goban-1.1.orig/ 0000755 0001750 0001750 00000000000 10271274052 011152 5 ustar al al goban-1.1.orig/Makefile.in 0000644 0001750 0001750 00000044474 10271270606 013235 0 ustar al al # Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/configure.h.in \
$(srcdir)/goban.spec.in $(top_srcdir)/configure COPYING TODO \
compile install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = configure.h
CONFIG_CLEAN_FILES = goban.spec
depcomp =
am__depfiles_maybe =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
GNOME_DATADIR = @GNOME_DATADIR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
AUTOMAKE_OPTIONS = foreign no-dependencies
SUBDIRS = src
SCREENSAVER_DATADIR = $(GNOME_DATADIR)/control-center/screensavers
EXTRA_DIST = games goban.xml goban.spec.in src/*.h README.screensaver
all: configure.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
configure.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/configure.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status configure.h
$(srcdir)/configure.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f configure.h stamp-h1
goban.spec: $(top_builddir)/config.status $(srcdir)/goban.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) configure.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) configure.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) configure.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) configure.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkdir_p) $(distdir)/. $(distdir)/src
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile configure.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am: install-data-local
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
check-am clean clean-generic clean-recursive ctags \
ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
dist-tarZ dist-zip distcheck distclean distclean-generic \
distclean-hdr distclean-recursive distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-data-local install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-info-am
install-data-local:
test -e $(SCREENSAVER_DATADIR) && $(INSTALL) goban.xml $(SCREENSAVER_DATADIR)
$(INSTALL) -d $(pkgdatadir)
$(INSTALL) games/* $(pkgdatadir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
goban-1.1.orig/README 0000644 0001750 0001750 00000015621 06436130660 012043 0 ustar al al README for cgoban 1.9.2 23 November 1997
----------------------------------------
Cgoban (Complete Goban) is for Unix systems with X11. It has the ability
to be a computerized go board, view and edit smart-go files, and connect to
go servers on the Internet.
I'm keeping a mailing list of people interested in cgoban. I will keep
the traffic very low. All I send out are announcements when new versions
are ready, along with a description of what is new/fixed in the new version.
If you want these announcements, then please send me mail at
"wms@hevanet.com".
HOW TO BUILD
------------
Cgoban uses the Gnu autoconf utility. To build and run it, follow these
steps:
1) Unpack it. You must have done this already to read this file. Make sure
that you "cd" into the cgoban directory (the directory that has this
README in it).
2) Type "./configure".
3) Type "make".
4) Type "cgoban". If all went well you should be running cgoban. Directions
on using cgoban are all available through the "help" buttons. For a
list of command line switches available, try "cgoban -help".
INSTALLING
----------
cgoban's build directories (that is, the directory that has this README
in it and all the subdirectories) take up a lot of disk space. After you
build it, you need nothing but the binary. You can install it by running
"make install" in the build directory; if you want to put it somewhere
besides "/usr/games/bin", then you should edit the Makefile, set "PREFIX"
to the place to put cgoban, then run "make install". After you've installed
the binary, feel free to delete everything but the binary.
IF YOU HAVE TROUBLE
-------------------
The section below this lists some systems that are known to have trouble
building. Check there to see if your system is on the list.
The most common problem is systems that need special switches to run "cc".
Your C compiler MUST be an ansi-compatible c compiler. If you have trouble
with "./configure" or if you have trouble compiling, try setting your
environment variable "CC" to be how to run your C compiler. For example,
on some HP/UX systems "make" will break unless you set "CC" to be
"cc -Aa -D_HPUX_SOURCE". On a csh-based system, you set this with:
$ setenv CC "cc -Aa -D_HPUX_SOURCE"
and on an sh-based system you need to type two lines:
$ CC="cc -Aa -D_HPUX_SOURCE"
$ export CC
After setting CC, run "./configure" again and then "make" again to see if it
works better.
Another problem is finding the X11 includes and/or libraries. If they
aren't founds when you are compiling, try running configure again, but
this time try "./configure --x-includes=
--x-libraries=" to
tell configure where your X includes and X libraries are.
KNOWN PROBLEM SYSTEMS
---------------------
HP/UX
Needs CC set as above, and sometimes needs the X directory set
by hand (also as shown above).
Linux Elf
Old Linux Elf libcs have a bug in sscanf that prevents cgoban from working
correctly. If you can see the "games" window in client mode, then everything
is fine. If you get an error window when you press the "games" button on the
client main window, then you need to get a newer version of libc and recompile.
I've heard that libc 5.3.12 works, so if you get that version or later you
should be OK.
VAX/Ultrix
Some systems have broken long longs. If you get an error referring to
"__ll_lshift" when you try to build, then edit obj-*/configure.h to change
"SIZEOF_LONG_LONG" to 0, then do a "make clean" then a "make".
AIX
There seems to be some broken AIX compilers out there (or it may be a
bug in Cgoban that only shows up on AIX). If your AIX system doesn't work
correctly try editing the Makefile and changing the CFLAGS line to have no
"-O" switch. Then do a "make clean" then "make" and see if it works better.
SPARC
There are some Sparc X systems that have a bug. When you start up cgoban,
your whole X server crashes. If this happens to you, get an upgrade from
Sun (they do have a bug fix out that will fix this).
FIREWALLS
---------
See the help for the "setup" window.
NOTE
----
Everybody complains that you can't resize the boards. Well, I'm working
on it. In the meantime, PLEASE see the man page about the "cgoban -fontHeight"
switch. With this you _can_ change the size of the board, but just not
"on the fly". For example, "cgoban -fontHeight 14" will make the boards a
little bit bigger (12 is the default); "cgoban -fontHeight 10" will make the
boards a little bit smaller.
ARENA MODE
----------
This is just for testing out go modem protocol programs. Run it like:
$ cgoban -arena.games 4 -arena.size 9 -arena.komi 5.5 -arena.prog1
"myprog-new" -arena.prog2 "myprog-old"
This will play myprog-new against myprog-old for four games, alternating
who plays white and who plays black. The output will look like:
0 12.5
1 0.5
0 30.5
0 3.5
Which means that myprog-new won the first, third, and fourth games by
12.5, 30.5, and 3.5 points, while myprog-old won the second game by 0.5 points.
Note that myprog-new and myprog-old *MUST* play until all dead stones are
removed from the game, since the scoring function does *NOT* remove dead
stones in arena mode. Scoring is done with Chinese rules so playing until
all the dead stones are gone won't count against your score.
Arena mode is kind of hacked in mostly for my benefit, so sorry but it
isn't real user-friendly.
THE grab_cgoban SHELL SCRIPT
----------------------------
If you use cgoban with a 12 point font, then the grab_cgoban shell script
will nicely take a snapshot of a cgoban board and save it as a .gif file. For
this script to work, you must have either the "imagemagick" or "pbmplus"
packages installed.
REVISION HISTORY
----------------
If the patchlevel changes, then it's just bug fixes. So for example 1.4.2
is just like 1.4.0 but some things that were broken are fixed.
0.0.0
Alpha version. Not all features are present.
0.1.0
First beta version. All features for the 1.0.0 release are present,
but there are still some blatant bugs.
1.0.0
First full release.
1.1.0
Lots-O-bug fixes! Tons of them!
Added support for "look" client command.
Added a prompt for the client.
Added ability to shift-click on a client game to move easily to a specific
move number.
Added "Say/Both/Kibitz" radio button.
Improved games list window to show flags, be more resizable, and
not crush columns together.
1.2.0
Spiffed up the configure window and added connect-with-telnet support for
the firewalled folks out there.
1.3.0
Added the ability to try out variations on server games that you are
observing or playing in.
1.4.0
Added file selector window, game info window, "Edit Game" buttons, and
keeping server game info around after the game ends.
1.5.2
Added support for more than two servers, arena mode, and the anti-slip
option. Also made it automatically run with no color if it can't get enough
instead of just whining about it.
1.6.3
Added server "match" GUI.
goban-1.1.orig/missing 0000755 0001750 0001750 00000024533 10267761603 012570 0 ustar al al #! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2004-09-07.08
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard , 1996.
# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to ."
exit 0
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit 0
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case "$1" in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
goban-1.1.orig/Makefile.am 0000644 0001750 0001750 00000000547 10271270417 013215 0 ustar al al AUTOMAKE_OPTIONS = foreign no-dependencies
SUBDIRS = src
SCREENSAVER_DATADIR = $(GNOME_DATADIR)/control-center/screensavers
install-data-local:
test -e $(SCREENSAVER_DATADIR) && $(INSTALL) goban.xml $(SCREENSAVER_DATADIR)
$(INSTALL) -d $(pkgdatadir)
$(INSTALL) games/* $(pkgdatadir)
EXTRA_DIST = games goban.xml goban.spec.in src/*.h README.screensaver
goban-1.1.orig/src/ 0000755 0001750 0001750 00000000000 10271274053 011742 5 ustar al al goban-1.1.orig/src/clp-x.h 0000644 0001750 0001750 00000001054 06143253010 013127 0 ustar al al /*
* wmslib/src/wms/clp.h, part of wmslib (Library functions)
* Copyright (C) 1994-1996 William Shubert.
* See "configure.h.in" for more copyright information.
*
* Command Line Parse.
*/
#ifndef _WMS_CLP_X_H_
#define _WMS_CLP_X_H_ 1
#ifndef _WMS_CLP_H_
#include
#endif
/**********************************************************************
* Functions
**********************************************************************/
extern void clp_rXDefaults(Clp *cltab, Display *dpy, const char *name);
#endif /* _WMS_CLP_X_H_ */
goban-1.1.orig/src/rcur.h 0000644 0001750 0001750 00000003350 10267775261 013103 0 ustar al al /*
* wmslib/include/but/rcur.h, part of wmslib (Library functions)
* Copyright (C) 1994-1995 William Shubert.
* See "configure.h.in" for more copyright information.
*
* Includes for remote cursors.
*/
#ifndef _BUTRCUR_H_
#define _BUTRCUR_H_ 1
/**********************************************************************
* Constants
**********************************************************************/
#define BUTCUR_NUM 10
/**********************************************************************
* Types
**********************************************************************/
/*
* Do not use butCur_bogus. It is a bogus cursor, _NOT_ a bogus-looking
* cursor.
*/
typedef enum {
butCur_idle, butCur_text, butCur_twitch, butCur_right, butCur_left,
butCur_up, butCur_down, butCur_lr, butCur_ud, butCur_grab, butCur_bogus}
ButCur;
typedef struct ButRcur_struct {
ButEnv *env;
int winId, rx,ry, rw,rh;
int lx,ly;
ButCur type;
bool drawn;
Pixmap under;
MAGIC_STRUCT
} ButRcur;
/**********************************************************************
* Functions
**********************************************************************/
/* Public. */
extern void butEnv_rcInit(ButEnv *env);
extern void butRcur_create(ButRcur *rc, ButEnv *env);
#define butRcur_destroy(rc) butRcur_move(-2, 0,0, 0,0);
extern void butRcur_move(ButRcur *rc, int winId, int rx,int ry,
int rw,int rh, ButCur type);
extern void butRcur_redraw(ButEnv *env, int winId, int x,int y, int w,int h);
/* The type of cursor has changed. */
extern void butEnv_setCursor(ButEnv *env, But *but, ButCur newCursor);
/* Set up any cursor changes that may have occurred. */
extern void butEnv_rcActivate(ButEnv *env);
#endif /* _BUTRCUR_H_ */
goban-1.1.orig/src/msg.c 0000644 0001750 0001750 00000045033 10270056445 012703 0 ustar al al /*
* src/msg.c, part of Complete Goban (game program)
* Copyright (C) 1995-1997 William Shubert
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include
#include
#include
#include "cgbuts.h" /* Included for CGBUTS_WSTONECHAR and CGBUTS_BSTONECHAR */
#ifdef _MSG_H_
Levelization Error.
#endif
#include "msg.h"
/**********************************************************************
* Globals
**********************************************************************/
const char msg_mFonts[] =
"-adobe-utopia-medium-r-normal--%d-*-*-*-*-*-*-*/"
"-adobe-times-medium-r-normal--%d-*-*-*-*-*-*-*/"
"-bitstream-charter-medium-r-normal--%d-*-*-*-*-*-*-*";
const char msg_labelFonts[] =
"-adobe-helvetica-bold-r-normal--%d-*-*-*-*-*-*-*";
const char msg_bFonts[] =
"-adobe-utopia-bold-r-normal--%d-*-*-*-*-*-*-*/"
"-adobe-times-bold-r-normal--%d-*-*-*-*-*-*-*/"
"-bitstream-charter-black-r-normal--%d-*-*-*-*-*-*-*";
/*
* From crwin.c
*/
const char msg_byBillShubert[] =
"Copyright \251 1995-1996 William Shubert";
const char msg_noWarranty[] = "Cgoban comes with ABSOLUTELY NO WARRANTY "
"and is free software.";
const char msg_seeHelp[] = "Please see the file \"COPYING\" for more "
"details.";
/* From "cgoban.c" */
const char msg_path[] = "Path:";
const char msg_file[] = "File:";
const char msg_mask[] = "Mask:";
const char msg_dirs[] = "Directories";
const char msg_files[] = "Files";
const char msg_dirErr[] =
"Error \"%s\" occurred while trying to read directory \"%s\".";
const char msg_notEnoughColors[] =
" Cgoban can't get enough colors. You probably have programs running "
"that use a lot of colors, like Netscape or image viewers. Cgoban will "
"run in black and white mode; if you want to run cgoban in color, then "
"you must exit from the problem applications and run cgoban again.";
/*
* From control.c
*/
const char msg_newGame[] = "New Game";
const char msg_loadGame[] = "Load Game";
const char msg_editSGF[] = "Edit SGF File";
const char msg_goModem[] = "Go Modem";
const char msg_quit[] = "Quit";
const char msg_setup[] = "Setup";
const char msg_loadGameName[] = "Select the file to load:";
const char msg_editGameName[] = "Select the file to edit:";
/*
* Buttons from gameSetup.c
*/
const char msg_gSetup[] = "Game Setup";
const char msg_wName[] = CGBUTS_WSTONECHAR " White:";
const char msg_bName[] = CGBUTS_BSTONECHAR " Black:";
const char msg_ruleSet[] = "Rules Set";
const char *msg_ruleNames[] =
{"Chinese", "Japanese", "Ing", "AGA", "New Zealand", "Tibetan",
BUTMENU_OLEND};
const char msg_boardSize[] = "Board Size";
const char msg_handicap[] = "Handicap";
const char msg_komi[] = "Komi";
const char msg_ok[] = "OK";
const char msg_cancel[] = "Cancel";
const char msg_timeSystem[] = "Time System";
const char *msg_timeSystems[] =
{"None", "Absolute", "Japanese", "Canadian", "Ing", BUTMENU_OLEND};
const char msg_primaryTime[] = "Main Time";
const char msg_byoYomi[] = "Byo-Yomi Time";
const char msg_byoYomiStones[] = "Stones per Byo-Yomi";
const char msg_byoYomiCount[] = "Byo-Yomi Periods";
const char msg_badSize[] = "\"%s\" is an invalid size. The size should be "
"a number from 2 through %d.";
const char msg_badHcap[] = "\"%s\" is an invalid handicap. The handicap "
"should be zero or a number from 2 through %d.";
const char msg_badKomi[] = "\"%s\" is an invalid komi. The komi should be "
"be a number, possibly with 0.5 (one-half) added.";
const char msg_localTitle[] = "%s (W) vs. %s (B)";
const char msg_noTitle[] = "No Title";
const char msg_badTime[] = "\"%s\" is not a legal time. Use either "
"just minutes, \"mm:ss\", or \"hh:mm:ss\" "
"formats.";
const char msg_badBYStones[] = "\"%s\" is not a legal byo-yomi stone "
"count. Use any positive number.";
const char msg_badBYCount[] = "\"%s\" is not a legal value for the "
"number of byo-yomi periods. Use a "
"positive whole number.";
/*
* Text from local.c
*/
const char msg_notCgobanFile[] =
"\"%s\" is not a Cgoban save game. You may "
"edit this SGF file, but you can not continue the game.";
const char msg_gameInfo[] = "Game Info";
const char msg_help[] = "Help";
const char msg_pass[] = "Pass";
const char msg_done[] = "Done";
const char msg_resume[] = "Resume";
const char msg_dispute[] = "Dispute";
const char msg_saveGame[] = "Save Game";
const char msg_editGame[] = "Edit Game";
const char msg_score[] = "Score:";
const char msg_time[] = "Time: ";
const char msg_localChiRemDead[] = "Now you must remove all dead stones. "
"Click on a group to mark them as dead. "
"Press \"Done\" when all dead groups are "
"removed. Press \"Resume\" or \""
CGBUTS_BACKCHAR "\" if you want to go "
"back to the game.";
const char msg_localJapRemDead[] = "Now you must remove all dead stones. "
"Click on a group to mark them as dead. "
"Press \"Done\" when all dead groups are "
"removed. Press \"Dispute\" if the "
"players cannot agree which stones are "
"dead. Press \"" CGBUTS_BACKCHAR
"\" to continue the game.";
const char msg_selectDisputedMsg[] =
"Click on the stones that are disputed, then play to determine whether "
"the stones are alive or dead. Pass when you are satisfied with the fate "
"of the stones.";
const char *msg_stoneNames[] = {"White", "Black", "Empty"};
const char msg_gameStartDesc[] = "Game Start: ";
const char msg_move1Desc[] = "Move 1 (%c %s): ";
const char msg_move1OfDesc[] = "Move 1 (%c %s) of %d: ";
const char msg_moveNDesc[] = "Moves 1 to %d (%c %s): ";
const char msg_moveNOfDesc[] = "Moves 1 to %d (%c %s) of %d: ";
const char msg_toPlay[] = " to play";
const char msg_selectDead[] = "Select Dead Stones";
const char msg_selectDisputed[] = "Select Disputed Stones";
const char msg_whiteWon[] = "Game Over: White Won";
const char msg_blackWon[] = "Game Over: Black Won";
const char msg_jigo[] = "Game Over: Jigo (Tie Game)";
const char msg_timeLossInfo[] = "Game Over: %s has run out of time";
const char msg_disputeAnnounce[] = "Dispute (%s): %s to play";
const char msg_alive[] = "Alive";
const char msg_dead[] = "Dead";
const char msg_disputeOverAlive[] =
"At least one disputed stone is still alive, so they will all stay on "
"the board. You may now select more dead stones, or press \"Done\".";
const char msg_disputeOverDead[] =
"All disputed stones are dead, so they will be removed from the board. "
"You may now select more dead stones, or press \"Done\".";
const char msg_scoreKillsComment[] =
"The game is over. Final score:\n"
" White = %d territory + %d captures + %g komi%s = %g\n"
" Black = %d territory + %d captures%s = %g\n";
const char msg_scoreNoKillsComment[] =
"The game is over. Final score:\n"
" White = %d territory + %d living stones + %g dame + %g komi%s = %g\n"
" Black = %d territory + %d living stones + %g dame%s = %g\n";
const char msg_ingPenaltyComment[] =
" - %d Ing Time Penalty";
const char msg_winnerComment[] = "%s wins by %g.";
const char msg_jigoComment[] = "Jigo (Tie game).";
const char msg_gameIsOver[] = "The game is over. %s";
const char msg_saveGameName[] = "Enter the file name for the game:";
const char msg_timeLoss[] = "%s has run out of time. %s wins.";
const char msg_reallyQuitGame[] =
"You have changed this game since you last saved it. Are you sure that "
"you want to quit without saving?";
/* From "goban.c" */
const char msg_say[] = "Say";
const char msg_both[] = "Both";
const char msg_kib[] = "Kib";
/* From movechain.c */
const char msg_mcReadErr[] = "System error \"%s\" occurred while trying to read "
" file \"%s\".";
const char msg_badSGFFile[] = "File \"%s\" has %s on line %d. It "
"cannot be read in.";
const char msg_sgfBadToken[] = "a bad token";
const char msg_sgfEarlyEOF[] = "an unexpected EOF";
const char msg_sgfBadLoc[] = "a bad board position";
const char msg_sgfBadArg[] = "a bad argument";
/* From editBoard.c */
const char msg_printGame[] = "Print Game";
const char msg_noSuchGame[] =
"Sorry, file \"%s\" cannot be found. To create a new smart-go file, "
"use \"New Game\" from the control panel, then press \"Edit Game\" "
"once the game has started.";
const char msg_reallyQuit[] =
"File \"%s\" has been changed since you last saved it. Are you sure that "
"you want to quit and lose your changes?";
const char msg_noCancel[] = "No, Cancel";
const char msg_yesQuit[] = "Yes, Quit";
const char msg_changeNodeWhileScoring[] = "You cannot change nodes while "
"you are scoring a game. Please change to a different tool.";
/* From editTools.c */
const char *msg_toolNames[] = {
"Play Game", "Edit Board", "Compute Score", "Add Triangle", "Add Square",
"Add Circle", "Add Letter", "Number Stones"};
const char *msg_toolDesc1[] = {
"Click to play a stone",
"Click to add/remove white stones",
"Click to mark stones as dead",
"Click to add/remove triangle marks",
"Click to add/remove square marks",
"Click to add/remove circle marks",
"Click to add/remove letters",
"Click to add/remove numbers starting at 1"};
const char *msg_toolDesc2[] = {
"Shift-click to go to when a move was made",
"Shift-click to add/remove black stones",
"Press \"Done\" to record score",
"Shift-click to mark groups of stones",
"Shift-click to mark groups of stones",
"Shift-click to mark groups of stones",
"",
"Shift-click to add/remove move numbers"};
const char msg_killNode[] = "Delete Moves";
const char msg_moveNode[] = "Reorder Moves";
/* From "editInfo.c" */
const char msg_editInfoTitle[] = "SGF Game Info";
const char msg_copyrightC[] = "Copyright:";
const char msg_gameTitle[] = "Title:";
const char msg_result[] = "Result:";
const char msg_wStoneName[] = CGBUTS_WSTONECHAR " Name:";
const char msg_bStoneName[] = CGBUTS_BSTONECHAR " Name:";
const char msg_wRank[] = CGBUTS_WSTONECHAR " Rank:";
const char msg_bRank[] = CGBUTS_BSTONECHAR " Rank:";
const char msg_handicapC[] = "Handicap:";
const char msg_komiC[] = "Komi:";
const char msg_date[] = "Date:";
const char msg_place[] = "Place:";
const char msg_event[] = "Event:";
const char msg_source[] = "Source:";
/* From gmpSetup.c */
const char msg_gmpSetup[] = "Go Modem Protocol Setup";
const char *msg_gmpPlayers[] = {CGBUTS_WSTONECHAR " White Player",
CGBUTS_BSTONECHAR " Black Player"};
const char *msg_gmpTypes[] =
{"Program", "Device", "Human", "NNGS", "IGS", "Local Port", "Remote Port",
BUTMENU_OLEND};
const char msg_program[] = "Program";
const char msg_device[] = "Device";
const char msg_machineName[] = "Machine Name";
const char msg_port[] = "Port";
const char msg_username[] = "Username";
const char msg_password[] = "Password";
const char msg_waitingForGame[] =
"Waiting for go modem handshaking to complete.";
const char msg_noUndoFromGmpToClient[] =
"A request to undo the last move came from the go modem protocol "
"connection. This is not supported when you are playing on a go server. "
"The undo request will be ignored.";
const char msg_badPortNum[] =
"\"%s\" is not a valid port. Your ports should be a value from 1 through "
"65535. \"26276\" is the default port.";
const char msg_progRunErr[] =
"System error \"%s\" occurred while trying to run program \"%s\".";
const char msg_devOpenErr[] =
"System error \"%s\" occurred while trying to open device program \"%s\".";
const char msg_gmpTooBig[] =
"The go modem protocol does not permit games to be played on a board "
"larger than 22x22.";
/* From gmpPlay.c */
const char msg_gmpMoveOutsideGame[] =
"A move was received from the go modem protocol when the game was not "
"in progress!";
const char msg_gmpBadMove[] =
"An illegal move at location %s was received from the go modem protocol.";
const char msg_undoRequested[] =
"Player %s requested to undo %d moves.";
const char msg_badNewGameReq[] =
"Player %s wants to start a new game. You may restart a new game "
"manually if you wish.";
const char msg_gmpCouldntStart[] =
"Command line \"%s\" could not be executed. Please make sure that you have "
"completely specified the programs path.";
const char msg_gmpProgDied[] =
"Program \"%s\" exitted unexpectedly with status %d.";
const char msg_gmpProgKilled[] =
"Program \"%s\" was unexpectedly killed by signal %d.";
const char msg_gmpProgWhyDead[] =
"Program \"%s\" is dead, but I can't figure out why.";
/* From gmp.c */
const char msg_gmpDead[] =
"System error \"%s\" occurred over the go modem protocol link.";
const char msg_gmpTimeout[] =
"The go modem protocol connection has timed out.";
const char msg_gmpSendBufFull[] =
"The go modem protocol is out of send buffer space.";
/* From cliLogin.c */
const char *msg_loginDesc[] = {
"Please enter your NNGS username and password here. If you do not yet "
"have an account, just leave the password blank and you will be logged in "
"as an unregistered user.",
"Please enter your IGS username and password here. If you do not yet "
"have an account, fill in \"guest\" for your username."};
const char msg_usernameColon[] = "Username:";
const char msg_passwordColon[] = "Password:";
const char msg_cliOpenSocket[] =
"Error \"%s\" while trying to open a socket to contact %s.";
const char msg_cliLookup[] =
"The machine \"%s\" couldn't be found in host lookup tables. Either "
"this machine does not exist or there is something wrong with your "
"name server.";
const char msg_cliConnect[] =
"Error \"%s\" occurred while trying to connect to %s.";
const char msg_cliHangup[] =
"Your connection to server %s was lost due to \"%s\".";
const char msg_notAGuest[] = "Sorry, the username \"%s\" seems to be "
"taken already! You must either supply a password or choose another name "
"to use while you are a guest.";
const char msg_guest[] = "You have logged in as a guest. You may use "
"the \"register\" command to get a full account.";
const char msg_loginFailed[] = "Sorry, your password seems to be wrong "
"for the account name you gave. Please try another password or another "
"account.";
const char msg_login[] = "The connection to %s has been established. "
"Login is in progress.";
/* From client/board.c */
const char msg_cliGameName[] = "Game %d: %s %s (W) vs. %s %s (B)";
const char msg_close[] = "Close";
const char msg_adjourn[] = "Adjourn";
const char msg_resign[] = "Resign";
const char msg_yesResign[] = "Yes, Resign";
const char msg_reallyResign[] = "You have pressed \"Resign\" which will "
"end the game and give your opponent victory. Are you sure that you "
"want to do this?";
const char msg_cliGameBadMove[] = "Move \"%s\" in game %d came from the "
"server. This does not seem to be a legal move. Sorry, I'm not sure what "
"to do now.";
/* From client/conn.c */
const char msg_commandError[] = "The command \"%s\" exited with error "
"return code %d.";
/* From client/look.c */
const char msg_cliLookName[] = "%s %s (W) vs. %s %s (B)";
const char msg_cliLookInfo[] = "Static Game Board";
/* From client/main.c */
const char msg_log[] = "Log";
const char msg_players[] = "Players";
const char msg_games[] = "Games";
/* From client/game.c */
const char msg_gameGoneResign[] =
"The game has ended; %s has resigned. Press the \"Close\" button to "
"remove this board.";
const char msg_gameResultResign[] = "Move %d: %s resigns";
const char msg_gameGoneAdjourn[] =
"The game has been adjourned. Press the \"Close\" button to remove this "
"board.";
const char msg_gameResultAdjourn[] = "Move %d: Game adjourned";
const char msg_gameGoneTime[] =
"The game has ended; %s ran out of time and lost. Press the \"Close\" "
"button to remove this board.";
const char msg_gameResultTime[] = "Move %d: %s runs out of time";
const char msg_gameGoneScore[] =
"The game has ended. The final score is White %g points, Black %g "
"points. %s wins.";
const char msg_gameResultScore[] = "Move %d: %s wins, %g to %g";
const char msg_gameGone[] = "This game has ended on the server. You can "
"continue to look at the game, but your kibitzes, etc. will not be seen "
"by other players.";
const char msg_gameListDesc[] = "\t#\tWhite\t\tBlack\tMv\tSz\tH\tKm\tFl\tOb";
const char msg_gameBadElf[] =
" Cgoban is having trouble interpreting data from the server. This "
"probably means that this cgoban binary was built on an old Linux Elf "
"system. Older Linux Elf systems have a bug in sscanf that prevents "
"cgoban from functioning properly. Please see the cgoban README for more "
"information.";
/* From client/player.c */
const char msg_name[] = "Name";
const char msg_braceRank[] = "[Rank]";
const char msg_state[] = "State";
const char msg_playerListDesc[] = "\tIdle\tGm";
/* From setup.c */
const char msg_selServer[] = "Server to Edit";
const char msg_setupTitle[] = "Cgoban Setup";
const char msg_gsCompName[] = "Machine Name:";
const char msg_gsPortNum[] = "Port Number:";
const char msg_clientBadPortNum[] =
"\"%s\" is not a valid port. Your ports should be a value from 1 through "
"65535. The default ports are 9696 for NNGS servers and 6969 for "
"IGS servers.";
const char msg_srvConfig[] = "Connecting To Server";
const char msg_directConn[] = "Connect Directly To Server";
const char msg_connCmdLabel[] = "Connecting Command:";
const char msg_miscellaneous[] = "Miscellaneous";
const char msg_showCoordinates[] = "Show Coordinates Around Boards";
const char msg_numberKibitzes[] = "Number Kibitzes";
const char msg_hiContrast[] = "High Contrast Stones";
const char msg_noTypo[] = "Anti-Slip Moving";
const char msg_setupSrvName[] = "Server Name:";
const char msg_setupProtocol[] = "Server Protocol:";
/* From client/match.c */
const char msg_swapColors[] = "Swap Colors";
const char msg_cliGameSetup[] = "Server Game Setup";
const char msg_cliGameSetupSent[] = "Server Game Setup - Challenge Sent";
const char msg_cliGameSetupRej[] = "Server Game Setup - Challenge Rejected";
const char msg_cliGameSetupRecvd[] = "Server Game Setup - Challenge Received";
const char msg_freeGame[] = "Free (Unrated) Game";
const char msg_youDontExist[] = "Sorry, an error has happened. Somehow "
"you don't seem to be in the player list, so I can't start up the "
"challenge! You might want to try pressing "
"the \"reload\" button on the player list to see if that helps. This may "
"also mean that you are a guest on IGS.";
/* From "sgfPlay.c" */
const char msg_badMoveInSgf[] = "The SGF file has \"%s\" as move "
"number %d. This is not a legal move, so it will not be placed on the "
"board";
goban-1.1.orig/src/menu.h 0000644 0001750 0001750 00000003612 06156372606 013073 0 ustar al al /*
* wmslib/src/but/menu.h, part of wmslib (Library functions)
* Copyright (C) 1995-1996 William Shubert.
* See "configure.h.in" for more copyright information.
*
* Includes for menu.c
*/
#ifndef _BUT_MENU_H_
#define _BUT_MENU_H_ 1
/**********************************************************************
* Constants
**********************************************************************/
#define BUTMENU_OLEND NULL
#define BUTMENU_OLBREAK (&butMenu_dummy)
#define BUTMENU_DISABLED 1 /* Flags. */
#define BUTMENU_END 2 /* Private. */
#define BUTMENU_BREAK 4 /* Private. */
/**********************************************************************
* Global variables
**********************************************************************/
/* Private. */
extern char butMenu_dummy;
/**********************************************************************
* Functions
**********************************************************************/
extern But *butMenu_upCreate(ButOut (*func)(But *but, int value),
void *packet, ButWin *win, int layer,
int toplayer, int flags, const char *title,
const char *optlist[], int cur_opt);
extern But *butMenu_downCreate(ButOut (*func)(But *but, int value),
void *packet, ButWin *win, int layer,
int toplayer, int flags, const char *title,
const char *optlist[], int cur_opt);
extern void butMenu_set(But *but, int new_opt);
extern int butMenu_get(But *but);
extern void butMenu_setColor(But *but, int fg, int bg);
/* If newcval is -1, then it will be left unchanged. */
extern void butMenu_setText(But *but, const char *title,
const char *optlist[], int newcval);
extern void butMenu_setOptionName(But *but, const char *new, int entryNum);
/*
* flags should be from the BUTMENU_DISABLED list above.
*/
extern void butMenu_setFlags(But *but, int optnum, uint flags);
#endif /* _BUT_MENU_H_ */
goban-1.1.orig/src/Makefile.in 0000644 0001750 0001750 00000140345 10271264567 014027 0 ustar al al # Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SOURCES = $(goban_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
bin_PROGRAMS = goban$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/configure.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_goban_OBJECTS = goban-abut.$(OBJEXT) goban-abut_help.$(OBJEXT) \
goban-abut_msg.$(OBJEXT) goban-arena.$(OBJEXT) \
goban-board.$(OBJEXT) goban-box.$(OBJEXT) goban-but.$(OBJEXT) \
goban-canvas.$(OBJEXT) goban-cgbuts.$(OBJEXT) \
goban-cgoban.$(OBJEXT) goban-checkbox.$(OBJEXT) \
goban-client.$(OBJEXT) goban-client_main.$(OBJEXT) \
goban-client_setup.$(OBJEXT) goban-clp.$(OBJEXT) \
goban-clp-x.$(OBJEXT) goban-cm2pm.$(OBJEXT) \
goban-conn.$(OBJEXT) goban-control.$(OBJEXT) \
goban-crwin.$(OBJEXT) goban-ctext.$(OBJEXT) \
goban-data.$(OBJEXT) goban-drawStone.$(OBJEXT) \
goban-editBoard.$(OBJEXT) goban-editInfo.$(OBJEXT) \
goban-editTool.$(OBJEXT) goban-engine.$(OBJEXT) \
goban-fsel.$(OBJEXT) goban-game.$(OBJEXT) \
goban-gameSetup.$(OBJEXT) goban-goban.$(OBJEXT) \
goban-goBoard.$(OBJEXT) goban-goGame.$(OBJEXT) \
goban-goHash.$(OBJEXT) goban-goPic.$(OBJEXT) \
goban-goScore.$(OBJEXT) goban-goTime.$(OBJEXT) \
goban-help.$(OBJEXT) goban-i_finder.$(OBJEXT) \
goban-i_general.$(OBJEXT) goban-i_snd.$(OBJEXT) \
goban-i_win.$(OBJEXT) goban-list.$(OBJEXT) \
goban-local.$(OBJEXT) goban-login.$(OBJEXT) \
goban-look.$(OBJEXT) goban-lsetup.$(OBJEXT) \
goban-main.$(OBJEXT) goban-match.$(OBJEXT) \
goban-menu.$(OBJEXT) goban-menu_snd.$(OBJEXT) \
goban-msg.$(OBJEXT) goban-net.$(OBJEXT) goban-plain.$(OBJEXT) \
goban-plasma.$(OBJEXT) goban-play.$(OBJEXT) \
goban-player.$(OBJEXT) goban-radio.$(OBJEXT) \
goban-rcur.$(OBJEXT) goban-rnd.$(OBJEXT) \
goban-screensaver.$(OBJEXT) goban-server.$(OBJEXT) \
goban-setup.$(OBJEXT) goban-sgf.$(OBJEXT) \
goban-sgfIn.$(OBJEXT) goban-sgfMap.$(OBJEXT) \
goban-sgfOut.$(OBJEXT) goban-sgfPlay.$(OBJEXT) \
goban-slide.$(OBJEXT) goban-snd.$(OBJEXT) goban-str.$(OBJEXT) \
goban-swin.$(OBJEXT) goban-tbin.$(OBJEXT) \
goban-tblock.$(OBJEXT) goban-term.$(OBJEXT) \
goban-text.$(OBJEXT) goban-textin.$(OBJEXT) \
goban-timer.$(OBJEXT) goban-wms.$(OBJEXT) \
goban-write.$(OBJEXT)
goban_OBJECTS = $(am_goban_OBJECTS)
goban_DEPENDENCIES =
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(goban_SOURCES)
DIST_SOURCES = $(goban_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
GNOME_DATADIR = @GNOME_DATADIR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
AUTOMAKE_OPTIONS = foreign no-dependencies
AM_CFLAGS = -DPACKAGE_DATA_DIR=\"$(pkgdatadir)\"
goban_SOURCES = abut.c abut_help.c abut_msg.c arena.c board.c box.c but.c canvas.c cgbuts.c cgoban.c checkbox.c client.c client_main.c client_setup.c clp.c clp-x.c cm2pm.c conn.c control.c crwin.c ctext.c data.c drawStone.c editBoard.c editInfo.c editTool.c engine.c fsel.c game.c gameSetup.c goban.c goBoard.c goGame.c goHash.c goPic.c goScore.c goTime.c help.c i_finder.c i_general.c i_snd.c i_win.c list.c local.c login.c look.c lsetup.c main.c match.c menu.c menu_snd.c msg.c net.c plain.c plasma.c play.c player.c radio.c rcur.c rnd.c screensaver.c server.c setup.c sgf.c sgfIn.c sgfMap.c sgfOut.c sgfPlay.c slide.c snd.c str.c swin.c tbin.c tblock.c term.c text.c textin.c timer.c wms.c write.c
goban_CFLAGS = @X_CFLAGS@ $(AM_CFLAGS)
goban_LDADD = @X_LIBS@ -lX11 @X_EXTRA_LIBS@ -lm
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
goban$(EXEEXT): $(goban_OBJECTS) $(goban_DEPENDENCIES)
@rm -f goban$(EXEEXT)
$(LINK) $(goban_LDFLAGS) $(goban_OBJECTS) $(goban_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
.c.o:
$(COMPILE) -c $<
.c.obj:
$(COMPILE) -c `$(CYGPATH_W) '$<'`
goban-abut.o: abut.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-abut.o `test -f 'abut.c' || echo '$(srcdir)/'`abut.c
goban-abut.obj: abut.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-abut.obj `if test -f 'abut.c'; then $(CYGPATH_W) 'abut.c'; else $(CYGPATH_W) '$(srcdir)/abut.c'; fi`
goban-abut_help.o: abut_help.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-abut_help.o `test -f 'abut_help.c' || echo '$(srcdir)/'`abut_help.c
goban-abut_help.obj: abut_help.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-abut_help.obj `if test -f 'abut_help.c'; then $(CYGPATH_W) 'abut_help.c'; else $(CYGPATH_W) '$(srcdir)/abut_help.c'; fi`
goban-abut_msg.o: abut_msg.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-abut_msg.o `test -f 'abut_msg.c' || echo '$(srcdir)/'`abut_msg.c
goban-abut_msg.obj: abut_msg.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-abut_msg.obj `if test -f 'abut_msg.c'; then $(CYGPATH_W) 'abut_msg.c'; else $(CYGPATH_W) '$(srcdir)/abut_msg.c'; fi`
goban-arena.o: arena.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-arena.o `test -f 'arena.c' || echo '$(srcdir)/'`arena.c
goban-arena.obj: arena.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-arena.obj `if test -f 'arena.c'; then $(CYGPATH_W) 'arena.c'; else $(CYGPATH_W) '$(srcdir)/arena.c'; fi`
goban-board.o: board.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-board.o `test -f 'board.c' || echo '$(srcdir)/'`board.c
goban-board.obj: board.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-board.obj `if test -f 'board.c'; then $(CYGPATH_W) 'board.c'; else $(CYGPATH_W) '$(srcdir)/board.c'; fi`
goban-box.o: box.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-box.o `test -f 'box.c' || echo '$(srcdir)/'`box.c
goban-box.obj: box.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-box.obj `if test -f 'box.c'; then $(CYGPATH_W) 'box.c'; else $(CYGPATH_W) '$(srcdir)/box.c'; fi`
goban-but.o: but.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-but.o `test -f 'but.c' || echo '$(srcdir)/'`but.c
goban-but.obj: but.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-but.obj `if test -f 'but.c'; then $(CYGPATH_W) 'but.c'; else $(CYGPATH_W) '$(srcdir)/but.c'; fi`
goban-canvas.o: canvas.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-canvas.o `test -f 'canvas.c' || echo '$(srcdir)/'`canvas.c
goban-canvas.obj: canvas.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-canvas.obj `if test -f 'canvas.c'; then $(CYGPATH_W) 'canvas.c'; else $(CYGPATH_W) '$(srcdir)/canvas.c'; fi`
goban-cgbuts.o: cgbuts.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-cgbuts.o `test -f 'cgbuts.c' || echo '$(srcdir)/'`cgbuts.c
goban-cgbuts.obj: cgbuts.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-cgbuts.obj `if test -f 'cgbuts.c'; then $(CYGPATH_W) 'cgbuts.c'; else $(CYGPATH_W) '$(srcdir)/cgbuts.c'; fi`
goban-cgoban.o: cgoban.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-cgoban.o `test -f 'cgoban.c' || echo '$(srcdir)/'`cgoban.c
goban-cgoban.obj: cgoban.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-cgoban.obj `if test -f 'cgoban.c'; then $(CYGPATH_W) 'cgoban.c'; else $(CYGPATH_W) '$(srcdir)/cgoban.c'; fi`
goban-checkbox.o: checkbox.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-checkbox.o `test -f 'checkbox.c' || echo '$(srcdir)/'`checkbox.c
goban-checkbox.obj: checkbox.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-checkbox.obj `if test -f 'checkbox.c'; then $(CYGPATH_W) 'checkbox.c'; else $(CYGPATH_W) '$(srcdir)/checkbox.c'; fi`
goban-client.o: client.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-client.o `test -f 'client.c' || echo '$(srcdir)/'`client.c
goban-client.obj: client.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-client.obj `if test -f 'client.c'; then $(CYGPATH_W) 'client.c'; else $(CYGPATH_W) '$(srcdir)/client.c'; fi`
goban-client_main.o: client_main.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-client_main.o `test -f 'client_main.c' || echo '$(srcdir)/'`client_main.c
goban-client_main.obj: client_main.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-client_main.obj `if test -f 'client_main.c'; then $(CYGPATH_W) 'client_main.c'; else $(CYGPATH_W) '$(srcdir)/client_main.c'; fi`
goban-client_setup.o: client_setup.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-client_setup.o `test -f 'client_setup.c' || echo '$(srcdir)/'`client_setup.c
goban-client_setup.obj: client_setup.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-client_setup.obj `if test -f 'client_setup.c'; then $(CYGPATH_W) 'client_setup.c'; else $(CYGPATH_W) '$(srcdir)/client_setup.c'; fi`
goban-clp.o: clp.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-clp.o `test -f 'clp.c' || echo '$(srcdir)/'`clp.c
goban-clp.obj: clp.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-clp.obj `if test -f 'clp.c'; then $(CYGPATH_W) 'clp.c'; else $(CYGPATH_W) '$(srcdir)/clp.c'; fi`
goban-clp-x.o: clp-x.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-clp-x.o `test -f 'clp-x.c' || echo '$(srcdir)/'`clp-x.c
goban-clp-x.obj: clp-x.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-clp-x.obj `if test -f 'clp-x.c'; then $(CYGPATH_W) 'clp-x.c'; else $(CYGPATH_W) '$(srcdir)/clp-x.c'; fi`
goban-cm2pm.o: cm2pm.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-cm2pm.o `test -f 'cm2pm.c' || echo '$(srcdir)/'`cm2pm.c
goban-cm2pm.obj: cm2pm.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-cm2pm.obj `if test -f 'cm2pm.c'; then $(CYGPATH_W) 'cm2pm.c'; else $(CYGPATH_W) '$(srcdir)/cm2pm.c'; fi`
goban-conn.o: conn.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-conn.o `test -f 'conn.c' || echo '$(srcdir)/'`conn.c
goban-conn.obj: conn.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-conn.obj `if test -f 'conn.c'; then $(CYGPATH_W) 'conn.c'; else $(CYGPATH_W) '$(srcdir)/conn.c'; fi`
goban-control.o: control.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-control.o `test -f 'control.c' || echo '$(srcdir)/'`control.c
goban-control.obj: control.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-control.obj `if test -f 'control.c'; then $(CYGPATH_W) 'control.c'; else $(CYGPATH_W) '$(srcdir)/control.c'; fi`
goban-crwin.o: crwin.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-crwin.o `test -f 'crwin.c' || echo '$(srcdir)/'`crwin.c
goban-crwin.obj: crwin.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-crwin.obj `if test -f 'crwin.c'; then $(CYGPATH_W) 'crwin.c'; else $(CYGPATH_W) '$(srcdir)/crwin.c'; fi`
goban-ctext.o: ctext.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-ctext.o `test -f 'ctext.c' || echo '$(srcdir)/'`ctext.c
goban-ctext.obj: ctext.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-ctext.obj `if test -f 'ctext.c'; then $(CYGPATH_W) 'ctext.c'; else $(CYGPATH_W) '$(srcdir)/ctext.c'; fi`
goban-data.o: data.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-data.o `test -f 'data.c' || echo '$(srcdir)/'`data.c
goban-data.obj: data.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-data.obj `if test -f 'data.c'; then $(CYGPATH_W) 'data.c'; else $(CYGPATH_W) '$(srcdir)/data.c'; fi`
goban-drawStone.o: drawStone.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-drawStone.o `test -f 'drawStone.c' || echo '$(srcdir)/'`drawStone.c
goban-drawStone.obj: drawStone.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-drawStone.obj `if test -f 'drawStone.c'; then $(CYGPATH_W) 'drawStone.c'; else $(CYGPATH_W) '$(srcdir)/drawStone.c'; fi`
goban-editBoard.o: editBoard.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-editBoard.o `test -f 'editBoard.c' || echo '$(srcdir)/'`editBoard.c
goban-editBoard.obj: editBoard.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-editBoard.obj `if test -f 'editBoard.c'; then $(CYGPATH_W) 'editBoard.c'; else $(CYGPATH_W) '$(srcdir)/editBoard.c'; fi`
goban-editInfo.o: editInfo.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-editInfo.o `test -f 'editInfo.c' || echo '$(srcdir)/'`editInfo.c
goban-editInfo.obj: editInfo.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-editInfo.obj `if test -f 'editInfo.c'; then $(CYGPATH_W) 'editInfo.c'; else $(CYGPATH_W) '$(srcdir)/editInfo.c'; fi`
goban-editTool.o: editTool.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-editTool.o `test -f 'editTool.c' || echo '$(srcdir)/'`editTool.c
goban-editTool.obj: editTool.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-editTool.obj `if test -f 'editTool.c'; then $(CYGPATH_W) 'editTool.c'; else $(CYGPATH_W) '$(srcdir)/editTool.c'; fi`
goban-engine.o: engine.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-engine.o `test -f 'engine.c' || echo '$(srcdir)/'`engine.c
goban-engine.obj: engine.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-engine.obj `if test -f 'engine.c'; then $(CYGPATH_W) 'engine.c'; else $(CYGPATH_W) '$(srcdir)/engine.c'; fi`
goban-fsel.o: fsel.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-fsel.o `test -f 'fsel.c' || echo '$(srcdir)/'`fsel.c
goban-fsel.obj: fsel.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-fsel.obj `if test -f 'fsel.c'; then $(CYGPATH_W) 'fsel.c'; else $(CYGPATH_W) '$(srcdir)/fsel.c'; fi`
goban-game.o: game.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-game.o `test -f 'game.c' || echo '$(srcdir)/'`game.c
goban-game.obj: game.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-game.obj `if test -f 'game.c'; then $(CYGPATH_W) 'game.c'; else $(CYGPATH_W) '$(srcdir)/game.c'; fi`
goban-gameSetup.o: gameSetup.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-gameSetup.o `test -f 'gameSetup.c' || echo '$(srcdir)/'`gameSetup.c
goban-gameSetup.obj: gameSetup.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-gameSetup.obj `if test -f 'gameSetup.c'; then $(CYGPATH_W) 'gameSetup.c'; else $(CYGPATH_W) '$(srcdir)/gameSetup.c'; fi`
goban-goban.o: goban.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goban.o `test -f 'goban.c' || echo '$(srcdir)/'`goban.c
goban-goban.obj: goban.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goban.obj `if test -f 'goban.c'; then $(CYGPATH_W) 'goban.c'; else $(CYGPATH_W) '$(srcdir)/goban.c'; fi`
goban-goBoard.o: goBoard.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goBoard.o `test -f 'goBoard.c' || echo '$(srcdir)/'`goBoard.c
goban-goBoard.obj: goBoard.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goBoard.obj `if test -f 'goBoard.c'; then $(CYGPATH_W) 'goBoard.c'; else $(CYGPATH_W) '$(srcdir)/goBoard.c'; fi`
goban-goGame.o: goGame.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goGame.o `test -f 'goGame.c' || echo '$(srcdir)/'`goGame.c
goban-goGame.obj: goGame.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goGame.obj `if test -f 'goGame.c'; then $(CYGPATH_W) 'goGame.c'; else $(CYGPATH_W) '$(srcdir)/goGame.c'; fi`
goban-goHash.o: goHash.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goHash.o `test -f 'goHash.c' || echo '$(srcdir)/'`goHash.c
goban-goHash.obj: goHash.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goHash.obj `if test -f 'goHash.c'; then $(CYGPATH_W) 'goHash.c'; else $(CYGPATH_W) '$(srcdir)/goHash.c'; fi`
goban-goPic.o: goPic.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goPic.o `test -f 'goPic.c' || echo '$(srcdir)/'`goPic.c
goban-goPic.obj: goPic.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goPic.obj `if test -f 'goPic.c'; then $(CYGPATH_W) 'goPic.c'; else $(CYGPATH_W) '$(srcdir)/goPic.c'; fi`
goban-goScore.o: goScore.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goScore.o `test -f 'goScore.c' || echo '$(srcdir)/'`goScore.c
goban-goScore.obj: goScore.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goScore.obj `if test -f 'goScore.c'; then $(CYGPATH_W) 'goScore.c'; else $(CYGPATH_W) '$(srcdir)/goScore.c'; fi`
goban-goTime.o: goTime.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goTime.o `test -f 'goTime.c' || echo '$(srcdir)/'`goTime.c
goban-goTime.obj: goTime.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-goTime.obj `if test -f 'goTime.c'; then $(CYGPATH_W) 'goTime.c'; else $(CYGPATH_W) '$(srcdir)/goTime.c'; fi`
goban-help.o: help.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-help.o `test -f 'help.c' || echo '$(srcdir)/'`help.c
goban-help.obj: help.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-help.obj `if test -f 'help.c'; then $(CYGPATH_W) 'help.c'; else $(CYGPATH_W) '$(srcdir)/help.c'; fi`
goban-i_finder.o: i_finder.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-i_finder.o `test -f 'i_finder.c' || echo '$(srcdir)/'`i_finder.c
goban-i_finder.obj: i_finder.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-i_finder.obj `if test -f 'i_finder.c'; then $(CYGPATH_W) 'i_finder.c'; else $(CYGPATH_W) '$(srcdir)/i_finder.c'; fi`
goban-i_general.o: i_general.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-i_general.o `test -f 'i_general.c' || echo '$(srcdir)/'`i_general.c
goban-i_general.obj: i_general.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-i_general.obj `if test -f 'i_general.c'; then $(CYGPATH_W) 'i_general.c'; else $(CYGPATH_W) '$(srcdir)/i_general.c'; fi`
goban-i_snd.o: i_snd.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-i_snd.o `test -f 'i_snd.c' || echo '$(srcdir)/'`i_snd.c
goban-i_snd.obj: i_snd.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-i_snd.obj `if test -f 'i_snd.c'; then $(CYGPATH_W) 'i_snd.c'; else $(CYGPATH_W) '$(srcdir)/i_snd.c'; fi`
goban-i_win.o: i_win.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-i_win.o `test -f 'i_win.c' || echo '$(srcdir)/'`i_win.c
goban-i_win.obj: i_win.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-i_win.obj `if test -f 'i_win.c'; then $(CYGPATH_W) 'i_win.c'; else $(CYGPATH_W) '$(srcdir)/i_win.c'; fi`
goban-list.o: list.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-list.o `test -f 'list.c' || echo '$(srcdir)/'`list.c
goban-list.obj: list.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-list.obj `if test -f 'list.c'; then $(CYGPATH_W) 'list.c'; else $(CYGPATH_W) '$(srcdir)/list.c'; fi`
goban-local.o: local.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-local.o `test -f 'local.c' || echo '$(srcdir)/'`local.c
goban-local.obj: local.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-local.obj `if test -f 'local.c'; then $(CYGPATH_W) 'local.c'; else $(CYGPATH_W) '$(srcdir)/local.c'; fi`
goban-login.o: login.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-login.o `test -f 'login.c' || echo '$(srcdir)/'`login.c
goban-login.obj: login.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-login.obj `if test -f 'login.c'; then $(CYGPATH_W) 'login.c'; else $(CYGPATH_W) '$(srcdir)/login.c'; fi`
goban-look.o: look.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-look.o `test -f 'look.c' || echo '$(srcdir)/'`look.c
goban-look.obj: look.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-look.obj `if test -f 'look.c'; then $(CYGPATH_W) 'look.c'; else $(CYGPATH_W) '$(srcdir)/look.c'; fi`
goban-lsetup.o: lsetup.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-lsetup.o `test -f 'lsetup.c' || echo '$(srcdir)/'`lsetup.c
goban-lsetup.obj: lsetup.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-lsetup.obj `if test -f 'lsetup.c'; then $(CYGPATH_W) 'lsetup.c'; else $(CYGPATH_W) '$(srcdir)/lsetup.c'; fi`
goban-main.o: main.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
goban-main.obj: main.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
goban-match.o: match.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-match.o `test -f 'match.c' || echo '$(srcdir)/'`match.c
goban-match.obj: match.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-match.obj `if test -f 'match.c'; then $(CYGPATH_W) 'match.c'; else $(CYGPATH_W) '$(srcdir)/match.c'; fi`
goban-menu.o: menu.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-menu.o `test -f 'menu.c' || echo '$(srcdir)/'`menu.c
goban-menu.obj: menu.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-menu.obj `if test -f 'menu.c'; then $(CYGPATH_W) 'menu.c'; else $(CYGPATH_W) '$(srcdir)/menu.c'; fi`
goban-menu_snd.o: menu_snd.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-menu_snd.o `test -f 'menu_snd.c' || echo '$(srcdir)/'`menu_snd.c
goban-menu_snd.obj: menu_snd.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-menu_snd.obj `if test -f 'menu_snd.c'; then $(CYGPATH_W) 'menu_snd.c'; else $(CYGPATH_W) '$(srcdir)/menu_snd.c'; fi`
goban-msg.o: msg.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-msg.o `test -f 'msg.c' || echo '$(srcdir)/'`msg.c
goban-msg.obj: msg.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-msg.obj `if test -f 'msg.c'; then $(CYGPATH_W) 'msg.c'; else $(CYGPATH_W) '$(srcdir)/msg.c'; fi`
goban-net.o: net.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-net.o `test -f 'net.c' || echo '$(srcdir)/'`net.c
goban-net.obj: net.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-net.obj `if test -f 'net.c'; then $(CYGPATH_W) 'net.c'; else $(CYGPATH_W) '$(srcdir)/net.c'; fi`
goban-plain.o: plain.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-plain.o `test -f 'plain.c' || echo '$(srcdir)/'`plain.c
goban-plain.obj: plain.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-plain.obj `if test -f 'plain.c'; then $(CYGPATH_W) 'plain.c'; else $(CYGPATH_W) '$(srcdir)/plain.c'; fi`
goban-plasma.o: plasma.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-plasma.o `test -f 'plasma.c' || echo '$(srcdir)/'`plasma.c
goban-plasma.obj: plasma.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-plasma.obj `if test -f 'plasma.c'; then $(CYGPATH_W) 'plasma.c'; else $(CYGPATH_W) '$(srcdir)/plasma.c'; fi`
goban-play.o: play.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-play.o `test -f 'play.c' || echo '$(srcdir)/'`play.c
goban-play.obj: play.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-play.obj `if test -f 'play.c'; then $(CYGPATH_W) 'play.c'; else $(CYGPATH_W) '$(srcdir)/play.c'; fi`
goban-player.o: player.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-player.o `test -f 'player.c' || echo '$(srcdir)/'`player.c
goban-player.obj: player.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-player.obj `if test -f 'player.c'; then $(CYGPATH_W) 'player.c'; else $(CYGPATH_W) '$(srcdir)/player.c'; fi`
goban-radio.o: radio.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-radio.o `test -f 'radio.c' || echo '$(srcdir)/'`radio.c
goban-radio.obj: radio.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-radio.obj `if test -f 'radio.c'; then $(CYGPATH_W) 'radio.c'; else $(CYGPATH_W) '$(srcdir)/radio.c'; fi`
goban-rcur.o: rcur.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-rcur.o `test -f 'rcur.c' || echo '$(srcdir)/'`rcur.c
goban-rcur.obj: rcur.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-rcur.obj `if test -f 'rcur.c'; then $(CYGPATH_W) 'rcur.c'; else $(CYGPATH_W) '$(srcdir)/rcur.c'; fi`
goban-rnd.o: rnd.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-rnd.o `test -f 'rnd.c' || echo '$(srcdir)/'`rnd.c
goban-rnd.obj: rnd.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-rnd.obj `if test -f 'rnd.c'; then $(CYGPATH_W) 'rnd.c'; else $(CYGPATH_W) '$(srcdir)/rnd.c'; fi`
goban-screensaver.o: screensaver.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-screensaver.o `test -f 'screensaver.c' || echo '$(srcdir)/'`screensaver.c
goban-screensaver.obj: screensaver.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-screensaver.obj `if test -f 'screensaver.c'; then $(CYGPATH_W) 'screensaver.c'; else $(CYGPATH_W) '$(srcdir)/screensaver.c'; fi`
goban-server.o: server.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-server.o `test -f 'server.c' || echo '$(srcdir)/'`server.c
goban-server.obj: server.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-server.obj `if test -f 'server.c'; then $(CYGPATH_W) 'server.c'; else $(CYGPATH_W) '$(srcdir)/server.c'; fi`
goban-setup.o: setup.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-setup.o `test -f 'setup.c' || echo '$(srcdir)/'`setup.c
goban-setup.obj: setup.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-setup.obj `if test -f 'setup.c'; then $(CYGPATH_W) 'setup.c'; else $(CYGPATH_W) '$(srcdir)/setup.c'; fi`
goban-sgf.o: sgf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-sgf.o `test -f 'sgf.c' || echo '$(srcdir)/'`sgf.c
goban-sgf.obj: sgf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-sgf.obj `if test -f 'sgf.c'; then $(CYGPATH_W) 'sgf.c'; else $(CYGPATH_W) '$(srcdir)/sgf.c'; fi`
goban-sgfIn.o: sgfIn.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-sgfIn.o `test -f 'sgfIn.c' || echo '$(srcdir)/'`sgfIn.c
goban-sgfIn.obj: sgfIn.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-sgfIn.obj `if test -f 'sgfIn.c'; then $(CYGPATH_W) 'sgfIn.c'; else $(CYGPATH_W) '$(srcdir)/sgfIn.c'; fi`
goban-sgfMap.o: sgfMap.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-sgfMap.o `test -f 'sgfMap.c' || echo '$(srcdir)/'`sgfMap.c
goban-sgfMap.obj: sgfMap.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-sgfMap.obj `if test -f 'sgfMap.c'; then $(CYGPATH_W) 'sgfMap.c'; else $(CYGPATH_W) '$(srcdir)/sgfMap.c'; fi`
goban-sgfOut.o: sgfOut.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-sgfOut.o `test -f 'sgfOut.c' || echo '$(srcdir)/'`sgfOut.c
goban-sgfOut.obj: sgfOut.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-sgfOut.obj `if test -f 'sgfOut.c'; then $(CYGPATH_W) 'sgfOut.c'; else $(CYGPATH_W) '$(srcdir)/sgfOut.c'; fi`
goban-sgfPlay.o: sgfPlay.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-sgfPlay.o `test -f 'sgfPlay.c' || echo '$(srcdir)/'`sgfPlay.c
goban-sgfPlay.obj: sgfPlay.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-sgfPlay.obj `if test -f 'sgfPlay.c'; then $(CYGPATH_W) 'sgfPlay.c'; else $(CYGPATH_W) '$(srcdir)/sgfPlay.c'; fi`
goban-slide.o: slide.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-slide.o `test -f 'slide.c' || echo '$(srcdir)/'`slide.c
goban-slide.obj: slide.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-slide.obj `if test -f 'slide.c'; then $(CYGPATH_W) 'slide.c'; else $(CYGPATH_W) '$(srcdir)/slide.c'; fi`
goban-snd.o: snd.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-snd.o `test -f 'snd.c' || echo '$(srcdir)/'`snd.c
goban-snd.obj: snd.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-snd.obj `if test -f 'snd.c'; then $(CYGPATH_W) 'snd.c'; else $(CYGPATH_W) '$(srcdir)/snd.c'; fi`
goban-str.o: str.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-str.o `test -f 'str.c' || echo '$(srcdir)/'`str.c
goban-str.obj: str.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-str.obj `if test -f 'str.c'; then $(CYGPATH_W) 'str.c'; else $(CYGPATH_W) '$(srcdir)/str.c'; fi`
goban-swin.o: swin.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-swin.o `test -f 'swin.c' || echo '$(srcdir)/'`swin.c
goban-swin.obj: swin.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-swin.obj `if test -f 'swin.c'; then $(CYGPATH_W) 'swin.c'; else $(CYGPATH_W) '$(srcdir)/swin.c'; fi`
goban-tbin.o: tbin.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-tbin.o `test -f 'tbin.c' || echo '$(srcdir)/'`tbin.c
goban-tbin.obj: tbin.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-tbin.obj `if test -f 'tbin.c'; then $(CYGPATH_W) 'tbin.c'; else $(CYGPATH_W) '$(srcdir)/tbin.c'; fi`
goban-tblock.o: tblock.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-tblock.o `test -f 'tblock.c' || echo '$(srcdir)/'`tblock.c
goban-tblock.obj: tblock.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-tblock.obj `if test -f 'tblock.c'; then $(CYGPATH_W) 'tblock.c'; else $(CYGPATH_W) '$(srcdir)/tblock.c'; fi`
goban-term.o: term.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-term.o `test -f 'term.c' || echo '$(srcdir)/'`term.c
goban-term.obj: term.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-term.obj `if test -f 'term.c'; then $(CYGPATH_W) 'term.c'; else $(CYGPATH_W) '$(srcdir)/term.c'; fi`
goban-text.o: text.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-text.o `test -f 'text.c' || echo '$(srcdir)/'`text.c
goban-text.obj: text.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-text.obj `if test -f 'text.c'; then $(CYGPATH_W) 'text.c'; else $(CYGPATH_W) '$(srcdir)/text.c'; fi`
goban-textin.o: textin.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-textin.o `test -f 'textin.c' || echo '$(srcdir)/'`textin.c
goban-textin.obj: textin.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-textin.obj `if test -f 'textin.c'; then $(CYGPATH_W) 'textin.c'; else $(CYGPATH_W) '$(srcdir)/textin.c'; fi`
goban-timer.o: timer.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c
goban-timer.obj: timer.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi`
goban-wms.o: wms.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-wms.o `test -f 'wms.c' || echo '$(srcdir)/'`wms.c
goban-wms.obj: wms.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-wms.obj `if test -f 'wms.c'; then $(CYGPATH_W) 'wms.c'; else $(CYGPATH_W) '$(srcdir)/wms.c'; fi`
goban-write.o: write.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-write.o `test -f 'write.c' || echo '$(srcdir)/'`write.c
goban-write.obj: write.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goban_CFLAGS) $(CFLAGS) -c -o goban-write.obj `if test -f 'write.c'; then $(CYGPATH_W) 'write.c'; else $(CYGPATH_W) '$(srcdir)/write.c'; fi`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-binPROGRAMS \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-binPROGRAMS uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
goban-1.1.orig/src/goHash.h 0000644 0001750 0001750 00000003112 10267776232 013334 0 ustar al al /*
* src/gohash.h, part of Complete Goban (game program)
* Copyright (C) 1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _GOHASH_H_
#define _GOHASH_H_ 1
#ifndef _WMS_RND_H_
#include
#endif
/**********************************************************************
* Data types
**********************************************************************/
#if SIZEOF_LONG >= 8
#define GoHash_isScalar 1
typedef ulong GoHash;
#elif SIZEOF_LONG_LONG >= 8
#define GoHash_isScalar 1
typedef unsigned long long GoHash;
#else
#define GoHash_isScalar 0
typedef struct {
uint32 lo, hi;
} GoHash;
#endif
/**********************************************************************
* Global variables
**********************************************************************/
extern const GoHash goHash_zero;
extern const GoHash goHash_pass;
/**********************************************************************
* Functions
**********************************************************************/
/* In all of these functions, passing zero as the "loc" means a pass. */
GoHash goHash_init(Rnd *r);
#if GoHash_isScalar
#define goHash_xor(v1, v2) ((v1) ^ (v2))
#define goHash_eq(v1, v2) ((v1) == (v2))
#define goHash_loBits(v, m) ((v) & (m))
#define goHash_print(v) printf("0x%x%08x",(int)(v>>32),(int)v)
#else
extern GoHash goHash_xor(GoHash v1, GoHash v2);
#define goHash_eq(v1, v2) (((v1).lo == (v2).lo) && ((v1).hi == (v2).hi))
#define goHash_loBits(v, m) ((v).lo & (m))
#endif /* GoHash_isScalar */
#endif /* _GOHASH_H_ */
goban-1.1.orig/src/screensaver.c 0000644 0001750 0001750 00000014743 10271260632 014435 0 ustar al al /*
* src/screensaver.c, part of Complete Goban (game program)
* Copyright (C) 1998 Scott Draves
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "cgoban.h"
#include "goban.h"
#include "msg.h"
#include "goGame.h"
#include "goPic.h"
#include "cgbuts.h"
#include "sgf.h"
#include "sgfIn.h"
#include "sgfOut.h"
#include "sgfPlay.h"
#include "editBoard.h"
#include
#include
#ifdef _LOCAL_H_
Levelization Error.
#endif
#include "screensaver.h"
#include "local.h"
static bool fwdOk(void *packet) {
return TRUE;
}
#if 0
#define none2 NULL
#define none1 NULL
#define nonev1 NULL
#else
GobanOut
none2(void *packet, int loc)
{
return 0;
}
GobanOut
none1(void *packet)
{
return gobanOut_draw;
}
void
nonev1(void *packet)
{
}
#endif
static const GobanActions local_actions = {
none2, none1, none1, none1, none1,
none1, none1, none1, none1, none1,
none1, none1,
NULL,
nonev1,
fwdOk, fwdOk, fwdOk, fwdOk};
static void
set_time(struct timeval *s, double secs) {
s->tv_usec = (int)(secs * 1e6) % (1000*1000);
s->tv_sec = secs;
}
static double
get_time(struct timeval *s) {
return s->tv_sec + s->tv_usec * 1e-6;
}
static const char *
gameTitle(Sgf *mc) {
SgfElem *me = sgf_findFirstType(mc, sgfType_title);
if (me) {
return str_chars(me->sVal);
} else if ((me = sgf_findFirstType(mc, sgfType_playerName))) {
char buf[1000];
SgfElem *you = sgfElem_findFirstType(me, sgfType_playerName);
const char *n1 = str_chars(me->sVal);
const char *n2 = you ? str_chars(you->sVal) : "?";
if (me->gVal != goStone_white) {
const char *t = n1;
n1 = n2;
n2 = t;
}
sprintf(buf, "%s - %s", n1, n2);
return strdup(buf); /* leaks */
}
return msg_noTitle;
}
void
screensaver_setSgf(Screensaver *l, Sgf *mc) {
GoRules rules;
int size, hcap;
float komi;
GoTime time;
SgfElem *me;
l->moves = mc;
l->move = 0;
me = sgf_findType(mc, sgfType_rules);
if (me) {
rules = (GoRules)me->iVal;
} else
rules = goRules_japanese;
me = sgf_findType(mc, sgfType_size);
if (me) {
size = me->iVal;
} else {
size = 19;
}
me = sgf_findType(mc, sgfType_handicap);
if (me) {
hcap = me->iVal;
} else {
hcap = 0;
}
me = sgf_findType(mc, sgfType_komi);
if (me) {
komi = (float)me->iVal / 2.0;
} else {
komi = 0.0;
}
me = sgf_findFirstType(mc, sgfType_playerName);
while (me) {
me = sgfElem_findFirstType(me, sgfType_playerName);
}
me = sgf_findFirstType(mc, sgfType_time);
if (me) {
goTime_parseDescribeChars(&time, str_chars(me->sVal));
} else {
time.type = goTime_none;
}
if (l->game)
goGame_destroy(l->game);
// should be passive ? XXX
l->game = goGame_create(size, rules, hcap, komi, &time, TRUE);
sgf_play(mc, l->game, NULL, -1, NULL);
if (l->goban)
butText_set(l->goban->labelText, gameTitle(mc));
goGame_moveTo(l->game, 0);
}
char *
screensaver_randomSgf(char *dir)
{
char *namelist[8096];
struct dirent *dirp;
DIR *dp;
int i, n = 0;
char *sgf;
if((dp=opendir(dir)) == NULL ) {
fprintf(stderr, "could not read %s\n", dir);
exit(1);
}
while ((dirp = readdir(dp)) != NULL) {
if (dirp->d_name[0] == '.')continue;
namelist[n++]=strdup(dirp->d_name);
}
{
char buf[1000];
sprintf(buf, "%s/%s", dir, namelist[random() % n]);
sgf = strdup(buf);
}
for (i = 0; i < n; i++)
free(namelist[i]);
closedir(dp);
return sgf;
}
Sgf *
set_game(Screensaver *l)
{
Sgf *mc;
const char *err;
while (1) {
char *fname = screensaver_randomSgf(l->game_dir);
mc = sgf_createFile(l->cg, fname, &err, NULL);
if (mc) {
/* printf("playing %s\n", fname); */
return mc;
}
fprintf(stderr, "error in %s\n", err);
}
}
static ButOut
next_move(ButTimer *timer)
{
Screensaver *l = butTimer_packet(timer);
{
double p = get_time(&timer->period);
p *= l->acceleration;
if (p < l->mintime) p = l->mintime;
set_time(&timer->period, p);
}
if (l->game->moveNum == l->game->maxMoves) {
Sgf *mc;
sleep(l->gametime);
mc = set_game(l);
screensaver_setSgf(l, mc);
set_time(&l->timer->period, l->stonetime);
butTimer_reset(l->timer);
} else {
goGame_moveTo(l->game, l->game->moveNum + 1);
}
goban_update(l->goban);
return 0;
}
Screensaver *
screensaver_create(Cgoban *cg) {
Sgf *mc;
Screensaver *l;
const char *title;
srandom(time(0));
cg->env->minWindows = 1;
cg->screensaver = 1;
cg->showCoords = 0;
assert(MAGIC(cg));
l = wms_malloc(sizeof(Screensaver));
MAGIC_SET(l);
l->cg = cg;
l->game = NULL;
l->goban = NULL;
{
char *gd = clp_getStr(cg->clp, "game-dir");
l->game_dir = strdup((gd && gd[0]) ? gd : PACKAGE_DATA_DIR);
}
mc = set_game(l);
screensaver_setSgf(l, mc);
title = gameTitle(mc);
l->goban = goban_create(cg, &local_actions, l, l->game, "local",
title);
l->goban->iDec1 = grid_create(&cg->cgbuts, NULL, NULL, l->goban->iWin, 2,
BUT_DRAWABLE, 0);
grid_setStone(l->goban->iDec1, goStone_white, FALSE);
l->goban->iDec2 = grid_create(&cg->cgbuts, NULL, NULL, l->goban->iWin, 2,
BUT_DRAWABLE, 0);
grid_setStone(l->goban->iDec2, goStone_black, FALSE);
{
double x = clp_getDouble(cg->clp, "gametime");
if (x < 0.0) {
fprintf(stderr, "gametime cannot be negative, %g is.\n", x);
x = 0.0;
}
x *= 1e-3;
l->gametime = x;
}
{
double x = clp_getDouble(cg->clp, "acceleration");
/* command line option is normally 0 - 100. 150 is max possible,
negative values are fine */
x = 1.0 - pow(10.0, -(1.0 + (100.0-x) * 0.02));
if (x < 0.0) x = 0.0;
l->acceleration = x;
}
{
double x = clp_getDouble(cg->clp, "minstonetime");
if (x <= 1) {
fprintf(stderr, "minstonetime is too small (%g).\n", x);
x = 1;
}
x *= 1e-3;
l->mintime = x;
}
{
struct timeval period;
double secs = clp_getDouble(cg->clp, "stonetime");
if (secs <= 0.0) {
fprintf(stderr, "stonetime must be positive, %g is not.\n", secs);
secs = 1e-4;
} else
secs *= 1e-3;
l->stonetime = secs;
set_time(&period, secs);
l->timer = butTimer_create(l, NULL, period, period, 0, next_move);
}
return(l);
}
goban-1.1.orig/src/lsetup.c 0000644 0001750 0001750 00000041543 10270064734 013433 0 ustar al al /*
* src/lsetup.c, part of Complete Goban (game program)
* Copyright (C) 1995-1996 William Shubert
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "cm2pm.h"
#include "msg.h"
#include "plasma.h"
#ifdef _SETUP_H_
Levelization ERror
#endif
#include "lsetup.h"
/**********************************************************************
* Forward Declarations
**********************************************************************/
static ButOut unmap(ButWin *win);
static ButOut map(ButWin *win);
static ButOut resize(ButWin *win);
static ButOut subwinResize(ButWin *win);
static ButOut destroy(ButWin *win);
static ButOut newComp(But *but, const char *val);
static ButOut newPort(But *but, const char *val);
static ButOut newConnCmd(But *but, const char *val);
static ButOut newDirect(But *but, bool value);
static ButOut newCoord(But *but, bool value);
static ButOut newNumKibs(But *but, bool value);
static ButOut newNoTypo(But *but, bool value);
static ButOut ok(But *but);
static ButOut newSrvNum(But *but, int value);
static ButOut newName(But *but, const char *newVal);
static ButOut newProto(But *but, int newVal);
static ButOut newHiContrast(But *but, bool value);
/**********************************************************************
* Functions
**********************************************************************/
#define boxHeight(lines, fh, bw) ((lines) * (2 * (fh) + (bw)) + 3 * (bw))
#define textOff(line, fh, bw) ((line) * (2 * (fh) + (bw)) + 2 * (bw))
Setup *setup_create(Cgoban *cg,
void (*destroyCallback)(Setup *setup, void *packet),
void (*newServerCallback)(Setup *setup, void *packet),
void *packet) {
Setup *setup;
bool isDirect;
bool err;
int i;
int h, minH, bw;
ButWin *subwin;
const char *menuOpts[SETUP_MAXSERVERS + 1];
assert(MAGIC(cg));
setup = wms_malloc(sizeof(Setup));
MAGIC_SET(setup);
setup->cg = cg;
setup->destroyCallback = destroyCallback;
setup->newServerCallback = newServerCallback;
setup->packet = packet;
bw = butEnv_stdBw(cg->env);
minH = cg->fontH * 12 + bw * 16;
h = (int)(minH * 2 * clp_getDouble(cg->clp, "config.h") + 0.5);
setup->win = butWin_create(setup, cg->env, "Cgoban Setup", minH * 2, h,
unmap, map, resize, destroy);
butWin_setMinH(setup->win, minH);
butWin_setMaxH(setup->win, cg->fontH * 4 + bw * 8 +
boxHeight(8, cg->fontH, bw) + cg->fontH * 2 +
boxHeight(4, cg->fontH, bw));
i = clp_iGetInt(cg->clp, "config.x", &err);
if (!err)
butWin_setX(setup->win, i);
i = clp_iGetInt(cg->clp, "config.y", &err);
if (!err)
butWin_setY(setup->win, i);
butWin_activate(setup->win);
setup->bg = butBoxFilled_create(setup->win, 0, BUT_DRAWABLE);
butBoxFilled_setPixmaps(setup->bg, cg->bgLitPixmap, cg->bgShadPixmap,
cg->bgPixmap);
setup->title = butText_create(setup->win, 1, BUT_DRAWABLE,
msg_setupTitle, butText_center);
butText_setFont(setup->title, 2);
setup->swin = abutSwin_create(setup, setup->win, 1, ABUTSWIN_LSLIDE,
subwinResize);
subwin = setup->swin->win;
setup->srvBox = butBoxFilled_create(subwin, 0, BUT_DRAWABLE);
setup->srvTitle = butText_create(subwin, 1, BUT_DRAWABLE,
msg_srvConfig,
butText_center);
butText_setFont(setup->srvTitle, 2);
setup->srvNum = 0;
for (i = 0; i < SETUP_MAXSERVERS; ++i) {
menuOpts[i] = clp_getStrNum(cg->clp, "client.server", i);
}
menuOpts[i] = BUTMENU_OLEND;
setup->srvMenu = butMenu_downCreate(newSrvNum, setup, subwin, 2, 3,
BUT_DRAWABLE|BUT_PRESSABLE,
msg_selServer, menuOpts, 0);
setup->srvName = butTextin_create(newName, setup, subwin, 1,
BUT_DRAWABLE|BUT_PRESSABLE,
clp_getStrNum(cg->clp, "client.server",
setup->srvNum), 100);
setup->srvNameLabel = butText_create(subwin, 1, BUT_DRAWABLE,
msg_setupSrvName,
butText_left);
setup->srvProto = butRadio_create(newProto, setup, subwin, 1,
BUT_DRAWABLE|BUT_PRESSABLE,
(clp_getStrNum(cg->clp, "client.protocol",
setup->srvNum)[0] == 'n'),
2);
setup->srvProtoLabel = butText_create(subwin, 1, BUT_DRAWABLE,
msg_setupProtocol,
butText_left);
setup->igsLabel = butText_create(subwin, 2, BUT_DRAWABLE|BUT_PRESSTHRU,
"IGS", butText_center);
setup->nngsLabel = butText_create(subwin, 2, BUT_DRAWABLE|BUT_PRESSTHRU,
"NNGS", butText_center);
isDirect = (clp_getStrNum(cg->clp, "client.direct",
setup->srvNum)[0] == 't');
setup->srvDirectLabel = butText_create(subwin, 1, BUT_DRAWABLE,
msg_directConn,
butText_left);
setup->srvDirect = butCb_create(newDirect, setup, subwin, 1,
BUT_DRAWABLE|BUT_PRESSABLE, isDirect);
setup->srvComp = butText_create(subwin, 1, BUT_DRAWABLE,
msg_gsCompName, butText_left);
setup->srvCompIn =
butTextin_create(newComp, setup, subwin, 1, BUT_DRAWABLE,
clp_getStrNum(cg->clp, "client.address", setup->srvNum),
100);
setup->srvPort = butText_create(subwin, 1, BUT_DRAWABLE,
msg_gsPortNum, butText_left);
setup->srvPortIn =
butTextin_create(newPort, setup, subwin, 1, BUT_DRAWABLE,
clp_getStrNum(cg->clp, "client.port", setup->srvNum), 20);
setup->srvCmdLabel = butText_create(subwin, 1, BUT_DRAWABLE,
msg_connCmdLabel,
butText_left);
setup->srvCmd = butTextin_create(newConnCmd, setup, subwin, 1,
BUT_DRAWABLE,
clp_getStrNum(cg->clp, "client.connCmd",
setup->srvNum), 100);
newDirect(setup->srvDirect, isDirect);
setup->miscBox = butBoxFilled_create(subwin, 0, BUT_DRAWABLE);
setup->miscTitle = butText_create(subwin, 1, BUT_DRAWABLE,
msg_miscellaneous,
butText_center);
butText_setFont(setup->miscTitle, 2);
setup->coordLabel = butText_create(subwin, 1, BUT_DRAWABLE,
msg_showCoordinates,
butText_left);
setup->coord = butCb_create(newCoord, setup, subwin, 1,
BUT_DRAWABLE|BUT_PRESSABLE,
clp_getBool(cg->clp, "board.showCoords"));
setup->hiLabel = butText_create(subwin, 1, BUT_DRAWABLE,
msg_hiContrast,
butText_left);
setup->hi = butCb_create(newHiContrast, setup, subwin, 1,
BUT_DRAWABLE|BUT_PRESSABLE,
clp_getBool(cg->clp, "hiContrast"));
setup->numKibsLabel = butText_create(subwin, 1, BUT_DRAWABLE,
msg_numberKibitzes,
butText_left);
setup->numKibs = butCb_create(newNumKibs, setup, subwin, 1,
BUT_DRAWABLE|BUT_PRESSABLE,
clp_getBool(cg->clp, "client.numberKibitz"));
setup->noTypoLabel = butText_create(subwin, 1, BUT_DRAWABLE,
msg_noTypo, butText_left);
setup->noTypo = butCb_create(newNoTypo, setup, subwin, 1,
BUT_DRAWABLE|BUT_PRESSABLE,
clp_getBool(cg->clp, "client.noTypo"));
setup->help = butCt_create(cgoban_createHelpWindow, &help_configure,
setup->win, 1,
BUT_DRAWABLE|BUT_PRESSABLE, msg_help);
setup->ok = butCt_create(ok, setup, setup->win, 1,
BUT_DRAWABLE|BUT_PRESSABLE, msg_ok);
return(setup);
}
void setup_destroy(Setup *setup, bool propagate) {
assert(MAGIC(setup));
if (propagate)
setup->destroyCallback(setup, setup->packet);
if (setup->win)
butWin_destroy(setup->win);
MAGIC_UNSET(setup);
wms_free(setup);
}
static ButOut unmap(ButWin *win) {
return(0);
}
static ButOut map(ButWin *win) {
return(0);
}
static ButOut resize(ButWin *win) {
ButEnv *env = butWin_env(win);
Setup *setup = butWin_packet(win);
int y, w, h;
int fontH, bw;
assert(MAGIC(setup));
w = butWin_w(win);
h = butWin_h(win);
fontH = setup->cg->fontH;
bw = butEnv_stdBw(env);
but_resize(setup->bg, 0, y = 0, w, h);
but_resize(setup->title, bw*2, y += bw*2, w - bw*4, fontH * 2);
abutSwin_resize(setup->swin, bw*2, y += fontH * 2 + bw,
w - bw*4, h - fontH * 4 - bw * 6,
(butEnv_fontH(env, 0) * 3) / 2,
butEnv_fontH(env, 0));
but_resize(setup->help, bw * 2, h - (fontH * 2 + bw * 2),
(w - bw * 5) / 2, fontH * 2);
but_resize(setup->ok, (w + bw) / 2, h - (fontH * 2 + bw * 2),
w - bw*2 - (w + bw) / 2, fontH * 2);
return(0);
}
static ButOut subwinResize(ButWin *win) {
AbutSwin *swin;
ButEnv *env = butWin_env(win);
Setup *setup;
int y, w;
int fontH, bw;
swin = butWin_packet(win);
assert(MAGIC(swin));
setup = swin->packet;
assert(MAGIC(setup));
w = butWin_w(win);
fontH = setup->cg->fontH;
bw = butEnv_stdBw(env);
y = 0;
but_resize(setup->srvBox, 0, y, w, boxHeight(8, fontH, bw) + fontH*2);
but_resize(setup->srvTitle, bw*2, y + textOff(0, fontH, bw),
w - bw*4, fontH * 2);
but_resize(setup->srvMenu, bw * 2, y + textOff(1, fontH, bw),
w - bw * 4, fontH * 4);
but_resize(setup->srvNameLabel, bw * 2,
y + textOff(2, fontH, bw) + fontH * 2, w/2 - bw*2, fontH * 2);
but_resize(setup->srvName, w/2, y + textOff(2, fontH, bw) + fontH * 2,
w - (w/2 + bw*2), fontH * 2);
but_resize(setup->srvProtoLabel, bw * 2,
y + textOff(3, fontH, bw) + fontH * 2, w/2 - bw*2, fontH * 2);
but_resize(setup->srvProto, w/2, y + textOff(3, fontH, bw) + fontH * 2,
w - (w/2 + bw*2), fontH * 2);
butText_resize(setup->igsLabel, w/2 + (w - (w/2 + bw*2))/4,
y + textOff(3, fontH, bw) + fontH * 2, fontH * 2);
butText_resize(setup->nngsLabel,
w/2 + (w - (w/2 + bw*2)) - (w - (w/2 + bw*2))/4,
y + textOff(3, fontH, bw) + fontH * 2, fontH * 2);
but_resize(setup->srvDirectLabel, bw * 2,
y + textOff(4, fontH, bw) + fontH*2,
w - (bw * 4 + fontH * 2), fontH * 2);
but_resize(setup->srvDirect,
w - (bw*2 + fontH * 2), y + textOff(4, fontH, bw) + fontH * 2,
fontH * 2, fontH * 2);
but_resize(setup->srvComp, bw * 2,
y + textOff(5, fontH, bw) + fontH * 2, w/2 - bw*2, fontH * 2);
but_resize(setup->srvCompIn, w/2, y + textOff(5, fontH, bw) + fontH * 2,
w - (w/2 + bw*2), fontH * 2);
but_resize(setup->srvPort, bw * 2, y + textOff(6, fontH, bw) + fontH * 2,
w/2 - bw*2, fontH * 2);
but_resize(setup->srvPortIn, w/2, y + textOff(6, fontH, bw) + fontH * 2,
w - (w/2 + bw*2), fontH * 2);
but_resize(setup->srvCmdLabel, bw * 2, y + textOff(7, fontH, bw) + fontH * 2,
w/2 - bw*2, fontH * 2);
but_resize(setup->srvCmd, w/2, y + textOff(7, fontH, bw) + fontH * 2,
w - (w/2 + bw*2), fontH * 2);
y += boxHeight(8, fontH, bw) + fontH * 2;
but_resize(setup->miscBox, 0, y, w, boxHeight(5, fontH, bw));
but_resize(setup->miscTitle, bw*2, y + textOff(0, fontH, bw),
w - bw*4, fontH * 2);
but_resize(setup->coordLabel, bw * 2, y + textOff(1, fontH, bw),
w - (bw * 4 + fontH * 2), fontH * 2);
but_resize(setup->coord,
w - (bw*2 + fontH * 2), y + textOff(1, fontH, bw),
fontH * 2, fontH * 2);
but_resize(setup->hiLabel, bw * 2, y + textOff(2, fontH, bw),
w - (bw * 4 + fontH * 2), fontH * 2);
but_resize(setup->hi,
w - (bw*2 + fontH * 2), y + textOff(2, fontH, bw),
fontH * 2, fontH * 2);
but_resize(setup->numKibsLabel, bw * 2, y + textOff(3, fontH, bw),
w - (bw * 4 + fontH * 2), fontH * 2);
but_resize(setup->numKibs,
w - (bw*2 + fontH * 2), y + textOff(3, fontH, bw),
fontH * 2, fontH * 2);
but_resize(setup->noTypoLabel, bw * 2, y + textOff(4, fontH, bw),
w - (bw * 4 + fontH * 2), fontH * 2);
but_resize(setup->noTypo,
w - (bw*2 + fontH * 2), y + textOff(4, fontH, bw),
fontH * 2, fontH * 2);
y += boxHeight(5, fontH, bw);
if (y != butWin_h(win)) {
butCan_resizeWin(win, butWin_w(win), y, TRUE);
}
return(0);
}
static ButOut destroy(ButWin *win) {
Setup *setup = butWin_packet(win);
assert(MAGIC(setup));
clp_setInt(setup->cg->clp, "config.x", butWin_x(win));
clp_setInt(setup->cg->clp, "config.y", butWin_y(win));
clp_setDouble(setup->cg->clp, "config.h",
(double)butWin_h(win) / (double)butWin_w(win));
setup->win = NULL; /* It's dead already. */
setup_destroy(setup, TRUE);
return(0);
}
static ButOut newComp(But *but, const char *val) {
Setup *setup = but_packet(but);
assert(MAGIC(setup));
clp_setStrNum(setup->cg->clp, "client.address", val, setup->srvNum);
but_setFlags(but, BUT_NOKEY);
return(0);
}
static ButOut newPort(But *but, const char *val) {
Setup *setup = but_packet(but);
ButOut result = 0;
Str errorMsg;
int test;
bool err;
assert(MAGIC(setup));
err = FALSE;
test = wms_atoi(val, &err);
if ((test < 0) || (test > 65535) || err) {
str_init(&errorMsg);
str_print(&errorMsg, msg_clientBadPortNum, val);
cgoban_createMsgWindow(setup->cg, "Cgoban Error", str_chars(&errorMsg));
str_deinit(&errorMsg);
result = BUTOUT_ERR;
} else
clp_setStrNum(setup->cg->clp, "client.port", val, setup->srvNum);
but_setFlags(but, BUT_NOKEY);
return(result);
}
static ButOut ok(But *but) {
Setup *setup = but_packet(but);
ButOut result = 0;
assert(MAGIC(setup));
result |= newComp(setup->srvCompIn, butTextin_get(setup->srvCompIn));
result |= newPort(setup->srvPortIn, butTextin_get(setup->srvPortIn));
result |= newConnCmd(setup->srvCmd, butTextin_get(setup->srvCmd));
result |= newName(setup->srvName, butTextin_get(setup->srvName));
if (!(result & BUTOUT_ERR)) {
butWin_destroy(but_win(but));
}
return(result);
}
static ButOut newConnCmd(But *but, const char *val) {
Setup *setup = but_packet(but);
assert(MAGIC(setup));
but_setFlags(but, BUT_NOKEY);
clp_setStrNum(setup->cg->clp, "client.connCmd", val, setup->srvNum);
return(0);
}
static ButOut newDirect(But *but, bool value) {
Setup *setup = but_packet(but);
uint directFlags;
assert(MAGIC(setup));
if (value)
directFlags = BUT_DRAWABLE | BUT_PRESSABLE;
else
directFlags = BUT_DRAWABLE | BUT_NOPRESS | BUT_NOKEY;
clp_setStrNum(setup->cg->clp, "client.direct", (value ? "t" : "f"),
setup->srvNum);
butText_setColor(setup->srvComp, BUT_FG, !value);
but_setFlags(setup->srvCompIn, directFlags);
butText_setColor(setup->srvPort, BUT_FG, !value);
but_setFlags(setup->srvPortIn, directFlags);
butText_setColor(setup->srvCmdLabel, BUT_FG, value);
but_setFlags(setup->srvCmd, directFlags ^
(BUT_PRESSABLE|BUT_NOPRESS|BUT_NOKEY));
return(0);
}
static ButOut newCoord(But *but, bool value) {
Setup *setup = but_packet(but);
assert(MAGIC(setup));
clp_setBool(setup->cg->clp, "board.showCoords", value);
setup->cg->showCoords = value;
butEnv_resizeAll(butWin_env(but_win(but)));
return(0);
}
static ButOut newHiContrast(But *but, bool value) {
Setup *setup = but_packet(but);
assert(MAGIC(setup));
clp_setBool(setup->cg->clp, "hiContrast", value);
setup->cg->cgbuts.hiContrast = value;
cm2OldPm(setup->cg->env,
plasma(),
PLASMA_SIZE,PLASMA_SIZE,
CGBUTS_COLORBOARD(0), 256,
setup->cg->boardPixmap, value);
cgbuts_redraw(&setup->cg->cgbuts);
return(0);
}
static ButOut newNumKibs(But *but, bool value) {
Setup *setup = but_packet(but);
assert(MAGIC(setup));
clp_setBool(setup->cg->clp, "client.numberKibitz", value);
return(0);
}
static ButOut newNoTypo(But *but, bool value) {
Setup *setup = but_packet(but);
assert(MAGIC(setup));
clp_setBool(setup->cg->clp, "client.noTypo", value);
setup->cg->cgbuts.holdEnabled = value;
return(0);
}
static ButOut newProto(But *but, int newVal) {
Setup *setup = but_packet(but);
static const char *protos[] = {"i", "n"};
assert(MAGIC(setup));
clp_setStrNum(setup->cg->clp, "client.protocol",
protos[newVal], setup->srvNum);
return(0);
}
static ButOut newName(But *but, const char *newVal) {
Setup *setup = but_packet(but);
assert(MAGIC(setup));
but_setFlags(but, BUT_NOKEY);
clp_setStrNum(setup->cg->clp, "client.server", newVal, setup->srvNum);
butMenu_setOptionName(setup->srvMenu, newVal, setup->srvNum);
setup->newServerCallback(setup, setup->packet);
return(0);
}
static ButOut newSrvNum(But *but, int value) {
Setup *setup = but_packet(but);
ButOut result = 0;
Clp *clp = setup->cg->clp;
result |= newComp(setup->srvCompIn, butTextin_get(setup->srvCompIn));
result |= newPort(setup->srvPortIn, butTextin_get(setup->srvPortIn));
result |= newConnCmd(setup->srvCmd, butTextin_get(setup->srvCmd));
result |= newName(setup->srvName, butTextin_get(setup->srvName));
setup->srvNum = value;
butTextin_set(setup->srvName, clp_getStrNum(clp, "client.server", value),
FALSE);
butRadio_set(setup->srvProto, (clp_getStrNum(clp, "client.protocol",
value)[0] == 'n'), FALSE);
butCb_set(setup->srvDirect, (clp_getStrNum(clp, "client.direct",
value)[0] == 't'), TRUE);
butTextin_set(setup->srvCompIn, clp_getStrNum(clp, "client.address", value),
FALSE);
butTextin_set(setup->srvPortIn, clp_getStrNum(clp, "client.port", value),
FALSE);
butTextin_set(setup->srvCmd, clp_getStrNum(clp, "client.connCmd", value),
FALSE);
return(result);
}
goban-1.1.orig/src/rcur.c 0000644 0001750 0001750 00000024277 10270072263 013073 0 ustar al al /*
* wmslib/src/but/rcur.c, part of wmslib (Library functions)
* Copyright (C) 1994 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#include
#include "wms.h"
#ifdef X11_DISP
#ifdef STDC_HEADERS
#include
#include
#endif /* STDC_HEADERS */
#include
#include
#include
#include
#include
#include
#include
#ifdef HAVE_SYS_SELECT_H
#include
#endif
#include
#include
#include
#include
typedef struct Curs_struct {
int fontcurnum;
int hotX, hotY, w, h;
char *pic, *mask;
} Curs;
#define ntm_width 16
#define ntm_height 16
#define ntm_bits ((char *)ntm_ubits)
static uchar ntm_ubits[] = {
0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3f, 0x00, 0x7f, 0x00,
0xff, 0x00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x03, 0x7f, 0x00, 0xf7, 0x00,
0xf3, 0x00, 0xe0, 0x01, 0xe0, 0x01, 0xc0, 0x01};
#define ntp_width 16
#define ntp_height 16
#define ntp_bits ((char *)ntp_ubits)
static uchar ntp_ubits[] = {
0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0x00, 0x3e, 0x00,
0x7e, 0x00, 0xfe, 0x00, 0xfe, 0x01, 0x3e, 0x00, 0x36, 0x00, 0x62, 0x00,
0x60, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00};
#define tm_width 16
#define tm_height 16
#define tm_bits ((char *)tm_ubits)
static uchar tm_ubits[] = {
0x00, 0xe0, 0x00, 0xf8, 0x00, 0xfe, 0x80, 0x7f, 0xe0, 0x7f, 0xf8, 0x3f,
0xfc, 0x3f, 0xf8, 0x1f, 0xe0, 0x1f, 0xf0, 0x0f, 0xf8, 0x0f, 0x7c, 0x07,
0x3e, 0x07, 0x1f, 0x02, 0x0e, 0x00, 0x04, 0x00};
#define tp_width 16
#define tp_height 16
#define tp_bits ((char *)tp_ubits)
static uchar tp_ubits[] = {
0x00, 0x00, 0x00, 0x60, 0x00, 0x78, 0x00, 0x3e, 0x80, 0x3f, 0xe0, 0x1f,
0xf8, 0x1f, 0x80, 0x0f, 0xc0, 0x0f, 0xe0, 0x06, 0x70, 0x06, 0x38, 0x02,
0x1c, 0x02, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00};
#define txtp_width 16
#define txtp_height 16
#define txtp_bits ((char *)txtp_ubits)
static uchar txtp_ubits[] = {
0x00, 0x00, 0xee, 0x00, 0x38, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00,
0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00,
0x10, 0x00, 0x38, 0x00, 0xee, 0x00, 0x00, 0x00};
#define txtm_width 16
#define txtm_height 16
#define txtm_bits ((char *)txtm_ubits)
static uchar txtm_ubits[] = {
0xef, 0x01, 0xff, 0x01, 0xff, 0x01, 0x7c, 0x00, 0x38, 0x00, 0x38, 0x00,
0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00,
0x7c, 0x00, 0xff, 0x01, 0xff, 0x01, 0xef, 0x01};
static Curs cursors[BUTCUR_NUM];
static void draw(ButRcur *rc);
static void erase(ButRcur *rc);
static void butRcur_hideForRedraw(ButRcur *rc, int winId, int x,int y,
int w,int h);
void butEnv_rcInit(ButEnv *env) {
Drawable d = RootWindow(env->dpy, DefaultScreen(env->dpy));
static bool first_time = TRUE;
ButCur i;
int dataWidth, j, k;
if (first_time) {
first_time = FALSE;
for (i = butCur_idle; i < butCur_bogus; ++i)
cursors[i].pic = NULL;
cursors[butCur_idle].fontcurnum = XC_left_ptr;
cursors[butCur_idle].hotX = 1;
cursors[butCur_idle].hotY = 1;
cursors[butCur_idle].w = 16;
cursors[butCur_idle].h = 16;
cursors[butCur_idle].pic = ntp_bits;
cursors[butCur_idle].mask = ntm_bits;
cursors[butCur_twitch].fontcurnum = XC_arrow;
cursors[butCur_twitch].hotX = 14;
cursors[butCur_twitch].hotY = 1;
cursors[butCur_twitch].w = 16;
cursors[butCur_twitch].h = 16;
cursors[butCur_twitch].pic = tp_bits;
cursors[butCur_twitch].mask = tm_bits;
cursors[butCur_text].fontcurnum = XC_xterm;
cursors[butCur_text].hotX = 4;
cursors[butCur_text].hotY = 8;
cursors[butCur_text].w = 16;
cursors[butCur_text].h = 16;
cursors[butCur_text].pic = txtp_bits;
cursors[butCur_text].mask = txtm_bits;
cursors[butCur_up].fontcurnum = XC_sb_up_arrow;
cursors[butCur_up].hotX = 14;
cursors[butCur_up].hotY = 14;
cursors[butCur_up].w = 16;
cursors[butCur_up].h = 16;
cursors[butCur_up].pic = ntp_bits;
cursors[butCur_up].mask = ntm_bits;
cursors[butCur_down].fontcurnum = XC_sb_down_arrow;
cursors[butCur_down].hotX = 14;
cursors[butCur_down].hotY = 14;
cursors[butCur_down].w = 16;
cursors[butCur_down].h = 16;
cursors[butCur_down].pic = ntp_bits;
cursors[butCur_down].mask = ntm_bits;
cursors[butCur_left].fontcurnum = XC_sb_left_arrow;
cursors[butCur_left].hotX = 14;
cursors[butCur_left].hotY = 14;
cursors[butCur_left].w = 16;
cursors[butCur_left].h = 16;
cursors[butCur_left].pic = ntp_bits;
cursors[butCur_left].mask = ntm_bits;
cursors[butCur_right].fontcurnum = XC_sb_right_arrow;
cursors[butCur_right].hotX = 14;
cursors[butCur_right].hotY = 14;
cursors[butCur_right].w = 16;
cursors[butCur_right].h = 16;
cursors[butCur_right].pic = ntp_bits;
cursors[butCur_right].mask = ntm_bits;
cursors[butCur_lr].fontcurnum = XC_sb_h_double_arrow;
cursors[butCur_lr].hotX = 14;
cursors[butCur_lr].hotY = 14;
cursors[butCur_lr].w = 16;
cursors[butCur_lr].h = 16;
cursors[butCur_lr].pic = ntp_bits;
cursors[butCur_lr].mask = ntm_bits;
cursors[butCur_ud].fontcurnum = XC_sb_v_double_arrow;
cursors[butCur_ud].hotX = 14;
cursors[butCur_ud].hotY = 14;
cursors[butCur_ud].w = 16;
cursors[butCur_ud].h = 16;
cursors[butCur_ud].pic = ntp_bits;
cursors[butCur_ud].mask = ntm_bits;
cursors[butCur_grab].fontcurnum = XC_fleur;
cursors[butCur_grab].hotX = 14;
cursors[butCur_grab].hotY = 14;
cursors[butCur_grab].w = 16;
cursors[butCur_grab].h = 16;
cursors[butCur_grab].pic = ntp_bits;
cursors[butCur_grab].mask = ntm_bits;
}
for (i = butCur_idle; i < butCur_bogus; ++i) {
/* "Grey out" the remote cursors. */
dataWidth = (cursors[i].w + 7) / 8;
for (j = 0; j < cursors[i].h; j += 2) {
for (k = 0; k < dataWidth; ++k) {
cursors[i].mask[j*dataWidth + k] &= 0x55;
if (j+1 < cursors[i].h) {
cursors[i].mask[(j+1)*dataWidth + k] &= 0xaa;
}
}
}
env->cursors[i] = XCreateFontCursor(env->dpy, cursors[i].fontcurnum);
env->cpic[i] = XCreateBitmapFromData(env->dpy, d, cursors[i].pic,
cursors[i].w, cursors[i].h);
env->cmask[i] = XCreateBitmapFromData(env->dpy, d, cursors[i].mask,
cursors[i].w, cursors[i].h);
}
env->curnum = butCur_idle;
env->curwin = None;
env->curhold = NULL;
env->curlast = butCur_bogus;
}
/* Erase the cursor if it is in the area specified. */
void butRcur_create(ButRcur *rc, ButEnv *env) {
MAGIC_SET(rc);
rc->env = env;
rc->winId = -2;
rc->drawn = FALSE;
rc->under = XCreatePixmap(env->dpy, DefaultRootWindow(env->dpy),
16,16, env->depth);
}
void butRcur_move(ButRcur *rc, int winId, int rx,int ry, int rw,int rh,
ButCur type) {
ButEnv *env = rc->env;
assert(MAGIC(rc));
if ((winId < 0) || (winId >= env->maxWinIds))
winId = -2;
else if (env->id2Win[winId] == NULL)
winId = -2;
if ((winId == rc->winId) && (rx == rc->rx) && (ry == rc->ry) &&
(rw == rc->rw) && (rh == rc->rh) && (type == rc->type))
return;
if (rc->drawn)
erase(rc);
rc->winId = winId;
rc->rx = rx;
rc->ry = ry;
rc->rw = rw;
rc->rh = rh;
rc->type = type;
if (winId != -2) {
rc->lx = (rx * env->id2Win[winId]->w + rw/2) / rw - cursors[type].hotX;
rc->ly = (ry * env->id2Win[winId]->h + rh/2) / rh - cursors[type].hotY;
draw(rc);
}
}
void butRcur_redraw(ButEnv *env, int winId, int x,int y, int w,int h) {
int i;
if (winId == -2)
return;
for (i = 0; i < env->numPartners; ++i) {
if (env->partners[i]) {
if (butRnet_valid(env->partners[i]) &&
(winId == env->partners[i]->rc.winId))
butRcur_hideForRedraw(&env->partners[i]->rc, winId, x,y, w,h);
}
}
}
static void butRcur_hideForRedraw(ButRcur *rc, int winId, int x,int y,
int w,int h) {
assert(MAGIC(rc));
if (rc->drawn && (rc->winId == winId) &&
(x < rc->lx+16) &&
(y < rc->ly+16) &&
(x+w > rc->lx) && (y+h > rc->ly)) {
/* We need to erase it. Will the redraw erase it for us? */
if ((x <= rc->lx) && (y <= rc->ly) &&
(x+w >= rc->lx+16) &&
(y+h >= rc->ly+16)) {
rc->drawn = FALSE;
} else
erase(rc);
}
}
/* xio is the I/O context that the move got reported in. */
static void draw(ButRcur *rc) {
ButEnv *env = rc->env;
assert(!rc->drawn);
assert(MAGIC(rc));
XCopyArea(env->dpy, env->id2Win[rc->winId]->win, rc->under, env->gc2,
rc->lx,rc->ly, 16,16, 0,0);
if (!env->colorp)
XSetFillStyle(env->dpy, env->gc2, FillSolid);
XSetClipMask(env->dpy, env->gc2, env->cmask[rc->type]);
XSetClipOrigin(env->dpy, env->gc2, rc->lx,rc->ly);
XSetForeground(env->dpy, env->gc2, env->colors[BUT_FG]);
XSetBackground(env->dpy, env->gc2, env->colors[BUT_LIT]);
XCopyPlane(env->dpy, env->cpic[rc->type],env->id2Win[rc->winId]->win,
env->gc2, 0,0, 16,16, rc->lx,rc->ly, 1L);
XSetClipMask(env->dpy, env->gc2, None);
if (!env->colorp)
XSetFillStyle(env->dpy, env->gc2, FillTiled);
rc->drawn = TRUE;
}
static void erase(ButRcur *rc) {
ButEnv *env = rc->env;
assert(MAGIC(rc));
assert(rc->drawn);
XCopyArea(env->dpy, rc->under, env->id2Win[rc->winId]->win, env->gc2,
0,0, 16,16, rc->lx,rc->ly);
rc->drawn = FALSE;
}
/* Change the cursor to make it twitched or not twitched. */
void butEnv_setCursor(ButEnv *env, But *but, ButCur newcursor) {
if (newcursor == butCur_idle) {
if (but == env->curhold) {
env->curnum = newcursor;
env->curhold = NULL;
}
} else {
env->curnum = newcursor;
env->curhold = but;
}
env->curwin = but->win->physWin;
}
/* Set up any cursor changes that may have occurred. */
void butEnv_rcActivate(ButEnv *env) {
int i;
if ((env->curlast != env->curnum) && (env->curwin != None)) {
assert(env->curnum < butCur_bogus);
env->curlast = env->curnum;
XDefineCursor(env->dpy, env->curwin, env->cursors[env->curlast]);
butRnet_mMove(env, -1, -1,-1, -1,-1, env->curnum);
}
for (i = 0; i < env->numPartners; ++i) {
if (env->partners[i]) {
if (butRnet_valid(env->partners[i]) &&
(env->partners[i]->rc.winId >= 0) &&
!env->partners[i]->rc.drawn)
draw(&env->partners[i]->rc);
}
}
}
#endif
goban-1.1.orig/src/net.h 0000644 0001750 0001750 00000011421 10267776722 012717 0 ustar al al /*
* wmslib/include/but/net.h, part of wmslib (Library functions)
* Copyright (C) 1994-1995 William Shubert.
* See "configure.h.in" for more copyright information.
*
* Includes for button networking.
*/
#ifndef _BUTNET_H_
#define _BUTNET_H_ 1
#include
/**********************************************************************
* Constants
**********************************************************************/
/* Public. */
#define BUTNET_MAXCMD (16*1024) /* Max length of 1 net command. */
/* Private. */
/*
* These really should be an enum, but then I'd be treating the enum like an
* int when I do int_stdInt32() to it, so I may as well just leave it as
* an int.
*/
#define BUTNET_PROTOWHO 0
#define BUTNET_CLOSE 1
#define BUTNET_USERDATA 2
#define BUTNET_MOUSE 3
#define BUTNET_MOUSEACK 4
#define BUTNET_NEWFLAGS 5
#define BUTNET_BUTSPEC 6
/**********************************************************************
* Types
**********************************************************************/
/* Private. */
struct ButLnet_struct {
struct ButEnv_struct *env;
void *packet;
bool valid, error;
int errNum;
char *protocol;
ButOut (*ocallback)(struct ButRnet_struct *net);
ButOut (*callback)(struct ButRnet_struct *net, void *cmd, int cmdLen);
ButOut (*ccallback)(struct ButRnet_struct *net, const char *reason);
int fd;
MAGIC_STRUCT
}; /* ButLnet typedef in but.h */
typedef enum {
butRnetState_pwWait, butRnetState_pwAccWait, butRnetState_accWait,
butRnetState_open, butRnetState_closing, butRnetState_closed
} ButRnetState;
typedef struct ButNetMsg_struct {
StdInt32 length;
StdInt32 type;
union {
struct {
StdInt32 context; /* This is the client's new context. */
char proto[100];
char who[100];
} protoWho;
char close[BUTNET_MAXCMD];
char userData[BUTNET_MAXCMD];
struct {
StdInt32 context, win, type, x,y, w,h;
} mouse;
/* mouseAck needs no data. */
struct {
StdInt32 butId;
StdInt32 newFlags;
} newFlags;
struct {
StdInt32 butId;
char butData[BUTNET_MAXCMD - sizeof(StdInt32)];
} butSpec;
} perType;
} ButNetMsg;
struct ButRnet_struct {
struct ButEnv_struct *env;
int partner, rmtPartner;
void *packet;
ButRnetState state;
bool error, lookupError, butNetError;
int errNum;
const char *who, *protocol;
ButOut (*ocallback)(struct ButRnet_struct *net);
ButOut (*callback)(struct ButRnet_struct *net, void *cmd, int cmdLen);
ButOut (*ccallback)(struct ButRnet_struct *net, const char *reason);
int wBufSize, wBufStart, wBufLen;
char *wBuffer;
int rBufAmt; /* How much stuff in the rBuffer? */
int rBufLen;
int rBufMsgLen;
struct ButNetMsg_struct rBuffer;
int fd;
int lWinId, lx,ly, lw,lh, lType;
int lPress, lTwitch;
ButRcur rc;
bool ackNeeded, mouseMove;
MAGIC_STRUCT
}; /* ButLnet typedef in but.h */
/**********************************************************************
* Functions
**********************************************************************/
/* Public. */
#define butRnet_valid(net) ((net)->state == butRnetState_open)
#define butRnet_error(net) ((net)->error)
#define butRnet_lookupError(net) ((net)->lookupError)
#define butRnet_specialError(net) ((net)->specialError)
#define butRnet_errNum(net) ((net)->errNum)
#define butRnet_packet(net) ((net)->packet)
#define butRnet_who(net) ((net)->who)
#define butRnet_protocol(net) ((net)->protocol)
#define butLnet_valid(net) ((net)->valid)
#define butLnet_error(net) ((net)->error)
#define butLnet_errNum(net) ((net)->errNum)
#define butLnet_packet(net) ((net)->packet)
/*
* butLnet_create and butRnet_create will return NULL if the system was
* compiled without sockets available.
*/
extern ButLnet *butLnet_create(ButEnv *env, int port, void *packet,
ButOut ocallback(ButRnet *net),
ButOut callback(ButRnet *net, void *cmd,
int cmdLen),
ButOut ccallback(ButRnet *net,
const char *reason));
extern void butLnet_destroy(ButLnet *net);
extern ButRnet *butRnet_create(ButEnv *env, const char *address, int port,
void *packet,
ButOut ocallback(ButRnet *net),
ButOut callback(ButRnet *net, void *cmd,
int cmdLen),
ButOut ccallback(ButRnet *net,
const char *reason));
extern void butRnet_accept(ButRnet *net);
extern void butRnet_send(ButRnet *net, void *buffer, int len);
extern void butRnet_destroy(ButRnet *net, const char *reason);
/* Private. */
extern void butRnet_mMove(ButEnv *env, int winId, int lx, int ly,
int lw, int lh, ButCur type);
extern void butRnet_butSpecSend(But *but, void *buffer, int len);
extern void butRnet_newFlags(ButEnv *env, int butId, uint newFlags);
#endif /* _BUTNET_H_ */
goban-1.1.orig/src/sgfPlay.c 0000644 0001750 0001750 00000017664 10270074300 013521 0 ustar al al /*
* src/sgfPlay.c, part of Complete Goban (game program)
* Copyright (C) 1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include
#include
#include "cgoban.h"
#include "goPic.h"
#include "sgf.h"
#include "sgfPlay.h"
#include "abut_msg.h"
/**********************************************************************
* Forward declarations
**********************************************************************/
static void processMoves(SgfElem *me, GoGame *game, int *handicap,
bool *handicapPlayed, Cgoban *cg);
static void processNodeMarks(SgfElem *me, GoGame *game, GoPic *pic,
bool *changed);
static void eraseObsoleteMarks(GoPic *pic, GoGame *game, bool *changed);
/**********************************************************************
* Functions
**********************************************************************/
int sgf_play(Sgf *mc, GoGame *game, GoPic *pic, int numNodes,
SgfElem *terminator) {
int handicap = 0, i, currentNode = 0;
SgfElem *me;
bool handicapPlayed = FALSE;
SgfElem *nodeStart = mc->top.activeChild;
bool *changed;
goGame_moveTo(game, 0);
if (numNodes >= 0)
++numNodes;
if (terminator != NULL) {
terminator = terminator->activeChild;
}
for (me = mc->top.activeChild;
(me != terminator) && numNodes; me = me->activeChild) {
assert(MAGIC(me));
mc->active = me;
if (me->type == sgfType_node) {
assert((me->childH == NULL) || (me->childH != me->childT) ||
(me->activeChild == me->childH));
--numNodes;
++currentNode;
if (numNodes) {
nodeStart = me->activeChild;
/*
* We take out the last move at each node to make sure that
* you don't see that silly ring forever. If there's another
* move coming then this will get undone when we move.
*/
goGame_noLastMove(game);
} else {
mc->active = me->parent;
}
} else {
assert(me->parent->childH == me->parent->childT);
assert(me->parent->activeChild == me->parent->childH);
if (pic == NULL)
processMoves(me, game, &handicap, &handicapPlayed, NULL);
else
processMoves(me, game, &handicap, &handicapPlayed, pic->cg);
}
}
/*
* Now set the clock to match the time that we had left.
for (i = game->moveNum - 1; i >= 0; --i) {
if (game->moves[i].color == goStone_white)
game->timers[goStone_white] = game->moves[i].time;
}
for (i = game->moveNum - 1; i >= 0; --i) {
if (game->moves[i].color == goStone_black)
game->timers[goStone_black] = game->moves[i].time;
}
*/
/*
* If there are handicap stones that were added automatically and aren't
* in the movechain, then add them now.
* This is really stupid. There is no way that adding handicap stones
* should be in the sgf play code! :-(
*/
if (!handicapPlayed && handicap && !game->passive) {
for (i = 0; i < goBoard_area(game->board); ++i) {
if (goBoard_stone(game->board, i) == goStone_black)
sgf_addStone(mc, goStone_black, goBoard_loc2Sgf(game->board, i));
}
}
/*
* If we were given a GoPic, then add marks to it now.
*/
if (pic) {
changed = wms_malloc(goBoard_area(game->board) * sizeof(bool));
memset(changed, 0, goBoard_area(game->board) * sizeof(bool));
while (nodeStart) {
if (nodeStart->type == sgfType_node)
break;
processNodeMarks(nodeStart, game, pic, changed);
nodeStart = nodeStart->activeChild;
}
eraseObsoleteMarks(pic, game, changed);
wms_free(changed);
}
if (me)
--currentNode;
return(currentNode);
}
static void processMoves(SgfElem *me, GoGame *game, int *handicap,
bool *handicapPlayed, Cgoban *cg) {
int i;
switch(me->type) {
case sgfType_node:
assert(0);
break;
case sgfType_handicap:
*handicap = me->iVal;
break;
case sgfType_whoseMove:
game->setWhoseMoveNum = game->moveNum;
game->setWhoseMoveColor = me->gVal;
game->whoseMove = me->gVal;
break;
case sgfType_move:
*handicapPlayed = TRUE;
i = goBoard_sgf2Loc(game->board, me->lVal);
if (!*handicap || (goBoard_stone(game->board, i) != goStone_black)) {
assert(game->passive || (me->gVal == game->whoseMove));
if (!goGame_isLegal(game, me->gVal, i)) {
Str errmsg;
char moveStr[5];
str_init(&errmsg);
goBoard_loc2Str(game->board, i, moveStr),
str_print(&errmsg, msg_badMoveInSgf, moveStr,
game->moveNum);
if (cg != NULL)
cgoban_createMsgWindow(cg, "CGoban: Error in SGF file",
str_chars(&errmsg));
str_deinit(&errmsg);
} else {
goGame_move(game, me->gVal, i, NULL);
}
}
if (*handicap)
--*handicap;
break;
case sgfType_pass:
if (game->state != goGameState_selectDead) {
/*
* IGS sends out games with more than two passes at the end of the
* game. If you've already gone to non-play state and you get
* passes, then ignore them.
*/
goGame_pass(game, me->gVal, NULL);
}
break;
case sgfType_setBoard:
i = goBoard_sgf2Loc(game->board, me->lVal);
if ((me->gVal == goStone_empty) &&
((game->state == goGameState_selectDead) ||
game->forcePlay)) {
if (!(game->flags[i] & GOGAMEFLAGS_MARKDEAD)) {
goGame_markDead(game, i);
}
} else {
if (goBoard_stone(game->board, i) != me->gVal) {
goGame_setBoard(game, me->gVal, i);
}
assert(goBoard_stone(game->board, i) == me->gVal);
}
break;
case sgfType_timeLeft:
if (me->iVal < 0) {
/*
* This is marking a time loss. Fake up the game structure to
* make it clear that this is what happened.
*/
game->maxMoves = ++game->moveNum;
}
game->moves[game->moveNum - 1].time.timeLeft = me->iVal;
break;
case sgfType_stonesLeft:
game->moves[game->moveNum - 1].time.aux = me->iVal;
break;
default:
break;
}
}
static void processNodeMarks(SgfElem *me, GoGame *game, GoPic *pic,
bool *changed) {
int loc, i;
GoMarkType mark;
bool err;
assert(MAGIC(me));
switch(me->type) {
case sgfType_territory:
loc = goBoard_sgf2Loc(game->board, me->lVal);
changed[loc] = TRUE;
mark = goMarkType_stone2sm(me->gVal);
if (goStone_isStone(goBoard_stone(game->board, loc))) {
if (!grid_grey(pic->boardButs[loc])) {
grid_setStone(pic->boardButs[loc], goBoard_stone(game->board, loc),
TRUE);
}
}
if (grid_markType(pic->boardButs[loc]) != mark) {
grid_setMark(pic->boardButs[loc], mark, 0);
}
break;
case sgfType_triangle:
case sgfType_circle:
case sgfType_square:
if (me->type == sgfType_triangle)
mark = goMark_triangle;
else if (me->type == sgfType_circle)
mark = goMark_circle;
else /* me->type == sgfType_square */
mark = goMark_square;
loc = goBoard_sgf2Loc(game->board, me->lVal);
changed[loc] = TRUE;
if (grid_grey(pic->boardButs[loc])) {
grid_setStone(pic->boardButs[loc], goBoard_stone(game->board, loc),
FALSE);
}
if (grid_markType(pic->boardButs[loc]) != mark) {
grid_setMark(pic->boardButs[loc], mark, 0);
}
break;
case sgfType_label:
loc = goBoard_sgf2Loc(game->board, me->lVal);
changed[loc] = TRUE;
/* See if it is a numeric label. */
i = wms_atoi(str_chars(me->sVal), &err);
if (err)
grid_setMark(pic->boardButs[loc], goMark_letter, str_chars(me->sVal)[0]);
else
grid_setMark(pic->boardButs[loc], goMark_number, i);
break;
default:
break;
}
}
static void eraseObsoleteMarks(GoPic *pic, GoGame *game, bool *changed) {
int loc;
for (loc = 0; loc < goBoard_area(game->board); ++loc) {
if (!changed[loc] && pic->boardButs[loc]) {
if (grid_grey(pic->boardButs[loc]) ||
(grid_markType(pic->boardButs[loc]) != goMark_none)) {
grid_setStone(pic->boardButs[loc], goBoard_stone(game->board, loc),
FALSE);
grid_setMark(pic->boardButs[loc], goMark_none, 0);
}
}
}
}
goban-1.1.orig/src/drawStone.c 0000644 0001750 0001750 00000055327 10270000000 014042 0 ustar al al /*
* src/drawStone.c, part of Complete Goban (game program)
* Copyright (C) 1995-1996 William Shubert.
* See "configure.h.in" for more copyright information.
*
* This code extends the wmslib/but library to add special buttons needed
* for cgoban.
*
* The globe data was extracted from the CIA World Data Bank II map database.
*
*/
#include
#include
#include
#include
#include
#include
#include "goBoard.h"
#ifdef _DRAWSTONE_H_
Levelization Error.
#endif
#include "drawStone.h"
/**********************************************************************
* Data Types
**********************************************************************/
typedef struct WhiteDesc_struct {
float cosTheta, sinTheta;
float stripeWidth, xAdd;
float stripeMul, zMul;
} WhiteDesc;
/**********************************************************************
* Forward Declarations
**********************************************************************/
static void decideAppearance(WhiteDesc *desc, int size, Rnd *rnd);
static float calcCosAngleReflection2View(int x, int y, int r,
float *lambertian, float *z);
static void drawNngs(Display *dpy, GC gc, Pixmap pic, int xOff, int size);
static void drawIgs(Display *dpy, GC gc, Pixmap pic, int xOff, int size);
static void drawWorld(Display *dpy, GC gc, Pixmap pic, int xOff, int size,
const XPoint data[]);
static int yinYangX(int size, int y);
/**********************************************************************
* Global Variables
**********************************************************************/
void drawStone_newPics(ButEnv *env, Rnd *rnd, int baseColor,
Pixmap *stonePixmap, Pixmap *maskBitmap, int size,
bool color) {
XImage *stones;
GC gc1;
Display *dpy = env->dpy;
uchar *maskData;
int maxRadius;
int maskW;
int x, y, i, wBright, bBright, yyx;
XGCValues values;
float bright, lambertian, z;
float wStripeLoc, wStripeColor;
WhiteDesc white[DRAWSTONE_NUMWHITE];
int sizeLimit;
stones = butEnv_imageCreate(env, size * (DRAWSTONE_NUMWHITE + 1), size);
maskW = (size * 6 + 7) >> 3;
maskData = wms_malloc(maskW * size);
memset(maskData, 0, maskW * size);
for (i = 0; i < DRAWSTONE_NUMWHITE; ++i) {
decideAppearance(&white[i], size, rnd);
}
maxRadius = size * size;
sizeLimit = (int)((size - butEnv_fontH(env, 0) * 0.14) *
(size - butEnv_fontH(env, 0) * 0.14));
if (sizeLimit > ((size - 1) * (size - 1)))
sizeLimit = (size - 1) * (size - 1);
for (y = 0; y < size; ++y) {
yyx = yinYangX(size, y);
for (x = 0; x < size; ++x) {
/*
* Here we build the masks. We need three basic masks; the solid
* circular mask, and two dithered masks used for semitransparent
* stones.
* Then after that we have the yin yang mask. We have the world masks
* too, but we make those in a separate function.
*/
if (((size - 1) - (x+x)) * ((size - 1) - (x+x)) +
((size - 1) - (y+y)) * ((size - 1) - (y+y)) <= maxRadius) {
maskData[(x >> 3) + (y * maskW)] |= (1 << (x & 7));
x += size;
if ((x & 1) == (y & 1))
maskData[(x >> 3) + (y * maskW)] |= (1 << (x & 7));
x += size;
if ((x & 1) == (y & 1))
maskData[(x >> 3) + (y * maskW)] |= (1 << (x & 7));
x += size;
if (x - size*3 < yyx)
maskData[(x >> 3) + (y * maskW)] |= (1 << (x & 7));
x -= size*3;
/*
* Now we do the actual stone. If it's a greyscale/b&w display, it's
* easy because there is no rendering going on.
*/
if (!color) {
XPutPixel(stones, x, y, butEnv_color(env, BUT_BLACK));
if (((size - 1) - (x+x)) * ((size - 1) - (x+x)) +
((size - 1) - (y+y)) * ((size - 1) - (y+y)) <
sizeLimit) {
for (i = 0; i < DRAWSTONE_NUMWHITE; ++i) {
XPutPixel(stones, x+size*(i+1), y, butEnv_color(env, BUT_WHITE));
}
} else {
for (i = 0; i < DRAWSTONE_NUMWHITE; ++i) {
XPutPixel(stones, x+size*(i+1), y, butEnv_color(env, BUT_BLACK));
}
}
} else {
/*
* All right, time to add some color. First we calculate the
* cosine of the angle of reflection to the angle of the viewer.
* This is the basic quantity used to calculate the amount of
* light seen in phong shading. You raise this value to a
* power; the higher the power, the "shinier" the object you are
* rendering. For the black stones, which aren't very shiny,
* I use bright^4. For the white stones, which are very shiny,
* I use bright^32. Then you multiply this value by the
* intensity of the object at the point of rendering, add a
* little bit of lambertian reflection and a tiny bit of ambient
* light, and you're done!
*/
bright = calcCosAngleReflection2View((size - 1) - (x+x),
(size - 1) - (y + y),
size+size, &lambertian, &z);
bright *= bright;
bright *= bright;
bBright = bright*165.0 + lambertian*10.0 - 5.0;
bright *= bright;
bright *= bright;
bright *= bright;
if (bBright > 255)
bBright = 255;
if (bBright < 0)
bBright = 0;
XPutPixel(stones, x, y, butEnv_color(env, baseColor + bBright));
/*
* OK, the black stones are done. Now for the white stones.
* Here we have to add the stripes. The algorithm for stripe
* intensity is just something I made up. I kept tweaking
* parameters and screwing around with it until it looked sort
* of like my stones. The stripes are too regular, some day I
* may go back and change that, but for now it is acceptable
* looking IMHO.
*/
for (i = 0; i < DRAWSTONE_NUMWHITE; ++i) {
wStripeLoc = (x*white[i].cosTheta - y*white[i].sinTheta) +
white[i].xAdd;
wStripeLoc += cos(wStripeLoc/4);
wStripeColor = fmod(wStripeLoc + (z * z * z * white[i].zMul) *
white[i].stripeWidth,
white[i].stripeWidth) / white[i].stripeWidth;
wStripeColor = wStripeColor * white[i].stripeMul - 0.5;
if (wStripeColor < 0.0)
wStripeColor = -2.0 * wStripeColor;
if (wStripeColor > 1.0)
wStripeColor = 1.0;
wStripeColor = wStripeColor * 0.15 + 0.85;
wBright = bright*70.0 +
wStripeColor * (lambertian*120.0 + 110.0);
if (wBright > 255)
wBright = 255;
if (wBright < 0)
wBright = 0;
XPutPixel(stones, x+(i+1)*size, y,
butEnv_color(env, baseColor + wBright));
}
}
}
}
}
*stonePixmap =
XCreatePixmap(dpy, RootWindow(dpy, DefaultScreen(dpy)),
size * (DRAWSTONE_NUMWHITE + 1),
size, DefaultDepth(dpy, DefaultScreen(dpy)));
XPutImage(dpy, *stonePixmap, env->gc2, stones, 0,0, 0,0,
size * (DRAWSTONE_NUMWHITE + 1), size);
butEnv_imageDestroy(stones);
*maskBitmap =
XCreateBitmapFromData(dpy, RootWindow(dpy, DefaultScreen(dpy)),
(void *)maskData, maskW<<3, size);
/*
* The "void *" above is because maskData should be a uchar, but the
* function prototype specifies a char.
*/
wms_free(maskData);
values.graphics_exposures = False;
gc1 = XCreateGC(dpy, *maskBitmap, GCGraphicsExposures, &values);
/* Do that whole world thing, you know, the world thing. */
XSetForeground(dpy, gc1, 1);
drawNngs(dpy, gc1, *maskBitmap, size*4, size);
drawIgs(dpy, gc1, *maskBitmap, size*5, size);
XSetFunction(dpy, gc1, GXand);
XCopyArea(dpy, *maskBitmap, *maskBitmap, gc1, 0,0, size,size, size*4,0);
XCopyArea(dpy, *maskBitmap, *maskBitmap, gc1, 0,0, size,size, size*5,0);
}
/*
* Viewing vector is simply "z".
* I model the stones as the top part of the sphere with the viewer looking
* straight down on them. lx*i+ly*j+lz*k is the angle of incident light.
* If you draw out the vectors and work out the equation, you'll notice that
* it very nicely simplifies down to what you get here. The lambertian
* intensity (lambertian) and the z magnitude of the surface normal (z)
* aren't really related to the cosine being calculated, but they share
* many operations with it so it saves CPU time to calculate them at the
* same time.
*/
static float calcCosAngleReflection2View(int x, int y, int r,
float *lambertian, float *z) {
const float lx = 0.35355339, ly = 0.35355339, lz = 0.8660254;
float nx, ny, nz, rz;
float nDotL;
nz = sqrt((double)(r * r - x * x - y * y));
*z = 1.0 - (nz / r);
nx = (float)x;
ny = (float)y;
nDotL = (nx*lx + ny*ly + nz*lz) / r;
rz = (2.0 * nz * nDotL) / r - lz;
*lambertian = nDotL;
return(rz);
}
/*
* drawNngs and drawIgs are a list of vectors to draw to outline the world.
* I took GIFs produced by XGlobe, which got it's data from the
* CIA World Data Bank II map database. Then I wrote a program that
* traced the outlines of the continents of those gifs, clipped out
* unnecessare points, and saved the results as these list of points for
* the polygons. Pretty cool, huh?
*/
static void drawNngs(Display *dpy, GC gc, Pixmap pic, int xOff, int size) {
static const XPoint nngsData[] = {
{120,0},{145,0},{147,2},{153,2},{155,4},{157,4},{159,6},{161,6},{161,9},
{159,11},{159,17},{158,17},{156,15},{152,15},{148,11},{146,11},{140,5},
{138,5},{136,3},{130,3},{129,2},{128,2},{126,4},{126,5},{127,6},{131,6},
{133,8},{135,8},{137,10},{137,13},{135,15},{134,15},{132,13},{128,13},
{126,11},{124,11},{124,9},{123,8},{122,8},{119,11},{119,13},{116,13},
{116,7},{115,6},{114,6},{113,7},{113,13},{109,13},{105,17},{105,18},
{107,20},{111,20},{113,22},{117,22},{117,26},{118,27},{119,27},{120,26},
{120,22},{122,22},{123,21},{123,20},{122,19},{122,14},{125,14},{127,16},
{131,16},{133,18},{136,18},{138,16},{139,16},{145,22},{147,22},{149,24},
{151,24},{151,28},{153,30},{157,30},{157,33},{150,33},{150,29},{149,28},
{148,28},{147,29},{145,29},{142,32},{142,33},{143,34},{147,34},{147,37},
{145,37},{143,39},{140,39},{138,37},{137,37},{133,41},{133,43},{131,43},
{123,51},{123,53},{119,57},{117,57},{113,61},{113,66},{115,68},{115,71},
{113,73},{112,73},{110,71},{110,67},{106,63},{99,63},{97,65},{87,65},
{85,67},{83,67},{81,69},{81,75},{79,77},{79,82},{84,87},{85,87},{86,86},
{90,86},{92,84},{92,82},{94,80},{99,80},{99,85},{97,87},{97,90},{99,92},
{105,92},{107,94},{107,99},{105,101},{105,102},{110,107},{111,107},
{112,106},{117,106},{119,108},{120,108},{122,106},{122,104},{124,102},
{128,102},{130,100},{133,100},{135,102},{139,102},{141,104},{155,104},
{155,106},{159,110},{161,110},{165,114},{171,114},{173,116},{175,116},
{177,118},{177,122},{179,124},{179,126},{181,128},{185,128},{187,130},
{189,130},{191,132},{193,132},{195,134},{199,134},{203,138},{205,138},
{207,140},{207,147},{205,149},{205,151},{199,157},{199,161},{197,163},
{197,167},{195,169},{195,171},{191,175},{191,177},{187,177},{185,179},
{183,179},{181,181},{179,181},{177,183},{177,185},{175,187},{175,189},
{163,201},{159,201},{157,203},{157,205},{155,207},{153,207},{151,209},
{149,209},{138,220},{138,221},{139,222},{139,223},{135,227},{135,230},
{137,232},{137,233},{132,233},{130,231},{128,231},{128,229},{126,227},
{126,220},{128,218},{128,217},{126,215},{126,212},{128,210},{128,204},
{130,202},{130,198},{132,196},{132,186},{134,184},{134,169},{128,163},
{126,163},{124,161},{122,161},{122,157},{118,153},{118,151},{116,149},
{116,147},{110,141},{110,136},{112,134},{112,126},{114,126},{116,124},
{116,122},{119,119},{119,118},{118,117},{118,111},{115,108},{114,108},
{113,109},{113,111},{110,111},{108,109},{106,109},{102,105},{100,105},
{100,103},{96,99},{94,99},{92,97},{88,97},{83,92},{82,92},{81,93},
{76,93},{74,91},{72,91},{70,89},{68,89},{64,85},{64,77},{60,73},{60,65},
{57,62},{56,62},{55,63},{55,64},{57,66},{57,74},{59,76},{59,77},{56,77},
{56,73},{52,69},{52,68},{54,66},{54,65},{52,63},{52,57},{50,55},{50,48},
{52,46},{52,44},{54,42},{54,40},{60,34},{60,32},{62,30},{62,28},{63,27},
{63,26},{62,25},{62,24},{67,19},{67,18},{66,17},{62,17},{62,16},{64,16},
{66,14},{68,14},{70,12},{72,12},{74,10},{76,10},{78,8},{82,8},{84,6},
{87,6},{88,7},{89,7},{90,6},{91,6},{93,8},{94,8},{98,4},{104,4},{106,2},
{107,2},{107,6},{108,7},{109,7},{110,6},{110,2},{111,2},{111,4},{112,5},
{113,5},{114,4},{114,2},{118,2},{119,1},{-1,-1},{168,10},{173,10},
{175,12},{175,13},{172,13},{170,11},{168,11},{-1,-1},{186,14},{189,14},
{197,22},{199,22},{201,24},{205,24},{213,32},{215,32},{219,36},{219,38},
{221,40},{221,44},{225,48},{225,50},{226,51},{227,51},{228,50},{229,50},
{235,56},{235,58},{239,62},{239,64},{241,66},{241,68},{243,70},{243,72},
{245,74},{245,76},{247,78},{247,82},{249,84},{249,88},{251,90},{251,94},
{253,96},{253,104},{255,106},{255,137},{254,137},{254,119},{251,116},
{250,116},{249,117},{248,117},{247,116},{246,116},{245,117},{242,117},
{242,115},{238,111},{238,107},{232,101},{232,97},{230,95},{230,87},
{228,85},{228,83},{226,81},{226,66},{227,65},{227,64},{226,63},{226,61},
{224,59},{224,53},{222,51},{220,51},{216,47},{216,45},{212,41},{212,38},
{213,37},{213,36},{212,35},{210,35},{202,27},{198,27},{190,19},{190,17},
{188,15},{186,15},{-1,-1},{110,76},{113,76},{115,78},{117,78},{119,80},
{121,80},{123,82},{125,82},{125,83},{123,83},{120,86},{120,87},{121,88},
{121,89},{118,89},{118,86},{119,85},{119,84},{116,81},{114,81},{112,79},
{106,79},{106,78},{108,78},{109,77},{-1,-1},{128,84},{135,84},{137,86},
{139,86},{139,87},{135,87},{133,89},{132,89},{130,87},{126,87},{126,86},
{127,85},{-1,-1},{142,86},{143,86},{143,89},{142,89},{142,87},{-1,-1},
{88,128},{89,128},{89,129},{88,129},{-1,-1},{254,142},{255,142},
{255,143},{254,143},{-1,-1},{250,162},{251,162},{251,165},{250,165},
{250,163},{-1,-1},{146,228},{149,228},{149,229},{146,229},{-1,-1},
{140,242},{143,242},{143,243},{141,243},{139,245},{137,245},{136,246},
{136,247},{137,248},{137,249},{135,251},{133,251},{132,252},{132,253},
{133,254},{136,254},{138,252},{139,252},{141,254},{142,254},{144,252},
{154,252},{156,250},{162,250},{164,248},{167,248},{167,249},{165,251},
{161,251},{159,253},{151,253},{149,255},{106,255},{104,253},{98,253},
{98,250},{107,250},{108,251},{109,251},{110,250},{124,250},{126,248},
{130,248},{134,244},{138,244},{139,243},{-2,-2}};
drawWorld(dpy, gc, pic, xOff, size, nngsData);
}
static void drawIgs(Display *dpy, GC gc, Pixmap pic, int xOff, int size) {
static const XPoint igsData[] = {
{106,2},{115,2},{117,4},{121,4},{123,6},{126,6},{128,4},{128,2},{131,2},
{135,6},{143,6},{145,8},{163,8},{164,9},{165,9},{166,8},{166,6},{171,6},
{173,8},{177,8},{179,10},{181,10},{183,12},{185,12},{187,14},{189,14},
{191,16},{191,23},{190,23},{190,21},{186,17},{180,17},{174,11},{167,11},
{165,13},{165,15},{163,15},{161,17},{159,17},{157,19},{157,23},{155,25},
{155,27},{152,27},{150,25},{150,18},{151,17},{151,16},{150,15},{149,15},
{147,17},{133,17},{128,22},{128,23},{129,24},{135,24},{135,28},{137,30},
{137,31},{135,33},{134,33},{134,29},{133,28},{132,28},{131,29},{131,33},
{127,37},{125,37},{121,41},{117,41},{111,47},{111,48},{113,50},{113,53},
{111,55},{106,55},{106,51},{104,49},{104,48},{105,47},{105,46},{104,45},
{103,45},{101,47},{100,47},{98,45},{97,45},{95,47},{95,48},{97,50},
{101,50},{101,51},{97,51},{95,53},{95,56},{97,58},{97,65},{91,71},
{91,72},{92,73},{93,73},{94,72},{95,72},{95,77},{93,79},{92,79},{92,75},
{91,74},{90,74},{89,75},{87,75},{85,77},{83,77},{81,79},{77,79},{73,83},
{73,85},{71,87},{68,87},{68,84},{69,83},{69,82},{68,81},{67,81},{63,85},
{63,88},{67,92},{67,103},{65,103},{59,109},{58,109},{58,105},{53,100},
{52,100},{49,103},{49,108},{55,114},{55,128},{59,132},{61,132},{63,134},
{63,135},{61,135},{59,137},{59,138},{61,140},{63,140},{65,142},{75,142},
{79,146},{93,146},{93,147},{91,147},{89,149},{89,151},{88,151},{88,149},
{86,147},{70,147},{68,145},{62,145},{56,139},{54,139},{52,137},{52,135},
{50,133},{50,131},{49,130},{48,130},{47,131},{46,131},{46,130},{47,129},
{47,128},{44,125},{44,121},{40,117},{40,116},{45,116},{48,119},{49,119},
{50,118},{50,115},{48,113},{48,111},{46,109},{46,106},{48,104},{48,93},
{47,92},{46,92},{45,93},{44,93},{42,91},{42,90},{44,88},{44,87},{42,85},
{42,81},{40,79},{39,79},{23,95},{23,99},{21,101},{21,108},{23,110},
{23,111},{21,113},{21,115},{20,115},{20,109},{19,108},{18,108},{17,109},
{16,109},{16,88},{18,86},{18,83},{16,81},{16,78},{18,76},{18,75},{16,73},
{15,73},{13,75},{13,77},{11,79},{11,81},{9,83},{9,85},{7,87},{7,89},
{5,91},{4,91},{4,90},{6,88},{6,84},{8,82},{8,78},{10,76},{10,74},{14,70},
{14,66},{16,64},{16,62},{20,58},{20,56},{24,52},{24,50},{34,40},{34,38},
{36,36},{38,36},{40,34},{40,32},{42,32},{50,24},{52,24},{56,20},{58,20},
{62,16},{64,16},{66,14},{68,14},{70,12},{72,12},{74,10},{76,10},{78,8},
{84,8},{86,6},{90,6},{92,4},{93,4},{94,5},{95,5},{96,4},{104,4},{105,3},
{-1,-1},{134,36},{135,36},{137,38},{139,38},{139,41},{135,41},{133,43},
{133,44},{135,46},{135,47},{133,49},{133,53},{131,53},{129,55},{127,55},
{125,57},{117,57},{115,59},{115,61},{112,61},{112,58},{118,52},{124,52},
{130,46},{130,44},{131,43},{131,42},{130,41},{130,40},{132,40},{134,38},
{134,37},{-1,-1},{92,86},{93,86},{95,88},{95,91},{93,93},{93,94},{95,96},
{97,96},{97,98},{99,100},{101,100},{101,103},{98,106},{98,107},{99,108},
{103,108},{103,111},{101,113},{101,115},{98,115},{95,112},{94,112},
{93,113},{92,113},{92,110},{94,108},{94,105},{92,103},{92,102},{93,102},
{95,104},{96,104},{97,103},{97,102},{96,101},{96,99},{95,98},{94,98},
{93,99},{90,99},{90,95},{88,93},{88,92},{90,90},{90,88},{91,87},{-1,-1},
{80,112},{83,112},{87,116},{87,117},{85,117},{83,119},{83,122},{85,124},
{85,125},{83,127},{83,129},{81,131},{81,135},{79,137},{76,137},{74,135},
{68,135},{68,131},{66,129},{66,124},{68,124},{76,116},{78,116},{80,114},
{80,113},{-1,-1},{90,124},{93,124},{95,126},{96,126},{98,124},{99,124},
{99,125},{97,127},{91,127},{90,128},{90,129},{91,130},{95,130},{95,131},
{93,131},{92,132},{92,133},{93,134},{93,136},{95,138},{95,139},{92,139},
{91,138},{90,138},{89,139},{89,141},{88,141},{86,139},{86,130},{88,128},
{88,126},{89,125},{-1,-1},{104,124},{107,124},{107,127},{105,129},
{105,131},{104,131},{104,125},{-1,-1},{114,128},{117,128},{119,130},
{119,132},{121,134},{122,134},{123,133},{123,132},{122,131},{122,130},
{123,130},{124,131},{125,131},{126,130},{127,130},{129,132},{133,132},
{135,134},{139,134},{141,136},{143,136},{147,140},{149,140},{149,144},
{155,150},{155,151},{150,151},{144,145},{141,145},{137,149},{134,149},
{131,146},{130,146},{129,147},{128,147},{128,141},{126,139},{124,139},
{122,137},{116,137},{114,135},{114,133},{112,131},{112,130},{113,129},
{-1,-1},{100,132},{101,132},{103,134},{103,137},{102,137},{102,135},
{100,133},{-1,-1},{106,134},{111,134},{111,135},{106,135},{-1,-1},
{158,136},{161,136},{161,137},{157,141},{152,141},{152,140},{154,140},
{157,137},{-1,-1},{98,146},{103,146},{103,147},{101,149},{99,149},
{97,151},{96,151},{96,148},{97,147},{-1,-1},{174,148},{177,148},
{179,150},{179,151},{178,151},{176,149},{174,149},{-1,-1},{110,152},
{113,152},{114,153},{115,153},{116,152},{117,152},{119,154},{125,154},
{125,159},{124,160},{124,161},{127,164},{129,164},{131,166},{132,166},
{134,164},{134,158},{136,156},{136,152},{139,152},{139,156},{143,160},
{143,162},{145,164},{145,168},{147,170},{149,170},{151,172},{151,174},
{157,180},{157,193},{155,195},{155,197},{149,203},{149,205},{147,207},
{132,207},{128,203},{126,203},{126,201},{125,200},{124,200},{123,201},
{122,201},{122,199},{118,195},{109,195},{107,197},{103,197},{101,199},
{95,199},{93,201},{88,201},{86,199},{86,195},{84,193},{84,191},{80,187},
{80,183},{78,181},{78,176},{80,176},{84,172},{88,172},{90,170},{92,170},
{94,168},{94,164},{96,164},{102,158},{105,158},{107,160},{108,160},
{110,158},{110,156},{111,155},{111,154},{110,153},{-1,-1},{208,164},
{209,164},{209,165},{207,167},{204,167},{204,166},{206,166},{207,165},
{-1,-1},{180,172},{183,172},{185,174},{185,177},{184,177},{180,173},
{-1,-1},{188,202},{189,202},{193,206},{193,207},{187,213},{186,213},
{186,208},{188,206},{188,203},{-1,-1},{144,210},{145,210},{145,213},
{143,215},{140,215},{138,213},{138,212},{142,212},{143,211},{-1,-1},
{180,212},{183,212},{183,215},{181,215},{175,221},{170,221},{170,218},
{172,218},{174,216},{176,216},{179,213},{-1,-1},{90,244},{101,244},
{102,245},{103,245},{104,244},{109,244},{111,246},{112,246},{114,244},
{117,244},{118,245},{119,245},{120,244},{129,244},{131,246},{141,246},
{143,248},{149,248},{149,249},{147,251},{143,251},{141,253},{139,253},
{137,255},{106,255},{104,253},{96,253},{94,251},{90,251},{88,249},
{84,249},{82,247},{78,247},{78,246},{88,246},{89,245},{-1,-1},{152,252},
{155,252},{155,253},{152,253},{-2,-2}};
drawWorld(dpy, gc, pic, xOff, size, igsData);
}
/*
* Here we take the world polygon point list and trace it out into a bitmap.
*/
static void drawWorld(Display *dpy, GC gc, Pixmap pic, int xOff, int size,
const XPoint data[]) {
XPoint temp[344];
int i, numPoints;
numPoints = 0;
for (i = 0;; ++i) {
if (data[i].x < 0) {
if (numPoints > 2) {
XFillPolygon(dpy, pic, gc, temp, numPoints, Complex, CoordModeOrigin);
}
numPoints = 0;
if (data[i].x == -2)
return;
} else {
temp[numPoints].x = ((data[i].x * (size + 1)) >> 8) + xOff;
temp[numPoints].y = ((data[i].y * (size + 1)) >> 8);
if ((numPoints == 0) || (temp[numPoints - 1].x != temp[numPoints].x) ||
(temp[numPoints - 1].y != temp[numPoints].y)) {
++numPoints;
assert(numPoints <= 344);
}
}
}
}
/*
* Returns the answer:
* Where is the x coordinate of the "seam" in the yin yang symbol for this
* particular y value?
*/
static int yinYangX(int size, int y) {
float center;
float fy = y + 0.5;
if (y < size / 2) {
center = (float)size * 0.25;
return((int)((float)size * 0.5 +
sqrt(center * center -
(fy - center) * (fy - center)) +
0.5));
} else {
center = (float)size * 0.75;
return((int)((float)size * 0.5 -
sqrt((float)(size * size) * 0.0625 -
(fy - center) * (fy - center)) +
0.5));
}
}
static void decideAppearance(WhiteDesc *desc, int size, Rnd *rnd) {
double minStripeW, maxStripeW, theta;
minStripeW = (float)size / 20.0;
if (minStripeW < 2.5)
minStripeW = 2.5;
maxStripeW = (float)size / 5.0;
if (maxStripeW < 4.0)
maxStripeW = 4.0;
theta = rnd_float(rnd) * 2.0 * M_PI;
desc->cosTheta = cos(theta);
desc->sinTheta = sin(theta);
desc->stripeWidth = minStripeW +
(rnd_float(rnd) * (maxStripeW - minStripeW));
desc->xAdd = rnd_float(rnd) * desc->stripeWidth +
(float)size * 3; /* Make sure that all x's are positive! */
desc->stripeMul = rnd_float(rnd) * 4.0 + 1.5;
desc->zMul = rnd_float(rnd) * 650.0 + 70.0;
}
goban-1.1.orig/src/editBoard.c 0000644 0001750 0001750 00000100523 10270000050 013763 0 ustar al al /*
* src/editBoard.c, part of Complete Goban (game program)
* Copyright (C) 1995-1997 William Shubert
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "cgoban.h"
#include "sgf.h"
#include "sgfIn.h"
#include "sgfPlay.h"
#include "sgfOut.h"
#include "goban.h"
#include "msg.h"
#include "sgfMap.h"
#ifdef _EDITBOARD_H_
#error Levelization Error.
#endif
#include "editBoard.h"
/**********************************************************************
* Data types
**********************************************************************/
typedef enum {
setMark_toggle, setMark_forceOn, setMark_forceOff
} SetMarkAction;
/**********************************************************************
* Forward declarations
**********************************************************************/
static void toolsQuit(void *packet);
static GobanOut gridPressed(void *packet, int loc);
static GobanOut quitPressed(void *packet);
static GobanOut passPressed(void *packet);
static GobanOut rewPressed(void *packet);
static GobanOut backPressed(void *packet);
static GobanOut fwdPressed(void *packet);
static GobanOut ffPressed(void *packet);
static GobanOut donePressed(void *packet);
static GobanOut disputePressed(void *packet);
static GobanOut savePressed(void *packet);
static GobanOut gameInfoPressed(void *packet);
static void writeGobanComments(EditBoard *e), readGobanComments(EditBoard *e);
static void clearComments(EditBoard *eb);
static bool backOk(void *packet);
static bool fwdOk(void *packet);
static void saveFile(AbutFsel *fsel, void *packet, const char *fname);
static void gobanDestroyed(void *packet);
static GobanOut jumpToLoc(EditBoard *eb, int loc);
static void addPattern(EditBoard *eb, GoStone color, int loc);
static void setMark(EditBoard *eb, SgfType sType, int loc,
SetMarkAction action);
static void addLetter(EditBoard *eb, int loc);
static bool addNumber(EditBoard *eb, int loc, bool moveNum);
static bool markGroup(EditBoard *eb, SgfType type, int loc);
static ButOut newTool(void *packet);
static ButOut shiftPressed(But *but, bool press);
static ButOut newActiveSgfNode(void *packet, int nodeNum);
static void changeWhoseMove(EditBoard *eb);
static ButOut reallyQuit(But *but);
static ButOut dontQuit(But *but);
static ButOut quitWinDead(void *packet);
static EditBoard *createSgf(Cgoban *cg, Sgf *sgf, const char *fName);
static void infoDead(EditInfo *info, void *packet);
/**********************************************************************
* Global variables
**********************************************************************/
static const GobanActions editBoard_actions = {
gridPressed, quitPressed, passPressed, rewPressed, backPressed,
fwdPressed, ffPressed, donePressed, disputePressed, savePressed,
NULL, /* editPressed / printPressed */ gameInfoPressed,
&help_editBoard,
gobanDestroyed,
backOk, backOk, fwdOk, fwdOk};
/**********************************************************************
* Functions
**********************************************************************/
EditBoard *editBoard_create(Cgoban *cg, const char *fName) {
Sgf *sgf;
const char *err;
Str *tmpTitle;
bool noFile = FALSE;
sgf = sgf_createFile(cg, fName, &err, &noFile);
if (sgf == NULL) {
if (noFile) {
tmpTitle = str_create();
str_print(tmpTitle, msg_noSuchGame, fName);
abutMsg_winCreate(cg->abut, "Cgoban Error", str_chars(tmpTitle));
str_destroy(tmpTitle);
} else {
abutMsg_winCreate(cg->abut, "Cgoban Error", err);
}
return(FALSE);
}
return(createSgf(cg, sgf, fName));
}
EditBoard *editBoard_createSgf(Cgoban *cg, const Sgf *sgf) {
EditBoard *eb;
eb = createSgf(cg, sgf_copy(sgf), NULL);
if (eb != NULL) {
ffPressed(eb);
goban_update(eb->goban);
}
return(eb);
}
static EditBoard *createSgf(Cgoban *cg, Sgf *sgf, const char *fName) {
EditBoard *eb;
SgfElem *me;
const char *white = NULL, *black = NULL, *title;
GoRules rules;
int size;
int hcap;
float komi;
GoTime time;
static const ButKey shiftKeys[] = {{XK_Shift_L, 0,0},
{XK_Shift_R,0,0}, {0,0,0}};
static const ButKey shiftUpKeys[] = {{XK_Up, ShiftMask, ShiftMask},
{0,0,0}};
static const ButKey shiftDownKeys[] = {{XK_Down, ShiftMask, ShiftMask},
{0,0,0}};
Str *tmpTitle = NULL;
sgf->mode = sgfInsert_variant;
eb = wms_malloc(sizeof(EditBoard));
MAGIC_SET(eb);
eb->cg = cg;
eb->fsel = NULL;
eb->reallyQuit = NULL;
eb->sgf = sgf;
me = sgf_findType(sgf, sgfType_rules);
if (me) {
rules = (GoRules)me->iVal;
} else
rules = goRules_japanese;
me = sgf_findType(sgf, sgfType_size);
if (me) {
size = me->iVal;
} else {
size = 19;
}
me = sgf_findType(sgf, sgfType_handicap);
if (me) {
hcap = me->iVal;
} else {
hcap = 0;
}
me = sgf_findType(sgf, sgfType_komi);
if (me) {
komi = (float)me->iVal / 2.0;
} else {
komi = 0.0;
}
me = sgf_findFirstType(sgf, sgfType_playerName);
while (me) {
if (me->gVal == goStone_white)
white = str_chars(me->sVal);
else {
assert(me->gVal == goStone_black);
black = str_chars(me->sVal);
}
me = sgfElem_findFirstType(me, sgfType_playerName);
}
str_init(&eb->fName);
if (fName != NULL) {
str_copyChars(&eb->fName, fName);
} else if (white && black) {
str_print(&eb->fName, "%s-%s.sgf", white, black);
} else {
str_copyChars(&eb->fName, "game.sgf");
}
me = sgf_findFirstType(sgf, sgfType_time);
if (me) {
goTime_parseDescribeChars(&time, str_chars(me->sVal));
} else {
time.type = goTime_none;
}
eb->game = goGame_create(size, rules, hcap, komi, &time, TRUE);
sgf_play(sgf, eb->game, NULL, eb->currentNodeNum = 0, NULL);
++eb->game->maxMoves;
me = sgf_findFirstType(sgf, sgfType_title);
if (me) {
title = str_chars(me->sVal);
} else {
if (white && black) {
tmpTitle = str_create();
str_print(tmpTitle, msg_localTitle, white, black);
title = str_chars(tmpTitle);
} else
title = msg_noTitle;
}
eb->goban = goban_create(cg, &editBoard_actions, eb, eb->game, "edit",
title);
if (tmpTitle)
str_destroy(tmpTitle);
eb->goban->iDec1 = stoneGroup_create(&cg->cgbuts, eb->goban->iWin, 2,
BUT_DRAWABLE);
assert((hcap == 0) || ((hcap >= 2) && (hcap <= 27)));
butCt_setText(eb->goban->edit, msg_printGame);
eb->lastComment = NULL;
editToolWin_init(&eb->tools, cg, eb->sgf, toolsQuit,
newTool, newActiveSgfNode, eb);
eb->oldTool = editTool_changeBoard;
eb->shiftKeytrap = butKeytrap_create(shiftPressed, eb, eb->goban->win,
BUT_DRAWABLE|BUT_PRESSABLE);
but_setKeys(eb->shiftKeytrap, shiftKeys);
eb->prevVar = butKeytrap_create(editToolWin_shiftUpPressed, &eb->tools,
eb->goban->win, BUT_DRAWABLE|BUT_PRESSABLE);
but_setKeys(eb->prevVar, shiftUpKeys);
eb->nextVar = butKeytrap_create(editToolWin_shiftDownPressed, &eb->tools,
eb->goban->win, BUT_DRAWABLE|BUT_PRESSABLE);
but_setKeys(eb->nextVar, shiftDownKeys);
eb->invertShift = FALSE;
butKeytrap_setHold(eb->shiftKeytrap, FALSE);
writeGobanComments(eb);
newTool(eb);
eb->info = NULL;
return(eb);
}
void editBoard_destroy(EditBoard *eb) {
assert(MAGIC(eb));
str_deinit(&eb->fName);
if (eb->reallyQuit) {
abutMsg_destroy(eb->reallyQuit, FALSE);
eb->reallyQuit = NULL;
}
if (eb->sgf)
sgf_destroy(eb->sgf);
if (eb->goban)
goban_destroy(eb->goban, FALSE);
if (eb->game)
goGame_destroy(eb->game);
editToolWin_deinit(&eb->tools);
if (eb->info) {
editInfo_destroy(eb->info, FALSE);
eb->info = NULL;
}
MAGIC_UNSET(eb);
wms_free(eb);
}
static void toolsQuit(void *packet) {
quitPressed(packet);
}
static GobanOut gridPressed(void *packet, int loc) {
EditBoard *eb = packet;
ButEnv *env;
GobanOut result = gobanOut_draw;
assert(MAGIC(eb));
assert(eb->sgf->active != NULL);
env = eb->cg->env;
switch(eb->tools.tool) {
case editTool_play:
if (butEnv_keyModifiers(env) & ShiftMask) {
result = jumpToLoc(eb, loc);
} else {
if (goBoard_stone(eb->game->board, loc) != goStone_empty) {
result = gobanOut_err;
} else {
eb->tools.modified = TRUE;
readGobanComments(eb);
sgf_addNode(eb->sgf);
assert(eb->sgf->active->mapX < 1000);
editToolWin_nodeAdded(&eb->tools, eb->sgf->active);
sgf_move(eb->sgf, goGame_whoseMove(eb->game),
goBoard_loc2Sgf(eb->game->board, loc));
sgf_play(eb->sgf, eb->game, eb->goban->pic, ++eb->currentNodeNum,
NULL);
editToolWin_newActiveNode(&eb->tools, eb->sgf->active);
writeGobanComments(eb);
}
}
break;
case editTool_changeBoard:
eb->tools.modified = TRUE;
if (goStone_isStone(goBoard_stone(eb->game->board, loc)))
addPattern(eb, goStone_empty, loc);
else if (butEnv_keyModifiers(env) & ShiftMask)
addPattern(eb, goStone_black, loc);
else
addPattern(eb, goStone_white, loc);
break;
case editTool_score:
if (goStone_isStone(goBoard_stone(eb->game->board, loc)))
goGame_markDead(eb->game, loc);
else
result = gobanOut_err;
break;
case editTool_triangle:
if (butEnv_keyModifiers(env) & ShiftMask) {
if (!markGroup(eb, sgfType_triangle, loc))
result = gobanOut_err;
else {
eb->tools.modified = TRUE;
}
} else {
eb->tools.modified = TRUE;
setMark(eb, sgfType_triangle, loc, setMark_toggle);
}
break;
case editTool_square:
if (butEnv_keyModifiers(env) & ShiftMask) {
if (!markGroup(eb, sgfType_square, loc))
result = gobanOut_err;
else {
eb->tools.modified = TRUE;
}
} else {
eb->tools.modified = TRUE;
setMark(eb, sgfType_square, loc, setMark_toggle);
}
break;
case editTool_circle:
if (butEnv_keyModifiers(env) & ShiftMask) {
if (!markGroup(eb, sgfType_circle, loc))
result = gobanOut_err;
else {
eb->tools.modified = TRUE;
}
} else {
eb->tools.modified = TRUE;
setMark(eb, sgfType_circle, loc, setMark_toggle);
}
break;
case editTool_letter:
eb->tools.modified = TRUE;
addLetter(eb, loc);
break;
case editTool_number:
if (addNumber(eb, loc, butEnv_keyModifiers(env) & ShiftMask)) {
eb->tools.modified = TRUE;
} else
result = gobanOut_err;
break;
}
editToolWin_newColor(&eb->tools, goGame_whoseMove(eb->game));
assert(eb->sgf->active != NULL);
sgfMap_changeNode(eb->tools.sgfMap, eb->sgf->active);
return(result);
}
static GobanOut jumpToLoc(EditBoard *eb, int loc) {
char moveTo[5];
int newNode, i;
strcpy(moveTo, goBoard_loc2Sgf(eb->game->board, loc));
newNode = -1;
if (goBoard_stone(eb->game->board, loc) == goStone_empty) {
i = sgfElem_findMove(eb->sgf->active, moveTo, 1);
if (i >= 0) {
newNode = eb->currentNodeNum + i;
} else {
i = sgfElem_findMove(eb->sgf->active, moveTo, -1);
if (i >= 0)
newNode = eb->currentNodeNum - i;
}
} else {
i = sgfElem_findMove(eb->sgf->active, moveTo, -1);
assert(i >= 0);
newNode = eb->currentNodeNum - i;
}
if (newNode > 0) {
readGobanComments(eb);
sgf_play(eb->sgf, eb->game, eb->goban->pic, eb->currentNodeNum = newNode,
NULL);
editToolWin_newActiveNode(&eb->tools, eb->sgf->active);
writeGobanComments(eb);
return(gobanOut_draw);
} else
return(gobanOut_err);
}
static GobanOut quitPressed(void *packet) {
EditBoard *eb = packet;
AbutMsgOpt buttons[2];
Str saveMessage;
assert(MAGIC(eb));
readGobanComments(eb);
if (eb->tools.modified) {
buttons[0].name = msg_noCancel;
buttons[0].callback = dontQuit;
buttons[0].packet = eb;
buttons[0].keyEq = NULL;
buttons[1].name = msg_yesQuit;
buttons[1].callback = reallyQuit;
buttons[1].packet = eb;
buttons[1].keyEq = NULL;
str_init(&saveMessage);
str_print(&saveMessage, msg_reallyQuit,
str_chars(&eb->fName));
if (eb->reallyQuit)
abutMsg_destroy(eb->reallyQuit, FALSE);
eb->reallyQuit = abutMsg_winOptCreate(eb->cg->abut, "Cgoban Warning",
str_chars(&saveMessage),
quitWinDead, eb, 2, buttons);
str_deinit(&saveMessage);
} else
editBoard_destroy(packet);
return(gobanOut_noDraw);
}
static GobanOut passPressed(void *packet) {
EditBoard *eb = packet;
assert(MAGIC(eb));
switch(eb->tools.tool) {
case editTool_play:
readGobanComments(eb);
sgf_addNode(eb->sgf);
assert(eb->sgf->active->parent->activeChild == eb->sgf->active);
editToolWin_nodeAdded(&eb->tools, eb->sgf->active);
assert(eb->sgf->active->parent->activeChild == eb->sgf->active);
readGobanComments(eb);
assert(eb->sgf->active->type == sgfType_node);
assert(eb->sgf->active->parent->activeChild == eb->sgf->active);
assert((eb->sgf->active->parent->childH !=
eb->sgf->active->parent->childT) ||
(eb->sgf->active->parent->activeChild ==
eb->sgf->active->parent->childH));
sgf_pass(eb->sgf, goGame_whoseMove(eb->game));
assert(eb->sgf->active->type == sgfType_pass);
assert(eb->sgf->active->parent->activeChild == eb->sgf->active);
assert(eb->sgf->active->parent->activeChild ==
eb->sgf->active->parent->childH);
assert(eb->sgf->active->parent->activeChild ==
eb->sgf->active->parent->childT);
assert((eb->sgf->active->parent->parent->childH !=
eb->sgf->active->parent->parent->childT) ||
(eb->sgf->active->parent->parent->activeChild ==
eb->sgf->active->parent->parent->childH));
sgf_play(eb->sgf, eb->game, eb->goban->pic, ++eb->currentNodeNum, NULL);
editToolWin_newActiveNode(&eb->tools, eb->sgf->active);
writeGobanComments(eb);
break;
case editTool_changeBoard:
readGobanComments(eb);
sgf_addNode(eb->sgf);
clearComments(eb);
editToolWin_newActiveNode(&eb->tools, eb->sgf->active);
writeGobanComments(eb);
break;
default:
break;
}
editToolWin_newColor(&eb->tools, goGame_whoseMove(eb->game));
sgfMap_changeNode(eb->tools.sgfMap, eb->sgf->active);
return(gobanOut_draw);
}
static GobanOut rewPressed(void *packet) {
EditBoard *e = packet;
assert(MAGIC(e));
readGobanComments(e);
sgf_play(e->sgf, e->game, e->goban->pic, e->currentNodeNum = 0, NULL);
editToolWin_newActiveNode(&e->tools, e->sgf->active);
writeGobanComments(e);
editToolWin_newColor(&e->tools, goGame_whoseMove(e->game));
return(gobanOut_draw);
}
static GobanOut backPressed(void *packet) {
EditBoard *eb = packet;
SgfElem *active;
int backCount = 1;
assert(MAGIC(eb));
readGobanComments(eb);
if (butEnv_keyModifiers(eb->cg->env) & ShiftMask) {
/*
* Jump to next node with comments or a variation.
*/
backCount = 0;
active = eb->sgf->active;
while (active) {
if (active->type == sgfType_node) {
++backCount;
} else if ((active->type >= sgfType_setBoard) &&
(active->type <= sgfType_comment) && backCount)
break;
if ((backCount > 0) && (active->childH != active->childT))
break;
active = active->parent;
}
}
sgf_play(eb->sgf, eb->game, eb->goban->pic, eb->currentNodeNum -= backCount,
NULL);
editToolWin_newActiveNode(&eb->tools, eb->sgf->active);
writeGobanComments(eb);
editToolWin_newColor(&eb->tools, goGame_whoseMove(eb->game));
return(gobanOut_draw);
}
static GobanOut fwdPressed(void *packet) {
EditBoard *eb = packet;
SgfElem *active;
int fwdCount = 1;
assert(MAGIC(eb));
readGobanComments(eb);
if (butEnv_keyModifiers(eb->cg->env) & ShiftMask) {
/*
* Jump to next node with comments or a variation.
*/
active = eb->sgf->active->activeChild->activeChild;
while (active) {
if (active->type == sgfType_node) {
++fwdCount;
} else if ((active->type >= sgfType_setBoard) &&
(active->type <= sgfType_comment))
break;
if (active->childH != active->childT)
break;
active = active->activeChild;
}
}
sgf_play(eb->sgf, eb->game, eb->goban->pic, eb->currentNodeNum += fwdCount,
NULL);
editToolWin_newActiveNode(&eb->tools, eb->sgf->active);
writeGobanComments(eb);
editToolWin_newColor(&eb->tools, goGame_whoseMove(eb->game));
return(gobanOut_draw);
}
static GobanOut ffPressed(void *packet) {
EditBoard *e = packet;
assert(MAGIC(e));
readGobanComments(e);
e->currentNodeNum = sgf_play(e->sgf, e->game, e->goban->pic, -1, NULL);
editToolWin_newActiveNode(&e->tools, e->sgf->active);
writeGobanComments(e);
editToolWin_newColor(&e->tools, goGame_whoseMove(e->game));
return(gobanOut_draw);
}
static GobanOut donePressed(void *packet) {
SgfElem *otherTerrMarks;
int i;
EditBoard *eb = packet;
Str *scoreComment;
assert(MAGIC(eb));
readGobanComments(eb);
while ((otherTerrMarks = sgfElem_findTypeInNode(eb->sgf->active,
sgfType_territory))) {
sgfElem_snip(otherTerrMarks, eb->sgf);
}
for (i = 0; i < goBoard_area(eb->game->board); ++i) {
if (((eb->game->flags[i] & GOGAMEFLAGS_SEEN) == GOGAMEFLAGS_SEEWHITE) &&
((goBoard_stone(eb->game->board, i) == goStone_empty) ||
(eb->game->flags[i] & GOGAMEFLAGS_MARKDEAD)))
sgf_addTerritory(eb->sgf, goStone_white,
goBoard_loc2Sgf(eb->game->board, i));
}
for (i = 0; i < goBoard_area(eb->game->board); ++i) {
if (((eb->game->flags[i] & GOGAMEFLAGS_SEEN) == GOGAMEFLAGS_SEEBLACK) &&
((goBoard_stone(eb->game->board, i) == goStone_empty) ||
(eb->game->flags[i] & GOGAMEFLAGS_MARKDEAD)))
sgf_addTerritory(eb->sgf, goStone_black,
goBoard_loc2Sgf(eb->game->board, i));
}
scoreComment = goScore_str(&eb->goban->score, eb->game,
&eb->game->time, eb->goban->timers);
sgf_catComment(eb->sgf, str_chars(scoreComment));
sgfMap_changeNode(eb->tools.sgfMap, eb->sgf->active);
str_destroy(scoreComment);
editToolWin_newTool(&eb->tools, editTool_play, TRUE);
writeGobanComments(eb);
sgfMap_changeNode(eb->tools.sgfMap, eb->sgf->active);
return(gobanOut_noDraw);
}
static GobanOut disputePressed(void *packet) {
return(gobanOut_noDraw);
}
static GobanOut savePressed(void *packet) {
EditBoard *e = packet;
assert(MAGIC(e));
if (e->fsel)
abutFsel_destroy(e->fsel, FALSE);
e->fsel = abutFsel_create(e->cg->abut, saveFile, e, "CGoban",
msg_saveGameName,
str_chars(&e->fName));
return(gobanOut_noDraw);
}
static void saveFile(AbutFsel *fsel, void *packet, const char *fname) {
EditBoard *e = packet;
assert(MAGIC(e));
str_copy(&e->cg->lastDirAccessed, &fsel->pathVal);
if (fname != NULL) {
str_copyChars(&e->fName, fname);
clp_setStr(e->cg->clp, "edit.sgfName", butTextin_get(fsel->in));
readGobanComments(e);
e->tools.modified = FALSE;
if (e->info)
editInfo_updateSgf(e->info);
sgf_writeFile(e->sgf, fname, NULL);
}
e->fsel = NULL;
}
static void clearComments(EditBoard *eb) {
assert(MAGIC(eb));
goban_setComments(eb->goban, "");
}
/*
* This transfers comments from the SGF move chain to the goban.
*/
static void writeGobanComments(EditBoard *e) {
SgfElem *comElem;
assert(MAGIC(e));
comElem = sgfElem_findTypeInNode(e->sgf->active, sgfType_comment);
if (comElem) {
if (strcmp(str_chars(comElem->sVal), goban_getComments(e->goban)))
goban_setComments(e->goban, str_chars(comElem->sVal));
} else {
if (e->lastComment)
goban_setComments(e->goban, "");
}
e->lastComment = comElem;
}
/*
* This transfers comments from the goban to the SGF move chain.
*/
static void readGobanComments(EditBoard *eb) {
const char *comm;
int cmpLen;
assert(MAGIC(eb));
assert(eb->sgf->active->parent->activeChild == eb->sgf->active);
comm = goban_getComments(eb->goban);
if (comm[0]) {
if (eb->lastComment) {
cmpLen = str_len(eb->lastComment->sVal);
if (str_chars(eb->lastComment->sVal)[cmpLen - 1] != '\n') {
/* A "\n" was added. */
if ((strlen(comm) == cmpLen + 1) &&
!strncmp(comm, str_chars(eb->lastComment->sVal), cmpLen))
return;
} else {
if (!strcmp(comm, str_chars(eb->lastComment->sVal)))
return;
}
}
eb->tools.modified = TRUE;
eb->sgf->mode = sgfInsert_inline;
sgf_comment(eb->sgf, comm);
eb->sgf->mode = sgfInsert_variant;
eb->lastComment = sgfElem_findTypeInNode(eb->sgf->active, sgfType_comment);
assert(eb->lastComment != NULL);
assert(eb->sgf->active->parent->activeChild == eb->sgf->active);
} else if (eb->lastComment) {
eb->tools.modified = TRUE;
sgfElem_snip(eb->lastComment, eb->sgf);
eb->lastComment = NULL;
assert(eb->sgf->active->parent->activeChild == eb->sgf->active);
}
sgfMap_setMapPointer(eb->tools.sgfMap, eb->sgf->active);
}
static bool backOk(void *packet) {
EditBoard *e = packet;
assert(MAGIC(e));
return((e->game->state == goGameState_play) && (e->currentNodeNum > 0));
}
static bool fwdOk(void *packet) {
EditBoard *e = packet;
assert(MAGIC(e));
return((e->game->state == goGameState_play) &&
(e->sgf->active->activeChild != NULL));
}
static void gobanDestroyed(void *packet) {
EditBoard *eb = packet;
assert(MAGIC(eb));
eb->goban = NULL;
editBoard_destroy(eb);
}
static void addPattern(EditBoard *eb, GoStone color, int loc) {
SgfElem *otherEdits, *oldActive;
GoBoard *newBoard, *tmp;
int i;
otherEdits = sgfElem_findTypeInNode(eb->sgf->active, sgfType_setBoard);
if (otherEdits == NULL) {
/*
* We always add a node if there are no other edits, 'cause they
* shouldn't be in the same node as moves.
*/
readGobanComments(eb);
sgf_addNode(eb->sgf);
editToolWin_nodeAdded(&eb->tools, eb->sgf->active);
++eb->currentNodeNum;
editToolWin_newActiveNode(&eb->tools, eb->sgf->active);
writeGobanComments(eb);
}
/*
* What we do is add the stone, copy the board, then recreate the game
* just before this group of stones. Then we scan through the two boards,
* looking for differences, and recording them in the sgf file. This
* is very time consuming, but it's the easient way to do things so for
* now I'll leave it as is.
*/
newBoard = goBoard_create(eb->game->size);
goGame_setBoard(eb->game, color, loc);
goBoard_copy(eb->game->board, newBoard);
if (eb->currentNodeNum == 0) {
/* We must start from a fresh board! */
goGame_moveTo(eb->game, 0);
} else {
/* We want to preserve the active node across this call to "play()". */
oldActive = eb->sgf->active;
sgf_play(eb->sgf, eb->game, NULL, eb->currentNodeNum - 1, NULL);
eb->sgf->active = oldActive;
}
eb->sgf->mode = sgfInsert_inline;
/*
* Now we have to snip out all previous edits.
*/
while ((otherEdits = sgfElem_findTypeInNode(eb->sgf->active,
sgfType_setBoard))) {
sgfElem_snip(otherEdits, eb->sgf);
}
/* First add all the empties... */
for (i = 0; i < goBoard_area(newBoard); ++i) {
if ((goBoard_stone(newBoard, i) == goStone_empty) &&
(goBoard_stone(eb->game->board, i) != goStone_empty))
sgf_addStone(eb->sgf, goStone_empty, goBoard_loc2Sgf(newBoard, i));
}
/* Now the white stones... */
for (i = 0; i < goBoard_area(newBoard); ++i) {
if ((goBoard_stone(newBoard, i) == goStone_white) &&
(goBoard_stone(eb->game->board, i) != goStone_white))
sgf_addStone(eb->sgf, goStone_white, goBoard_loc2Sgf(newBoard, i));
}
/* And finally the black stones. */
for (i = 0; i < goBoard_area(newBoard); ++i) {
if ((goBoard_stone(newBoard, i) == goStone_black) &&
(goBoard_stone(eb->game->board, i) != goStone_black))
sgf_addStone(eb->sgf, goStone_black, goBoard_loc2Sgf(newBoard, i));
}
/* Now put the board back the way that it should be. */
tmp = eb->game->board;
eb->game->board = newBoard;
eb->sgf->mode = sgfInsert_variant;
goBoard_destroy(tmp);
}
static void setMark(EditBoard *eb, SgfType sType, int loc,
SetMarkAction action) {
SgfElem *search;
bool remove;
GoMarkType markAdded;
for (search = eb->sgf->active; search && (search->type != sgfType_node);
search = search->parent) {
if (((search->type == sgfType_triangle) ||
(search->type == sgfType_circle) ||
(search->type == sgfType_square)) &&
(goBoard_sgf2Loc(eb->game->board, search->lVal) == loc)) {
remove = (((search->type == sType) && (action == setMark_toggle)) ||
(action == setMark_forceOff));
sgfElem_snip(search, eb->sgf);
if (remove) {
grid_setMark(eb->goban->pic->boardButs[loc], goMark_none, 0);
return;
}
break;
}
}
search = sgfElem_findTypeInNode(eb->sgf->active, sType);
if (search)
eb->sgf->active = search;
eb->sgf->mode = sgfInsert_inline;
sgf_addLElem(eb->sgf, sType, goBoard_loc2Sgf(eb->game->board, loc));
eb->sgf->mode = sgfInsert_variant;
if (sType == sgfType_triangle) {
markAdded = goMark_triangle;
} else if (sType == sgfType_square) {
markAdded = goMark_square;
} else {
assert(sType == sgfType_circle);
markAdded = goMark_circle;
}
grid_setMark(eb->goban->pic->boardButs[loc], markAdded, 0);
}
static void addLetter(EditBoard *eb, int loc) {
SgfElem *search;
int i;
char letter[2];
for (search = eb->sgf->active; search && (search->type != sgfType_node);
search = search->parent) {
if ((search->type == sgfType_label) &&
(goBoard_sgf2Loc(eb->game->board, search->lVal) == loc)) {
if (eb->sgf->active == search)
eb->sgf->active = search->parent;
sgfElem_snip(search, eb->sgf);
grid_setMark(eb->goban->pic->boardButs[loc], goMark_none, 0);
return;
}
}
letter[0] = 'A';
letter[1] = '\0';
for (i = 0; i < goBoard_area(eb->game->board); ++i) {
if (eb->goban->pic->boardButs[i]) {
if ((grid_markType(eb->goban->pic->boardButs[i]) == goMark_letter) &&
(grid_markAux(eb->goban->pic->boardButs[i]) >= letter[0]))
letter[0] = grid_markAux(eb->goban->pic->boardButs[i]) + 1;
}
}
if (letter[0] == 'Z' + 1)
letter[0] = 'a';
else if (letter[0] > 'z')
letter[0] = 'z';
eb->sgf->mode = sgfInsert_inline;
sgf_label(eb->sgf, goBoard_loc2Sgf(eb->game->board, loc), letter);
eb->sgf->mode = sgfInsert_variant;
grid_setMark(eb->goban->pic->boardButs[loc], goMark_letter, letter[0]);
}
static bool addNumber(EditBoard *eb, int loc, bool moveNum) {
SgfElem *search;
int i, val;
char labelStr[4];
const char *sgfLoc;
for (search = eb->sgf->active; search && (search->type != sgfType_node);
search = search->parent) {
if ((search->type == sgfType_label) &&
(goBoard_sgf2Loc(eb->game->board, search->lVal) == loc)) {
if (eb->sgf->active == search)
eb->sgf->active = search->parent;
sgfElem_snip(search, eb->sgf);
grid_setMark(eb->goban->pic->boardButs[loc], goMark_none, 0);
return(TRUE);
}
}
if (moveNum) {
for (val = eb->game->moveNum - 1; val >= 0; --val) {
if (eb->game->moves[val].move == loc)
break;
}
if (val < 0)
return(FALSE);
else
++val;
} else {
val = 1;
for (i = 0; i < goBoard_area(eb->game->board); ++i) {
if (eb->goban->pic->boardButs[i]) {
if ((grid_markType(eb->goban->pic->boardButs[i]) == goMark_number) &&
(grid_markAux(eb->goban->pic->boardButs[i]) >= val))
val = grid_markAux(eb->goban->pic->boardButs[i]) + 1;
}
}
}
if (val > 999)
val = 999;
sprintf(labelStr, "%d", val);
eb->sgf->mode = sgfInsert_inline;
sgfLoc = goBoard_loc2Sgf(eb->game->board, loc);
sgf_label(eb->sgf, sgfLoc, labelStr);
eb->sgf->mode = sgfInsert_variant;
grid_setMark(eb->goban->pic->boardButs[loc], goMark_number, val);
return(TRUE);
}
static bool markGroup(EditBoard *eb, SgfType type, int loc) {
GoMarkType oldMark;
SetMarkAction action;
GoBoardGroupIter i;
if (!goStone_isStone(goBoard_stone(eb->game->board, loc)))
return(FALSE);
oldMark = grid_markType(eb->goban->pic->boardButs[loc]);
if ((oldMark == goMark_triangle) || (oldMark == goMark_square) ||
(oldMark == goMark_circle))
action = setMark_forceOff;
else
action = setMark_forceOn;
goBoardGroupIter(i, eb->game->board, loc) {
setMark(eb, type, goBoardGroupIter_loc(i, eb->game->board), action);
}
return(TRUE);
}
static ButOut shiftPressed(But *but, bool press) {
EditBoard *eb = but_packet(but);
ButOut result;
assert(MAGIC(eb));
/*
* Alas, the modifier flags don't change until AFTER the press, so we
* have to invert the shift here.
*/
eb->invertShift = TRUE;
/*
* Change the oldTool thingy so we don't change color if we're on the
* play tool.
*/
eb->oldTool = editTool_changeBoard;
result = newTool(but_packet(but));
eb->invertShift = FALSE;
return(result);
}
static ButOut newTool(void *packet) {
EditBoard *eb = packet;
bool shiftPressed, updateGoban = FALSE;
uint pressAllowed = goPicMove_empty | goPicMove_stone;
GoGameState gameState = goGameState_play;
assert(MAGIC(eb));
shiftPressed = butEnv_keyModifiers(eb->cg->env) & ShiftMask;
if (eb->invertShift)
shiftPressed = !shiftPressed;
switch(eb->tools.tool) {
case editTool_play:
if (!shiftPressed)
pressAllowed = goPicMove_legal;
if (eb->oldTool == editTool_play) {
/*
* Change whose turn it is.
*/
changeWhoseMove(eb);
updateGoban = TRUE;
}
break;
case editTool_changeBoard:
if (!shiftPressed)
pressAllowed |= goPicMove_forceWhite;
else
pressAllowed |= goPicMove_forceBlack;
break;
case editTool_score:
pressAllowed = goPicMove_stone | goPicMove_noPass;
gameState = goGameState_selectDead;
break;
case editTool_triangle:
case editTool_square:
case editTool_circle:
case editTool_number:
pressAllowed |= goPicMove_noPass;
if (shiftPressed)
pressAllowed = goPicMove_stone;
break;
case editTool_letter:
pressAllowed |= goPicMove_noPass;
break;
}
eb->oldTool = eb->tools.tool;
if (pressAllowed != eb->goban->pic->allowedMoves) {
eb->goban->pic->allowedMoves = pressAllowed;
updateGoban = TRUE;
}
if (gameState != eb->game->state) {
eb->game->state = gameState;
if (eb->game->state == goGameState_play) {
/*
* Replay the game to get rid of all those nasty territory markers.
*/
sgf_play(eb->sgf, eb->game, eb->goban->pic, eb->currentNodeNum,
NULL);
}
updateGoban = TRUE;
}
if (updateGoban)
goban_update(eb->goban);
return(0);
}
static ButOut newActiveSgfNode(void *packet, int nodeNum) {
EditBoard *eb = packet;
assert(MAGIC(eb));
if (eb->game->state == goGameState_selectDead) {
abutMsg_winCreate(eb->cg->abut, "Cgoban Error",
msg_changeNodeWhileScoring);
return(BUTOUT_ERR);
} else {
readGobanComments(eb);
sgf_play(eb->sgf, eb->game, eb->goban->pic, nodeNum, NULL);
eb->currentNodeNum = nodeNum;
editToolWin_newActiveNode(&eb->tools, eb->sgf->active);
writeGobanComments(eb);
editToolWin_newColor(&eb->tools, goGame_whoseMove(eb->game));
goban_update(eb->goban);
return(0);
}
}
static void changeWhoseMove(EditBoard *eb) {
SgfElem *oldSetTurn;
GoStone newColor;
newColor = goStone_opponent(eb->game->whoseMove);
oldSetTurn = sgfElem_findTypeInNode(eb->sgf->active, sgfType_whoseMove);
if (oldSetTurn) {
assert(oldSetTurn->gVal != newColor);
oldSetTurn->gVal = newColor;
} else {
eb->sgf->mode = sgfInsert_inline;
sgf_setWhoseMove(eb->sgf, newColor);
eb->sgf->mode = sgfInsert_variant;
}
eb->game->setWhoseMoveNum = eb->game->moveNum;
eb->game->whoseMove = eb->game->setWhoseMoveColor = newColor;
editToolWin_newColor(&eb->tools, newColor);
but_draw(eb->tools.selDesc[editTool_play]);
}
static ButOut reallyQuit(But *but) {
editBoard_destroy(but_packet(but));
return(0);
}
static ButOut dontQuit(But *but) {
EditBoard *eb = but_packet(but);
assert(MAGIC(eb));
abutMsg_destroy(eb->reallyQuit, FALSE);
eb->reallyQuit = NULL;
return(0);
}
static ButOut quitWinDead(void *packet) {
EditBoard *eb = packet;
assert(MAGIC(eb));
eb->reallyQuit = NULL;
return(0);
}
static GobanOut gameInfoPressed(void *packet) {
EditBoard *eb = packet;
assert(MAGIC(eb));
if (eb->info) {
XRaiseWindow(butEnv_dpy(eb->cg->env),
butWin_xwin(eb->info->win));
} else {
eb->info = editInfo_create(eb->cg, eb->goban, eb->sgf, infoDead, eb);
}
return(gobanOut_noDraw);
}
static void infoDead(EditInfo *info, void *packet) {
EditBoard *eb = packet;
assert(MAGIC(eb));
assert(eb->info == info);
eb->info = NULL;
}
goban-1.1.orig/src/goScore.h 0000644 0001750 0001750 00000001646 06201012446 013515 0 ustar al al /*
* src/goScore.h, part of Complete Goban (game program)
* Copyright (C) 1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _GOSCORE_H_
#define _GOSCORE_H_ 1
#ifndef _GOGAME_H_
#include "goGame.h"
#endif
/**********************************************************************
* Data types
**********************************************************************/
typedef struct GoScore_struct {
int territories[2], livingStones[2], deadStones[2], dame;
float scores[2];
} GoScore;
/**********************************************************************
* Functions
**********************************************************************/
extern void goScore_compute(GoScore *score, GoGame *game);
extern void goScore_zero(GoScore *score);
extern Str *goScore_str(GoScore *score, GoGame *game,
const GoTime *time, const GoTimer *timers);
#endif /* _GOSCORE_H_ */
goban-1.1.orig/src/local.c 0000644 0001750 0001750 00000046545 10270001413 013201 0 ustar al al /*
* src/local.c, part of Complete Goban (game program)
* Copyright (C) 1995-1996 William Shubert
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "cgoban.h"
#include "goban.h"
#include "msg.h"
#include "goGame.h"
#include "goPic.h"
#include "cgbuts.h"
#include "sgf.h"
#include "sgfIn.h"
#include "sgfOut.h"
#include "sgfPlay.h"
#include "editBoard.h"
#ifdef _LOCAL_H_
Levelization Error.
#endif
#include "local.h"
/**********************************************************************
* Forward references
**********************************************************************/
static GobanOut gridPressed(void *packet, int loc);
static GobanOut quitPressed(void *packet);
static GobanOut passPressed(void *packet);
static GobanOut rewPressed(void *packet);
static GobanOut backPressed(void *packet);
static GobanOut fwdPressed(void *packet);
static GobanOut ffPressed(void *packet);
static GobanOut donePressed(void *packet);
static GobanOut disputePressed(void *packet);
static GobanOut savePressed(void *packet);
static GobanOut editPressed(void *packet);
static void saveFile(AbutFsel *fsel, void *packet, const char *fname);
static void writeGobanComments(Local *l), readGobanComments(Local *l);
static void addDisputedTriangles(GoGame *game, Sgf *sgf);
static void addTimeInfoToSgf(Local *l, GoStone color);
static void recordTimeLoss(Local *l);
static bool rewOk(void *packet), backOk(void *packet), fwdOk(void *packet);
static void gobanDestroyed(void *packet);
static ButOut reallyQuit(But *but);
static ButOut dontQuit(But *but);
static ButOut quitWinDead(void *packet);
static void setTimers(Local *l);
/**********************************************************************
* Global variables
**********************************************************************/
static const GobanActions local_actions = {
gridPressed, quitPressed, passPressed, rewPressed, backPressed,
fwdPressed, ffPressed, donePressed, disputePressed, savePressed,
editPressed, NULL /* gameInfo */,
&help_localBoard,
gobanDestroyed,
rewOk, backOk, fwdOk, fwdOk};
/**********************************************************************
* Functions
**********************************************************************/
Local *local_create(Cgoban *cg, GoRules rules, int size, int hcap,
float komi, const char *white, const char *black,
GoTimeType timeType, int mainTime, int byTime,
int auxTime) {
Sgf *mc;
Str tmp;
GoTime time;
mc = sgf_create();
str_init(&tmp);
sgf_setRules(mc, rules);
sgf_setSize(mc, size);
sgf_setHandicap(mc, hcap);
sgf_setKomi(mc, komi);
sgf_setPlayerName(mc, goStone_white, white);
sgf_setPlayerName(mc, goStone_black, black);
str_print(&tmp, msg_localTitle, white, black);
sgf_setTitle(mc, str_chars(&tmp));
sgf_setDate(mc);
sgf_style(mc, "Cgoban " VERSION);
time.type = timeType;
time.main = mainTime;
time.by = byTime;
time.aux = auxTime;
goTime_describeStr(&time, &tmp);
sgf_setTimeFormat(mc, str_chars(&tmp));
str_deinit(&tmp);
return(local_createSgf(cg, mc));
}
Local *local_createFile(Cgoban *cg, const char *fname) {
Str badFile;
Sgf *mc;
SgfElem *style;
const char *err;
mc = sgf_createFile(cg, fname, &err, NULL);
if (mc == NULL) {
abutMsg_winCreate(cg->abut, "Cgoban Error", err);
return(NULL);
}
style = sgf_findType(mc, sgfType_style);
if (!style || strncmp(str_chars(style->sVal), "Cgoban", 6)) {
str_init(&badFile);
str_print(&badFile, msg_notCgobanFile, fname);
abutMsg_winCreate(cg->abut, "Cgoban Error", str_chars(&badFile));
str_deinit(&badFile);
sgf_destroy(mc);
return(NULL);
}
return(local_createSgf(cg, mc));
}
Local *local_createSgf(Cgoban *cg, Sgf *mc) {
Local *l;
SgfElem *me;
GoRules rules;
int size, hcap;
float komi;
GoTime time;
const char *title;
assert(MAGIC(cg));
l = wms_malloc(sizeof(Local));
MAGIC_SET(l);
l->cg = cg;
l->moves = mc;
l->endGame = NULL;
me = sgf_findType(mc, sgfType_rules);
if (me) {
rules = (GoRules)me->iVal;
} else
rules = goRules_japanese;
me = sgf_findType(mc, sgfType_size);
if (me) {
size = me->iVal;
} else {
size = 19;
}
me = sgf_findType(mc, sgfType_handicap);
if (me) {
hcap = me->iVal;
} else {
hcap = 0;
}
me = sgf_findType(mc, sgfType_komi);
if (me) {
komi = (float)me->iVal / 2.0;
} else {
komi = 0.0;
}
me = sgf_findFirstType(mc, sgfType_playerName);
while (me) {
me = sgfElem_findFirstType(me, sgfType_playerName);
}
me = sgf_findFirstType(mc, sgfType_time);
if (me) {
goTime_parseDescribeChars(&time, str_chars(me->sVal));
} else {
time.type = goTime_none;
}
l->game = goGame_create(size, rules, hcap, komi, &time, FALSE);
sgf_play(mc, l->game, NULL, -1, NULL);
l->modified = FALSE;
me = sgf_findFirstType(mc, sgfType_title);
if (me) {
title = str_chars(me->sVal);
} else {
title = msg_noTitle;
}
l->goban = goban_create(cg, &local_actions, l, l->game, "local",
title);
l->goban->iDec1 = grid_create(&cg->cgbuts, NULL, NULL, l->goban->iWin, 2,
BUT_DRAWABLE, 0);
grid_setStone(l->goban->iDec1, goStone_white, FALSE);
l->goban->iDec2 = grid_create(&cg->cgbuts, NULL, NULL, l->goban->iWin, 2,
BUT_DRAWABLE, 0);
grid_setStone(l->goban->iDec2, goStone_black, FALSE);
setTimers(l);
l->lastComment = NULL;
assert((hcap == 0) || ((hcap >= 2) && (hcap <= 27)));
l->fsel = NULL;
l->reallyQuit = NULL;
return(l);
}
void local_destroy(Local *l) {
assert(MAGIC(l));
if (l->goban)
goban_destroy(l->goban, FALSE);
if (l->game)
goGame_destroy(l->game);
if (l->fsel)
abutFsel_destroy(l->fsel, FALSE);
if (l->reallyQuit)
abutMsg_destroy(l->reallyQuit, FALSE);
MAGIC_UNSET(l);
wms_free(l);
}
static GobanOut gridPressed(void *packet, int loc) {
Local *l = packet;
GoStone moveColor;
bool timeLeft;
assert(MAGIC(l));
l->modified = TRUE;
moveColor = goGame_whoseMove(l->game);
if (l->game->state <= goGameState_dispute) {
readGobanComments(l);
sgf_addNode(l->moves);
if (l->game->state == goGameState_dispute) {
addDisputedTriangles(l->game, l->moves);
}
timeLeft = goban_stopTimer(l->goban);
if (!timeLeft) {
l->game->state = goGameState_done;
recordTimeLoss(l);
} else {
sgf_move(l->moves, moveColor, goBoard_loc2Sgf(l->game->board, loc));
goGame_move(l->game, moveColor, loc, &l->goban->timers[moveColor]);
addTimeInfoToSgf(l, moveColor);
goban_startTimer(l->goban, goStone_opponent(moveColor));
}
} else if (l->game->state == goGameState_selectDead) {
goGame_markDead(l->game, loc);
} else if (l->game->state == goGameState_selectDisputed) {
l->endGame = l->moves->active;
goGame_dispute(l->game, loc);
/*
* We briefly change to "variant" insert mode so that multiple disputes
* will be seen in the order they were made. Then we switch back to
* "main" insert mode so that undos and ends of disputes will be
* the main variation.
*/
l->moves->mode = sgfInsert_variant;
sgf_addNode(l->moves);
addDisputedTriangles(l->game, l->moves);
sgf_setWhoseMove(l->moves, l->game->setWhoseMoveColor);
l->moves->mode = sgfInsert_main;
}
writeGobanComments(l);
return(gobanOut_draw);
}
/*
* This transfers comments from the SGF move chain to the goban.
*/
static void writeGobanComments(Local *l) {
SgfElem *comElem;
assert(MAGIC(l));
comElem = sgfElem_findTypeInNode(l->moves->active, sgfType_comment);
if (comElem) {
if (strcmp(str_chars(comElem->sVal), goban_getComments(l->goban)))
goban_setComments(l->goban, str_chars(comElem->sVal));
} else {
if (l->lastComment)
goban_setComments(l->goban, "");
}
l->lastComment = comElem;
}
/*
* This transfers comments from the goban to the SGF move chain.
*/
static void readGobanComments(Local *l) {
const char *comm;
comm = goban_getComments(l->goban);
if (comm[0]) {
if (l->lastComment) {
if (!strcmp(comm, str_chars(l->lastComment->sVal)))
return;
}
l->modified = TRUE;
l->moves->mode = sgfInsert_inline;
sgf_comment(l->moves, comm);
l->moves->mode = sgfInsert_main;
l->lastComment = l->moves->active;
} else if (l->lastComment) {
l->modified = TRUE;
sgfElem_snip(l->lastComment, l->moves);
l->lastComment = NULL;
}
}
static GobanOut quitPressed(void *packet) {
Local *l = packet;
AbutMsgOpt buttons[2];
assert(MAGIC(l));
if (l->modified) {
buttons[0].name = msg_noCancel;
buttons[0].callback = dontQuit;
buttons[0].packet = l;
buttons[0].keyEq = NULL;
buttons[1].name = msg_yesQuit;
buttons[1].callback = reallyQuit;
buttons[1].packet = l;
buttons[1].keyEq = NULL;
if (l->reallyQuit)
abutMsg_destroy(l->reallyQuit, FALSE);
l->reallyQuit = abutMsg_winOptCreate(l->cg->abut, "Cgoban Warning",
msg_reallyQuitGame,
quitWinDead, l, 2, buttons);
} else
local_destroy(l);
return(gobanOut_noDraw);
}
static GobanOut passPressed(void *packet) {
Local *l = packet;
GoGameState oldState = l->game->state;
SgfElem *startActive;
GoStone moveColor;
bool timeLeft;
assert(MAGIC(l));
readGobanComments(l);
moveColor = goGame_whoseMove(l->game);
sgf_addNode(l->moves);
startActive = l->moves->active;
if (oldState == goGameState_dispute)
addDisputedTriangles(l->game, l->moves);
sgf_pass(l->moves, moveColor);
addTimeInfoToSgf(l, moveColor);
timeLeft = goban_stopTimer(l->goban);
if (!timeLeft) {
l->game->state = goGameState_done;
recordTimeLoss(l);
} else if (goGame_pass(l->game, moveColor, &l->goban->timers[moveColor])) {
/*
* The game state has changed.
*/
if (oldState == goGameState_dispute) {
assert(MAGIC(l->endGame));
l->moves->active = l->endGame;
l->endGame = NULL;
if (l->game->disputeAlive)
goban_message(l->goban, msg_disputeOverAlive);
else
goban_message(l->goban, msg_disputeOverDead);
} else {
assert(oldState == goGameState_play);
if ((l->game->rules == goRules_japanese) ||
(l->game->rules == goRules_tibetan))
goban_message(l->goban, msg_localJapRemDead);
else
goban_message(l->goban, msg_localChiRemDead);
}
} else {
goban_startTimer(l->goban, goStone_opponent(moveColor));
}
writeGobanComments(l);
return(gobanOut_draw);
}
static GobanOut rewPressed(void *packet) {
Local *l = packet;
assert(MAGIC(l));
readGobanComments(l);
goban_noMessage(l->goban);
goban_stopTimer(l->goban);
if (l->game->state == goGameState_dispute)
goGame_moveTo(l->game, l->game->setWhoseMoveNum);
else
goGame_moveTo(l->game, 0);
sgf_setActiveNodeNumber(l->moves, l->game->moveNum);
setTimers(l);
writeGobanComments(l);
return(gobanOut_draw);
}
static GobanOut backPressed(void *packet) {
Local *l = packet;
assert(MAGIC(l));
readGobanComments(l);
goban_noMessage(l->goban);
goban_stopTimer(l->goban);
if (l->game->state != goGameState_selectDead) {
goGame_moveTo(l->game, l->game->moveNum - 1);
} else {
/* We must be in the endgame. Let's continue the game now instead! */
goGame_resume(l->game);
}
sgf_setActiveNodeNumber(l->moves, l->game->moveNum);
setTimers(l);
writeGobanComments(l);
return(gobanOut_draw);
}
static GobanOut fwdPressed(void *packet) {
Local *l = packet;
assert(MAGIC(l));
readGobanComments(l);
goban_noMessage(l->goban);
goban_stopTimer(l->goban);
goGame_moveTo(l->game, l->game->moveNum + 1);
sgf_setActiveNodeNumber(l->moves, l->game->moveNum);
setTimers(l);
writeGobanComments(l);
return(gobanOut_draw);
}
static GobanOut ffPressed(void *packet) {
Local *l = packet;
assert(MAGIC(l));
readGobanComments(l);
goban_noMessage(l->goban);
goban_stopTimer(l->goban);
goGame_moveTo(l->game, l->game->maxMoves);
sgf_setActiveNodeNumber(l->moves, l->game->moveNum);
setTimers(l);
writeGobanComments(l);
return(gobanOut_draw);
}
static GobanOut donePressed(void *packet) {
Local *l = packet;
int i;
Str *scoreComment, winner, doneMessage, result;
float wScore, bScore;
SgfElem *resultElem;
assert(MAGIC(l));
assert(l->game->state == goGameState_selectDead);
readGobanComments(l);
goban_stopTimer(l->goban);
str_init(&winner);
str_init(&doneMessage);
str_init(&result);
goban_noMessage(l->goban);
goGame_done(l->game);
sgf_addNode(l->moves);
/*
* Add a territory list.
*/
for (i = 0; i < goBoard_area(l->game->board); ++i) {
if (((l->game->flags[i] & GOGAMEFLAGS_SEEN) == GOGAMEFLAGS_SEEWHITE) &&
((goBoard_stone(l->game->board, i) == goStone_empty) ||
(l->game->flags[i] & GOGAMEFLAGS_MARKDEAD)))
sgf_addTerritory(l->moves, goStone_white,
goBoard_loc2Sgf(l->game->board, i));
}
for (i = 0; i < goBoard_area(l->game->board); ++i) {
if (((l->game->flags[i] & GOGAMEFLAGS_SEEN) == GOGAMEFLAGS_SEEBLACK) &&
((goBoard_stone(l->game->board, i) == goStone_empty) ||
(l->game->flags[i] & GOGAMEFLAGS_MARKDEAD)))
sgf_addTerritory(l->moves, goStone_black,
goBoard_loc2Sgf(l->game->board, i));
}
wScore = goban_score(l->goban, goStone_white);
bScore = goban_score(l->goban, goStone_black);
if (wScore > bScore) {
str_print(&winner, msg_winnerComment,
msg_stoneNames[goStone_white],
wScore - bScore);
str_print(&result, "W+%g", wScore - bScore);
} else if ((bScore > wScore) || (l->game->rules == goRules_ing)) {
str_print(&winner, msg_winnerComment,
msg_stoneNames[goStone_black],
bScore - wScore);
str_print(&result, "B+%g", bScore - wScore);
} else {
str_print(&winner, msg_jigoComment);
str_copyChar(&result, '0');
}
str_print(&doneMessage, msg_gameIsOver, winner);
goban_message(l->goban, str_chars(&doneMessage));
scoreComment = goScore_str(&l->goban->score, l->game,
&l->game->time, l->goban->timers);
sgf_catComment(l->moves, str_chars(scoreComment));
str_destroy(scoreComment);
resultElem = sgf_findType(l->moves, sgfType_result);
if (resultElem) {
sgfElem_newString(resultElem, str_chars(&result));
} else {
sgf_setActiveNodeNumber(l->moves, 0);
l->moves->mode = sgfInsert_inline;
sgf_result(l->moves, str_chars(&result));
l->moves->mode = sgfInsert_main;
sgf_setActiveToEnd(l->moves);
}
str_deinit(&winner);
str_deinit(&doneMessage);
str_deinit(&result);
writeGobanComments(l);
return(gobanOut_draw);
}
static GobanOut disputePressed(void *packet) {
Local *l = packet;
assert(MAGIC(l));
goGame_selectDisputed(l->game);
goban_message(l->goban, msg_selectDisputedMsg);
return(gobanOut_draw);
}
static GobanOut savePressed(void *packet) {
Local *l = packet;
assert(MAGIC(l));
if (l->fsel)
abutFsel_destroy(l->fsel, FALSE);
l->fsel = abutFsel_create(l->cg->abut, saveFile, l, "CGoban",
msg_saveGameName,
clp_getStr(l->cg->clp, "local.sgfName"));
return(gobanOut_noDraw);
}
static GobanOut editPressed(void *packet) {
Local *l = packet;
assert(MAGIC(l));
editBoard_createSgf(l->cg, l->moves);
return(gobanOut_noDraw);
}
static void saveFile(AbutFsel *fsel, void *packet, const char *fname) {
Local *l = packet;
assert(MAGIC(l));
str_copy(&l->cg->lastDirAccessed, &fsel->pathVal);
if (fname != NULL) {
readGobanComments(l);
l->modified = FALSE;
clp_setStr(l->cg->clp, "local.sgfName", butTextin_get(fsel->in));
sgf_writeFile(l->moves, fname, NULL);
}
l->fsel = NULL;
}
static void addDisputedTriangles(GoGame *game, Sgf *sgf) {
int i;
for (i = 0; i < goBoard_area(game->board); ++i) {
if (game->flags[i] & GOGAMEFLAGS_DISPUTED)
sgf_addTriangle(sgf, goBoard_loc2Sgf(game->board, i));
}
}
static void addTimeInfoToSgf(Local *l, GoStone who) {
if (l->game->time.type != goTime_none) {
sgf_timeLeft(l->moves, who,
l->goban->timers[who].timeLeft +
(l->goban->timers[who].usLeft > 0));
if ((l->game->time.type == goTime_ing) ||
((l->game->time.type == goTime_canadian) &&
l->goban->timers[who].aux)) {
sgf_stonesLeft(l->moves, who, l->goban->timers[who].aux);
}
}
}
static void recordTimeLoss(Local *l) {
Str timeMsg;
GoStone loser = l->game->whoseMove;
/* I don't think that this code is needed any more.
* sgf_timeLeft(l->moves, l->game->timeLoss, -1);
* if ((l->game->time.type == goTime_ing) ||
* ((l->game->time.type == goTime_canadian) &&
* l->goban->timers[loser].aux)) {
* sgf_stonesLeft(l->moves, loser,
* l->goban->timers[loser].aux +
* (l->game->time.type == goTime_canadian));
* }
*/
str_init(&timeMsg);
str_print(&timeMsg, msg_timeLoss,
msg_stoneNames[loser],
msg_stoneNames[goStone_opponent(loser)]);
goban_message(l->goban, str_chars(&timeMsg));
str_catChar(&timeMsg, '\n');
sgf_catComment(l->moves, str_chars(&timeMsg));
str_print(&timeMsg, "%c+T",
(int)goStone_char(goStone_opponent(loser)));
sgf_setActiveNodeNumber(l->moves, 0);
l->moves->mode = sgfInsert_inline;
sgf_result(l->moves, str_chars(&timeMsg));
l->moves->mode = sgfInsert_main;
sgf_setActiveToEnd(l->moves);
str_deinit(&timeMsg);
}
static bool rewOk(void *packet) {
Local *l = packet;
GoGame *game;
assert(MAGIC(l));
game = l->game;
switch(game->state) {
case(goGameState_selectDead):
case(goGameState_selectDisputed):
return(FALSE);
break;
case(goGameState_dispute):
return(game->moveNum > game->setWhoseMoveNum);
break;
default:
return(game->moveNum > 0);
break;
}
}
static bool backOk(void *packet) {
Local *l = packet;
GoGame *game;
assert(MAGIC(l));
game = l->game;
switch(game->state) {
case(goGameState_selectDead):
return(TRUE);
break;
case(goGameState_selectDisputed):
return(FALSE);
break;
case(goGameState_dispute):
return(game->moveNum > game->setWhoseMoveNum);
break;
default:
return(game->moveNum > 0);
break;
}
}
static bool fwdOk(void *packet) {
Local *l = packet;
GoGame *game;
assert(MAGIC(l));
game = l->game;
switch(game->state) {
case(goGameState_selectDead):
case(goGameState_selectDisputed):
return(FALSE);
break;
default:
return(game->moveNum < game->maxMoves);
break;
}
}
static void gobanDestroyed(void *packet) {
Local *l = packet;
assert(MAGIC(l));
l->goban = NULL;
local_destroy(l);
}
static ButOut reallyQuit(But *but) {
local_destroy(but_packet(but));
return(0);
}
static ButOut dontQuit(But *but) {
Local *l = but_packet(but);
assert(MAGIC(l));
abutMsg_destroy(l->reallyQuit, FALSE);
l->reallyQuit = NULL;
return(0);
}
static ButOut quitWinDead(void *packet) {
Local *l = packet;
assert(MAGIC(l));
l->reallyQuit = NULL;
return(0);
}
static void setTimers(Local *l) {
GoStone stone;
const GoTimer *timer;
assert(MAGIC(l));
goStoneIter(stone) {
timer = goGame_getTimer(l->game, stone);
if (timer == NULL)
goTimer_init(&l->goban->timers[stone], &l->game->time);
else
l->goban->timers[stone] = *timer;
}
goban_updateTimeReadouts(l->goban);
goban_startTimer(l->goban, goGame_whoseMove(l->game));
}
goban-1.1.orig/src/tblock.c 0000644 0001750 0001750 00000024263 10270060051 013361 0 ustar al al /*
* wmslib/src/but/tblock.c, part of wmslib (Library functions)
* Copyright (C) 1994-1996 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#include
#include "wms.h"
#ifdef X11_DISP
#ifdef STDC_HEADERS
#include
#include
#endif /* STDC_HEADERS */
#include
#include
#include
#include
#include
#include
#include
#ifdef HAVE_SYS_SELECT_H
#include
#endif
#include
#include
#include
#include
#include
/**********************************************************************
* Data Types
**********************************************************************/
typedef struct Word_struct {
int start, len, xoff, yoff, w;
} Word;
typedef struct {
char *str;
int nwords;
Word *words;
ButTextAlign align;
int font;
int setup_w;
} Tb;
/**********************************************************************
* Forward Declarations
**********************************************************************/
static void draw(But *but, int x,int y, int w,int h);
static ButOut destroy(But *but);
/**********************************************************************
* Globals
**********************************************************************/
static const ButAction action = {
NULL,NULL,NULL,NULL,
NULL,NULL, draw, destroy, but_flags, NULL};
/**********************************************************************
* Functions
**********************************************************************/
But *butTblock_create(ButWin *win, int layer, int flags,
const char *text, ButTextAlign align) {
But *but;
Tb *tb;
assert(MAGIC(win));
assert(MAGIC(&win->butsNoDraw));
tb = wms_malloc(sizeof(Tb));
but = but_create(win, tb, &action);
but->layer = layer;
but->flags = flags;
tb->str = NULL;
tb->nwords = 0;
tb->words = NULL;
tb->align = align;
tb->font = 0;
tb->setup_w = 0;
but_init(but);
if (text != NULL)
butTblock_setText(but, text);
return(but);
}
void butTblock_setFont(But *but, int fontnum) {
Tb *tb = but->iPacket;
assert(but->action == &action);
tb->font = fontnum;
but_draw(but);
}
int butTblock_getH(But *but) {
Tb *tb = but->iPacket;
int fonth;
assert(but->action == &action);
fonth = but->win->env->fonts[tb->font]->ascent +
but->win->env->fonts[tb->font]->descent;
if (tb->nwords == 0)
return(fonth);
else
return(tb->words[tb->nwords - 1].yoff + fonth);
}
const char *butTblock_getText(But *but) {
Tb *tb;
assert(but->action == &action);
tb = but->iPacket;
return(tb->str);
}
void butTblock_setText(But *but, const char *text) {
Tb *tb = but->iPacket;
ButEnv *env = but->win->env;
int w = tb->setup_w = but->w, txtH;
int len, numLines, wordNum, totalWidth, i, j;
int lastSpaceSeen, spacesAtLastSpace, spacesThisLine;
int widthAtLastSpace, widthNonSpace, widthOfCurrentChar;
int widthNonSpaceAtLastSpace;
bool nonSpaceSeen, prevCharWasSpace;
Word *words;
int *widths;
int wordWMax, wordWMin;
assert(but->action == &action);
txtH = env->fonts[tb->font]->ascent + env->fonts[tb->font]->descent;
if (text != NULL) {
len = strlen(text);
if (tb->str != NULL)
wms_free(tb->str);
tb->str = wms_malloc((len + 1) * sizeof(char));
strcpy(tb->str, text);
}
if (w == 0)
return;
text = tb->str;
len = strlen(text);
if (tb->words != NULL)
wms_free(tb->words);
if (text == NULL) {
tb->words = NULL;
return;
}
tb->nwords = strlen(tb->str);
if (tb->nwords == 0)
return;
tb->words = words = wms_malloc(tb->nwords * sizeof(Word));
widths = wms_malloc(len * sizeof(int));
words[0].start = 0;
words[0].xoff = 0;
words[0].yoff = 0;
words[0].w = 0;
wordNum = totalWidth = widthNonSpace = 0;
widthAtLastSpace = 0;
spacesAtLastSpace = 0;
widthNonSpaceAtLastSpace = 0;
wordWMax = wordWMin = 0;
numLines = 1;
spacesThisLine = lastSpaceSeen = 0;
nonSpaceSeen = prevCharWasSpace = FALSE;
for (i = 0; i < len; ++i) {
widthOfCurrentChar = butEnv_charWidth(env, tb->str+i, tb->font);
assert(widthOfCurrentChar > 0);
widths[i] = widthOfCurrentChar;
if (tb->str[i] == ' ') {
if (!prevCharWasSpace) {
lastSpaceSeen = i;
widthAtLastSpace = totalWidth;
widthNonSpaceAtLastSpace = widthNonSpace;
spacesAtLastSpace = spacesThisLine;
}
if (nonSpaceSeen)
++spacesThisLine;
else
widthNonSpace += widthOfCurrentChar;
prevCharWasSpace = TRUE;
} else {
if ((uchar)tb->str[i] < BUTWRITE_MINPRINT) {
++i;
widths[i] = 0;
}
nonSpaceSeen = TRUE;
prevCharWasSpace = FALSE;
widthNonSpace += widthOfCurrentChar;
}
totalWidth += widthOfCurrentChar;
if (totalWidth > w) {
if (lastSpaceSeen != words[wordNum].start)
i = lastSpaceSeen;
words[wordNum].len = i - words[wordNum].start;
switch(tb->align) {
case butText_center:
words[wordNum].xoff += (w - widthAtLastSpace) / 2;
words[wordNum].w = widthAtLastSpace;
break;
case butText_right:
words[wordNum].xoff += (w - widthAtLastSpace);
words[wordNum].w = widthAtLastSpace;
break;
case butText_just:
widthNonSpace = widthNonSpaceAtLastSpace;
totalWidth = 0;
j = words[wordNum].start;
nonSpaceSeen = FALSE;
while (spacesAtLastSpace > 0) {
assert(j <= i);
if ((tb->str[j] == ' ') && nonSpaceSeen) {
widthOfCurrentChar = (w - widthNonSpace +
spacesAtLastSpace/2) / spacesAtLastSpace;
--spacesAtLastSpace;
widthNonSpace += widthOfCurrentChar;
totalWidth += widthOfCurrentChar;
if (tb->str[j - 1] != ' ') {
words[wordNum].len = j - words[wordNum].start;
assert(words[wordNum].w > 0);
assert(words[wordNum].w < w);
++wordNum;
}
if (tb->str[j + 1] != ' ') {
assert(totalWidth < w);
words[wordNum].start = j + 1;
words[wordNum].xoff = totalWidth;
words[wordNum].yoff = txtH * (numLines - 1);
words[wordNum].w = 0;
}
} else {
if (tb->str[j] != ' ')
nonSpaceSeen = TRUE;
totalWidth += widths[j];
words[wordNum].w += widths[j];
if ((uchar)tb->str[j] < BUTWRITE_MINPRINT)
++j;
}
++j;
}
words[wordNum].len = i - tb->words[wordNum].start;
while ((tb->str[j] != ' ') && (tb->str[j] != '\0'))
words[wordNum].w += widths[j++];
break;
case butText_left:
words[wordNum].w = widthAtLastSpace;
break;
}
++wordNum;
while (tb->str[i] == ' ') {
++i;
widths[i] = butEnv_charWidth(env, tb->str+i, tb->font);
}
lastSpaceSeen = i;
widthNonSpace = totalWidth = widths[i];
spacesThisLine = 0;
nonSpaceSeen = TRUE;
prevCharWasSpace = FALSE;
words[wordNum].start = i;
words[wordNum].xoff = 0;
words[wordNum].yoff = txtH * numLines;
words[wordNum].w = 0;
++numLines;
/*
* If this was a special character then step over it's second byte.
*/
if ((uchar)tb->str[i] < BUTWRITE_MINPRINT) {
++i;
widths[i] = 0;
}
}
}
words[wordNum].len = i - words[wordNum].start;
if (tb->align == butText_center)
words[wordNum].xoff += (w - totalWidth) / 2;
else if (tb->align == butText_right)
words[wordNum].xoff += (w - totalWidth);
words[wordNum].w = totalWidth;
tb->nwords = wordNum + 1;
/* We probably allocated way too many words, so allocate a new block
* of exactly the right size and move to it.
*/
words = wms_malloc(tb->nwords * sizeof(Word));
memcpy(words, tb->words, tb->nwords * sizeof(Word));
for (i = 0; i < tb->nwords; ++i) {
words[i].w = 0;
for (j = words[i].start; j < words[i].start+words[i].len; ++j)
words[i].w += widths[j];
}
wms_free(widths);
wms_free(tb->words);
tb->words = words;
}
/* Returns the height of the text block after being resized. */
int butTblock_resize(But *but, int x, int y, int w) {
int old_w = but->w, h;
assert(MAGIC(but));
assert(but->action == &action);
but->w = w;
butTblock_setText(but, NULL);
but->w = old_w;
but_resize(but, x, y, w, h = butTblock_getH(but));
return(h);
}
static ButOut destroy(But *but) {
Tb *tb = but->iPacket;
if (tb->str != NULL)
wms_free(tb->str);
if (tb->words != NULL)
wms_free(tb->words);
wms_free(tb);
return(0);
}
static void draw(But *but, int dx, int dy, int dw, int dh) {
Tb *tb = but->iPacket;
ButEnv *env = but->win->env;
int i, x, y;
char temp;
int fonth;
if (but->w != tb->setup_w)
butTblock_setText(but, NULL);
fonth = env->fonts[tb->font]->ascent + env->fonts[tb->font]->descent;
butEnv_setXFg(env, BUT_FG);
x = but->x;
y = but->y;
for (i = 0; i < tb->nwords; ++i) {
assert((tb->words[i].xoff >= 0) &&
(tb->words[i].xoff < but->w) &&
(tb->words[i].yoff >= 0) &&
(tb->words[i].yoff < but->h));
assert((tb->words[i].w > 0) && (tb->words[i].w <= but->w));
if ((x+tb->words[i].xoff < dx+dw) &&
(y+tb->words[i].yoff < dy+dh) &&
(x+tb->words[i].xoff + tb->words[i].w >= dx) &&
(y+tb->words[i].yoff + fonth >= dy)) {
temp = tb->str[tb->words[i].start + tb->words[i].len];
tb->str[tb->words[i].start + tb->words[i].len] = '\0';
butWin_write(but->win, x+tb->words[i].xoff, y+tb->words[i].yoff,
tb->str+tb->words[i].start, tb->font);
tb->str[tb->words[i].start + tb->words[i].len] = temp;
}
}
}
int butTblock_guessH(ButEnv *env, const char *text, int w, int fontNum) {
int curW = 0, curH;
int wLastSpace = 0;
int fontH;
int i;
fontH = butEnv_fontH(env, fontNum);
curH = fontH;
for (i = 0; text[i]; ++i) {
if (text[i] == ' ') {
curW += butEnv_charWidth(env, text+i, fontNum);
wLastSpace = curW;
if (curW >= w) {
while (i+1 == ' ')
++i;
curH += fontH;
wLastSpace = curW = 0;
}
} else {
curW += butEnv_charWidth(env, text+i, fontNum);
if (text[i] <= '\2')
++i;
if (curW > w) {
curH += fontH;
if (wLastSpace) {
curW -= wLastSpace;
wLastSpace = 0;
} else {
/* No spaces, break the word in half. */
curW = butEnv_charWidth(env, text+i, fontNum);
}
}
}
}
return(curH);
}
#endif
goban-1.1.orig/src/editInfo.h 0000644 0001750 0001750 00000003307 10270000205 013640 0 ustar al al /*
* src/editInfo.h, part of Complete Goban (game program)
* Copyright (C) 1996 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _EDITINFO_H_
#ifndef _CGOBAN_H_
#include "cgoban.h"
#endif
#ifndef _ABUT_TERM_H_
#include
#endif
#ifndef _GOBAN_H_
#include "goban.h"
#endif
#ifdef _EDITINFO_H_
Levelization Error.
#endif
#define _EDITINFO_H_ 1
/**********************************************************************
* Data Types
**********************************************************************/
typedef enum {
editInfo_gameTitle, editInfo_copyright,
editInfo_wName, editInfo_bName,
editInfo_wRank, editInfo_bRank,
editInfo_handicap, editInfo_komi,
editInfo_time, editInfo_result,
editInfo_date, editInfo_place,
editInfo_event, editInfo_source,
editInfo_count
} EditInfoVal;
typedef struct EditInfo_struct {
Cgoban *cg;
Goban *goban;
ButWin *win;
But *bg;
Sgf *sgf;
But *winTitle;
struct {
But *name, *in;
} infos[editInfo_count];
AbutTerm *gameComment;
void (*destroy)(struct EditInfo_struct *info, void *packet);
void *packet;
MAGIC_STRUCT
} EditInfo;
/**********************************************************************
* Functions
**********************************************************************/
#define editInfoVal_iter(v) \
for ((v) = editInfo_gameTitle; (v) < editInfo_count; ++(v))
extern EditInfo *editInfo_create(Cgoban *cg, Goban *goban, Sgf *sgf,
void (*dCallback)(EditInfo *info,
void *packet),
void *packet);
extern void editInfo_destroy(EditInfo *info, bool propagate);
extern void editInfo_updateSgf(EditInfo *info);
#endif
goban-1.1.orig/src/textin.c 0000644 0001750 0001750 00000072556 10270063321 013431 0 ustar al al /*
* wmslib/src/but/textin.c, part of wmslib (Library functions)
* Copyright (C) 1994-1997 William Shubert.
* See "configure.h.in" for more copyright information.
*/
/*
* I don't really like this button.
* It is slower than it has to be (this may or may not matter).
*/
#include
#include "wms.h"
#ifdef X11_DISP
#ifdef STDC_HEADERS
#include
#include
#endif /* STDC_HEADERS */
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef HAVE_SYS_SELECT_H
#include
#endif
#include
#include
#include
#include
#include
/**********************************************************************
* Data Types
**********************************************************************/
typedef struct SpecKey_struct {
struct SpecKey_struct *next;
KeySym keysym;
uint keyModifiers, modMask;
ButOut (*callback)(But *but, KeySym keysym, uint keyModifiers,
void *context);
void *context;
MAGIC_STRUCT
} SpecKey;
typedef struct Txtin_struct {
ButOut (*callback)(But *but, const char *value);
bool hidden;
char *str, *dispStr; /* dispStr is only used if hidden is TRUE. */
int maxlen, len, loc, cutend;
int mousePress, origMousePress, clicks;
int xoffset;
Pixmap pm;
int pm_w, pm_h, slideDir, slideFreq;
int but3StartMouse, but3StartXoff;
bool mouseInBut, cursorVisible;
ButTimer *cTimer, *sTimer;
SpecKey *specKeys;
MAGIC_STRUCT
} Txtin;
/**********************************************************************
* Forward Declarations
**********************************************************************/
static int locateMouse(XFontStruct *fs, char *text, int len, int x,
bool *rightSide);
static void ti_cursor(But *but);
static void ti_redrawCursor(But *but);
static ButOut mmove(But *but, int x, int y);
static ButOut mleave(But *but);
static ButOut mpress(But *but, int butnum, int x, int y);
static ButOut mrelease(But *but, int butnum, int x, int y);
static ButOut kpress(But *but, const char *keystr, KeySym sym);
static void draw(But *but, int x,int y, int w,int h);
static ButOut destroy(But *but);
static bool insert(ButEnv *env, const char *src, Txtin *but);
static void cut(ButEnv *env, char *cutstr, int cutlen, But *but);
static void paste(ButEnv *env, But *but);
static void enableCTimer(But *but);
static void disableCTimer(But *but);
static void curInView(But *but);
static void textInView(But *but, bool maxInView);
static bool sreq(ButEnv *env, XSelectionRequestEvent *xsre);
static int sclear(ButEnv *env);
static int snotify(ButEnv *env, XSelectionEvent *xsre);
static void flags(But *but, uint flags);
static void wordsel_adjust(Txtin *but);
static void startSlide(But *but, int dir, bool fast);
static ButOut slide(ButTimer *timer);
/**********************************************************************
* Globals
**********************************************************************/
static int cutstr_maxlen = 0, cutstr_len;
static char *cutdata = NULL;
static But *cut_butnum = NULL;
static But *paste_butnum = NULL;
static const ButAction action = {
mmove, mleave, mpress, mrelease,
kpress, NULL, draw, destroy, flags, NULL};
/**********************************************************************
* Functions
**********************************************************************/
But *butTextin_create(ButOut (*callback)(But *but, const char *value),
void *packet, ButWin *win, int layer, int flags,
const char *text, int maxlen) {
But *but;
Txtin *ti;
ti = wms_malloc(sizeof(Txtin));
MAGIC_SET(ti);
but = but_create(win, ti, &action);
but->uPacket = packet;
but->layer = layer;
but->flags = flags | BUT_OPAQUE;
if (text == NULL)
text = "";
ti->callback = callback;
ti->hidden = FALSE;
ti->maxlen = maxlen;
ti->str = (char *)wms_malloc(ti->maxlen + 1);
ti->dispStr = ti->str;
ti->xoffset = 0;
ti->pm_w = ti->pm_h = 0;
ti->pm = None;
ti->mousePress = -1;
ti->mouseInBut = FALSE;
strcpy(ti->str, text);
ti->len = ti->loc = ti->cutend = strlen(text);
ti->cTimer = NULL;
if (flags & BUT_KEYED) {
ti->cursorVisible = TRUE;
} else
ti->cursorVisible = FALSE;
ti->sTimer = NULL;
ti->but3StartXoff = -1;
ti->specKeys = NULL;
but_init(but);
return(but);
}
const char *butTextin_get(But *but) {
Txtin *ti = but->iPacket;
assert(but->action == &action);
assert(MAGIC(ti));
return(ti->str);
}
static ButOut destroy(But *but) {
Txtin *ti = but->iPacket;
ButEnv *env = but->win->env;
SpecKey *spec, *nextSpec;
assert(but->action == &action);
assert(MAGIC(ti));
spec = ti->specKeys;
while (spec != NULL) {
assert(MAGIC(spec));
nextSpec = spec->next;
MAGIC_UNSET(spec);
wms_free(spec);
spec = nextSpec;
}
if (cut_butnum == but) {
if (env->sClear == sclear)
env->sClear = NULL;
if (env->sReq == sreq)
env->sReq = NULL;
cut_butnum = NULL;
}
if (paste_butnum == but) {
if (env->sNotify == snotify)
env->sNotify = NULL;
paste_butnum = NULL;
}
if (ti->pm != None)
XFreePixmap(but->win->env->dpy, ti->pm);
wms_free(ti->str);
if (ti->hidden)
wms_free(ti->dispStr);
else {
assert(ti->dispStr == ti->str);
}
MAGIC_UNSET(ti);
wms_free(ti);
return(0);
}
static void draw(But *but, int x,int y, int w,int h) {
ButWin *win = but->win;
ButEnv *env = win->env;
Txtin *ti = but->iPacket;
int txtw;
int butbw = env->stdButBw;
XFontStruct *fs = env->fonts[0];
assert(but->action == &action);
assert(MAGIC(ti));
XSetFont(env->dpy, env->gc2, env->fonts[0]->fid);
if ((ti->pm_w != but->w - 2*butbw) || (ti->pm_h != but->h - 2*butbw)) {
if (ti->pm != None)
XFreePixmap(env->dpy, ti->pm);
ti->pm = XCreatePixmap(env->dpy, win->win,
ti->pm_w = but->w - 2*butbw,
ti->pm_h = but->h - 2*butbw,
DefaultDepth(env->dpy, DefaultScreen(env->dpy)));
}
but_drawBox(win, but->x,but->y, but->w,but->h, 1, butbw,
BUT_SRIGHT|BUT_SLEFT, BUT_LIT, BUT_SHAD, None, None);
txtw = XTextWidth(fs, ti->dispStr, ti->loc);
butEnv_setXFg2(env, BUT_HIBG);
XFillRectangle(env->dpy, ti->pm, env->gc2,
0,0, ti->pm_w,ti->pm_h);
if (but->flags & BUT_PRESSABLE)
butEnv_setXFg2(env, BUT_FG);
else {
XSetFillStyle(env->dpy, env->gc2, FillStippled);
XSetForeground(env->dpy, env->gc2, env->colors[BUT_FG]);
}
if (ti->loc == ti->cutend) {
XDrawString(env->dpy, ti->pm, env->gc2,
x = butbw - ti->xoffset,
y = (fs->ascent + ti->pm_h - fs->descent) / 2,
ti->dispStr, ti->len);
} else {
int tw1, tw2;
int cl1, cl2;
if (ti->cutend >= ti->loc) {
cl1 = ti->loc;
cl2 = ti->cutend;
} else {
cl1 = ti->cutend;
cl2 = ti->loc;
}
XDrawString(env->dpy, ti->pm, env->gc2,
x = butbw - ti->xoffset,
y = (fs->ascent + ti->pm_h - fs->descent) / 2,
ti->dispStr, cl1);
tw1 = XTextWidth(fs, ti->dispStr, cl1);
tw2 = XTextWidth(fs, ti->dispStr + cl1, cl2 - cl1);
x += tw1 + tw2;
XDrawString(env->dpy, ti->pm, env->gc2, x,y,
ti->dispStr + cl2, ti->len - cl2);
x -= tw2;
XSetBackground(env->dpy, env->gc2, env->colors[BUT_SELBG]);
if (!env->colorp) {
XSetTile(env->dpy, env->gc2, env->colorPmaps[BUT_WHITE]);
XSetForeground(env->dpy, env->gc2, env->colors[BUT_WHITE]);
}
XDrawImageString(env->dpy, ti->pm, env->gc2, x,y,
ti->dispStr + cl1, cl2 - cl1);
}
if (!(but->flags & BUT_PRESSABLE)) {
butEnv_stdFill2(env);
}
XCopyArea(env->dpy, ti->pm, win->win, env->gc,
0,0, ti->pm_w,ti->pm_h,
but->x + butbw - win->xOff, but->y + butbw - win->yOff);
if ((ti->loc == ti->cutend) && ti->cursorVisible &&
(but->flags & BUT_PRESSABLE))
ti_cursor(but);
}
static ButOut mmove(But *but, int x, int y) {
Txtin *ti = but->iPacket;
ButWin *win = but->win;
ButEnv *env = win->env;
int newMousePress;
bool rightSide;
if (!(but->flags & BUT_PRESSABLE))
return(BUTOUT_CAUGHT);
if (!ti->mouseInBut) {
ti->mouseInBut = TRUE;
butEnv_setCursor(env, but, butCur_text);
}
if (ti->mousePress != -1) {
if (ti->clicks < 2) {
if (x < but->x) {
startSlide(but, -1, (x < but->x - but->h + env->stdButBw*2));
newMousePress = 0;
} else if (x > but->x + but->w) {
startSlide(but, 1, (x > but->x + but->w + but->h - env->stdButBw*2));
newMousePress = ti->len;
} else {
if (ti->sTimer != NULL) {
butTimer_destroy(ti->sTimer);
ti->sTimer = NULL;
}
if (y < but->y + env->stdButBw*2)
newMousePress = 0;
else if (y > but->y+but->h - env->stdButBw*2)
newMousePress = ti->len;
else
newMousePress = locateMouse(env->fonts[0], ti->dispStr, ti->len,
x - (but->x + 2*env->stdButBw -
ti->xoffset), &rightSide);
}
if (ti->clicks == 1) {
if (rightSide && (newMousePress >= ti->origMousePress) &&
(newMousePress < ti->len))
++newMousePress;
else if (!rightSide && (newMousePress <= ti->origMousePress)
&& (newMousePress > 0))
--newMousePress;
}
if (newMousePress != ti->mousePress) {
ti->mousePress = ti->loc = newMousePress;
if (ti->clicks == 1) {
ti->cutend = ti->origMousePress;
wordsel_adjust(ti);
}
but_draw(but);
}
}
}
if (ti->but3StartXoff != -1) {
int oldXoff = ti->xoffset;
ti->xoffset = ti->but3StartXoff - 10*(x - ti->but3StartMouse);
textInView(but, FALSE);
if (oldXoff != ti->xoffset)
but_draw(but);
}
return(BUTOUT_CAUGHT);
}
static ButOut mleave(But *but) {
Txtin *ti = but->iPacket;
if (ti->mouseInBut) {
ti->mouseInBut = FALSE;
butEnv_setCursor(but->win->env, but, butCur_idle);
}
return(BUTOUT_CAUGHT);
}
static ButOut mpress(But *but, int butnum, int x, int y) {
Txtin *ti = but->iPacket;
ButEnv *env = but->win->env;
static Time lastPressTime = -1;
static int lastPressNum = -2;
int rightSide;
if (ti->cTimer) {
butTimer_reset(ti->cTimer);
ti->cursorVisible = TRUE;
}
switch (butnum) {
case 1:
/* Button 1 selects, drags, etc. */
if (ti->but3StartXoff != -1)
return(BUTOUT_ERR);
if (!(but->flags & BUT_KEYED))
but_newFlags(but, but->flags | BUT_KEYED);
but_newFlags(but, but->flags | BUT_LOCKED);
ti->mousePress = locateMouse(env->fonts[0], ti->dispStr, ti->len,
x - (but->x + 2*env->stdButBw -
ti->xoffset), &rightSide);
ti->loc = ti->cutend = ti->origMousePress = ti->mousePress;
if ((lastPressTime + BUT_DCLICK > env->eventTime) &&
(lastPressNum + 1 == env->eventNum)) {
if (ti->clicks == 0) {
/* It's a double click! */
++ti->clicks;
if (rightSide)
++ti->loc;
else
--ti->loc;
wordsel_adjust(ti);
} else if (ti->clicks == 1) {
/* It's a triple click! */
++ti->clicks;
ti->loc = 0;
ti->cutend = ti->len;
} else {
/* Quadruple click! Restart! */
ti->clicks = 0;
}
} else
ti->clicks = 0;
lastPressTime = env->eventTime;
lastPressNum = env->eventNum;
but_draw(but);
break;
case 2:
/* Paste! */
ti->cutend = ti->loc = locateMouse(env->fonts[0], ti->dispStr, ti->len,
x - (but->x + 2*env->stdButBw -
ti->xoffset), NULL);
paste(env, but);
break;
case 3:
/*
* Button 3 scrolls as if this input window was a mini-canvas. I'm not
* sure how useful this is but I'm doing it anyway just to make my
* interface more consistent.
*/
if (ti->mousePress != -1)
return(BUTOUT_ERR);
but_newFlags(but, but->flags | BUT_LOCKED);
butEnv_setCursor(env, but, butCur_lr);
ti->but3StartMouse = x;
ti->but3StartXoff = ti->xoffset;
break;
default:
/*
* Weird. I don't know what to do with mice with more than 3 buttons
* so I guess I might as well beep. I like beeping.
*/
return(BUTOUT_ERR);
break;
}
return(BUTOUT_CAUGHT);
}
static ButOut mrelease(But *but, int butnum, int x, int y) {
Txtin *ti = but->iPacket;
char *cutstr;
int cutlen;
if (ti->cTimer) {
butTimer_reset(ti->cTimer);
ti->cursorVisible = TRUE;
}
if ((butnum == 1) && (ti->mousePress != -1)) {
if (ti->sTimer != NULL) {
butTimer_destroy(ti->sTimer);
ti->sTimer = NULL;
}
if (ti->loc != ti->cutend) {
if (ti->loc < ti->cutend) {
cutstr = ti->str + ti->loc;
cutlen = ti->cutend - ti->loc;
} else {
cutstr = ti->str + ti->cutend;
cutlen = ti->loc - ti->cutend;
}
cut(but->win->env, cutstr, cutlen, but);
}
ti->mousePress = -1;
but_newFlags(but, but->flags & ~BUT_LOCKED);
} else if ((butnum == 3) && (ti->but3StartXoff != -1)) {
butEnv_setCursor(but->win->env, but, butCur_text);
ti->but3StartXoff = -1;
but_newFlags(but, but->flags & ~BUT_LOCKED);
}
return(BUTOUT_CAUGHT);
}
static ButOut kpress(But *but, const char *newtext, KeySym keysym) {
Txtin *ti = but->iPacket;
ButEnv *env = but->win->env;
bool need_draw = FALSE, needCallback = FALSE;
int i;
ButOut result = 0;
SpecKey *spec;
butTimer_reset(ti->cTimer);
ti->cursorVisible = TRUE;
for (spec = ti->specKeys; spec != NULL; spec = spec->next) {
if ((keysym == spec->keysym) &&
((env->keyModifiers & spec->modMask) == spec->keyModifiers)) {
return(spec->callback(but, keysym, env->keyModifiers, spec->context) |
BUTOUT_CAUGHT);
}
}
if (((keysym >= XK_KP_Space) && (keysym <= XK_KP_9)) ||
((keysym >= XK_space) && (keysym <= XK_ydiaeresis))) {
need_draw = TRUE;
switch(newtext[0]) {
case '\001': /* Ctrl-A: Beginning of line. */
case '\020': /* Ctrl-P: Up a line. */
ti->loc = ti->cutend = 0;
break;
case '\002': /* Ctrl-B: Back a character. */
if (ti->loc != ti->cutend) {
ti->cutend = ti->loc;
} else if (ti->loc) {
ti->cutend = --ti->loc;
} else {
need_draw = FALSE;
result |= BUTOUT_ERR | BUTOUT_CAUGHT;
}
break;
case '\004': /* Ctrl-D: Delete right. */
if (ti->loc != ti->cutend)
need_draw = insert(env, "", ti);
else if (ti->loc < ti->len) {
for (i = ti->loc; ti->str[i]; ++i)
ti->str[i] = ti->str[i+1];
--ti->len;
need_draw = TRUE;
} else
result |= BUTOUT_ERR | BUTOUT_CAUGHT;
break;
case '\005': /* Ctrl-E: End of line. */
case '\016': /* Ctrl-N: Down a line. */
ti->loc = ti->cutend = ti->len;
break;
case '\006': /* Ctrl-F: Forward a character. */
if (ti->loc != ti->cutend) {
ti->loc = ti->cutend;
} else if (ti->loc < ti->len) {
ti->cutend = ++ti->loc;
} else {
result |= BUTOUT_ERR | BUTOUT_CAUGHT;
need_draw = FALSE;
}
break;
case '\013': /* Ctrl-K: Kill to end of line. */
ti->str[ti->len = ti->loc = ti->cutend] = '\0';
break;
case '\025': /* Ctrl-U: Kill from beginning of line. */
for (i = ti->loc; i < ti->len; ++i)
ti->str[i - ti->loc] = ti->str[i];
ti->str[ti->len -= ti->loc] = '\0';
ti->loc = ti->cutend = 0;
break;
default:
if (!(need_draw = insert(env, newtext, ti)))
result |= BUTOUT_ERR | BUTOUT_CAUGHT;
break;
}
} else if ((keysym >= XK_Shift_L) && (keysym <= XK_Hyper_R)) {
} else if ((keysym >= XK_F1) && (keysym <= XK_F35)) {
if (!(need_draw = insert(env, newtext, ti)))
result |= BUTOUT_ERR | BUTOUT_CAUGHT;
} else if ((keysym == XK_BackSpace) || (keysym == XK_Delete)) {
if (ti->loc != ti->cutend)
need_draw = insert(env, "", ti);
else if (ti->loc > 0) {
for (i = ti->cutend = --ti->loc; ti->str[i]; ++i)
ti->str[i] = ti->str[i+1];
--ti->len;
need_draw = TRUE;
} else
result |= BUTOUT_ERR | BUTOUT_CAUGHT;
#if 0 /* People don't like it when delete works the way I like it. :-( */
} else if (keysym == XK_Delete) {
if (ti->loc != ti->cutend)
need_draw = insert(env, "", ti);
else if (ti->loc < ti->len) {
for (i = ti->loc; ti->str[i]; ++i)
ti->str[i] = ti->str[i+1];
--ti->len;
need_draw = TRUE;
} else
result |= BUTOUT_ERR | BUTOUT_CAUGHT;
#endif
} else if (keysym == XK_Left) {
if (ti->loc != ti->cutend) {
if (ti->loc < ti->cutend)
ti->cutend = ti->loc;
else
ti->loc = ti->cutend;
need_draw = TRUE;
} else if (ti->loc) {
ti->cutend = --ti->loc;
need_draw = TRUE;
} else
result |= BUTOUT_ERR | BUTOUT_CAUGHT;
} else if (keysym == XK_Right) {
if (ti->loc != ti->cutend) {
if (ti->loc > ti->cutend)
ti->cutend = ti->loc;
else
ti->loc = ti->cutend;
need_draw = TRUE;
} else if (ti->loc < ti->len) {
ti->cutend = ++ti->loc;
need_draw = TRUE;
} else
result |= BUTOUT_ERR | BUTOUT_CAUGHT;
} else if (keysym == XK_Up) {
ti->loc = ti->cutend = 0;
need_draw = TRUE;
} else if (keysym == XK_Down) {
ti->loc = ti->cutend = ti->len;
need_draw = TRUE;
} else if ((keysym == XK_Return) || (keysym == XK_Linefeed) ||
(keysym == XK_KP_Enter)) {
result |= BUTOUT_CAUGHT;
if (ti->callback == NULL) {
but_setFlags(but, BUT_NOKEY);
} else {
needCallback = TRUE;
}
}
/* Void all mouse movement until it is pressed again. */
if (ti->mousePress != -1) {
ti->mousePress = -1;
if (but->flags & BUT_LOCKED)
but_newFlags(but, but->flags & ~BUT_LOCKED);
}
if (need_draw) {
result |= BUTOUT_CAUGHT;
curInView(but);
but_draw(but);
}
if (needCallback)
result |= ti->callback(but, ti->str);
return(result);
}
static bool insert(ButEnv *env, const char *src, Txtin *ti) {
int i, j, ntLen, cl1, cl2;
XFontStruct *fs = env->fonts[0];
if (src == NULL) {
return(FALSE);
}
if (ti->loc <= ti->cutend) {
cl1 = ti->loc;
cl2 = ti->cutend;
} else {
cl1 = ti->cutend;
cl2 = ti->loc;
}
for (i = 0, ntLen = 0; src[i]; ++i) {
if ((((uchar)src[i] >= fs->min_char_or_byte2) &&
((uchar)src[i] <= fs->max_char_or_byte2)) ||
(fs->all_chars_exist &&
fs->per_char[(uchar)src[i] - fs->min_char_or_byte2].width))
++ntLen;
}
if ((ntLen == 0) && src[0])
return(FALSE);
if (ntLen + ti->len + cl1 - cl2 > ti->maxlen) {
return(FALSE);
}
if (cl1 != cl2) {
for (i = cl1; i < ti->len; ++i)
ti->str[i] = ti->str[i + cl2 - cl1];
}
for (i = ti->len + ntLen; i >= cl1 + ntLen; --i)
ti->str[i] = ti->str[i - ntLen];
for (i = 0, j = cl1; src[i]; ++i) {
if ((((uchar)src[i] >= fs->min_char_or_byte2) &&
((uchar)src[i] <= fs->max_char_or_byte2)) ||
(fs->all_chars_exist &&
fs->per_char[(uchar)src[i] - fs->min_char_or_byte2].width)) {
ti->str[j++] = src[i];
}
}
ti->len += cl1 - cl2 + ntLen;
ti->loc = ti->cutend = cl1 + ntLen;
return(TRUE);
}
static void ti_cursor(But *but) {
Txtin *ti = but->iPacket;
ButWin *win = but->win;
ButEnv *env = win->env;
XFontStruct *fs = env->fonts[0];
int x, y;
int rw;
if (ti->loc != ti->cutend)
return;
x = but->x - ti->xoffset + env->stdButBw*2 +
XTextWidth(fs, ti->dispStr, ti->loc);
y = but->y + env->stdButBw*2;
if ((rw = (fs->ascent + fs->descent + 10) / 20) < 1)
rw = 1;
x -= rw/2;
if (x < but->x + env->stdButBw) {
rw -= (but->x + env->stdButBw - x);
x = but->x + env->stdButBw;
} else if (x+rw > but->x + but->w - env->stdButBw) {
rw = but->x + but->w - env->stdButBw - x;
}
if (rw <= 0)
return;
if (ti->cursorVisible)
butEnv_setXFg2(env, BUT_FG);
else
butEnv_setXFg2(env, BUT_HIBG);
XFillRectangle(env->dpy, win->win, env->gc2, x - win->xOff, y - win->yOff,
rw, ti->pm_h - env->stdButBw*2);
}
static void ti_redrawCursor(But *but) {
Txtin *ti = but->iPacket;
ButWin *win = but->win;
ButEnv *env = win->env;
XFontStruct *fs = env->fonts[0];
int x, y;
int rw;
if (ti->loc != ti->cutend)
return;
x = but->x - ti->xoffset + env->stdButBw*2 +
XTextWidth(fs, ti->dispStr, ti->loc);
y = but->y + env->stdButBw*2;
if ((rw = (fs->ascent + fs->descent + 10) / 20) < 1)
rw = 1;
x -= rw/2;
if (x < but->x + env->stdButBw) {
rw -= (but->x + env->stdButBw - x);
x = but->x + env->stdButBw;
} else if (x+rw > but->x + but->w - env->stdButBw) {
rw = but->x + but->w - env->stdButBw - x;
}
if (rw <= 0)
return;
butWin_redraw(win, x, y,
rw, ti->pm_h - env->stdButBw*2);
}
static void cut(ButEnv *env, char *cutstr, int cutlen, But *but) {
ButWin *realWin;
if (cutstr_maxlen < cutlen) {
if (cutdata != NULL)
wms_free(cutdata);
cutdata = (char *)wms_malloc(cutlen);
cutstr_maxlen = cutlen;
}
XStoreBytes(env->dpy, cutstr, cutlen);
memcpy(cutdata, cutstr, cutlen);
cutstr_len = cutlen;
realWin = but->win;
while (realWin->parent != NULL)
realWin = realWin->parent;
if ((env->sReq == NULL) ||
((env->sReq == sreq) && (cut_butnum == but)))
XSetSelectionOwner(env->dpy, XA_PRIMARY, realWin->win, 0);
else
env->sClear(env);
if (XGetSelectionOwner(env->dpy, XA_PRIMARY) == realWin->win) {
env->sReq = sreq;
env->sClear = sclear;
cut_butnum = but;
}
}
static bool sreq(ButEnv *env, XSelectionRequestEvent *xsre) {
if (xsre->target != XA_STRING)
return(FALSE);
XChangeProperty(env->dpy, xsre->requestor, xsre->property, xsre->target,
8, PropModeReplace, cutdata, cutstr_len);
return(TRUE);
}
static int sclear(ButEnv *env) {
Txtin *ti;
assert(MAGIC(cut_butnum));
ti = cut_butnum->iPacket;
assert(MAGIC(ti));
ti->loc = ti->cutend;
but_draw(cut_butnum);
env->sReq = NULL;
env->sClear = NULL;
return(0);
}
static void paste(ButEnv *env, But *but) {
ButWin *topWin;
paste_butnum = but;
env->sNotify = snotify;
topWin = but->win;
while (topWin->parent != NULL)
topWin = topWin->parent;
XConvertSelection(env->dpy, XA_PRIMARY, XA_STRING, env->prop,
topWin->win, 0);
}
static int snotify(ButEnv *env, XSelectionEvent *xsnot) {
unsigned char *propbuf;
unsigned long proplen, propleft;
int blen;
int pformat;
Atom ptype;
Txtin *ti;
char *pb2;
ti = paste_butnum->iPacket;
if (xsnot->property != None) {
XGetWindowProperty(env->dpy, xsnot->requestor,
xsnot->property, 0, ti->maxlen, True, AnyPropertyType,
&ptype, &pformat, &proplen, &propleft,
&propbuf);
pb2 = (char *)wms_malloc(proplen * pformat + 1);
pb2[proplen * pformat] = '\0';
memcpy(pb2, propbuf, proplen * pformat);
XFree(propbuf);
if (insert(env, pb2, ti)) {
textInView(paste_butnum, FALSE);
but_draw(paste_butnum);
} else
XBell(env->dpy, 0);
wms_free(pb2);
} else {
propbuf = (unsigned char *)XFetchBytes(env->dpy, &blen);
if (blen > 0) {
pb2 = (char *)wms_malloc(blen + 1);
pb2[blen] = '\0';
memcpy(pb2, propbuf, blen);
XFree(propbuf);
if (insert(env, pb2, ti)) {
textInView(paste_butnum, FALSE);
but_draw(paste_butnum);
} else
XBell(env->dpy, 0);
wms_free(pb2);
} else
XBell(env->dpy, 0);
}
env->sNotify = NULL;
return(0);
}
/*
* This adjusts your loc and your cutend for when you're in word select mode.
*/
static void wordsel_adjust(Txtin *but) {
int a, b;
if (but->loc < but->cutend) {
a = but->loc;
b = but->cutend;
} else {
a = but->cutend;
b = but->loc;
}
for (;;) {
if (a <= 0) {
a = 0;
break;
}
if (((isalnum(but->str[a]) || (but->str[a] == '_')) &&
(isalnum(but->str[a-1]) || (but->str[a-1] == '_'))) ||
(but->str[a] == but->str[a-1]) ||
(isdigit(but->str[a]) && (but->str[a-1] == '.') &&
(a >= 2) && isdigit(but->str[a-2])) ||
(isdigit(but->str[a+1]) && (but->str[a] == '.') &&
isdigit(but->str[a-1])))
--a;
else
break;
}
if (b <= 0)
b = 1;
for (;;) {
if (b >= but->len) {
b = but->len;
break;
}
if (((isalnum(but->str[b-1]) || (but->str[b-1] == '_')) &&
(isalnum(but->str[b]) || (but->str[b] == '_'))) ||
(but->str[b-1] == but->str[b]) ||
(isdigit(but->str[b-1]) && (but->str[b] == '.') &&
isdigit(but->str[b+1])) ||
((b >= 2) && isdigit(but->str[b-2]) && (but->str[b-1] == '.') &&
isdigit(but->str[b])))
++b;
else
break;
}
but->loc = a;
but->cutend = b;
}
/* Returns the index of the character just to the right of the cursor. */
static int locateMouse(XFontStruct *fs, char *text, int len, int x,
bool *rightSide) {
int i;
int prev_x = x;
bool dummy;
if (rightSide == NULL)
rightSide = &dummy;
for (i = 0; (x > 0) && (i < len); ++i) {
prev_x = x;
if (fs->per_char == NULL)
/* Monospace font. */
x -= fs->min_bounds.width;
else
x -= fs->per_char[text[i] - fs->min_char_or_byte2].width;
}
if ((*rightSide = ((i > 0) && (x < 0) && (prev_x < -x))))
--i;
if (i == len)
*rightSide = FALSE;
return(i);
}
/* Set up xoffset so that the cursor will be in view. */
static void curInView(But *but) {
Txtin *ti = but->iPacket;
ButEnv *env = but->win->env;
int curIn;
curIn = XTextWidth(env->fonts[0], ti->dispStr, ti->loc);
if (curIn < ti->xoffset)
ti->xoffset = curIn;
if (curIn - ti->xoffset > ti->pm_w - env->stdButBw * 2)
ti->xoffset = curIn - ti->pm_w + env->stdButBw * 2;
}
/*
* Set up xoffset so that the text will be in view. If maxInView is set,
* then make sure that as much text is in the window as possible (that is,
* there is no unnecessary empty space to the right of the text).
*/
static void textInView(But *but, bool maxInView) {
Txtin *ti = but->iPacket;
ButEnv *env = but->win->env;
int curIn;
curIn = XTextWidth(env->fonts[0], ti->dispStr, ti->len);
if (maxInView) {
if (ti->xoffset > curIn - (but->w - env->stdButBw*4))
ti->xoffset = curIn - (but->w - env->stdButBw * 4);
}
if (ti->xoffset < 0)
ti->xoffset = 0;
if (ti->xoffset > curIn)
ti->xoffset = curIn;
}
static void flags(But *but, uint flags) {
Txtin *ti = but->iPacket;
if ((but->flags & BUT_KEYED) != (flags & BUT_KEYED)) {
if (flags & BUT_KEYED) {
enableCTimer(but);
ti->cursorVisible = TRUE;
} else {
ti->cursorVisible = FALSE;
disableCTimer(but);
}
}
but->flags = flags;
assert((but->flags & BUT_PRESSABLE) || !(but->flags & BUT_KEYED));
but_draw(but);
}
static ButOut blinkCursor(ButTimer *timer) {
But *but = butTimer_packet(timer);
Txtin *ti = but->iPacket;
ti->cursorVisible = !(butTimer_ticks(timer) & 1);
ti_redrawCursor(but);
return(0);
}
static ButOut slide(ButTimer *timer) {
But *but = butTimer_packet(timer);
Txtin *ti = but->iPacket;
int newXoff, oldXoff;
if (ti->slideDir > 0) {
oldXoff = ti->xoffset;
textInView(but, TRUE);
if (oldXoff != ti->xoffset) {
ti->xoffset = oldXoff;
butTimer_destroy(ti->sTimer);
ti->sTimer = NULL;
return(0);
}
}
newXoff = ti->xoffset + ti->slideDir * butTimer_ticks(timer);
ti->xoffset = newXoff;
textInView(but, ti->slideDir > 0);
if (ti->xoffset != newXoff) {
butTimer_destroy(ti->sTimer);
ti->sTimer = NULL;
}
butTimer_setTicks(timer, 0);
but_draw(but);
return(0);
}
static void startSlide(But *but, int dir, bool fast) {
struct timeval zero;
Txtin *ti = but->iPacket;
int freq;
zero.tv_sec = 0;
zero.tv_usec = 0;
freq = but->h;
if (fast)
freq *= 10;
if (ti->sTimer != NULL) {
if ((ti->slideFreq == freq) && (ti->slideDir == dir))
return;
butTimer_destroy(ti->sTimer);
}
ti->slideDir = dir;
ti->slideFreq = freq;
ti->sTimer = butTimer_fCreate(but, but, zero, freq, FALSE, slide);
}
static void enableCTimer(But *but) {
Txtin *ti = but->iPacket;
struct timeval halfSec;
assert(ti->cTimer == NULL);
halfSec.tv_sec = 0;
halfSec.tv_usec = 500000;
ti->cTimer = butTimer_create(but, but, halfSec, halfSec, TRUE,
blinkCursor);
}
static void disableCTimer(But *but) {
Txtin *ti = but->iPacket;
if (ti->cTimer != NULL) {
butTimer_destroy(ti->cTimer);
ti->cTimer = NULL;
}
}
void butTextin_set(But *but, const char *newStr, bool propagate) {
Txtin *ti;
assert(MAGIC(but));
assert(but->action == &action);
ti = but->iPacket;
assert(MAGIC(ti));
assert(strlen(newStr) <= ti->maxlen);
strcpy(ti->str, newStr);
ti->len = ti->loc = ti->cutend = strlen(newStr);
textInView(but, TRUE);
but_draw(but);
if (propagate)
ti->callback(but, ti->str);
}
void butTextin_setHidden(But *but, bool hidden) {
Txtin *ti;
int i;
assert(MAGIC(but));
assert(but->action == &action);
ti = but->iPacket;
assert(MAGIC(ti));
if (hidden == ti->hidden)
return;
ti->hidden = hidden;
if (hidden) {
ti->dispStr = wms_malloc(ti->maxlen);
for (i = 0; i < ti->maxlen; ++i) {
ti->dispStr[i] = '*';
}
} else {
wms_free(ti->dispStr);
ti->dispStr = ti->str;
}
}
void butTextin_setSpecialKey(But *but, KeySym keysym,
uint keyModifiers, uint modMask,
ButOut callback(But *but,
KeySym keysym, uint keyModifiers,
void *context),
void *context) {
Txtin *ti;
SpecKey *newSpec;
assert(MAGIC(but));
assert(but->action == &action);
ti = but->iPacket;
assert(MAGIC(ti));
assert((keyModifiers & modMask) == keyModifiers);
newSpec = wms_malloc(sizeof(SpecKey));
MAGIC_SET(newSpec);
newSpec->next = ti->specKeys;
ti->specKeys = newSpec;
newSpec->keysym = keysym;
newSpec->keyModifiers = keyModifiers;
newSpec->modMask = modMask;
newSpec->callback = callback;
newSpec->context = context;
}
#endif /* X11_DISP */
goban-1.1.orig/src/server.c 0000644 0001750 0001750 00000001313 10270065364 013414 0 ustar al al /*
* src/cliServer.c, part of Complete Goban (game program)
* Copyright (C) 1995-1996 William Shubert
* See "configure.h.in" for more copyright information.
*/
#include
#include "server.h"
/**********************************************************************
* Functions
**********************************************************************/
/*
* It seems that gcc has an error. If no _functions_ in a library file are
* called, then the file is not linked in. Since I want "cliServer_names[]"
* to get pulled in, I need to have a function here. :-(
* This file no longer has *any* data in it, so I could just scrap this, but
* what the hell.
*/
void cliServer_create(void) {
}
goban-1.1.orig/src/help.h 0000644 0001750 0001750 00000002053 10267776074 013062 0 ustar al al /*
* src/msg.h, part of Complete Goban (game program)
* Copyright (C) 1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _HELP_H_
#define _HELP_H_ 1
#ifndef _ABUT_HELP_H_
#include "abut_help.h"
#endif
/**********************************************************************
* Data Types
**********************************************************************/
typedef struct {
int numPages;
const char *menuTitle;
const AbutHelpPage *pages;
} Help;
/**********************************************************************
* Global variables
**********************************************************************/
extern Help help_control;
extern Help help_gameSetup;
extern Help help_editTool;
extern Help help_cliMain;
extern Help help_cliMatch;
extern Help help_editBoard;
extern Help help_localBoard;
extern Help help_cliBoard;
extern Help help_cliSetup;
extern Help help_gmpBoard;
extern Help help_gmpSetup;
extern Help help_configure;
extern Help help_cliLook;
#endif /* _HELP_H_ */
goban-1.1.orig/src/cm2pm.h 0000644 0001750 0001750 00000001434 06342434120 013130 0 ustar al al /*
* src/cm2pm.h, part of Complete Goban (game program)
* Copyright (C) 1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _CM2PM_H_
#define _CM2PM_H_ 1
/**********************************************************************
* Constants
**********************************************************************/
/**********************************************************************
* Functions
**********************************************************************/
extern Pixmap cm2Pm(ButEnv *env, uchar *cmap, uint cmapw,uint cmaph,
uint w,uint h,
int pic0, int npic, bool flat);
extern void cm2OldPm(ButEnv *env, uchar *cmap, uint cmapw,uint cmaph,
int pic0, int npic, Pixmap pic, bool flat);
#endif /* _CM2PM_H_ */
goban-1.1.orig/src/clp-x.c 0000644 0001750 0001750 00000002053 10270001107 013114 0 ustar al al /*
* wmslib/src/wms/clp-x.c, part of wmslib (Library functions)
* Copyright (C) 1995-1996 William Shubert.
* See "configure.h.in" for more copyright information.
*
* Command Line Parser.
*/
#include
#if X11_DISP
#include
#include
#include "clp.h"
/**********************************************************************
* Functions
**********************************************************************/
void clp_rXDefaults(Clp *clp, Display *dpy, char *name) {
int i, j;
ClpEntry *ci;
char *xdef, wname[80];
for (i = 0; i < clp->numInfos; ++i) {
ci = &clp->infos[i];
if (!ci->name || (ci->where == clpWhere_cmdline))
continue;
strncpy(wname, ci->name, sizeof(wname) - 1);
wname[sizeof(wname) - 1] = '\0';
for (j = 0; wname[j]; ++j)
if (wname[j] == ',')
wname[j] = '\0';
xdef = XGetDefault(dpy, name, wname);
if (xdef != NULL) {
ci->where = clpWhere_xdefs;
ci->type = clpDtype_string;
clpEntry_setStr(ci, xdef);
}
}
}
#endif /* X11_DISP */
goban-1.1.orig/src/abut.h 0000644 0001750 0001750 00000002256 10267775610 013065 0 ustar al al /*
* src/abut.h, part of wmslib library
* Copyright (C) 1995-1996 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _ABUT_ABUT_H_
#ifndef _WMS_CLP_H_
#include
#endif
#ifdef _ABUT_ABUT_H_
Levelization Error.
#endif
#define _ABUT_ABUT_H_ 1
/**********************************************************************
* Types
**********************************************************************/
/* Private. */
typedef struct Abut_struct {
ButEnv *env;
const char *ok, *cancel;
int butH;
int ulColor, lrColor, bgColor;
Pixmap ulPixmap, lrPixmap, bgPixmap;
Clp *clp;
MAGIC_STRUCT
} Abut;
/**********************************************************************
* Functions available
**********************************************************************/
extern Abut *abut_create(ButEnv *env, const char *ok, const char *cancel);
extern void abut_destroy(Abut *a);
extern void abut_setColors(Abut *a, int ul, int lr, int bg);
extern void abut_setPixmaps(Abut *a, Pixmap ul, Pixmap lr, Pixmap bg);
#define abut_setClp(a, c) ((a)->clp = (c))
#define abut_setButH(a, h) ((a)->butH = (h))
#endif /* _ABUT_ABUT_H_ */
goban-1.1.orig/src/setup.c 0000644 0001750 0001750 00000040551 10270070355 013251 0 ustar al al /*
* src/gmp/setup.c, part of Complete Goban (game program)
* Copyright (C) 1995 William Shubert
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "cgoban.h"
#include "setup.h"
#include "client.h"
#include "gameSetup.h"
#include "msg.h"
#include "play.h"
#include
/**********************************************************************
* Global variables
**********************************************************************/
/*
* If this field is TRUE, then we will really, truly be speaking GMP to
* the player in question.
*/
static const bool isGmpType[] = {
TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE};
/**********************************************************************
* Forward declarations
**********************************************************************/
static ButOut unmap(ButWin *win);
static ButOut map(ButWin *win);
static ButOut resize(ButWin *win);
static ButOut destroy(ButWin *win);
static ButOut okPressed(But *but);
static ButOut cancelPressed(But *but);
static ButOut newType(But *but, int newVal);
static ButOut newIn1(But *but, const char *value);
static ButOut newIn2(But *but, const char *value);
static void gotGameSetup(void *packet, GameSetup *gameSetup);
/**********************************************************************
* Functions
**********************************************************************/
GmpSetup *gmpSetup_create(Cgoban *cg) {
GmpSetup *gs;
GoStone s;
int w, h;
GmpSetupPlayer *p;
char port[10];
assert(MAGIC(cg));
gs = wms_malloc(sizeof(GmpSetup));
MAGIC_SET(gs);
gs->cg = cg;
gs->gameWaiting = FALSE;
h = cg->fontH * 16 + butEnv_stdBw(cg->env) * 14;
w = h * 2;
gs->win = butWin_create(gs, cg->env, "Go Modem Protocol Setup", w,h,
unmap, map, resize, destroy);
butWin_activate(gs->win);
gs->bg = butBoxFilled_create(gs->win, 0, BUT_DRAWABLE);
butBoxFilled_setPixmaps(gs->bg, cg->bgLitPixmap, cg->bgShadPixmap,
cg->bgPixmap);
gs->title = butText_create(gs->win, 1, BUT_DRAWABLE, msg_gmpSetup,
butText_center);
butText_setFont(gs->title, 2);
gs->ok = butCt_create(okPressed, gs, gs->win, 1,
BUT_PRESSABLE|BUT_DRAWABLE, msg_ok);
gs->cancel = butCt_create(cancelPressed, gs, gs->win, 1,
BUT_PRESSABLE|BUT_DRAWABLE, msg_cancel);
gs->help = butCt_create(cgoban_createHelpWindow, &help_gmpSetup, gs->win, 1,
BUT_DRAWABLE|BUT_PRESSABLE, msg_help);
gs->players[goStone_white].optionEntry = clp_lookup(cg->clp, "gmp.WOption");
gs->players[goStone_black].optionEntry = clp_lookup(cg->clp, "gmp.BOption");
gs->players[goStone_white].progNameEntry = clp_lookup(cg->clp,
"gmp.WProgram");
gs->players[goStone_black].progNameEntry = clp_lookup(cg->clp,
"gmp.BProgram");
gs->players[goStone_white].devNameEntry = clp_lookup(cg->clp, "gmp.WDevice");
gs->players[goStone_black].devNameEntry = clp_lookup(cg->clp, "gmp.BDevice");
sprintf(port, "%d", clp_getInt(cg->clp, "gmp.port"));
/*
* Set up the goStone_black type because when I set up goStone_white,
* below, I will check this value and it must be something sane.
*/
gs->players[goStone_black].type = gmpSetup_program;
goStoneIter(s) {
p = &gs->players[s];
str_initChars(&p->progName, clpEntry_getStr(p->progNameEntry));
str_initChars(&p->devName, clpEntry_getStr(p->devNameEntry));
p->box = butBox_create(gs->win, 1, BUT_DRAWABLE);
butBox_setPixmaps(p->box, cg->bgLitPixmap, cg->bgShadPixmap);
p->typeMenu = butMenu_downCreate(newType, gs, gs->win, 1, 2,
BUT_DRAWABLE|BUT_PRESSABLE,
msg_gmpPlayers[s],
msg_gmpTypes,
clpEntry_getInt(p->optionEntry));
butMenu_setFlags(p->typeMenu, (int)gmpSetup_local, BUTMENU_DISABLED);
butMenu_setFlags(p->typeMenu, (int)gmpSetup_remote, BUTMENU_DISABLED);
p->strDesc1 = butText_create(gs->win, 1, BUT_DRAWABLE,
msg_program, butText_center);
butText_setColor(p->strDesc1, BUT_NOCHANGE, TRUE);
p->strIn1 = butTextin_create(newIn1, gs, gs->win, 1,
BUT_DRAWABLE,
str_chars(&p->progName), 500);
p->strDesc2 = butText_create(gs->win, 1, BUT_DRAWABLE,
msg_port, butText_center);
butText_setColor(p->strDesc2, BUT_NOCHANGE, TRUE);
p->strIn2 = butTextin_create(newIn2, gs, gs->win, 1,
BUT_DRAWABLE, port, 100);
p->type = -1;
newType(p->typeMenu, clpEntry_getInt(p->optionEntry));
}
return(gs);
}
void gmpSetup_destroy(GmpSetup *gs) {
assert(MAGIC(gs));
if (gs->win) {
butWin_setDestroy(gs->win, NULL);
butWin_destroy(gs->win);
}
str_deinit(&gs->players[goStone_white].progName);
str_deinit(&gs->players[goStone_black].progName);
str_deinit(&gs->players[goStone_white].devName);
str_deinit(&gs->players[goStone_black].devName);
MAGIC_UNSET(gs);
wms_free(gs);
}
static ButOut unmap(ButWin *win) {
return(0);
}
static ButOut map(ButWin *win) {
return(0);
}
static ButOut resize(ButWin *win) {
GmpSetup *gs = butWin_packet(win);
Cgoban *cg;
int w, h;
int bw, fh;
ButEnv *env;
int boxX, boxY, boxW, boxH, butX, butW, butY;
GoStone s;
GmpSetupPlayer *p;
assert(MAGIC(gs));
cg = gs->cg;
assert(MAGIC(cg));
env = cg->env;
bw = butEnv_stdBw(env);
fh = cg->fontH;
w = butWin_w(win);
h = butWin_h(win);
but_resize(gs->bg, 0,0, w,h);
butText_resize(gs->title, w/2,bw*2, fh*2);
boxX = bw;
boxY = bw * 3 + fh * 2;
boxH = h - bw * 6 - fh * 4;
goStoneIter(s) {
p = &gs->players[s];
boxW = (w - bw * 2 + (int)s) / 2;
but_resize(p->box, boxX, boxY, boxW, boxH);
butX = boxX + bw * 2;
butW = boxW - bw * 4;
butY = boxY + bw * 2;
boxX += boxW;
but_resize(p->typeMenu, butX, butY, butW, fh * 4);
butY += fh * 4 + bw;
but_resize(p->strDesc1, butX, butY, butW, fh * 2);
butY += fh * 2 + bw;
but_resize(p->strIn1, butX, butY, butW, fh * 2);
butY += fh * 2 + bw;
but_resize(p->strDesc2, butX, butY, butW, fh * 2);
butY += fh * 2 + bw;
but_resize(p->strIn2, butX, butY, butW, fh * 2);
}
boxX = bw * 2;
boxW = (w - bw * 6) / 3;
but_resize(gs->help, boxX, boxY + boxH + bw, boxW, fh * 2);
boxX += boxW + bw;
boxW = (w - bw * 6) / 3 + ((w - bw * 6) % 3);
but_resize(gs->cancel, boxX, boxY + boxH + bw, boxW, fh * 2);
boxX += boxW + bw;
boxW = (w - bw * 6) / 3;
but_resize(gs->ok, boxX, boxY + boxH + bw, boxW, fh * 2);
return(0);
}
static ButOut destroy(ButWin *win) {
GmpSetup *gs = butWin_packet(win);
assert(MAGIC(gs));
gs->win = NULL; /* It's dead already. */
if (!gs->gameWaiting) {
gmpSetup_destroy(gs);
}
return(0);
}
/*
* Callback for when "OK" is pressed in the setup window.
* It starts up the game setup dialogue, which asks for handicap, time
* controls, etc.
*/
static ButOut okPressed(But *but) {
GmpSetup *gs;
GoStone s;
GmpSetupPlayer *p;
bool needSetup = TRUE;
CliServer server = cliServer_nngs;
const char *userName = NULL, *password = NULL;
gs = but_packet(but);
assert(MAGIC(gs));
goStoneIter(s) {
p = &gs->players[s];
if (but_getFlags(p->strIn1) & BUT_PRESSABLE) {
if (newIn1(p->strIn1, butTextin_get(p->strIn1)) & BUTOUT_ERR)
return(BUTOUT_ERR);
}
if (but_getFlags(p->strIn2) & BUT_PRESSABLE) {
if (newIn2(p->strIn2, butTextin_get(p->strIn2)) & BUTOUT_ERR)
return(BUTOUT_ERR);
}
if ((p->type == gmpSetup_nngs) || (p->type == gmpSetup_igs)) {
if (p->type == gmpSetup_nngs)
server = cliServer_nngs;
else
server = cliServer_igs;
needSetup = FALSE;
userName = butTextin_get(p->strIn1);
password = butTextin_get(p->strIn2);
}
}
if (needSetup) {
gs->gameWaiting = TRUE;
butWin_destroy(gs->win);
gameSetup_create(gs->cg, gotGameSetup, gs);
} else {
/* You need to connect to the server! */
if (gs->players[goStone_white].type == gmpSetup_program)
gmpClient_create(gs->cg, str_chars(&gs->players[goStone_white].progName),
server, userName, password);
else
gmpClient_create(gs->cg, str_chars(&gs->players[goStone_black].progName),
server, userName, password);
gmpSetup_destroy(gs);
}
return(0);
}
static void gotGameSetup(void *packet, GameSetup *gameSetup) {
int inFiles[2], outFiles[2], pids[2];
GmpSetup *gs = packet;
GoStone s;
GmpSetupPlayer *p;
bool valid = TRUE;
Str error;
struct termios newTty;
assert(MAGIC(gs));
if (gameSetup) {
if (gameSetup_size(gameSetup) > 22) {
cgoban_createMsgWindow(gs->cg, "Cgoban Error", msg_gmpTooBig);
valid = FALSE;
} else {
goStoneIter(s) {
p = &gs->players[s];
switch(p->type) {
case gmpSetup_program:
pids[s] = gmp_forkProgram(gs->cg, &inFiles[s], &outFiles[s],
str_chars(&p->progName),
gameSetup->mainTime, gameSetup->byTime);
if (pids[s] < 0) {
str_init(&error);
str_print(&error, msg_progRunErr,
strerror(errno), str_chars(&p->progName));
cgoban_createMsgWindow(gs->cg, "Cgoban Error", str_chars(&error));
str_deinit(&error);
valid = FALSE;
}
break;
case gmpSetup_device:
pids[s] = -1;
inFiles[s] = outFiles[s] = open(str_chars(&p->devName),
O_RDWR | O_NDELAY);
if (inFiles[s] < 0) {
str_init(&error);
str_print(&error, msg_devOpenErr,
strerror(errno), str_chars(&p->devName));
cgoban_createMsgWindow(gs->cg, "Cgoban Error", str_chars(&error));
str_deinit(&error);
valid = FALSE;
}
if (isatty(inFiles[s])) {
newTty.c_cflag = B2400 | CREAD | CLOCAL | CS8;
newTty.c_iflag = 0;
newTty.c_oflag = 0;
newTty.c_lflag = 0;
bzero(newTty.c_cc, NCCS);
tcsetattr(inFiles[s], TCSANOW, &newTty);
}
break;
case gmpSetup_human:
inFiles[s] = outFiles[s] = -1;
pids[s] = -1;
break;
case gmpSetup_local:
case gmpSetup_remote:
default:
assert(0);
break;
}
}
}
if (valid) {
gmpPlay_create(gs->cg, inFiles, outFiles, pids,
gameSetup_rules(gameSetup), gameSetup_size(gameSetup),
gameSetup_handicap(gameSetup), gameSetup_komi(gameSetup),
gameSetup_wName(gameSetup), gameSetup_bName(gameSetup),
gameSetup_timeType(gameSetup),
gameSetup_mainTime(gameSetup),
gameSetup_byTime(gameSetup),
gameSetup_timeAux(gameSetup));
}
}
gmpSetup_destroy(gs);
}
static ButOut cancelPressed(But *but) {
GmpSetup *gs = but_packet(but);
assert(MAGIC(gs));
butWin_destroy(gs->win);
return(0);
}
static ButOut newType(But *but, int newVal) {
GmpSetup *gs;
GoStone color;
GmpSetupPlayer *p;
gs = but_packet(but);
assert(MAGIC(gs));
if (but == gs->players[goStone_white].typeMenu) {
color = goStone_white;
} else {
assert(but == gs->players[goStone_black].typeMenu);
color = goStone_black;
}
p = &gs->players[color];
if (p->type == (GmpSetupType)newVal)
return(0);
p->type = (GmpSetupType)newVal;
clpEntry_setInt(p->optionEntry, newVal);
switch((GmpSetupType)newVal) {
case gmpSetup_program:
butText_setColor(p->strDesc1, BUT_NOCHANGE, FALSE);
butText_set(p->strDesc1, msg_program);
butTextin_set(p->strIn1, str_chars(&p->progName), FALSE);
but_setFlags(p->strIn1, BUT_PRESSABLE);
butText_setColor(p->strDesc2, BUT_NOCHANGE, TRUE);
but_setFlags(p->strIn2, BUT_NOPRESS);
break;
case gmpSetup_device:
butText_setColor(p->strDesc1, BUT_NOCHANGE, FALSE);
butText_set(p->strDesc1, msg_device);
butTextin_set(p->strIn1, str_chars(&p->devName), FALSE);
but_setFlags(p->strIn1, BUT_PRESSABLE);
butText_setColor(p->strDesc2, BUT_NOCHANGE, TRUE);
but_setFlags(p->strIn2, BUT_NOPRESS);
break;
case gmpSetup_human:
butText_setColor(p->strDesc1, BUT_NOCHANGE, TRUE);
but_setFlags(p->strIn1, BUT_NOPRESS);
butText_setColor(p->strDesc2, BUT_NOCHANGE, TRUE);
but_setFlags(p->strIn2, BUT_NOPRESS);
break;
case gmpSetup_nngs:
butText_setColor(p->strDesc1, BUT_NOCHANGE, FALSE);
butText_set(p->strDesc1, msg_username);
butTextin_set(p->strIn1, clp_getStr(gs->cg->clp, "gmp.nngs.username"),
FALSE);
but_setFlags(p->strIn1, BUT_PRESSABLE);
butText_setColor(p->strDesc2, BUT_NOCHANGE, FALSE);
butText_set(p->strDesc2, msg_password);
but_setFlags(p->strIn2, BUT_DRAWABLE|BUT_PRESSABLE);
butTextin_set(p->strIn2, clp_getStr(gs->cg->clp, "gmp.nngs.password"),
FALSE);
butTextin_setHidden(p->strIn2, TRUE);
break;
case gmpSetup_igs:
butText_setColor(p->strDesc1, BUT_NOCHANGE, FALSE);
butText_set(p->strDesc1, msg_username);
butTextin_set(p->strIn1, clp_getStr(gs->cg->clp, "gmp.igs.username"),
FALSE);
but_setFlags(p->strIn1, BUT_PRESSABLE);
butText_setColor(p->strDesc2, BUT_NOCHANGE, FALSE);
butText_set(p->strDesc2, msg_password);
but_setFlags(p->strIn2, BUT_DRAWABLE|BUT_PRESSABLE);
butTextin_set(p->strIn2, clp_getStr(gs->cg->clp, "gmp.igs.password"),
FALSE);
butTextin_setHidden(p->strIn2, TRUE);
break;
case gmpSetup_local:
butText_setColor(p->strDesc1, BUT_NOCHANGE, FALSE);
butText_set(p->strDesc1, msg_port);
butTextin_set(p->strIn1, clp_getStr(gs->cg->clp, "gmp.port"),
FALSE);
but_setFlags(p->strIn1, BUT_PRESSABLE);
butText_setColor(p->strDesc2, BUT_NOCHANGE, TRUE);
but_setFlags(p->strIn2, BUT_NOPRESS);
break;
case gmpSetup_remote:
butText_setColor(p->strDesc1, BUT_NOCHANGE, FALSE);
butText_set(p->strDesc1, msg_machineName);
butTextin_set(p->strIn1, clp_getStr(gs->cg->clp, "gmp.machine"), FALSE);
but_setFlags(p->strIn1, BUT_PRESSABLE);
butText_setColor(p->strDesc2, BUT_NOCHANGE, FALSE);
butText_set(p->strDesc2, msg_port);
but_setFlags(p->strIn2, BUT_DRAWABLE|BUT_PRESSABLE);
butTextin_set(p->strIn2, clp_getStr(gs->cg->clp, "gmp.port"), FALSE);
butTextin_setHidden(p->strIn2, FALSE);
break;
}
if (!isGmpType[gs->players[goStone_white].type] &&
!isGmpType[gs->players[goStone_black].type]) {
but_setFlags(gs->ok, BUT_NOPRESS);
} else {
but_setFlags(gs->ok, BUT_PRESSABLE);
}
return(0);
}
static ButOut newIn1(But *but, const char *value) {
GmpSetup *gs = but_packet(but);
GoStone color;
GmpSetupPlayer *p;
Str errorMsg;
assert(MAGIC(gs));
but_setFlags(but, BUT_NOKEY);
if (but == gs->players[goStone_white].strIn1) {
color = goStone_white;
} else {
assert(but == gs->players[goStone_black].strIn1);
color = goStone_black;
}
p = &gs->players[color];
switch(p->type) {
case gmpSetup_program:
clpEntry_setStr(p->progNameEntry, value);
str_copyChars(&p->progName, value);
break;
case gmpSetup_device:
clpEntry_setStr(p->devNameEntry, value);
str_copyChars(&p->devName, value);
break;
case gmpSetup_nngs:
clp_setStr(gs->cg->clp, "gmp.nngs.username", value);
break;
case gmpSetup_igs:
clp_setStr(gs->cg->clp, "gmp.igs.username", value);
break;
case gmpSetup_local:
if (!clp_setStr(gs->cg->clp, "gmp.port", value)) {
str_init(&errorMsg);
str_print(&errorMsg, msg_badPortNum,
value);
cgoban_createMsgWindow(gs->cg, "Cgoban Error", str_chars(&errorMsg));
str_deinit(&errorMsg);
return(BUTOUT_ERR);
}
break;
case gmpSetup_remote:
clp_setStr(gs->cg->clp, "gmp.machine", value);
break;
default:
assert(0);
break;
}
return(0);
}
static ButOut newIn2(But *but, const char *value) {
GmpSetup *gs = but_packet(but);
GoStone color;
GmpSetupPlayer *p;
Str errorMsg;
assert(MAGIC(gs));
but_setFlags(but, BUT_NOKEY);
if (but == gs->players[goStone_white].strIn2) {
color = goStone_white;
} else {
assert(but == gs->players[goStone_black].strIn2);
color = goStone_black;
}
p = &gs->players[color];
switch(p->type) {
case gmpSetup_nngs:
clp_setStr(gs->cg->clp, "gmp.nngs.password", value);
break;
case gmpSetup_igs:
clp_setStr(gs->cg->clp, "gmp.igs.password", value);
break;
case gmpSetup_remote:
if (!clp_setStr(gs->cg->clp, "gmp.port", value)) {
str_init(&errorMsg);
str_print(&errorMsg, msg_badPortNum,
value);
cgoban_createMsgWindow(gs->cg, "Cgoban Error", str_chars(&errorMsg));
str_deinit(&errorMsg);
return(BUTOUT_ERR);
}
break;
default:
assert(0);
break;
}
return(0);
}
goban-1.1.orig/src/client_setup.h 0000644 0001750 0001750 00000002164 10270065364 014616 0 ustar al al /*
* src/client/setup.h, part of Complete Goban (game program)
* Copyright (C) 1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _CLIENT_SETUP_H_
#define _CLIENT_SETUP_H_ 1
#ifndef _CGOBAN_H_
#include "../cgoban.h"
#endif
#ifndef _CLIENT_DATA_H_
#include "data.h"
#endif
#ifndef _CLIENT_SERVER_H_
#include "server.h"
#endif
/**********************************************************************
* Data Types
**********************************************************************/
typedef struct CliSetup_struct {
CliData *cd;
AbutMsg *login;
int serverNum;
ClpEntry *userClp, *passwordClp;
MAGIC_STRUCT
} CliSetup;
/**********************************************************************
* Functions
**********************************************************************/
extern CliSetup *cliSetup_create(Cgoban *cg, int serverNum);
extern void cliSetup_createGmp(Cgoban *cg, int serverNum,
const char *username, const char *password,
const CliActions *actions, void *packet);
extern void cliSetup_destroy(CliSetup *c);
#endif /* _CLIENT_SETUP_H_ */
goban-1.1.orig/src/net.c 0000644 0001750 0001750 00000052075 10270071403 012676 0 ustar al al /*
* wmslib/src/but/net.c, part of wmslib (Library functions)
* Copyright (C) 1995-1997 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#include
#include "wms.h"
#if X11_DISP
#ifdef STDC_HEADERS
#include
#include
#endif /* STDC_HEADERS */
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef HAVE_SYS_SELECT_H
#include
#endif
#include
#if HAVE_SOCKETS
#include
#if HAVE_NETINET_IN_H
#include
#endif
#if HAVE_SYS_IN_H
#include
#endif
#if HAVE_SYS_INET_H
#include
#endif
#include
#if HAVE_ARPA_NAMESER_H
#include
#endif
#if HAVE_RESOLV_H
#include
#endif
#if HAVE_SYS_UTSNAME_H
#include
#endif
#include
#endif /* HAVE_SOCKETS */
#include
#include
#include
#include
#if HAVE_SOCKETS
/**********************************************************************
* Forward Declarations
**********************************************************************/
static ButOut newConn(void *packet, int fd);
static ButRnet *newRnet(ButEnv *env);
static ButOut getNetData(void *packet, int fd);
static ButOut finishWrite(void *packet, int fd);
static void putProtoWho(ButRnet *net);
static void butRnet_close(ButRnet *net, const char *reason, bool forced);
static bool butRnet_write(ButRnet *net, ButNetMsg *msg);
static void butRnet_sendMMove(ButRnet *net, int winId, int lx, int ly,
int lw, int lh, ButCur type);
static void newFlags(ButRnet *net, int id, uint newFlags);
static ButOut butSpec(ButEnv *env, int butId, void *buf, int bufLen);
/**********************************************************************
* Functions
**********************************************************************/
ButLnet *butLnet_create(ButEnv *env, int port, void *packet,
ButOut ocallback(ButRnet *net),
ButOut callback(ButRnet *net, void *cmd, int cmdLen),
ButOut ccallback(ButRnet *net, const char *reason)) {
ButLnet *net = wms_malloc(sizeof(ButLnet));
struct sockaddr_in sa;
MAGIC_SET(net);
net->env = env;
net->packet = packet;
net->valid = net->error = FALSE;
net->fd = socket(AF_INET, SOCK_STREAM, 0);
net->ocallback = ocallback;
net->callback = callback;
net->ccallback = ccallback;
if (net->fd == -1) {
net->error = TRUE;
net->errNum = errno;
return(net);
}
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = INADDR_ANY;
sa.sin_port = htons(port);
if (bind(net->fd, (struct sockaddr *)&sa, sizeof(sa)) != 0) {
net->error = TRUE;
net->errNum = errno;
close(net->fd);
return(net);
}
if (listen(net->fd, 2) != 0) {
net->error = TRUE;
net->errNum = errno;
close(net->fd);
return(net);
}
butEnv_addFile(env, BUT_READFILE, net->fd, net, newConn);
net->valid = TRUE;
return(net);
}
ButRnet *butRnet_create(ButEnv *env, const char *address, int port,
void *packet, ButOut ocallback(ButRnet *net),
ButOut callback(ButRnet *net, void *cmd, int cmdLen),
ButOut ccallback(ButRnet *net, const char *reason)) {
ButRnet *net;
struct sockaddr_in sa;
struct hostent *hp;
net = newRnet(env);
net->packet = packet;
net->state = butRnetState_closed;
net->error = net->lookupError = net->butNetError = FALSE;
net->ocallback = ocallback;
net->callback = callback;
net->ccallback = ccallback;
if ((net->fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
net->error = TRUE;
net->errNum = errno;
return(net);
}
sa.sin_family = AF_INET;
if ((hp = gethostbyname(address)) == NULL) {
net->lookupError = TRUE;
#if HAVE_H_ERRNO
net->errNum = h_errno;
#else
net->errNum = HOST_NOT_FOUND;
#endif
return(net);
}
memcpy(&sa.sin_addr, hp->h_addr, hp->h_length);
sa.sin_port = htons(port);
if (connect(net->fd, (struct sockaddr *)&sa, sizeof(sa)) < 0) {
net->error = TRUE;
net->errNum = errno;
return(net);
}
net->state = butRnetState_pwWait;
fcntl(net->fd, F_SETFL, O_NONBLOCK);
putProtoWho(net);
butEnv_addFile(net->env, BUT_READFILE, net->fd, net, getNetData);
return(net);
}
void butRnet_accept(ButRnet *net) {
assert(net->state == butRnetState_accWait);
net->state = butRnetState_open;
net->lType = net->env->curlast;
net->env->curlast = butCur_bogus; /* Force the cursor type to be sent. */
putProtoWho(net);
}
void butLnet_destroy(ButLnet *net) {
assert(MAGIC(net));
if (net->valid) {
close(net->fd);
butEnv_rmFile(net->env, BUT_READFILE, net->fd);
}
MAGIC_UNSET(net);
wms_free(net);
}
void butRnet_destroy(ButRnet *net, const char *reason) {
ButNetMsg msgOut;
assert(MAGIC(net));
if (net->state < butRnetState_closing) {
msgOut.type = int_stdInt32(BUTNET_CLOSE);
msgOut.length = int_stdInt32(2*4+strlen(reason)+1);
strcpy(msgOut.perType.close, reason);
butRnet_write(net, &msgOut);
butRnet_close(net, NULL, FALSE);
}
}
static ButOut newConn(void *packet, int fd) {
ButLnet *lnet = packet;
ButRnet *rnet;
struct sockaddr_in addr;
int addrlen = sizeof(addr);
assert(MAGIC(lnet));
rnet = newRnet(lnet->env);
rnet->fd = accept(lnet->fd, (struct sockaddr *)&addr, &addrlen);
if (rnet->fd < 0) {
rnet->env->partners[rnet->partner] = NULL;
MAGIC_UNSET(rnet);
wms_free(rnet);
return(0);
}
rnet->packet = lnet->packet;
rnet->ocallback = lnet->ocallback;
rnet->callback = lnet->callback;
rnet->ccallback = lnet->ccallback;
fcntl(rnet->fd, F_SETFL, O_NONBLOCK);
rnet->state = butRnetState_pwAccWait;
butEnv_addFile(rnet->env, BUT_READFILE, rnet->fd, rnet, getNetData);
return(0);
}
static ButRnet *newRnet(ButEnv *env) {
ButRnet *net = wms_malloc(sizeof(ButRnet));
int newNumPartners, i, partner;
ButRnet **newPartners;
MAGIC_SET(net);
for (partner = 0; partner < env->numPartners; ++partner) {
if (!env->partners[partner])
break;
}
if (partner == env->numPartners) {
newNumPartners = (env->numPartners + 1) * 2;
newPartners = wms_malloc(newNumPartners * sizeof(ButRnet *));
for (i = 0; i < env->numPartners; ++i) {
newPartners[i] = env->partners[i];
}
for (; i < newNumPartners; ++i)
newPartners[i] = NULL;
if (env->partners)
wms_free(env->partners);
env->numPartners = newNumPartners;
env->partners = newPartners;
}
env->partners[partner] = net;
net->partner = partner;
net->env = env;
net->error = FALSE;
net->wBufSize = net->wBufStart = net->wBufLen = 0;
net->wBuffer = NULL;
net->rBufAmt = 0;
net->rBufLen = BUTNET_MAXCMD * 2 + 2;
net->fd = -1;
net->ackNeeded = net->mouseMove = FALSE;
net->who = "Unknown";
net->protocol = "Unknown";
if ((env->last_mwin) && (env->last_mx >= 0)) {
assert(MAGIC(env->last_mwin));
net->lWinId = env->last_mwin->id;
net->lx = env->last_mx;
net->ly = env->last_my;
net->lw = env->last_mwin->w;
net->lh = env->last_mwin->h;
net->lType = env->curnum;
} else
net->lWinId = -2;
net->lPress = net->lTwitch = -1;
butRcur_create(&net->rc, net->env);
return(net);
}
/* Returns TRUE if success. */
static bool butRnet_write(ButRnet *net, ButNetMsg *msg) {
int len = stdInt32_int(msg->length) + 8;
int amtWritten;
char *remainder = (char *)msg;
assert(MAGIC(net));
if (net->wBufLen == 0) {
/* Nothing queued up. Try to write directly! */
amtWritten = write(net->fd, msg, len);
if (amtWritten == len)
return(TRUE);
if (amtWritten < 0) {
butRnet_close(net, strerror(errno), TRUE);
return(FALSE);
}
remainder += amtWritten;
len -= amtWritten;
}
/* Not all got written. Put some into the wBuffer. */
if (len + net->wBufStart + net->wBufLen > net->wBufSize) {
char *newBuf;
newBuf = wms_malloc(net->wBufSize = len + net->wBufStart + net->wBufLen);
if (net->wBufLen)
memcpy(newBuf, net->wBuffer+net->wBufStart, net->wBufLen);
net->wBufStart = 0;
if (net->wBuffer)
wms_free(net->wBuffer);
net->wBuffer = newBuf;
}
memcpy(remainder, net->wBuffer + net->wBufStart + net->wBufLen, len);
net->wBufLen += len;
butEnv_addFile(net->env, BUT_WRITEFILE, net->fd, net, finishWrite);
return(TRUE);
}
static ButOut finishWrite(void *packet, int fd) {
ButRnet *net = packet;
int amtWritten;
assert(MAGIC(net));
amtWritten = write(net->fd, net->wBuffer + net->wBufStart, net->wBufLen);
if (amtWritten == net->wBufLen) {
butEnv_rmFile(net->env, BUT_WRITEFILE, net->fd);
net->wBufLen = 0;
net->wBufStart = 0;
if (net->state == butRnetState_closing) {
close(net->fd);
net->fd = -1;
MAGIC_UNSET(net);
wms_free(net);
}
} else if (amtWritten < 0) {
butRnet_close(net, strerror(errno), TRUE);
return(0);
} else {
net->wBufStart += amtWritten;
net->wBufLen -= amtWritten;
}
return(0);
}
static ButOut getNetData(void *packet, int fd) {
ButRnet *net = packet;
int readLen, i, msgType;
ButOut res = 0;
char *temp;
assert(MAGIC(net));
if (net->rBufAmt < 4) {
/* Waiting for the length count. */
readLen = read(fd, (char *)&net->rBuffer + net->rBufAmt, 4 - net->rBufAmt);
if (readLen <= 0) {
if (readLen == 0)
butRnet_close(net, "Connection closed", TRUE);
else if ((readLen < 0) && (errno != EAGAIN))
butRnet_close(net, strerror(errno), TRUE);
return(res);
}
if ((net->rBufAmt += readLen) < 4)
return(0);
net->rBufMsgLen = stdInt32_int(net->rBuffer.length);
if (net->rBufMsgLen > BUTNET_MAXCMD) {
fprintf(stderr, "Bogus command\n");
for (;;);
}
net->rBufMsgLen += 8;
return(0);
}
if ((net->rBufMsgLen > BUTNET_MAXCMD+8) ||
(net->rBufMsgLen < 8)) {
butRnet_close(net, "Invalid data on connection", TRUE);
return(res);
}
readLen = read(fd, (char *)&net->rBuffer + net->rBufAmt,
net->rBufMsgLen - net->rBufAmt);
if (readLen <= 0) {
if (readLen == 0)
butRnet_close(net, "Connection closed", TRUE);
else if ((readLen < 0) && (errno != EAGAIN))
butRnet_close(net, strerror(errno), TRUE);
return(res);
}
net->rBufAmt += readLen;
if (net->rBufAmt == net->rBufMsgLen) {
msgType = stdInt32_int(net->rBuffer.type);
net->rBufAmt = 0;
switch(msgType) {
case BUTNET_PROTOWHO:
if (net->state == butRnetState_pwWait) {
net->state = butRnetState_open;
/* Force the cursor type to be sent. */
net->lType = net->env->curlast;
net->env->curlast = butCur_bogus;
} else if (net->state == butRnetState_pwAccWait) {
net->state = butRnetState_accWait;
} else {
butRnet_close(net, "Invalid data on connection", TRUE);
break;
}
if (net->rBufMsgLen != sizeof(net->rBuffer.perType.protoWho) + 8) {
butRnet_close(net, "Invalid data on connection", TRUE);
break;
}
net->rmtPartner = stdInt32_int(net->rBuffer.perType.protoWho.context);
temp = wms_malloc(i = (strlen(net->rBuffer.perType.protoWho.proto) + 1));
strcpy(temp, net->rBuffer.perType.protoWho.proto);
net->protocol = temp;
temp = wms_malloc(strlen(net->rBuffer.perType.protoWho.who) + 1);
strcpy(temp, net->rBuffer.perType.protoWho.who);
net->who = temp;
return(net->ocallback(net));
break;
case BUTNET_CLOSE:
butRnet_close(net, net->rBuffer.perType.close, FALSE);
break;
case BUTNET_USERDATA:
if (net->callback)
return(net->callback(net, net->rBuffer.perType.userData,
stdInt32_int(net->rBuffer.length)));
break;
case BUTNET_MOUSE:
if (net->rBufMsgLen != sizeof(net->rBuffer.perType.mouse) + 8) {
butRnet_close(net, "Invalid data on connection", TRUE);
break;
}
butRcur_move(&net->rc, stdInt32_int(net->rBuffer.perType.mouse.win),
stdInt32_int(net->rBuffer.perType.mouse.x),
stdInt32_int(net->rBuffer.perType.mouse.y),
stdInt32_int(net->rBuffer.perType.mouse.w),
stdInt32_int(net->rBuffer.perType.mouse.h),
stdInt32_int(net->rBuffer.perType.mouse.type));
net->rBuffer.length = int_stdInt32(0);
net->rBuffer.type = int_stdInt32(BUTNET_MOUSEACK);
butRnet_write(net, &net->rBuffer);
break;
case BUTNET_MOUSEACK:
if (net->rBufMsgLen != 8) {
butRnet_close(net, "Invalid data on connection", TRUE);
break;
}
net->ackNeeded = FALSE;
if (net->mouseMove) {
net->mouseMove = FALSE;
butRnet_sendMMove(net, -1, -1,-1, -1,-1, -1);
}
break;
case BUTNET_NEWFLAGS:
if (net->rBufMsgLen != sizeof(net->rBuffer.perType.newFlags) + 8) {
butRnet_close(net, "Invalid data on connection", TRUE);
break;
}
newFlags(net, stdInt32_int(net->rBuffer.perType.newFlags.butId),
stdInt32_int(net->rBuffer.perType.newFlags.newFlags));
break;
case BUTNET_BUTSPEC:
res |= butSpec(net->env,
stdInt32_int(net->rBuffer.perType.butSpec.butId),
net->rBuffer.perType.butSpec.butData,
stdInt32_int(net->rBuffer.length) - sizeof(StdInt32));
break;
default:
butRnet_close(net, "Invalid data on connection", TRUE);
break;
}
}
return(res);
}
static void newFlags(ButRnet *net, int id, uint newFlags) {
ButEnv *env = net->env;
But *but;
if (id < env->maxButIds) {
but = env->id2But[id];
if (but) {
if (newFlags & BUT_PRESSED)
net->lPress = id;
else if (net->lPress == id)
net->lPress = -1;
if (newFlags & BUT_TWITCHED)
net->lTwitch = id;
else if (net->lTwitch == id)
net->lTwitch = -1;
but_newFlags(but, (newFlags & (BUT_NETMASK<flags & ~(BUT_NETMASK<env;
ButNetMsg protoOut;
assert(MAGIC(net));
protoOut.length = int_stdInt32(sizeof(protoOut.perType.protoWho));
protoOut.type = int_stdInt32(BUTNET_PROTOWHO);
#if HAVE_SYS_UTSNAME_H
uname(&unameOut);
#endif
if ((loginName = getlogin()) == NULL) {
pw = getpwuid(getuid());
loginName = pw->pw_name;
}
strcpy(protoOut.perType.protoWho.proto, env->protocol);
protoOut.perType.protoWho.proto[sizeof(protoOut.perType.protoWho.proto) -
1] = '\0';
sprintf(protoOut.perType.protoWho.who, "%s@%s",
loginName,
#if HAVE_SYS_UTSNAME_H
unameOut.nodename
#else
"unknown"
#endif
);
butRnet_write(net, &protoOut);
}
static void butRnet_close(ButRnet *net, const char *reason, bool force) {
ButEnv *env = net->env;
assert(MAGIC(net));
if (net->lPress != -1) {
if (env->id2But[net->lPress]) {
but_newFlags(env->id2But[net->lPress], env->id2But[net->lPress]->flags &
~BUT_NETPRESS);
}
}
if (net->lTwitch != -1) {
if (env->id2But[net->lTwitch]) {
but_newFlags(env->id2But[net->lTwitch],
env->id2But[net->lTwitch]->flags & ~BUT_NETTWITCH);
}
}
if (net->state < butRnetState_closing) {
if (reason && net->ccallback)
net->ccallback(net, reason);
net->state = butRnetState_closing;
butEnv_rmFile(net->env, BUT_READFILE, net->fd);
if (force || (net->wBufLen == 0)) {
close(net->fd);
net->fd = -1;
if (net->wBufLen != 0)
butEnv_rmFile(net->env, BUT_WRITEFILE, net->fd);
}
}
net->env->partners[net->partner] = NULL;
MAGIC_UNSET(net);
wms_free(net);
}
void butRnet_send(ButRnet *net, void *buffer, int len) {
ButNetMsg msg;
assert(len <= BUTNET_MAXCMD);
msg.length = int_stdInt32(len);
msg.type = int_stdInt32(BUTNET_USERDATA);
memcpy(msg.perType.userData, buffer, len);
butRnet_write(net, &msg);
}
void butRnet_mMove(ButEnv *env, int winId, int lx,int ly, int lw,int lh,
ButCur curnum) {
int i;
for (i = 0; i < env->numPartners; ++i) {
if (env->partners[i]) {
if (butRnet_valid(env->partners[i]) &&
((winId != -2) || (env->partners[i]->lWinId != -2)))
butRnet_sendMMove(env->partners[i], winId, lx,ly, lw,lh, curnum);
}
}
}
static void butRnet_sendMMove(ButRnet *net, int winId, int lx, int ly,
int lw, int lh, ButCur curnum) {
ButNetMsg msg;
if (winId == -1)
winId = net->lWinId;
if (lx == -1)
lx = net->lx;
if (ly == -1)
ly = net->ly;
if (lw == -1)
lw = net->lw;
if (lh == -1)
lh = net->lh;
if (curnum == -1)
curnum = net->lType;
net->lWinId = winId;
net->lx = lx;
net->ly = ly;
net->lw = lw;
net->lh = lh;
net->lType = curnum;
if (net->ackNeeded)
net->mouseMove = TRUE;
else {
msg.length = int_stdInt32(sizeof(msg.perType.mouse));
msg.type = int_stdInt32(BUTNET_MOUSE);
msg.perType.mouse.context = int_stdInt32(0);
msg.perType.mouse.win = int_stdInt32(winId);
msg.perType.mouse.x = int_stdInt32(lx);
msg.perType.mouse.y = int_stdInt32(ly);
msg.perType.mouse.w = int_stdInt32(lw);
msg.perType.mouse.h = int_stdInt32(lh);
msg.perType.mouse.type = int_stdInt32(curnum);
assert((curnum == -1) ||
(curnum < butCur_bogus));
butRnet_write(net, &msg);
}
}
void butRnet_newFlags(ButEnv *env, int butId, uint newFlags) {
int i;
ButNetMsg msg;
if ((butId != -2) && (env->numPartners > 0)) {
assert(butId >= 0);
assert(butId < env->maxButIds);
newFlags = (newFlags & ~(BUT_NETTWITCH|BUT_NETPRESS|BUT_NETKEY)) |
((newFlags & BUT_NETMASK) << BUT_NETSHIFT);
msg.length = int_stdInt32(sizeof(msg.perType.newFlags));
msg.type = int_stdInt32(BUTNET_NEWFLAGS);
msg.perType.newFlags.butId = int_stdInt32(butId);
msg.perType.newFlags.newFlags = int_stdInt32(newFlags);
for (i = 0; i < env->numPartners; ++i) {
if (env->partners[i])
if (butRnet_valid(env->partners[i]))
butRnet_write(env->partners[i], &msg);
}
}
}
static ButOut butSpec(ButEnv *env, int butId, void *buf, int bufLen) {
But *but;
but = env->id2But[butId];
assert(but->action->netMessage);
return(but->action->netMessage(but, buf, bufLen));
}
#else /* !HAVE_SOCKETS */
ButLnet *butLnet_create(ButEnv *env, int port, void *packet,
ButOut ocallback(ButRnet *net),
ButOut callback(ButRnet *net, void *cmd, int cmdLen),
ButOut ccallback(ButRnet *net, const char *reason)) {
ButLnet *net = wms_malloc(sizeof(ButLnet));
net->error = TRUE;
net->valid = FALSE;
net->errNum = EPERM;
return(net);
}
ButRnet *butRnet_create(ButEnv *env, char *address, int port,
void *packet, ButOut ocallback(ButRnet *net),
ButOut callback(ButRnet *net, void *cmd, int cmdLen),
ButOut ccallback(ButRnet *net, const char *reason)) {
ButRnet *net = wms_malloc(sizeof(ButRnet));
net->error = TRUE;
net->errNum = EPERM;
net->state = butRnetState_closed;
return(net);
}
void butLnet_destroy(ButLnet *net) { wms_free(net); }
void butRnet_destroy(ButRnet *net, char *reason) { wms_free(net); }
bool butRnet_write(ButRnet *net, ButNetMsg *msg) { return(FALSE); }
void butRnet_send(ButRnet *net, void *buffer, int len) {}
void butRnet_mMove(ButEnv *env, int winId, int lx,int ly, int lw,int lh,
ButCur curnum) {}
void butRnet_newFlags(ButEnv *env, int butId, uint newFlags) {}
void butRnet_accept(ButRnet *net) {}
#endif /* HAVE_SOCKETS */
void but_setId(But *but, int id) {
ButEnv *env = but->win->env;
int i;
assert(MAGIC(but));
if (id >= env->maxButIds) {
But **newId2But;
int newMaxButIds = (id + 1)*2;
newId2But = wms_malloc(newMaxButIds * sizeof(But *));
for (i = 0; i < env->maxButIds; ++i)
newId2But[i] = env->id2But[i];
for (; i < newMaxButIds; ++i)
newId2But[i] = NULL;
env->maxButIds = newMaxButIds;
if (env->id2But)
wms_free(env->id2But);
env->id2But = newId2But;
}
if (but->id != -1) {
assert(but->id < env->maxButIds);
env->id2But[id] = NULL;
}
env->id2But[id] = but;
but->id = id;
}
void butWin_setId(ButWin *win, int id) {
ButEnv *env = win->env;
int i;
assert(MAGIC(win));
if (id >= env->maxWinIds) {
ButWin **newId2Win;
int newMaxWinIds = (id + 1)*2;
newId2Win = wms_malloc(newMaxWinIds * sizeof(ButWin *));
for (i = 0; i < env->maxWinIds; ++i)
newId2Win[i] = env->id2Win[i];
for (; i < newMaxWinIds; ++i)
newId2Win[i] = NULL;
env->maxWinIds = newMaxWinIds;
if (env->id2Win)
wms_free(env->id2Win);
env->id2Win = newId2Win;
}
if (win->id != -1) {
assert(win->id < env->maxWinIds);
env->id2Win[id] = NULL;
}
env->id2Win[id] = win;
win->id = id;
}
void butRnet_butSpecSend(But *but, void *buffer, int len) {
ButEnv *env;
ButNetMsg msg;
int i;
assert(len < BUTNET_MAXCMD - sizeof(StdInt32));
if (but->id >= 0) {
env = but->win->env;
if (env->numPartners > 0) {
msg.length = int_stdInt32(len + 4);
msg.type = int_stdInt32(BUTNET_BUTSPEC);
msg.perType.butSpec.butId = int_stdInt32(but->id);
if (len > 0)
memcpy(msg.perType.butSpec.butData, buffer, len);
for (i = 0; i < env->numPartners; ++i) {
if (env->partners[i]) {
if (butRnet_valid(env->partners[i]))
butRnet_write(env->partners[i], &msg);
}
}
}
}
}
#endif /* X11_DISP */
goban-1.1.orig/src/canvas.h 0000644 0001750 0001750 00000002420 06042230657 013367 0 ustar al al /*
* wmslib/include/but/canvas.h, part of wmslib (Library functions)
* Copyright (C) 1994-1995 William Shubert.
* See "configure.h.in" for more copyright information.
*
* Includes for canvas.c
*/
#ifndef _BUT_CANVAS_H_
#define _BUT_CANVAS_H_ 1
/**********************************************************************
* Functions.
**********************************************************************/
extern ButWin *butCan_create(void *packet, ButWin *parent, int layer,
ButWinFunc *resize, ButWinFunc *destroy,
void (*change)(void *packet, int xOff, int yOff,
int w, int h,
int viewW, int viewH));
/* Any values of BUT_NOCHANGE in this function will be left unchanged. */
extern void butCan_resizeView(ButWin *win, int x, int y, int w, int h,
bool propagate);
extern void butCan_slide(ButWin *win, int xOff, int yOff, bool propagate);
extern void butCan_resizeWin(ButWin *win, int w, int h, bool propagate);
#define butCan_xOff(win) ((win)->xOff)
#define butCan_yOff(win) ((win)->yOff)
extern void butCan_destroy(ButWin *can);
/* Private. */
extern Window butCan_xWin(ButWin *win);
extern void butCan_redrawn(ButWin *win, int x,int y, int w,int h);
extern void butCan_winDead(ButWin *win);
#endif /* _BUT_CANVAS_H_ */
goban-1.1.orig/src/abut_msg.c 0000644 0001750 0001750 00000026056 10270061240 013707 0 ustar al al /*
* src/msg.c, part of wmslib library
* Copyright (C) 1994-1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
static ButOut unmap(ButWin *win);
static ButOut wDestroy(ButWin *win);
static ButOut resize(ButWin *win);
static ButOut ok_pressed(But *but);
static void checkNewSize(AbutMsg *mwin, ButWin *win);
static void calcDims(Abut *abut, int fontNum, const char *text,
int *w, int *h, int *textH, int numTins);
static ButOut msg_resize(ButWin *win, AbutMsg *mwin);
static void fillboxDead(But *but);
/*
* UseMsg is never accessed. We just need a void * guaranteed to be
* different from any the user could pass us.
*/
static int useMsg = 0;
AbutMsg *abutMsg_inCreate(Abut *a, ButWin *win, int layer, const char *text,
void *packet,
int numTins, const AbutMsgTin *tinList) {
static AbutMsgOpt ok[1];
static ButKey ka_ok[] = {{XK_Return, 0, ShiftMask},
{XK_KP_Enter, 0, ShiftMask}, {0,0,0}};
ok[0].name = a->ok;
ok[0].callback = ok_pressed;
ok[0].keyEq = ka_ok;
ok[0].packet = &useMsg;
return(abutMsg_optInCreate(a, win, layer, text, NULL, NULL, 1, ok,
numTins, tinList));
}
AbutMsg *abutMsg_optInCreate(Abut *a, ButWin *win, int layer,
const char *text,
ButOut (*destroy)(void *packet), void *packet,
int numButs, const AbutMsgOpt *optList,
int numTins, const AbutMsgTin *tinList) {
ButEnv *env;
AbutMsg *mwin;
int winW, winH;
int i;
void *butPacket;
assert(MAGIC(a));
assert(a->env == butWin_env(win));
env = a->env;
mwin = wms_malloc(sizeof(AbutMsg));
MAGIC_SET(mwin);
mwin->abut = a;
mwin->win = win;
mwin->numButs = numButs;
mwin->buts = wms_malloc(numButs * sizeof(But *));
mwin->numTins = numTins;
mwin->tins = wms_malloc(numTins * sizeof(But *));
mwin->tinTitles = wms_malloc(numTins * sizeof(But *));
mwin->butDesc = optList;
mwin->destroy = destroy;
mwin->packet = packet;
mwin->layer = layer;
calcDims(a, 0, text, &winW, &winH, &mwin->textH, numTins);
mwin->w = winW;
mwin->h = winH;
mwin->box = butBoxFilled_create(win, layer, BUT_DRAWABLE);
but_setPacket(mwin->box, mwin);
but_setDestroyCallback(mwin->box, fillboxDead);
butBoxFilled_setColors(mwin->box, a->ulColor, a->lrColor, a->bgColor);
butBoxFilled_setPixmaps(mwin->box, a->ulPixmap, a->lrPixmap, a->bgPixmap);
mwin->text = butTblock_create(win, layer+1, BUT_DRAWABLE,
text, butText_just);
for (i = 0; i < numButs; ++i) {
butPacket = optList[i].packet;
if (butPacket == &useMsg)
butPacket = mwin;
mwin->buts[i] = butCt_create(optList[i].callback, butPacket,
win, layer+1, BUT_DRAWABLE|BUT_PRESSABLE,
optList[i].name);
if (optList[i].keyEq)
but_setKeys(mwin->buts[i], optList[i].keyEq);
}
for (i = 0; i < numTins; ++i) {
if (tinList[i].name)
mwin->tinTitles[i] = butText_create(win, layer+1, BUT_DRAWABLE,
tinList[i].name, butText_left);
else
mwin->tinTitles[i] = NULL;
mwin->tins[i] = butTextin_create(tinList[i].callback, packet,
win, layer+1, BUT_DRAWABLE|BUT_PRESSABLE,
tinList[i].def, 500);
}
if (butWin_w(win))
msg_resize(win, mwin);
return(mwin);
}
AbutMsg *abutMsg_winInCreate(Abut *a, const char *title, const char *text,
void *packet,
int numTins, const AbutMsgTin *tinList) {
static AbutMsgOpt ok[1];
static ButKey ka_ok[] = {{XK_Return, 0, ShiftMask|ControlMask},
{XK_KP_Enter, 0, ShiftMask|ControlMask},
{0, 0, 0}};
ok[0].name = a->ok;
ok[0].callback = ok_pressed;
ok[0].keyEq = ka_ok;
ok[0].packet = &useMsg;
return(abutMsg_winOptInCreate(a, title, text, NULL, NULL, 1, ok,
numTins, tinList));
}
AbutMsg *abutMsg_winOptInCreate(Abut *a, const char *title, const char *text,
ButOut (*destroy)(void *packet), void *packet,
int numButs, const AbutMsgOpt *optList,
int numTins, const AbutMsgTin *tinList) {
ButEnv *env;
AbutMsg *mwin;
ButWin *win;
int winW, winH;
int i;
void *butPacket;
assert(MAGIC(a));
env = a->env;
mwin = wms_malloc(sizeof(AbutMsg));
MAGIC_SET(mwin);
mwin->abut = a;
mwin->numButs = numButs;
mwin->buts = wms_malloc(numButs * sizeof(But *));
mwin->numTins = numTins;
mwin->tins = wms_malloc(numTins * sizeof(But *));
mwin->tinTitles = wms_malloc(numTins * sizeof(But *));
mwin->butDesc = optList;
mwin->destroy = destroy;
mwin->packet = packet;
mwin->layer = 0;
calcDims(a, 0, text, &winW, &winH, &mwin->textH, numTins);
mwin->w = winW;
mwin->h = winH;
mwin->win = win = butWin_create(mwin, env, title, winW, winH,
unmap, NULL, resize, wDestroy);
butWin_activate(win);
mwin->box = butBoxFilled_create(win, 0, BUT_DRAWABLE);
butBoxFilled_setColors(mwin->box, a->ulColor, a->lrColor, a->bgColor);
butBoxFilled_setPixmaps(mwin->box, a->ulPixmap, a->lrPixmap, a->bgPixmap);
mwin->text = butTblock_create(win, 1, BUT_DRAWABLE,
text, butText_just);
for (i = 0; i < numButs; ++i) {
butPacket = optList[i].packet;
if (butPacket == &useMsg)
butPacket = mwin;
mwin->buts[i] = butCt_create(optList[i].callback, butPacket,
win, 1, BUT_DRAWABLE|BUT_PRESSABLE,
optList[i].name);
if (optList[i].keyEq)
but_setKeys(mwin->buts[i], optList[i].keyEq);
}
for (i = 0; i < numTins; ++i) {
mwin->tinTitles[i] = butText_create(win, 1, BUT_DRAWABLE,
tinList[i].name, butText_left);
mwin->tins[i] = butTextin_create(tinList[i].callback, packet, win,
1, BUT_DRAWABLE|BUT_PRESSABLE,
tinList[i].def, 150);
if (tinList[i].flags & abutMsgTinFlags_secret) {
butTextin_setHidden(mwin->tins[i], TRUE);
}
}
if (butWin_w(win))
msg_resize(win, mwin);
return(mwin);
}
static ButOut unmap(ButWin *win) {
butWin_destroy(win);
return(0);
}
static ButOut wDestroy(ButWin *win) {
AbutMsg *mwin = butWin_packet(win);
ButOut result = 0;
assert(MAGIC(mwin));
mwin->win = NULL;
if (mwin->buts) {
wms_free(mwin->buts);
mwin->buts = NULL;
}
if (mwin->tins) {
wms_free(mwin->tins);
wms_free(mwin->tinTitles);
mwin->tins = NULL;
mwin->tinTitles = NULL;
}
if (mwin->destroy)
result = mwin->destroy(mwin->packet);
MAGIC_UNSET(mwin);
wms_free(mwin);
return(result);
}
static ButOut resize(ButWin *win) {
return(msg_resize(win, butWin_packet(win)));
}
static ButOut msg_resize(ButWin *win, AbutMsg *mwin) {
int x, y, w, h, buth;
ButEnv *env = butWin_env(win);
int bw = butEnv_stdBw(env);
int butX, butW, i;
int maxTinNameLen = 0, newLen;
assert(MAGIC(mwin));
checkNewSize(mwin, win);
x = (butWin_w(win) - mwin->w) / 2;
y = (butWin_h(win) - mwin->h) / 2;
w = mwin->w;
h = mwin->h;
buth = mwin->abut->butH;
but_resize(mwin->box, x,y, w,h);
butTblock_resize(mwin->text, x+bw*2, y+bw*2, w - bw*4);
for (butX = bw*2, i = 0; i < mwin->numButs; ++i) {
butW = (w-bw-butX + (mwin->numButs - i) / 2) / (mwin->numButs - i) - bw;
but_resize(mwin->buts[i], x+butX, y+h-bw*2-buth, butW, buth);
butX += butW + bw;
}
for (i = 0; i < mwin->numTins; ++i) {
if (mwin->tinTitles[i]) {
newLen = butText_resize(mwin->tinTitles[i], x + bw*2,
y + h - (buth + bw)*(mwin->numTins - i + 1) -
bw*2, buth) + bw;
if (newLen > maxTinNameLen)
maxTinNameLen = newLen;
}
}
for (i = 0; i < mwin->numTins; ++i) {
but_resize(mwin->tins[i], x + bw*2 + maxTinNameLen,
y + h - (buth + bw)*(mwin->numTins - i + 1) - bw*2,
w - bw*4 - maxTinNameLen, buth);
}
return(0);
}
static void checkNewSize(AbutMsg *mwin, ButWin *win) {
ButEnv *env = butWin_env(win);
int textH, butH;
textH = butEnv_fontH(env, 0);
butH = mwin->abut->butH;
if (textH != mwin->textH) {
calcDims(mwin->abut, 0, butTblock_getText(mwin->text),
&mwin->w, &mwin->h, &mwin->textH, mwin->numTins);
if (mwin->layer == 0)
butWin_resize(win, mwin->w, mwin->h);
}
}
static ButOut ok_pressed(But *but) {
AbutMsg *msg;
msg = but_packet(but);
assert(MAGIC(msg));
if (msg->layer == 0)
butWin_destroy(msg->win);
else
abutMsg_destroy(but_packet(but), TRUE);
return(0);
}
void abutMsg_destroy(AbutMsg *msg, bool propagate) {
int i;
int x = 0, y = 0, w = 0, h = 0;
assert(MAGIC(msg));
if (propagate == FALSE) {
msg->destroy = NULL;
}
if (msg->box) {
x = but_x(msg->box);
y = but_y(msg->box);
w = but_w(msg->box);
h = but_h(msg->box);
}
if (msg->buts) {
but_setPacket(msg->box, NULL);
but_destroy(msg->box);
but_destroy(msg->text);
for (i = 0; i < msg->numButs; ++i)
but_destroy(msg->buts[i]);
for (i = 0; i < msg->numTins; ++i) {
but_destroy(msg->tins[i]);
but_destroy(msg->tinTitles[i]);
}
}
if ((msg->layer == 0) && msg->win)
butWin_destroy(msg->win);
else {
butWin_redraw(msg->win, x, y, w, h);
MAGIC_UNSET(msg);
wms_free(msg);
}
}
static void calcDims(Abut *abut, int fontNum, const char *text,
int *w, int *h, int *textHOut, int numTins) {
ButEnv *env = abut->env;
int textW, textH, butH, butSpc;
int winW, winH, actualH, bw;
double b, c;
textW = butEnv_textWidth(env, text, fontNum);
*textHOut = textH = butEnv_fontH(env, fontNum);
butH = abut->butH;
bw = butEnv_stdBw(env);
butSpc = butH + bw;
/*
* This is based on the calculations:
* winW = 2*winH
* (winW - 4*bw) * (winH - (4*bw + butSpc*(numTins + 1))) = textW*textH
* Solve for winW...
* (winW - 4*bw) * (0.5*winW - 4*bw - butSpc*numTins - butSpc) =
* textW*textH
* 0.5*winW^2 - winW*(-4*bw-butSpc*numTins-butSpc-2*bw) +
* 16*bw*bw+4*bw*butSpc*numTins+4*bw*butSpc - textW*textH = 0
* winW^2 - winW*(-12*bw-2*butSpc*numTins-2*butSpc) +
* 32*bw*bw+8*bw*butSpc*numTins+8*bw*butSpc - 2*textW*textH = 0
* Using the quadratic equation, notice a is 1.0, and solve
* winW = (-b+sqrt(b*b-4*a*c))/2*a
*/
b = (double)(-12 * bw - 2 * butSpc * numTins - 2 * butSpc);
c = (double)(32*bw*bw + 8*bw*butSpc*numTins + 8*bw*butSpc - 2 * textW*textH);
winW = (int)((-b + sqrt(b*b-4*c)) * 0.5 + 0.5);
winH = winW / 2;
if (winH < 2*textH + butSpc*(numTins + 1) + 4*butEnv_stdBw(env))
winH = 2*textH + butSpc*(numTins + 1) + 4*butEnv_stdBw(env);
winW = winH * 2;
actualH = butTblock_guessH(env, text, winW - 4*butEnv_stdBw(env), fontNum) +
butSpc*(numTins + 1) + 4*butEnv_stdBw(env);
if (actualH > winH) {
winH = actualH;
winW = 2*winH;
}
*w = winW;
*h = winH;
}
static void fillboxDead(But *but) {
AbutMsg *mwin;
assert(MAGIC(but));
mwin = but_packet(but);
if (mwin) {
assert(MAGIC(mwin));
if (mwin->buts) {
wms_free(mwin->buts);
mwin->buts = NULL;
}
if (mwin->tins) {
wms_free(mwin->tins);
wms_free(mwin->tinTitles);
mwin->tins = NULL;
mwin->tinTitles = NULL;
}
mwin->box = mwin->text = NULL;
mwin->win = NULL;
}
}
goban-1.1.orig/src/editBoard.h 0000644 0001750 0001750 00000002743 10270001467 014012 0 ustar al al /*
* src/editBoard.h, part of Complete Goban (game program)
* Copyright (C) 1995-1996 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _EDITBOARD_H_
#ifndef _CGOBAN_H_
#include "cgoban.h"
#endif
#ifndef _SGF_H_
#include "sgf.h"
#endif
#ifndef _GOGAME_H_
#include "goGame.h"
#endif
#ifndef _GOBAN_H_
#include "goban.h"
#endif
#ifndef _EDITTOOL_H_
#include "editTool.h"
#endif
#ifndef _ABUT_FSEL_H_
#include
#endif
#ifndef _EDITINFO_H_
#include "editInfo.h"
#endif
#ifdef _EDITBOARD_H_
Levelization Error.
#endif
#define _EDITBOARD_H_ 1
/**********************************************************************
* Data types
**********************************************************************/
typedef struct EditBoard_struct {
Cgoban *cg;
Str fName;
bool modified;
AbutFsel *fsel;
AbutMsg *reallyQuit;
Sgf *sgf;
int currentNodeNum;
GoGame *game;
Goban *goban;
SgfElem *lastComment;
EditToolWin tools;
EditTool oldTool;
But *shiftKeytrap, *prevVar, *nextVar;
bool invertShift; /* Kludgey. :-( */
EditInfo *info;
MAGIC_STRUCT
} EditBoard;
/**********************************************************************
* Functions
**********************************************************************/
EditBoard *editBoard_create(Cgoban *cg, const char *fName);
EditBoard *editBoard_createSgf(Cgoban *cg, const Sgf *sgf);
void editBoard_destroy(EditBoard *eb);
#endif /* _EDITBOARD_H_ */
goban-1.1.orig/src/term.h 0000644 0001750 0001750 00000002675 10267777722 013114 0 ustar al al /*
* wmslib/src/abut/term.h, part of wmslib (Library functions)
* Copyright (C) 1995 William Shubert
* See "configure.h.in" for more copyright information.
*
* Includes for "term" scrolling terminal-like widgety thing.
*/
#ifndef _ABUT_TERM_H_
#define _ABUT_TERM_H_ 1
#ifndef _ABUT_ABUT_H_
#include
#endif
#ifndef _ABUT_SWIN_H_
#include
#endif
#ifndef _BUT_TBIN_H_
#include
#endif
/**********************************************************************
* Data types
**********************************************************************/
typedef enum {
abutTermState_fastUp, abutTermState_slowUp, abutTermState_steady,
abutTermState_slowDown, abutTermState_fastDown
} AbutTermState;
typedef struct AbutTerm_struct {
Abut *abut;
AbutSwin *swin;
But *bg;
But *tbin;
AbutTermState state;
MAGIC_STRUCT
} AbutTerm;
/**********************************************************************
* Functions
**********************************************************************/
extern AbutTerm *abutTerm_create(Abut *abut, ButWin *parent,
int layer, bool editable);
extern void abutTerm_destroy(AbutTerm *term);
extern void abutTerm_resize(AbutTerm *term, int x, int y, int w, int h);
extern void abutTerm_set(AbutTerm *term, const char *text);
#define abutTerm_get(term) butTbin_get((term)->tbin)
extern void abutTerm_append(AbutTerm *term, const char *appText);
#endif /* _ABUT_TERM_H_ */
goban-1.1.orig/src/look.c 0000644 0001750 0001750 00000013224 10270070111 013040 0 ustar al al /*
* src/client/look.c, part of Complete Goban (game program)
* Copyright (C) 1996 William Shubert
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include
#ifndef _MSG_H_
#include "msg.h"
#endif
#ifdef _CLIENT_LOOK_H_
LEVELIZATION ERROR
#endif
#include "look.h"
/**********************************************************************
* Forward Declarations
**********************************************************************/
static void gameReady(CliLook *look, int size);
static GobanOut quit(void *packet);
static void gobanDead(void *packet);
static bool moveOk(void *packet);
static void makeMoves(GoGame *game, const char *board, int size);
/**********************************************************************
* Functions
**********************************************************************/
void cliLook_init(CliLook *look, Cgoban *cg, CliServer server) {
GoStone s;
MAGIC_SET(look);
look->cg = cg;
look->server = server;
look->state = cliLook_ready;
goStoneIter(s) {
str_init(&look->name[s]);
str_init(&look->rank[s]);
}
str_init(&look->boardData);
}
void cliLook_deinit(CliLook *look) {
GoStone s;
assert(MAGIC(look));
goStoneIter(s) {
str_deinit(&look->name[s]);
str_deinit(&look->rank[s]);
}
str_deinit(&look->boardData);
MAGIC_UNSET(look);
}
void cliLook_gotData(CliLook *look, const char *buf) {
GoStone s;
int lineNum, matches;
char data[GOBOARD_MAXSIZE + 1];
char name[40], rank[10];
assert(MAGIC(look));
switch(look->state) {
case cliLook_ready:
look->skip = FALSE;
str_clip(&look->boardData, 0);
/* Fall through to cliLook_info1. */
case cliLook_info:
s = (look->state - cliLook_ready) + goStone_white;
matches = sscanf(buf, "%39s %9s %d %*d %*d %*s %g %d",
name, rank, &look->captures[s],
&look->komi, &look->handicap);
assert(matches == 5);
str_copyChars(&look->name[s], name);
str_copyChars(&look->rank[s], rank);
++look->state;
break;
case cliLook_body:
matches = sscanf(buf, "%d: %s", &lineNum, data);
assert(matches == 2);
assert(strlen(data) <= GOBOARD_MAXSIZE);
str_catChars(&look->boardData, data);
if (lineNum == strlen(data) - 1) {
gameReady(look, lineNum + 1);
look->state = cliLook_ready;
}
break;
}
}
static void gameReady(CliLook *look, int size) {
static const GobanActions actions = {
NULL, quit, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, /* edit, gameInfo */
&help_cliLook, gobanDead,
moveOk, moveOk, moveOk, moveOk};
Goban *goban;
GoGame *game;
Str title;
static const GoTime noTime = {goTime_none, 0, 0, 0};
CliLookChild *child;
int i;
/*
* If it's a game-end board, then don't show it.
* You can tell these because they have 3s, 4s, and 5s in them.
*/
for (i = 0; i < str_len(&look->boardData); ++i) {
assert(str_chars(&look->boardData)[i] >= '0');
assert(str_chars(&look->boardData)[i] <= '6');
if ((str_chars(&look->boardData)[i] > '2') &&
(str_chars(&look->boardData)[i] < '6')) {
return;
}
}
child = wms_malloc(sizeof(CliLookChild));
MAGIC_SET(child);
str_init(&title);
str_print(&title, msg_cliLookName,
str_chars(&look->name[goStone_white]),
str_chars(&look->rank[goStone_white]),
str_chars(&look->name[goStone_black]),
str_chars(&look->rank[goStone_black]));
/*
* I pass in a handicap of 0 even though I know the real handicap. Why?
* because otherwise when I parse over the board, if I find a white
* stone where there used to be a handicap stone, I'm screwed! I'd have
* to erase the black stone somehow and add a white one. Ugh. Easier
* just to never add the handicap stones to begin with; they'll be caught
* when I scan the board later.
*/
game = goGame_create(size, goRules_japanese, 0, look->komi,
&noTime, TRUE);
makeMoves(game, str_chars(&look->boardData), size);
goban = goban_create(look->cg, &actions, child, game, "client.look",
str_chars(&title));
goban->pic->allowedMoves = goPicMove_noWhite | goPicMove_noBlack;
goban->iDec1 = grid_create(&look->cg->cgbuts, NULL, NULL,
goban->iWin, 2, BUT_DRAWABLE, 0);
grid_setStone(goban->iDec1, goStone_white, FALSE);
if (look->server == cliServer_nngs)
grid_setVersion(goban->iDec1, CGBUTS_WORLDWEST(0));
else
grid_setVersion(goban->iDec1, CGBUTS_WORLDEAST(0));
goban_update(goban);
butText_set(goban->infoText, "Static Game Board");
child->game = game;
child->goban = goban;
str_deinit(&title);
}
static GobanOut quit(void *packet) {
CliLookChild *child = packet;
assert(MAGIC(child));
goban_destroy(child->goban, TRUE);
return(gobanOut_noDraw);
}
static void gobanDead(void *packet) {
CliLookChild *child = packet;
assert(MAGIC(child));
goGame_destroy(child->game);
MAGIC_UNSET(child);
wms_free(child);
}
static bool moveOk(void *packet) {
return(FALSE);
}
static void makeMoves(GoGame *game, const char *board, int size) {
int x, y;
for (x = 0; x < size; ++x) {
for (y = 0; y < size; ++y) {
switch(*board) {
case '0':
goGame_move(game, goStone_black,
goBoard_xy2Loc(game->board, x, y), NULL);
break;
case '1':
goGame_move(game, goStone_white,
goBoard_xy2Loc(game->board, x, y), NULL);
break;
case '2':
case '6':
break;
default:
assert(0);
break;
}
++board;
}
}
goGame_pass(game, goStone_black, NULL); /* These passes just get rid of */
goGame_pass(game, goStone_white, NULL); /* the "last move here" marker. */
}
goban-1.1.orig/src/str.h 0000644 0001750 0001750 00000004002 06121705431 012715 0 ustar al al /*
* wmslib/src/wms/str.h, part of wmslib (Library functions)
* Copyright (C) 1994-1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _WMS_STR_H_
#define _WMS_STR_H_ 1
#ifndef _WMS_H_
#include
#endif
/**********************************************************************
* Data Types
**********************************************************************/
typedef struct Str_struct {
char *chars;
int len;
int maxLen;
MAGIC_STRUCT
} Str;
/**********************************************************************
* Functions
**********************************************************************/
extern Str *str_create(void);
extern Str *str_createStr(const Str *s);
extern Str *str_createChars(const char *chars);
extern Str *str_createChar(char c);
extern void str_destroy(Str *s);
extern void str_init(Str *s);
extern void str_initStr(Str *s, const Str *src);
extern void str_initChars(Str *s, const char *src);
extern void str_initCharsLen(Str *s, const char *src, int len);
extern void str_deinit(Str *s);
#define str_len(s) ((s)->len)
#define str_chars(s) ((const char *)((s)->chars))
extern void str_copy(Str *dest, const Str *src);
extern void str_copyChars(Str *dest, const char *src);
extern void str_copyCharsLen(Str *dest, const char *src, int len);
extern void str_copyChar(Str *dest, char src);
extern void str_print(Str *dest, const char *fmt, ...);
extern void str_cat(Str *dest, const Str *src);
extern void str_catChars(Str *dest, const char *src);
extern void str_catCharsLen(Str *dest, const char *src, int len);
extern void str_catChar(Str *dest, char src);
extern void str_catInt(Str *dest, int src);
/* str_alphaCmd is useful in qsort and bsearch. */
extern int str_alphaCmp(const void *a, const void *b);
#define str_clip(s, l) \
do { \
if ((l) < (s)->len) \
(s)->chars[(s)->len = (l)] = '\0'; \
} while(0)
#endif /* _WMS_STR_H_ */
goban-1.1.orig/src/sgfOut.c 0000644 0001750 0001750 00000020650 10270056703 013357 0 ustar al al /*
* src/sgfOut.c, part of Complete Goban (game program)
* Copyright (C) 1995-1996 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include
#include "cgoban.h"
#include "sgf.h"
#include "msg.h"
#ifdef _SGFOUT_H_
LEVELIZATION ERROR
#endif
#include "sgfOut.h"
/**********************************************************************
* Forward Declarations
**********************************************************************/
static void printColor(Str *out, SgfElem *me);
static void printPoint(Str *out, Sgf *mc, SgfElem *me);
static bool writeNode(FILE *f, Sgf *mc, SgfElem *me, int *err,
int col, Str *tmp1, Str *tmp2);
static void printString(Str *out, SgfElem *me);
static SgfElem *printPoints(Str *out, Sgf *mc, SgfElem *me);
static SgfElem *printLabelPoints(Str *out, Sgf *mc, SgfElem *me);
/**********************************************************************
* Functions
**********************************************************************/
bool sgf_writeFile(Sgf *mc, const char *fname, int *err) {
FILE *f;
SgfElem *me;
Str nodeOut, tmp;
assert(MAGIC(mc));
f = fopen(fname, "w");
if (f == NULL) {
if (err)
*err = errno;
return(FALSE);
}
fprintf(f, "(;GM[1]FF[3]\n");
str_init(&nodeOut);
str_init(&tmp);
if (mc->top.childH == mc->top.childT) {
if (!writeNode(f, mc, mc->top.childH, err, 0, &nodeOut, &tmp)) {
fclose(f);
str_deinit(&nodeOut);
str_deinit(&tmp);
return(FALSE);
}
} else {
for (me = mc->top.childH; me; me = me->sibling) {
fprintf(f, "\n(");
if (!writeNode(f, mc, me, err, 0, &nodeOut, &tmp)) {
fclose(f);
str_deinit(&nodeOut);
str_deinit(&tmp);
return(FALSE);
}
fprintf(f, ")");
}
}
fprintf(f, "\n)\n");
fclose(f);
str_deinit(&nodeOut);
str_deinit(&tmp);
return(TRUE);
}
static bool writeNode(FILE *f, Sgf *mc, SgfElem *me, int *err,
int col, Str *nodeOut, Str *tmp) {
bool crNeeded; /* Flag; put this on its own line? */
while (me) {
crNeeded = FALSE;
switch(me->type) {
case sgfType_node:
str_copyChar(nodeOut, ';');
break;
case sgfType_unknown:
str_copyChars(nodeOut, str_chars(me->sVal));
break;
case sgfType_size:
str_print(nodeOut, "SZ[%d]", me->iVal);
break;
case sgfType_rules:
str_print(nodeOut, "RU[%s]", msg_ruleNames[(int)(me->iVal)]);
break;
case sgfType_handicap:
str_print(nodeOut, "HA[%d]", me->iVal);
break;
case sgfType_komi:
str_print(nodeOut, "KM[%g]", (double)me->iVal / 2.0);
break;
case sgfType_time:
str_print(nodeOut, "TM[%s]", str_chars(me->sVal));
break;
case sgfType_copyright:
str_copyChars(nodeOut, "CP");
printString(nodeOut, me);
break;
case sgfType_playerName:
crNeeded = TRUE;
str_copyChar(nodeOut, 'P');
printColor(nodeOut, me);
printString(nodeOut, me);
break;
case sgfType_title:
crNeeded = TRUE;
str_copyChars(nodeOut, "GN");
printString(nodeOut, me);
break;
case sgfType_playerRank:
str_clip(nodeOut, 0);
printColor(nodeOut, me);
str_catChar(nodeOut, 'R');
printString(nodeOut, me);
break;
case sgfType_event:
crNeeded = TRUE;
str_copyChars(nodeOut, "EV");
printString(nodeOut, me);
break;
case sgfType_source:
crNeeded = TRUE;
str_copyChars(nodeOut, "SO");
printString(nodeOut, me);
break;
case sgfType_gameComment:
str_copyChars(nodeOut, "GC");
printString(nodeOut, me);
break;
case sgfType_date:
crNeeded = TRUE;
str_copyChars(nodeOut, "DT");
printString(nodeOut, me);
break;
case sgfType_whoseMove:
assert(goStone_isStone(me->gVal));
str_print(nodeOut, "PL[%d]", (int)(me->gVal == goStone_white) + 1);
break;
case sgfType_move:
str_clip(nodeOut, 0);
printColor(nodeOut, me);
printPoint(nodeOut, mc, me);
break;
case sgfType_pass:
str_clip(nodeOut, 0);
printColor(nodeOut, me);
if (mc->longLoc)
str_catChars(nodeOut, "[]");
else
str_catChars(nodeOut, "[tt]");
break;
case sgfType_timeLeft:
str_clip(tmp, 0);
printColor(tmp, me);
str_print(nodeOut, "%sL[%d]", str_chars(tmp), me->iVal);
break;
case sgfType_stonesLeft:
str_copyChar(tmp, 'O');
printColor(tmp, me);
str_print(nodeOut, "%s[%d]", str_chars(tmp), me->iVal);
break;
case sgfType_setBoard:
str_copyChar(nodeOut, 'A');
printColor(nodeOut, me);
me = printPoints(nodeOut, mc, me);
break;
case sgfType_territory:
str_copyChar(nodeOut, 'T');
printColor(nodeOut, me);
me = printPoints(nodeOut, mc, me);
break;
case sgfType_triangle:
str_copyChars(nodeOut, "TR");
me = printPoints(nodeOut, mc, me);
break;
case sgfType_circle:
str_copyChars(nodeOut, "CR");
me = printPoints(nodeOut, mc, me);
break;
case sgfType_square:
str_copyChars(nodeOut, "MA");
me = printPoints(nodeOut, mc, me);
break;
case sgfType_label:
str_copyChars(nodeOut, "LB");
me = printLabelPoints(nodeOut, mc, me);
break;
case sgfType_comment:
str_copyChars(nodeOut, "C");
printString(nodeOut, me);
break;
case sgfType_result:
crNeeded = TRUE;
str_copyChars(nodeOut, "RE");
printString(nodeOut, me);
break;
case sgfType_place:
str_copyChars(nodeOut, "PC");
printString(nodeOut, me);
break;
case sgfType_style:
str_copyChars(nodeOut, "SY");
printString(nodeOut, me);
break;
default:
fprintf(stderr, "BOGUS PROPERTY TO PRINT!\n");
for (;;);
break;
}
if (col && (crNeeded || (col + str_len(nodeOut) > 70))) {
fprintf(f, "\n");
col = 0;
}
col += str_len(nodeOut);
fprintf(f, "%s", str_chars(nodeOut));
if (crNeeded) {
fprintf(f, "\n");
col = 0;
}
if (me->childH == me->childT) {
me = me->childH;
} else {
for (me = me->childH; me; me = me->sibling) {
fprintf(f, "\n(");
if (!writeNode(f, mc, me, err, 1, nodeOut, tmp))
return(FALSE);
fprintf(f, ")\n");
col = 0;
}
}
}
return(TRUE);
}
static void printColor(Str *out, SgfElem *me) {
if (me->gVal == goStone_white)
str_catChar(out, 'W');
else if (me->gVal == goStone_black)
str_catChar(out, 'B');
else {
assert(me->gVal == goStone_empty);
str_catChar(out, 'E');
}
}
static void printPoint(Str *out, Sgf *mc, SgfElem *me) {
if (mc->longLoc) {
str_catChar(out, '[');
str_catChar(out, me->lVal[0]);
str_catChar(out, me->lVal[1]);
str_catChar(out, me->lVal[2]);
str_catChar(out, me->lVal[3]);
str_catChar(out, ']');
} else {
str_catChar(out, '[');
str_catChar(out, me->lVal[1]);
str_catChar(out, me->lVal[3]);
str_catChar(out, ']');
}
}
static SgfElem *printPoints(Str *out, Sgf *mc, SgfElem *me) {
printPoint(out, mc, me);
while ((me->childH != NULL) &&
(me->childH == me->childT) &&
(me->childH->type == me->type) &&
(me->childH->gVal == me->gVal)) {
me = me->childH;
printPoint(out, mc, me);
}
return(me);
}
static void printLabelPoint(Str *out, Sgf *mc, SgfElem *me) {
if (mc->longLoc) {
str_catChar(out, '[');
str_catChar(out, me->lVal[0]);
str_catChar(out, me->lVal[1]);
str_catChar(out, me->lVal[2]);
str_catChar(out, me->lVal[3]);
str_catChar(out, ':');
str_cat(out, me->sVal);
str_catChar(out, ']');
} else {
str_catChar(out, '[');
str_catChar(out, me->lVal[1]);
str_catChar(out, me->lVal[3]);
str_catChar(out, ':');
str_cat(out, me->sVal);
str_catChar(out, ']');
}
}
static SgfElem *printLabelPoints(Str *out, Sgf *mc, SgfElem *me) {
printLabelPoint(out, mc, me);
while (me->childH &&
(me->childH == me->childT) &&
(me->childH->type == me->type) &&
(me->childH->gVal == me->gVal)) {
me = me->childH;
printLabelPoint(out, mc, me);
}
return(me);
}
static void printString(Str *out, SgfElem *me) {
const char *str = str_chars(me->sVal);
str_catChar(out, '[');
while (*str) {
if ((*str == ']') || (*str == '[') || (*str == '\\'))
str_catChar(out, '\\');
str_catChar(out, *str);
++str;
}
str_catChar(out, ']');
}
goban-1.1.orig/src/menu_snd.c 0000644 0001750 0001750 00000021245 10270056420 013715 0 ustar al al /*
* wmslib/src/but/menu_snd.c, part of wmslib (Library functions)
* Copyright (C) 1994 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#include
#if X11_DISP
#include
#include
#include
static uchar openmenu[] = {
/*
* Actual noise: "Twanging" a rubber band stretched across my
* hole puncher.
*/
101,97,104,92,79,70,53,55,89,32,21,35,32,44,47,57,72,83,229,196,
146,136,150,140,139,145,150,158,164,175,190,235,74,59,51,47,45,
44,43,43,43,44,45,47,49,53,56,36,31,180,101,222,193,211,210,45,
29,14,19,12,22,31,35,109,191,200,220,175,176,169,169,167,166,166,
166,167,168,167,142,128,133,139,142,151,156,167,177,206,80,58,47,
43,40,31,12,3,5,6,10,14,21,25,30,41,50,73,238,195,185,178,174,
163,137,128,133,137,141,146,152,159,168,180,197,102,68,57,50,42,
34,47,46,43,47,44,48,48,52,55,59,47,24,16,18,15,14,17,25,32,44,
62,125,191,180,173,169,166,160,140,129,137,159,178,159,147,140,
142,151,161,34,21,44,168,162,184,185,223,95,70,60,56,52,51,49,50,
50,51,53,52,31,17,15,13,15,25,60,161,146,143,149,150,154,156,159,
163,167,171,174,179,184,189,195,201,207,214,221,227,233,235,235,
233,229,227,45,12,7,11,15,24,30,41,54,84,203,185,167,143,137,146,
175,67,225,207,166,144,141,139,139,142,158,43,17,13,17,20,32,169,
149,143,151,156,161,172,178,197,219,82,68,60,56,45,24,16,16,15,
21,29,58,176,158,154,158,159,163,167,170,174,184,202,223,79,81,
240,185,176,186,186,189,191,194,202,33,7,8,14,18,27,32,45,204,
149,141,142,167,36,59,64,79,220,213,193,175,156,157,165,176,88,
68,69,74,75,77,78,105,165,147,142,138,142,150,155,166,175,198,97,
57,24,10,10,10,13,22,39,174,157,159,165,169,173,178,185,190,198,
206,217,232,93,51,45,49,46,52,55,62,82,193,172,169,172,173,175,
194,21,6,13,17,24,31,40,56,231,155,143,149,172,53,222,215,203,
189,183,157,153,157,162,188,75,53,56,59,60,64,213,173,172,161,
154,151,148,147,150,158,167,179,202,91,53,26,14,12,11,15,20,28,
48,190,162,158,167,172,176,188,208,91,78,67,57,49,51,59,76,234,
204,194,187,175,168,163,161,166,179,73,27,10,12,17,22,29,36,47,
206,157,156,157,179,69,78,96,208,174,155,155,156,160,175,218,50,
43,45,49,86,172,166,159,156,157,158,165,168,170,170,171,175,187,
236,60,45,34,27,23,21,22,24,28,36,55,207,185,179,177,179,180,186,
196,205,218,237,110,107,222,196,186,185,179,174,173,173,174,179,
189,210,56,34,22,12,13,20,25,31,46,176,163,165,164,183,201,187,
179,174,170,167,166,168,173,185,209,89,76,77,110,200,182,175,172,
170,170,170,171,174,174,177,183,186,191,207,91,58,45,40,36,32,29,
29,33,41,47,55,66,95,208,201,204,206,207,205,202,200,196,194,191,
189,187,182,178,176,180,187,206,94,71,53,40,30,24,21,22,30,44,87,
184,173,170,171,172,175,181,181,180,183,181,178,179,184,191,208,
244,107,121,225,203,193,187,184,185,184,183,182,181,182,184,189,
196,205,231,77,56,45,41,38,37,38,41,47,58,69,78,90,239,216,211,
208,207,206,206,203,202,203,199,195,193,191,188,188,192,205,124,
78,67,53,39,33,30,30,34,41,56,101,189,177,173,173,174,176,179,
184,189,191,196,199,198,195,192,193,197,203,210,222,234,232,230,
220,214,211,203,196,191,188,187,188,191,199,214,106,73,58,49,45,
43,44,46,52,61,74,94,237,218,212,206,204,205,206,206,206,208,210,
209,206,204,201,196,192,191,191,198,218,88,61,50,39,30,30,32,40,
51,79,201,183,176,176,179,184,189,196,203,206,207,207,207,202,
194,191,190,193,198,201,203,206,208,212,214,218,221,221,218,208,
205,200,193,192,197,207,124,76,61,53,47,46,47,54,61,73,91,242,
218,209,206,206,205,205,208,211,214,214,215,218,217,219,216,212,
207,203,204,205,219,96,72,57,44,35,30,31,38,48,72,206,185,178,
176,178,184,189,197,205,208,211,207,205,199,192,191,191,193,196,
200,204,209,212,217,222,222,231,228,220,214,205,200,195,191,191,
198,213,99,72,60,55,53,53,57,64,75,83,90,97,102,109,254,254,249,
242,234,229,223,219,215,212,208,206,204,203,203,205,213,223,114,
79,65,56,45,37,34,38,45,59,101,197,184,179,179,182,186,191,199,
205,207,206,205,202,198,197,195,196,197,199,202,205,215,230,111,
93,86,85,90,105,235,211,199,191,186,186,190,203,250,76,62,57,56,
59,64,75,83,89,95,95,90,85,85,87,91,99,120,237,228,226,225,221,
215,209,208,206,205,209,220,110,78,65,58,49,42,40,42,46,59,79,
207,189,182,179,180,183,188,194,202,206,209,212,211,206,204,201,
199,198,198,200,203,210,224,254,97,91,87,83,83,87,101,236,213,
202,195,194,201,217,109,77,65,61,61,64,73,84,96,105,103,103,96,
95,97,105,120,244,231,223,222,220,219,216,213,212,208,211,220,
235,92,73,62,56,50,44,44,46,53,65,91,213,194,187,184,183,185,188,
191,199,204,207,213,215,215,214,211,207,206,207,210,216,223,236,
121,101,91,86,87,94,125,220,205,195,190,188,189,192,204,242,85,
72,64,62,63,67,72,78,88,95,104,117,109,106,114,123,117,123,255,
120,109,106,108,110,119,237,227,233,246,97,77,66,59,54,48,49,55,
62,78,245,206,194,187,185,186,188,191,195,200,204,206,215,231,
242,236,225,218,213,212,214,218,222,231,252,104,92,87,90,95,114,
225,206,198,191,190,190,195,206,247,84,72,66,66,69,74,79,89,95,
101,100,95,94,96,101,108,113,109,105,99,94,92,92,95,103,116,122,
116,101,86,75,67,61,58,56,58,63,75,95,223,207,199,193,190,189,
189,190,193,197,200,203,207,217,226,237,251,247,243,236,232,230,
227,230,245,110,95,92,94,109,234,214,204,200,198,197,201,210,235,
94,78,71,68,69,72,76,83,90,103,122,242,238,237,236,238,239,238,
238,237,247,115,104,96,94,99,103,104,100,90,82,75,69,63,61,62,66,
74,89,252,223,215,208,203,199,196,196,198,200,201,204,211,219,
224,229,234,235,231,233,234,231,227,223,224,229,245,102,94,94,
102,248};
static uchar closemenu[] = {
/*
* Actual sound: Me clicking my tongue. I don't really like this
* noise but I can't find a better one within my wage slave
* cubicle and if I leave to record a good noise my boss might
* see me.
*/
214,102,73,59,51,47,44,42,42,43,44,47,52,61,81,218,191,182,176,
175,174,175,177,181,187,194,202,215,224,231,223,209,200,193,190,
188,188,186,181,180,181,185,195,219,90,65,55,47,45,44,43,43,43,
46,52,68,243,192,177,172,170,169,172,182,205,77,52,41,34,30,29,
30,34,41,54,103,188,173,167,164,162,162,162,164,166,170,172,175,
175,179,189,217,76,59,52,49,49,47,44,38,32,30,30,32,40,49,67,110,
199,185,176,171,167,166,168,173,184,205,94,72,66,62,60,57,54,54,
58,70,117,201,188,186,188,192,195,193,189,185,184,184,185,187,
190,188,187,184,180,177,175,175,174,175,176,183,204,72,44,31,25,
21,18,18,19,21,25,29,36,47,76,197,178,172,169,167,168,168,168,
168,169,170,171,174,175,178,177,175,175,175,177,183,188,198,211,
225,122,99,87,73,63,60,58,60,62,62,61,60,57,55,55,57,61,68,78,79,
76,71,70,77,105,206,191,186,183,183,184,186,190,199,204,215,249,
94,90,120,212,199,190,189,191,196,203,208,208,206,207,218,118,86,
73,66,59,55,52,47,45,43,41,40,40,39,39,40,41,44,49,60,91,203,184,
174,167,160,157,156,159,168,179,192,197,189,177,174,179,221,56,
44,44,55,73,62,43,31,41,175,144,144,144,152,144,153,18,18,18,145,
144,144,151,31,18,18,18,72,153,193,32,144,144,174,18,18,39,151,
195,172,144,144,160,18,18,163,158,34,150,144,144,178,18,18,41,37,
18,36,144,144,144,18,18,18,18,21,235,144,144,144,18,18,22,18,22,
168,144,144,144,95,25,18,18,18,42,144,144,163,152,59,18,18,18,25,
147,153,144,144,167,18,18,19,23,29,148,144,144,186,27,26,18,18,
18,152,144,158,145,155,22,18,18,35,41,175,144,144,159,47,43,18,
18,25,158,151,153,144,148,42,20,29,34,45,157,144,146,163,195,26,
18,18,20,32,182,144,144,145,153,172,48,43,74,201,170,157,168,62,
29,18,18,18,18,26,126,167,172,164,189,62,76,237,166,150,144,144,
144,149,172,73,43,34,47,68,214,189,102,46,28,22,17,21,30,43,217,
188,192,220,49,41,38,43,79,181,162,158,160,170,189,84,60,78,194,
172,164,162,168,188,62,31,18,192,154,29,144,22,144,31,41,175,18,
156,18,144,29,145,197,177,174,41,162,31,151,52,147,194,157,206,
67,57,36,104,34,187,35,186,26,32,47,60,68,29,203,105,189,87,88,
78,38,47,43,97,73,169,171,161,173,171,193,239,103,80,195,203,177,
189,189,76,63,45,47,46,58,87,217,191,206,222,63,58,48,57,69,209,
187,178,180,189,216,77,66,59,68,86,210,196,186,185,185,188,189,
184,176,172,169,167,169,175,194,106,63,56,55,62,78,119,116,75,56,
44,36,31,30,31,36,42,51,60,79,107,223,200,187,176,172,166,162,
159,160,163,167,173,177,186,191,204,242,78,59,47,40,33,30,30,31,
35,41,47,57,69,90,221,202,191,184,178,175,174,175,178,183,191,
206,243,107,255,222,213,205,202,202,205,212,213,217,213,205,198,
194,192,193,198,207,220,232,225,211,203,198,200,209,121,78,63,57,
54,52,51,52,56,60,65,74,76,78,81,88,116,219,205,202,201,202,207,
219,239,105,87,78,78,82,84,88,88,80,77,76,76,79,93,234,209,201,
194,189,186,184,185,188,190,190,190,190,191,191,193,197,204,219,
229,241,123,95,79,72,68,64,60,56};
Snd butMenu_openSnd = snd_define(openmenu);
Snd butMenu_closeSnd = snd_define(closemenu);
#endif /* X11_DISP */
goban-1.1.orig/src/goScore.c 0000644 0001750 0001750 00000037144 10270000767 013516 0 ustar al al /*
* src/goScore.c, part of Complete Goban (game program)
* Copyright (C) 1995-1996 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include "goBoard.h"
#include "goGame.h"
#include "goScore.h"
#include "msg.h"
/**********************************************************************
* Forward Declarations
**********************************************************************/
static void checkIfSeki(GoGame *game, int loc);
static void markNeighborEmptySpecial(GoGame *game, int loc, GoStone s);
static void markSpecialStones(GoGame *game, GoStone s, uint mark);
static int findSpecialEyes(GoGame *game, GoStone s);
static int countNeighbors(GoGame *g, GoBoard *b, int loc, GoStone s);
static void removeFakeEyes(GoGame *g, GoStone s);
static void testGroupForFake(GoGame *g, int loc, GoStone s);
static void paintRelatedGroupsFaketest(GoGame *g, int loc, GoStone s);
/**********************************************************************
* Functions
**********************************************************************/
Str *goScore_str(GoScore *score, GoGame *game,
const GoTime *time, const GoTimer *timers) {
Str *result, ingTimes[2], winner;
GoRules rules = game->rules;
float scores[2];
int timePenalties[2];
GoStone s;
result = str_create();
goStoneIter(s) {
str_init(&ingTimes[s]);
if (time != NULL)
timePenalties[s] = goTime_ingPenalty(time, &timers[s]);
if (timePenalties[s]) {
str_print(&ingTimes[s], msg_ingPenaltyComment, timePenalties[s]);
}
scores[s] = score->scores[s] - timePenalties[s];
}
if (goRules_scoreKills[rules]) {
str_print(result, msg_scoreKillsComment,
score->territories[goStone_white],
goGame_caps(game, goStone_white) +
score->deadStones[goStone_white],
game->komi,
str_chars(&ingTimes[goStone_white]),
scores[goStone_white],
score->territories[goStone_black],
goGame_caps(game, goStone_black) +
score->deadStones[goStone_black],
str_chars(&ingTimes[goStone_black]),
scores[goStone_black]);
} else {
str_print(result, msg_scoreNoKillsComment,
score->territories[goStone_white],
score->livingStones[goStone_white],
(double)score->dame / 2.0,
game->komi,
str_chars(&ingTimes[goStone_white]),
scores[goStone_white],
score->territories[goStone_black],
score->livingStones[goStone_black],
(double)score->dame / 2.0,
str_chars(&ingTimes[goStone_black]),
scores[goStone_black]);
}
str_init(&winner);
if (scores[goStone_white] > scores[goStone_black]) {
str_print(&winner, msg_winnerComment,
msg_stoneNames[goStone_white],
scores[goStone_white] - scores[goStone_black]);
} else if ((scores[goStone_black] > scores[goStone_white]) ||
(game->rules == goRules_ing)) {
str_print(&winner, msg_winnerComment,
msg_stoneNames[goStone_black],
scores[goStone_black] - scores[goStone_white]);
} else {
str_print(&winner, msg_jigoComment);
}
str_cat(result, &winner);
str_catChar(result, '\n');
str_deinit(&winner);
str_deinit(&ingTimes[goStone_white]);
str_deinit(&ingTimes[goStone_black]);
return(result);
}
void goScore_compute(GoScore *score, GoGame *game) {
int sekiArea[2], dame = 0;
GoBoard *b = game->board;
bool change;
int i, j, min, max;
uint oldFlags;
GoStone s;
assert(MAGIC(game));
assert(game->state >= goGameState_selectDead);
game->flagsCleared = FALSE;
min = goBoard_minLoc(game->board);
max = goBoard_maxLoc(game->board);
score->livingStones[goStone_black] = score->livingStones[goStone_white] = 0;
score->territories[goStone_black] = score->territories[goStone_white] = 0;
score->deadStones[goStone_black] = score->deadStones[goStone_white] = 0;
score->dame = 0;
sekiArea[goStone_black] = sekiArea[goStone_white] = 0;
/* Add up the number of living stones. */
for (i = min; i < max; ++i) {
game->flags[i] &= ~(GOGAMEFLAGS_SEEN |
GOGAMEFLAGS_SEKI | GOGAMEFLAGS_NOSEKI);
s = goBoard_stone(b, i);
if (goStone_isStone(s)) {
if (game->flags[i] & GOGAMEFLAGS_MARKDEAD) {
++score->deadStones[goStone_opponent(s)];
} else {
game->flags[i] |= goGameFlags_see(s);
++score->livingStones[s];
}
}
}
/*
* Now iterate over the board, figuring out what empty spaces see
* different stones.
*/
do {
change = FALSE;
for (i = min; i < max; ++i) {
if ((goBoard_stone(b, i) == goStone_empty) ||
(game->flags[i] & GOGAMEFLAGS_MARKDEAD)) {
/* It's an empty space. */
oldFlags = game->flags[i];
for (j = 0; j < 4; ++j) {
game->flags[i] |=
game->flags[i + goBoard_dir(b, j)] & GOGAMEFLAGS_SEEN;
}
change = (change || (game->flags[i] != oldFlags));
}
}
} while (change);
/*
* Go through and find all the sekis.
*/
if (game->rules == goRules_japanese) {
for (i = 0; i < goBoard_area(game->board); ++i) {
if (goStone_isStone(goBoard_stone(game->board, i)) &&
!(game->flags[i] &
(GOGAMEFLAGS_SEKI | GOGAMEFLAGS_NOSEKI | GOGAMEFLAGS_MARKDEAD)))
checkIfSeki(game, i);
}
}
for (i = min; i < max; ++i) {
if ((goBoard_stone(b, i) == goStone_empty) ||
(game->flags[i] & GOGAMEFLAGS_MARKDEAD)) {
if (((game->flags[i] & GOGAMEFLAGS_SEEBLACK) == 0) ==
((game->flags[i] & GOGAMEFLAGS_SEEWHITE) == 0)) {
++dame;
} else if (game->flags[i] & GOGAMEFLAGS_SEEBLACK) {
if (game->flags[i] & GOGAMEFLAGS_SEKI) {
++sekiArea[goStone_black];
} else {
++score->territories[goStone_black];
}
} else {
assert(game->flags[i] & GOGAMEFLAGS_SEEWHITE);
if (game->flags[i] & GOGAMEFLAGS_SEKI) {
++sekiArea[goStone_white];
} else {
++score->territories[goStone_white];
}
}
}
}
score->dame = dame;
switch(game->rules) {
case goRules_chinese:
case goRules_ing:
case goRules_nz:
goStoneIter(s) {
score->territories[s] += sekiArea[s];
score->scores[s] = (float)dame / 2.0 + score->territories[s] +
score->livingStones[s];
}
break;
case goRules_aga:
case goRules_tibetan:
goStoneIter(s) {
score->territories[s] += sekiArea[s];
score->scores[s] = score->territories[s] + goGame_caps(game, s) +
score->deadStones[s];
}
break;
case goRules_japanese:
goStoneIter(s) {
score->scores[s] = score->territories[s] + goGame_caps(game, s) +
score->deadStones[s];
}
break;
}
score->scores[goStone_white] += game->komi;
}
static void checkIfSeki(GoGame *game, int loc) {
GoStone s;
int i;
s = goBoard_stone(game->board, loc);
goBoard_copy(game->board, game->tmpBoard);
for (i = 0; i < goBoard_area(game->tmpBoard); ++i) {
if (goStone_isStone(goBoard_stone(game->tmpBoard, i)) &&
(game->flags[i] & GOGAMEFLAGS_MARKDEAD))
goBoard_rmGroup(game->tmpBoard, i);
}
markNeighborEmptySpecial(game, loc, s);
removeFakeEyes(game, s);
if (findSpecialEyes(game, s) > 1) {
markSpecialStones(game, s, GOGAMEFLAGS_NOSEKI);
return;
}
markSpecialStones(game, s, GOGAMEFLAGS_SEKI);
}
static void markNeighborEmptySpecial(GoGame *game, int loc, GoStone s) {
int i, d;
bool change;
GoStone stoneHere;
uint oldFlags, enemySeen;
for (i = 0; i < goBoard_area(game->tmpBoard); ++i)
game->flags[i] &= ~(GOGAMEFLAGS_SPECIAL | GOGAMEFLAGS_EYE |
GOGAMEFLAGS_NOTFAKE | GOGAMEFLAGS_FAKETEST);
game->flags[loc] |= GOGAMEFLAGS_SPECIAL;
do {
change = FALSE;
for (i = 0; i < goBoard_area(game->tmpBoard); ++i) {
stoneHere = goBoard_stone(game->tmpBoard, i);
if (!(game->flags[i] & GOGAMEFLAGS_SPECIAL) &&
((stoneHere == goStone_empty) || (stoneHere == s))) {
oldFlags = game->flags[i];
for (d = 0; d < 4; ++d)
game->flags[i] |= game->flags[i+goBoard_dir(game->tmpBoard, d)] &
GOGAMEFLAGS_SPECIAL;
change = (change || (oldFlags != game->flags[i]));
}
}
} while (change);
enemySeen = goGameFlags_see(goStone_opponent(s));
for (i = 0; i < goBoard_area(game->tmpBoard); ++i) {
if (game->flags[i] & enemySeen)
game->flags[i] &= ~GOGAMEFLAGS_SPECIAL;
}
}
static void markSpecialStones(GoGame *game, GoStone s, uint mark) {
int i;
for (i = 0; i < goBoard_area(game->tmpBoard); ++i) {
if (game->flags[i] & GOGAMEFLAGS_SPECIAL)
game->flags[i] |= mark;
}
}
static int findSpecialEyes(GoGame *game, GoStone s) {
uint oldFlags;
int i, d, eyeSize, n;
int deadEnemyLoc, enemySize = 0, deadEnemyConn[5];
int specialConn[5];
bool change, emptyAwayFromEnemy = FALSE;
GoStone opponent = goStone_opponent(s);
deadEnemyLoc = 0;
for (i = 0; i < 5; ++i) {
deadEnemyConn[i] = 0;
specialConn[i] = 0;
}
for (i = 0; i < goBoard_area(game->tmpBoard); ++i) {
if ((game->flags[i] & GOGAMEFLAGS_SPECIAL) &&
(goBoard_stone(game->tmpBoard, i) == goStone_empty)) {
game->flags[i] |= GOGAMEFLAGS_EYE;
break;
}
}
if (i == goBoard_area(game->tmpBoard)) {
return(0);
}
/*
* If this is a dead enemy stone, we want to know!
*/
if (goBoard_stone(game->board, i) == opponent) {
deadEnemyLoc = i;
++deadEnemyConn[countNeighbors(game, game->board, i, opponent)];
++enemySize;
} else {
n = countNeighbors(game, game->board, i, goStone_empty);
++specialConn[n];
if (n >= 3)
return(2);
if (countNeighbors(game, game->board, i, opponent) == 0)
emptyAwayFromEnemy = TRUE;
}
eyeSize = 1;
do {
change = FALSE;
for (i = 0; i < goBoard_area(game->tmpBoard); ++i) {
if (((game->flags[i] & (GOGAMEFLAGS_EYE|GOGAMEFLAGS_SPECIAL)) ==
GOGAMEFLAGS_SPECIAL) &&
(goBoard_stone(game->tmpBoard, i) == goStone_empty)) {
oldFlags = game->flags[i];
for (d = 0; d < 4; ++d)
game->flags[i] |= game->flags[i+goBoard_dir(game->tmpBoard, d)] &
GOGAMEFLAGS_EYE;
if (game->flags[i] != oldFlags) {
change = TRUE;
++eyeSize;
if (goBoard_stone(game->board, i) == opponent) {
if (deadEnemyLoc) {
if (!goBoard_groupEq(game->board, deadEnemyLoc, i))
return(2);
} else
deadEnemyLoc = i;
++deadEnemyConn[countNeighbors(game, game->board, i, opponent)];
++enemySize;
} else {
n = countNeighbors(game, game->board, i, goStone_empty);
++specialConn[n];
if (n >= 3)
return(2);
if (countNeighbors(game, game->board, i, opponent) == 0)
emptyAwayFromEnemy = TRUE;
}
}
}
}
} while (change);
/*
* Look for a second eye.
*/
for (i = 0; i < goBoard_area(game->tmpBoard); ++i) {
if (((game->flags[i] & (GOGAMEFLAGS_SPECIAL |
GOGAMEFLAGS_EYE)) == GOGAMEFLAGS_SPECIAL) &&
(goBoard_stone(game->tmpBoard, i) == goStone_empty)) {
return(2);
}
}
/*
* We have one big eye with no dead enemies in in. It can make unless it
* is less than 3 in size or it is a 4 space 2x2 eye.
*/
if (enemySize == 0) {
switch(eyeSize) {
case(1):
case(2):
return(1);
case(4):
if (specialConn[2] == 4)
return(1);
else
return(2);
default:
return(2);
}
}
/*
* If there are enemies and you have a liberty away from them, then you
* can get two eyes.
*/
if (emptyAwayFromEnemy)
return(2);
/*
* We have some dead enemies. See if they're in a dead shape.
*/
/*
* First test: Matches ?
* ? # ?
* ?
*/
if (deadEnemyConn[4] + deadEnemyConn[3] + deadEnemyConn[2] < 2)
return(1);
/*
* Second test: Matches # #
* ? # #
* ?
*/
if ((deadEnemyConn[4] == (deadEnemyConn[1] == 2)) &&
(deadEnemyConn[3] == (deadEnemyConn[1] == 1)) &&
(deadEnemyConn[4] + deadEnemyConn[3] + deadEnemyConn[2] == 4) &&
(deadEnemyConn[1] < 3))
return(1);
/*
* Second test: Matches # #
* # # #
* # #
*/
if ((deadEnemyConn[4] == 1) && (deadEnemyConn[2] == 6) &&
(enemySize == 7))
return(1);
return(2);
}
static int countNeighbors(GoGame *g, GoBoard *b, int loc, GoStone s) {
int d, newLoc, count;
for (d = 0, count = 0; d < 4; ++d) {
newLoc = loc + goBoard_dir(b, d);
if ((goBoard_stone(b, newLoc) == s) &&
(g->flags[newLoc] & GOGAMEFLAGS_SPECIAL))
++count;
}
return(count);
}
static void removeFakeEyes(GoGame *g, GoStone s) {
int i;
bool change;
do {
change = FALSE;
for (i = 0; i < goBoard_area(g->tmpBoard); ++i) {
if ((goBoard_stone(g->tmpBoard, i) == s) &&
((g->flags[i] & (GOGAMEFLAGS_SPECIAL | GOGAMEFLAGS_NOTFAKE)) ==
GOGAMEFLAGS_SPECIAL)) {
change = TRUE;
testGroupForFake(g, i, s);
break;
}
}
} while (change);
}
static void testGroupForFake(GoGame *g, int loc, GoStone s) {
int i, d, faketests, newLoc;
int emptySeen = 0;
paintRelatedGroupsFaketest(g, loc, s);
/*
* All SPECIAL empties touching FAKETEST stones are fake UNLESS:
* - There are more than one SPECIAL empties that touch FAKETEST
* stones.
* or
* - There is at least one SPECIAL empty that is bounded on all four
* sides by FAKETEST stones.
*/
for (i = 0; i < goBoard_area(g->tmpBoard); ++i) {
if ((goBoard_stone(g->tmpBoard, i) == goStone_empty) &&
(g->flags[i] & GOGAMEFLAGS_SPECIAL)) {
faketests = 0;
for (d = 0; d < 4; ++d) {
if (g->flags[i + goBoard_dir(g->tmpBoard, d)] & GOGAMEFLAGS_FAKETEST)
++faketests;
}
if (faketests)
++emptySeen;
if (faketests == 4)
++emptySeen;
}
}
if (emptySeen != 1) {
/* No fakes associated with this group. */
for (i = 0; i < goBoard_area(g->tmpBoard); ++i) {
if ((goBoard_stone(g->tmpBoard, i) == s) &&
(g->flags[i] & GOGAMEFLAGS_FAKETEST)) {
g->flags[i] |= GOGAMEFLAGS_NOTFAKE;
}
g->flags[i] &= ~GOGAMEFLAGS_FAKETEST;
}
} else {
/*
* Fake. Turn off the specialness of all adjacent empties, and
* also turn off all NOTFAKE flags.
* Turn on the SEEBLACK and the SEEWHITE flags to make sure that
* the fake eyes don't count for territory.
*/
for (i = 0; i < goBoard_area(g->tmpBoard); ++i) {
if ((goBoard_stone(g->tmpBoard, i) == s) &&
(g->flags[i] & GOGAMEFLAGS_FAKETEST)) {
for (d = 0; d < 4; ++d) {
newLoc = i + goBoard_dir(g->tmpBoard, d);
if ((g->flags[newLoc] & GOGAMEFLAGS_SPECIAL) &&
(goBoard_stone(g->tmpBoard, newLoc) == goStone_empty)) {
g->flags[newLoc] = (g->flags[newLoc] & ~GOGAMEFLAGS_SPECIAL) |
(GOGAMEFLAGS_SEEBLACK|GOGAMEFLAGS_SEEWHITE);
}
}
}
g->flags[i] &= ~(GOGAMEFLAGS_FAKETEST | GOGAMEFLAGS_NOTFAKE);
}
}
}
/*
* All stones that are connected by non-eye spaces are related. Here
* we paint all such groups FAKETEST.
*/
static void paintRelatedGroupsFaketest(GoGame *g, int loc, GoStone s) {
bool change;
uint oldFlags;
int i, d;
g->flags[loc] |= GOGAMEFLAGS_FAKETEST;
do {
change = FALSE;
for (i = 0; i < goBoard_area(g->tmpBoard); ++i) {
if ((goBoard_stone(g->tmpBoard, i) == s) ||
((goBoard_stone(g->tmpBoard, i) == goStone_empty) &&
!(g->flags[i] & GOGAMEFLAGS_SPECIAL))) {
oldFlags = g->flags[i];
for (d = 0; d < 4; ++d)
g->flags[i] |= (g->flags[i + goBoard_dir(g->tmpBoard, d)] &
GOGAMEFLAGS_FAKETEST);
change = (change || (oldFlags != g->flags[i]));
}
}
} while (change);
}
void goScore_zero(GoScore *score) {
GoStone color;
score->dame = 0;
goStoneIter(color) {
score->territories[color] = 0;
score->livingStones[color] = 0;
score->deadStones[color] = 0;
score->scores[color] = 0.0;
}
}
goban-1.1.orig/src/fsel.h 0000644 0001750 0001750 00000004630 10267777524 013067 0 ustar al al /*
* src/fsel.h, part of wmslib library
* Copyright (C) 1995-1997 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _ABUT_FSEL_H_
#ifndef _ABUT_ABUT_H_
#include
#endif
#ifndef _ABUT_SWIN_H_
#include
#endif
#ifndef _WMS_STR_H_
#include
#endif
#ifndef _ABUT_MSG_H_
#include
#endif
#ifdef _ABUT_FSEL_H_
#error Levelization Error.
#endif
#define _ABUT_FSEL_H_ 1
/**********************************************************************
* Data types
**********************************************************************/
typedef struct AbutFsel_struct {
Abut *abut;
bool propagate;
void (*callback)(struct AbutFsel_struct *fsel,
void *packet, const char *fname);
void *packet;
ButWin *win;
But *title;
But *box;
But *path, *pathIn;
But *file, *in;
But *mask, *maskIn;
But *dirs, *files;
AbutSwin *dSwin, *fSwin;
But *dList, *dlBg, *fList, *flBg;
But *ok;
But *cancel;
Str pathVal;
AbutMsg *msg;
MAGIC_STRUCT
} AbutFsel;
/**********************************************************************
* Globals
**********************************************************************/
extern const char *abutFsel_pathMessage;
extern const char *abutFsel_fileMessage;
extern const char *abutFsel_maskMessage;
extern const char *abutFsel_dirsMessage;
extern const char *abutFsel_filesMessage;
extern const char *abutFsel_dirErrMessage;
/**********************************************************************
* Functions
**********************************************************************/
extern AbutFsel *abutFsel_create(Abut *a,
void (*callback)(AbutFsel *fsel,
void *packet,
const char *fname),
void *packet,
const char *app, const char *title,
const char *startName);
extern AbutFsel *abutFsel_createDir(Abut *a,
void (*callback)(AbutFsel *fsel,
void *packet,
const char *fname),
void *packet,
const char *app, const char *title,
const char *startDir,
const char *startName);
extern void abutFsel_destroy(AbutFsel *fsel, bool propagate);
#define abutFsel_setColors(f, ul, lr, c) \
butBoxFilled_setColors((f)->box, (ul), (lr), (c))
#define abutFsel_setPixmaps(f, ul, lr, c) \
butBoxFilled_setPixmaps((f)->box, (ul), (lr), (c))
#endif /* _ABUT_FSEL_H_ */
goban-1.1.orig/src/control.h 0000644 0001750 0001750 00000001737 10270067644 013610 0 ustar al al /*
* src/control.h, part of Complete Goban (game program)
* Copyright (C) 1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _CONTROL_H_
#define _CONTROL_H_ 1
#ifndef _SETUP_H_
#include "lsetup.h"
#endif
/**********************************************************************
* Data types
**********************************************************************/
typedef struct Control_struct {
Cgoban *cg;
ButWin *win;
But *box;
But *sPics[2], *servers[2];
But *lGame, *lGamePic;
But *lLoad, *lLoadPic;
But *edit, *editPic;
But *gmp, *gmpPic;
But *sBox;
Setup *setupWin;
But *help, *setup, *quit;
ButWin *iWin;
But *iBg, *ig;
MAGIC_STRUCT
} Control;
/**********************************************************************
* Functions
**********************************************************************/
extern Control *control_create(Cgoban *cg, bool iconic);
#endif /* _CONTROL_H_ */
goban-1.1.orig/src/goHash.c 0000644 0001750 0001750 00000001536 10270000734 013314 0 ustar al al /*
* src/gohash.c, part of Complete Goban (game program)
* Copyright (C) 1995 William Shubert
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include "goHash.h"
#if GoHash_isScalar
const GoHash goHash_zero = 0;
const GoHash goHash_pass = 1;
#else
const GoHash goHash_zero = {0, 0};
const GoHash goHash_pass = {1, 0};
#endif /* GoHash_isScalar */
GoHash goHash_init(Rnd *r) {
GoHash v;
int i;
#if GoHash_isScalar
v = 0;
for (i = 0; i < sizeof(GoHash) / sizeof(uint32); ++i)
v = (v << 32) | (GoHash)rnd_uint32(r);
v &= ~1;
#else
v.hi = rnd_uint32(r);
v.lo = rnd_uint32(r) & ~1;
#endif /* GoHash_isScalar */
return(v);
}
#if !GoHash_isScalar
GoHash goHash_xor(GoHash v1, GoHash v2) {
v1.lo ^= v2.lo;
v1.hi ^= v2.hi;
return(v1);
}
#endif /* !GoHash_isScalar */
goban-1.1.orig/src/but.h 0000644 0001750 0001750 00000041743 10267775045 012732 0 ustar al al /*
* wmslib/include/but/but.h, part of wmslib (Library functions)
* Copyright (C) 1994-1995 William Shubert.
* See "configure.h.in" for more copyright information.
*
* Includes for auxiliary button code.
*/
#ifndef _BUT_BUT_H_
#define _BUT_BUT_H_ 1
#include
#include
#if HAVE_SYS_SELECT_H
#include
#endif
/**********************************************************************
* Forward declarations
**********************************************************************/
typedef struct ButTimer_struct ButTimer;
typedef struct ButWin_struct ButWin;
typedef struct ButLnet_struct ButLnet;
typedef struct ButRnet_struct ButRnet;
typedef struct ButEnv_struct ButEnv;
typedef struct But_struct But;
#include
/**********************************************************************
* Constants
**********************************************************************/
#define BUT_DCLICK 350 /* Time between double clicks; should probably */
/* be settable by the user. */
/**********************************************************************
* Types
**********************************************************************/
#define BUTOUT_STOPWAIT 0x01
#define BUTOUT_ERR 0x02
#define BUTOUT_CAUGHT 0x04
#define BUTOUT_STILLBUTS 0x08
#define BUTOUT_IGNORE 0x10 /* Used by canvases. */
typedef uint ButOut;
typedef ButOut ButWinFunc(struct ButWin_struct *win);
typedef struct ButAction_struct {
ButOut (*mMove)(But *but, int x, int y);
ButOut (*mLeave)(But *but);
ButOut (*mPress)(But *but, int butnum, int x, int y);
ButOut (*mRelease)(But *but, int butnum, int x, int y);
ButOut (*kPress)(But *but, const char *str, KeySym sym);
ButOut (*kRelease)(But *but, const char *str, KeySym sym);
void (*draw)(But *but, int x, int y, int w, int h);
ButOut (*destroy)(But *but);
void (*newFlags)(But *but, uint nfl);
ButOut (*netMessage)(But *but, void *msg, int msgLen);
/* resize returns TRUE if redraws are needed for old & new position. */
bool (*resize)(But *but, int oldX, int oldY, int oldW, int oldH);
} ButAction;
typedef struct ButColor_struct {
int red, green, blue, greyLevel;
} ButColor;
typedef struct ButSet_struct {
int numButs;
bool dynamic; /* If TRUE, then buts should be freed when you're done. */
But **buts;
int maxButs;
MAGIC_STRUCT
} ButSet;
typedef struct ButWinArea_struct {
int x, y, w, h;
} ButWinArea;
struct ButWin_struct {
struct ButWin_struct *parent; /* NULL unless you're a canvas. */
struct But_struct *parentBut; /* NULL unless you're a canvas. */
void *packet, *iPacket;
Window win, physWin;
struct ButWin_struct *iconWin;
const char *name;
bool iconic, isIcon;
bool isroot; /* for screensaver */
int window_id; /* for screensaver */
int x,y,w,h, xOff, yOff, minWRatio, minHRatio, maxWRatio, maxHRatio;
int minW, minH, maxW, maxH, wStep, hStep;
int logicalW, logicalH; /* Same as w&h except for canvases. */
bool resized, resizeNeeded, redrawReady;
ButWinArea *redraws;
int numRedraws, maxRedraws;
int id;
bool mapped;
ButWinFunc *unmap, *map, *resize, *destroy, *quit;
ButEnv *env;
int minLayer, maxLayer;
struct ButSet_struct butsNoDraw;
But *lock, *butIn;
But *keyBut;
int numCols, maxCols;
struct ButCol_struct *cols;
MAGIC_STRUCT
};
typedef struct ButWrite_struct {
double width;
void *packet;
void (*draw)(void *packet, ButWin *win, int x, int y, int w, int h);
} ButWrite;
#define BUTWRITE_MINPRINT '\t'
#define BUTWRITE_MAXCHARS (BUTWRITE_MINPRINT*256-256)
typedef struct ButFdCallback_struct {
ButOut (*callback)(void *packet, int fd);
void *packet;
} ButFdCallback;
struct ButEnv_struct {
char *protocol;
void *packet;
Display *dpy;
int (*shutdown)(Display *dpy);
GC gc, gc2;
Pixmap stipDisable;
bool colorp; /* TRUE if color, FALSE if b/w. */
int numColors;
ulong *colors;
Pixmap greyMaps[17];
Pixmap *colorPmaps;
int numFonts;
XFontStruct **fonts;
int font0h, depth, rootW, rootH;
int stdButBw;
Atom prop;
bool (*sReq)(ButEnv *env, XSelectionRequestEvent *xsre);
int (*sClear)(ButEnv *env);
int (*sNotify)(ButEnv *env, XSelectionEvent *xsnot);
struct ButWin_struct **winlist;
int minWindows, wllen, wlmax;
But *butIn, *lockBut;
struct ButWin_struct *last_mwin;
int last_mx, last_my;
ButEnv *next;
struct ButWrite_struct write[BUTWRITE_MAXCHARS];
uint keyModifiers;
Time eventTime; /* But & kbd PRESS or RELEASE or MOVE events. */
int eventNum; /* But & kbd PRESS events ONLY. */
int maxFd, maxGFds[3];
fd_set fMasks[3];
ButFdCallback *fCallbacks[3];
/* These are set up in the rc (remote cusor) file. */
int cur_mnum, new_mnum;
Cursor cursors[BUTCUR_NUM];
Pixmap cpic[BUTCUR_NUM], cmask[BUTCUR_NUM], *cstore;
struct ButRnet_struct **partners;
int partner, numPartners;
int maxButIds, maxWinIds;
But **id2But;
struct ButWin_struct **id2Win;
ButCur curnum, curlast;
Window curwin;
But *curhold;
MAGIC_STRUCT
};
typedef struct ButKey_struct {
KeySym key;
uint modifiers;
uint modMask;
} ButKey;
struct But_struct {
void *uPacket; /* Packet of user information. */
void *iPacket; /* Packet unique to this button type. */
struct ButWin_struct *win;
int layer;
int x, y, w, h, id;
unsigned flags;
const ButKey *keys; /* A list of keys that map to this button. */
const ButAction *action;
void (*destroyCallback)(struct But_struct *but);
MAGIC_STRUCT
};
typedef struct ButRow_struct {
int startY, numButs, maxButs;
But **buts;
MAGIC_STRUCT
} ButRow;
typedef struct ButCol_struct {
int startX;
int numRows, maxRows;
struct ButRow_struct *rows;
MAGIC_STRUCT
} ButCol;
#define butEnv_setXFg(env, colornum) \
do { \
if (env->colorp) \
XSetForeground(env->dpy, env->gc, env->colors[colornum]); \
else \
XSetTile(env->dpy, env->gc, env->colorPmaps[colornum]); \
} while (0)
#define butEnv_stdFill(env) \
do { \
if (env->colorp) \
XSetFillStyle(env->dpy, env->gc, FillSolid); \
else \
XSetFillStyle(env->dpy, env->gc, FillTiled); \
} while (0)
#define butEnv_setXFg2(env, colornum) \
do { \
if (env->colorp) \
XSetForeground(env->dpy, env->gc2, env->colors[colornum]); \
else \
XSetTile(env->dpy, env->gc2, env->colorPmaps[colornum]); \
} while (0)
#define butEnv_stdFill2(env) \
do { \
if (env->colorp) \
XSetFillStyle(env->dpy, env->gc2, FillSolid); \
else \
XSetFillStyle(env->dpy, env->gc2, FillTiled); \
} while (0)
extern Atom but_myProp, but_wmDeleteWindow, but_wmProtocols;
extern struct ButTimer_struct *but_timerList;
extern bool but_inEvent;
extern void butWin_turnOnTimers(ButWin *win);
extern void butWin_turnOffTimers(ButWin *win);
extern ButOut butWin_delete(ButWin *win);
extern ButOut but_dList(But *but);
extern ButOut butWin_dList(ButWin *win);
/* From "write.c" */
extern void butWin_write(ButWin *win, int x, int y, const char *text,
int font);
/* Functions available to the buttons. */
extern void butEnv_deinit(ButEnv *env);
extern But *but_create(ButWin *win, void *iPacket,
const ButAction *action);
extern void but_init(But *but);
extern ButOut but_delete(But *but);
#define but_getFlags(b) ((b)->flags)
extern void but_newFlags(But *but, uint newflags);
extern void but_flags(But *but, uint newflags); /* Private. */
extern void but_draw(But *but);
extern void butWin_redraw(ButWin *win, int x, int y, int w, int h);
extern void butWin_performDraws(ButWin *win);
extern void but_resize(But *but, int x, int y, int w, int h);
extern ButOut butWin_mMove(ButWin *win, int x, int y);
extern ButOut butWin_mPress(ButWin *win, int x, int y, int butnum);
extern ButOut butWin_mRelease(ButWin *win, int x, int y, int butnum);
extern ButOut butWin_kPress(ButWin *win, const char *kstring, KeySym sym);
extern ButOut butWin_kRelease(ButWin *env, const char *kstring, KeySym sym);
/* Functions for internal use only. */
/* In but_finder.c */
void butSet_destroy(ButSet *butset);
extern ButWin *butEnv_findWin(ButEnv *env, Window win);
extern void butWin_addToTable(ButWin *win);
extern void butWin_rmFromTable(ButWin *win);
extern void but_addToTable(But *but);
extern void but_delFromTable(But *but);
extern void butWin_findButSet(ButWin *win, int x, int y, ButSet *butset);
extern void butWin_findButSetInRegion(ButWin *win, int x,int y,
int w,int h, ButSet *butset);
extern But *butWin_findButsInRegion(ButWin *win, int x,int y, int w,int h,
bool (*action)(But *but, void *packet),
void *packet);
void butSet_addBut(ButSet *butset, But *but);
void butSet_delBut(ButSet *butset, But *but);
/* From "ctext.c" */
extern Snd but_downSnd, but_upSnd;
/**********************************************************************
* Forward declarations
**********************************************************************/
/* These are all bits for the flags arguments to button functions. */
#define BUT_DRAWABLE 0x0001 /* Can be drawn. */
#define BUT_PRESSABLE 0x0002 /* Can be pressed. */
#define BUT_TWITCHABLE 0x0004 /* Changes when mouse goes over it. */
#define BUT_KEYED 0x0008 /* Keys pressed land in this button. */
#define BUT_PRESSTHRU 0x0010
#define BUT_PRESSED 0x0020
#define BUT_TWITCHED 0x0040
#define BUT_KEYPRESSED 0x0080
#define BUT_KEYACTIVE 0x0100 /* Read only; set if recvs keypresses. */
#define BUT_TABLED 0x0200 /* Private. Don't touch. */
#define BUT_LOCKED 0x0400
#define BUT_OPAQUE 0x0800 /* Solidly fills rectangle. */
#define BUT_DEAD 0x1000 /* Marked for death! */
#define BUT_NETPRESS 0x2000
#define BUT_NETTWITCH 0x4000
#define BUT_NETKEY 0x8000
#define BUT_MAXBITS 16
#define BUT_NODRAW (BUT_DRAWABLE<packet)
#define butEnv_dpy(env) ((env)->dpy)
#define butEnv_gc(env) ((env)->gc)
#define butEnv_color(env, cnum) ((env)->colors[cnum])
#define butEnv_isColor(env) ((env)->colorp)
#define butEnv_pixmap(env, cnum) ((env)->colorPmaps[cnum])
#define butEnv_fontStr(env, fnum) ((env)->fonts[fnum])
#define butEnv_stdBw(env) ((env)->stdButBw)
#define butEnv_keyModifiers(env) ((env)->keyModifiers)
#define butWin_packet(win) ((win)->packet)
#define butWin_env(win) ((win)->env)
#define butWin_xwin(bwin) ((bwin)->win)
#define butWin_w(win) ((win)->logicalW)
#define butWin_h(win) ((win)->logicalH)
#define butWin_viewW(win) ((win)->w)
#define butWin_viewH(win) ((win)->h)
#define butWin_x(win) ((win)->x)
#define butWin_y(win) ((win)->y)
#define butWin_xoff(win) ((win)->xOff)
#define butWin_yoff(win) ((win)->yOff)
#define butWin_setPacket(win, p) ((win)->packet = (p))
#define butWin_setQuit(win, q) ((win)->quit = (q))
#define butWin_setDestroy(win, d) ((win)->destroy = (d))
#define but_win(but) ((but)->win)
#define but_packet(but) ((but)->uPacket)
#define but_setPacket(but, val) ((but)->uPacket = (val))
#define but_x(but) ((but)->x)
#define but_y(but) ((but)->y)
#define but_w(but) ((but)->w)
#define but_h(but) ((but)->h)
#define but_setDestroyCallback(but, v) ((but)->destroyCallback = (v))
/*
* but_events keeps servicing events until one returns BUT_OUT_STOPWAIT.
*/
extern void butEnv_events(ButEnv *env);
extern ButEnv *butEnv_create(const char *protocol, const char *dpyname,
int shutdown(Display *dpy));
extern ButEnv *butEnv_createNoDpy(const char *protocol);
/*
* but_env_init() returns:
* 0 - Black and white display or color=FALSE.
* 1 - Couldn't allocate standard colors. Failed.
* 2 - Color successful.
* 3 - Truecolor display. Color will always be successful.
*/
extern int butEnv_init(ButEnv *env, void *packet, const char *atomname,
bool color);
extern void butEnv_destroy(ButEnv *env);
extern bool butEnv_setFont(ButEnv *env, int fontnum, const char *fontname,
int fparam);
#define butEnv_fontH(env, fnum) \
((env)->fonts[fnum]->ascent + (env)->fonts[fnum]->descent)
/* drawall is typically used after changing fonts, etc. */
extern void butEnv_drawAll(ButEnv *env);
extern void butEnv_resizeAll(ButEnv *env);
extern void but_draw(But *but);
extern void but_destroy(But *but);
extern void but_resize(But *but, int x, int y, int w, int h);
#define butEnv_localContext(env) ((env)->localContext)
#define butEnv_context(env) ((env)->context)
extern void but_setId(But *but, int id);
extern void butWin_setId(ButWin *win, int id);
#define BUT_READFILE 0
#define BUT_WRITEFILE 1
#define BUT_XFILE 2
extern void butEnv_addFile(ButEnv *env, int group, int fd, void *packet,
ButOut (*callback)(void *packet, int fd));
extern void butEnv_rmFile(ButEnv *env, int group, int fd);
extern ButWin *butWin_iCreate(void *packet, ButEnv *env,
const char *name, int w, int h,
ButWin **iWin, bool iconic, int iW, int iH,
ButWinFunc *unmap,
ButWinFunc *map,
ButWinFunc *resize,
ButWinFunc *iResize,
ButWinFunc *destroy);
#define butWin_create(p,e,n,w,h,un,ma,re,de) \
butWin_iCreate(p,e,n,w,h,NULL,FALSE,0,0,un,ma,re,NULL,de)
extern void butWin_setGeom(ButWin *win, const char *geometry);
extern void butWin_setX(ButWin *win, int x);
extern void butWin_setY(ButWin *win, int y);
extern void butWin_setMinW(ButWin *win, int minW);
extern void butWin_setMinH(ButWin *win, int minH);
extern void butWin_setMaxW(ButWin *win, int maxW);
extern void butWin_setMaxH(ButWin *win, int maxH);
extern void butWin_setWHRatio(ButWin *win, int w, int h);
extern void butWin_setWHRatios(ButWin *win,
int minW, int minH, int maxW, int maxH);
extern void butWin_setWStep(ButWin *win, int wStep);
extern void butWin_setHStep(ButWin *win, int hStep);
#define butWin_getMinW(w) ((w)->minW)
#define butWin_getMinH(w) ((w)->minH)
#define butWin_getMaxW(w) ((w)->maxW)
#define butWin_getMaxH(w) ((w)->maxH)
#define butWin_getWStep(w) ((w)->wStep)
#define butWin_getHStep(w) ((w)->hStep)
extern void butWin_activate(ButWin *win);
extern void butWin_checkDims(ButWin *win); /* Private. */
extern void butWin_resize(ButWin *win, int newW, int newH);
extern void butWin_destroy(ButWin *xw);
/* grey is 0..16 */
extern ButColor butColor_create(int r, int g, int b, int grey);
/* The output color will have bw_greyscale same as c1's. */
extern ButColor butColor_mix(ButColor c1, int r1,
ButColor c2, int r2);
extern bool butEnv_setColor(ButEnv *env, int colornum, ButColor color);
XImage *butEnv_imageCreate(ButEnv *env, int w, int h);
void butEnv_imageDestroy(XImage *image);
/* From "i_general.c" */
extern void but_setFlags(But *but, uint fch);
extern void but_setKeys(But *but, const ButKey *keys);
/* From "but_write.c" */
extern void butEnv_setChar(ButEnv *env, double wratio, const char *id,
void (*draw)(void *packet, ButWin *win,
int x, int y, int w, int h),
void *packet);
extern int butEnv_textWidth(ButEnv *env, const char *text, int fnum);
extern int butEnv_charWidth(ButEnv *env, const char *text, int fnum);
/* From "but_textin.c" */
#define BUT_NOCHANGE (1 << (sizeof(int)*8-2))
#endif /* _BUT_BUT_H_ */
goban-1.1.orig/src/sgfIn.c 0000644 0001750 0001750 00000034664 10270056635 013174 0 ustar al al /*
* src/sgfInchain.c, part of Complete Goban (game program)
* Copyright (C) 1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include
#include
#include "cgoban.h"
#include "sgf.h"
#include "sgfIn.h"
#include "msg.h"
#include "goGame.h"
/**********************************************************************
* Constants
**********************************************************************/
#define POOLSIZE 100
/**********************************************************************
* Forward declarations
**********************************************************************/
static uint getToken(FILE *f, const char **arg, int *lineCount);
static const char *readFile(Sgf *mc, FILE *f, int *lineCount);
static const char *arg_getLoc(const char *arg, bool *err);
static int arg_getInt(const char *arg, bool *err);
static double arg_getDouble(const char *arg, bool *err);
static const char *arg_getStr(const char *arg, Str *result);
static void arg_multi(const char *arg, Sgf *mc, SgfType type,
GoStone gval, bool *err);
static void arg_multiLabel(const char *arg, Sgf *mc, bool *errOut);
/**********************************************************************
* Functions
**********************************************************************/
#define TOKEN1(c) ((int)c & 0xff)
#define TOKEN2(c1, c2) (((int)c1 & 0xff) | (((int)c2 << 8) & 0xff00))
Sgf *sgf_createFile(Cgoban *cg, const char *fName, const char **err,
bool *noFile) {
static Str strErr;
static bool firstTime = TRUE;
Sgf *mc;
SgfElem *me;
FILE *f;
int c, crCount = 1;
const char *problem;
bool dummy;
if (noFile == NULL)
noFile = &dummy;
*noFile = FALSE;
if (firstTime) {
str_init(&strErr);
firstTime = FALSE;
}
mc = sgf_create();
assert(MAGIC(mc));
mc->mode = sgfInsert_variant;
f = fopen(fName, "r");
if (f == NULL) {
if (err) {
if (errno == ENOENT)
*noFile = TRUE;
str_print(&strErr, msg_mcReadErr, strerror(errno), fName);
*err = str_chars(&strErr);
}
sgf_destroy(mc);
return(NULL);
}
/*
* Start reading after the "(;" bit that marks the first node.
*/
do {
do {
c = getc(f);
if (c == '\n')
++crCount;
} while((c != '(') && (c != EOF));
do {
c = getc(f);
if (c == '\n')
++crCount;
} while(isspace(c));
} while ((c != EOF) && (c != ';'));
problem = readFile(mc, f, &crCount);
if (problem) {
if (err) {
str_print(&strErr, msg_badSGFFile, fName, problem, crCount);
*err = str_chars(&strErr);
}
fclose(f);
sgf_destroy(mc);
return(NULL);
}
fclose(f);
mc->mode = sgfInsert_main;
for (me = &mc->top; me; me = me->activeChild) {
mc->active = me;
}
return(mc);
}
/*
* Returns FALSE if there was an error.
*/
static const char *readFile(Sgf *mc, FILE *f, int *crCount) {
uint token;
const char *arg;
SgfElem *me;
int i;
bool err = FALSE;
const char *problem;
static Str strOut;
static bool firstTime = TRUE;
float komi;
if (firstTime) {
str_init(&strOut);
firstTime = FALSE;
}
for (;;) {
token = getToken(f, &arg, crCount);
switch(token) {
case(0):
return(msg_sgfBadToken);
break;
case(TOKEN1(')')):
return(NULL);
break;
case(TOKEN1(';')):
sgf_addNode(mc);
break;
case(TOKEN1('(')):
me = mc->active;
problem = readFile(mc, f, crCount);
if (problem)
return(problem);
else {
mc->active = me;
me->activeChild = me->childH;
}
break;
case(TOKEN2('S','Z')):
i = arg_getInt(arg, &err);
if ((err) || (i < 2) || (i > GOBOARD_MAXSIZE))
return(msg_sgfBadArg);
sgf_setSize(mc, i);
break;
case(TOKEN2('R','U')):
arg_getStr(arg, &strOut);
for (i = 0; i < (int)goRules_num; ++i) {
if (!strcmp(str_chars(&strOut), msg_ruleNames[i])) {
break;
}
}
if (i == goRules_num) {
sgf_setRules(mc, goRules_japanese);
} else {
sgf_setRules(mc, (GoRules)i);
}
break;
case(TOKEN2('H','A')):
i = arg_getInt(arg, &err);
if (err) {
return(msg_sgfBadArg);
}
sgf_setHandicap(mc, i);
break;
case(TOKEN2('K','M')):
arg_getStr(arg, &strOut);
if (str_len(&strOut) == 0) {
sgf_setKomi(mc, 0.0);
} else {
komi = wms_atof(str_chars(&strOut), &err);
if (err) {
if ((str_chars(&strOut)[0] == '-') ||
isdigit(str_chars(&strOut)[0])) {
komi = atoi(str_chars(&strOut));
if (komi >= 0.0)
komi += 0.5;
else
komi -= 0.5;
} else {
return(msg_sgfBadArg);
}
}
sgf_setKomi(mc, komi);
}
break;
case(TOKEN2('T','M')):
sgf_setTimeFormat(mc, arg_getStr(arg, &strOut));
break;
case(TOKEN2('C','P')):
sgf_copyright(mc, arg_getStr(arg, &strOut));
break;
case(TOKEN2('P','W')):
sgf_setPlayerName(mc, goStone_white, arg_getStr(arg, &strOut));
break;
case(TOKEN2('P','B')):
sgf_setPlayerName(mc, goStone_black, arg_getStr(arg, &strOut));
break;
case(TOKEN2('D','T')):
sgf_addSElem(mc, sgfType_date, arg_getStr(arg, &strOut));
break;
case(TOKEN2('G','N')):
arg_getStr(arg, &strOut);
if (str_len(&strOut) > 0)
sgf_addSElem(mc, sgfType_title, str_chars(&strOut));
break;
case(TOKEN2('W','R')):
sgf_playerRank(mc, goStone_white, arg_getStr(arg, &strOut));
break;
case(TOKEN2('B','R')):
sgf_playerRank(mc, goStone_black, arg_getStr(arg, &strOut));
break;
case(TOKEN2('E','V')):
sgf_event(mc, arg_getStr(arg, &strOut));
break;
case(TOKEN2('S','O')):
sgf_source(mc, arg_getStr(arg, &strOut));
break;
case(TOKEN2('G','C')):
sgf_gameComment(mc, arg_getStr(arg, &strOut));
break;
case(TOKEN2('P','L')):
arg_getStr(arg, &strOut);
if (str_len(&strOut) != 1) {
return(msg_sgfBadArg);
}
switch(str_chars(&strOut)[0]) {
case 'B':
case 'b':
case '1':
sgf_setWhoseMove(mc, goStone_black);
break;
case 'W':
case 'w':
case '2':
sgf_setWhoseMove(mc, goStone_white);
break;
default:
return(msg_sgfBadArg);
}
break;
case(TOKEN1('W')):
arg = arg_getLoc(arg, &err);
if (err)
return(msg_sgfBadLoc);
if (arg)
sgf_move(mc, goStone_white, arg);
else
sgf_pass(mc, goStone_white);
break;
case(TOKEN1('B')):
arg = arg_getLoc(arg, &err);
if (err)
return(msg_sgfBadLoc);
if (arg)
sgf_move(mc, goStone_black, arg);
else
sgf_pass(mc, goStone_black);
break;
case(TOKEN2('W','L')):
i = (int)arg_getDouble(arg, &err);
if (err) {
return(msg_sgfBadArg);
}
sgf_timeLeft(mc, goStone_white, i);
break;
case(TOKEN2('B','L')):
i = (int)arg_getDouble(arg, &err);
if (err) {
return(msg_sgfBadArg);
}
sgf_timeLeft(mc, goStone_black, i);
break;
case(TOKEN2('O','W')):
i = arg_getInt(arg, &err);
if (err) {
return(msg_sgfBadArg);
}
sgf_stonesLeft(mc, goStone_white, i);
break;
case(TOKEN2('O','B')):
i = arg_getInt(arg, &err);
if (err) {
return(msg_sgfBadArg);
}
sgf_stonesLeft(mc, goStone_black, i);
break;
case(TOKEN2('A','E')):
arg_multi(arg, mc, sgfType_setBoard, goStone_empty, &err);
if (err)
return(msg_sgfBadLoc);
break;
case(TOKEN2('A','W')):
arg_multi(arg, mc, sgfType_setBoard, goStone_white, &err);
if (err)
return(msg_sgfBadLoc);
break;
case(TOKEN2('A','B')):
arg_multi(arg, mc, sgfType_setBoard, goStone_black, &err);
if (err) {
return(msg_sgfBadLoc);
}
break;
case(TOKEN2('T','W')):
arg_multi(arg, mc, sgfType_territory, goStone_white, &err);
if (err)
return(msg_sgfBadLoc);
break;
case(TOKEN2('T','B')):
arg_multi(arg, mc, sgfType_territory, goStone_black, &err);
if (err)
return(msg_sgfBadLoc);
break;
case(TOKEN2('T','R')):
arg_multi(arg, mc, sgfType_triangle, goStone_empty, &err);
if (err)
return(msg_sgfBadLoc);
break;
case(TOKEN2('C','R')):
arg_multi(arg, mc, sgfType_circle, goStone_empty, &err);
if (err)
return(msg_sgfBadLoc);
break;
case(TOKEN2('M','A')): /* I draw "MA" (mark) as a square. */
case(TOKEN1('M')): /* Some games have marks as "M[..]". */
arg_multi(arg, mc, sgfType_square, goStone_empty, &err);
if (err)
return(msg_sgfBadLoc);
break;
case(TOKEN2('L','B')):
arg_multiLabel(arg, mc, &err);
if (err)
return(msg_sgfBadLoc);
break;
case(TOKEN1('L')):
/* Obsolete version of the LB token. */
me = mc->active;
arg_multi(arg, mc, sgfType_label, goStone_empty, &err);
if (err)
return(msg_sgfBadLoc);
i = 'A';
while (me != mc->active) {
me = me->activeChild;
me->sVal = str_createChar(i++);
}
break;
case(TOKEN1('C')):
sgf_comment(mc, arg_getStr(arg, &strOut));
break;
case(TOKEN2('R','E')):
sgf_result(mc, arg_getStr(arg, &strOut));
break;
case(TOKEN2('G','M')):
/*
* if (arg_getInt(arg, &err) != 1)
* return(msg_sgfBadArg);
*/
break;
case(TOKEN2('F','F')):
break;
case(TOKEN2('P','C')):
sgf_place(mc, arg_getStr(arg, &strOut));
break;
case(TOKEN2('S','Y')):
sgf_style(mc, arg_getStr(arg, &strOut));
break;
default:
sgf_unknown(mc, arg);
break;
}
}
}
static const char *arg_getLoc(const char *arg, bool *err) {
static char result[5] = "abcd";
while ((*arg != '[') && *arg)
++arg;
if (!(*arg)) {
*err = TRUE;
return(NULL);
}
++arg;
if ((*arg == ']') ||
((arg[0] == 't') && (arg[1] == 't') && (arg[2] == ']')))
return(NULL);
if (!islower(arg[0]) || !islower(arg[1])) {
*err = TRUE;
return(NULL);
}
if ((arg[2] == ']') || (arg[2] == ':')) {
result[0] = result[2] = 'a';
result[1] = arg[0];
result[3] = arg[1];
result[4] = '\0';
return(result);
}
if (islower(arg[2]) && islower(arg[3]) &&
((arg[4] == ']') || (arg[4] == ':'))) {
result[0] = arg[0];
result[1] = arg[1];
result[2] = arg[2];
result[3] = arg[3];
result[4] = '\0';
return(result);
} else {
*err = TRUE;
return(NULL);
}
}
static void arg_multi(const char *arg, Sgf *mc, SgfType type,
GoStone gval, bool *errOut) {
bool err = FALSE;
const char *loc;
for (;;) {
while ((*arg != '[') && (*arg != '\0'))
++arg;
if (*arg == '\0')
return;
loc = arg_getLoc(arg, &err);
if (err) {
*errOut = TRUE;
return;
}
if (loc != NULL)
sgf_addCLElem(mc, type, gval, loc);
++arg;
}
}
static void arg_multiLabel(const char *arg, Sgf *mc, bool *errOut) {
bool err = FALSE;
const char *loc;
for (;;) {
while ((*arg != '[') && (*arg != '\0'))
++arg;
if (*arg == '\0')
return;
loc = arg_getLoc(arg, &err);
if (err) {
*errOut = TRUE;
return;
}
while ((*arg != ':') && (*arg != '\0'))
++arg;
if (*arg == '\0') {
*errOut = TRUE;
return;
}
sgf_label(mc, loc, "");
++arg;
while ((*arg != ']') && (*arg != '\0')) {
str_catChar(mc->active->sVal, *arg);
++arg;
}
if (*arg == '\0') {
*errOut = TRUE;
return;
}
}
}
static int arg_getInt(const char *arg, bool *err) {
int len;
char tmp[11];
while (*arg != '[')
++arg;
if (arg[1] == ']') {
/*
* Is this an error? I think so.
* But apparently some lame ass SGF editor uses [] as zero at times,
* so I gotta accept it.
*/
return(0);
}
++arg;
for (len = 0; arg[len] != ']'; ++len) {
tmp[len] = arg[len];
if (len + 1 >= sizeof(tmp)) {
*err = TRUE;
return(0);
}
}
tmp[len] = '\0';
return(wms_atoi(tmp, err));
}
static double arg_getDouble(const char *arg, bool *err) {
int len;
char tmp[20];
while (*arg != '[')
++arg;
++arg;
for (len = 0; arg[len] != ']'; ++len) {
tmp[len] = arg[len];
if (len + 1 >= sizeof(tmp)) {
*err = TRUE;
return(0);
}
}
tmp[len] = '\0';
return(wms_atof(tmp, err));
}
static const char *arg_getStr(const char *arg, Str *result) {
str_clip(result, 0);
while (*arg != '[')
++arg;
++arg;
while (*arg != ']') {
assert(*arg);
if (*arg == '\\')
++arg;
str_catChar(result, *arg);
++arg;
}
return(str_chars(result));
}
static uint getToken(FILE *f, const char **arg, int *lineCount) {
static bool firstTime = TRUE;
static Str buf;
int c;
enum { state_token, state_arg, state_nextArg } state;
bool escaping = FALSE, escaped;
uint token = 0;
int shift = 0;
int countAdd = 0;
int lastCloseBracket = 0;
if (firstTime) {
str_init(&buf);
firstTime = FALSE;
}
state = state_token;
str_copyChars(&buf, "");
for (;;) {
c = getc(f);
if (c == '\n')
++countAdd;
if (c == EOF) {
*arg = str_chars(&buf);
if (state == state_nextArg) {
*lineCount += countAdd;
return(token);
} else
return(0);
}
if (!escaping) {
escaped = FALSE;
if (c == '\\')
escaping = TRUE;
} else {
escaped = TRUE;
escaping = FALSE;
}
if ((state == state_token) && !escaped && !token &&
((c == ';') || (c == '(') || (c == ')'))) {
str_catChar(&buf, c);
token = c;
*arg = str_chars(&buf);
*lineCount += countAdd;
return(token);
} else if ((state == state_token) && !islower(c) && !isspace(c) &&
(c != '[')) {
str_catChar(&buf, c);
token |= ((int)c & 0xff) << shift;
shift += 8;
if (shift > 16)
return(0);
} else if (((state == state_token) || (state == state_nextArg)) &&
!escaped && (c == '[')) {
*lineCount += countAdd;
countAdd = 0;
str_catChar(&buf, c);
state = state_arg;
} else if ((state == state_arg) && !escaped && (c == ']')) {
str_catChar(&buf, c);
lastCloseBracket = str_len(&buf);
state = state_nextArg;
} else if ((state == state_nextArg) && !isspace(c) && (c != '[')) {
ungetc(c, f);
*arg = str_chars(&buf);
*lineCount += countAdd;
assert(lastCloseBracket > 0);
str_clip(&buf, lastCloseBracket);
return(token);
} else {
str_catChar(&buf, c);
}
}
}
goban-1.1.orig/src/Makefile.am 0000644 0001750 0001750 00000001613 10271254777 014012 0 ustar al al AUTOMAKE_OPTIONS = foreign no-dependencies
AM_CFLAGS = -DPACKAGE_DATA_DIR=\"$(pkgdatadir)\"
bin_PROGRAMS = goban
goban_SOURCES = abut.c abut_help.c abut_msg.c arena.c board.c box.c but.c canvas.c cgbuts.c cgoban.c checkbox.c client.c client_main.c client_setup.c clp.c clp-x.c cm2pm.c conn.c control.c crwin.c ctext.c data.c drawStone.c editBoard.c editInfo.c editTool.c engine.c fsel.c game.c gameSetup.c goban.c goBoard.c goGame.c goHash.c goPic.c goScore.c goTime.c help.c i_finder.c i_general.c i_snd.c i_win.c list.c local.c login.c look.c lsetup.c main.c match.c menu.c menu_snd.c msg.c net.c plain.c plasma.c play.c player.c radio.c rcur.c rnd.c screensaver.c server.c setup.c sgf.c sgfIn.c sgfMap.c sgfOut.c sgfPlay.c slide.c snd.c str.c swin.c tbin.c tblock.c term.c text.c textin.c timer.c wms.c write.c
goban_CFLAGS = @X_CFLAGS@ $(AM_CFLAGS)
goban_LDADD = @X_LIBS@ -lX11 @X_EXTRA_LIBS@ -lm
goban-1.1.orig/src/msg.h 0000644 0001750 0001750 00000015752 10267777403 012727 0 ustar al al /*
* src/msg.h, part of Complete Goban (game program)
* Copyright (C) 1995-1996 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _MSG_H_
#define _MSG_H_ 1
/**********************************************************************
* Global variables
**********************************************************************/
extern const char msg_mFonts[], msg_labelFonts[], msg_bFonts[];
/* From "crwin.c" */
extern const char msg_byBillShubert[];
extern const char msg_noWarranty[];
extern const char msg_seeHelp[];
/* From "cgoban.c" */
extern const char msg_path[], msg_file[], msg_mask[];
extern const char msg_dirs[], msg_files[];
extern const char msg_dirErr[];
extern const char msg_notEnoughColors[];
/* From "control.c" */
extern const char msg_newGame[], msg_loadGame[];
extern const char msg_editSGF[], msg_goModem[];
extern const char msg_quit[], msg_setup[];
extern const char msg_loadGameName[], msg_editGameName[];
/* From "local.c" */
extern const char msg_gSetup[];
extern const char msg_wName[], msg_bName[];
extern const char msg_ruleSet[], *msg_ruleNames[];
extern const char msg_boardSize[];
extern const char msg_handicap[];
extern const char msg_komi[];
extern const char msg_ok[];
extern const char msg_cancel[];
extern const char msg_timeSystem[], *msg_timeSystems[];
extern const char msg_primaryTime[], msg_byoYomi[];
extern const char msg_byoYomiCount[], msg_byoYomiStones[];
extern const char msg_badSize[], msg_badHcap[], msg_badKomi[];
extern const char msg_localTitle[], msg_noTitle[];
extern const char msg_badTime[], msg_badBYStones[], msg_badBYCount[];
/*
* From "local.c"
*/
extern const char msg_notCgobanFile[];
extern const char msg_gameInfo[], msg_help[];
extern const char msg_pass[], msg_done[], msg_resume[], msg_dispute[];
extern const char msg_saveGame[], msg_editGame[];
extern const char msg_score[], msg_time[];
extern const char msg_localChiRemDead[], msg_localJapRemDead[];
extern const char msg_selectDisputed[], msg_selectDisputedMsg[];
extern const char *msg_stoneNames[];
extern const char msg_gameStartDesc[], msg_toPlay[];
extern const char msg_move1Desc[], msg_move1OfDesc[];
extern const char msg_moveNDesc[], msg_moveNOfDesc[];
extern const char msg_selectDead[];
extern const char msg_whiteWon[], msg_blackWon[], msg_jigo[];
extern const char msg_timeLossInfo[];
extern const char msg_disputeAnnounce[], msg_alive[], msg_dead[];
extern const char msg_disputeOverAlive[];
extern const char msg_disputeOverDead[];
extern const char msg_scoreKillsComment[], msg_scoreNoKillsComment[];
extern const char msg_ingPenaltyComment[];
extern const char msg_winnerComment[], msg_jigoComment[];
extern const char msg_gameIsOver[];
extern const char msg_timeLoss[];
extern const char msg_saveGameName[];
extern const char msg_reallyQuitGame[];
/* From "goban.c" */
extern const char msg_say[], msg_both[], msg_kib[];
/* From movechain.c */
extern const char msg_mcReadErr[];
extern const char msg_badSGFFile[];
extern const char msg_sgfBadToken[];
extern const char msg_sgfEarlyEOF[];
extern const char msg_sgfBadLoc[];
extern const char msg_sgfBadArg[];
/* From editBoard.c */
extern const char msg_printGame[], msg_noSuchGame[], msg_reallyQuit[];
extern const char msg_noCancel[], msg_yesQuit[];
extern const char msg_changeNodeWhileScoring[];
/* From editTool.c */
extern const char *msg_toolNames[];
extern const char *msg_toolDesc1[], *msg_toolDesc2[];
extern const char msg_killNode[], msg_moveNode[];
/* From "editInfo.c" */
extern const char msg_editInfoTitle[], msg_copyrightC[];
extern const char msg_gameTitle[], msg_result[];
extern const char msg_wStoneName[], msg_bStoneName[];
extern const char msg_wRank[], msg_bRank[];
extern const char msg_handicapC[], msg_komiC[];
extern const char msg_date[], msg_place[], msg_event[], msg_source[];
/* From gmp/setup.c */
extern const char msg_gmpSetup[];
extern const char *msg_gmpTypes[];
extern const char *msg_gmpPlayers[];
extern const char msg_program[];
extern const char msg_device[];
extern const char msg_machineName[];
extern const char msg_port[];
extern const char msg_username[];
extern const char msg_password[];
extern const char msg_badPortNum[];
extern const char msg_progRunErr[], msg_devOpenErr[];
extern const char msg_gmpTooBig[];
extern const char msg_waitingForGame[];
extern const char msg_noUndoFromGmpToClient[];
/* From gmp/play.c */
extern const char msg_gmpMoveOutsideGame[];
extern const char msg_gmpBadMove[];
extern const char msg_undoRequested[];
extern const char msg_badNewGameReq[];
extern const char msg_gmpCouldntStart[];
extern const char msg_gmpProgDied[], msg_gmpProgKilled[];
extern const char msg_gmpProgWhyDead[];
/* From gmp/engine.c */
extern const char msg_gmpDead[], msg_gmpTimeout[], msg_gmpSendBufFull[];
/* From client/setup.c */
extern const char *msg_loginDesc[];
extern const char msg_usernameColon[], msg_passwordColon[];
/* From client/login.c */
extern const char msg_cliOpenSocket[], msg_cliLookup[], msg_cliConnect[];
extern const char msg_cliHangup[], msg_login[];
extern const char msg_notAGuest[], msg_guest[], msg_loginFailed[];
/* From client/board.c */
extern const char msg_cliGameName[], msg_close[], msg_adjourn[];
extern const char msg_resign[], msg_yesResign[], msg_reallyResign[];
extern const char msg_cliGameBadMove[];
/* From client/conn.c */
extern const char msg_commandError[];
/* From client/look.c */
extern const char msg_cliLookName[];
extern const char msg_cliLookInfo[];
/* From client/main.c */
extern const char msg_players[], msg_games[];
/* From client/game.c */
extern const char msg_gameGoneResign[], msg_gameGoneAdjourn[];
extern const char msg_gameGoneTime[], msg_gameGoneScore[];
extern const char msg_gameResultResign[], msg_gameResultAdjourn[];
extern const char msg_gameResultTime[], msg_gameResultScore[];
extern const char msg_gameListDesc[];
extern const char msg_gameBadElf[];
/* From client/player.c */
extern const char msg_name[], msg_braceRank[], msg_state[];
extern const char msg_playerListDesc[];
/* From setup.c */
extern const char msg_setupTitle[];
extern const char msg_selServer[];
extern const char msg_gsCompName[];
extern const char msg_gsPortNum[];
extern const char msg_clientBadPortNum[];
extern const char msg_srvConfig[];
extern const char msg_directConn[];
extern const char msg_connCmdLabel[];
extern const char msg_miscellaneous[];
extern const char msg_showCoordinates[], msg_numberKibitzes[];
extern const char msg_hiContrast[];
extern const char msg_noTypo[];
extern const char msg_setupSrvName[];
extern const char msg_setupProtocol[];
/* From client/match.c */
extern const char msg_swapColors[];
extern const char msg_cliGameSetup[];
extern const char msg_cliGameSetupSent[];
extern const char msg_cliGameSetupRej[];
extern const char msg_cliGameSetupRecvd[];
extern const char msg_freeGame[];
extern const char msg_youDontExist[];
/* From "sgfPlay.c" */
extern const char msg_badMoveInSgf[];
#endif /* _MSG_H_ */
goban-1.1.orig/src/vroot.h 0000644 0001750 0001750 00000012170 06756155141 013276 0 ustar al al /*****************************************************************************/
/** Copyright 1991 by Andreas Stolcke **/
/** Copyright 1990 by Solbourne Computer Inc. **/
/** Longmont, Colorado **/
/** **/
/** All Rights Reserved **/
/** **/
/** Permission to use, copy, modify, and distribute this software and **/
/** its documentation for any purpose and without fee is hereby **/
/** granted, provided that the above copyright notice appear in all **/
/** copies and that both that copyright notice and this permis- **/
/** sion notice appear in supporting documentation, and that the **/
/** name of Solbourne not be used in advertising **/
/** in publicity pertaining to distribution of the software without **/
/** specific, written prior permission. **/
/** **/
/** ANDREAS STOLCKE AND SOLBOURNE COMPUTER INC. DISCLAIMS ALL WARRANTIES **/
/** WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF **/
/** MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ANDREAS STOLCKE **/
/** OR SOLBOURNE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL **/
/** DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/
/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/
/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/
/** OR PERFORMANCE OF THIS SOFTWARE. **/
/*****************************************************************************/
/*
* vroot.h -- Virtual Root Window handling header file
*
* This header file redefines the X11 macros RootWindow and DefaultRootWindow,
* making them look for a virtual root window as provided by certain `virtual'
* window managers like swm and tvtwm. If none is found, the ordinary root
* window is returned, thus retaining backward compatibility with standard
* window managers.
* The function implementing the virtual root lookup remembers the result of
* its last invocation to avoid overhead in the case of repeated calls
* on the same display and screen arguments.
* The lookup code itself is taken from Tom LaStrange's ssetroot program.
*
* Most simple root window changing X programs can be converted to using
* virtual roots by just including
*
* #include
*
* after all the X11 header files. It has been tested on such popular
* X clients as xphoon, xfroot, xloadimage, and xaqua.
* It also works with the core clients xprop, xwininfo, xwd, and editres
* (and is necessary to get those clients working under tvtwm).
* It does NOT work with xsetroot; get the xsetroot replacement included in
* the tvtwm distribution instead.
*
* Andreas Stolcke , 9/7/90
* - replaced all NULL's with properly cast 0's, 5/6/91
* - free children list (suggested by Mark Martin ), 5/16/91
* - include X11/Xlib.h and support RootWindowOfScreen, too 9/17/91
*/
#ifndef _VROOT_H_
#define _VROOT_H_
#if !defined(lint) && !defined(SABER)
static const char vroot_rcsid[] = "#Id: vroot.h,v 1.4 1991/09/30 19:23:16 stolcke Exp stolcke #";
#endif
#include
#include
#include
static Window
#ifdef __STDC__ /* ANSIfication added by jwz, to avoid superfluous warnings. */
VirtualRootWindowOfScreen(Screen *screen)
#else /* !__STDC__ */
VirtualRootWindowOfScreen(screen) Screen *screen;
#endif /* !__STDC__ */
{
static Screen *save_screen = (Screen *)0;
static Window root = (Window)0;
if (screen != save_screen) {
Display *dpy = DisplayOfScreen(screen);
Atom __SWM_VROOT = None;
int i;
Window rootReturn, parentReturn, *children;
unsigned int numChildren;
root = RootWindowOfScreen(screen);
/* go look for a virtual root */
__SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
if (XQueryTree(dpy, root, &rootReturn, &parentReturn,
&children, &numChildren)) {
for (i = 0; i < numChildren; i++) {
Atom actual_type;
int actual_format;
unsigned long nitems, bytesafter;
Window *newRoot = (Window *)0;
if (XGetWindowProperty(dpy, children[i],
__SWM_VROOT, 0, 1, False, XA_WINDOW,
&actual_type, &actual_format,
&nitems, &bytesafter,
(unsigned char **) &newRoot) == Success
&& newRoot) {
root = *newRoot;
break;
}
}
if (children)
XFree((char *)children);
}
save_screen = screen;
}
return root;
}
#undef RootWindowOfScreen
#define RootWindowOfScreen(s) VirtualRootWindowOfScreen(s)
#undef RootWindow
#define RootWindow(dpy,screen) VirtualRootWindowOfScreen(ScreenOfDisplay(dpy,screen))
#undef DefaultRootWindow
#define DefaultRootWindow(dpy) VirtualRootWindowOfScreen(DefaultScreenOfDisplay(dpy))
#endif /* _VROOT_H_ */
goban-1.1.orig/src/swin.h 0000644 0001750 0001750 00000003311 06051507625 013076 0 ustar al al /*
* wmslib/src/abut/swin.h, part of wmslib (Library functions)
* Copyright (C) 1994-1995 William Shubert.
* See "configure.h.in" for more copyright information.
*
* Includes for auxiliary button code.
*/
#ifndef _ABUT_SWIN_H_
#define _ABUT_SWIN_H_ 1
#ifndef _WMS_H_
#include
#endif
#ifndef _BUT_BUT_H_
#include
#endif
/**********************************************************************
* Constants
**********************************************************************/
#define ABUT_UPPIC "\2\1"
#define ABUT_DOWNPIC "\2\2"
#define ABUT_LEFTPIC "\2\3"
#define ABUT_RIGHTPIC "\2\4"
/**********************************************************************
* Data types
**********************************************************************/
typedef struct AbutSwin_struct {
ButWin *win;
void *packet;
But *up, *down, *left, *right, *hSlide, *vSlide, *box;
float xCenter, yCenter;
uint flags;
ButTimer *timer;
int x, y, w, h, slideW, lineH; /* Backups for resizing. */
int canButW, canButH;
MAGIC_STRUCT
} AbutSwin;
#define ABUTSWIN_LSLIDE 0x1
#define ABUTSWIN_RSLIDE 0x2
#define ABUTSWIN_TSLIDE 0x4
#define ABUTSWIN_BSLIDE 0x8
/**********************************************************************
* Functions
**********************************************************************/
extern AbutSwin *abutSwin_create(void *packet, ButWin *parent,
int layer, uint flags,
ButWinFunc resize);
extern void abutSwin_resize(AbutSwin *swin, int x, int y, int w, int h,
int slidew, int lineh);
extern void abutSwin_destroy(AbutSwin *swin);
extern void abutSwin_vMove(AbutSwin *swin, int newLoc);
#endif /* _ABUT_SWIN_H_ */
goban-1.1.orig/src/help.c 0000644 0001750 0001750 00000253540 06427022272 013051 0 ustar al al /*
* src/help.c, part of Complete Goban (game program)
* Copyright (C) 1995-1996 William Shubert
* See "configure.h.in" for more copyright information.
*/
#include
#include "cgbuts.h"
#ifdef _HELP_H_
LEVELIZATION ERROR
#endif
#include "help.h"
/*
* Used by all help pages
*/
static const AbutHelpText aboutAuthor[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "About the author"},
{butText_just, 0, " Hello! My name is Bill Shubert. I learned go "
"when I was very young, but never had any opponents until late 1993, "
"when I learned of the Internet Go Server. I was thrilled by the "
"server, but was disappointed by the client programs available. I was "
"also disappointed by the quality of the smart go editing tools that "
"I could find. Instead of just whining, I decided to create my own "
"program to do these tasks! I called it \"Cgoban\", for Complete "
"Goban, because it does everything that a computerized goban should."},
{butText_just, 0, " You can always get the latest version of cgoban from "
"my web pages at the URL below. You can also find out more about me if "
"you wish."},
{butText_just, 0, " I run a mailing list for people who want cgoban "
"updates. I keep the traffic low; mostly only announcements when new "
"versions are available, along with a brief description of what is "
"new or fixed in the new version. If you want these announcements, "
"then send me email. Also feel free to get in touch with me if you "
" have any comments about this program. Bug reports are especially "
"welcome. As of the date at the top of this help page, you can contact "
"me in these ways:"},
{butText_left, 0, " Email: wms@hevanet.com"},
{butText_left, 0, " WWW: http://www.hevanet.com/wms/"},
{butText_left, 0, " Work email: wms@ssd.intel.com"},
{butText_left, 0, " Phone: (503)223-2285"},
{butText_just, 0, "Or send me a postcard at:"},
{butText_left, 0, " Bill Shubert"},
{butText_left, 0, " 1975 NW Everett St. #301"},
{butText_left, 0, " Portland, OR 97209"},
{butText_left, 0, " USA"},
{butText_just, 0, ""},
{butText_just, 0, " Thanks for trying out my program. I hope you like "
"it!"},
{butText_just, 0, " Special thanks to all cgoban testers, especially "
"to Dan Niles, Per-Eric Martin, Anthony Thyssen, Jan van der Steen, "
"Eric Hoffman, Allen Tollin, Mel Melchner, Saito Takaaki, and "
"Matt Ritchie, who were "
"willing to debug cgoban on their systems and/or hack on the code to help "
"track down bugs for me."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText copyright[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 0, " The globe pictures were extracted from gifs created "
"by xearth-1.0, which carries this copyright:"},
{butText_center, 0,
"Copyright (C) 1989, 1990, 1993, 1994, 1995 Kirk Lauritz Johnson"},
{butText_center, 0, "Parts of the source code (as marked) are:"},
{butText_center, 0, "Copyright (C) 1989, 1990, 1991 by Jim Frost"},
{butText_center, 0, "Copyright (C) 1992 by Jamie Zawinski "},
{butText_center, 0, "Permission to use, copy, modify and freely distribute "
"xearth for non-commercial and not-for-profit purposes is hereby granted "
"without fee, provided that both the above copyright notice and "
"this permission notice appear in all copies and in supporting "
"documentation."},
{butText_just, 0, ""},
{butText_just, 2, "Distribution"},
{butText_just, 0, " All code except for the data described above is "
"copyright \251 1995-1996 William Shubert and is distributed under the "
"Gnu General Public License, version 2. This should have been included "
"with your copy of the source code is a file called \"COPYING\". In any "
"case, the license is also included below."},
{butText_just, 0, " Basically, there are three things that most of you "
"will care about in this license. One is that you can give away free "
"copies to all your friends. Another is that you have to be told where "
"you can get the source code from. You can get it from me; see the "
"\"About the Author\" help page for how to get in touch. The last is "
"that there is no warranty, so if this software ruins your life don't "
"come crying to me."},
{butText_just, 0, " If you want to do anything else with this software, "
"you should read the license below for details."},
{butText_just, 0, ""},
{butText_center, 0, "GNU GENERAL PUBLIC LICENSE"},
{butText_center, 0, "TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND "
"MODIFICATION"},
{butText_just, 0, ""},
{butText_just, 0, " 0. This License applies to any program or other work "
"which contains a notice placed by the copyright holder saying it may be "
"distributed under the terms of this General Public License. The "
"\"Program\", below, refers to any such program or work, and a \"work "
"based on the Program\" means either the Program or any derivative work "
"under copyright law: that is to say, a work containing the Program or a "
"portion of it, either verbatim or with modifications and/or translated "
"into another language. (Hereinafter, translation is included without "
"limitation in the term \"modification\".) Each licensee is addressed "
"as \"you\"."},
{butText_just, 0, ""},
{butText_just, 0, "Activities other than copying, distribution and "
"modification are not covered by this License; they are outside its "
"scope. The act of running the Program is not restricted, and the "
"output from the Program is covered only if its contents constitute a "
"work based on the Program (independent of having been made by running "
"the Program). Whether that is true depends on what the Program does."},
{butText_just, 0, ""},
{butText_just, 0, " 1. You may copy and distribute verbatim copies of the "
"Program's source code as you receive it, in any medium, provided that "
"you conspicuously and appropriately publish on each copy an appropriate "
"copyright notice and disclaimer of warranty; keep intact all the "
"notices that refer to this License and to the absence of any warranty; "
"and give any other recipients of the Program a copy of this License "
"along with the Program."},
{butText_just, 0, ""},
{butText_just, 0, "You may charge a fee for the physical act of "
"transferring a copy, and you may at your option offer warranty "
"protection in exchange for a fee."},
{butText_just, 0, ""},
{butText_just, 0, " 2. You may modify your copy or copies of the Program "
"or any portion of it, thus forming a work based on the Program, and "
"copy and distribute such modifications or work under the terms of "
"Section 1 above, provided that you also meet all of these "
"conditions:"},
{butText_just, 0, ""},
{butText_just, 0, " a) You must cause the modified files to carry "
"prominent notices stating that you changed the files and the date of "
"any change."},
{butText_just, 0, ""},
{butText_just, 0, " b) You must cause any work that you distribute or "
"publish, that in whole or in part contains or is derived from the "
"Program or any part thereof, to be licensed as a whole at no charge to "
"all third parties under the terms of this License."},
{butText_just, 0, ""},
{butText_just, 0, " c) If the modified program normally reads commands "
"interactively when run, you must cause it, when started running for "
"such interactive use in the most ordinary way, to print or display an "
"announcement including an appropriate copyright notice and a notice "
"that there is no warranty (or else, saying that you provide a warranty) "
"and that users may redistribute the program under these conditions, and "
"telling the user how to view a copy of this License. (Exception: if "
"the Program itself is interactive but does not normally print such an "
"announcement, your work based on the Program is not required to print "
"an announcement.)"},
{butText_just, 0, ""},
{butText_just, 0, "These requirements apply to the modified work as a "
"whole. If identifiable sections of that work are not derived from the "
"Program, and can be reasonably considered independent and separate "
"works in themselves, then this License, and its terms, do not apply to "
"those sections when you distribute them as separate works. But when "
"you distribute the same sections as part of a whole which is a work "
"based on the Program, the distribution of the whole must be on the "
"terms of this License, whose permissions for other licensees extend to "
"the entire whole, and thus to each and every part regardless of who "
"wrote it."},
{butText_just, 0, ""},
{butText_just, 0, "Thus, it is not the intent of this section to claim "
"rights or contest your rights to work written entirely by you; rather, "
"the intent is to exercise the right to control the distribution of "
"derivative or collective works based on the Program."},
{butText_just, 0, ""},
{butText_just, 0, "In addition, mere aggregation of another work not based "
"on the Program with the Program (or with a work based on the Program) "
"on a volume of a storage or distribution medium does not bring the "
"other work under the scope of this License."},
{butText_just, 0, ""},
{butText_just, 0, " 3. You may copy and distribute the Program (or a work "
"based on it, under Section 2) in object code or executable form under "
"the terms of Sections 1 and 2 above provided that you also do one of "
"the following:"},
{butText_just, 0, ""},
{butText_just, 0, " a) Accompany it with the complete corresponding "
"machine-readable source code, which must be distributed under the terms "
"of Sections 1 and 2 above on a medium customarily used for software "
"interchange; or,"},
{butText_just, 0, ""},
{butText_just, 0, " b) Accompany it with a written offer, valid for at "
"least three years, to give any third party, for a charge no more than "
"your cost of physically performing source distribution, a complete "
"machine-readable copy of the corresponding source code, to be "
"distributed under the terms of Sections 1 and 2 above on a medium "
"customarily used for software interchange; or,"},
{butText_just, 0, ""},
{butText_just, 0, " c) Accompany it with the information you received "
"as to the offer to distribute corresponding source code. (This "
"alternative is allowed only for noncommercial distribution and only if "
"you received the program in object code or executable form with such an "
"offer, in accord with Subsection b above.)"},
{butText_just, 0, ""},
{butText_just, 0, "The source code for a work means the preferred form of "
"the work for making modifications to it. For an executable work, "
"complete source code means all the source code for all modules it "
"contains, plus any associated interface definition files, plus the "
"scripts used to control compilation and installation of the executable. "
" However, as a special exception, the source code distributed need not "
"include anything that is normally distributed (in either source or "
"binary form) with the major components (compiler, kernel, and so on) of "
"the operating system on which the executable runs, unless that "
"component itself accompanies the executable."},
{butText_just, 0, ""},
{butText_just, 0, "If distribution of executable or object code is made by "
"offering access to copy from a designated place, then offering "
"equivalent access to copy the source code from the same place counts as "
"distribution of the source code, even though third parties are not "
"compelled to copy the source along with the object code."},
{butText_just, 0, ""},
{butText_just, 0, " 4. You may not copy, modify, sublicense, or "
"distribute the Program except as expressly provided under this License. "
" Any attempt otherwise to copy, modify, sublicense or distribute the "
"Program is void, and will automatically terminate your rights under "
"this License. However, parties who have received copies, or rights, "
"from you under this License will not have their licenses terminated so "
"long as such parties remain in full compliance."},
{butText_just, 0, ""},
{butText_just, 0, " 5. You are not required to accept this License, since "
"you have not signed it. However, nothing else grants you permission to "
"modify or distribute the Program or its derivative works. These "
"actions are prohibited by law if you do not accept this License. "
"Therefore, by modifying or distributing the Program (or any work based "
"on the Program), you indicate your acceptance of this License to do so, "
"and all its terms and conditions for copying, distributing or modifying "
"the Program or works based on it."},
{butText_just, 0, ""},
{butText_just, 0, " 6. Each time you redistribute the Program (or any "
"work based on the Program), the recipient automatically receives a "
"license from the original licensor to copy, distribute or modify the "
"Program subject to these terms and conditions. You may not impose any "
"further restrictions on the recipients' exercise of the rights granted "
"herein. You are not responsible for enforcing compliance by third "
"parties to this License."},
{butText_just, 0, ""},
{butText_just, 0, " 7. If, as a consequence of a court judgment or "
"allegation of patent infringement or for any other reason (not limited "
"to patent issues), conditions are imposed on you (whether by court "
"order, agreement or otherwise) that contradict the conditions of this "
"License, they do not excuse you from the conditions of this License. "
"If you cannot distribute so as to satisfy simultaneously your "
"obligations under this License and any other pertinent obligations, "
"then as a consequence you may not distribute the Program at all. For "
"example, if a patent license would not permit royalty-free "
"redistribution of the Program by all those who receive copies directly "
"or indirectly through you, then the only way you could satisfy both it "
"and this License would be to refrain entirely from distribution of the "
"Program."},
{butText_just, 0, ""},
{butText_just, 0, "If any portion of this section is held invalid or "
"unenforceable under any particular circumstance, the balance of the "
"section is intended to apply and the section as a whole is intended to "
"apply in other circumstances."},
{butText_just, 0, ""},
{butText_just, 0, "It is not the purpose of this section to induce you to "
"infringe any patents or other property right claims or to contest "
"validity of any such claims; this section has the sole purpose of "
"protecting the integrity of the free software distribution system, "
"which is implemented by public license practices. Many people have "
"made generous contributions to the wide range of software distributed "
"through that system in reliance on consistent application of that "
"system; it is up to the author/donor to decide if he or she is willing "
"to distribute software through any other system and a licensee cannot "
"impose that choice."},
{butText_just, 0, ""},
{butText_just, 0, "This section is intended to make thoroughly clear what "
"is believed to be a consequence of the rest of this License."},
{butText_just, 0, ""},
{butText_just, 0, " 8. If the distribution and/or use of the Program is "
"restricted in certain countries either by patents or by copyrighted "
"interfaces, the original copyright holder who places the Program under "
"this License may add an explicit geographical distribution limitation "
"excluding those countries, so that distribution is permitted only in or "
"among countries not thus excluded. In such case, this License "
"incorporates the limitation as if written in the body of this License."},
{butText_just, 0, ""},
{butText_just, 0, " 9. The Free Software Foundation may publish revised "
"and/or new versions of the General Public License from time to time. "
"Such new versions will be similar in spirit to the present version, but "
"may differ in detail to address new problems or concerns."},
{butText_just, 0, ""},
{butText_just, 0, "Each version is given a distinguishing version number. "
"If the Program specifies a version number of this License which applies "
"to it and \"any later version\", you have the option of following the "
"terms and conditions either of that version or of any later version "
"published by the Free Software Foundation. If the Program does not "
"specify a version number of this License, you may choose any version "
"ever published by the Free Software Foundation."},
{butText_just, 0, ""},
{butText_just, 0, " 10. If you wish to incorporate parts of the Program "
"into other free programs whose distribution conditions are different, "
"write to the author to ask for permission. For software which is "
"copyrighted by the Free Software Foundation, write to the Free Software "
"Foundation; we sometimes make exceptions for this. Our decision will "
"be guided by the two goals of preserving the free status of all "
"derivatives of our free software and of promoting the sharing and reuse "
"of software generally."},
{butText_just, 0, ""},
{butText_center, 0, "NO WARRANTY"},
{butText_just, 0, ""},
{butText_just, 0, " 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, "
"THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY "
"APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT "
"HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT "
"WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT "
"LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A "
"PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE "
"OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU "
"ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION."},
{butText_just, 0, ""},
{butText_just, 0, " 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR "
"AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO "
"MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE "
"LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL "
"OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE "
"PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING "
"RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A "
"FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF "
"SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH "
"DAMAGES."},
{butText_just, 0, ""},
{butText_center, 0, "END OF TERMS AND CONDITIONS"},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
/*
* From control.c
*/
static const AbutHelpText ctrlHelp[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Control Panel"},
{butText_just, 0, " The control panel of cgoban is used to select one "
"of Cgoban's features. The text on this help page will only briefly "
"describe what feature each button activates. More detailed help "
"on each of these features is available once the feature has been "
"started."},
{butText_just, 0, ""},
{butText_just, 2, "Server Buttons"},
{butText_just, 0, " These two buttons are used to log in to the "
"internet go servers. Clicking on a button will connect to the server "
"named on that button. To access more than two servers, hold down shift "
"and click on a server button; this will change the server that the "
"button connects to."},
{butText_just, 0, ""},
{butText_just, 2, "\"New Game\" and \"Load Game\" Buttons"},
{butText_just, 0, " To start a new game of Go, click on the \"New Game\" "
"button. Here two players can play against each other on a single "
"go board."},
{butText_just, 0, " Pressing the \"Load Game\" button will let you "
"continue a previously saved game of go. You can only use \"Load Game\" "
"for games started with cgoban. If you want to load a smart go file "
"that was created with a different program, then use the \"Edit SGF "
"File\" button instead."},
{butText_just, 0, ""},
{butText_just, 2, "\"Edit SGF File\" Button"},
{butText_just, 0, " To edit a smart go file, use the \"Edit SGF File\" "
"button. Using this button, you can review an sgf file or edit it, "
"viewing and adding comments, annotations, and variations. The "
"\"Edit SGF File\" button can not be used to create a new SGF file. "
"To do that use the \"New Game\" button, then once the game has "
"started use the \"Edit Game\" button on the go board to switch to "
"SGF editing mode."},
{butText_just, 0, " To edit a file without going through the control "
"window, you may start cgoban by typing \"cgoban -edit \"."},
{butText_just, 0, ""},
{butText_just, 2, "\"Go Modem\" Button"},
{butText_just, 0, " The Go Modem protocol is a standard protocol for "
"playing go over a modem that was designed by Bruce Wilcox and others. "
"It has also become a standard format for playing computer go "
"tournaments. The \"Go Modem\" button can be used to connect cgoban to a "
"computer program or a device that talks the go modem protocol. The \"Go "
"Modem\" button can also be used to connect a go modem protocol program "
"to one of the internet go servers."},
{butText_just, 0, ""},
{butText_just, 2, "\"Help\", \"Setup\", and \"Quit\" Buttons"},
{butText_just, 0, " Pressing \"Help\" brings up this window. Most "
"Cgoban windows have help buttons. Pressing the help button on any "
"window brings up help for that window."},
{butText_just, 0, " The \"Setup\" button will open the cgoban setup "
"window. In this window you can configure cgoban, "
"changing the address of the go servers, turning on and off certain "
"features, etc."},
{butText_just, 0, " Pressing the \"Quit\" button will exit from Cgoban. "
"Be careful! If you press \"Quit\", then all games in progress will "
"end!"},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage ctrlPage[] = {
{"Control Window", ctrlHelp},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_control = {4, "Control Help Pages", ctrlPage};
/*
* From gameSetup.c
*/
static const AbutHelpText gameSetup[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Game Setup Window"},
{butText_just, 0, " This window allows you to set up a new game. At "
"the top you may enter the names of the players. You have a choice of "
"rule sets in the left pane of the window, and a choice of time controls "
"in the right pane."},
{butText_just, 0,
" The difference in rule sets and time controls is described in "
"other help pages. To see these pages, use the menu at the top of this "
"help window."},
{butText_just, 0,
" Besides selecting the rule set and the time system, players can "
"choose the handicap and the komi. \"Handicap\" is the number of "
"stones that Black is given at the start of the game. Depending on "
"the rule set, Black may be free to place these stones where they "
"choose or may be forced to play them in certain locations. A handicap "
"of zero will give Black no stones to begin the game."},
{butText_just, 0,
" The komi is the number of points that White is given at the "
"beginning of the game to make up for having to move second. Most "
"rule sets say that a komi of 5.5 with a handicap of zero lead to a fair "
"game (the extra half point prevents tie games). The Ing rules, "
"however, say that a komi of 8.0 is fair. Often, a game with no "
"handicap and a komi of zero is called a \"handicap 1\" game because "
"the Black player gets the advantage of moving first and no penalty."},
{butText_just, 0,
" When the game is configured the way you want, press the \"Ok\" "
"button to start the game, or press the \"Cancel\" button if you decide "
"not to start the game at all."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText ruleSets[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "Rule Sets"},
{butText_just, 0,
" Depending on where Go is played, the rules of the game can differ "
"sligtly. Cgoban allows you to pick the rule set that you are most "
"comfortable with. This help page is not a description of the rules of "
"go; it is only meant to outline the differences between the rule sets."},
{butText_just, 0,
" The biggest differences between the rule sets are typically the ko "
"rule used and the way that the game is scored."},
{butText_just, 0, ""},
{butText_just, 2, "Chinese Rules"},
{butText_just, 0,
" Chinese rules are played primarily on mainland China. Chinese "
"rules use the Superko rule. The superko rule states that it is illegal "
"to make a move which returns the board to an earlier position. A game "
"played under Chinese rules ends when both players pass; at that point "
"score is counted. The score of a player is the number of living stones "
"that player has on the board, plus the amount of territory surrounded, "
"plus one-half the number of dame points on the board. If there is a "
"dispute over which stones are dead at the end of the game, the players "
"can simply continue the game where they left off to resolve the "
"problem."},
{butText_just, 0,
" Chinese rules are considered by some people to be the most "
"mathematically elegant version of the rules of go."},
{butText_just, 0, ""},
{butText_just, 2, "Japanese Rules"},
{butText_just, 0,
" Japanese rules are played in Japan and also have strong followings "
"in many other countries. The Japanese ko rule states that it is "
"illegal to recreate the board position of exactly two moves ago. "
"There are certain board positions that can lead to cycles of more than "
"two moves; if a game ever falls into one of these positions, the "
"players repeat until they conclude that the game will never finish. "
"At this point the game is regarded as \"no result\" (not as a draw). "
"If this is a game in a tournament, it must be replayed."},
{butText_just, 0,
" The score in a Japanese game is the total of the number of enemy "
"stones captured and the amount of territory surrounded. Territory in "
"a seki is not counted towards either player's score. If there is "
"a dispute over which stones are dead at the end of the game, the "
"fate of the disputed stones is resolved locally. Cgoban handles this "
"by letting the players continue the game. When resolving the "
"dispute, ko stones can never be retaken until a player passes, and "
"after three passes the stones are considered dead only if all of them "
"have been removed from the board. At this point the board is returned "
"to the original end game position but with the disputed stones marked "
"as alive or dead."},
{butText_just, 0,
" Japanese rules state that suicide (making a move which kills your "
"own stones) is illegal. Under some rare circumstances such a move may "
"be useful, so most other rule sets allow it."},
{butText_just, 0,
" Under some situations cgoban will not recognize a seki unless the "
"dame are filled in. If there is a seki position on the board and "
"you see that cgoban is mis-scoring it, continue the game and fill in "
"the dame."},
{butText_just, 0,
" Some people find the Japanese rules to be the most natural "
"to play with. Most of Europe and North America plays with rule sets "
"based on the Japanese rules."},
{butText_just, 0, ""},
{butText_just, 2, "Ing Rules"},
{butText_just, 0,
" The Ing rules were invented by a wealthy Taiwanese Go player. They "
"are encouraged through the Ing Foundation, which sponsors Go "
"tournaments around the world. Unfortunately, the Ing Ko rule is very "
"difficult (some say impossible) to implement on a computer, so the "
"Ing rules of Cgoban are the same as Chinese rules except that the "
"standard Komi is 8 and tie games are awarded to Black."},
{butText_just, 0, ""},
{butText_just, 2, "AGA Rules"},
{butText_just, 0,
" The American Go Association has a set of rules designed to feel "
"like Japanese rules, but use the simpler end of game disputes of "
"Chinese rules. AGA rules use Superko like Chinese rules, but count "
"score as captures plus territory (although unlike Japanese rules, eyes "
"in a seki count for points under AGA rules). In addition, every time "
"that you pass under AGA rules you must give your opponent one capture. "
"This change makes it reasonable to resolve disputed stones by "
"continuing the game, as in Chinese rules."},
{butText_just, 0, ""},
{butText_just, 2, "New Zealand Rules"},
{butText_just, 0,
" In New Zealand the go organization has adopted the Chinese rules, "
"with the exception that handicap stones may be placed anywhere on the "
"board instead of at the preselected star points. In every other way "
"it is the same as Chinese rules."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText timeTypes[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "Time Formats"},
{butText_just, 0,
" Much like the rule sets, as Go has travelled around the world many "
"different ways of timing games have been used. Cgoban makes available "
"many of the more popular. To select a time control, first choose the "
"type of time control with the \"Time System\" menu, then fill in the "
"appropriate time values."},
{butText_just, 0, ""},
{butText_just, 2, "None"},
{butText_just, 0,
" If you select \"None\" as your time system, then the players may "
"take as long as they wish to make their moves."},
{butText_just, 0, ""},
{butText_just, 2, "Absolute Time"},
{butText_just, 0,
" With the \"Absolute\" time system, you simply set a main time for "
"the players. Each player must finish the game within the time "
"specified. If the player runs out of time, then the player loses."},
{butText_just, 0, ""},
{butText_just, 2, "Japanese Time"},
{butText_just, 0,
" In Japan one of the common tournament time systems involves a "
"main time and what are called \"byo-yomi\" periods. The easiest way "
"to explain this is with an example. If you play with 45 minutes main "
"time and five one-minute byo-yomi periods, then each player starts with "
"45 minutes on the clock. Play goes as with an absolute time limit, but "
"when a player's clock drops below the five minute mark the enter the "
"first byo-yomi period. As long as they finish before their clock drops "
"below the four minute mark, it will be reset to five minutes. From "
"then on, they can play as many moves as they want, but if they take "
"more than a minute on any move their clock moves to the second byo-yomi "
"period, which is from four to three minutes. If they ever use up their "
"last byo-yomi period, then they lose the game."},
{butText_just, 0,
" This scheme gives players lots of time to think until they have "
"used up their main time, then forces them to keep moving with only a "
"few opportunities to think for long after that."},
{butText_just, 0, ""},
{butText_just, 2, "Canadian Time"},
{butText_just, 0,
" The canadian time system is also used on the internet go servers. "
"It also has a main time period and what are called byo-yomi periods, "
"but the byo-yomi periods work differently. Again, an example will "
"be a good way to show how this works. If you have a 30 minute main "
"time period and byo-yomi periods of 25 moves in ten minutes, then each "
"player starts with 30 minutes on their clock. After that time is gone, "
"their clock is reset to ten minutes. They must make 25 moves in that "
"ten minutes or lose. If they make 25 moves, then no matter how much "
"time is left on their clock it is reset to ten minutes again and they "
"must make another 25 moves in that ten minutes. This can continue "
"indefinitely."},
{butText_just, 0, ""},
{butText_just, 2, "Ing Time"},
{butText_just, 0,
" Like the Ing rules, the Ing time controls are encouraged by the "
"Ing foundation. Under Ing rules, players are given main time and "
"extra time periods, but the players are penalized tw, points for "
"entering each extra time periods."},
{butText_just, 0,
" If players have 45 minutes and three 15 minute periods, a player who "
"used 55 minutes to make their moves will lose two points. A player who "
"used 80 minutes will lose six points, and a player who used only 40 "
"minutes will lose no points."},
{butText_just, 0, ""},
{butText_just, 0, NULL}};
static const AbutHelpPage gameSetupPage[] = {
{"Game Setup Window", gameSetup},
{"Rule Sets", ruleSets},
{"Time Controls", timeTypes},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_gameSetup = {6, "Game Setup Help Pages", gameSetupPage};
static const AbutHelpText editToolHelp[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "About Smart Go Files"},
{butText_just, 0,
" Smart go files can contain a game complete with many different "
"types of annotation. A game may contain marks on the board that "
"become visible as the game is viewed, it make contain comments about "
"the game as it progresses, and it may also contain variations."},
{butText_just, 0,
" The variations of a smart go file make it into what can be called a "
"move tree. The starting position (typically an empty board) is at the "
"start of the move tree. From each move in the game, you may progress "
"to the next move. When there is a variation, there may be several "
"different moves to go to. Typically one move will be the move actually "
"made during game play, and the other moves show what would have "
"happened if the players had made different choices."},
{butText_just, 0,
" As you are viewing a game, the \"active move list\" is the set of "
"moves that you will see if you step through the game. You may choose "
"which moves are active with the game map (see below). The active moves "
"are also the moves that will be affected by the cut and reorder "
"buttons."},
{butText_just, 0, ""},
{butText_just, 2, "The Edit Tool Window"},
{butText_just, 0,
" The edit tool window of cgoban is used to edit a smart go file. "
"It contains three parts; the tool selector, the cut/reorder buttons, "
"and the game map."},
{butText_just, 0, ""},
{butText_just, 2, "The Tool Selector"},
{butText_just, 0,
" The tool selector is the line of buttons on the top of the edit tool "
"window. Click on a button to make that the active tool. The effects "
"of the current tool are listed just below the tool selector. A "
"complete description of each tool is available through the menu at the "
"top of this help window."},
{butText_just, 0, ""},
{butText_just, 2, "The Delete Moves Button"},
{butText_just, 0,
" Pressing \"Delete Moves\" will remove all of the active moves below "
"your current move. Be careful! There is currently no way to undo if "
"you accidentally delete some moves"},
{butText_just, 0, ""},
{butText_just, 2, "The Reorder Moves Button"},
{butText_just, 0,
" Pressing \"Reorder Moves\" is useful when you have several "
"variations to your current move. Pressing this button will change "
"the order in which the variations appear."},
{butText_just, 0, ""},
{butText_just, 2, "The Game Map"},
{butText_just, 0,
" The game map shows the same game that is being viewed on the "
"board, but it shows the game as a list of moves instead of showing "
"the current board position. For a game with no variations, this list "
"will be a simple line of stones. For a game with many variations, "
"however, the game map can be invaluable in finding interesting "
"variations and keeping your place within the game."},
{butText_just, 0,
" The active move list is shown as a set of moves along a line. "
"variation that are not active (that is, variations that you will not "
"see by just stepping through the move list) are shown in grey. You "
"may skip to a new move by clicking on the mark that corresponds to "
"that move. If you click on a non-active move, then the active move "
"list will change to the move list that contains the move you clicked "
"on. The move that you see on the board is always shown with a box "
"around it."},
{butText_just, 0,
" On the game map, the starting board position is in the upper-left "
"of the map. Each game move is to the right of the previous move. "
"When there are several moves that are variations from a single board "
"position, these will be seen as a \"fork\" in the game with each "
"possible variation as a separate move chain."},
{butText_just, 0,
" Different types of moves are represented by different symbols "
"on the game map. Simple moves are shown as a black or white stone. "
"If there is some sort of comment or annotation to the move, a "
"triangle move is placed on the stone; otherwise the stone is labeled "
"with its move number."},
{butText_just, 0,
" Moves that are not strictly game moves, but instead modifications "
"to the board, are represented by groups of four stones on the map. "
"An empty spot on a move chain means that there is no move information "
"here."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText moveTool[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Move Tool"},
{butText_just, 0,
" The \"Move Tool\" is represented on the tool selector as a plain "
"stone. The color of the stone shows whose move it is. By clicking on "
"the stone you may set whose turn it is to move."},
{butText_just, 0,
" When you click on the board with the move tool, you will add moves "
"to the game that you are viewing. These moves will be added to the "
"game as variations off of the current move if there is already a move "
"off of the current move."},
{butText_just, 0,
" Holding down the shift key when you use the move tool will not add "
"stones to the board. Instead it will make the current move change to "
"the point when a specific move was made. For example, to see the "
"board when a move was made at location C16, hold down shift and click "
"on the board at location C16."},
{butText_just, 0,
" Clicking on the move tool when it is already active will change "
"whose move it is."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText editToolKey[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "Edit Tool Keyboard Shortcuts"},
{butText_just, 0,
" Shift-up changes the active move list to the previous variation."},
{butText_just, 0,
" Shift-down changes the active move list to the next variation."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText changeTool[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Change Board Tool"},
{butText_just, 0,
" The \"Change Board Tool\" is represented on the tool selector as a "
"group of four stones. This tool lets you rearrange a lot of stones "
"with a single move; it is useful for setting up board positions and "
"erasing groups of stones."},
{butText_just, 0,
" Clicking on the board with this tool will erase a stone where you "
"click, or add a stone if there isn't a stone there. The added stone "
"will be white. To add a black stone, hold down the shift key when you "
"click."},
{butText_just, 0,
" Pressing \"Pass\" when the change board tool is selected will make "
"all new board changes become part of a new board. This lets you create "
"a sequence of moves, each rearranging the board however you wish."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText scoreTool[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Score Tool"},
{butText_just, 0,
" The \"Score Tool\" is represented on the tool selector as a yin-yang "
"symbol. This tallies up the current score of the game and adds marks "
"to show who own what territory."},
{butText_just, 0,
" When you select this tool, all territory completely surrounded by "
"one player will be marked as that player's territory. Now clicking "
"on stones will mark them as dead. To unmark some dead stones, click "
"on them again."},
{butText_just, 0,
" When you are satisfied with which stones are dead and alive, press "
"the \"Done\" button next to the board. This will add a comment to "
"the game record stating the score. To stop scoring and remove all "
"marks, select a different tool."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText markTools[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Marking Tools Tool"},
{butText_just, 0,
" The marking tools are represented on the tool selector as stones "
"marked with a triangle, circle, or square. All three of these tools "
"behaves in the same way; only the mark added is different."},
{butText_just, 0,
" When one of the three marking tools is selected and you click on "
"the board, the appropriate mark will be added. Holding down shift "
"when you click will mark a group of stones."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText labelTools[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Label Tools"},
{butText_just, 0,
" The label tools are represented on the tool selector as a stones "
"with a letter or number on them. The letter label tool and the "
"number label tool behave in very similar ways."},
{butText_just, 0,
" When you click on the board with a label tool, the appropriate "
"type of label (a letter or a number) is added. The labels will start "
"at \"A\" or \"1\" and count up for each label that you add. Holding "
"down shift when you click with the numbering tool will add the move "
"number of that stone instead of starting at one."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage editToolPage[] = {
{"Edit Tool Window", editToolHelp},
{"Keyboard Shortcuts", editToolKey},
{"Move Tool", moveTool},
{"Change Board Tool", changeTool},
{"Score Tool", scoreTool},
{"Marking Tools", markTools},
{"Label Tools", labelTools},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_editTool = {10, "Edit Tool Help Pages", editToolPage};
/*
* From client/main.c
*/
static const AbutHelpText cliMain[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Client Main Window"},
{butText_just, 0,
" When cgoban is connected to one of the servers, the client main "
"window is the central area for information. There is a log in "
"the middle of this window which shows the output from the server. "
"Above the log are two buttons that open other windows; see the "
"\"Client Game List Window\" and \"Client Player List Window\" help "
"pages in the menu at the top of this help page. Below the log "
"are a text input box, the help button and the \"Quit\" button. The "
"\"Quit\" button will disconnect you from the server."},
{butText_just, 0,
" Any commands that you want to send to the server should be typed "
"in the text input box below the log. If you need help on server "
"commands, type the \"Help\" command here. These help pages only give "
"help for this client, not for the servers themselves."},
{butText_just, 0,
" Some server commands won\'t work with this client if you try to "
"enter them directly. For example, the \"who\" command should not be "
"used because its output will be caught by the client and not shown; if "
"you want a list of players, open the \"Player List\" window. Other "
"commands that will not work correctly are the \"games\" and \"observe\" "
"commands. Other commands may not be needed because their "
"functionality is already present in the client, but they will work "
"if you want to use them."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText cliGames[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Client Game List Window"},
{butText_just, 0,
" The game list window presents a list of all games in progress on "
"the server. The list will be automatically kept up to date as games "
"start and end."},
{butText_just, 0,
" Each line of the list is one game. From left to right, the columns "
"of the list are the game number, the name and rank of the white "
"player, the name and rank of the black player, the size of the board "
"used, the number of handicap stones given to black, the komi points "
"given to white, the game flags, and the number of players observing the "
"game."},
{butText_just, 0, " When a game ends, the game number will be replaced "
"with a hyphen and the \"Flags\" and \"Observers\" columns will be "
"replaced with the result of the game. This will remain until another "
"game is started in that game slot or until the \"*\" button is pressed "
"(see below)."},
{butText_just, 0,
" If you can't see all of the columns, then resize the window to be "
"bigger. For a description of exactly what the column means, see "
"the server's help file on the \"games\" command."},
{butText_just, 0,
" To observe a game in progress, click on the game in the list."},
{butText_just, 0,
" Not all of these fields will be kept up to date. To refresh the "
"window at any time press the \"*\" button in the upper left corner of "
"the list. This will also clear out all old game results for games "
"that have ended."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText cliPlayers[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Client Player List Window"},
{butText_just, 0,
" The player list window is a list of all players currently logged in "
"to the server. As players come and go they will appear and disappear "
"on this list."},
{butText_just, 0,
" Each line of the list is one player. From left to right, the "
"column of the list are the player\'s name, the player\'s rank, the "
"player\'s state, how long the player has been idle, and the game number "
"that the player is currently observing or playing in."},
{butText_just, 0,
" The state is one of four options: \"!\" means that the player is "
"actively looking for games, \"O\" means that the player is open to "
"playing, \"X\" means that the player is not available for games, and "
"\"?\" means that the client does not know what state the player is in"},
{butText_just, 0,
" The list is sorted. You have three choices on how to sort the list; "
"pick one by clicking on the buttons at the top of the player list. "
"Clicking on \"Name\" will sort the list alphabetically by name. "
"Clicking on \"Rank\" will sort the list by rank, strongest players "
"to weakest players. Clicking on \"State\" will sort the list by "
"state, with the players looking for games at the top and players "
"not interested in games at the bottom."},
{butText_just, 0,
" If you click on a player\'s name, the complete status of that "
"player will be fetched from the server and displayed in the log in "
"the main window."},
{butText_just, 0,
" If the player is available for games, then you can click on the "
"player's state to open up a \"Server Game Setup\" window. Use this "
"window to set up games against the other players on the server."},
{butText_just, 0,
" As new players arrive, they are placed at the bottom of the list. "
"To update the list and re-sort it, press the \"*\" button in the upper "
"left corner of the list."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage cliMainPage[] = {
{"Main Client Window", cliMain},
{"Game List Window", cliGames},
{"Player List Window", cliPlayers},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_cliMain = {6, "Client Help Pages", cliMainPage};
/* From "client/match.c" */
static const AbutHelpText cliMatch[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Server Game Setup Window"},
{butText_just, 0,
" The server game setup window is used to set up games against other "
"people on the server. To use this, first you set up the game "
"parameters as you wish, then when you are ready you click on the "
"\"OK\" button. This will send the match request to the other player. "
"When they send you a matching request, the game will begin!"},
{butText_just, 0,
" At the top are the names of the players (you and your opponent). "
"To change who plays black and who white, press the \"Switch\" button."},
{butText_just, 0,
" Below this are places where you can choose the rules of the game - "
"the size, handicap, etc. Most of these should be self-explanatory if "
"you are familiar with playing go on the servers. If you have any "
"questions, then you may want to try the online help files from the "
"server. Typing \"help match\", \"help komi\", etc. on the server "
"command line should give you the help that you need."},
{butText_just, 0,
" The \"Free Game\" button will determine whether the game counts "
"towards your rank. Usually you want this to happen, but if you want "
"to just experiment during a game or play casually, then check this "
"box."},
{butText_just, 0,
" Click \"Cancel\" if you decide that you don't want to play the game "
"at all. This will take away the window."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage cliMatchPage[] = {
{"Server Game Setup Window", cliMatch},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_cliMatch = {4, "Client Help Pages", cliMatchPage};
/* From "editBoard.c" */
static const AbutHelpText editBoard[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Edit Board Window"},
{butText_just, 0,
" When editing a smart-go file, the current board position is "
"displayed in the edit board window. Around the edit board window are "
"various buttons and controls."},
{butText_just, 0, ""},
{butText_just, 2, "The Title Box"},
{butText_just, 0,
" At the top left of the window is the title box. This shows the "
"name of the game in bold, and below that which moves are currently "
"visible on the board."},
{butText_just, 0, ""},
{butText_just, 2, "The Board"},
{butText_just, 0,
" Just below the title box is the board. Clicking on a point on "
"the board will have different effects depending on which edit tool "
"you are using; press \"Help\" in the edit tool window for more "
"infomation. With the most common tool, the \"Move Tool\", clicking "
"on the board will add a variation. Holding down shift when you "
"click on the board will change your move number to see when a "
"particular move was made."},
{butText_just, 0, ""},
{butText_just, 2, "The \""CGBUTS_REWCHAR"\", \""CGBUTS_BACKCHAR"\", "
"\""CGBUTS_FWDCHAR"\", and \""CGBUTS_FFCHAR"\" Buttons"},
{butText_just, 0,
" Pressing these buttons will change the current move number that "
"you can see on the board. "CGBUTS_BACKCHAR" and "CGBUTS_FWDCHAR" "
"will go one move at a time. "CGBUTS_REWCHAR" moves you to the "
"beginning of the game, and "CGBUTS_FFCHAR" moves you to the end."},
{butText_just, 0, ""},
{butText_just, 2, "The Score Boxes"},
{butText_just, 0,
" To the right of the board are the score boxes. There are two; one "
"for white and one for black. In each box are shown the current score "
"for that player and the amount of time remaining on that player's "
"clock. The score is not the final score for that player, but the sum "
"of the number of captures and the komi. To see the final score use "
"the \"Score Tool\" in the edit tool window."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Save Game\" Button"},
{butText_just, 0,
" Pressing \"Save Game\" will let you save the changes that you have "
"made to the smart-go file."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Quit\" Button"},
{butText_just, 0,
" Pressing the \"Quit\" button will close the edit board window and "
"the edit tool window. If you have made any changes to the smart go "
"file that you were viewing then you will be asked whether you want to "
"save these changes before you exit."},
{butText_just, 0, ""},
{butText_just, 2, "The Comments Box"},
{butText_just, 0,
" At the very bottom of the window is the comments box. Here you "
"will see any comments that have been made about the move you are "
"viewing. To edit or add the comments, click in the comments box "
"and start typing. Some emacs-style control keys are available; "
"see the \"Keyboard Shortcuts\" help page for a list of them."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText editBoardInfo[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Game Info Window"},
{butText_just, 0, " You open the game info window by pressing the "
"\"Game Info\" button when you are viewing a smart go file."},
{butText_just, 0, " The game info window lets you view and edit the "
"smart go game properties, such as player names, etc. To change "
"the properties simply type in your new value then save the game. "
"You should be warned that changing a property does not change the "
"game itself, only the description of the game. For example, if you "
"change the handicap then handicap stones will not be automatically "
"added to the game; the game will be described as having the new "
"handicap but to see this change you must add the stones yourself."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText editBoardKey[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "Edit Board Keyboard Shortcuts"},
{butText_just, 0, " Left arrow: Go back one move."},
{butText_just, 0, " Right arrow: Go ahead one move."},
{butText_just, 0, " Shift-left arrow: Go back to the previous "
"variation, comment, or annotation."},
{butText_just, 0, " Shift-right arrow: Go ahead to the next "
"variation, comment, or annotation."},
{butText_just, 0, " Shift-up arrow: Change the main variation to "
"the previous variation."},
{butText_just, 0, " Shift-down arrow: Change the main variation to "
"the next variation."},
{butText_just, 0, ""},
{butText_just, 2, "Comment Editing"},
{butText_just, 0, " When you are editing a comment the left and right "
"arrows will not change moves. Instead they will move the cursor. "
"These other commands are available:"},
{butText_just, 0, " Ctrl-A: Move cursor to the beginning of the line."},
{butText_just, 0, " Ctrl-D: Delete to the right of the cursor"},
{butText_just, 0, " Ctrl-E: Move cursor to the end of the line."},
{butText_just, 0, " Ctrl-K: Delete to the end of the line."},
{butText_just, 0, " Ctrl-U: Delete from the beginning of the line."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage editBoardPage[] = {
{"Edit Board Window", editBoard},
{"Game Info Window", editBoardInfo},
{"Keyboard Shortcuts", editBoardKey},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_editBoard = {6, "Edit Board Help Pages", editBoardPage};
/* From "local.c" */
static const AbutHelpText localBoard[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Game Board"},
{butText_just, 0, " When two players are playing go with Cgoban, the "
"board is shown in a window with controls used in the game around it. "
"To make a move, click on the board where you want your stone to go. "
"The last stone played will have a circle marker on it; if the last "
"move was a ko move, then the stone will have a square marker on it "
"instead."},
{butText_just, 0, ""},
{butText_just, 2, "The Title Box"},
{butText_just, 0, " Just above the board is the title box. Here, the "
"title of the game is shown along with the current move number and "
"whose move it is."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Pass\" Button"},
{butText_just, 0, " Pressing \"Pass\" will pass your turn. The game will "
"enter the scoring stage after both players pass."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Dispute\" Button"},
{butText_just, 0, " When you are playing with Japanese scoring, the "
"button just below the pass button is the \"Dispute\" button. If "
"the players disagree on whether a group of stones are alive or dead, "
"they can resolve the disagreement by pressing \"Dispute\". After "
"pressing dispute, the players select which group of stones are "
"the problem. Then the game continues, with slightly different rules. "
"When you are resolving disputes, kos cannot be retaken until a player "
"passes and it takes three consecutive passes to end the dispute. After "
"the three passes, the board is put back to the position it had before "
"the dispute. If any of the disputed stones are still alive, then "
"they are alive for scoring purposes; if they are all dead, then they "
"are dead for scoring purposes."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Resume\" button"},
{butText_just, 0, " When you are not using Japanese rules, any dispute "
"at the end of the game can be resolved by simply undoing the last two "
"passes and continuing the game. Pressing \"Resume\" will let you do "
"that."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Done\" button"},
{butText_just, 0, " When both players are done marking dead stones, "
"pressing \"Done\" will finish it and record the score."},
{butText_just, 0, ""},
{butText_just, 2, "The \""CGBUTS_REWCHAR"\", \""CGBUTS_BACKCHAR"\", "
"\""CGBUTS_FWDCHAR"\", and \""CGBUTS_FFCHAR"\" Buttons"},
{butText_just, 0,
" Pressing these buttons will move forward and backward through the "
"game, letting you undo and redo moves. "CGBUTS_BACKCHAR" and "
CGBUTS_FWDCHAR" will go one move at a time. "CGBUTS_REWCHAR" moves "
"you to the beginning of the game, and "CGBUTS_FFCHAR" moves you to the "
"end."},
{butText_just, 0, ""},
{butText_just, 2, "The Score Boxes"},
{butText_just, 0,
" To the right of the board are the score boxes. There are two; one "
"for white and one for black. In each box are shown the current score "
"for that player and the amount of time remaining on that player's "
"clock. When you are playing the game, the score is not the final "
"score for that player, but the sum of the number of captures and the "
"komi. When you are selecting dead stones and after pressing the "
"\"Done\" button, the score is the actual score for that player."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Save Game\" Button"},
{butText_just, 0,
" Pressing \"Save Game\" will save the game as a smart go file. Later "
"you can continue the game with the \"Load Game\" button of the control "
"window. You can also choose \"Edit Game\" from the control panel to "
"edit the game that you have saved. This is currently the only way to "
"create a new smart go file since the \"Edit Game\" button doesn't "
"work."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Edit Game\" Button"},
{butText_just, 0,
" Pressing \"Edit Game\" will pop up a second game board with the "
"game on it. This will be an edit game board, not a playing game "
"board, and it will come with a edit tool set. This is used if you "
"want to stop playing a game and want to use the editing tools to "
"annotate your game."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Quit\" Button"},
{butText_just, 0,
" Pressing \"Quit\" will end the game. If you want to continue the "
"game later, you should choose \"Save Game\" before you quit."},
{butText_just, 0, ""},
{butText_just, 2, "The Comments Box"},
{butText_just, 0,
" At the very bottom of the window is the comments box. Here you "
"can make comments about the game that will be saved in the smart go "
"file if you choose \"Save Game\" later. To edit or add the comments, "
"click in the comments box and start typing. Some emacs-style control "
"keys are available; see the \"Keyboard Shortcuts\" help page for a "
"list of them."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText localKeys[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "Playing Go Keyboard Shortcuts"},
{butText_just, 0, " Left arrow: Go back one move."},
{butText_just, 0, " Right arrow: Go ahead one move."},
{butText_just, 0, ""},
{butText_just, 2, "Comment Editing"},
{butText_just, 0, " When you are editing a comment the left and right "
"arrows will not change moves. Instead they will move the cursor. "
"These other commands are available:"},
{butText_just, 0, " Ctrl-A: Move cursor to the beginning of the line."},
{butText_just, 0, " Ctrl-D: Delete to the right of the cursor"},
{butText_just, 0, " Ctrl-E: Move cursor to the end of the line."},
{butText_just, 0, " Ctrl-K: Delete to the end of the line."},
{butText_just, 0, " Ctrl-U: Delete from the beginning of the line."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage localBoardPage[] = {
{"Playing Go", localBoard},
{"Keyboard Shortcuts", localKeys},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_localBoard = {5, "Playing Go Help Pages", localBoardPage};
/* From "client/board.c" */
static const AbutHelpText cliBoardPage[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Game Board"},
{butText_just, 0, " When you play or observe a game on the server, the "
"board is shown in a window with controls used in the game around it. "
"To make a move, click on the board where you want your stone to go. "
"The last stone played will have a circle marker on it; if the last "
"move was a ko move, then the stone will have a square marker on it "
"instead."},
{butText_just, 0, " You can also skip around in games or try out "
"variations by holding down shift or control as you click on the board. "
"See the \"Keyboard Shortcuts\" help page for more information on this."},
{butText_just, 0, ""},
{butText_just, 2, "The Title Box"},
{butText_just, 0, " Just above the board is the title box. Here, the "
"title of the game is shown along with the current move number and "
"whose move it is."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Pass\" Button"},
{butText_just, 0, " Pressing \"Pass\" will pass your turn. The game will "
"enter the scoring stage after both players pass."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Done\" button"},
{butText_just, 0, " When you are done marking dead stones, "
"pressing \"Done\" will finish it and record the score."},
{butText_just, 0, ""},
{butText_just, 2, "The \""CGBUTS_REWCHAR"\", \""CGBUTS_BACKCHAR"\", "
"\""CGBUTS_FWDCHAR"\", and \""CGBUTS_FFCHAR"\" Buttons"},
{butText_just, 0,
" Pressing these buttons will move forward and backward through the "
"game to see what order the moves occurred in. They do not undo or "
"redo moves; they only let you look back at previous moves. "
CGBUTS_BACKCHAR" and "
CGBUTS_FWDCHAR" will go one move at a time. "CGBUTS_REWCHAR" moves "
"you to the beginning of the game, and "CGBUTS_FFCHAR" moves you to the "
"end."},
{butText_just, 0, ""},
{butText_just, 2, "The Score Boxes"},
{butText_just, 0,
" To the right of the board are the score boxes. There are two; one "
"for white and one for black. In each box are shown the current score "
"for that player and the amount of time remaining on that player's "
"clock. When you are playing the game, the score is not the final "
"score for that player, but the sum of the number of captures and the "
"komi. When you are selecting dead stones and after pressing the "
"\"Done\" button, the score is the actual score for that player."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Adjourn\" Button"},
{butText_just, 0,
" Pressing \"Adjourn\" will send a request to adjourn the game when "
"you are playing. The other player must choose to adjourn also; then "
"the game will be saved on the server and you can safely stop playing."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Resign\" and \"Close\" Buttons"},
{butText_just, 0,
" If you are playing a game, there will be a button labeled "
"\"Resign\". Pressing this will resign the game. You will be asked "
"whether you really want to resign just in case you pressed the button "
"by accident!"},
{butText_just, 0,
" If you are not playing in the game, then the button will say "
"\"close\" instead and pressing it will close the window showing the "
"game."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Edit Game\" Button"},
{butText_just, 0,
" Pressing \"Edit Game\" will pop up a second game board with the "
"game on it. This will be an edit game board, not a server game "
"board, and it will come with a edit tool set. This is used if you "
"want to the editing tools to annotate the game that your are "
"observing or playing in."},
{butText_just, 0, ""},
{butText_just, 2, "The Kibitz Box"},
{butText_just, 0,
" At the very bottom of the window is the kibitz box. If you are "
"observing the game, then you will see kibitzes here. If you are "
"playing, then you will see messages from your opponent here."},
{butText_just, 0,
" There is an area below the kibitz box where you can type your "
"own kibitzes. Observers can only kibitz here; if you are playing, "
"then the radio button to the right of the text entry box controls "
"whether your message is seen by the observers (the \"Kib\" setting), "
"your opponent (the \"Say\" setting) or everybody (the \"Both\" "
"setting)."},
{butText_just, 0,
" When you are typing a message, the left and right arrows will not "
"move you forwards and backwards in the game. Instead they will move "
"the text cursor. To get rid of the text cursor and enable the "
"left and right arrows again, just press \"Return\" on an empty "
"kibitz."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText cliBoardKeyPage[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "Client Play Keyboard Shortcuts"},
{butText_just, 0, " Left arrow: Go back one move."},
{butText_just, 0, " Right arrow: Go ahead one move."},
{butText_just, 0,
" Holding down shift when you click on the board will move the "
"game forward or back to when that move was played."},
{butText_just, 0,
" Holding down control when you click on the board will let you try "
"out variations in the game you are observing or playing. Press "
"the \"" CGBUTS_FFCHAR "\" button to return to the game."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage cliBoard[] = {
{"Server Play", cliBoardPage},
{"Keyboard Shortcuts", cliBoardKeyPage},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_cliBoard = {5, "Server Play Help Pages", cliBoard};
/* From "client/setup.c" */
static const AbutHelpText cliSetup[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "Connecting to Go Servers"},
{butText_just, 0,
" The internet go servers provide a way for go "
"players around the world to meet to talk and play go. If your computer "
"can connect to these servers then you too can enjoy this. In some "
"parts of the world the go servers is the only way to find games of "
"go on a regular basis!"},
{butText_just, 0,
" To connect, fill out your username and password "
"in the areas provided. You will not see your password as you type it "
"for security reasons. Your username and password will be stored in "
"your resource file so that you will not have to type them next time "
"that you log in. This does mean, however, that you should be careful "
"about letting people see your resource file! The default name for "
"this file is \".cgobanrc\"; you should protect it if you are worried "
"about your password getting out."},
{butText_just, 0,
" If you don't have an account on the server you are "
"connecting to, just follow the directions in the connect window and "
"you will log in as a guest."},
{butText_just, 0,
" If you are behind a firewall and need to use a proxy "
"agent to connect to a server, then press the \"setup\" button on the "
"main window. This will allow you to configure the servers to go "
"through a proxy. It will also enable you to add or remove servers."},
{butText_just, 0,
" To change the machine name or port numbers used to "
"connect to the servers, press the \"Setup\" button in the control "
"window."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage cliSetupPage[] = {
{"Server Connect", cliSetup},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_cliSetup = {4, "Server Connect Help Pages", cliSetupPage};
/* From "gmp/play.c" */
static const AbutHelpText gmpBoard[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "The Game Board"},
{butText_just, 0, " When using go modem protocol to play a game, the "
"board is shown in a window with controls used in the game around it. "
"To make a move, click on the board where you want your stone to go. "
"The last stone played will have a circle marker on it; if the last "
"move was a ko move, then the stone will have a square marker on it "
"instead."},
{butText_just, 0, ""},
{butText_just, 2, "The Title Box"},
{butText_just, 0, " Just above the board is the title box. Here, the "
"title of the game is shown along with the current move number and "
"whose move it is."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Pass\" Button"},
{butText_just, 0, " Pressing \"Pass\" will pass your turn. The game will "
"enter the scoring stage after both players pass."},
{butText_just, 0, " Go modem protocol has no way to indicate which stones "
"are dead, so that must be done by a person."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Dispute\" Button"},
{butText_just, 0, " When you are playing with Japanese scoring, the "
"button just below the pass button is the \"Dispute\" button. If "
"the players disagree on whether a group of stones are alive or dead, "
"they can resolve the disagreement by pressing \"Dispute\". After "
"pressing dispute, the players select which group of stones are "
"the problem. Then the game continues, with slightly different rules. "
"When you are resolving disputes, kos cannot be retaken until a player "
"passes and it takes three consecutive passes to end the dispute. After "
"the three passes, the board is put back to the position it had before "
"the dispute. If any of the disputed stones are still alive, then "
"they are alive for scoring purposes; if they are all dead, then they "
"are dead for scoring purposes."},
{butText_just, 0, " It should be noted that go modem protocol has no "
"way to resolve disputes, so the disputes must be played out by a "
"person."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Resume\" button"},
{butText_just, 0, " When you are not using Japanese rules, any dispute "
"at the end of the game can be resolved by simply undoing the last two "
"passes and continuing the game. Pressing \"Resume\" will let you do "
"that."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Done\" button"},
{butText_just, 0, " When both players are done marking dead stones, "
"pressing \"Done\" will finish it and record the score."},
{butText_just, 0, ""},
{butText_just, 2, "The \""CGBUTS_REWCHAR"\", \""CGBUTS_BACKCHAR"\", "
"\""CGBUTS_FWDCHAR"\", and \""CGBUTS_FFCHAR"\" Buttons"},
{butText_just, 0,
" Pressing these buttons will move forward and backward through the "
"game, letting you undo and redo moves. "CGBUTS_BACKCHAR" and "
CGBUTS_FWDCHAR" will go one move at a time. "CGBUTS_REWCHAR" moves "
"you to the beginning of the game, and "CGBUTS_FFCHAR" moves you to the "
"end."},
{butText_just, 0, ""},
{butText_just, 2, "The Score Boxes"},
{butText_just, 0,
" To the right of the board are the score boxes. There are two; one "
"for white and one for black. In each box are shown the current score "
"for that player and the amount of time remaining on that player's "
"clock. When you are playing the game, the score is not the final "
"score for that player, but the sum of the number of captures and the "
"komi. When you are selecting dead stones and after pressing the "
"\"Done\" button, the score is the actual score for that player."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Save Game\" Button"},
{butText_just, 0,
" Pressing \"Save Game\" will save the game as a smart go file. Later "
"you can continue the game with the \"Load Game\" button of the control "
"window. You can also choose \"Edit Game\" from the control panel to "
"edit the game that you have saved. This is currently the only way to "
"create a new smart go file since the \"Edit Game\" button doesn't "
"work."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Edit Game\" Button"},
{butText_just, 0,
" Pressing \"Edit Game\" will pop up a second game board with the "
"game on it. This will be an edit game board, not a go modem game "
"board, and it will come with a edit tool set. This is used if you "
"want to use the editing tools to annotate the game that is being "
"played."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Quit\" Button"},
{butText_just, 0,
" Pressing \"Quit\" will end the game. If you want to continue the "
"game later, you should choose \"Save Game\" before you quit."},
{butText_just, 0, ""},
{butText_just, 2, "The Comments Box"},
{butText_just, 0,
" At the very bottom of the window is the comments box. Here you "
"can make comments about the game that will be saved in the smart go "
"file if you choose \"Save Game\" later. To edit or add the comments, "
"click in the comments box and start typing. Some emacs-style control "
"keys are available; see the \"Keyboard Shortcuts\" help page for a "
"list of them."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpText gmpBoardKey[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "Playing Go Keyboard Shortcuts"},
{butText_just, 0, " Left arrow: Go back one move."},
{butText_just, 0, " Right arrow: Go ahead one move."},
{butText_just, 0, ""},
{butText_just, 2, "Comment Editing"},
{butText_just, 0, " When you are editing a comment the left and right "
"arrows will not change moves. Instead they will move the cursor. "
"These other commands are available:"},
{butText_just, 0, " Ctrl-A: Move cursor to the beginning of the line."},
{butText_just, 0, " Ctrl-D: Delete to the right of the cursor"},
{butText_just, 0, " Ctrl-E: Move cursor to the end of the line."},
{butText_just, 0, " Ctrl-K: Delete to the end of the line."},
{butText_just, 0, " Ctrl-U: Delete from the beginning of the line."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage gmpBoardPage[] = {
{"Go Modem Play", gmpBoard},
{"Keyboard Shortcuts", gmpBoardKey},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_gmpBoard = {5, "Go Modem Help Pages", gmpBoardPage};
/* From "gmp/setup.c" */
static const AbutHelpText gmpSetup[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "Go Modem Protocol Setup Window"},
{butText_just, 0, " Using this window you may configure how the go modem "
"protocol will be used. The different types of connections allowed "
"will be described."},
{butText_just, 0, ""},
{butText_just, 2, "\"Program\" Connections"},
{butText_just, 0, " When you select \"Program\" as either the white "
"or the black player, Cgoban will execute a program and communicate "
"go modem protocol with that program's stdin/stdout. You must "
"specify the program to run in the \"Program\" field. The full "
"command line, with the path, must be specified. If you put \"%d\" "
"in the command line somewhere, the first \"%d\" will be replaced by "
"the main time (in seconds) and the second \"%d\" will be replaced by "
"the byo-yomi time (in seconds). For example, the program name "
"\"./goDummy -time %d -byoYomi %d\" will run the program \"goDummy\" "
"from the current directory with the time and the byo-yomi time "
"passed in on the command line."},
{butText_just, 0, " The send game command checkbox controls whether "
"commands to start the game will be sent to the program. Go modem "
"protocol required the two agents to decide before connecting who will "
"initiate the communication; this button lets you choose. Make sure "
"that either Cgoban or the program send the game command or else the "
"game will never start!"},
{butText_just, 0, ""},
{butText_just, 2, "\"Device\" Connections"},
{butText_just, 0, " This behaves much like a \"Program\" connection "
"except that instead of running a program, Cgoban will connect to "
"the device specified. For example, in Linux setting device to "
"\"/dev/cua0\" will connect up to the computer's COM1 port."},
{butText_just, 0, ""},
{butText_just, 2, "\"Human\" Connections"},
{butText_just, 0, " Setting the connection to \"Human\" will let you "
"make moves for this player."},
{butText_just, 0, ""},
{butText_just, 2, "\"NNGS\" and \"IGS\" Connections"},
{butText_just, 0, " Using \"NNGS\" or \"IGS\" will open a connection "
"to a go server. The username and the password should be set "
"correctly. If one player is \"NNGS\" or \"IGS\", then the other "
"player will be started up every time that a game is accepted on "
"the server. You will have to type all server commands except for "
"the actual moves in the game; these will be made by the program or "
"device. The \"Send game command\" switch is always set when you "
"are connected to a server."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage gmpSetupPage[] = {
{"Go Modem Play Setup", gmpSetup},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_gmpSetup = {4, "Go Modem Setup Help Pages", gmpSetupPage};
/* From "setup.c" */
static const AbutHelpText configure[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "Configure Window"},
{butText_just, 0, " The configure window lets you change the behavior "
"of Cgoban. There are several control panels in the configure window; "
"each controls a different part of cgoban."},
{butText_just, 0, ""},
{butText_just, 2, "The \"Connecting To NNGS\" And \"Connecting To IGS\" "
"Control Panels"},
{butText_just, 0, " Here you can set the location of the go servers. "
"The default will be set to the current location of the "
"servers; this window is here in case they move in the future. "
"If the locations are wrong then you should fill in the machine name "
"and port number of the server in the appropriate fields."},
{butText_just, 0, " Typically you want to leave \"Connect Directly To "
"Server\" set. This is the most efficient way to connect to a go "
"server. The only time when you might not want to set this is when "
"your computer is behind a firewall or other security system. Then "
"direct connections out might not work and you will have to go through "
"a proxy. To do this, turn off \"Connect Directly To Server\" and "
"enter the name of a program that can get through the firewall in "
"the \"Connecting Command\" field. Instead of connecting to the "
"server itself, Cgoban will run the command you specify and use it "
"to get to the server."},
{butText_just, 0, " Be careful that you do not confuse the NNGS and the "
"IGS servers! There are subtle differences in their protocol and "
"Cgoban will not operate reliably if it connects to one type of "
"server when it thinks it is connecting to another!"},
{butText_just, 0, ""},
{butText_just, 2, "The \"Miscellaneous\" Control Panel"},
{butText_just, 0, " Here are a few different controls."},
{butText_just, 0, " When \"Show Coordinates Around Boards\" checkbox "
"controls whether the coordinates are shown around the boards that "
"Cgoban draws."},
{butText_just, 0, " When \"Number Kibitzes\" is set, any kibitz "
"in a game on a go server will have the move number shown before it."},
{butText_just, 0, " The \"Anti-Slip Moving\" button will not let you "
"make a move until you have held the mouse over that point for at least "
"a half a second. This is useful because sometimes clicking on the "
"mouse makes it slip to the next space over, placing your move in "
"the wrong location! With Anti-Slip on, this can't happen."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage configurePage[] = {
{"Configuring Cgoban", configure},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_configure = {4, "Configure Help Pages", configurePage};
/* From client/look.c */
static const AbutHelpText cliLook[] = {
{butText_center, 2, "Cgoban " VERSION},
{butText_center, 0, "By Bill Shubert"},
{butText_center, 0, DATE},
{butText_just, 0, ""},
{butText_just, 2, "Client Look Window"},
{butText_just, 0, " The \"Look\" and \"Status\" commands on the go "
"servers show you the current state of a game. \"Look\" shows you "
"a saved game, while \"Status\" shows you a game in progress."},
{butText_just, 0, " These boards cannot be edited or manipulated in "
"any way."},
{butText_just, 0, ""},
{butText_left, 0, NULL}};
static const AbutHelpPage cliLookPage[] = {
{"Client Look Window", cliLook},
{NULL, NULL},
{"Copyright and Non-Warranty", copyright},
{"About the Author", aboutAuthor}};
Help help_cliLook = {4, "Client Look Help Pages", cliLookPage};
goban-1.1.orig/src/cgbuts.c 0000644 0001750 0001750 00000073270 10267776707 013430 0 ustar al al /*
* src/cgbuts.c, part of Complete Goban (game program)
* Copyright (C) 1995-1996 William Shubert.
* See "configure.h.in" for more copyright information.
*
* This code extends the wmslib/but library to add special buttons needed
* for cgoban.
*
* The globe data was extracted from the CIA World Data Bank II map database.
* via XEarth. See the main copyright for information about this.
*/
#include
#include
#include
#include
#include
#include
#include "goBoard.h"
#include "drawStone.h"
#ifdef _CGBUTS_H_
Levelization Error.
#endif
#include "cgbuts.h"
/**********************************************************************
* Forward Declarations
**********************************************************************/
static ButOut grid_mmove(But *but, int x, int y);
static ButOut grid_mleave(But *but);
static ButOut grid_mpress(But *but, int butnum, int x, int y);
static ButOut grid_mrelease(But *but, int butnum, int x, int y);
static void grid_draw(But *but, int x,int y,int w,int h);
static ButOut grid_destroy(But *but);
static void grid_newflags(But *but, uint fl);
static ButOut gridNetPress(But *but, void *buf, int bufLen);
static void drawRewChar(void *packet, ButWin *win,
int x, int y, int w, int h);
static void drawBackChar(void *packet, ButWin *win,
int x, int y, int w, int h);
static void drawFwdChar(void *packet, ButWin *win,
int x, int y, int w, int h);
static void drawFfChar(void *packet, ButWin *win,
int x, int y, int w, int h);
static void drawWStoneChar(void *packet, ButWin *win,
int x, int y, int w, int h);
static void drawBStoneChar(void *packet, ButWin *win,
int x, int y, int w, int h);
static void grid_morePixmaps(Cgbuts *b, int newNumPixmaps);
static void gobanPic_draw(But *but, int x,int y, int w,int h);
static ButOut gobanPic_destroy(But *but);
static void stoneGroup_draw(But *but, int x,int y, int w,int h);
static ButOut stoneGroup_destroy(But *but);
static void computerPic_draw(But *but, int x,int y, int w,int h);
static ButOut computerPic_destroy(But *but);
static void toolPic_draw(But *but, int x,int y, int w,int h);
static ButOut toolPic_destroy(But *but);
/**********************************************************************
* Global Variables
**********************************************************************/
const char *cgbuts_stoneChar[2] = {CGBUTS_WSTONECHAR, CGBUTS_BSTONECHAR};
static const ButAction grid_action = {
grid_mmove, grid_mleave, grid_mpress, grid_mrelease,
NULL, NULL, grid_draw, grid_destroy, grid_newflags, gridNetPress};
static const ButAction no_action = {
NULL, NULL, NULL, NULL,
NULL, NULL, grid_draw, grid_destroy, grid_newflags, gridNetPress};
static const ButAction gobanPic_action = {
NULL, NULL, NULL, NULL,
NULL, NULL, gobanPic_draw, gobanPic_destroy, but_flags, NULL};
static const ButAction stoneGroup_action = {
NULL, NULL, NULL, NULL,
NULL, NULL, stoneGroup_draw, stoneGroup_destroy, but_flags, NULL};
static const ButAction computerPic_action = {
NULL, NULL, NULL, NULL,
NULL, NULL, computerPic_draw, computerPic_destroy, but_flags, NULL};
static const ButAction toolPic_action = {
NULL, NULL, NULL, NULL,
NULL, NULL, toolPic_draw, toolPic_destroy, but_flags, NULL};
/**********************************************************************
* Functions
**********************************************************************/
void cgbuts_init(Cgbuts *cgbuts, ButEnv *env, Rnd *rnd, int color,
bool hold, bool hiContrast, bool interactive) {
MAGIC_SET(cgbuts);
cgbuts->env = env;
cgbuts->dpyDepth = DefaultDepth(butEnv_dpy(env),
DefaultScreen(butEnv_dpy(env)));
cgbuts->dpyRootWindow = RootWindow(butEnv_dpy(env),
DefaultScreen(butEnv_dpy(env)));
cgbuts->pics = NULL;
cgbuts->numPics = 0;
cgbuts->rnd = rnd;
cgbuts->color = color;
cgbuts->holdStart = 0;
cgbuts->hiContrast = hiContrast;
cgbuts->interactive = interactive;
cgbuts->holdEnabled = hold;
butEnv_setChar(env, 1.0, CGBUTS_REWCHAR, drawRewChar, NULL);
butEnv_setChar(env, 0.5, CGBUTS_BACKCHAR, drawBackChar, NULL);
butEnv_setChar(env, 0.5, CGBUTS_FWDCHAR, drawFwdChar, NULL);
butEnv_setChar(env, 1.0, CGBUTS_FFCHAR, drawFfChar, NULL);
butEnv_setChar(env, 1.0, CGBUTS_WSTONECHAR, drawWStoneChar, cgbuts);
butEnv_setChar(env, 1.0, CGBUTS_BSTONECHAR, drawBStoneChar, cgbuts);
}
But *grid_create(Cgbuts *b, ButOut (*func)(But *but), void *packet,
ButWin *win, int layer, int flags, int pos) {
Grid *grid;
But *but;
grid = wms_malloc(sizeof(Grid));
MAGIC_SET(grid);
but = but_create(win, grid, b->interactive ? &grid_action : &no_action);
but->uPacket = packet;
but->layer = layer;
but->flags = flags;
grid->b = b;
grid->callback = func;
grid->lineGroup = gridLines_center;
grid->starPoint = FALSE;
grid->pos = pos;
grid->pressColor = goStone_black;
grid->stoneVersion = rnd_int(b->rnd) % CGBUTS_NUMWHITE;
grid->ptype = goStone_empty;
grid->grey = FALSE;
grid->holdRequired = FALSE;
grid->markType = goMark_none;
grid->markAux = 0;
but_init(but);
return(but);
}
void grid_setStone(But *but, GoStone piece, bool grey) {
Grid *grid = but->iPacket;
if ((piece != grid->ptype) || (grey != grid->grey)) {
grid->ptype = piece;
grid->grey = grey;
but_draw(but);
}
}
void grid_setMark(But *but, GoMarkType mark, int aux) {
Grid *grid = but->iPacket;
if ((grid->markType != mark) || (grid->markAux != aux)) {
grid->markType = mark;
grid->markAux = aux;
but_draw(but);
}
}
static ButOut grid_destroy(But *but) {
Grid *grid = but->iPacket;
wms_free(grid);
return(0);
}
static void grid_newflags(But *but, uint fl) {
uint ofl = but->flags;
but->flags = fl;
if ((ofl & (BUT_TWITCHED|BUT_PRESSED|BUT_NETTWITCH|BUT_NETPRESS)) !=
(fl & (BUT_TWITCHED|BUT_PRESSED|BUT_NETTWITCH|BUT_NETPRESS))) {
but_draw(but);
}
}
static ButOut grid_mmove(But *but, int x, int y) {
uint newflags = but->flags, retval = BUTOUT_CAUGHT;
Grid *grid;
if (!(but->flags & BUT_PRESSABLE))
return(BUTOUT_CAUGHT);
if ((x < but->x) || (y < but->y) ||
(x >= but->x + but->w) || (y >= but->y + but->h)) {
newflags &= ~BUT_TWITCHED;
if (newflags != but->flags) {
butEnv_setCursor(but->win->env, but, butCur_idle);
but_newFlags(but, newflags);
}
if (!(newflags & BUT_LOCKED))
retval = 0;
} else {
newflags |= BUT_TWITCHED;
if (newflags != but->flags) {
grid = but->iPacket;
assert(MAGIC(grid));
grid->b->holdStart = butWin_env(but_win(but))->eventTime;
butEnv_setCursor(but->win->env, but, butCur_twitch);
but_newFlags(but, newflags);
}
}
return(retval);
}
static ButOut grid_mleave(But *but) {
int newflags = but->flags;
newflags &= ~BUT_TWITCHED;
if (newflags != but->flags) {
butEnv_setCursor(but->win->env, but, butCur_idle);
but_newFlags(but, newflags);
}
return(BUTOUT_CAUGHT);
}
static ButOut grid_mpress(But *but, int butnum, int x, int y) {
int newflags = but->flags, retval = BUTOUT_CAUGHT;
Grid *grid;
if (butnum == 1) {
grid = but->iPacket;
assert(MAGIC(grid));
/*
* Check to make sure that the user has been holding the mouse there
* long enough.
* Holding the mouse is only necessare if all of these are true:
* - Cgbuts.holdEnabled is TRUE. This lets the user turn on and off
* all holds globally.
* - This particular button has hold enabled. This lets cgoban turn
* off hold when you are in a situation where an undo is no problem.
* - No modifiers are pressed. Same reason as the previous.
*/
if (((but->win->env->keyModifiers & (ShiftMask | ControlMask)) == 0) &&
grid->holdRequired && grid->b->holdEnabled &&
(butWin_env(but_win(but))->eventTime - grid->b->holdStart <
CGBUTS_HOLDTIME))
retval |= BUTOUT_ERR;
else
newflags |= BUT_PRESSED|BUT_LOCKED;
} else
retval |= BUTOUT_ERR;
/*
* if (!(but->flags & BUT_PRESSED) && (newflags & BUT_PRESSED))
* snd_play(&pe_move_snd);
*/
if (newflags != but->flags)
but_newFlags(but, newflags);
return(retval);
}
static ButOut grid_mrelease(But *but, int butnum, int x, int y) {
int newflags = but->flags, retval = BUTOUT_CAUGHT;
Grid *grid = but->iPacket;
bool makeCallback = FALSE;
if (butnum != 1)
return(retval);
if (but->flags & BUT_TWITCHED) {
if (but->flags & BUT_PRESSED) {
if (but->id)
butRnet_butSpecSend(but, NULL, 0);
makeCallback = TRUE;
}
} else
retval |= BUTOUT_ERR;
newflags &= ~(BUT_PRESSED|BUT_LOCKED);
if (newflags != but->flags)
but_newFlags(but, newflags);
if (makeCallback)
retval |= grid->callback(but);
return(retval);
}
static void grid_draw(But *but, int x,int y,int w,int h) {
static const struct {
int numPoints, points[5];
} lineFormats[9] = {
{3, {4,2,3}}, /* ul */
{4, {1,3,2,4}}, /* top */
{3, {1,2,4}}, /* ur */
{4, {0,4,2,3}}, /* left */
{5, {1,3,2,0,4}}, /* center */
{4, {0,4,2,1}}, /* right */
{3, {0,2,3}}, /* ll */
{4, {1,3,2,0}}, /* bottom */
{3, {0,2,1}}}; /* lr */
Grid *grid = but->iPacket;
int i, lineWidth, starSize, flags = but->flags;
Display *dpy;
XPoint points[5], lines[5];
GC gc = but->win->env->gc;
GoStone markColor;
Cgbuts *b = grid->b;
assert(MAGIC(b));
dpy = but->win->env->dpy;
/* Points are:
* 0
* |
* 1 - 2 - 3
* |
* 4
*/
if ((grid->markType != goMark_letter) && (grid->markType != goMark_number) &&
(grid->lineGroup != gridLines_none) &&
((grid->ptype == goStone_empty) || grid->grey)) {
butEnv_setXFg(but->win->env, BUT_FG);
lineWidth = (but->w + 15) / 30;
if (lineWidth < 1)
lineWidth = 1;
XSetLineAttributes(dpy, gc, lineWidth, LineSolid, CapButt, JoinMiter);
points[0].x = points[2].x = points[4].x = but->x + but->w/2;
points[1].x = but->x;
points[3].x = but->x + but->w;
points[0].y = but->y;
points[1].y = points[2].y = points[3].y = but->y + but->h/2;
points[4].y = but->y + but->h;
for (i = 0; i < lineFormats[grid->lineGroup].numPoints; ++i)
lines[i] = points[lineFormats[grid->lineGroup].points[i]];
XDrawLines(dpy, but->win->win, gc, lines,
lineFormats[grid->lineGroup].numPoints, CoordModeOrigin);
if (grid->starPoint) {
butEnv_setXFg(but->win->env, BUT_FG);
starSize = (((but->w + 6 - lineWidth*6) / 12) * 2) + lineWidth+1;
if (starSize > 1) {
XFillArc(dpy, but->win->win, gc, but->x+(but->w - starSize)/2,
but->y + (but->h-starSize)/2, starSize, starSize,
0, 360*64);
}
}
}
if ((grid->ptype == goStone_empty) &&
!(flags & (BUT_TWITCHED|BUT_NETTWITCH)) &&
(grid->markType == goMark_none))
return;
markColor = grid->ptype;
if (grid->ptype != goStone_empty) {
if (flags & (BUT_PRESSED|BUT_NETPRESS)) {
/* Pressed. Invert the greyness. */
cgbuts_drawp(b, but->win, grid->ptype, !grid->grey, but->x, but->y,
but->w, grid->stoneVersion, x,y,w,h);
} else {
cgbuts_drawp(b, but->win, grid->ptype, grid->grey, but->x, but->y,
but->w, grid->stoneVersion, x,y,w,h);
if (flags & (BUT_TWITCHED|BUT_NETTWITCH)) {
/* Twitched. Draw a small stone in the middle of it. */
if (grid->grey) {
cgbuts_drawp(b, but->win, grid->ptype, FALSE,
but->x+(but->w+1)/4, but->y+(but->w+1)/4,
but->w/2, grid->stoneVersion, x,y,w,h);
} else {
cgbuts_drawp(b, but->win, goStone_opponent(grid->ptype), TRUE,
but->x+(but->w+1)/4, but->y+(but->w+1)/4,
but->w/2, grid->stoneVersion, x,y,w,h);
}
}
}
} else {
assert(grid->ptype == goStone_empty);
if (flags & (BUT_PRESSED|BUT_NETPRESS|BUT_TWITCHED|BUT_NETTWITCH)) {
markColor = grid->pressColor;
if (flags & (BUT_PRESSED |BUT_NETPRESS)) {
cgbuts_drawp(b, but->win, grid->pressColor, FALSE,
but->x, but->y, but->w, grid->stoneVersion, x,y,w,h);
} else {
/* Grid is twitched only. */
cgbuts_drawp(b, but->win, grid->pressColor, TRUE,
but->x, but->y, but->w, grid->stoneVersion, x,y,w,h);
}
}
}
if ((grid->markType != goMark_none) &&
(!(flags & (BUT_PRESSED|BUT_NETPRESS)))) {
cgbuts_markPiece(b, but->win, markColor, grid->markType, grid->markAux,
but->x, but->y, but->w, grid->stoneVersion, x,y,w,h);
}
}
static ButOut gridNetPress(But *but, void *buf, int bufLen) {
Grid *grid = but->iPacket;
assert(bufLen == 0);
/* snd_play(&pe_move_snd); */
return(grid->callback(but));
}
void cgbuts_drawp(Cgbuts *b, ButWin *win, GoStone piece, bool grey,
int x, int y, int size, int stoneVersion,
int dx,int dy, int dw,int dh) {
ButEnv *env = win->env;
Display *dpy = env->dpy;
GC gc = env->gc2;
int copyStart;
int worldNum = 0;
if (size >= b->numPics)
grid_morePixmaps(b, size + 1);
if (b->pics[size].stonePixmaps == None)
drawStone_newPics(env, b->rnd, CGBUTS_GREY(0),
&b->pics[size].stonePixmaps,
&b->pics[size].maskBitmaps, size,
butEnv_isColor(env) && !b->hiContrast);
if (stoneVersion >= CGBUTS_NUMWHITE) {
worldNum = 2 + stoneVersion / CGBUTS_NUMWHITE;
stoneVersion %= CGBUTS_NUMWHITE;
}
if ((dx >= x+size) || (dy >= y+size) ||
(dx+dw <= x) || (dy+dh <= y))
return;
if (dx < x) {
dw -= x - dx;
dx = x;
}
if (dy < y) {
dh -= y - dy;
dy = y;
}
if (dx + dw > x + size)
dw = x + size - dx;
if (dy + dh > y + size)
dh = y + size - dy;
XSetClipMask(dpy, gc, b->pics[size].maskBitmaps);
if (grey) {
if ((x & 1) == (y & 1))
XSetClipOrigin(dpy, gc, x - size - win->xOff, y - win->yOff);
else
XSetClipOrigin(dpy, gc, x - size * 2 - win->xOff, y - win->yOff);
} else {
XSetClipOrigin(dpy, gc, x - win->xOff, y - win->yOff);
}
copyStart = 0;
if (piece == goStone_white)
copyStart = (stoneVersion + 1) * size;
XCopyArea(dpy, b->pics[size].stonePixmaps, win->win, gc,
copyStart+dx-x,dy-y, dw,dh, dx - win->xOff, dy - win->yOff);
if (worldNum) {
copyStart = 0;
if (piece == goStone_black)
copyStart = (stoneVersion + 1) * size;
XSetClipOrigin(dpy, gc, x-size*worldNum - win->xOff, y - win->yOff);
XCopyArea(dpy, b->pics[size].stonePixmaps, win->win, gc,
copyStart+dx-x,dy-y, dw,dh, dx - win->xOff, dy - win->yOff);
}
XSetClipMask(dpy, gc, None);
}
void cgbuts_markPiece(Cgbuts *b, ButWin *win, GoStone piece,
GoMarkType markType, int markAux,
int x, int y, int w, int stoneVersion,
int dx,int dy, int dw,int dh) {
ButEnv *env = win->env;
Display *dpy = env->dpy;
GC gc = env->gc;
int lw = 0;
XPoint points[4];
int off;
char text[4];
if ((markType >= goMark_lastMove) && (markType <= goMark_circle)) {
/* Must set up line attributes. */
lw = (w + 7) / 15;
if (lw < 1)
lw = 1;
XSetLineAttributes(dpy, gc, lw, LineSolid, CapButt, JoinMiter);
}
if (piece == goStone_black)
butEnv_setXFg(env, BUT_WHITE);
else
butEnv_setXFg(env, BUT_BLACK);
switch(markType) {
case goMark_none:
break;
case goMark_triangle:
points[0].x = x+w/2 - win->xOff;
points[0].y = y+lw - win->yOff;
points[1].x = x+((w*0.9330127)-(lw*0.8660254)+0.5) - win->xOff;
points[1].y = y+((w*0.75)-(lw*0.5)+0.5) - win->yOff;
points[2].x = x+((w*0.0669873)+(lw*0.8660254)+0.5) - win->xOff;
points[2].y = points[1].y;
points[3] = points[0];
XDrawLines(dpy, win->win, gc, points, 4, CoordModeOrigin);
break;
case goMark_ko:
case goMark_square:
off = (int)(w*0.14644661+lw*0.5+0.5);
XDrawRectangle(dpy, win->win, gc, x + off - win->xOff, y + off - win->yOff,
w-off*2-(lw&1),w-off*2-(lw&1));
break;
case goMark_lastMove:
case goMark_circle:
off = (w + 1) / 4;
XDrawArc(dpy, win->win, gc, x + off - win->xOff, y + off - win->yOff,
w-off*2-1,w-off*2-1, 0,360*64);
break;
case goMark_smBlack:
case goMark_smWhite:
if (markType == goMark_smBlack)
cgbuts_drawp(b, win, goStone_black, FALSE, x+(w+1)/4,y+(w+1)/4, w/2,
stoneVersion, dx,dy,dw,dh);
else
cgbuts_drawp(b, win, goStone_white, FALSE, x+(w+1)/4,y+(w+1)/4, w/2,
stoneVersion, dx,dy,dw,dh);
break;
case goMark_letter:
text[0] = markAux;
text[1] = '\0';
butWin_write(win, x + (w - butEnv_textWidth(env, text, 1)) / 2,
y + (w - butEnv_fontH(env, 1)) / 2, text, 1);
break;
case goMark_number:
assert(markAux >= 0);
if (markAux > 999)
markAux = 999;
if ((markAux > 99) && (w < butEnv_fontH(env, 0) * 2))
sprintf(text, "%02d", markAux % 100);
else
sprintf(text, "%d", markAux);
butWin_write(win, x + (w - butEnv_textWidth(env, text, 1)) / 2,
y + (w - butEnv_fontH(env, 1)) / 2, text, 1);
break;
}
}
void grid_setPress(But *but, GoStone pressColor) {
Grid *grid;
if (pressColor == goStone_empty) {
if (but->flags & BUT_PRESSABLE)
but_setFlags(but, BUT_NOPRESS);
} else {
if (!(but->flags & BUT_PRESSABLE))
but_setFlags(but, BUT_PRESSABLE);
grid = but->iPacket;
grid->pressColor = pressColor;
}
if (but->flags & BUT_TWITCHED)
but_draw(but);
}
static void drawRewChar(void *packet, ButWin *win,
int x, int y, int w, int h) {
XPoint points[8];
Display *dpy = butEnv_dpy(butWin_env(win));
Window xwin = butWin_xwin(win);
GC gc = butEnv_gc(butWin_env(win));
h &= ~1;
w &= ~1;
points[0].x = x;
points[0].y = y+h/2;
points[1].x = x+w/2;
points[1].y = y;
points[2].x = x+w/2;
points[2].y = y+h/2;
points[3].x = x+w;
points[3].y = y;
points[4].x = x+w;
points[4].y = y+h;
points[5] = points[2];
points[6].x = x+w/2;
points[6].y = y+h;
points[7] = points[0];
XFillPolygon(dpy, xwin, gc, points, 8, Nonconvex, CoordModeOrigin);
}
static void drawBackChar(void *packet, ButWin *win,
int x, int y, int w, int h) {
XPoint points[4];
Display *dpy = butEnv_dpy(butWin_env(win));
Window xwin = butWin_xwin(win);
GC gc = butEnv_gc(butWin_env(win));
h &= ~1;
points[0].x = x;
points[0].y = y+h/2;
points[1].x = x+w;
points[1].y = y;
points[2].x = x+w;
points[2].y = y+h;
points[3] = points[0];
XFillPolygon(dpy, xwin, gc, points, 4, Nonconvex, CoordModeOrigin);
}
static void drawFwdChar(void *packet, ButWin *win,
int x, int y, int w, int h) {
XPoint points[4];
Display *dpy = butEnv_dpy(butWin_env(win));
Window xwin = butWin_xwin(win);
GC gc = butEnv_gc(butWin_env(win));
h &= ~1;
points[0].x = x;
points[0].y = y;
points[1].x = x+w;
points[1].y = y+h/2;
points[2].x = x;
points[2].y = y+h;
points[3] = points[0];
XFillPolygon(dpy, xwin, gc, points, 4, Nonconvex, CoordModeOrigin);
}
static void drawFfChar(void *packet, ButWin *win,
int x, int y, int w, int h) {
XPoint points[8];
Display *dpy = butEnv_dpy(butWin_env(win));
Window xwin = butWin_xwin(win);
GC gc = butEnv_gc(butWin_env(win));
h &= ~1;
w &= ~1;
points[0].x = x;
points[0].y = y;
points[1].x = x+w/2;
points[1].y = y+h/2;
points[2].x = x+w/2;
points[2].y = y;
points[3].x = x+w;
points[3].y = y+h/2;
points[4].x = x+w/2;
points[4].y = y+h;
points[5] = points[1];
points[6].x = x;
points[6].y = y+h;
points[7] = points[0];
XFillPolygon(dpy, xwin, gc, points, 8, Nonconvex, CoordModeOrigin);
}
static void drawWStoneChar(void *packet, ButWin *win,
int x, int y, int w, int h) {
Cgbuts *b = packet;
cgbuts_drawp(b, win, goStone_white, FALSE, x,y, w, 1, x,y,w,h);
}
static void drawBStoneChar(void *packet, ButWin *win,
int x, int y, int w, int h) {
Cgbuts *b = packet;
cgbuts_drawp(b, win, goStone_black, FALSE, x,y, w, 1, x,y,w,h);
}
static void grid_morePixmaps(Cgbuts *b, int newNumPics) {
int i;
CgbutsPic *newPics;
assert(MAGIC(b));
newPics = wms_malloc(newNumPics * sizeof(CgbutsPic));
for (i = 0; i < b->numPics; ++i) {
newPics[i] = b->pics[i];
}
for (; i < newNumPics; ++i) {
newPics[i].stonePixmaps = None;
newPics[i].maskBitmaps = None;
}
b->numPics = newNumPics;
if (b->pics) {
wms_free(b->pics);
}
b->pics = newPics;
}
But *gobanPic_create(Cgbuts *b, ButWin *win, int layer, int flags) {
But *but;
but = but_create(win, b, &gobanPic_action);
but->uPacket = NULL;
but->layer = layer;
but->flags = flags;
return(but);
}
static void gobanPic_draw(But *but, int x,int y, int w,int h) {
ButWin *win = but->win;
ButEnv *env = win->env;
int w13 = (but->w+1)/3;
int w16 = (but->w + 2) / 6;
int stonew = but->w/3;
int bw = butEnv_stdBw(env);
int cgtop = but->y + (but->w - stonew - bw - (w13 + w16)) / 2;
int bdtop = cgtop + stonew + bw;
XPoint points[4];
butEnv_setXFg(env, CGBUTS_COLORBOARD(0));
XFillRectangle(env->dpy, win->win, env->gc, but->x,bdtop+w13,
but->w,w16);
butEnv_setXFg(env, CGBUTS_COLORBOARD(225));
points[0].x = but->x;
points[0].y = bdtop+w13;
points[1].x = but->x + w16;
points[1].y = bdtop;
points[2].x = but->x + but->w - w16;
points[2].y = points[1].y;
points[3].x = but->x + but->w;
points[3].y = points[0].y;
XFillPolygon(env->dpy, win->win, env->gc, points, 4,
Convex, CoordModeOrigin);
}
static ButOut gobanPic_destroy(But *but) {
return(0);
}
But *stoneGroup_create(Cgbuts *b, ButWin *win, int layer, int flags) {
But *but;
but = but_create(win, b, &stoneGroup_action);
but->uPacket = NULL;
but->layer = layer;
but->flags = flags;
return(but);
}
static void stoneGroup_draw(But *but, int x,int y, int w,int h) {
ButWin *win = but->win;
int stoneW;
stoneW = but->w >> 1;
cgbuts_drawp(but->iPacket, win, goStone_black, FALSE,
but->x, but->y, stoneW, 0, x, y, w, h);
cgbuts_drawp(but->iPacket, win, goStone_white, FALSE,
but->x + stoneW, but->y, stoneW, 1, x, y, w, h);
cgbuts_drawp(but->iPacket, win, goStone_white, FALSE,
but->x, but->y + stoneW, stoneW, 2, x, y, w, h);
cgbuts_drawp(but->iPacket, win, goStone_black, FALSE,
but->x + stoneW, but->y + stoneW, stoneW, 3, x, y, w, h);
}
static ButOut stoneGroup_destroy(But *but) {
return(0);
}
But *computerPic_create(Cgbuts *b, ButWin *win, int layer, int flags) {
But *but;
but = but_create(win, b, &computerPic_action);
but->uPacket = NULL;
but->layer = layer;
but->flags = flags;
return(but);
}
static void computerPic_draw(But *but, int x,int y, int w,int h) {
XPoint points[4];
ButWin *win = but->win;
Display *dpy = butEnv_dpy(butWin_env(win));
Window xwin = butWin_xwin(win);
GC gc = butEnv_gc(butWin_env(win));
int h2 = but->h / 2, h3 = but->h / 3, h12 = but->h / 12;
int w6 = but->w / 6, w9 = but->w / 9;
x = but->x;
y = but->y;
w = but->w;
h = but->h;
y += (h - (h12 + h2 + h12 + h3)) / 2;
points[0].x = x;
points[0].y = y + h12 + h2 + h3;
points[1].x = x + w6;
points[1].y = y + h12 + h2 + h12;
points[2].x = x + w - w6;
points[2].y = y + h12 + h2 + h12;
points[3].x = x + w;
points[3].y = y + h12 + h2 + h3;
butEnv_setXFg(butWin_env(win), BUT_BLACK);
XFillPolygon(dpy, xwin, gc, points, 4, Nonconvex, CoordModeOrigin);
XFillRectangle(dpy, xwin, gc, x+w6,y+h12, w-2*w6,h2);
butEnv_setXFg(butWin_env(win), BUT_PBG);
XFillRectangle(dpy, xwin, gc, x+w6+w9,y+h12*2, w-2*w6-2*w9,h2-h12*2);
}
static ButOut computerPic_destroy(But *but) {
return(0);
}
But *toolPic_create(Cgbuts *b, ButWin *win, int layer, int flags) {
But *but;
but = but_create(win, b, &toolPic_action);
but->uPacket = NULL;
but->layer = layer;
but->flags = flags;
return(but);
}
static void toolPic_draw(But *but, int x,int y, int w,int h) {
XPoint points[12];
ButWin *win = but->win;
Display *dpy = butEnv_dpy(butWin_env(win));
Window xwin = butWin_xwin(win);
GC gc = butEnv_gc(butWin_env(win));
/* Size of hammer or screwdriver relative to whole picture. */
const float subBoxSize = 0.75;
const float bevel = 0.25;
const float hr2 = 0.70710678; /* Half of Root 2 */
/* Hammer constants. */
const float hHandleW = 0.1;
const float hJointW = 0.2;
const float hJointL = 0.2;
const float hClawL = 0.4;
const float hNeckW = 0.07;
const float hHeadL = 0.1;
/* Screwdriver constants. */
const float sHandleW = 0.2;
const float sHandleL = 0.5;
const float sHEndW = 0.15;
const float sBladeW = 0.04;
float th;
float bx, by;
x = but->x;
y = but->y;
h = but->h;
th = h * subBoxSize;
bx = x + h * (1.0 - subBoxSize);
by = y + h * (1.0 - subBoxSize);
/* The hammer's handle. */
points[0].x = x;
points[0].y = y + th * (1.0 - hHandleW) + 0.5;
points[1].x = x + th * hHandleW + 0.5;
points[1].y = points[0].y + (points[1].x - points[0].x);
points[2].x = x + th * (1.0 - hJointL * hr2) + 0.5;
points[2].y = points[1].y - (points[2].x - points[1].x);
points[3].x = points[2].x - (points[1].x - points[0].x);
points[3].y = points[2].y - (points[1].x - points[0].x);
/* Add beveling to the handle. */
points[4] = points[0];
points[5].x = x + th * hHandleW * bevel + 0.5;
points[5].y = points[4].y + (points[5].x - points[4].x);
points[6].x = x + th * (1.0 - hJointL * hr2) + 0.5;
points[6].y = points[5].y - (points[6].x - points[5].x);
points[7] = points[3];
points[9] = points[1];
points[10] = points[2];
points[8].x = points[9].x - th * hHandleW * bevel + 0.5;
points[8].y = points[9].y - (points[9].x - points[8].x);
points[11].x = points[10].x - (points[9].x - points[8].x);
points[11].y = points[10].y - (points[9].x - points[8].x);
butEnv_setXFg(butWin_env(win), CGBUTS_COLORBOARD(200));
XFillPolygon(dpy, xwin, gc, points, 4, Nonconvex, CoordModeOrigin);
butEnv_setXFg(butWin_env(win), CGBUTS_COLORBOARD(0));
XFillPolygon(dpy, xwin, gc, points+4, 4, Nonconvex, CoordModeOrigin);
butEnv_setXFg(butWin_env(win), CGBUTS_COLORBOARD(255));
XFillPolygon(dpy, xwin, gc, points+8, 4, Nonconvex, CoordModeOrigin);
/* The hammer's head. */
points[0].x = x + th + 0.5;
points[0].y = y + th * (hJointL * hr2) + 0.5;
points[1].x = points[0].x - (points[0].y - y);
points[1].y = y;
points[2].x = x + th * (1.0 - hJointL * hr2 - hClawL) + 0.5;
points[2].y = y;
points[3].x = x + th * (1.0 - (hJointL + hJointW) * hr2) + 0.5;
points[3].y = y + (points[1].x - points[3].x);
points[4].x = points[3].x + (points[0].x - points[1].x);
points[4].y = points[3].y + (points[4].x - points[3].x);
points[5].x = x + th * (1.0 - (hJointW + hNeckW) * hr2 * 0.5) + 0.5;
points[5].y = points[4].y - (points[5].x - points[4].x);
points[6].x = points[5].x;
points[6].y = points[4].y + (points[6].x - points[4].x);
points[7].x = x + th * (1.0 + (hHeadL * 2.0 - hJointW) * hr2) + 0.5;
points[7].y = points[6].y + (points[7].x - points[6].x);
points[8].x = points[7].x + (points[0].x - points[4].x);
points[8].y = points[7].y - (points[8].x - points[7].x);
points[9].x = points[8].x - (points[7].x - points[6].x);
points[9].y = points[8].y - (points[7].x - points[6].x);
points[10].x = points[0].x - (points[9].y - points[0].y);
points[10].y = points[9].y;
butEnv_setXFg(butWin_env(win), BUT_BLACK);
XFillPolygon(dpy, xwin, gc, points, 11, Nonconvex, CoordModeOrigin);
/* The screwdriver's blade. */
points[0].x = bx + th * (1.0 - sBladeW * hr2) + 0.5;
points[0].y = by + 0.5;
points[1].x = bx + th * sHandleW + 0.5;
points[1].y = points[0].y + (points[0].x - points[1].x);
points[3].x = bx + th + 0.5;
points[3].y = points[0].y + (points[3].x - points[0].x);
points[2].x = points[1].x + (points[3].x - points[0].x);
points[2].y = points[1].y + (points[3].x - points[0].x);
butEnv_setXFg(butWin_env(win), CGBUTS_GREY(120));
XFillPolygon(dpy, xwin, gc, points, 4, Nonconvex, CoordModeOrigin);
/* The screwdriver's handle. */
points[4].x = bx + 0.5;
points[4].y = by + th * (1.0 - sHandleW * hr2) + 0.5;
points[5].x = points[4].x;
points[5].y = by + th * (1.0 - sHEndW * hr2) + 0.5;
points[6].y = by + th + 0.5;
points[6].x = points[5].x + (points[6].y - points[5].y);
points[7].y = points[6].y;
points[7].x = points[6].x + (points[5].y - points[4].y);
points[8].x = bx + th * (sHandleL + sHandleW) * hr2 + 0.5;
points[8].y = points[7].y - (points[8].x - points[7].x);
points[3].x = points[4].x + (points[8].x - points[7].x);
points[3].y = points[4].y - (points[8].x - points[7].x);
points[2].x = points[3].x + th * bevel * sHandleW * hr2 + 0.5;
points[2].y = points[3].y + (points[2].x - points[3].x);
points[9].x = points[8].x - (points[2].x - points[3].x);
points[9].y = points[8].y - (points[2].x - points[3].x);
points[1].x = points[4].x + (points[2].x - points[3].x);
points[1].y = points[4].y + (points[2].x - points[3].x);
points[10].x = points[7].x - (points[2].x - points[3].x);
points[10].y = points[7].y - (points[2].x - points[3].x);
points[0].x = points[5].x + th * bevel * sHEndW * hr2 + 0.5;
points[0].y = points[5].y + (points[0].x - points[5].x);
points[11].x = points[6].x - (points[0].x - points[5].x);
points[11].y = points[6].y - (points[0].x - points[5].x);
butEnv_setXFg(butWin_env(win), CGBUTS_COLORBOARD(200));
XFillPolygon(dpy, xwin, gc, points+3, 6, Nonconvex, CoordModeOrigin);
butEnv_setXFg(butWin_env(win), CGBUTS_COLORBOARD(0));
XFillPolygon(dpy, xwin, gc, points, 6, Nonconvex, CoordModeOrigin);
butEnv_setXFg(butWin_env(win), CGBUTS_COLORBOARD(255));
XFillPolygon(dpy, xwin, gc, points+6, 6, Nonconvex, CoordModeOrigin);
}
static ButOut toolPic_destroy(But *but) {
return(0);
}
void cgbuts_redraw(Cgbuts *b) {
int i;
assert(MAGIC(b));
for (i = 0; i < b->numPics; ++i) {
if (b->pics[i].stonePixmaps != None) {
XFreePixmap(butEnv_dpy(b->env), b->pics[i].stonePixmaps);
XFreePixmap(butEnv_dpy(b->env), b->pics[i].maskBitmaps);
}
}
wms_free(b->pics);
b->pics = NULL;
b->numPics = 0;
butEnv_drawAll(b->env);
}
goban-1.1.orig/src/goGame.h 0000644 0001750 0001750 00000013206 06431442507 013320 0 ustar al al /*
* src/gogame.h, part of Complete Goban (game program)
* Copyright (C) 1995-1997 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _GOGAME_H_
#define _GOGAME_H_ 1
#ifndef _GOHASH_H_
#include "goHash.h"
#endif
#ifndef _GOBOARD_H_
#include "goBoard.h"
#endif
#ifndef _GOTIME_H_
#include "goTime.h"
#endif
/**********************************************************************
* Constants
**********************************************************************/
#define GOGAME_PASS 0
/**********************************************************************
* Data types
**********************************************************************/
typedef enum {
goRules_chinese, goRules_japanese, goRules_ing, goRules_aga,
goRules_nz, goRules_tibetan
} GoRules;
#define goRules_num ((int)goRules_tibetan + 1)
typedef enum {
goRulesKo_japanese, goRulesKo_super, goRulesKo_tibetan
/*
* goRulesKo_ing is longer supported since it can't be implemented
* accurately by a computer without lots of help from the players.
*/
} GoRulesKo;
typedef enum {
goGameState_play, goGameState_dispute,
goGameState_selectDead, goGameState_selectDisputed,
goGameState_done
} GoGameState;
#define GOGAMEFLAGS_DISPUTED 0x0001
#define GOGAMEFLAGS_MARKDEAD 0x0002
#define GOGAMEFLAGS_WANTDEAD 0x0004
#define GOGAMEFLAGS_RESOLVEDEAD 0x0008
#define GOGAMEFLAGS_RESOLVEALIVE 0x0010
#define GOGAMEFLAGS_SEEWHITE 0x0020
#define GOGAMEFLAGS_SEEBLACK 0x0040
#define GOGAMEFLAGS_SEKI 0x0080
#define GOGAMEFLAGS_NOSEKI 0x0100
#define GOGAMEFLAGS_SPECIAL 0x0200 /* For seki detection. */
#define GOGAMEFLAGS_EYE 0x0400 /* For seki detection. */
#define GOGAMEFLAGS_FAKETEST 0x0800 /* For seki detection. */
#define GOGAMEFLAGS_NOTFAKE 0x1000 /* For seki detection. */
#define GOGAMEFLAGS_RESOLVED (GOGAMEFLAGS_RESOLVEDEAD| \
GOGAMEFLAGS_RESOLVEALIVE)
#define GOGAMEFLAGS_SEEN (GOGAMEFLAGS_SEEBLACK|GOGAMEFLAGS_SEEWHITE)
#define goGameFlags_see(s) (GOGAMEFLAGS_SEEWHITE << (s))
typedef struct GoGameMove_struct {
int move;
GoStone color;
GoHash hash; /* Hash value at the beginning of this move. */
GoTimer time; /* Time left at this move. */
} GoGameMove;
typedef struct {
int size;
GoRules rules;
/*
* Passive and forcePlay are somewhat redundant. I should clean them up.
* But basically, passive means it is controlled by the SGF, and
* forcePlay means go server. Yuck.
*/
bool passive;
bool forcePlay;
float komi;
GoTime time;
int moveNum, maxMoves, handicap, passCount;
GoGameMove *moves;
int movesLen;
bool noLastMove;
GoStone whoseMove;
GoBoard *board;
GoBoard *tmpBoard; /* Used for superko rule and seki checks. */
uint *flags;
bool flagsCleared;
int *hotMoves;
int cooloff; /* The last move that cleared the kos. */
GoGameState state;
bool disputeAlive;
int setWhoseMoveNum;
GoStone setWhoseMoveColor;
int disputedLoc;
MAGIC_STRUCT
} GoGame;
/**********************************************************************
* Global variables
**********************************************************************/
extern const bool goRules_freeHandicaps[goRules_num];
extern const GoRulesKo goRules_ko[goRules_num];
extern const bool goRules_suicide[goRules_num];
extern const bool goRules_dispute[goRules_num];
extern const bool goRules_scoreKills[goRules_num];
/**********************************************************************
* Functions
**********************************************************************/
extern GoGame *goGame_create(int size, GoRules rules, int handicap,
float komi, const GoTime *time, bool passive);
extern void goGame_destroy(GoGame *game);
/*
* Valid in the play or dispute states.
*/
/*
* goGame_move() returns TRUE if the move caused the game's state to change.
* Possible changes:
* play --> selectDead
* dispute --> selectDead
* play, dispute --> done (for time-out losses only, move will not be made)
*/
extern bool goGame_move(GoGame *game, GoStone color, int move,
GoTimer *currentTime);
extern void goGame_setBoard(GoGame *game, GoStone color, int loc);
#define goGame_pass(g, color, t) goGame_move((g), color, GOGAME_PASS, t)
#define goGame_isHot(g, l) ((g)->hotMoves[l] >= (g)->cooloff)
#define goGame_whoseMove(g) ((g)->whoseMove)
extern GoStone goGame_whoseTurnOnMove(GoGame *game, int moveNum);
extern const GoTimer *goGame_getTimer(const GoGame *game, GoStone color);
/*
* Valid in play, dispute, or done states. Returns TRUE if the game's state
* has changed, just like goGame_move.
* Possible changes:
* play --> done
* done --> play
*/
extern bool goGame_moveTo(GoGame *game, int moveNum);
/*
* Valid in the selectDead state.
*/
extern void goGame_markDead(GoGame *game, int loc);
/*
* resume() will change state from selectDead to play.
*/
extern void goGame_resume(GoGame *game);
/*
* done() will change state from selectDead to done.
*/
extern void goGame_done(GoGame *game);
/*
* selectDisputed() will change state from selectDead to selectDisputed.
*/
#define goGame_selectDisputed(g) ((g)->state = goGameState_selectDisputed)
/*
* dispute() will change state from selectDisputed to dispute.
*/
extern void goGame_dispute(GoGame *game, int loc);
/*
* Always valid.
*/
extern bool goGame_isLegal(GoGame *game, GoStone moveColor, int move);
#define goGame_caps(g, s) goBoard_caps((g)->board, (s))
extern int goGame_lastMove(GoGame *g);
#define goGame_noLastMove(g) ((g)->noLastMove = TRUE)
#endif /* _GOGAME_H_ */
goban-1.1.orig/src/checkbox.h 0000644 0001750 0001750 00000001246 06035353012 013700 0 ustar al al /*
* wmslib/src/but/checkbox.h, part of wmslib (Library functions)
* Copyright (C) 1994-1995 William Shubert.
* See "configure.h.in" for more copyright information.
*
* Includes for checkbox.c
*/
#ifndef _BUT_CHECKBOX_H_
#define _BUT_CHECKBOX_H_ 1
/**********************************************************************
* Functions
**********************************************************************/
extern But *butCb_create(ButOut (*func)(But *but, bool value), void *packet,
ButWin *win, int layer, int flags,
bool on);
extern bool butCb_get(But *but);
extern void butCb_set(But *but, bool on, bool makeCallback);
#endif /* _BUT_CHECKBOX_H_ */
goban-1.1.orig/src/data.h 0000644 0001750 0001750 00000003727 10270070030 013021 0 ustar al al /*
* src/client/data.h, part of Complete Goban (game program)
* Copyright (C) 1995-1997 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _CLIENT_DATA_H_
#ifndef _CLIENT_SERVER_H_
#include "server.h"
#endif
#ifndef _CGOBAN_H_
#include "cgoban.h"
#endif
#ifndef _CLIENT_CONN_H_
#include "conn.h"
#endif
#ifndef _WMS_STR_H_
#include
#endif
#ifdef _CLIENT_DATA_H_
#error LEVELIZATION ERROR
#endif
#define _CLIENT_DATA_H_ 1
/**********************************************************************
* Data Types
**********************************************************************/
typedef struct CliActions_struct {
/*
* Passing board as a void is really ugly. What I should do is move
* this data type into board.h and keep it in the main data structure,
* passing it down as needed.
*/
void (*newGame)(void *packet, GoStone localColor, int size, int handicap,
float komi, int mainTime, int byTime, void *board);
void (*gotMove)(void *packet, GoStone color, int loc);
void (*gotUndo)(void *packet);
void (*endGame)(void *packet);
void (*logout)(void *packet);
} CliActions;
typedef enum {
cliData_setup, cliData_login, cliData_main
} CliDataState;
typedef struct CliData_struct {
CliDataState state;
Cgoban *cg;
int serverNum;
CliServer server;
const char *serverName;
Str userName;
Str cmdBuild;
ClpEntry *numKibitz;
bool connValid;
CliConn conn;
const CliActions *actions;
void *packet;
int refCount;
MAGIC_STRUCT
} CliData;
/**********************************************************************
* Functions
**********************************************************************/
extern CliData *cliData_create(Cgoban *cg, int serverNum,
const CliActions *actions, void *packet);
#define cliData_incRef(cd) (++((cd)->refCount))
extern void cliData_closeConns(CliData *cd);
extern void cliData_decRef(CliData *cd);
#endif /* _CLIENT_DATA_H_ */
goban-1.1.orig/src/i_win.h 0000644 0001750 0001750 00000000417 06035353012 013216 0 ustar al al /*
* wmslib/src/but/i_win.h, part of wmslib (Library functions)
* Copyright (C) 1995 William Shubert.
* See "configure.h.in" for more copyright information.
*
* Includes for i_win.c
*/
#ifndef _BUT_I_WIN_H_
#define _BUT_I_WIN_H_ 1
#endif /* _BUT_I_WIN_H_ */
goban-1.1.orig/src/plasma.c 0000644 0001750 0001750 00000006435 10270056457 013400 0 ustar al al /*
* src/xio/plasma.c, part of Complete Goban (game program)
* Copyright (C) 1994-1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#include
#include
#include "plasma.h"
#define FACTOR 0.7
#define SIZE PLASMA_SIZE
#define STRETCH 3
static void vert(int *cloud, int step, int skew, Rnd *rnd);
static void diag(int *, int, int, Rnd *), perp(int *, int, int, Rnd *);
static int my_random(int limit, Rnd *rnd);
uchar *plasma(void) {
static bool done = FALSE;
int *cloud, x;
Rnd *rnd;
static unsigned char *cout = NULL;
int step, i;
float fskew;
if (done)
return(cout);
done = TRUE;
rnd = rnd_create(time(NULL));
cout = wms_malloc(SIZE * SIZE * sizeof(char));
fskew = (float)(750 << 8);
cloud = wms_malloc(SIZE * (SIZE+1) * sizeof(int));
assert(cloud != NULL);
if (cloud == NULL) {
fprintf(stderr, "Could not allocate enough memory.\n");
exit(1);
}
*cloud = my_random(256 << 16, rnd);
for (step = SIZE/2; step; step /= 2) {
diag(cloud, step, (int)fskew, rnd);
fskew *= FACTOR;
if (fskew < 1.0)
fskew = 1.0;
perp(cloud, step, (int)fskew, rnd);
fskew *= FACTOR;
if (fskew < 1.0)
fskew = 1.0;
}
#if STRETCH
for (i = PLASMA_SIZE*PLASMA_SIZE/(1<= 0; i -= PLASMA_SIZE) {
memcpy(cloud+(i<>= 1) {
fskew = 1.0;
vert(cloud, step, (int)fskew, rnd);
fskew *= FACTOR*FACTOR;
if (fskew < 1.0)
fskew = 1.0;
}
#endif /* STRETCH */
for (i = 0; i < SIZE*SIZE; ++i) {
x = (cloud[i] >> 8) & 511;
if (x > 255)
x = 511 - x;
cout[i] = x;
}
wms_free(cloud);
rnd_destroy(rnd);
return(cout);
}
#define CLACC(x, y) cloud[(x) + ((y)*SIZE)]
static void diag(int *cloud, int step, int skew, Rnd *rnd) {
int i, j;
int sum;
for (i = 0; i < SIZE; i += step)
for (j = 0; j < SIZE; j += step) {
if (((i & step) != 0) && ((j & step) != 0)) {
sum = (CLACC(i-step, j-step) +
CLACC(i-step, (j+step)&(SIZE-1)) +
CLACC((i+step)&(SIZE-1), j-step) +
CLACC((i+step)&(SIZE-1), (j+step)&(SIZE-1))) / 4;
CLACC(i, j) = sum + my_random(skew, rnd);
}
}
}
static void perp(int *cloud, int step, int skew, Rnd *rnd) {
int i, j;
int sum;
for (i = 0; i < SIZE; i += step)
for (j = 0; j < SIZE; j += step) {
if ((i & step) != (j & step)) {
sum = (CLACC((i-step)&(SIZE-1), j) +
CLACC(i, (j+step)&(SIZE-1)) +
CLACC((i+step)&(SIZE-1), j) +
CLACC(i, (j-step)&(SIZE-1))) / 4.0;
CLACC(i, j) = sum + my_random(skew, rnd);
}
}
}
static void vert(int *cloud, int step, int skew, Rnd *rnd) {
int i, j;
int sum;
for (i = 0; i < SIZE; ++i)
for (j = step; j < SIZE; j += (step<<1)) {
sum = (CLACC((i-1)&(SIZE-1), j-step) +
CLACC(i, j-step) +
CLACC((i+1)&(SIZE-1), j-step) +
CLACC((i-1)&(SIZE-1), j+step) +
CLACC(i, j+step) +
CLACC((i+1)&(SIZE-1), j+step)) / 6.0;
CLACC(i, j) = sum + my_random(skew, rnd);
}
}
static int my_random(int limit, Rnd *rnd) {
int i;
i = rnd_int(rnd);
if (i & 8)
return(rnd_int(rnd) % limit);
else
return(-(rnd_int(rnd) % limit));
}
goban-1.1.orig/src/setup.h 0000644 0001750 0001750 00000002644 06415545327 013273 0 ustar al al /*
* src/gmp/setup.h, part of Complete Goban (game program)
* Copyright (C) 1995 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#ifndef _GMP_SETUP_H_
#define _GMP_SETUP_H_ 1
/**********************************************************************
* Data types
**********************************************************************/
typedef enum {
gmpSetup_program, gmpSetup_device, gmpSetup_human, gmpSetup_nngs,
gmpSetup_igs, gmpSetup_local, gmpSetup_remote
} GmpSetupType;
typedef struct GmpSetupPlayer_struct {
GmpSetupType type;
ClpEntry *optionEntry, *progNameEntry, *devNameEntry;
Str progName, devName;
But *box;
But *typeMenu;
But *strDesc1, *strIn1;
But *strDesc2, *strIn2;
} GmpSetupPlayer;
typedef struct GmpSetup_struct {
Cgoban *cg;
/* TRUE if you are waiting for a callback from gameSetup. */
bool gameWaiting;
ButWin *win;
But *bg;
But *title;
But *ok, *help, *cancel;
GmpSetupPlayer players[2];
MAGIC_STRUCT
} GmpSetup;
/**********************************************************************
* Functions
**********************************************************************/
extern GmpSetup *gmpSetup_create(Cgoban *cg);
extern void gmpSetup_destroy(GmpSetup *gs);
extern int gmp_forkProgram(Cgoban *cg, int *inFile, int *outFile,
const char *progName, int mainTime, int byTime);
#endif /* _GMP_SETUP_H_ */
goban-1.1.orig/src/slide.c 0000644 0001750 0001750 00000036127 10270074372 013220 0 ustar al al /*
* wmslib/src/but/slide.c, part of wmslib (Library functions)
* Copyright (C) 1994-1997 William Shubert.
* See "configure.h.in" for more copyright information.
*/
#include
#include "wms.h"
#ifdef X11_DISP
#ifdef STDC_HEADERS
#include
#include
#endif /* STDC_HEADERS */
#include
#include
#include
#include
#include
#include
#include
#ifdef HAVE_SYS_SELECT_H
#include