OSDN Git Service

TiMidity++-1.3.0
authorMasanao Izumo <mo@goice.co.jp>
Tue, 2 Feb 1999 22:28:12 +0000 (07:28 +0900)
committerMasanao Izumo <mo@goice.co.jp>
Tue, 2 Feb 1999 22:28:12 +0000 (07:28 +0900)
71 files changed:
ChangeLog
INSTALL
INSTALL.jp
Makefile.in
NEWS
common.makefile.in
config.h.in
configure
configure.in
doc/C/Makefile.in
doc/Makefile.in
doc/ja_JP.ujis/Makefile.in
doc/ja_JP.ujis/timidity.cfg.5
interface/Makefile.am
interface/Makefile.in
interface/bitmaps/Makefile.in
interface/browser.tcl
interface/gtk_p.c
interface/mac_c.h
interface/mac_mag.c
interface/mac_wrdwindow.c
interface/motif_bitmaps/Makefile.in
interface/motif_p.c
interface/pixmaps/Makefile.in
interface/tk_c.c
interface/tkmidity.ptcl
interface/vt100_c.c
interface/wrdt_mac.c
interface/wrdt_wincon.c
interface/xaw_c.c
interface/xaw_i.c
libarc/Makefile.in
libarc/arc.h
libarc/arc_mime.c
libarc/url.c
libarc/url_dir.c
timidity/Makefile.am
timidity/Makefile.in
timidity/aiff_a.c
timidity/au_a.c
timidity/audriv_al.c
timidity/audriv_sun.c
timidity/bsd20_a.c
timidity/common.c
timidity/common.h
timidity/dl_dlopen.c
timidity/dl_hpux.c
timidity/hpux_d_a.c
timidity/linux_a.c
timidity/mac_com.h
timidity/mac_main.c
timidity/mac_main.h
timidity/output.c
timidity/output.h
timidity/playmidi.c
timidity/raw_a.c
timidity/readmidi.c
timidity/reverb.c
timidity/reverb.h
timidity/timidity.c
timidity/timidity.h
timidity/wave_a.c
timidity/win_a.c
timidity/wrdt.c
utils/Makefile.am
utils/Makefile.in
utils/getopt.c [deleted file]
utils/net.c
utils/net.h
utils/support.c [new file with mode: 0644]
utils/timer.c

index f8976f7..6e012bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,106 @@
+-- 1.3.0
+Wed Feb 3 1999
+Summary:
+    * Fixed some problems with the Xaw and Tcl/Tk interfaces.
+    * Modified to compile on cygnus.
+    * Made support.c to define missing functions.
+    * Used `strerror()' instead of `sys_errlist[]'.
+    * Imported Macintosh source from 1999.1.7 released.
+    * Defined BIG_ENDIAN or LITTLE_ENDIAN according to WORDS_BIGENDIAN.
+    * Configure/Makefile modifications:
+       - Enabled to configure on cygnus.
+        - Remove -aout compiler flag on FreeBSD.
+        - Remove -Wall compiler flag.
+       - Don't use `+=' operation in any Makefiles.  Old GNU make may not
+         recognize append operator.
+    * Improved XAW interface for trace playing.
+    * Improved reverb sounds.
+    * Fixed MIME/Multipart bug.
+
+
+Date: Tue, 2 Feb 1999 21:15:14 +0100 (CET)
+From: Peter Kleiweg <kleiweg@let.rug.nl>
+Files: interface/{browser.tcl,xaw_i.c,tkmidity.ptcl}
+    Fixed some problems with the Xaw and Tcl/Tk interfaces:
+    - With the Xaw interface, in the File Open dialog, the file/directory
+      listing was unsorted.
+    - With the Tcl/Tk interface, in the File Open dialog, the directory
+      listing was sorted, but not the file listing.
+    - On some machine, there is no 17 point fonts.  Changed the use of 17
+      point fonts into 18 point fonts.
+
+Date: Wed Feb 3 1999
+From: Masanao Izumo <mo@goice.co.jp>
+Files: timidity/{win_a.c,timidity.c,playmidi.c}
+    Modified to compile on CYGNUS/gcc.
+    Fragment optimizations.
+
+Date: Tue Feb 2 1999
+From: Masanao Izumo <mo@goice.co.jp>
+Files: utils/support.c timidity/timidity.h
+    Defined missing functions.  And declared them in timidity.h.
+Files: timidity/output.c timidity/output.h
+    Added output_encoding_string() function to display the name of encoding.
+Files: interface/{wrdt_wincon.c,vt100_c.c}
+       timidity/{playmidi.c,win_a.c}
+    Modified to compile on CYGNUS/gcc
+Files: interface{gtk_p.c,motif_p.c,tk_c.c} libarc/url.c
+       timidity/{aiff_a.c,au_a.c,audriv_al.c,audriv_sun.c,bsd20_a.c,common.c,
+       dl_dlopen.c,dl_hpux.c,hpux_d_a.c,linux_a.c,raw_a.c,readmidi.c,
+       timidity.c,timidity.h,wave_a.c}
+    Used `strerror()' instead of `sys_errlist[]'.
+    Included <errno.h> in timidity.h if HAVE_ERRNO_H is true.
+Files: timidity/{mac_a.c,mac_com.h,mac_dlog.c,mac_main.c,mac_main.h,mac_qt_a.c,
+       mac_soundspec.c}
+       interface/{mac_c.c,mac_c.h,mac_loadBMP.c,mac_loadBMP.h,mac_mag.c,
+       mac_mag.h,mac_skin.c,mac_skin.h,mac_trace.c,mac_wrdwindow.c,
+       mac_wrdwindow.h,wrdt_mac.c}
+       utils/{mac_readdir.c,mac_readdir.h,mac_util.c,mac_util.h}
+    Imported Macintosh source from 1999.1.7 released.
+Files: timidity/timidity.h
+    If WORDS_BIGENDIAN is defined in config.h, define BIG_ENDIAN,
+    otherwise define LITTLE_ENDIAN.
+Files: utils/timer.c
+    Use gettimeofday() if HAVE_GETTIMEOFDAY, otherwise Use Windows API.
+Files: configure.in utils/Makefile.am libarc/url_dir.c
+    Modified the implementation about opendir().
+
+Date: Mon Feb 1 1999
+From: Yoshishige Arai <ryo2@on.rim.or.jp>
+    Improved XAW interface display in trace mode.
+
+Date: Fri Jan 29 1999
+From: Masanao Izumo <mo@goice.co.jp>
+Files: configure.in
+    On FreeBSD, There is probrem to make shared object library.
+    Netscape Plugin needs `aout' format, but I don't have enough
+    knowledge to build aout format under ELF environment FreeBSD.
+    So I just removed -aout flag for compiler.
+Files: doc/ja_JP.ujis/timidity.cfg.5
+    Changed `Kairyouban' to `TiMidity++'.
+Files: INSTALL, INSTALL.jp
+    Added some discriptions.
+Files: common.makefile.in
+    Removed -Wall option from compiler option.
+    Expanded `+=' macro definition.
+    Defined @EXTRADEFS@ in CPPFLAGS instead of DEFS.
+
+Date: Thu, 28 Jan 1999
+From: Masaki Kiryu <mkiryu@mb.kcom.ne.jp>
+Files: timidity/reverb.{c,h}
+    Improved reverb sounds.
+
+Date: Wed Jan 27 1999
+From: Masanao Izumo <mo@goice.co.jp>
+Files: libarc/arc_mime.c
+    Fixed bug about MIME archiver for multipart/mixed.
+    You can play midi in MIME/Multipart file.  For example:
+    % timidity mail:~/Mail/inbox/1234
+    I think MIME/Multipart is one of archive file format. :-)
+
 -- 1.2.1
 Mon Jan 25 1999
 Summary:
-    * Added missing files.
     * Fixed some configuration probrems.
     * Added --enable-dynamic `configure' option.
 
diff --git a/INSTALL b/INSTALL
index cdd09ba..9fdcc86 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -3,7 +3,7 @@
                               Installation guide
 
                                        Masanao Izumo <mo@goice.co.jp>
-                                       Last updated on Jan.6.1999
+                                       Last updated on Feb.3.1999
 ==============================================================================
 
  This document describes how to install TiMidity++(version 1.0.0 or later)
@@ -14,7 +14,7 @@
  Installing process:
 
   1. ./configure
-  2. edit Makefile and timidity.h (not necessary)
+  2. edit common.makefile, Makefile, timidity.h (not necessary)
   3. make              (required:GNU make)
   4. make install      (required:GNU make)
   5. search for various voice data :)
@@ -167,10 +167,10 @@ Note: '%' is the shell prompt.
 
 
 
-2. edits Makefile, timidity.h
+2. edits common.makefile, Makefile, timidity.h
 ------------------------------
  If configure failed or compile not complete successfully, edit
Makefile and timidity.h to appropriate value.
common.makefile, Makefile, and timidity.h to appropriate value.
 
 
 
@@ -204,12 +204,13 @@ vendorShellWidgetClass
 
 
 5. Search for various voice data
+ TiMidity++ uses GUS/patch (Glavis Ultrasound) as the voice data to play.
+ You must get GUS/patch files, and make the configuration file.
+ Please check the following sites for many voice(patch) data:
 
- This package contains only Piano and Guitar patch. Please check
- the following sites for many voice(patch) data:
-
-http://www.goice.co.jp/timidity/gus/
-http://www.i.h.kyoto-u.ac.jp/~shom/timidity/
+http://www.goice.co.jp/timidity/gus/                   (33M patch)
+http://www.goice.co.jp/timidity/dist/cfg/              (Some samples of *.cfg)
+http://www.i.h.kyoto-u.ac.jp/~shom/timidity/           (10M or 4M patch)
 ftp://ftp.cdrom.com/pub/gus/sound/patches/files/       (GUS site)
 
  If you got funny voice archive, extract it to appropriate directory and
@@ -495,28 +496,6 @@ ftp://ftp.cdrom.com/pub/gus/sound/patches/files/   (GUS site)
  temporary path with this macro.
 
 
- Next, configuration of existence of union semun. If your system
- has it, 
-
-#define HAVE_UNION_SEMUN
-
- or
-
-/* #define HAVE_UNION_SEMUN */
-
-
-
- Next, configuration of existence of volatile declaration. If your
- compiler supports volatile declaration,
-
-/* #define NO_VOLATILE */
-
- otherwise,
-
-#define NO_VOLATILE
-
-
-
  Next, recognizing GS drum part by GS exclusive message.
 
 #define GS_DRUMPART
index d1a3667..83ec01b 100644 (file)
@@ -3,7 +3,7 @@
                     TiMidity++ \e$B$N%$%s%9%H!<%k\e(B
 
                                        \e$B=P1@@5>0\e(B <mo@goice.co.jp>
-                                       \e$B:G=*=$@5F|\e(B 1999\e$BG/\e(B1\e$B7n\e(B6\e$BF|\e(B
+                                       \e$B:G=*=$@5F|\e(B 1999\e$BG/\e(B2\e$B7n\e(B3\e$BF|\e(B
 ==============================================================================
 
 \e$B$3$N%I%-%e%a%s%H$O\e(B TiMidity++ (\e$B%P!<%8%g%s$O\e(B 1.0.0 \e$B0J9_\e(B) \e$B$N\e(B UNIX \e$B>e$G$N\e(B
@@ -13,7 +13,7 @@
   \e$B%$%s%9%H!<%k$NBg$^$+$J<j=g$O\e(B
 
 1. configure
-2. Makefile, timidity.h \e$B$NJT=8\e(B (\e$B$7$J$/$F$b$h$$\e(B)
+2. common.makefile, Makefile, timidity.h \e$B$NJT=8\e(B (\e$B$7$J$/$F$b$h$$\e(B)
 3. make              (GNU \e$B$N\e(B make \e$B$,I,MW\e(B)
 4. make install      (GNU \e$B$N\e(B make \e$B$,I,MW\e(B)
 5. \e$B2;8;$r$=$m$($k\e(B
     \e$B9T$J$&$?$a$NDj5A$G$9!#\e(BLinux, FreeBSD, SunOS, Solaris, IRIX, DEC/OSF1 \e$B$G\e(B
     \e$BM-8z$G$9!#\e(B
 
-2. Makefile, timidity.h \e$B$NJT=8\e(B
+2. common.makefile, Makefile, timidity.h \e$B$NJT=8\e(B
 ------------------------------
-\e$B$b$7!"@5$7$/%3%s%Q%$%k$G$-$J$$>l9g$O!"\e(BMakefile, \e$B$"$k$$$O\e(B timidity.h
+\e$B$b$7!"@5$7$/%3%s%Q%$%k$G$-$J$$>l9g$O!"\e(Bcommon.makefile, Makefile, timidity.h
 \e$BFb$N%Q%i%a%?$r=$@5$7$F$/$@$5$$!#\e(B
 
 3. make
@@ -218,8 +218,9 @@ vendorShellWidgetClass
 \e$B$3$N%Q%C%1!<%8$N\e(B TiMidity \e$B$r%$%s%9%H!<%k$7$?$@$1$G$O!"2;$,$J$j$^$;$s!#\e(B
 \e$B1iAU$9$k$K$O!"\e(BGUS \e$B$N2;8;%U%!%$%k$rF~<j$9$kI,MW$,$"$j$^$9!#\e(B
 
-http://www.goice.co.jp/timidity/gus/
-http://www.i.h.kyoto-u.ac.jp/~shom/timidity/
+http://www.goice.co.jp/timidity/gus/                   (33M patch)
+http://www.goice.co.jp/timidity/dist/cfg/              (Some samples of *.cfg)
+http://www.i.h.kyoto-u.ac.jp/~shom/timidity/           (10M or 4M patch)
 ftp://ftp.cdrom.com/pub/gus/sound/patches/files/       (GUS \e$B%5%$%H$N0\E>@h\e(B)
 
 \e$B$J$I$+$i2;8;$rF~<j$7!$E,@Z$J>l=j$KE83+$7$^$9!%I,MW$K1~$8$F!$\e(B*.cfg \e$B%U%!%$%k$N\e(B
@@ -542,30 +543,6 @@ Windows \e$B$G$O!$\e(BTMPDIR \e$B4D6-JQ?t$OL5;k$5$l$^$9$N$G!$\e(B
 TMPDIR \e$B%^%/%m$rDj5A$7$F$/$@$5$$!%\e(B
 
 
-\e$B<!$K\e(B union semun \e$B6&MQBN$NM-L5$K4X$9$k@_Dj$G$9!%\e(B
-union semun \e$B6&MQBN$,Dj5A$5$l$F$$$k4D6-$G$O\e(B
-
-#define HAVE_UNION_SEMUN
-
-\e$B$HDj5A$7!$$J$$$J$i\e(B
-
-/* #define HAVE_UNION_SEMUN */
-
-\e$B$HL$Dj5A$K$7$F$/$@$5$$!%\e(B
-
-
-\e$B<!$K%3%s%Q%$%i$N\e(B volatile \e$B$K4X$9$k@_Dj$G$9!%\e(B
-\e$B%3%s%Q%$%i$,\e(B volatile \e$B@k8@$r%5%]!<%H$7$F$$$k$J$i!$\e(B
-
-/* #define NO_VOLATILE */
-
-\e$B$HL$Dj5A$7!$%5%]!<%H$7$F$$$J$1$l$P\e(B
-
-#define NO_VOLATILE
-
-\e$B$HDj5A$K$7$F$/$@$5$$!%\e(B
-
-
 \e$B<!$K!$\e(BGS \e$B$N%I%i%`%Q!<%H$NG'<1$K4X$9$k@_Dj$G$9!%\e(B
 
 #define GS_DRUMPART
index e656ec8..5f9cf9d 100644 (file)
@@ -105,6 +105,7 @@ VERSION = @VERSION@
 WISH = @WISH@
 dynamic_targets = @dynamic_targets@
 lispdir = @lispdir@
+program_transform_name = @program_transform_name@
 so = @so@
 tcltk_dep = @tcltk_dep@
 
diff --git a/NEWS b/NEWS
index 9dc3678..f55d7e3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+* 2/3, 1999
+    Released TiMidity++ v1.3.0.
+    New features and major change from v1.2.x:
+    * Enabled to configure & compile on cygnus.
+    * Improved XAW interface for trace playing.
+    * Improved reverb sounds.
+    * Fixed MIME/Multipart bug.
+
 * 1/25, 1999
     Released TiMidity++ v1.2.1.
     Added missing files.
index 3dd35bb..a757875 100644 (file)
@@ -47,15 +47,13 @@ pkgincludedir = $(includedir)/timidity
 
 #CC= @CC@
 #CFLAGS = @CFLAGS@
-#CPPFLAGS = @CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@ @EXTRADEFS@ -DDEFAULT_PATH=\"$(TIMID_DIR)\"
 #DEFS = @DEFS@
-#EXTRADEFS = @EXTRADEFS@
 #LDFLAGS = @LDFLAGS@
-#LIBS = @LIBS@
-#EXTRALIBS = @EXTRALIBS@
+LIBS = @LIBS@ @EXTRALIBS@
 SHLD = @SHLD@
 SHCFLAGS = @SHCFLAGS@
-DEBUGFLAGS = -Wall
+#@SET_MAKE@
 
 ########### Install.
 #INSTALL = @INSTALL@
@@ -70,8 +68,4 @@ TIMID_DIR = $(pkglibdir)
 TCL_DIR = $(TIMID_DIR)
 #TCL_DIR = $(pkgdatadir)
 
-CFLAGS += $(DEBUGFLAGS)
-DEFS += $(EXTRADEFS) -DDEFAULT_PATH=\"$(TIMID_DIR)\"
-LIBS += $(EXTRALIBS)
-
 .SUFFIXES: .c .h .ptcl .tcl .o .1 .txt .ps .@so@
index 40f0304..7670773 100644 (file)
@@ -56,6 +56,9 @@
 /* Define if you have the gethostbyname function.  */
 #undef HAVE_GETHOSTBYNAME
 
+/* Define if you have the getopt function.  */
+#undef HAVE_GETOPT
+
 /* Define if you have the getpagesize function.  */
 #undef HAVE_GETPAGESIZE
 
@@ -65,6 +68,9 @@
 /* Define if you have the select function.  */
 #undef HAVE_SELECT
 
+/* Define if you have the sleep function.  */
+#undef HAVE_SLEEP
+
 /* Define if you have the snprintf function.  */
 #undef HAVE_SNPRINTF
 
 /* Define if you have the <dlfcn.h> header file.  */
 #undef HAVE_DLFCN_H
 
+/* Define if you have the <errno.h> header file.  */
+#undef HAVE_ERRNO_H
+
 /* Define if you have the <fcntl.h> header file.  */
 #undef HAVE_FCNTL_H
 
index 9e9d974..a6b0dd3 100755 (executable)
--- a/configure
+++ b/configure
@@ -836,7 +836,7 @@ fi
 
 PACKAGE=TiMidity++
 
-VERSION=1.2.1
+VERSION=1.3.0
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
@@ -1330,6 +1330,7 @@ fi
 
 case "$target" in
   *-*-hpux*)
+    EXTRADEFS="-DHPUX"
     test -n "$SHLD" || SHLD="ld -b"
     so="sl"
     ;;
@@ -1342,16 +1343,23 @@ case "$target" in
     test -n "$SHLD" || SHLD="ld -Bforcearchive -Bshareable"
     so="so"
     ;;
-  *-*-freebsd2*)
-    EXTRALIBS="$EXTRALIBS -lxpg4"
-    test -n "$SHLD" || SHLD="ld -Bshareable"
-    so="so"
-    ;;
+
+#  *-*-freebsd2*)
+#    EXTRALIBS="$EXTRALIBS -lxpg4"
+#    test -n "$SHLD" || SHLD="ld -Bshareable"
+#    so="so"
+#    ;;
+#  *-*-freebsd*)
+#    SHCFLAGS=-aout
+#    EXTRALIBS="$EXTRALIBS -lxpg4"
+#    SHLDFLAGS="-L/usr/X11R6/lib/aout $SHLDFLAGS"
+#    test -n "$SHLD" || SHLD="env OBJFORMAT=aout ld -shared"
+#    so="so"
+#    ;;
+
   *-*-freebsd*)
-    EXTRACFLAGS=-aout
     EXTRALIBS="$EXTRALIBS -lxpg4"
-    SHLDFLAGS="-L/usr/X11R6/aout $SHLDFLAGS"
-    test -n "$SHLD" || SHLD="env OBJFORMAT=aout ld -shared"
+    test -n "$SHLD" || SHLD="ld -Bshareable"
     so="so"
     ;;
   *-*-cygwin32*)
@@ -1364,7 +1372,8 @@ case "$target" in
       *) test -n "$SHLD" || SHLD="unknown" ;;
     esac
     so="dll"
-    CYGWIN32=yes
+    CYGNUS=yes
+    program_suffix=.exe
     ;;
   *-dec-*)
     EXTRADEFS="-DDEC"
@@ -1383,7 +1392,7 @@ case "$target" in
 esac
 
 echo $ac_n "checking for sqrt in -lm""... $ac_c" 1>&6
-echo "configure:1387: checking for sqrt in -lm" >&5
+echo "configure:1396: checking for sqrt in -lm" >&5
 ac_lib_var=`echo m'_'sqrt | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1391,7 +1400,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1395 "configure"
+#line 1404 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1402,7 +1411,7 @@ int main() {
 sqrt()
 ; return 0; }
 EOF
-if { (eval echo configure:1406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1430,7 +1439,7 @@ else
 fi
 
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:1434: checking for socket in -lsocket" >&5
+echo "configure:1443: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1438,7 +1447,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1442 "configure"
+#line 1451 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1449,7 +1458,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:1453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1477,7 +1486,7 @@ else
 fi
 
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:1481: checking for dlopen in -ldl" >&5
+echo "configure:1490: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1485,7 +1494,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1489 "configure"
+#line 1498 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1496,7 +1505,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:1500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1519,12 +1528,12 @@ fi
 for ac_func in gethostbyname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1523: checking for $ac_func" >&5
+echo "configure:1532: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1528 "configure"
+#line 1537 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1547,7 +1556,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1569,7 +1578,7 @@ EOF
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:1573: checking for gethostbyname in -lnsl" >&5
+echo "configure:1582: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1577,7 +1586,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1581 "configure"
+#line 1590 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1588,7 +1597,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:1592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1619,7 +1628,7 @@ fi
 done
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1623: checking how to run the C preprocessor" >&5
+echo "configure:1632: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1634,13 +1643,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1638 "configure"
+#line 1647 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1644: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1653: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1651,13 +1660,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1655 "configure"
+#line 1664 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1661: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1670: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1684,7 +1693,7 @@ echo "$ac_t""$CPP" 1>&6
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:1688: checking for X" >&5
+echo "configure:1697: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -1746,12 +1755,12 @@ if test "$ac_x_includes" = NO; then
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 1750 "configure"
+#line 1759 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1755: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1764: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1820,14 +1829,14 @@ if test "$ac_x_libraries" = NO; then
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1824 "configure"
+#line 1833 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:1831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -1933,17 +1942,17 @@ else
     case "`(uname -sr) 2>/dev/null`" in
     "SunOS 5"*)
       echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:1937: checking whether -R must be followed by a space" >&5
+echo "configure:1946: checking whether -R must be followed by a space" >&5
       ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
       cat > conftest.$ac_ext <<EOF
-#line 1940 "configure"
+#line 1949 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -1959,14 +1968,14 @@ rm -f conftest*
       else
        LIBS="$ac_xsave_LIBS -R $x_libraries"
        cat > conftest.$ac_ext <<EOF
-#line 1963 "configure"
+#line 1972 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -1998,7 +2007,7 @@ rm -f conftest*
     # libraries were built with DECnet support.  And karl@cs.umb.edu says
     # the Alpha needs dnet_stub (dnet does not exist).
     echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:2002: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:2011: checking for dnet_ntoa in -ldnet" >&5
 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2006,7 +2015,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2010 "configure"
+#line 2019 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2017,7 +2026,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2039,7 +2048,7 @@ fi
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
       echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:2043: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:2052: checking for dnet_ntoa in -ldnet_stub" >&5
 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2047,7 +2056,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2051 "configure"
+#line 2060 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2058,7 +2067,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2087,12 +2096,12 @@ fi
     # The nsl library prevents programs from opening the X display
     # on Irix 5.2, according to dickey@clark.net.
     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:2091: checking for gethostbyname" >&5
+echo "configure:2100: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2096 "configure"
+#line 2105 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -2115,7 +2124,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -2136,7 +2145,7 @@ fi
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2140: checking for gethostbyname in -lnsl" >&5
+echo "configure:2149: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2144,7 +2153,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2148 "configure"
+#line 2157 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2155,7 +2164,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2185,12 +2194,12 @@ fi
     # -lsocket must be given before -lnsl if both are needed.
     # We assume that if connect needs -lnsl, so does gethostbyname.
     echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:2189: checking for connect" >&5
+echo "configure:2198: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2194 "configure"
+#line 2203 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -2213,7 +2222,7 @@ connect();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -2234,7 +2243,7 @@ fi
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:2238: checking for connect in -lsocket" >&5
+echo "configure:2247: checking for connect in -lsocket" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2242,7 +2251,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2246 "configure"
+#line 2255 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2253,7 +2262,7 @@ int main() {
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:2257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2277,12 +2286,12 @@ fi
 
     # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
     echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:2281: checking for remove" >&5
+echo "configure:2290: checking for remove" >&5
 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2286 "configure"
+#line 2295 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -2305,7 +2314,7 @@ remove();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -2326,7 +2335,7 @@ fi
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:2330: checking for remove in -lposix" >&5
+echo "configure:2339: checking for remove in -lposix" >&5
 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2334,7 +2343,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2338 "configure"
+#line 2347 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2345,7 +2354,7 @@ int main() {
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:2349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2369,12 +2378,12 @@ fi
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:2373: checking for shmat" >&5
+echo "configure:2382: checking for shmat" >&5
 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2378 "configure"
+#line 2387 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -2397,7 +2406,7 @@ shmat();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -2418,7 +2427,7 @@ fi
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:2422: checking for shmat in -lipc" >&5
+echo "configure:2431: checking for shmat in -lipc" >&5
 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2426,7 +2435,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2430 "configure"
+#line 2439 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2437,7 +2446,7 @@ int main() {
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:2441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2470,7 +2479,7 @@ fi
   # libraries we check for below, so use a different variable.
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:2474: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:2483: checking for IceConnectionNumber in -lICE" >&5
 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2478,7 +2487,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lICE  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2482 "configure"
+#line 2491 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2489,7 +2498,7 @@ int main() {
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:2493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2530,7 +2539,7 @@ if test "x$with_x" = xyes; then
   fi
 
   echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
-echo "configure:2534: checking for XOpenDisplay in -lX11" >&5
+echo "configure:2543: checking for XOpenDisplay in -lX11" >&5
 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2538,7 +2547,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lX11  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2542 "configure"
+#line 2551 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2549,7 +2558,7 @@ int main() {
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:2553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2577,12 +2586,12 @@ else
 fi
 
   echo $ac_n "checking X11 version 6""... $ac_c" 1>&6
-echo "configure:2581: checking X11 version 6" >&5
+echo "configure:2590: checking X11 version 6" >&5
   if eval "test \"`echo '$''{'timidity_cv_x11_version_6'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2586 "configure"
+#line 2595 "configure"
 #include "confdefs.h"
 #include <X11/Xlib.h>
 int main() {
@@ -2592,7 +2601,7 @@ fail;
 
 ; return 0; }
 EOF
-if { (eval echo configure:2596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   timidity_cv_x11_version_6=yes
 else
@@ -2612,7 +2621,7 @@ fi
 
     KEEPLIBS=$LIBS
   echo $ac_n "checking for XShapeCombineMask in -lXext""... $ac_c" 1>&6
-echo "configure:2616: checking for XShapeCombineMask in -lXext" >&5
+echo "configure:2625: checking for XShapeCombineMask in -lXext" >&5
 ac_lib_var=`echo Xext'_'XShapeCombineMask | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2620,7 +2629,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXext  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2624 "configure"
+#line 2633 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2631,7 +2640,7 @@ int main() {
 XShapeCombineMask()
 ; return 0; }
 EOF
-if { (eval echo configure:2635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2653,7 +2662,7 @@ have_xext=no
 fi
 
   echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:2657: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:2666: checking for IceConnectionNumber in -lICE" >&5
 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2661,7 +2670,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lICE  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2665 "configure"
+#line 2674 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2672,7 +2681,7 @@ int main() {
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:2676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2700,7 +2709,7 @@ else
 fi
 
   echo $ac_n "checking for SmcOpenConnection in -lSM""... $ac_c" 1>&6
-echo "configure:2704: checking for SmcOpenConnection in -lSM" >&5
+echo "configure:2713: checking for SmcOpenConnection in -lSM" >&5
 ac_lib_var=`echo SM'_'SmcOpenConnection | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2708,7 +2717,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lSM  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2712 "configure"
+#line 2721 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2719,7 +2728,7 @@ int main() {
 SmcOpenConnection()
 ; return 0; }
 EOF
-if { (eval echo configure:2723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2741,7 +2750,7 @@ have_xprelibs=no
 fi
 
   echo $ac_n "checking for XtVaAppInitialize in -lXt""... $ac_c" 1>&6
-echo "configure:2745: checking for XtVaAppInitialize in -lXt" >&5
+echo "configure:2754: checking for XtVaAppInitialize in -lXt" >&5
 ac_lib_var=`echo Xt'_'XtVaAppInitialize | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2749,7 +2758,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2753 "configure"
+#line 2762 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2760,7 +2769,7 @@ int main() {
 XtVaAppInitialize()
 ; return 0; }
 EOF
-if { (eval echo configure:2764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2782,7 +2791,7 @@ have_xt=no
 fi
 
   echo $ac_n "checking for XmuInternAtom in -lXmu""... $ac_c" 1>&6
-echo "configure:2786: checking for XmuInternAtom in -lXmu" >&5
+echo "configure:2795: checking for XmuInternAtom in -lXmu" >&5
 ac_lib_var=`echo Xmu'_'XmuInternAtom | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2790,7 +2799,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXmu  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2794 "configure"
+#line 2803 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2801,7 +2810,7 @@ int main() {
 XmuInternAtom()
 ; return 0; }
 EOF
-if { (eval echo configure:2805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2822,7 +2831,7 @@ else
 fi
 
   echo $ac_n "checking for XawInitializeWidgetSet in -lXaw3d""... $ac_c" 1>&6
-echo "configure:2826: checking for XawInitializeWidgetSet in -lXaw3d" >&5
+echo "configure:2835: checking for XawInitializeWidgetSet in -lXaw3d" >&5
 ac_lib_var=`echo Xaw3d'_'XawInitializeWidgetSet | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2830,7 +2839,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXaw3d  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2834 "configure"
+#line 2843 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2841,7 +2850,7 @@ int main() {
 XawInitializeWidgetSet()
 ; return 0; }
 EOF
-if { (eval echo configure:2845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2860,7 +2869,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
  echo $ac_n "checking for XawInitializeWidgetSet in -lXaw""... $ac_c" 1>&6
-echo "configure:2864: checking for XawInitializeWidgetSet in -lXaw" >&5
+echo "configure:2873: checking for XawInitializeWidgetSet in -lXaw" >&5
 ac_lib_var=`echo Xaw'_'XawInitializeWidgetSet | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2868,7 +2877,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXaw  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2872 "configure"
+#line 2881 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2879,7 +2888,7 @@ int main() {
 XawInitializeWidgetSet()
 ; return 0; }
 EOF
-if { (eval echo configure:2883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2903,7 +2912,7 @@ fi
 fi
 
   echo $ac_n "checking for XmCreateForm in -lXm""... $ac_c" 1>&6
-echo "configure:2907: checking for XmCreateForm in -lXm" >&5
+echo "configure:2916: checking for XmCreateForm in -lXm" >&5
 ac_lib_var=`echo Xm'_'XmCreateForm | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2911,7 +2920,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2915 "configure"
+#line 2924 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2922,7 +2931,7 @@ int main() {
 XmCreateForm()
 ; return 0; }
 EOF
-if { (eval echo configure:2926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2952,12 +2961,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:2956: checking for $ac_hdr that defines DIR" >&5
+echo "configure:2965: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2961 "configure"
+#line 2970 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -2965,7 +2974,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:2969: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -2990,7 +2999,7 @@ done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:2994: checking for opendir in -ldir" >&5
+echo "configure:3003: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2998,7 +3007,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3002 "configure"
+#line 3011 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3009,7 +3018,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:3013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3031,7 +3040,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:3035: checking for opendir in -lx" >&5
+echo "configure:3044: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3039,7 +3048,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3043 "configure"
+#line 3052 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3050,7 +3059,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:3054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3073,12 +3082,12 @@ fi
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3077: checking for ANSI C header files" >&5
+echo "configure:3086: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3082 "configure"
+#line 3091 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -3086,7 +3095,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3090: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3099: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3103,7 +3112,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3107 "configure"
+#line 3116 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3121,7 +3130,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3125 "configure"
+#line 3134 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3142,7 +3151,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 3146 "configure"
+#line 3155 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3153,7 +3162,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:3157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -3177,12 +3186,12 @@ EOF
 fi
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:3181: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:3190: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3186 "configure"
+#line 3195 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -3198,7 +3207,7 @@ wait (&s);
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:3202: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3211: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -3218,21 +3227,21 @@ EOF
 
 fi
 
-for ac_hdr in fcntl.h limits.h malloc.h strings.h sys/ioctl.h sys/time.h unistd.h dlfcn.h glob.h getopt.h
+for ac_hdr in fcntl.h limits.h malloc.h strings.h sys/ioctl.h sys/time.h unistd.h dlfcn.h glob.h getopt.h errno.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3226: checking for $ac_hdr" >&5
+echo "configure:3235: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3231 "configure"
+#line 3240 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3260,17 +3269,17 @@ done
 
 ac_safe=`echo "string.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for string.h""... $ac_c" 1>&6
-echo "configure:3264: checking for string.h" >&5
+echo "configure:3273: checking for string.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3269 "configure"
+#line 3278 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3274: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3283: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3294,12 +3303,12 @@ fi
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3298: checking for working const" >&5
+echo "configure:3307: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3303 "configure"
+#line 3312 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3348,7 +3357,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:3352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3369,14 +3378,14 @@ EOF
 fi
 
 echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:3373: checking whether char is unsigned" >&5
+echo "configure:3382: checking whether char is unsigned" >&5
 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$GCC" = yes; then
   # GCC predefines this symbol on systems where it applies.
 cat > conftest.$ac_ext <<EOF
-#line 3380 "configure"
+#line 3389 "configure"
 #include "confdefs.h"
 #ifdef __CHAR_UNSIGNED__
   yes
@@ -3398,7 +3407,7 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3402 "configure"
+#line 3411 "configure"
 #include "confdefs.h"
 /* volatile prevents gcc2 from optimizing the test away on sparcs.  */
 #if !defined(__STDC__) || __STDC__ != 1
@@ -3408,7 +3417,7 @@ main() {
   volatile char c = 255; exit(c < 0);
 }
 EOF
-if { (eval echo configure:3412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_char_unsigned=yes
 else
@@ -3432,14 +3441,14 @@ EOF
 fi
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:3436: checking whether byte ordering is bigendian" >&5
+echo "configure:3445: checking whether byte ordering is bigendian" >&5
 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 3443 "configure"
+#line 3452 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3450,11 +3459,11 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 3458 "configure"
+#line 3467 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3465,7 +3474,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3469: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -3485,7 +3494,7 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3489 "configure"
+#line 3498 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -3498,7 +3507,7 @@ main () {
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:3502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
@@ -3522,21 +3531,21 @@ EOF
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:3526: checking for inline" >&5
+echo "configure:3535: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 3533 "configure"
+#line 3542 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:3540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3549: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -3562,12 +3571,12 @@ EOF
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:3566: checking for off_t" >&5
+echo "configure:3575: checking for off_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3571 "configure"
+#line 3580 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3595,12 +3604,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:3599: checking for pid_t" >&5
+echo "configure:3608: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3604 "configure"
+#line 3613 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3628,12 +3637,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3632: checking for size_t" >&5
+echo "configure:3641: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3637 "configure"
+#line 3646 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3661,12 +3670,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3665: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:3674: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3670 "configure"
+#line 3679 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -3675,7 +3684,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:3679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3688: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3697,19 +3706,19 @@ fi
 
 
 echo $ac_n "checking volatile declaration""... $ac_c" 1>&6
-echo "configure:3701: checking volatile declaration" >&5
+echo "configure:3710: checking volatile declaration" >&5
 if eval "test \"`echo '$''{'timidity_cv_type_volatile'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3706 "configure"
+#line 3715 "configure"
 #include "confdefs.h"
 
 int main() {
 volatile int x
 ; return 0; }
 EOF
-if { (eval echo configure:3713: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   timidity_cv_type_volatile=yes
 else
@@ -3727,12 +3736,12 @@ if test $timidity_cv_type_volatile = no; then
 fi
 
 echo $ac_n "checking union semun declaration""... $ac_c" 1>&6
-echo "configure:3731: checking union semun declaration" >&5
+echo "configure:3740: checking union semun declaration" >&5
 if eval "test \"`echo '$''{'timidity_cv_type_union_semun'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3736 "configure"
+#line 3745 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ipc.h>
@@ -3741,7 +3750,7 @@ int main() {
 union semun x
 ; return 0; }
 EOF
-if { (eval echo configure:3745: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3754: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   timidity_cv_type_union_semun=yes
 else
@@ -3760,13 +3769,13 @@ fi
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:3764: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:3773: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 3770 "configure"
+#line 3779 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -3784,7 +3793,7 @@ rm -f conftest*
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 3788 "configure"
+#line 3797 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -3806,7 +3815,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
 fi
 
 echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:3810: checking for 8-bit clean memcmp" >&5
+echo "configure:3819: checking for 8-bit clean memcmp" >&5
 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3814,7 +3823,7 @@ else
   ac_cv_func_memcmp_clean=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 3818 "configure"
+#line 3827 "configure"
 #include "confdefs.h"
 
 main()
@@ -3824,7 +3833,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:3828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_memcmp_clean=yes
 else
@@ -3845,17 +3854,17 @@ for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3849: checking for $ac_hdr" >&5
+echo "configure:3858: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3854 "configure"
+#line 3863 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3859: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3868: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3884,12 +3893,12 @@ done
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3888: checking for $ac_func" >&5
+echo "configure:3897: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3893 "configure"
+#line 3902 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3912,7 +3921,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3937,7 +3946,7 @@ fi
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3941: checking for working mmap" >&5
+echo "configure:3950: checking for working mmap" >&5
 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3945,7 +3954,7 @@ else
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 3949 "configure"
+#line 3958 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -4085,7 +4094,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:4089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_mmap_fixed_mapped=yes
 else
@@ -4108,7 +4117,7 @@ EOF
 fi
 
 echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6
-echo "configure:4112: checking whether setvbuf arguments are reversed" >&5
+echo "configure:4121: checking whether setvbuf arguments are reversed" >&5
 if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4116,7 +4125,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4120 "configure"
+#line 4129 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 /* If setvbuf has the reversed format, exit 0. */
@@ -4130,7 +4139,7 @@ main () {
   exit(0);                     /* Non-reversed systems segv here.  */
 }
 EOF
-if { (eval echo configure:4134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_setvbuf_reversed=yes
 else
@@ -4154,12 +4163,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:4158: checking return type of signal handlers" >&5
+echo "configure:4167: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4163 "configure"
+#line 4172 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -4176,7 +4185,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:4180: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -4195,12 +4204,12 @@ EOF
 
 
 echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:4199: checking for vprintf" >&5
+echo "configure:4208: checking for vprintf" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4204 "configure"
+#line 4213 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vprintf(); below.  */
@@ -4223,7 +4232,7 @@ vprintf();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_vprintf=yes"
 else
@@ -4247,12 +4256,12 @@ fi
 
 if test "$ac_cv_func_vprintf" != yes; then
 echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:4251: checking for _doprnt" >&5
+echo "configure:4260: checking for _doprnt" >&5
 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4256 "configure"
+#line 4265 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt(); below.  */
@@ -4275,7 +4284,7 @@ _doprnt();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func__doprnt=yes"
 else
@@ -4299,15 +4308,15 @@ fi
 
 fi
 
-for ac_func in gettimeofday select socket strdup strstr vsnprintf snprintf usleep strncasecmp strerror
+for ac_func in gettimeofday select socket strdup strstr vsnprintf snprintf sleep usleep strncasecmp strerror getopt
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4306: checking for $ac_func" >&5
+echo "configure:4315: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4311 "configure"
+#line 4320 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4330,7 +4339,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4355,66 +4364,61 @@ fi
 done
 
 
-# check getopt
-echo $ac_n "checking for getopt""... $ac_c" 1>&6
-echo "configure:4361: checking for getopt" >&5
-if eval "test \"`echo '$''{'ac_cv_func_getopt'+set}'`\" = set"; then
+
+if test "x$CYGNUS" = xyes; then
+  echo $ac_n "checking for opendir""... $ac_c" 1>&6
+echo "configure:4371: checking for opendir" >&5
+if eval "test \"`echo '$''{'ac_cv_func_opendir'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4366 "configure"
+#line 4376 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char getopt(); below.  */
+    which can conflict with char opendir(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char getopt();
+char opendir();
 
 int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_getopt) || defined (__stub___getopt)
+#if defined (__stub_opendir) || defined (__stub___opendir)
 choke me
 #else
-getopt();
+opendir();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
-  eval "ac_cv_func_getopt=yes"
+  eval "ac_cv_func_opendir=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_getopt=no"
+  eval "ac_cv_func_opendir=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'getopt`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'opendir`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  has_getopt=yes
+  :
 else
   echo "$ac_t""no" 1>&6
-has_getopt=no
+ EXTRADEFS="$EXTRADEFS -D__W32READDIR__"
+         W32READDIR=yes 
 fi
 
-
-
-if test $has_getopt = no; then
-  NEED_GETOPT_TRUE=
-  NEED_GETOPT_FALSE='#'
-else
-  NEED_GETOPT_TRUE='#'
-  NEED_GETOPT_FALSE=
 fi
 
+
 # Check whether --with-tcl-includes or --without-tcl-includes was given.
 if test "${with_tcl_includes+set}" = set; then
   withval="$with_tcl_includes"
@@ -4474,7 +4478,7 @@ fi
 
 
 echo $ac_n "checking whether to enable audio""... $ac_c" 1>&6
-echo "configure:4478: checking whether to enable audio" >&5
+echo "configure:4482: checking whether to enable audio" >&5
 # Check whether --enable-audio or --disable-audio was given.
 if test "${enable_audio+set}" = set; then
   enableval="$enable_audio"
@@ -4520,7 +4524,7 @@ fi
 
 
 echo $ac_n "checking for ALSA CFLAGS""... $ac_c" 1>&6
-echo "configure:4524: checking for ALSA CFLAGS" >&5
+echo "configure:4528: checking for ALSA CFLAGS" >&5
 if test "$alsa_inc_prefix" != "" ; then
        ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
         CFLAGS="$CFLAGS -I$alsa_inc_prefix"
@@ -4528,7 +4532,7 @@ fi
 echo "$ac_t""$ALSA_CFLAGS" 1>&6
 
 echo $ac_n "checking for ALSA LDFLAGS""... $ac_c" 1>&6
-echo "configure:4532: checking for ALSA LDFLAGS" >&5
+echo "configure:4536: checking for ALSA LDFLAGS" >&5
 if test "$alsa_prefix" != "" ; then
        ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
        LIBS="-L$alsa_prefix"
@@ -4540,7 +4544,7 @@ echo "$ac_t""$ALSA_LIBS" 1>&6
 
 min_alsa_version=0.1.1
 echo $ac_n "checking for libasound headers version >= $min_alsa_version""... $ac_c" 1>&6
-echo "configure:4544: checking for libasound headers version >= $min_alsa_version" >&5
+echo "configure:4548: checking for libasound headers version >= $min_alsa_version" >&5
 no_alsa=""
     alsa_min_major_version=`echo $min_alsa_version | \
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
@@ -4550,7 +4554,7 @@ no_alsa=""
            sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
 
 cat > conftest.$ac_ext <<EOF
-#line 4554 "configure"
+#line 4558 "configure"
 #include "confdefs.h"
 
 #include <sys/asoundlib.h>
@@ -4591,7 +4595,7 @@ exit(0);
 
 ; return 0; }
 EOF
-if { (eval echo configure:4595: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""found." 1>&6
    have_alsa=yes
@@ -4605,7 +4609,7 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for snd_cards in -lasound""... $ac_c" 1>&6
-echo "configure:4609: checking for snd_cards in -lasound" >&5
+echo "configure:4613: checking for snd_cards in -lasound" >&5
 ac_lib_var=`echo asound'_'snd_cards | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4613,7 +4617,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lasound  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4617 "configure"
+#line 4621 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4624,7 +4628,7 @@ int main() {
 snd_cards()
 ; return 0; }
 EOF
-if { (eval echo configure:4628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4673,7 +4677,7 @@ fi
       echo "$ac_t""yes bsdi" 1>&6
       ;;
     *-*-hpux*)
-      EXTRADEFS="$EXTRADEFS -DHPUX -DAU_HPUX"
+      EXTRADEFS="$EXTRADEFS -DAU_HPUX"
       SYSEXTRAS="$SYSEXTRAS hpux_d_a.c hpux_a.c"
       if test -d /opt/audio/include; then
         CPPFLAGS="$CPPFLAGS -I/opt/audio/include"
@@ -4731,7 +4735,8 @@ fi
     *-*-cygwin32*)
       EXTRADEFS="$EXTRADEFS -DAU_WIN32"
       SYSEXTRAS="$SYSEXTRAS win_a.c"
-      echo "$ac_t""yes cygwin32" 1>&6
+      EXTRALIBS="$EXTRALIBS -lwinmm"
+      echo "$ac_t""yes cygnus" 1>&6
       ;;
     *)
       EXTRADEFS="$EXTRADEFS -DAU_NONE -DAU_AUDRIV"
@@ -4759,18 +4764,18 @@ case "$enable_ncurses$enable_slang$enable_motif$enable_tcltk$enable_emacs$enable
 *)         NEEDDLOPEN=no;;
 esac
 
-case "$CC " in "gcc "*) SHCFLAGS="-fPIC";; esac
+case "$CC " in "gcc "*) SHCFLAGS="$SHCFLAGS -fPIC";; esac
 case "x$enable_ump" in xyes|xdynamic) EXTRACFLAGS="$EXTRACFLAGS -DXP_UNIX $SHCFLAGS";; esac
 
 if test "$NEEDDLOPEN" = "yes"; then
   have_dl=no
   echo $ac_n "checking for LoadLibraryExA""... $ac_c" 1>&6
-echo "configure:4769: checking for LoadLibraryExA" >&5
+echo "configure:4774: checking for LoadLibraryExA" >&5
 if eval "test \"`echo '$''{'ac_cv_func_LoadLibraryExA'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4774 "configure"
+#line 4779 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char LoadLibraryExA(); below.  */
@@ -4793,7 +4798,7 @@ LoadLibraryExA();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_LoadLibraryExA=yes"
 else
@@ -4814,12 +4819,12 @@ fi
 
   if test "$have_dl" = "no"; then
     echo $ac_n "checking for shl_load""... $ac_c" 1>&6
-echo "configure:4818: checking for shl_load" >&5
+echo "configure:4823: checking for shl_load" >&5
 if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4823 "configure"
+#line 4828 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shl_load(); below.  */
@@ -4842,7 +4847,7 @@ shl_load();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_shl_load=yes"
 else
@@ -4867,12 +4872,12 @@ fi
   fi
   if test "$have_dl" = "no"; then
     echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:4871: checking for dlopen" >&5
+echo "configure:4876: checking for dlopen" >&5
 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4876 "configure"
+#line 4881 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlopen(); below.  */
@@ -4895,7 +4900,7 @@ dlopen();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_dlopen=yes"
 else
@@ -4917,12 +4922,12 @@ fi
   fi
   if test "$have_dl" = "no"; then
     echo $ac_n "checking for dld_init""... $ac_c" 1>&6
-echo "configure:4921: checking for dld_init" >&5
+echo "configure:4926: checking for dld_init" >&5
 if eval "test \"`echo '$''{'ac_cv_func_dld_init'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4926 "configure"
+#line 4931 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dld_init(); below.  */
@@ -4945,7 +4950,7 @@ dld_init();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_dld_init=yes"
 else
@@ -4967,7 +4972,7 @@ fi
   fi
   if test "$have_dl" = "no"; then
     echo $ac_n "checking for dld_init in -ldld""... $ac_c" 1>&6
-echo "configure:4971: checking for dld_init in -ldld" >&5
+echo "configure:4976: checking for dld_init in -ldld" >&5
 ac_lib_var=`echo dld'_'dld_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4975,7 +4980,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4979 "configure"
+#line 4984 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4986,7 +4991,7 @@ int main() {
 dld_init()
 ; return 0; }
 EOF
-if { (eval echo configure:4990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5009,13 +5014,13 @@ fi
   fi
 
   echo $ac_n "checking dynamic link method""... $ac_c" 1>&6
-echo "configure:5013: checking dynamic link method" >&5
+echo "configure:5018: checking dynamic link method" >&5
   case "$have_dl" in
     dlopen)
       echo "$ac_t""use dl_dlopen.c" 1>&6
       SYSEXTRAS="$SYSEXTRAS dl_dlopen.c"
       echo $ac_n "checking whether your dlsym() needs a leading underscore""... $ac_c" 1>&6
-echo "configure:5019: checking whether your dlsym() needs a leading underscore" >&5
+echo "configure:5024: checking whether your dlsym() needs a leading underscore" >&5
 if eval "test \"`echo '$''{'timidity_cv_func_dlsym_underscore'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5163,17 +5168,17 @@ if test "${enable_ncurses+set}" = set; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5167: checking for $ac_hdr" >&5
+echo "configure:5172: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5172 "configure"
+#line 5177 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5200,7 +5205,7 @@ fi
 done
 
     echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:5204: checking for initscr in -lncurses" >&5
+echo "configure:5209: checking for initscr in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5208,7 +5213,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5212 "configure"
+#line 5217 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5219,7 +5224,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5298,7 +5303,7 @@ if test "${enable_slang+set}" = set; then
   enableval="$enable_slang"
   case "x$enable_slang" in xyes|xdynamic)  KEEPLIBS=$LIBS
     echo $ac_n "checking for SLang_init_tty in -lslang""... $ac_c" 1>&6
-echo "configure:5302: checking for SLang_init_tty in -lslang" >&5
+echo "configure:5307: checking for SLang_init_tty in -lslang" >&5
 ac_lib_var=`echo slang'_'SLang_init_tty | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5306,7 +5311,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lslang  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5310 "configure"
+#line 5315 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5317,7 +5322,7 @@ int main() {
 SLang_init_tty()
 ; return 0; }
 EOF
-if { (eval echo configure:5321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5370,7 +5375,7 @@ xdynamic)
   dynamic_targets="$dynamic_targets interface_s.\$(so)"
    s_so_libs="-lslang"
     echo $ac_n "checking for initscr in -ltermcap""... $ac_c" 1>&6
-echo "configure:5374: checking for initscr in -ltermcap" >&5
+echo "configure:5379: checking for initscr in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5378,7 +5383,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5382 "configure"
+#line 5387 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5389,7 +5394,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5507,7 +5512,7 @@ if test "${enable_tcltk+set}" = set; then
     tk_lib=
     for l in tcl tcl8.0jp tcl7.6jp tcl80jp tcl76jp tcl8.0 tcl7.6 tcl80 tcl76; do
       case "x$tcl_lib" in x) echo $ac_n "checking for Tcl_Init in -l$l""... $ac_c" 1>&6
-echo "configure:5511: checking for Tcl_Init in -l$l" >&5
+echo "configure:5516: checking for Tcl_Init in -l$l" >&5
 ac_lib_var=`echo $l'_'Tcl_Init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5515,7 +5520,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l$l  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5519 "configure"
+#line 5524 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5526,7 +5531,7 @@ int main() {
 Tcl_Init()
 ; return 0; }
 EOF
-if { (eval echo configure:5530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5550,7 +5555,7 @@ fi
     LIBS="$LIBS $tcl_lib"
     for l in tk tk8.0jp tk4.2jp tk80jp tk42jp tk8.0 tk4.2 tk80 tk42; do
       case "x$tk_lib" in x) echo $ac_n "checking for Tk_Init in -l$l""... $ac_c" 1>&6
-echo "configure:5554: checking for Tk_Init in -l$l" >&5
+echo "configure:5559: checking for Tk_Init in -l$l" >&5
 ac_lib_var=`echo $l'_'Tk_Init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5558,7 +5563,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l$l  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5562 "configure"
+#line 5567 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5569,7 +5574,7 @@ int main() {
 Tk_Init()
 ; return 0; }
 EOF
-if { (eval echo configure:5573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5930,7 +5935,7 @@ fi
   # Extract the first word of "gtk-config", so it can be a program name with args.
 set dummy gtk-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5934: checking for $ac_word" >&5
+echo "configure:5939: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5961,7 +5966,7 @@ fi
 
   min_gtk_version=1.1.3
   echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:5965: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:5970: checking for GTK - version >= $min_gtk_version" >&5
   no_gtk=""
   if test "$GTK_CONFIG" = "no" ; then
     no_gtk=yes
@@ -5984,7 +5989,7 @@ echo "configure:5965: checking for GTK - version >= $min_gtk_version" >&5
   echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
   cat > conftest.$ac_ext <<EOF
-#line 5988 "configure"
+#line 5993 "configure"
 #include "confdefs.h"
 
 #include <gtk/gtk.h>
@@ -6050,7 +6055,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:6054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -6084,7 +6089,7 @@ fi
           CFLAGS="$CFLAGS $GTK_CFLAGS"
           LIBS="$LIBS $GTK_LIBS"
           cat > conftest.$ac_ext <<EOF
-#line 6088 "configure"
+#line 6093 "configure"
 #include "confdefs.h"
 
 #include <gtk/gtk.h>
@@ -6094,7 +6099,7 @@ int main() {
  return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); 
 ; return 0; }
 EOF
-if { (eval echo configure:6098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
    echo "*** The test program compiled, but did not run. This usually means"
           echo "*** that the run-time linker is not finding GTK or finding the wrong"
@@ -6173,17 +6178,17 @@ if test "${enable_ump+set}" = set; then
     fi
     ac_safe=`echo "X11/xpm.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/xpm.h""... $ac_c" 1>&6
-echo "configure:6177: checking for X11/xpm.h" >&5
+echo "configure:6182: checking for X11/xpm.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6182 "configure"
+#line 6187 "configure"
 #include "confdefs.h"
 #include <X11/xpm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6187: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6192: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6206,7 +6211,7 @@ else
 fi
 
     echo $ac_n "checking for XpmCreatePixmapFromData in -lXpm""... $ac_c" 1>&6
-echo "configure:6210: checking for XpmCreatePixmapFromData in -lXpm" >&5
+echo "configure:6215: checking for XpmCreatePixmapFromData in -lXpm" >&5
 ac_lib_var=`echo Xpm'_'XpmCreatePixmapFromData | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6214,7 +6219,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6218 "configure"
+#line 6223 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6225,7 +6230,7 @@ int main() {
 XpmCreatePixmapFromData()
 ; return 0; }
 EOF
-if { (eval echo configure:6229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6297,7 +6302,7 @@ if test "${enable_offix+set}" = set; then
       LDFLAGS="$LDFLAGS $offix_lib_dir"
       LIBS="$LIBS $lib_xmu_opt $lib_xt_opt $lib_xprelibs_opt $lib_xext_opt -lX11"
       echo $ac_n "checking for DndInitialize in -lDnd""... $ac_c" 1>&6
-echo "configure:6301: checking for DndInitialize in -lDnd" >&5
+echo "configure:6306: checking for DndInitialize in -lDnd" >&5
 ac_lib_var=`echo Dnd'_'DndInitialize | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6305,7 +6310,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lDnd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6309 "configure"
+#line 6314 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6316,7 +6321,7 @@ int main() {
 DndInitialize()
 ; return 0; }
 EOF
-if { (eval echo configure:6320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6416,13 +6421,23 @@ fi
 
 
 
-if test "x$CYGWIN32" = "xyes"; then
-  CYGWIN32_TRUE=
-  CYGWIN32_FALSE='#'
+if test "x$CYGNUS" = xyes; then
+  CYGNUS_TRUE=
+  CYGNUS_FALSE='#'
+else
+  CYGNUS_TRUE='#'
+  CYGNUS_FALSE=
+fi
+
+
+if test "x$W32READDIR" = "xyes"; then
+  W32READDIR_TRUE=
+  W32READDIR_FALSE='#'
 else
-  CYGWIN32_TRUE='#'
-  CYGWIN32_FALSE=
+  W32READDIR_TRUE='#'
+  W32READDIR_FALSE=
 fi
+
 rm -f wordtmp >/dev/null 2>&1
 val=''
 for f in $LDFLAGS; do
@@ -6495,6 +6510,7 @@ SHLD="$SHLD $SHLDFLAGS"
 
 
 
+
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
@@ -6675,8 +6691,6 @@ s%@X_PRE_LIBS@%$X_PRE_LIBS%g
 s%@X_LIBS@%$X_LIBS%g
 s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
 s%@LIBOBJS@%$LIBOBJS%g
-s%@NEED_GETOPT_TRUE@%$NEED_GETOPT_TRUE%g
-s%@NEED_GETOPT_FALSE@%$NEED_GETOPT_FALSE%g
 s%@ALSA_CFLAGS@%$ALSA_CFLAGS%g
 s%@ALSA_LIBS@%$ALSA_LIBS%g
 s%@NEEDDLOPEN_TRUE@%$NEEDDLOPEN_TRUE%g
@@ -6724,8 +6738,10 @@ s%@ENABLE_SOUND_SPEC_TRUE@%$ENABLE_SOUND_SPEC_TRUE%g
 s%@ENABLE_SOUND_SPEC_FALSE@%$ENABLE_SOUND_SPEC_FALSE%g
 s%@ENABLE_WRD_TRUE@%$ENABLE_WRD_TRUE%g
 s%@ENABLE_WRD_FALSE@%$ENABLE_WRD_FALSE%g
-s%@CYGWIN32_TRUE@%$CYGWIN32_TRUE%g
-s%@CYGWIN32_FALSE@%$CYGWIN32_FALSE%g
+s%@CYGNUS_TRUE@%$CYGNUS_TRUE%g
+s%@CYGNUS_FALSE@%$CYGNUS_FALSE%g
+s%@W32READDIR_TRUE@%$W32READDIR_TRUE%g
+s%@W32READDIR_FALSE@%$W32READDIR_FALSE%g
 s%@SYSEXTRAS@%$SYSEXTRAS%g
 s%@EXTRALIBS@%$EXTRALIBS%g
 s%@EXTRADEFS@%$EXTRADEFS%g
index e8b728e..345bb0d 100644 (file)
@@ -32,15 +32,15 @@ dnl         ac_cpp:     $CPP $CPPFLAGS
 dnl            ac_compile: ${CC-cc} -c $CFLAGS $CPPFLAGS
 dnl            ac_link:    ${CC-cc} -o * $CFLAGS $CPPFLAGS $LDFLAGS *.c $LIBS
 dnl EXTRACFLAGS - Extra flags to compile.  Adds to CFLAGS.
-dnl EXTRADEFS   - Extra define macros. (AC_SUBST: Adds to CFLAGS)
-dnl EXTRALIBS   - Extra libraries (AC_SUBST: Adds to LIBS)
+dnl EXTRADEFS   - Extra define macros.  Adds to CPPFLAGS.
+dnl EXTRALIBS   - Extra libraries  Adds to LIBS.
 dnl SYSEXTRAS   - Additional source codes to compile.
 dnl lib_*_opt   - Optional libraries. Adds to LIBS.
 dnl LIBRARY_PATH
 dnl            - add to -L LDFLAGS
 dnl C_INCLUDE_PATH
 dnl            - add to -I CPPFLAGS
-dnl CYGWIN32   - `yes' if cygnus win32 environment.
+dnl CYGNUS     - `yes' if cygnus windows environment.
 dnl WISH        - wish
 dnl LN_S       - ln -s
 dnl tcltk_dep  - make dependencies for tcl/tk interface
@@ -54,7 +54,7 @@ dnl SHCFLAGS  - Additional flags to compile shared object library.
 
 AC_INIT(timidity/timidity.c)
 AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE(TiMidity++, 1.2.1, no-define)
+AM_INIT_AUTOMAKE(TiMidity++, 1.3.0, no-define)
 
 dnl To use CONTAINS() macro (See acinclude.m4)
 CONTAINS_INIT
@@ -120,6 +120,7 @@ AC_PROG_LN_S
 dnl Target dependent
 case "$target" in
   *-*-hpux*)
+    EXTRADEFS="-DHPUX"
     test -n "$SHLD" || SHLD="ld -b"
     so="sl"
     ;;
@@ -133,16 +134,23 @@ case "$target" in
     test -n "$SHLD" || SHLD="ld -Bforcearchive -Bshareable"
     so="so"
     ;;
-  *-*-freebsd2*)
-    EXTRALIBS="$EXTRALIBS -lxpg4"
-    test -n "$SHLD" || SHLD="ld -Bshareable"
-    so="so"
-    ;;
+
+#  *-*-freebsd2*)
+#    EXTRALIBS="$EXTRALIBS -lxpg4"
+#    test -n "$SHLD" || SHLD="ld -Bshareable"
+#    so="so"
+#    ;;
+#  *-*-freebsd*)
+#    SHCFLAGS=-aout
+#    EXTRALIBS="$EXTRALIBS -lxpg4"
+#    SHLDFLAGS="-L/usr/X11R6/lib/aout $SHLDFLAGS"
+#    test -n "$SHLD" || SHLD="env OBJFORMAT=aout ld -shared"
+#    so="so"
+#    ;;
+
   *-*-freebsd*)
-    EXTRACFLAGS=-aout
     EXTRALIBS="$EXTRALIBS -lxpg4"
-    SHLDFLAGS="-L/usr/X11R6/aout $SHLDFLAGS"
-    test -n "$SHLD" || SHLD="env OBJFORMAT=aout ld -shared"
+    test -n "$SHLD" || SHLD="ld -Bshareable"
     so="so"
     ;;
   *-*-cygwin32*)
@@ -155,7 +163,8 @@ case "$target" in
       *) test -n "$SHLD" || SHLD="unknown" ;;
     esac
     so="dll"
-    CYGWIN32=yes
+    CYGNUS=yes
+    program_suffix=.exe
     ;;
   *-dec-*)
     EXTRADEFS="-DDEC"
@@ -230,7 +239,7 @@ dnl End of X configure
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h sys/ioctl.h sys/time.h unistd.h dlfcn.h glob.h getopt.h)
+AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h sys/ioctl.h sys/time.h unistd.h dlfcn.h glob.h getopt.h errno.h)
 AC_CHECK_HEADER(string.h,, [ EXTRADEFS="$EXTRADEFS -DNO_STRING_H " ])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
@@ -268,11 +277,16 @@ AC_FUNC_MMAP
 AC_FUNC_SETVBUF_REVERSED
 AC_TYPE_SIGNAL
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(gettimeofday select socket strdup strstr vsnprintf snprintf usleep strncasecmp strerror)
+AC_CHECK_FUNCS(gettimeofday select socket strdup strstr vsnprintf snprintf sleep usleep strncasecmp strerror getopt)
+
+
+dnl checking on cygnus
+if test "x$CYGNUS" = xyes; then
+  AC_CHECK_FUNC(opendir,,
+       [ EXTRADEFS="$EXTRADEFS -D__W32READDIR__"
+         W32READDIR=yes ])
+fi
 
-# check getopt
-AC_CHECK_FUNC(getopt,has_getopt=yes,has_getopt=no)
-AM_CONDITIONAL(NEED_GETOPT, test $has_getopt = no)
 
 dnl tcltk path
 AC_ARG_WITH(tcl-includes,
@@ -348,7 +362,7 @@ if test "$enable_audio" = "yes"; then
       AC_MSG_RESULT(yes bsdi)
       ;;
     *-*-hpux*)
-      EXTRADEFS="$EXTRADEFS -DHPUX -DAU_HPUX"
+      EXTRADEFS="$EXTRADEFS -DAU_HPUX"
       SYSEXTRAS="$SYSEXTRAS hpux_d_a.c hpux_a.c"
       if test -d /opt/audio/include; then
         CPPFLAGS="$CPPFLAGS -I/opt/audio/include"
@@ -406,7 +420,8 @@ if test "$enable_audio" = "yes"; then
     *-*-cygwin32*)
       EXTRADEFS="$EXTRADEFS -DAU_WIN32"
       SYSEXTRAS="$SYSEXTRAS win_a.c"
-      AC_MSG_RESULT(yes cygwin32)
+      EXTRALIBS="$EXTRALIBS -lwinmm"
+      AC_MSG_RESULT(yes cygnus)
       ;;
     *)
       EXTRADEFS="$EXTRADEFS -DAU_NONE -DAU_AUDRIV"
@@ -434,7 +449,7 @@ case "$enable_ncurses$enable_slang$enable_motif$enable_tcltk$enable_emacs$enable
 esac
 
 dnl check -fpic option for gcc
-case "$CC " in "gcc "*) SHCFLAGS="-fPIC";; esac
+case "$CC " in "gcc "*) SHCFLAGS="$SHCFLAGS -fPIC";; esac
 case "x$enable_ump" in xyes|xdynamic) EXTRACFLAGS="$EXTRACFLAGS -DXP_UNIX $SHCFLAGS";; esac
 
 if test "$NEEDDLOPEN" = "yes"; then
@@ -776,7 +791,9 @@ dnl Move -I* in CFLAGS to CPPFLAGS.
 dnl It comes from 
 
 
-AM_CONDITIONAL(CYGWIN32, test "x$CYGWIN32" = "xyes")
+AM_CONDITIONAL(CYGNUS, test "x$CYGNUS" = xyes)
+AM_CONDITIONAL(W32READDIR, test "x$W32READDIR" = "xyes")
+
 SET_UNIQ_WORDS(LDFLAGS,$LDFLAGS)
 SET_UNIQ_WORDS(SHLDFLAGS,$SHLDFLAGS)
 SET_UNIQ_WORDS(CFLAGS,$EXTRACFLAGS $CFLAGS)
@@ -801,6 +818,7 @@ AC_SUBST(so)
 AC_SUBST(LN_S)
 AC_SUBST(WISH)
 AC_SUBST(tcltk_dep)
+AC_SUBST(program_transform_name)
 
 AC_OUTPUT([
 Makefile
index 6f22836..55ab2d2 100644 (file)
@@ -103,6 +103,7 @@ VERSION = @VERSION@
 WISH = @WISH@
 dynamic_targets = @dynamic_targets@
 lispdir = @lispdir@
+program_transform_name = @program_transform_name@
 so = @so@
 tcltk_dep = @tcltk_dep@
 
index fe1f24c..17195aa 100644 (file)
@@ -103,6 +103,7 @@ VERSION = @VERSION@
 WISH = @WISH@
 dynamic_targets = @dynamic_targets@
 lispdir = @lispdir@
+program_transform_name = @program_transform_name@
 so = @so@
 tcltk_dep = @tcltk_dep@
 SUBDIRS = C ja_JP.ujis
index aa87361..cf15d04 100644 (file)
@@ -103,6 +103,7 @@ VERSION = @VERSION@
 WISH = @WISH@
 dynamic_targets = @dynamic_targets@
 lispdir = @lispdir@
+program_transform_name = @program_transform_name@
 so = @so@
 tcltk_dep = @tcltk_dep@
 
index b4fda9e..fabf0ec 100644 (file)
@@ -32,7 +32,7 @@ timidity.cfg \- configure file of TiMidity++
 .BI dir " directory"\r
 \fIdirectory\fP ¤òõº÷¥Ñ¥¹¤Ë²Ã¤¨¤Þ¤¹¡£²Ã¤¨Êý¤Ï\fB\-L\fP ¥ª¥×¥·¥ç¥ó¤ÈƱÍÍ¡£\r
 .br\r
-²þÎÉÈǤǤϡ¢¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤ò¥Ñ¥Ã¥Á¥»¥Ã¥È¤Ë¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£\r
+TiMidity++ ¤Ç¤Ï¡¢¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤ò¥Ñ¥Ã¥Á¥»¥Ã¥È¤Ë¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£\r
 \r
 Îã:\r
 .br\r
index 7a3bd8b..2375fe5 100644 (file)
@@ -136,6 +136,10 @@ WRD_OBJS = \
        x_mag.o
 endif
 
+if CYGNUS
+WRD_WINCON_OBJS = wrdt_wincon.o
+endif
+
 if NEEDDLOPEN
 DYNAMIC_OBJS = dynamic_c.o
 endif
@@ -156,6 +160,7 @@ libinterface_a_LIBADD = \
        $(XSKIN_OBJS) \
        $(GTK_OBJS) \
        $(WRD_OBJS) \
+       $(WRD_WINCON_OBJS) \
        $(DYNAMIC_OBJS) \
        $(SOUND_SPEC_OBJS)
 
index 2f3db47..54e5d06 100644 (file)
@@ -101,6 +101,7 @@ SYSEXTRAS = @SYSEXTRAS@
 VERSION = @VERSION@
 WISH = @WISH@
 lispdir = @lispdir@
+program_transform_name = @program_transform_name@
 so = @so@
 tcltk_dep = @tcltk_dep@
 
@@ -202,6 +203,8 @@ EXTRA_libinterface_a_SOURCES = \
 @ENABLE_WRD_TRUE@      VTPrsTbl.o \
 @ENABLE_WRD_TRUE@      x_mag.o
 
+@CYGNUS_TRUE@WRD_WINCON_OBJS = wrdt_wincon.o
+
 @NEEDDLOPEN_TRUE@DYNAMIC_OBJS = dynamic_c.o
 
 @ENABLE_SOUND_SPEC_TRUE@SOUND_SPEC_OBJS = \
@@ -218,6 +221,7 @@ libinterface_a_LIBADD = \
        $(XSKIN_OBJS) \
        $(GTK_OBJS) \
        $(WRD_OBJS) \
+       $(WRD_WINCON_OBJS) \
        $(DYNAMIC_OBJS) \
        $(SOUND_SPEC_OBJS)
 
@@ -417,11 +421,61 @@ distdir: $(DISTFILES)
          (cd $$subdir && $(MAKE) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
            || exit 1; \
        done
+VTPrsTbl.o: VTPrsTbl.c VTparse.h
 dumb_c.o: dumb_c.c ../config.h ../timidity/timidity.h \
        ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
        ../timidity/output.h ../timidity/controls.h \
        ../timidity/instrum.h ../timidity/playmidi.h \
        ../timidity/readmidi.h
+emacs_c.o: emacs_c.c ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/output.h ../timidity/controls.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/miditrace.h
+motif_c.o: motif_c.c ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/readmidi.h ../timidity/output.h \
+       ../timidity/controls.h motif.h ../timidity/miditrace.h
+motif_i.o: motif_i.c ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/output.h ../timidity/controls.h motif.h \
+       motif_bitmaps/back.xbm motif_bitmaps/next.xbm \
+       motif_bitmaps/prev.xbm motif_bitmaps/restart.xbm \
+       motif_bitmaps/fwd.xbm motif_bitmaps/pause.xbm \
+       motif_bitmaps/quit.xbm motif_bitmaps/timidity.xbm
+motif_p.o: motif_p.c ../config.h ../timidity/timidity.h \
+       ../timidity/controls.h motif.h
+ncurs_c.o: ncurs_c.c ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/readmidi.h ../timidity/output.h \
+       ../timidity/controls.h ../timidity/miditrace.h ../utils/timer.h \
+       ../utils/bitset.h ../libarc/arc.h ../utils/memb.h \
+       ../timidity/mid-j.defs
+slang_c.o: slang_c.c ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/readmidi.h ../timidity/output.h \
+       ../timidity/controls.h ../timidity/miditrace.h ../utils/timer.h
+soundspec.o: soundspec.c ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/output.h ../timidity/controls.h soundspec.h \
+       ../utils/fft.h ../timidity/miditrace.h
+tk_c.o: tk_c.c ../config.h ../timidity/timidity.h ../timidity/common.h \
+       ../libarc/url.h ../utils/mblock.h ../timidity/instrum.h \
+       ../timidity/playmidi.h ../timidity/readmidi.h \
+       ../timidity/output.h ../timidity/controls.h \
+       ../timidity/miditrace.h
+vt100.o: vt100.c ../config.h ../timidity/timidity.h vt100.h
+vt100_c.o: vt100_c.c ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/readmidi.h ../timidity/output.h \
+       ../timidity/controls.h ../timidity/miditrace.h vt100.h \
+       ../utils/timer.h ../utils/bitset.h
 wrdt_dumb.o: wrdt_dumb.c ../config.h ../timidity/timidity.h \
        ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
        ../timidity/instrum.h ../timidity/playmidi.h \
@@ -430,6 +484,47 @@ wrdt_tty.o: wrdt_tty.c ../config.h ../timidity/timidity.h \
        ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
        ../timidity/instrum.h ../timidity/playmidi.h \
        ../timidity/readmidi.h ../timidity/controls.h ../timidity/wrd.h
+wrdt_x.o: wrdt_x.c ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/readmidi.h ../timidity/controls.h ../timidity/wrd.h \
+       x_wrdwindow.h x_mag.h
+x_mag.o: x_mag.c ../config.h ../timidity/timidity.h ../timidity/common.h \
+       ../libarc/url.h ../utils/mblock.h x_mag.h \
+       ../timidity/controls.h ../timidity/wrd.h
+x_wrdwindow.o: x_wrdwindow.c ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h x_mag.h \
+       x_wrdwindow.h VTparse.h ../timidity/wrd.h \
+       ../timidity/controls.h
+xaw_c.o: xaw_c.c ../config.h ../timidity/timidity.h ../timidity/common.h \
+       ../libarc/url.h ../utils/mblock.h ../timidity/instrum.h \
+       ../timidity/playmidi.h ../timidity/readmidi.h \
+       ../timidity/output.h ../timidity/controls.h \
+       ../timidity/miditrace.h ../utils/timer.h xaw.h
+xaw_i.o: xaw_i.c ../config.h xaw.h check.xbm ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/readmidi.h ../timidity/controls.h
+xskin_c.o: xskin_c.c ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/readmidi.h ../timidity/output.h \
+       ../timidity/controls.h ../timidity/miditrace.h xskin.h
+xskin_i.o: xskin_i.c xskin.h ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/output.h ../timidity/controls.h \
+       ../timidity/miditrace.h
+xskin_loadBMP.o: xskin_loadBMP.c ../config.h ../timidity/timidity.h \
+       ../timidity/common.h ../libarc/url.h ../utils/mblock.h \
+       ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/controls.h ../timidity/output.h ../libarc/arc.h \
+       ../utils/memb.h
+xskin_spectrum.o: xskin_spectrum.c xskin.h ../config.h \
+       ../timidity/timidity.h ../timidity/common.h ../libarc/url.h \
+       ../utils/mblock.h ../timidity/instrum.h ../timidity/playmidi.h \
+       ../timidity/output.h ../timidity/controls.h \
+       ../timidity/miditrace.h
 
 info: info-recursive
 dvi: dvi-recursive
index 253ed7d..f562f82 100644 (file)
@@ -103,6 +103,7 @@ VERSION = @VERSION@
 WISH = @WISH@
 dynamic_targets = @dynamic_targets@
 lispdir = @lispdir@
+program_transform_name = @program_transform_name@
 so = @so@
 tcltk_dep = @tcltk_dep@
 
index 0f218f7..553bba0 100644 (file)
@@ -260,7 +260,7 @@ proc fs:update {w} {
        set patbase ""
     }
 
-    foreach i [glob -nocomplain $patbase$filter] {
+    foreach i [lsort -dictionary [glob -nocomplain $patbase$filter]] {
        if ![regexp "^.*/(\[^/\]+)$" $i full base] {
            set base $i
        }
@@ -271,7 +271,7 @@ proc fs:update {w} {
 
     set prev ".."
     $dir insert end $prev
-    foreach i [lsort [glob -nocomplain $patbase$lookall $patbase$filter]] {
+    foreach i [lsort -dictionary [glob -nocomplain $patbase$lookall $patbase$filter]] {
        if {$i == $prev} {continue}
        if ![regexp "^.*/(\[^/\]+)$" $i full base] {
            set base $i
index 4c6f234..52cfc11 100644 (file)
 #ifdef SOLARIS
 #include <sys/filio.h>
 #endif
+#ifndef NO_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
 
 #include "timidity.h"
 #include "controls.h"
@@ -63,7 +69,7 @@ pipe_error(char *st)
 {
     fprintf(stderr,"CONNECTION PROBLEM WITH Gtk+ PROCESS IN %s BECAUSE:%s\n",
            st,
-           sys_errlist[errno]);
+           strerror(errno));
     exit(1);
 }
 
index 3668f73..7e5c757 100644 (file)
@@ -54,4 +54,12 @@ enum{
        MW_SKIN_FILENAME
 };
 
+#define SKIN_ACTION_PREV() {mac_rc=RC_PREVIOUS;mac_HandleControl();}
+#define SKIN_ACTION_PLAY() {mac_rc=RC_CONTINUE;mac_HandleControl();}
+#define SKIN_ACTION_PAUSE() {mac_rc=RC_TOGGLE_PAUSE;mac_HandleControl();}
+#define SKIN_ACTION_STOP() {mac_rc=RC_QUIT;mac_HandleControl();}
+#define SKIN_ACTION_NEXT() {mac_rc=RC_NEXT;mac_HandleControl();}
+#define SKIN_ACTION_EJECT()
+#define SKIN_ACTION_EXIT()
+
 #endif //MAC_C_H
index 192df9f..ae2a7c8 100644 (file)
@@ -51,7 +51,7 @@ typedef struct {
        char    filename[256];
        int             width, hight;
        long    header_pos;
-       uint8   flag[640];
+       uint8   flag[1280]; //for safty
        uint8   *flagA_work, *flagB_work;
        int             flagA_pos, flagB_pos, pixel_pos;
        Ptr             bitMap;
index 9e7f36a..109c8c0 100644 (file)
@@ -98,7 +98,7 @@ static void BlockMoveData_transparent(const void*     srcPtr,  void * destPtr,
        }
 }
 
-static void BlockMoveData_gmode(const void*    srcPtr,  void * destPtr,
+static pascal void BlockMoveData_gmode(const void*     srcPtr,  void * destPtr,
                                                                 Size   byteCount)
 {
        int i, tmp;
@@ -121,7 +121,7 @@ static void BlockMoveData_gmode(const void* srcPtr,  void * destPtr,
 }
 
 #if __MC68K__
-static void mymemmove(const void* srcPtr, void * destPtr,Size byteCount)
+static pascal void mymemmove(const void* srcPtr, void * destPtr,Size byteCount)
 {
        memmove(destPtr, srcPtr, byteCount);
 }
@@ -194,7 +194,7 @@ void MyCopyBits(PixMapHandle srcPixmap, PixMapHandle dstPixmap,
        switch( mode ){
        case 0://srcCopy
                {
-               void (*func)(const void* srcPtr, void * destPtr,Size byteCount);
+               pascal void (*func)(const void* srcPtr, void *  destPtr,Size byteCount);
                if( gmode==0xF ) func=BlockMoveData;
                                else func= BlockMoveData_gmode;
                        if( srcRect.top >= dstRect.top ){
index 8065a41..8bf620e 100644 (file)
@@ -103,6 +103,7 @@ VERSION = @VERSION@
 WISH = @WISH@
 dynamic_targets = @dynamic_targets@
 lispdir = @lispdir@
+program_transform_name = @program_transform_name@
 so = @so@
 tcltk_dep = @tcltk_dep@
 
index 0d37a06..c60f70e 100644 (file)
 #ifdef SOLARIS
 #include <sys/filio.h>
 #endif
+#ifndef NO_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
 
 #include "timidity.h"
 #include "controls.h"
@@ -58,7 +63,7 @@ static void m_pipe_error(char *st)
 {
     fprintf(stderr,"CONNECTION PROBLEM WITH MOTIF PROCESS IN %s BECAUSE:%s"
            NLS,
-           st, sys_errlist[errno]);
+           st, strerror(errno));
     exit(1);
 }
 
index cbf7c44..af06d25 100644 (file)
@@ -103,6 +103,7 @@ VERSION = @VERSION@
 WISH = @WISH@
 dynamic_targets = @dynamic_targets@
 lispdir = @lispdir@
+program_transform_name = @program_transform_name@
 so = @so@
 tcltk_dep = @tcltk_dep@
 
index 8d9a4c6..0d89f99 100644 (file)
@@ -724,7 +724,7 @@ static void k_pipe_error(char *st)
 {
     fprintf(stderr,"CONNECTION PROBLEM WITH TCL/TK PROCESS IN %s BECAUSE:%s\n",
            st,
-           sys_errlist[errno]);
+           strerror(errno));
     exit(1);
 }
 
index 7f6e61e..096d40b 100644 (file)
@@ -39,9 +39,9 @@ lappend auto_path $TclRoot
 #
 
 option add *menu*font "-adobe-helvetica-bold-r-normal--12-*"
-option add *body.curfile.font "-adobe-helvetica-bold-o-normal--17-*"
+option add *body.curfile.font "-adobe-helvetica-bold-o-normal--18-*"
 option add *body.file*font "-adobe-helvetica-medium-r-normal--14-*"
-option add *body*label.font "-adobe-times-bold-i-normal--17-*"
+option add *body*label.font "-adobe-times-bold-i-normal--18-*"
 option add *body*Scale.font "-adobe-times-medium-i-normal--14-*"
 option add *body.text*font "-adobe-helvetica-medium-r-normal--14-*"
 
index 96ef260..04b1d9f 100644 (file)
@@ -35,7 +35,7 @@
 #include <strings.h>
 #endif
 
-#ifndef __WIN32__
+#if !defined(__WIN32__) || defined(__CYGWIN32__)
 #include <unistd.h> /* for sleep */
 #include <sys/time.h>
 #else
@@ -577,6 +577,7 @@ static void ctl_close(void)
     {
        ctl.opened = 0;
        vt100_move(24, 0);
+       vt100_refresh();
     }
 }
 
index 4c33d39..5961a20 100644 (file)
 static int wrdt_open(char *wrdt_opts);
 static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]);
 static void wrdt_update_events(void);
-static void wrdt_start(int /*wrdflag*/){}
+static void wrdt_start(int /*wrdflag*/)
+{
+       ctl->cmsg(CMSG_INFO, VERB_VERBOSE,
+                 "WRD START");
+}
+
 static void wrdt_end(void);
 static void wrdt_close(void);
 
@@ -173,7 +178,7 @@ void dev_remake_disp(Rect rect)
        LOCK_ALL_PIXMAP();
                if( dev_gon_flag) MyCopyBits(GDISP_PIX, DISP_PIX,
                                                                rect, rect, 0, 0xF);
-                       else dev_line(DISP_PIX, rect, 16, 2, 0x1F);
+                       else dev_line(DISP_PIX, rect, 16, 2, 0xFF);
        UNLOCK_ALL_PIXMAP();
        
        dev_text_redraw_rect(rect);
@@ -200,8 +205,8 @@ static void dev_text_clear(int locx1, int locy1, int locx2, int locy2,
 {                                                                      // clear (x1,y1) .... (x2,y1)
        int             y, startx,endx, width;
        
-       if( locx1<1 || COLS<locx1  || locx2<1 || COLS<locx2 || 
-               locy1<1 || LINES<locy1 || locy2<1 || LINES<locy2 ) return;
+       if( locx1<0 || COLS<locx1  || locx2<0 || COLS<locx2 || 
+               locy1<0 || LINES<locy1 || locy2<0 || LINES<locy2 ) return;
        if( locx2 < locx1 ) return;
        
        if( ch==' ' && !(color & 0x08) ){ch=0;}
@@ -622,7 +627,7 @@ static OSErr dev_setup()
        {
                short           fontID;
                SetGWorld(dispWorld,0);
-               GetFNum("\pOsaka¡ÝÅùÉý", &fontID);
+               GetFNum("\pOsaka\81|\93\99\95\9d", &fontID);
                TextFont(fontID);
                TextSize(14);
        }
@@ -679,8 +684,7 @@ start:
        switch(esccode){
        case 0:
        case DEFAULT:
-         wrd_text_color_attr&=~(CATTR_COLORED|CATTR_BGCOLORED|CATTR_TXTCOL_MASK);
-         break;
+         esccode=37; goto start;
 
        case 17: esccode=31; goto start;
        case 18: esccode=34; goto start;
@@ -1078,6 +1082,9 @@ static void wrdt_end(void)
 {
     wrd_argc = 0;
     inkey_flag = 0;
+    ctl->cmsg(CMSG_INFO, VERB_VERBOSE,
+                 "WRD END");
+
 }
 
 static void wrdt_close(void)
@@ -1337,6 +1344,20 @@ static void mac_wrd_event_esc(int esc)
        mac_wrd_doESC(event2string(esc)+1);
 }
 
+static int sry_decode_bindata( char *data )
+{
+       int i;
+       for( i=0; data[i*2]; i++ ){
+               if( data[i*2]==1 ){
+                       data[i]=0;
+               }else{
+                       data[i]=data[i*2+1];
+               }
+       }
+       data[i]='\0';
+       return i;
+}
+
 static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[])
 {
     char *p;
@@ -1626,13 +1647,24 @@ static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[])
        /* Extensionals */
       case WRD_START_SKIP:
        ctl->cmsg(CMSG_INFO, VERB_VERBOSE,
-                 "WRD START");
+                 "WRD START SKIP");
        break;
       case WRD_END_SKIP:
-       //if( fading ) wrd_fadestep( 1,1 );
        ctl->cmsg(CMSG_INFO, VERB_VERBOSE,
-                 "WRD END");
+                 "WRD END SKIP");
        break;
+       case WRD_SHERRY:
+               {
+                       char* data= wrd_event2string(wrd_args[0]);
+                       sry_decode_bindata(data);
+                       ctl->cmsg(CMSG_INFO, VERB_VERBOSE,
+                               "SHERRY OP= 0x%2x", data[0]);
+                       if(data[0]==0x51){
+                               ctl->cmsg(CMSG_INFO, VERB_VERBOSE,
+                                       "SHERRY TEXT= %s", data+11 );
+                       }
+               }
+               break;
     }
     wrd_argc = 0;
 }
index 7f2d2f1..9f8ec72 100644 (file)
 #else
 #include <strings.h>
 #endif
-#ifdef __WIN32__
+#ifndef __CYGWIN32__
 #include <conio.h>
 #endif
+
 #include "timidity.h"
 #include "common.h"
 #include "instrum.h"
 #include "wrd.h"
 
 // #define DEBUG1
-// #define USE_ESC
-#ifndef __WIN32__
+#ifdef __CYGWIN32__
 #define USE_ESC
-#endif /* __WIN32__ */
+
+#define NULL_STMT do ; while(0)
+#define gotoxy(x, y) NULL_STMT
+#define wherex() 1
+#define wherey() 1
+#define putch putchar
+#define cputs puts
+#define delline() NULL_STMT
+#define clrscr() NULL_STMT
+#define clreol() NULL_STMT
+
+
+#endif /* __CYGWIN32__ */
 
 static int wrdt_open(char *dummy);
 static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]);
@@ -81,6 +93,7 @@ static int wrd_argc;
 static int wrd_args[WRD_MAXPARAM];
 static int inkey_flag;
 
+#ifdef __BORLANDC__
 static struct text_info text_info;
 static struct conattr {
        int attr;
@@ -132,6 +145,15 @@ static void borlandc_con_reset(void)
 {
        borlandc_con_reset_attr();
 }
+#else
+struct {
+    int winleft, winright;
+    int wintop, winbottom;
+} text_info = {
+  1,25,
+  1,80,
+};
+#endif
 
 #define CANNOC_X(x) \
 {\
@@ -155,6 +177,7 @@ static void putstringn(char *str, int n)
                putch(*(str++));
 }
 
+#ifdef __BORLANDC__
 static void borlandc_con_color(int color)
 {
        switch(color){
@@ -292,6 +315,7 @@ static void borlandc_con_color(int color)
        }
        return;
 }
+#endif
 
 /* Escape sequence */
 
@@ -456,17 +480,23 @@ void esc_setcursorposition(void)
 
 void esc_enablecursordisplay(void)
 {
+#ifdef __BORLANDC__
        _setcursortype(_NORMALCURSOR);
+#endif /* __BORLANDC__ */
 }
 
 void esc_disablecursordisplay(void)
 {
+#ifdef __BORLANDC__
        _setcursortype(_NOCURSOR);
+#endif /* __BORLANDC__ */
 }
 
 void esc_characterattribute(int n)
 {
+#ifdef __BORLANDC__
        borlandc_con_color(n);
+#endif
 }
 
 /* return figures */
@@ -723,6 +753,7 @@ static void borlandc_esc(char *str)
 }
 */
 
+#ifdef __BORLANDC__
 static void borlandc_esc(char *str)
 {
        char local[201];
@@ -732,6 +763,7 @@ static void borlandc_esc(char *str)
        local[200] = '\0';
        putstring_with_esc(local);
 }
+#endif /* __BORLANDC__ */
 
 static int wrdt_open(char *dummy)
 {
index 115547c..151ca6b 100644 (file)
@@ -70,7 +70,7 @@ static void ctl_event(CtlEvent *e);
 static void ctl_refresh(void);
 static void ctl_total_time(int tt);
 static void ctl_note(int status, int ch, int note, int velocity);
-static void ctl_program(int ch, int val);
+static void ctl_program(int ch, int val, void *vp);
 static void ctl_volume(int ch, int val);
 static void ctl_expression(int ch, int val);
 static void ctl_panning(int ch, int val);
@@ -78,6 +78,7 @@ static void ctl_sustain(int ch, int val);
 static void ctl_pitch_bend(int ch, int val);
 static void ctl_reset(void);
 static void update_indicator(void);
+static void set_otherinfo(int ch, int val, char c);
 
 static double indicator_last_update = 0;
 static int exitflag=0,randomflag=0,repeatflag=0,selectflag=0,amp_diff=0;
@@ -165,7 +166,7 @@ static void ctl_total_time(int tt)
     mins=secs / 60;
     secs-=mins * 60;
 
-    sprintf(tt_str, " /%3d:%02d", mins, secs);
+    sprintf(tt_str, "/%d:%02d", mins, secs);
     ctl_current_time(0, 0);
 }
 
@@ -180,54 +181,42 @@ static void ctl_master_volume(int mv)
 
 static void ctl_volume(int ch, int val)
 {
-  if (!ctl.trace_playing)
-    return;
-  if(ch >= MAX_XAW_MIDI_CHANNELS)
-    return;
+  if(!ctl.trace_playing) return;
+  if(ch >= MAX_XAW_MIDI_CHANNELS) return;
   sprintf(local_buf, "PV%c%d", ch+'A', val);
   a_pipe_write(local_buf);
 }
 
 static void ctl_expression(int ch, int val)
 {
-  if (!ctl.trace_playing)
-    return;
-  if(ch >= MAX_XAW_MIDI_CHANNELS)
-    return;
+  if(!ctl.trace_playing) return;
+  if(ch >= MAX_XAW_MIDI_CHANNELS) return;
   sprintf(local_buf, "PE%c%d", ch+'A', val);
   a_pipe_write(local_buf);
 }
 
 static void ctl_panning(int ch, int val)
 {
-  if (!ctl.trace_playing)
-    return;
-  if(ch >= MAX_XAW_MIDI_CHANNELS)
-    return;
+  if(!ctl.trace_playing) return;
+  if(ch >= MAX_XAW_MIDI_CHANNELS) return;
   sprintf(local_buf, "PA%c%d", ch+'A', val);
   a_pipe_write(local_buf);
 }
 
 static void ctl_sustain(int ch, int val)
 {
-  if (!ctl.trace_playing)
-    return;
-  if(ch >= MAX_XAW_MIDI_CHANNELS)
-    return;
+  if(!ctl.trace_playing) return;
+  if(ch >= MAX_XAW_MIDI_CHANNELS) return;
   sprintf(local_buf, "PS%c%d", ch+'A', val);
   a_pipe_write(local_buf);
 }
 
 static void ctl_pitch_bend(int ch, int val)
 {
-  /*
-  if (!ctl.trace_playing)
-    return;
-  if(ch >= MAX_XAW_MIDI_CHANNELS)
-    return;
+  if(!ctl.trace_playing) return;
+  if(ch >= MAX_XAW_MIDI_CHANNELS) return;
   sprintf(local_buf, "PB%c%d", ch+'A', val);
   a_pipe_write(local_buf);
-  */
 }
 
 static void ctl_lyric(int lyricid)
@@ -608,19 +597,16 @@ ctl_note(int status, int ch, int note, int velocity)
 {
   char c;
 
-  if(ch >= MAX_XAW_MIDI_CHANNELS)
-       return;
-  if (!ctl.trace_playing || midi_trace.flush_flag)
-       return;
+  if(ch >= MAX_XAW_MIDI_CHANNELS) return;
+  if(!ctl.trace_playing || midi_trace.flush_flag) return;
        
-#define TRACE_HEIGHT 200
        c = '.';
     switch(status) {
     case VOICE_ON:
          c = '*';
          break;
     case VOICE_SUSTAINED:
-         c = '*';
+         c = '&';
          break;
        case VOICE_FREE:
        case VOICE_DIE:
@@ -632,12 +618,10 @@ ctl_note(int status, int ch, int note, int velocity)
        a_pipe_write(local_buf);
 }
 
-static void ctl_program(int ch, int val)
+static void ctl_program(int ch, int val, void *comm)
 {
-  if(ch >= MAX_XAW_MIDI_CHANNELS)
-    return;
-  if (!ctl.trace_playing)
-    return;
+  if(ch >= MAX_XAW_MIDI_CHANNELS) return;
+  if(!ctl.trace_playing) return;
 
   if(channel[ch].special_sample)
        val = channel[ch].special_sample;
@@ -645,6 +629,13 @@ static void ctl_program(int ch, int val)
        val += progbase;
   sprintf(local_buf, "PP%c%d", ch+'A', val);
   a_pipe_write(local_buf);
+  if (comm != NULL) {
+       sprintf(local_buf, "I%c%s", ch+'A', (char *)comm);
+       if (ISDRUMCHANNEL(ch))
+         sprintf(local_buf, "I%c%s", ch+'A',
+                 (!strlen((char *)comm))? "<drum>":(char *)comm);
+       a_pipe_write(local_buf);
+  }
 }
 
 static void ctl_event(CtlEvent *e)
@@ -669,7 +660,7 @@ static void ctl_event(CtlEvent *e)
          ctl_note((int)e->v1, (int)e->v2, (int)e->v3, (int)e->v4);
          break;
        case CTLE_PROGRAM:
-         ctl_program((int)e->v1, (int)e->v2);
+         ctl_program((int)e->v1, (int)e->v2, (char *)e->v3);
          break;
        case CTLE_VOLUME:
          ctl_volume((int)e->v1, (int)e->v2);
@@ -690,8 +681,10 @@ static void ctl_event(CtlEvent *e)
          ctl_pitch_bend((int)e->v1, e->v2 ? -1 : 0x2000);
          break;
        case CTLE_CHORUS_EFFECT:
+         set_otherinfo((int)e->v1, (int)e->v2, 'c');
          break;
        case CTLE_REVERB_EFFECT:
+         set_otherinfo((int)e->v1, (int)e->v2, 'r');
          break;
        case CTLE_LYRIC:
          ctl_lyric((int)e->v1);
@@ -713,19 +706,40 @@ static void ctl_refresh(void)
 {
 }
 
+static void set_otherinfo(int ch, int val, char c) {
+  if(!ctl.trace_playing) return;
+  if(ch >= MAX_XAW_MIDI_CHANNELS) return;
+  sprintf(local_buf, "P%c%c%d", c, ch+'A', val);
+  a_pipe_write(local_buf);
+}
+
 static void ctl_reset(void)
 {
   int i;
-  if (!ctl.trace_playing)
-    return;
 
+  if(!ctl.trace_playing) return;
   play_mode->purge_output();
 
   for (i=0; i<MAX_XAW_MIDI_CHANNELS; i++) {
-       if(ISDRUMCHANNEL(i))
-         ctl_program(i, channel[i].bank);
-       else
-         ctl_program(i, channel[i].program);
+       if(ISDRUMCHANNEL(i)) {
+         ctl_program(i, channel[i].bank, channel_instrum_name(i));
+       } else {
+         ToneBank *bank;
+         int b;
+
+         ctl_program(i, channel[i].program, channel_instrum_name(i));
+         b = channel[i].bank;
+         if((bank = tonebank[b]) == NULL
+                || bank->tone[channel[i].program].instrument == NULL)  {
+                 b = 0;
+                 bank = tonebank[0];
+         }
+         set_otherinfo(i, channel[i].bank, 'b');
+         if (opt_reverb_control && channel[i].rb != NULL)
+               set_otherinfo(i, channel[i].rb->level, 'r');
+         if(opt_chorus_control)
+               set_otherinfo(i, channel[i].chorus_level, 'c');
+       }
        ctl_volume(i, channel[i].volume);
        ctl_expression(i, channel[i].expression);
        ctl_panning(i, channel[i].panning);
@@ -743,6 +757,7 @@ static void update_indicator(void)
 {
   double t;
 
+  if(!ctl.trace_playing) return;
   t = get_current_calender_time();
   if(indicator_last_update + INDICATOR_UPDATE_TIME > t)        return;
   sprintf(local_buf, "U");
index 954093f..e7e9518 100644 (file)
@@ -68,6 +68,7 @@
 #include "common.h"
 #include "instrum.h"
 #include "playmidi.h"
+#include "readmidi.h"
 #include "controls.h"
 #if HAVE_STRSTR
 #define strstr(s,c)    index(s,c)
 #ifndef HAVE_STRNCASECMP
 int strncasecmp(char *s1, char *s2, unsigned int len);
 #endif
-#define TRACE_WIDTH 372
-#define TRACE_HEIGHT 180
-#define POS_HEIGHT 12
-#define PRG_HEIGHT 16
-#define TRACE_XOFS 30
-#define TRACE_YOFS 10
-#define BAR_INTERVAL 2
+
+#define TRACE_WIDTH 627                        /* default height of trace_vport */
+#define TRACEVPORT_WIDTH (TRACE_WIDTH+12)
+#define TRACE_WIDTH_SHORT 388
+#define TRACE_HEIGHT 336
+#define TRACEV_OFS 22
+#define TRACEH_OFS 0
 #define BAR_SPACE 20
-#define BAR_WIDTH (BAR_SPACE-BAR_INTERVAL)
-#define BAR_HEIGHT 140
-#define BAR_SCALE 1
-#define TRACE_BASELINE BAR_HEIGHT+10
+#define BAR_HEIGHT 16
+#define VOLUME_LABEL_WIDTH 80
+
+#define BARSCALE2 0.31111      /* velocity scale   (60-4)/180 */
+#define BARSCALE3 0.28125      /* volume scale     (40-4)/128 */
+#define BARSCALE4 0.25         /* expression scale (36-4)/128 */
+#define BARSCALE5 0.385827     /* expression scale (53-4)/128 */
+static int currwidth = 2;
+static int rotatewidth[] = {TRACE_WIDTH_SHORT, 592, 638};
+
+int dirlist_cmp (const void *p1, const void *p2)
+{
+    return strcasecmp (*((char **)p1), *((char **)p2));
+}
+
+
+typedef struct {
+  int                  col;    /* column number */
+  char                 **cap;  /* caption strings array */
+  int                  *w;     /* column width array */
+  int                  *ofs;   /* column offset array */
+} Tplane;
+static int plane = 0;
+
+#define TCOLUMN 9
+#define T2COLUMN 10
+static char *caption[TCOLUMN] =
+{"ch","  vel"," vol","expr","prog","pan","pit"," instrument",
+ "          keyboard"};
+static char *caption2[T2COLUMN] =
+{"ch","  vel"," vol","expr","prog","pan","bnk","reverb","chorus",
+ "          keyboard"};
+
+static int BARH_SPACE[TCOLUMN]= {22,60,40,36,36,36,30,106,304};
+#define BARH_OFS0      (TRACEH_OFS)
+#define BARH_OFS1      (BARH_OFS0+22)
+#define BARH_OFS2      (BARH_OFS1+60)
+#define BARH_OFS3      (BARH_OFS2+40)
+#define BARH_OFS4      (BARH_OFS3+36)
+#define BARH_OFS5      (BARH_OFS4+36)
+#define BARH_OFS6      (BARH_OFS5+36)
+#define BARH_OFS7      (BARH_OFS6+30)
+#define BARH_OFS8      (BARH_OFS7+106)
+static int bar0ofs[] = {BARH_OFS0,BARH_OFS1,BARH_OFS2,BARH_OFS3,
+         BARH_OFS4,BARH_OFS5,BARH_OFS6,BARH_OFS7,BARH_OFS8};
+
+static int BARH2_SPACE[T2COLUMN]= {22,60,40,36,36,36,30,53,53,304};
+#define BARH2_OFS0     (TRACEH_OFS)
+#define BARH2_OFS1     (BARH2_OFS0+22)
+#define BARH2_OFS2     (BARH2_OFS1+60)
+#define BARH2_OFS3     (BARH2_OFS2+40)
+#define BARH2_OFS4     (BARH2_OFS3+36)
+#define BARH2_OFS5     (BARH2_OFS4+36)
+#define BARH2_OFS6     (BARH2_OFS5+36)
+#define BARH2_OFS7     (BARH2_OFS6+30)
+#define BARH2_OFS8     (BARH2_OFS7+53)
+#define BARH2_OFS9     (BARH2_OFS8+53)
+static int bar1ofs[] = {BARH2_OFS0,BARH2_OFS1,BARH2_OFS2,BARH2_OFS3,
+         BARH2_OFS4,BARH2_OFS5,BARH2_OFS6,BARH2_OFS7,BARH2_OFS8,BARH2_OFS9};
+
+static Tplane pl[] = {
+  {TCOLUMN, caption, BARH_SPACE, bar0ofs},
+  {T2COLUMN, caption2, BARH2_SPACE, bar1ofs},
+};
+
+#define CL_C 0 /* column 0 = channel */
+#define CL_VE 1        /* column 1 = velocity */
+#define CL_VO 2        /* column 2 = volume */
+#define CL_EX 3        /* column 3 = expression */
+#define CL_PR 4        /* column 4 = program */
+#define CL_PA 5        /* column 5 = panning */
+#define CL_PI 6        /* column 6 = pitch bend */
+#define CL_IN 7        /* column 7 = instrument name */
+
+#define CL_BA  6       /* column 6 = bank */
+#define CL_RE  7       /* column 7 = reverb */
+#define CL_CH  8       /* column 8 = chorus */
+
+#define INST_NAME_SIZE 16
+static char *inst_name[MAX_XAW_MIDI_CHANNELS];
+static int disp_inst_name_len = 13;
 
 typedef struct {
   int                  id;
@@ -103,13 +181,17 @@ typedef struct {
 
 void a_print_text(Widget,char *);
 static void draw1Chan(int,int,char);
-static void drawProg(int,Boolean), drawPan(int,int,Boolean);
+static void drawProg(int,int,int,int,Boolean), drawPan(int,int,Boolean),
+  drawVol(int,int), drawExp(int,int), drawPitch(int,int),drawInstname(int,char *),
+  drawBank(int,int),drawReverb(int,int),drawChorus(int,int);
 static void quitCB(),playCB(),pauseCB(),stopCB(),prevCB(),nextCB(),
   forwardCB(),backCB(),repeatCB(),randomCB(),menuCB(),sndspecCB(),
-  volsetCB(),volupdownCB(),volupdownAction(),toggleMark(),filemenuCB(),
-  popupLoad(),popdownLoad(),a_readconfig(),a_saveconfig(),
-  saveconfigAction(),setDirAction(),setDirList();
-static void drawBar(),drawTraceAll(),completeDir(),ctl_channel_note();
+  volsetCB(),volupdownCB(),exchgWidthCB(),filemenuCB(),
+  volupdownAction(),toggleMark(),popupLoad(),popdownLoad(),a_readconfig(),
+  a_saveconfig(),saveconfigAction(),setDirAction(),setDirList();
+static void drawBar(),redrawTrace(Boolean),completeDir(),ctl_channel_note(),
+  drawKeyboardAll(), draw1Note(), redrawAction(), redrawCaption(),
+  exchgWidth(), toggletrace();
 static char *expandDir(),*strmatch();
 static int configcmp();
 #ifdef ENABLE_KEY_TRANSLATION
@@ -119,25 +201,27 @@ static void pauseAction(),soundkeyAction(),speedAction(),voiceAction();
 extern void a_pipe_write(char *);
 extern int a_pipe_read(char *,int);
 extern int a_pipe_nread(char *buf, int n);
-static void initTraceWindow(Boolean);
+static void initStatus(void);
 
 static Widget title_mb,title_sm,time_l,popup_load,popup_load_f,load_d;
-static Widget load_vport,load_flist,cwd_l,load_info;
-static Dimension lyric_height, base_height;
-static Widget lyric_t;
-static GC gct;
-static XColor bgcolor,defcolor,fgpan,fgstr,fgtmp;
-static XFontStruct *StatusFont;
+static Widget load_vport,load_flist,cwd_l,load_info, lyric_t;
+static Dimension lyric_height, base_height, text_height;
+static GC gc,gct;
+static Pixel bgcolor,menubcolor,textcolor,textbgcolor,text2bgcolor,buttonbgcolor,
+  buttoncolor,togglecolor,tracecolor,volcolor,expcolor,pancolor,capcolor,rimcolor,
+  boxcolor,suscolor,playcolor,revcolor,chocolor;
+static Pixel black,white;
 static long barcol[MAX_XAW_MIDI_CHANNELS];
 
-static Widget toplevel,m_box,base_f,file_mb,file_sm,bsb,trace;
+static Widget toplevel,m_box,base_f,file_mb,file_sm,bsb;
 static Widget quit_b,play_b,pause_b,stop_b,prev_b,next_b,fwd_b,back_b;
-static Widget random_b,repeat_b,b_box,v_box,vol_l,vol_bar;
+static Widget random_b,repeat_b,b_box,v_box,vol_l,vol_bar,trace_vport,trace;
 static char local_buf[300];
 static char window_title[300], *w_title;
 int amplitude = DEFAULT_AMPLIFICATION;
 String bitmapdir = DEFAULT_PATH "/bitmaps";
 Boolean arrangetitle = TRUE;
+
 typedef struct {
   Boolean              confirmexit;
   Boolean              repeat;
@@ -154,6 +238,7 @@ typedef struct {
 #define FLAG_PROG_ON    4
 #define FLAG_PAN        8
 #define FLAG_SUST       16
+#define FLAG_BENDT             32
 typedef struct {
   int reset_panel;
   int multi_part;
@@ -161,15 +246,30 @@ typedef struct {
   int16 cnote[MAX_XAW_MIDI_CHANNELS];
   int16 cvel[MAX_XAW_MIDI_CHANNELS];
   int16 ctotal[MAX_XAW_MIDI_CHANNELS];
+  int16 bank[MAX_XAW_MIDI_CHANNELS];
+  int16 reverb[MAX_XAW_MIDI_CHANNELS];  
   char c_flags[MAX_XAW_MIDI_CHANNELS];
   Channel channel[MAX_XAW_MIDI_CHANNELS];
 } PanelInfo;
 
 /* Default configuration to execute Xaw interface */
-/*  confirmexit repeat autostart hidetext shuffle disptrace */
+/* (confirmexit repeat autostart hidetext shuffle disptrace) */
 Config Cfg = { False, False, True, False, False, True };
 static PanelInfo *Panel;
 
+typedef struct {
+  int y;
+  int l;
+} KeyL;
+
+typedef struct {
+  KeyL k[3];
+  int xofs;
+  Pixel col;
+} ThreeL;
+static ThreeL *keyG;
+#define KEY_NUM 111
+
 #define MAXBITMAP 10
 static char *bmfname[] = {
   "back.xbm","fwrd.xbm","next.xbm","pause.xbm","play.xbm","prev.xbm",
@@ -210,7 +310,7 @@ char *cfg_items[]= {"Tracing", "ConfirmExit", "Disp:file", "Disp:volume",
 
 static Display *disp;
 static int screen;
-static Pixmap check_mark;
+static Pixmap check_mark, layer[2];
 
 static int bm_height[MAXBITMAP], bm_width[MAXBITMAP],
   x_hot,y_hot, root_height, root_width;
@@ -220,9 +320,21 @@ char basepath[PATH_MAX];
 String *dirlist = NULL;
 Dimension trace_width = TRACE_WIDTH, trace_height = TRACE_HEIGHT;
 
-/*static struct _app_resources {
+static struct _app_resources {
   String bitmap_dir;
   Boolean arrange_title;
+  short text_height,trace_width,trace_height;
+  Pixel common_fgcolor,common_bgcolor,menub_bgcolor,text_bgcolor,text2_bgcolor,
+       toggle_fgcolor,button_fgcolor,button_bgcolor,
+       velocity_color,drumvelocity_color,volume_color,expr_color,pan_color,
+       trace_bgcolor,rim_color,box_color,caption_color,sus_color,play_color,
+       rev_color,cho_color;
+  XFontStruct *label_font,*volume_font,*trace_font;
+#ifdef I18N
+  XFontSet text_font;
+#else
+  XFontStruct *text_font;
+#endif
 } app_resources;
 
 static XtResource resources[] ={
@@ -230,9 +342,75 @@ static XtResource resources[] ={
   {"bitmapDir", "BitmapDir", XtRString, sizeof(String),
    offset(bitmap_dir), XtRString, DEFAULT_PATH "/bitmaps"},
   {"arrangeTitle", "ArrangeTitle", XtRBoolean, sizeof(Boolean),
-   offset(arrange_title), XtRBoolean, (XtPointer)True},
+   offset(arrange_title), XtRImmediate, (XtPointer)True},
+#ifdef WIDGET_IS_LABEL_WIDGET
+  {"textLHeight", "TextLHeight", XtRShort, sizeof(short),
+   offset(text_height), XtRImmediate, (XtPointer)30},
+#else
+  {"textHeight", "TextHeight", XtRShort, sizeof(short),
+   offset(text_height), XtRImmediate, (XtPointer)120},
+#endif
+  {"traceWidth", "TraceWidth", XtRShort, sizeof(short),
+   offset(trace_width), XtRImmediate, (XtPointer)TRACE_WIDTH},
+  {"traceHeight", "TraceHeight", XtRShort, sizeof(short),
+   offset(trace_height), XtRImmediate, (XtPointer)TRACE_HEIGHT},
+  {"foreground", XtCForeground, XtRPixel, sizeof(Pixel),
+   offset(common_fgcolor), XtRString, "black"},
+  {"background", XtCBackground, XtRPixel, sizeof(Pixel),
+   offset(common_bgcolor), XtRString, "gray65"},
+  {"menubutton", "MenuButtonBackground", XtRPixel, sizeof(Pixel),
+   offset(menub_bgcolor), XtRString, "#CCFF33"},
+  {"textbackground", "TextBackground", XtRPixel, sizeof(Pixel),
+   offset(text_bgcolor), XtRString, "gray85"},
+  {"text2background", "Text2Background", XtRPixel, sizeof(Pixel),
+   offset(text2_bgcolor), XtRString, "gray80"},
+  {"toggleforeground", "ToggleForeground", XtRPixel, sizeof(Pixel),
+   offset(toggle_fgcolor), XtRString, "MediumBlue"},
+  {"buttonforeground", "ButtonForeground", XtRPixel, sizeof(Pixel),
+   offset(button_fgcolor), XtRString, "blue"},
+  {"buttonbackground", "ButtonBackground", XtRPixel, sizeof(Pixel),
+   offset(button_bgcolor), XtRString, "gray76"},
+  {"velforeground", "VelForeground", XtRPixel, sizeof(Pixel),
+   offset(velocity_color), XtRString, "orange"},
+  {"veldrumforeground", "VelDrumForeground", XtRPixel, sizeof(Pixel),
+   offset(drumvelocity_color), XtRString, "red"},
+  {"volforeground", "VolForeground", XtRPixel, sizeof(Pixel),
+   offset(volume_color), XtRString, "LightPink"},
+  {"expforeground", "ExpForeground", XtRPixel, sizeof(Pixel),
+   offset(expr_color), XtRString, "aquamarine"},
+  {"panforeground", "PanForeground", XtRPixel, sizeof(Pixel),
+   offset(pan_color), XtRString, "blue"},
+  {"tracebackground", "TraceBackground", XtRPixel, sizeof(Pixel),
+   offset(trace_bgcolor), XtRString, "gray90"},
+  {"rimcolor", "RimColor", XtRPixel, sizeof(Pixel),
+   offset(rim_color), XtRString, "gray20"},
+  {"boxcolor", "BoxColor", XtRPixel, sizeof(Pixel),
+   offset(box_color), XtRString, "gray76"},
+  {"captioncolor", "CaptionColor", XtRPixel, sizeof(Pixel),
+   offset(caption_color), XtRString, "DarkSlateGrey"},
+  {"sustainedkeycolor", "SustainedKeyColor", XtRPixel, sizeof(Pixel),
+   offset(sus_color), XtRString, "red4"},
+  {"playingkeycolor", "PlayingKeyColor", XtRPixel, sizeof(Pixel),
+   offset(play_color), XtRString, "maroon1"},
+  {"reverbcolor", "ReverbColor", XtRPixel, sizeof(Pixel),
+   offset(rev_color), XtRString, "PaleGoldenrod"},
+  {"choruscolor", "ChorusColor", XtRPixel, sizeof(Pixel),
+   offset(cho_color), XtRString, "yellow"},
+  {"labelfont", "LabelFont", XtRFontStruct, sizeof(XFontStruct *),
+   offset(label_font), XtRString, "-adobe-helvetica-bold-r-*-*-14-*-75-75-*-*-*-*"},
+  {"volumefont", "VolumeFont", XtRFontStruct, sizeof(XFontStruct *),
+   offset(volume_font), XtRString, "-adobe-helvetica-bold-r-*-*-12-*-75-75-*-*-*-*"},
+#ifdef I18N
+  {"textfontset", "TextFontSet", XtRFontSet, sizeof(XFontSet),
+   offset(text_font), XtRString, "-*-*-medium-r-normal--14-*-*-*-*-*-*-*"},
+#else
+  {"textfont", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
+   offset(text_font), XtRString, "-*-fixed-medium-r-normal--14-*-*-*-*-*-*-*"},
+#endif
+  {"tracefont", "TraceFont", XtRFontStruct, sizeof(XFontStruct *),
+   offset(trace_font), XtRString, "7x14"},
 #undef offset
-};*/
+};
 
 enum {
     ID_LOAD = 100,
@@ -275,6 +453,14 @@ static void offPlayButton(void) {
   }
 }
 
+static Boolean IsTracePlaying(void) {
+  Boolean s;
+
+  if (!ctl->trace_playing) return False;
+  XtVaGetValues(play_b,XtNstate,&s,NULL);
+  return(s);
+}
+
 static Boolean onPlayOffPause(void) {
   Boolean s;
   Boolean play_on;
@@ -354,35 +540,38 @@ static void stopCB(Widget w,XtPointer data,XtPointer dummy) {
   offPlayButton();
   offPauseButton();
   a_pipe_write("S");
-  initTraceWindow(True);
+  initStatus();
+  redrawTrace(False);
 }
 
 /*ARGSUSED*/
 static void nextCB(Widget w,XtPointer data,XtPointer dummy) {
   onPlayOffPause();
   a_pipe_write("N");
-  initTraceWindow(True);
+  initStatus();
+  redrawTrace(True);
 }
 
 /*ARGSUSED*/
 static void prevCB(Widget w,XtPointer data,XtPointer dummy) {
   onPlayOffPause();
   a_pipe_write("B");
-  initTraceWindow(True);
+  initStatus();
+  redrawTrace(True);
 }
 
 /*ARGSUSED*/
 static void forwardCB(Widget w,XtPointer data,XtPointer dummy) {
   if (onPlayOffPause()) a_pipe_write("P");
   a_pipe_write("f");
-  initTraceWindow(True);
+  initStatus();
 }
 
 /*ARGSUSED*/
 static void backCB(Widget w,XtPointer data,XtPointer dummy) {
   if (onPlayOffPause()) a_pipe_write("P");
   a_pipe_write("b");
-  initTraceWindow(True);
+  initStatus();
 }
 
 /*ARGSUSED*/
@@ -459,6 +648,45 @@ static void volupdownAction(Widget w,XEvent *e,String *v,Cardinal *n) {
   a_pipe_write(s);
 }
 
+/*ARGSUSED*/
+static void resizeAction(Widget w,XEvent *e,String *v,Cardinal *n) {
+  Dimension w1,w2,h1,y1,h2;
+  int i,tmp;
+
+  XtVaGetValues(toplevel,XtNwidth,&w1,NULL);
+  XtVaGetValues(toplevel,XtNheight,&h1,NULL);
+  w2 = w1 -8;
+  if(w2>TRACEVPORT_WIDTH) w2 = TRACEVPORT_WIDTH;
+  XtVaGetValues(lyric_t,XtNheight,&h2,NULL);
+  XtResizeWidget(lyric_t,w2-2,h2,0);
+  i= 0; tmp = 10;
+  while (tmp > 0) {
+       i++; tmp -= (int)(w2) / 36;
+  }
+  XtVaSetValues(lyric_t,XtNborderWidth,1,NULL);
+  XtVaSetValues(b_box,XtNheight,i*40,NULL);
+  XtResizeWidget(b_box,w2,i*40,0);
+
+  if(ctl->trace_playing) {
+       XtVaGetValues(trace_vport,XtNy,&y1,NULL);
+       XtResizeWidget(trace_vport,w2,((h1-y1>TRACE_HEIGHT+12)? TRACE_HEIGHT+12:h1-y1),0);
+  }
+  XtVaGetValues(v_box,XtNheight,&h2,NULL);
+  w2 = ((w1 < TRACE_WIDTH_SHORT)? w1:TRACE_WIDTH_SHORT);       /* new v_box width */
+  tmp = ((w2 -VOLUME_LABEL_WIDTH -20 < 0)? 0:VOLUME_LABEL_WIDTH); /* new vol_l width */
+  XtVaSetValues(vol_l,XtNwidth,tmp,NULL);
+  XtVaSetValues(v_box,XtNwidth,w2,NULL);
+  XtResizeWidget(v_box,w2,h2,0);
+  XtVaGetValues(vol_bar,XtNheight,&h2,NULL);
+  XtVaSetValues(vol_bar,XtNwidth,w2 -tmp -20,NULL);
+  XtResizeWidget(vol_bar,w2 -tmp -20,h2,0);
+  /*XtVaGetValues(vol_l,XtNheight,&h2,NULL);
+  XtVaSetValues(vol_l,XtNwidth,w1-20,NULL);
+  XtResizeWidget(vol_l,w1-20,h2,0);*/
+  XSync(disp, False);
+  usleep(10000);
+}
+
 #ifndef WIDGET_IS_LABEL_WIDGET
 void a_print_text(Widget w, char *st) {
   XawTextPosition pos;
@@ -477,7 +705,7 @@ void a_print_text(Widget w, char *st) {
 void a_print_text(Widget w, char *st) {
   XtVaSetValues(w,XtNlabel,st,NULL);
 }
-#endif /*WIDGET_IS_LABEL_WIDGET*/
+#endif /* !WIDGET_IS_LABEL_WIDGET */
 
 /*ARGSUSED*/
 static void popupLoad(Widget w,XtPointer client_data,XtPointer call_data) {
@@ -556,16 +784,16 @@ static void filemenuCB(Widget w,XtPointer id_data, XtPointer data) {
          if(ctl->trace_playing) {
                XtVaGetValues(toplevel,XtNheight,&h1,NULL);
                XtVaGetValues(toplevel,XtNwidth,&w1,NULL);
-               if (XtIsManaged(trace)) {
+               if(XtIsManaged(trace_vport)) {
                  tmp = trace_height + (XtIsManaged(lyric_t) ? 0:lyric_height);
-                 XtUnmanageChild(trace);
+                 XtUnmanageChild(trace_vport);
                  XtMakeResizeRequest(toplevel,w1,base_height-tmp,&w2,&h2);
                } else {
-                 XtManageChild(trace);
-                 XtVaSetValues(trace,XtNfromVert,
+                 XtManageChild(trace_vport);
+                 XtVaSetValues(trace_vport,XtNfromVert,
                                                (XtIsManaged(lyric_t) ? lyric_t:v_box),NULL);
                  XtMakeResizeRequest(toplevel,w1,h1+trace_height,&w2,&h2);
-                 XtVaSetValues(trace,XtNheight,trace_height,NULL);
+                 XtVaSetValues(trace_vport,XtNheight,trace_height,NULL);
                }
                toggleMark(w,*id);
          }
@@ -573,20 +801,20 @@ static void filemenuCB(Widget w,XtPointer id_data, XtPointer data) {
        case ID_HIDETXT:
          XtVaGetValues(toplevel,XtNheight,&h1,NULL);
          XtVaGetValues(toplevel,XtNwidth,&w1,NULL);
-         if (XtIsManaged(lyric_t)) {
+         if(XtIsManaged(lyric_t)) {
                if(ctl->trace_playing) {
-                 tmp = lyric_height + (XtIsManaged(trace) ? 0:trace_height);
+                 tmp = lyric_height + (XtIsManaged(trace_vport) ? 0:trace_height);
                } else {
                  tmp = lyric_height;
                }
                XtUnmanageChild(lyric_t);
-               if(ctl->trace_playing && XtIsManaged(trace))
-                 XtVaSetValues(trace,XtNfromVert,v_box,NULL);
+               if(ctl->trace_playing && XtIsManaged(trace_vport))
+                 XtVaSetValues(trace_vport,XtNfromVert,v_box,NULL);
                XtMakeResizeRequest(toplevel,w1,base_height-tmp,&w2,&h2);
          } else {
                XtManageChild(lyric_t);
-               if(ctl->trace_playing && XtIsManaged(trace)) {
-                 XtVaSetValues(trace,XtNfromVert,lyric_t,NULL);
+               if(ctl->trace_playing && XtIsManaged(trace_vport)) {
+                 XtVaSetValues(trace_vport,XtNfromVert,lyric_t,NULL);
                }
                XtVaSetValues(lyric_t,XtNheight,lyric_height,NULL);
                XtMakeResizeRequest(toplevel,w1,h1+lyric_height,&w2,&h2);
@@ -648,10 +876,9 @@ static void a_print_msg(Widget w)
 
 #define DELTA_VEL       32
 
-static void
-ctl_channel_note(int ch, int note, int velocity) {
+static void ctl_channel_note(int ch, int note, int velocity) {
   
-  if (!ctl->trace_playing) return;
+  if(!ctl->trace_playing) return;
   if (velocity == 0) {
        if (note == Panel->cnote[ch])     
          Panel->v_flags[ch] = FLAG_NOTE_OFF;
@@ -719,66 +946,95 @@ static void handle_input(XtPointer data,int *source,XtInputId *id) {
        }
        break;
   case 'Y':
-       ch= *(local_buf+1) - 'A';
-       c= *(local_buf+2);
-       note= (*(local_buf+3)-'0')*100 + (*(local_buf+4)-'0')*10 + *(local_buf+5)-'0';
-       n= atoi(local_buf+6);
-       if (c == '*') {
-         Panel->c_flags[ch] |= FLAG_PROG_ON;
-       } else {
-         Panel->c_flags[ch] &= ~FLAG_PROG_ON; n= 0;
+       if(ctl->trace_playing) {
+         ch= *(local_buf+1) - 'A';
+         c= *(local_buf+2);
+         note= (*(local_buf+3)-'0')*100 + (*(local_buf+4)-'0')*10 + *(local_buf+5)-'0';
+         n= atoi(local_buf+6);
+         if (c == '*' || c == '&') {
+               Panel->c_flags[ch] |= FLAG_PROG_ON;
+         } else {
+               Panel->c_flags[ch] &= ~FLAG_PROG_ON; n= 0;
+         }
+         ctl_channel_note(ch, note, n);
+         draw1Note(ch,note,c);
+         draw1Chan(ch,Panel->ctotal[ch],c);
+       }
+       break;
+  case 'I':
+       if(IsTracePlaying()) {
+         ch= *(local_buf+1) - 'A';
+         strncpy(inst_name[ch], (char *)&local_buf[2], INST_NAME_SIZE);
+         drawInstname(ch, inst_name[ch]);
        }
-       ctl_channel_note(ch, note, n);
-       draw1Chan(ch,Panel->ctotal[ch],c);
        break;
   case 'P':
-       c= *(local_buf+1);
-       ch= *(local_buf+2)-'A';
-       n= atoi(local_buf+3);
-       switch(c) {
-    case  'A':         /* panning */
-         Panel->channel[ch].panning = n;
-         Panel->c_flags[ch] |= FLAG_PAN;
-         drawPan(ch,n,True);
-         break;
-    case  'B':         /* pitch_bend */
-         /*Panel->channel[ch].pitch_bend = n;
-               Panel->c_flags[ch] |= FLAG_BENDT;*/
-         break;
-    case  'S':         /* sustain */
-         Panel->channel[ch].sustain = n;
-         Panel->c_flags[ch] |= FLAG_SUST;
-         break;
-    case  'P':         /* program */
-         Panel->channel[ch].program = n;
-         Panel->c_flags[ch] |= FLAG_PROG;
-         drawProg(ch,True);
-         break;
-    case  'E':         /* expression */
-         Panel->channel[ch].expression = n;
-         ctl_channel_note(ch, Panel->cnote[ch], Panel->cvel[ch]);
-         break;
-    case  'V':         /* volume */
-         Panel->channel[ch].volume = n;
-         ctl_channel_note(ch, Panel->cnote[ch], Panel->cvel[ch]);
-         break;
+       if(IsTracePlaying()) {
+         c= *(local_buf+1);
+         ch= *(local_buf+2)-'A';
+         n= atoi(local_buf+3);
+         switch(c) {
+         case  'A':            /* panning */
+               Panel->channel[ch].panning = n;
+               Panel->c_flags[ch] |= FLAG_PAN;
+               drawPan(ch,n,True);
+               break;
+         case  'B':            /* pitch_bend */
+               Panel->channel[ch].pitchbend = n;
+               Panel->c_flags[ch] |= FLAG_BENDT;
+               if (!plane) drawPitch(ch,n);
+               break;
+         case  'b':            /* tonebank */
+               Panel->channel[ch].bank = n;
+               if (plane) drawBank(ch,n);
+               break;
+         case  'r':            /* reverb */
+               Panel->reverb[ch] = n;
+               if (plane) drawReverb(ch,n);
+               break;
+         case  'c':            /* chorus */
+               Panel->channel[ch].chorus_level = n;
+               if (plane) drawChorus(ch,n);
+               break;
+         case  'S':            /* sustain */
+               Panel->channel[ch].sustain = n;
+               Panel->c_flags[ch] |= FLAG_SUST;
+               break;
+         case  'P':            /* program */
+               Panel->channel[ch].program = n;
+               Panel->c_flags[ch] |= FLAG_PROG;
+               drawProg(ch,n,4,pl[plane].ofs[CL_PR],True);
+               break;
+         case  'E':            /* expression */
+               Panel->channel[ch].expression = n;
+               ctl_channel_note(ch, Panel->cnote[ch], Panel->cvel[ch]);
+               drawExp(ch,n);
+               break;
+         case  'V':            /* volume */
+               Panel->channel[ch].volume = n;
+               ctl_channel_note(ch, Panel->cnote[ch], Panel->cvel[ch]);
+               drawVol(ch,n);
+               break;
+         }
        }
        break;
   case 'R':
-       drawTraceAll(); break;
+       redrawTrace(True);      break;
   case 'U':                    /* update timer */
-       for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++)
-         if (Panel->v_flags[i]) {
-               if (Panel->v_flags[i] == FLAG_NOTE_OFF) {
-                 Panel->ctotal[i] -= DELTA_VEL;
-                 if (Panel->ctotal[i] <= 0) {
-                       Panel->ctotal[i] = 0;
+       if(ctl->trace_playing) {
+         for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++)
+               if (Panel->v_flags[i]) {
+                 if (Panel->v_flags[i] == FLAG_NOTE_OFF) {
+                       Panel->ctotal[i] -= DELTA_VEL;
+                       if (Panel->ctotal[i] <= 0) {
+                         Panel->ctotal[i] = 0;
+                         Panel->v_flags[i] = 0;
+                       }
+                 } else {
                        Panel->v_flags[i] = 0;
                  }
-               } else {
-                 Panel->v_flags[i] = 0;
                }
-         }
+       }
        break;
   default : 
        fprintf(stderr,"Unkown message '%s' from CONTROL" NLS,local_buf);
@@ -941,6 +1197,7 @@ static void setDirList(Widget list, Widget label, XawListReturnStruct *lrs) {
          dirlist[i] = XtMalloc(sizeof(char) * strlen(filename) + 1);
          strcpy(dirlist[i++], filename);
        }
+        qsort (dirlist, i, sizeof (char *), dirlist_cmp);
        dirlist[i] = NULL;
        snprintf(local_buf, sizeof(local_buf), "%d Directories, %d Files", d_num, f_num);
        XawListChange(list, dirlist, 0,0,True);
@@ -950,33 +1207,32 @@ static void setDirList(Widget list, Widget label, XawListReturnStruct *lrs) {
   }
 }
 
-static void drawBar(int ch,int len) {
-  if (!ctl->trace_playing) return;
-  XSetForeground(disp, gct, barcol[ch]);  
+static void drawBar(int ch,int len, int xofs, int column, Pixel color) {
+  XSetForeground(disp, gct, bgcolor);
+  XSetForeground(disp, gct, boxcolor);
   XFillRectangle(XtDisplay(trace),XtWindow(trace),gct,
-                                TRACE_XOFS+ch*BAR_SPACE,TRACE_BASELINE-len*BAR_SCALE,
-                                BAR_WIDTH,len*BAR_SCALE);
-  XSetForeground(disp, gct, bgcolor.pixel);
+                                xofs+len+2,TRACEV_OFS+BAR_SPACE*ch+2,
+                                pl[plane].w[column] -len -4,BAR_HEIGHT);
+  XSetForeground(disp, gct, color);
   XFillRectangle(XtDisplay(trace),XtWindow(trace),gct,
-                                TRACE_XOFS+ch*BAR_SPACE,0,
-                                BAR_WIDTH+1,TRACE_BASELINE-len*BAR_SCALE);
+                                xofs+2,TRACEV_OFS+BAR_SPACE*ch+2,
+                                len,BAR_HEIGHT);
 }
 
-static void drawProg(int ch,Boolean do_clean) {
-  char s[3];
+static void drawProg(int ch,int val,int column,int xofs, Boolean do_clean) {
+  char s[4];
 
-  if (!ctl->trace_playing) return;
   if(do_clean) {
-       XSetForeground(disp, gct, bgcolor.pixel);
+       XSetForeground(disp, gct, boxcolor);
        XFillRectangle(XtDisplay(trace),XtWindow(trace),gct,
-                                  TRACE_XOFS+ch*BAR_SPACE,TRACE_BASELINE+POS_HEIGHT,
-                                  BAR_SPACE,PRG_HEIGHT);
-       XSetForeground(disp, gct, fgstr.pixel);
+                                  xofs+2,TRACEV_OFS+BAR_SPACE*ch+2,
+                                  pl[plane].w[4]-4,BAR_HEIGHT);
   }
-  sprintf(s, "%02X", Panel->channel[ch].program);
+  XSetForeground(disp, gct, black);
   /* 14 means suspected Text Height, though it's not so exact.. */
+  sprintf(s, "%3d", val);
   XDrawString(XtDisplay(trace), XtWindow(trace), gct,
-                         TRACE_XOFS+ch*BAR_SPACE+2,TRACE_BASELINE+POS_HEIGHT+14,s,2);
+                         xofs+5,TRACEV_OFS+BAR_SPACE*ch+16,s,3);
 }
 
 static void drawPan(int ch,int val,Boolean setcolor) {
@@ -984,79 +1240,289 @@ static void drawPan(int ch,int val,Boolean setcolor) {
   int x;
   static XPoint pp[3];
 
-  if (!ctl->trace_playing) return;
   if (val < 0) return;
-  x= TRACE_XOFS+ BAR_SPACE * ch+ 1;
-  ap= BAR_WIDTH * val/127;
-  bp= BAR_WIDTH -ap -1;
-  pp[0].x= ap+ x; pp[0].y= 6 +TRACE_BASELINE;
-  pp[1].x= bp+ x; pp[1].y= 2 +TRACE_BASELINE;
-  pp[2].x= bp+ x; pp[2].y= 10 +TRACE_BASELINE;
   if (setcolor) {
-       XSetForeground(disp, gct, bgcolor.pixel);
+       XSetForeground(disp, gct, boxcolor);
        XFillRectangle(XtDisplay(trace),XtWindow(trace),gct,
-                                  x-2,TRACE_BASELINE+1,BAR_SPACE-1,12);
-       XSetForeground(disp, gct, fgpan.pixel);
+                                  pl[plane].ofs[CL_PA]+2,TRACEV_OFS+BAR_SPACE*ch+2,
+                                  pl[plane].w[CL_PA]-4,BAR_HEIGHT);
+       XSetForeground(disp, gct, pancolor);
   }
+  x= pl[plane].ofs[CL_PA]+3;
+  ap= 31 * val/127;
+  bp= 31 -ap -1;
+  pp[0].x= ap+ x; pp[0].y= 12 +BAR_SPACE*(ch+1);
+  pp[1].x= bp+ x; pp[1].y= 8 +BAR_SPACE*(ch+1);
+  pp[2].x= bp+ x; pp[2].y= 16 +BAR_SPACE*(ch+1);
   XFillPolygon(XtDisplay(trace),XtWindow(trace),gct,pp,3,
                           (int)Nonconvex,(int)CoordModeOrigin);
 }
 
 static void draw1Chan(int ch,int val,char cmd) {
-  if (!ctl->trace_playing) return;
-  if (cmd == '*') {
-       drawBar(ch, val);
+  if (cmd == '*' || cmd == '&') {
+       drawBar(ch, (int)(val*BARSCALE2), pl[plane].ofs[CL_VE], CL_VE, barcol[ch]);
   } else {
-       XSetForeground(disp, gct, bgcolor.pixel);
+       XSetForeground(disp, gct, boxcolor);
        XFillRectangle(XtDisplay(trace),XtWindow(trace),gct,
-                                  TRACE_XOFS+ch*BAR_SPACE,TRACE_YOFS,BAR_WIDTH+1,BAR_HEIGHT);
+                                  pl[plane].ofs[CL_VE]+2,TRACEV_OFS+BAR_SPACE*ch+2,
+                                  pl[plane].w[CL_VE]-4,BAR_HEIGHT);
+  }
+}
+
+static void drawVol(int ch,int val) {
+  drawBar(ch, (int)(val*BARSCALE3), pl[plane].ofs[CL_VO], CL_VO, volcolor);
+}
+
+static void drawExp(int ch,int val) {
+  drawBar(ch, (int)(val*BARSCALE4), pl[plane].ofs[CL_EX], CL_EX, expcolor);
+}
+
+static void drawReverb(int ch,int val) {
+  drawBar(ch, (int)(val*BARSCALE5), pl[plane].ofs[CL_RE], CL_RE, revcolor);
+}
+
+static void drawChorus(int ch,int val) {
+  drawBar(ch, (int)(val*BARSCALE5), pl[plane].ofs[CL_CH], CL_CH, chocolor);
+}
+
+static void drawPitch(int ch,int val) {
+  char s[3];
+
+  XSetForeground(disp, gct, boxcolor);
+  XFillRectangle(XtDisplay(trace),XtWindow(trace),gct,
+                                pl[plane].ofs[CL_PI]+2,TRACEV_OFS+BAR_SPACE*ch+2,
+                                pl[plane].w[CL_PI] -4,BAR_HEIGHT);
+  XSetForeground(disp, gct, barcol[9]);
+  if (val != 0) {
+       if (val<0) {
+         sprintf(s, "=");
+       } else {
+         if (val == 0x2000) sprintf(s, "*");
+         else if (val>0x3000) sprintf(s, ">>");
+         else if (val>0x2000) sprintf(s, ">");
+         else if (val>0x1000) sprintf(s, "<");
+         else sprintf(s, "<<");
+       }
+       XDrawString(XtDisplay(trace), XtWindow(trace), gct,
+                               pl[plane].ofs[CL_PI]+4,TRACEV_OFS+BAR_SPACE*ch+16,s,strlen(s));
+  }
+}
+
+static void drawInstname(int ch, char *name) {
+  int len;
+  if(!ctl->trace_playing) return;
+  if(plane!=0) return;
+
+  XSetForeground(disp, gct, boxcolor);
+  XFillRectangle(XtDisplay(trace),XtWindow(trace),gct,
+                                pl[plane].ofs[CL_IN]+2,TRACEV_OFS+BAR_SPACE*ch+2,
+                                pl[plane].w[CL_IN] -4,BAR_HEIGHT);
+  XSetForeground(disp, gct, ((ISDRUMCHANNEL(ch))? capcolor:black));
+  len = strlen(name);
+  XDrawString(XtDisplay(trace), XtWindow(trace), gct,
+                         pl[plane].ofs[CL_IN]+4,TRACEV_OFS+BAR_SPACE*ch+15,
+                         name,(len>disp_inst_name_len)? disp_inst_name_len:len);
+}
+
+static void draw1Note(int ch,int note,int flag) {
+  int i, j;
+  XSegment dot[3];
+
+  j = note -9;
+  if (j<0) return;
+  if (flag == '*') {
+       XSetForeground(disp, gct, playcolor);
+  } else if (flag == '&') {
+       XSetForeground(disp, gct,
+                      ((keyG[j].col == black)? suscolor:barcol[0]));
+  }  else {
+       XSetForeground(disp, gct, keyG[j].col);
+  }
+  for(i= 0; i<3; i++) {
+       dot[i].x1 = keyG[j].xofs +i;
+       dot[i].y1 = TRACEV_OFS+ keyG[j].k[i].y+ ch*BAR_SPACE;
+       dot[i].x2 = dot[i].x1;
+       dot[i].y2 = dot[i].y1 + keyG[j].k[i].l;
+  }
+  XDrawSegments(XtDisplay(trace),XtWindow(trace),gct,dot,3);
+}
+
+static void drawKeyboardAll(Display *disp,Drawable pix) {
+  int i, j;
+  XSegment dot[3];
+
+  XSetForeground(disp, gc, tracecolor);
+  XFillRectangle(disp,pix,gc,0,0,BARH_OFS8,BAR_SPACE);
+  XSetForeground(disp, gc, boxcolor);
+  XFillRectangle(disp,pix,gc,BARH_OFS8,0,TRACE_WIDTH-BARH_OFS8+1,BAR_SPACE);
+  for(i= 0; i<KEY_NUM; i++) {
+       XSetForeground(disp, gc, keyG[i].col);
+       for(j= 0; j<3; j++) {
+         dot[j].x1 = keyG[i].xofs +j;
+         dot[j].y1 = keyG[i].k[j].y;
+         dot[j].x2 = dot[j].x1;
+         dot[j].y2 = dot[j].y1 + keyG[i].k[j].l;
+       }
+       XDrawSegments(disp,pix,gc,dot,3);
   }
 }
 
-static void drawTraceAll(void) {
+static void drawBank(int ch,int val) {
+  char s[4];
+
+  XSetForeground(disp, gct, black);
+  sprintf(s, "%3d", (int)val);
+  XDrawString(disp,XtWindow(trace),gct,
+              pl[plane].ofs[CL_BA],TRACEV_OFS+BAR_SPACE*ch+15, s,strlen(s));
+}
+
+static void exchgWidthCB(Widget w,XtPointer data,XtPointer dummy) {
+  Dimension w1,h1,w2,h2;
+
+  XtVaGetValues(toplevel,XtNheight,&h1,NULL);
+  ++currwidth;
+  currwidth %= 3;              /* number of rotatewidth */
+  w1 = rotatewidth[currwidth];
+  XtMakeResizeRequest(toplevel,w1,h1,&w2,&h2);
+  resizeAction(w,NULL,NULL,NULL);  
+}
+
+static void toggletrace(Widget w,XEvent *e,String *v,Cardinal *n) {
+  if((e->xbutton.button == 1) || e->type == KeyPress) {
+       plane ^= 1;
+       redrawTrace(True);
+  }
+}
+
+/*ARGSUSED*/
+static void exchgWidth(Widget w,XEvent *e,String *v,Cardinal *n) {
+  exchgWidthCB(w,NULL,NULL);
+}
+
+/*ARGSUSED*/
+static void redrawAction(Widget w,XEvent *e,String *v,Cardinal *n) {
+  redrawTrace(True);
+}
+
+/*ARGSUSED*/
+static Boolean cursor_is_in = False;
+static void redrawCaption(Widget w,XEvent *e,String *v,Cardinal *n) {
+  char *p;
   int i;
-  Dimension w, h;
 
-  if (!ctl->trace_playing) return;
-  XtVaGetValues(trace,XtNheight,&h,NULL);
-  XtVaGetValues(trace,XtNwidth,&w,NULL);
-  XSetForeground(disp, gct, bgcolor.pixel);
-  XFillRectangle(XtDisplay(trace),XtWindow(trace),gct,0,0,w,h);
-  for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++) {
-       XSetForeground(disp, gct, barcol[i]);
-       XDrawLine(XtDisplay(trace),XtWindow(trace),gct,
-                         TRACE_XOFS+i*BAR_SPACE,TRACE_BASELINE,
-                         TRACE_XOFS+(i+1)*BAR_SPACE -BAR_INTERVAL,TRACE_BASELINE);
+  if(e->type == EnterNotify) {
+       cursor_is_in = True;
+       XSetForeground(disp, gct, capcolor);
+  } else {
+       cursor_is_in = False;
+       XSetForeground(disp, gct, tracecolor);
   }
-  for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++)
-       if (Panel->ctotal[i] != 0 && Panel->c_flags[i] & FLAG_PROG_ON)
-         draw1Chan(i,Panel->ctotal[i],'*');
-  XSetForeground(disp, gct, fgpan.pixel);
-  for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++) {
-       if (Panel->c_flags[i] & FLAG_PAN)
-         drawPan(i,Panel->channel[i].panning,False);
+  XFillRectangle(disp,XtWindow(trace),gct, 0,0,TRACE_WIDTH,TRACEV_OFS);
+  XSetBackground(disp, gct, (e->type == EnterNotify)? expcolor:tracecolor);
+  XSetForeground(disp, gct, (e->type == EnterNotify)? tracecolor:capcolor);
+  for(i=0; i<pl[plane].col; i++) {
+       p = pl[plane].cap[i];
+       XDrawString(disp,XtWindow(trace),gct,pl[plane].ofs[i]+4,16,p,strlen(p));
   }
-  XSetForeground(disp, gct, fgstr.pixel);
-  for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++) {
-       drawProg(i,False);
+}
+
+static void redrawTrace(Boolean draw) {
+  int i;
+  Dimension w1, h1;
+  char s[3];
+
+  if(!ctl->trace_playing) return;
+  if(!XtIsRealized(trace)) return;
+
+  XtVaGetValues(trace,XtNheight,&h1,NULL);
+  XtVaGetValues(trace,XtNwidth,&w1,NULL);
+  XSetForeground(disp, gct, tracecolor);
+  XFillRectangle(disp,XtWindow(trace),gct, 0,0,w1,h1);
+  XSetForeground(disp, gct, boxcolor);
+  XFillRectangle(disp,XtWindow(trace),gct,
+                                BARH_OFS8 -1,TRACEV_OFS, TRACE_WIDTH-BARH_OFS8+1,
+                                BAR_SPACE*MAX_XAW_MIDI_CHANNELS);
+  for(i= 0; i<MAX_XAW_MIDI_CHANNELS; i++) {
+       XCopyArea(disp, layer[plane], XtWindow(trace), gct, 0,0,
+                         TRACE_WIDTH,BAR_SPACE, 0, TRACEV_OFS+i*BAR_SPACE);
+  }
+  XSetForeground(disp, gct, capcolor);
+  XDrawLine(disp,XtWindow(trace),gct,BARH_OFS0,TRACEV_OFS+BAR_SPACE*MAX_XAW_MIDI_CHANNELS,
+                       TRACE_WIDTH-1,TRACEV_OFS+BAR_SPACE*MAX_XAW_MIDI_CHANNELS);
+
+  XSetForeground(disp, gct, black);
+  for(i= 1; i<MAX_XAW_MIDI_CHANNELS+1; i++) {
+       sprintf(s, "%2d", i);
+       XDrawString(disp, XtWindow(trace), gct,
+                               pl[plane].ofs[CL_C]+2,TRACEV_OFS+BAR_SPACE*i-5,s,2);
+  }
+
+  if(cursor_is_in) {
+       XSetForeground(disp, gct, capcolor);
+       XFillRectangle(disp,XtWindow(trace),gct, 0,0,TRACE_WIDTH,TRACEV_OFS);
+  }
+  XSetForeground(disp, gct, (cursor_is_in)? tracecolor:capcolor);
+  for(i=0; i<pl[plane].col; i++) {
+       char *p;
+       p = pl[plane].cap[i];
+       XDrawString(disp,XtWindow(trace),gct,pl[plane].ofs[i]+4,16,p,strlen(p));
+  }
+  switch(play_system_mode) {
+  case GM_SYSTEM_MODE:
+       XDrawString(disp,XtWindow(trace),gct,TRACEH_OFS+594,16,"[GM]",4); break;
+  case GS_SYSTEM_MODE:
+       XDrawString(disp,XtWindow(trace),gct,TRACEH_OFS+594,16,"[GS]",4); break;
+  case XG_SYSTEM_MODE:
+       XDrawString(disp,XtWindow(trace),gct,TRACEH_OFS+594,16,"[XG]",4); break;
+  default:
+       break;
+  }
+  if(draw) {
+       for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++)
+         if (Panel->ctotal[i] != 0 && Panel->c_flags[i] & FLAG_PROG_ON)
+               draw1Chan(i,Panel->ctotal[i],'*');
+       XSetForeground(disp, gct, pancolor);
+       for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++) {
+         if (Panel->c_flags[i] & FLAG_PAN)
+               drawPan(i,Panel->channel[i].panning,False);
+       }
+       XSetForeground(disp, gct, black);
+       for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++) {
+         drawProg(i,Panel->channel[i].program,CL_PR,pl[plane].ofs[4],False);
+         drawVol(i,Panel->channel[i].volume);
+         drawExp(i,Panel->channel[i].expression);
+         if (plane) {
+               drawBank(i,Panel->channel[i].bank);
+               drawReverb(i,Panel->reverb[i]);
+               drawChorus(i,Panel->channel[i].chorus_level);
+         } else {
+               drawPitch(i,Panel->channel[i].pitchbend);
+               drawInstname(i, inst_name[i]);
+         }
+       }
   }
 }
 
-void initTraceWindow(Boolean draw) {
+static void initStatus(void) {
   int i;
+
   if(!ctl->trace_playing) return;
   for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++) {
        Panel->channel[i].program= 0;
+       Panel->channel[i].volume= 0;
        Panel->channel[i].sustain= 0;
        Panel->channel[i].expression= 0;
+       Panel->channel[i].pitchbend= 0;
        Panel->channel[i].panning= -1;
        Panel->ctotal[i] = 0;
        Panel->cvel[i] = 0;
+       Panel->bank[i] = 0;
+       Panel->reverb[i] = 0;
+       Panel->channel[i].chorus_level = 0;
        Panel->v_flags[i] = 0;
        Panel->c_flags[i] = 0;
+       *inst_name[i] = '\0';
   }
-  if (draw)
-       drawTraceAll();
 }
 
 /*ARGSUSED*/
@@ -1175,6 +1641,7 @@ static void a_saveconfig (char *file) {
        }
   }
 }
+
 #ifdef OFFIX
 static void FileDropedHandler(Widget widget ,XtPointer data,XEvent *event,Boolean *b)
 {
@@ -1218,7 +1685,10 @@ void a_start_interface(int pipe_in) {
        {"fix-menu", (XtActionProc)filemenuCB},
        {"do-complete", (XtActionProc)completeDir},
        {"do-chgdir", (XtActionProc)setDirAction},
-       {"draw-trace",(XtActionProc)drawTraceAll},
+       {"draw-trace",(XtActionProc)redrawAction},
+       {"do-exchange",(XtActionProc)exchgWidth},
+       {"do-toggletrace",(XtActionProc)toggletrace},
+       {"do-revcaption",(XtActionProc)redrawCaption},
 #ifdef ENABLE_KEY_TRANSLATION
        {"do-dialog-button",(XtActionProc)popdownLoad},
        {"do-load",(XtActionProc)popupLoad},
@@ -1237,70 +1707,53 @@ void a_start_interface(int pipe_in) {
 #endif
        {"do-volset",(XtActionProc)volsetCB},
        {"do-volupdown",(XtActionProc)volupdownAction},
+       {"do-resize",(XtActionProc)resizeAction},
   };
 
-#define XAW_WIDTH "380"
   static String fallback_resources[]={
        "*Label.font: -adobe-helvetica-bold-o-*-*-14-*-75-75-*-*-*-*",
        "*Text*fontSet: -misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*",
        "*Text*background: gray85",
-       "*Text*scrollbar*background: gray75",
+       "*Text*scrollbar*background: gray76",
        "*Scrollbar*background: gray85",
        "*Label.foreground: black",
        "*Label.background: #CCFF33",
-       "*MenuButton.background: #CCFF33",
+       "*Dialog*background: gray90",
        "*Command.background: gray85",
-       "*Dialog*background: gray75",
-       "*load_dialog.OK.background: gray85",
-       "*load_dialog.Cancel.background: gray85",
-       "*files.background: gray85",
-       "*clip.background: gray85",
-       "*Command.foreground: MediumBlue",
-       "*Toggle.background: gray85",
-       "*Toggle.foreground: MediumBlue",
-       "*random_button.foreground: MidnightBlue",
-       "*repeat_button.foreground: MidnightBlue",
        "*Command.font: -adobe-helvetica-medium-o-*-*-12-*-75-75-*-*-*-*",
        "*Toggle.font: -adobe-helvetica-medium-o-*-*-12-*-75-75-*-*-*-*",
        "*MenuButton.translations:<EnterWindow>:        highlight()\\n\
                <LeaveWindow>:  reset()\\n\
                Any<BtnDown>:   reset() fix-menu() PopupMenu()",
-       "*base_form.background: gray75",
-       "*menu_box.background: gray75",
        "*menu_box.borderWidth: 0",
-       "*button_box.background: gray75",
        "*button_box.borderWidth: 0",
        "*button_box.horizDistance: 4",
        "*file_menubutton.menuName: file_simplemenu",
        "*file_menubutton.label: file...",
-       "*MenuButton.font: -adobe-helvetica-bold-o-*-*-12-*-75-75-*-*-*-*",
        "*file_menubutton.width: 60",
        "*file_menubutton.height: 28",
        "*file_menubutton.horizDistance: 6",
        "*file_menubutton.vertDistance: 4",
        "*file_simplemenu.SmeBSB.font: -adobe-helvetica-medium-r-*-*-12-*-75-75-*-*-*-*",
        "*title_simplemenu.SmeBSB.font: -adobe-helvetica-medium-r-*-*-12-*-75-75-*-*-*-*",
-       "*file_simplemenu.background: Gray85",
-       "*title_simplemenu.background: Gray85",
        "*file_simplemenu.width: 196",
        "*title_simplemenu.width: 200",
        "*title_menubutton.menuName: title_simplemenu",
        "*title_menubutton.label: ------",
-       "*title_menubutton.width: 200",
+       "*title_menubutton.width: 210",
        "*title_menubutton.height: 28",
        "*title_menubutton.resize: false",
        "*title_menubutton.horizDistance: 6",
        "*title_menubutton.vertDistance: 4",
        "*title_menubutton.fromHoriz: file_menubutton",
        "*time_label.width: 96",
-       "*time_label.height: 28",
+       "*time_label.height: 26",
        "*time_label.resize: false",
        "*time_label.fromHoriz: title_menubutton",
        "*time_label.horizDistance: 1",
        "*time_label.vertDistance: 4",
        "*time_label.label: 00:00 / -----",
-       "*button_box.height: 42",
-       "*button_box.width: " XAW_WIDTH ,
+       "*button_box.height: 40",
        "*play_button.width: 32",
        "*play_button.height: 32",
        "*play_button.horizDistance: 1",
@@ -1342,25 +1795,16 @@ void a_start_interface(int pipe_in) {
        "*repeat_button.horizDistance: 1",
        "*repeat_button.vertDistance: 1",
        "*lyric_text.fromVert: volume_box",
-       "*lyric_text.width: " XAW_WIDTH ,
+       "*lyric_text.borderWidth: 1" ,
        "*lyric_text.vertDistance: 4",
 #ifndef WIDGET_IS_LABEL_WIDGET
        "*lyric_text.horizDistance: 6",
        "*lyric_text.height: 120",
-       "*lyric_text.background: gray85",
-       "*lyric_text.foreground: black",
        "*lyric_text.scrollVertical: WhenNeeded",
-       /*      "*lyric_text.resize: XawtextResizeBoth",*/
 #else
        "*lyric_text.height: 30",
-       "*lyric_text.fontSet: -*-*-medium-r-normal--14-*",
        "*lyric_text.label: MessageWindow",
-       "*lyric_text.resize: false",
-       "*trace.width: 372",
-       "*trace.height: 180",
-       "*trace.borderWidth: 1",
-       "*trace.background: gray85",
-       "*trace.vertDistance: 2",
+       "*lyric_text.resize: true",
        "*lyric_text.horizDistance: 6",
 #endif
 #ifdef I18N
@@ -1368,30 +1812,33 @@ void a_start_interface(int pipe_in) {
 #else
        "*lyric_text.international: False",
 #endif
-       "*volume_box.width: " XAW_WIDTH ,
-       "*volume_box.height: 48",
-       "*volume_box.background: gray75",
-       "*volume_label.background: gray75",
+       "*volume_box.height: 36",
+       "*volume_box.background: gray76",
+       "*volume_label.background: gray76",
        "*volume_label.vertDistance: 0",
        "*volume_box.vertDistance: 2",
        "*volume_box.borderWidth: 0",
        "*volume_label.font: -adobe-helvetica-bold-r-*-*-12-*-75-75-*-*-*-*",
        "*volume_label.borderWidth: 0",
        "*volume_label.label: Volume 70",
-       "*volume_label.width: 300",
+       "*volume_label.borderWIdth: 1",
        "*volume_bar.length: 350",
        "*popup_load.title: Timidity <Load File>",
        "*popup_loadform.height: 400",
-       "*popup_loadform.background: gray75",
        "*load_dialog.label: File Name",
-       "*load_dialog*background: gray75",
+       "*load_dialog.label.background: gray85",
+       "*load_dialog*background: gray76",
        "*load_dialog.borderWidth: 0",
        "*load_dialog.height: 132",
        "*cwd_label.background: gray85",
+       "*trace.vertDistance: 2",
+       "*trace.borderWidth: 1",
+       "*trace_vport.borderWidth: 1",
+       "*trace_vport.background: gray76",
        "*load_dialog.label.font: -adobe-helvetica-bold-r-*-*-14-*-75-75-*-*-*-*",
        "*cwd_label.font: -adobe-helvetica-medium-r-*-*-12-*-75-75-*-*-*-*",
        "*cwd_info.font: -adobe-helvetica-medium-r-*-*-12-*-75-75-*-*-*-*",
-       "*cwd_info.background: gray75",
+       "*cwd_info.background: gray76",
        "*BitmapDir: " DEFAULT_PATH "/bitmaps/",
 #ifndef XAW3D
        "*volume_bar.translations: #override\\n\
@@ -1440,9 +1887,12 @@ void a_start_interface(int pipe_in) {
                ~Shift<Key>o:           do-voice()\\n\
                ~Ctrl Shift<Key>o:      do-voice(1)\\n\
                ~Ctrl ~Shift<Key>v:     do-volupdown(-10)\\n\
-               ~Ctrl Shift<Key>v:      do-volupdown(10)",
+               ~Ctrl Shift<Key>v:      do-volupdown(10)\\n\
+               ~Ctrl<Key>x:            do-exchange()\\n\
+               ~Ctrl<Key>t:            do-toggletrace()\\n\
+               <ConfigureNotify>:      do-resize()",
 
-       "*load_dialog.value.translations: #override\
+       "*load_dialog.value.translations: #override\\n\
                ~Ctrl<Key>Return:       do-chgdir()\\n\
                ~Ctrl<Key>KP_Enter:     do-chgdir()\\n\
                ~Ctrl ~Meta<Key>Tab:    do-complete() end-of-line()\\n\
@@ -1454,39 +1904,61 @@ void a_start_interface(int pipe_in) {
        "*file_simplemenu.quit.label:   Quit",
 #endif
        "*trace.translations: #override\\n\
+               <Btn1Down>: do-toggletrace()\\n\
+               <EnterNotify>: do-revcaption()\\n\
+               <LeaveNotify>: do-revcaption()\\n\
                <Expose>: draw-trace()",
     NULL,
   };
   XtAppContext app_con;
   char cbuf[PATH_MAX];
   Pixmap bmPixmap;
-  char *statusfontstr= "7x14";
   int bmwidth, bmheight;
-  int i;
+  int i, j, k, tmpi;
   int argc=1;
   float thumb, l_thumb;
   char *argv="timidity";
-
+  XFontStruct *labelfont,*volumefont,*tracefont;
+#ifdef I18N
+  #define XtNfontDEF XtNfontSet
+  XFontSet textfont;
+#else
+  #define XtNfontDEF XtNfont
+  XFontStruct *textfont;
+#endif
   XawListReturnStruct lrs;
 
+#ifdef DEBUG_PRINT_RESOURCE
+  for(i=0; fallback_resources[i] != NULL; i++) {
+       fprintf(stderr, "%s\n", fallback_resources[i++]);
+  }
+  exit(0);
+#endif
 #ifdef I18N
   XtSetLanguageProc(NULL,NULL,NULL);
 #endif
   toplevel=XtVaAppInitialize(&app_con,APP_CLASS,NULL,ZERO,&argc,&argv,
                                                 fallback_resources,NULL);
-  /*XtVaGetApplicationResources(toplevel,(caddr_t)&app_resources,resources,
-                                                 XtNumber(resources),NULL);
+  XtGetApplicationResources(toplevel,(caddr_t)&app_resources,resources,
+                                                 XtNumber(resources),NULL,0);
   bitmapdir = app_resources.bitmap_dir;
-  arrangetitle = app_resources.arrange_title;*/
+  arrangetitle = app_resources.arrange_title;
+  text_height = (Dimension)app_resources.text_height;
+  trace_width = (Dimension)app_resources.trace_width;
+  trace_height = (Dimension)app_resources.trace_height;
+  labelfont = app_resources.label_font;
+  volumefont = app_resources.volume_font;
+  textfont = app_resources.text_font;
+  tracefont = app_resources.trace_font;
   a_readconfig(&Cfg);
   disp = XtDisplay(toplevel);
   screen = DefaultScreen(disp);
   root_height = DisplayHeight(disp, screen);
   root_width = DisplayWidth(disp, screen);
   check_mark = XCreateBitmapFromData(XtDisplay(toplevel),
-                                      RootWindowOfScreen(XtScreen(toplevel)),
-                                      (char *) check_bits,
-                                      check_width,check_height);
+                               RootWindowOfScreen(XtScreen(toplevel)),
+                               (char *) check_bits,
+                               check_width,check_height);
   for(i= 0; i < MAXBITMAP; i++) {
        snprintf(cbuf,sizeof(cbuf),"%s/%s",bitmapdir,bmfname[i]);
        XReadBitmapFile(disp,RootWindow(disp,screen),cbuf,&bm_width[i],&bm_height[i],
@@ -1504,27 +1976,59 @@ void a_start_interface(int pipe_in) {
   DndRegisterIconDrop(FileDropedHandler);
 #endif
   XtAppAddActions(app_con, actions, XtNumber(actions));
-  base_f=XtVaCreateManagedWidget("base_form",boxWidgetClass,toplevel,NULL);
+
+  bgcolor = app_resources.common_bgcolor;
+  menubcolor = app_resources.menub_bgcolor;
+  textcolor = app_resources.common_fgcolor;
+  textbgcolor = app_resources.text_bgcolor;
+  text2bgcolor = app_resources.text2_bgcolor;
+  buttonbgcolor = app_resources.button_bgcolor;
+  buttoncolor = app_resources.button_fgcolor;
+  togglecolor = app_resources.toggle_fgcolor;
+  if(ctl->trace_playing) {
+       volcolor = app_resources.volume_color;
+       expcolor = app_resources.expr_color;
+       pancolor = app_resources.pan_color;
+       tracecolor = app_resources.trace_bgcolor;
+  }
+  base_f=XtVaCreateManagedWidget("base_form",boxWidgetClass,toplevel,
+                       XtNbackground,bgcolor,
+                       XtNwidth,rotatewidth[currwidth], NULL);
   m_box=XtVaCreateManagedWidget("menu_box",boxWidgetClass,base_f,
-                                                               XtNorientation, XtorientHorizontal,
-                                                               NULL);
-  file_mb=XtVaCreateManagedWidget("file_menubutton",menuButtonWidgetClass,m_box,NULL);
-  file_sm=XtVaCreatePopupShell("file_simplemenu",simpleMenuWidgetClass,file_mb,NULL);
-  title_mb=XtVaCreateManagedWidget("title_menubutton",menuButtonWidgetClass,m_box,NULL);
-  title_sm=XtVaCreatePopupShell("title_simplemenu",simpleMenuWidgetClass,title_mb,NULL);
-  time_l=XtVaCreateManagedWidget("time_label",labelWidgetClass,m_box,NULL);
+                       XtNorientation,XtorientHorizontal,
+                       XtNbackground,bgcolor, NULL);
+  file_mb=XtVaCreateManagedWidget("file_menubutton",menuButtonWidgetClass,m_box,
+                       XtNforeground,textcolor, XtNbackground,menubcolor,
+                       XtNfont,labelfont, NULL);
+  file_sm=XtVaCreatePopupShell("file_simplemenu",simpleMenuWidgetClass,file_mb,
+                       XtNforeground,textcolor, XtNbackground,textbgcolor,
+                       NULL);
+  title_mb=XtVaCreateManagedWidget("title_menubutton",menuButtonWidgetClass,m_box,
+                       XtNforeground,textcolor, XtNbackground,menubcolor,
+                       XtNfont,labelfont, NULL);
+  title_sm=XtVaCreatePopupShell("title_simplemenu",simpleMenuWidgetClass,title_mb,
+                       XtNforeground,textcolor, XtNbackground,textbgcolor,
+                       NULL);
+  time_l=XtVaCreateManagedWidget("time_label",commandWidgetClass,m_box,
+                       XtNfont,labelfont,
+                       XtNbackground,menubcolor,NULL);
   b_box=XtVaCreateManagedWidget("button_box",boxWidgetClass,base_f,
-                                                               XtNorientation, XtorientHorizontal,
-                                                               XtNfromVert,m_box,NULL);
+                       XtNorientation,XtorientHorizontal,
+                       XtNwidth,rotatewidth[currwidth]-10,
+                       XtNbackground,bgcolor,XtNfromVert,m_box, NULL);
   v_box=XtVaCreateManagedWidget("volume_box",boxWidgetClass,base_f,
-                                                               XtNfromVert,b_box,NULL);
+                       XtNorientation,XtorientHorizontal,
+                       XtNwidth, TRACE_WIDTH_SHORT,
+                       XtNfromVert,b_box,XtNbackground,bgcolor, NULL);
   vol_l=XtVaCreateManagedWidget("volume_label",labelWidgetClass,v_box,
-                                                               NULL);
+                       XtNwidth, VOLUME_LABEL_WIDTH,
+                       XtNfont,volumefont,
+                       XtNforeground,textcolor, XtNbackground,bgcolor, NULL);
   vol_bar=XtVaCreateManagedWidget("volume_bar",scrollbarWidgetClass,v_box,
-                                                                 XtNorientation, XtorientHorizontal,
-                                                                 XtNfromVert,vol_l,
-                                                                 XtNtopOfThumb, &l_thumb,
-                                                                 NULL);
+                       XtNorientation, XtorientHorizontal,
+                       XtNwidth, TRACE_WIDTH_SHORT -VOLUME_LABEL_WIDTH -20,
+                       XtNbackground,textbgcolor,
+                       XtNfromVert,vol_l, XtNtopOfThumb,&l_thumb, NULL);
   l_thumb = thumb = (float)amplitude / (float)MAXVOLUME;
   if (sizeof(thumb) > sizeof(XtArgVal)) {
        XtVaSetValues(vol_bar,XtNtopOfThumb,&thumb,NULL);
@@ -1533,71 +2037,91 @@ void a_start_interface(int pipe_in) {
        XtVaSetValues(vol_bar,XtNtopOfThumb,*l_thumb,NULL);
   }
   play_b=XtVaCreateManagedWidget("play_button",toggleWidgetClass,b_box,
-                                                                XtNbitmap,bm_Pixmap[BM_PLAY],
-                                                                NULL);
+                       XtNbitmap,bm_Pixmap[BM_PLAY],
+                       XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,
+                       NULL);
   pause_b=XtVaCreateManagedWidget("pause_button",toggleWidgetClass,b_box,
-                                                                XtNbitmap,bm_Pixmap[BM_PAUSE],
-                                                                XtNfromHoriz, play_b,
-                                                                NULL);
+                       XtNbitmap,bm_Pixmap[BM_PAUSE],
+                       XtNfromHoriz, play_b,
+                       XtNforeground,togglecolor, XtNbackground,buttonbgcolor,
+                       NULL);
   stop_b=XtVaCreateManagedWidget("stop_button",commandWidgetClass,b_box,
-                                                                XtNbitmap,bm_Pixmap[BM_STOP],
-                                                                XtNfromHoriz,pause_b,NULL);
+                       XtNbitmap,bm_Pixmap[BM_STOP],
+                       XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,
+                       XtNfromHoriz,pause_b,NULL);
   prev_b=XtVaCreateManagedWidget("prev_button",commandWidgetClass,b_box,
-                                                                XtNbitmap,bm_Pixmap[BM_PREV],
-                                                                XtNfromHoriz,stop_b,NULL);
+                       XtNbitmap,bm_Pixmap[BM_PREV],
+                       XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,
+                       XtNfromHoriz,stop_b,NULL);
   back_b=XtVaCreateManagedWidget("back_button",commandWidgetClass,b_box,
-                                                                XtNbitmap,bm_Pixmap[BM_BACK],
-                                                                XtNfromHoriz,prev_b,NULL);
+                       XtNbitmap,bm_Pixmap[BM_BACK],
+                       XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,
+                       XtNfromHoriz,prev_b,NULL);
   fwd_b=XtVaCreateManagedWidget("fwd_button",commandWidgetClass,b_box,
-                                                                XtNbitmap,bm_Pixmap[BM_FWRD],
-                                                                XtNfromHoriz,back_b,NULL);
+                       XtNbitmap,bm_Pixmap[BM_FWRD],
+                       XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,
+                       XtNfromHoriz,back_b,NULL);
   next_b=XtVaCreateManagedWidget("next_button",commandWidgetClass,b_box,
-                                                                XtNbitmap,bm_Pixmap[BM_NEXT],
-                                                                XtNfromHoriz,fwd_b,NULL);
+                       XtNbitmap,bm_Pixmap[BM_NEXT],
+                       XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,
+                       XtNfromHoriz,fwd_b,NULL);
   quit_b=XtVaCreateManagedWidget("quit_button",commandWidgetClass,b_box,
-                                                                XtNbitmap,bm_Pixmap[BM_QUIT],
-                                                                XtNfromHoriz,next_b,NULL);
+                       XtNbitmap,bm_Pixmap[BM_QUIT],
+                       XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,
+                       XtNfromHoriz,next_b,NULL);
   random_b=XtVaCreateManagedWidget("random_button",toggleWidgetClass,b_box,
-                                                                  XtNbitmap,bm_Pixmap[BM_RANDOM],
-                                                                  XtNfromHoriz,quit_b,
-                                                                  NULL);
+                       XtNbitmap,bm_Pixmap[BM_RANDOM],
+                       XtNfromHoriz,quit_b,
+                       XtNforeground,togglecolor, XtNbackground,buttonbgcolor,
+                       NULL);
   repeat_b=XtVaCreateManagedWidget("repeat_button",toggleWidgetClass,b_box,
-                                                                  XtNbitmap,bm_Pixmap[BM_REPEAT],
-                                                                  XtNfromHoriz,random_b,
-                                                                  NULL);
-
+                       XtNbitmap,bm_Pixmap[BM_REPEAT],
+                       XtNfromHoriz,random_b,
+                       XtNforeground,togglecolor, XtNbackground,buttonbgcolor,
+                       NULL);
   popup_load=XtVaCreatePopupShell("popup_load",transientShellWidgetClass,toplevel,
-                                                                 NULL);  
+                       NULL);  
   popup_load_f= XtVaCreateManagedWidget("popup_loadform",formWidgetClass,popup_load,
-                                                                NULL);
+                       XtNbackground,textbgcolor, NULL);
   load_d=XtVaCreateManagedWidget("load_dialog",dialogWidgetClass,popup_load_f,
-                                                                XtNresizable, True,
-                                                                NULL);
+                       XtNbackground,textbgcolor, XtNresizable,True, NULL);
   cwd_l = XtVaCreateManagedWidget("cwd_label",labelWidgetClass,popup_load_f,
-                               XtNlabel,basepath, XtNborderWidth,0, XtNfromVert,load_d,
-                               XtNresizable,True, NULL);
+                       XtNlabel,basepath, XtNborderWidth,0, XtNfromVert,load_d,
+                       XtNbackground,text2bgcolor, XtNresizable,True, NULL);
   load_vport = XtVaCreateManagedWidget("vport",viewportWidgetClass, popup_load_f,
-                               XtNfromVert,cwd_l,      XtNallowHoriz,True, XtNallowVert,True,
-                               XtNwidth,250, XtNheight,200, NULL);
+                       XtNfromVert,cwd_l,      XtNallowHoriz,True, XtNallowVert,True,
+                       XtNwidth,250, XtNheight,200, NULL);
   load_flist = XtVaCreateManagedWidget("files",listWidgetClass,load_vport,
-                               XtNverticalList,True, XtNforceColumns,False,
-                               XtNdefaultColumns, 3, NULL);
+                       XtNverticalList,True, XtNforceColumns,False,
+                       XtNdefaultColumns, 3, NULL);
   load_info = XtVaCreateManagedWidget("cwd_info",labelWidgetClass,popup_load_f,
-                               XtNborderWidth,0, XtNwidth,250, XtNheight,32,
-                               XtNfromVert,load_vport, NULL);
+                       XtNborderWidth,0, XtNwidth,250, XtNheight,32,
+                       XtNbackground,text2bgcolor,     XtNfromVert,load_vport, NULL);
   XawDialogAddButton(load_d, "OK", popdownLoad,"Y");
   XawDialogAddButton(load_d, "Cancel", popdownLoad,NULL);
 #ifndef WIDGET_IS_LABEL_WIDGET
   lyric_t=XtVaCreateManagedWidget("lyric_text",asciiTextWidgetClass,base_f,
-                               XtNwrap,XawtextWrapWord, XtNeditType,XawtextAppend,
-                               XtNfromVert,v_box, NULL);
+                       XtNwrap,XawtextWrapWord, XtNeditType,XawtextAppend,
+                       XtNwidth, rotatewidth[currwidth]-10,
 #else
-  lyric_t=XtVaCreateManagedWidget("lyric_text",labelWidgetClass,base_f,NULL);
+  lyric_t=XtVaCreateManagedWidget("lyric_text",labelWidgetClass,base_f,
+                       XtNresize, False,
+                       XtNforeground,textcolor, XtNbackground,menubcolor,
+                       XtNwidth,rotatewidth[currwidth]-10,
 #endif
+                       XtNfontDEF,textfont, XtNheight,text_height,
+                       XtNfromVert,v_box, NULL);
   if(ctl->trace_playing) {
-       trace=XtVaCreateManagedWidget("trace",widgetClass,base_f,
-                                                                 XtNfromVert,lyric_t,NULL);
-       XtVaSetValues(trace,XtNwidth,trace_width,XtNheight,trace_height,NULL);
+       trace_vport = XtVaCreateManagedWidget("trace_vport",viewportWidgetClass, base_f,
+                       XtNallowHoriz,True, XtNallowVert,True,
+                       XtNuseBottom,True,XtNfromVert,lyric_t,
+#ifdef WIDGET_IS_LABEL_WIDGET
+                       XtNuseRight,True,
+#endif
+                       XtNwidth,trace_width, XtNheight,trace_height+12, NULL);
+       trace = XtVaCreateManagedWidget("trace",widgetClass,trace_vport,
+                       XtNwidth,trace_width,
+                       XtNheight,BAR_SPACE*MAX_XAW_MIDI_CHANNELS+TRACEV_OFS, NULL);
   }
   XtAddCallback(quit_b,XtNcallback,quitCB,NULL);
   XtAddCallback(play_b,XtNcallback,playCB,NULL);
@@ -1613,15 +2137,17 @@ void a_start_interface(int pipe_in) {
   XtAddCallback(vol_bar,XtNscrollProc,volupdownCB,NULL);
   XtAppAddInput(app_con,pipe_in,(XtPointer)XtInputReadMask,handle_input,NULL);
   XtAddCallback(load_flist,XtNcallback,(XtCallbackProc)setDirList,cwd_l);
+  XtAddCallback(time_l,XtNcallback,(XtCallbackProc)exchgWidthCB,NULL);
 
   XtRealizeWidget(toplevel);
-
   dirlist =(String *)malloc(sizeof(String)* MAX_DIRECTORY_ENTRY);
   dirlist[0] = (char *)NULL;
   lrs.string = "";
   setDirList(load_flist, cwd_l, &lrs);
   XtSetKeyboardFocus(base_f, base_f);
   XtSetKeyboardFocus(lyric_t, base_f);
+  if(ctl->trace_playing) 
+       XtSetKeyboardFocus(trace, base_f);
   XtSetKeyboardFocus(popup_load, load_d);
   XtOverrideTranslations (toplevel,
                        XtParseTranslationTable ("<Message>WM_PROTOCOLS: do-quit()"));
@@ -1640,22 +2166,85 @@ void a_start_interface(int pipe_in) {
   if(ctl->trace_playing) {
        Panel = (PanelInfo *)safe_malloc(sizeof(PanelInfo));
        gct = XCreateGC(disp, RootWindow(disp, screen), 0, NULL);
-       XAllocNamedColor(disp,DefaultColormap(disp, screen),"green",&fgtmp,&defcolor);
-       XAllocNamedColor(disp,DefaultColormap(disp, screen),"red",&bgcolor,&defcolor);
+       gc = XCreateGC(disp, RootWindow(disp, screen), 0, NULL);
        for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++) {
          if(ISDRUMCHANNEL(i))
-               barcol[i]=bgcolor.pixel;
+               barcol[i]=app_resources.drumvelocity_color;
          else
-               barcol[i]=fgtmp.pixel;
+               barcol[i]=app_resources.velocity_color;
+         inst_name[i] = (char *)safe_malloc(sizeof(char) * INST_NAME_SIZE);
+       }
+       rimcolor = app_resources.rim_color;
+       boxcolor = app_resources.box_color;
+       capcolor = app_resources.caption_color;
+       black = BlackPixel(disp, screen);
+       white = WhitePixel(disp, screen);
+       suscolor = app_resources.sus_color;
+       playcolor = app_resources.play_color;
+       revcolor = app_resources.rev_color;
+       chocolor = app_resources.cho_color;
+       XSetFont(disp, gct, tracefont->fid);
+
+       keyG = (ThreeL *)safe_malloc(sizeof(ThreeL) * KEY_NUM);
+       for(i=0, j= BARH_OFS8+1; i<KEY_NUM; i++) {
+         tmpi = i%12;
+         switch(tmpi) {
+         case 0:
+         case 5:
+         case 10:
+               keyG[i].k[0].y = 11; keyG[i].k[0].l = 7;
+               keyG[i].k[1].y = 2; keyG[i].k[1].l = 16;
+               keyG[i].k[2].y = 11; keyG[i].k[2].l = 7;
+               keyG[i].col = white;
+               break;
+         case 2:
+         case 7:
+               keyG[i].k[0].y = 11; keyG[i].k[0].l = 7;
+               keyG[i].k[1].y = 2; keyG[i].k[1].l = 16;
+               keyG[i].k[2].y = 2; keyG[i].k[2].l = 16;                
+               keyG[i].col = white; break;
+         case 3:
+         case 8:
+               j += 2;
+               keyG[i].k[0].y = 2; keyG[i].k[0].l = 16;
+               keyG[i].k[1].y = 2; keyG[i].k[1].l = 16;
+               keyG[i].k[2].y = 11; keyG[i].k[2].l = 7;
+               keyG[i].col = white; break;
+         default:      /* black key */
+               keyG[i].k[0].y = 2; keyG[i].k[0].l = 8;
+               keyG[i].k[1].y = 2; keyG[i].k[1].l = 8;
+               keyG[i].k[2].y = 2; keyG[i].k[2].l = 8;
+               keyG[i].col = black; break;
+         }
+         keyG[i].xofs = j; j += 2;
        }
-       XAllocNamedColor(disp,DefaultColormap(disp, screen),"black",&bgcolor,&defcolor);
-       XAllocNamedColor(disp,DefaultColormap(disp, screen),"yellow",&fgpan,&defcolor);
-       XAllocNamedColor(disp,DefaultColormap(disp, screen),"white",&fgstr,&defcolor);
-       if ((StatusFont = XLoadQueryFont(disp, statusfontstr)) == NULL)
-         if ((StatusFont = XLoadQueryFont(disp, "fixed")) == NULL)
-               perror("can't load fixed font. \n");
-       XSetFont(XtDisplay(trace), gct, StatusFont->fid);       
-       initTraceWindow(False);
+
+       /* draw on template pixmaps that includes one channel row */
+       for(i=0; i<2; i++) {
+         layer[i] = XCreatePixmap(disp,XtWindow(trace),TRACE_WIDTH,BAR_SPACE,
+                                  DefaultDepth(disp,screen));
+         drawKeyboardAll(disp, layer[i]);
+         XSetForeground(disp, gc, capcolor);
+         XDrawLine(disp,layer[i],gc,0,0,TRACE_WIDTH,0);
+         XDrawLine(disp,layer[i],gc,0,0,0,BAR_SPACE);
+         XDrawLine(disp,layer[i],gc,TRACE_WIDTH-1,0,TRACE_WIDTH-1,BAR_SPACE);
+
+         for(j=0; j<pl[i].col -1; j++) {
+               int w;
+               tmpi= TRACEH_OFS; w= pl[i].w[j];
+               for(k= 0; k<j; k++) tmpi += pl[i].w[k];
+               tmpi = pl[i].ofs[j];
+               XSetForeground(disp,gc, capcolor);
+               XDrawLine(disp,layer[i],gc, tmpi+w,0,tmpi+w,BAR_SPACE);
+               XSetForeground(disp,gc, rimcolor);
+               XDrawLine(disp,layer[i],gc,tmpi+w-2,2,tmpi+w-2,BAR_HEIGHT+1);
+               XDrawLine(disp,layer[i],gc,tmpi+2,BAR_HEIGHT+2,tmpi+w-2,BAR_HEIGHT+2);
+               XSetForeground(disp,gc, ((j)? boxcolor:textbgcolor));
+               XFillRectangle(disp,layer[i],gc,tmpi+2,2,w-4,BAR_HEIGHT);
+         }
+       }
+       initStatus();
+       XFreeGC(disp,gc);
   }
   while (1) {
        a_pipe_read(local_buf,sizeof(local_buf));
@@ -1671,32 +2260,42 @@ void a_start_interface(int pipe_in) {
   }
   for (i = 0; i < XtNumber(file_menu); i++) {
        bsb=XtVaCreateManagedWidget(file_menu[i].name,
-                                       (file_menu[i].trap ? smeBSBObjectClass:smeLineObjectClass),
-                                       file_sm,XtNleftBitmap, None,XtNleftMargin,24,NULL),
+                       (file_menu[i].trap ? smeBSBObjectClass:smeLineObjectClass),
+                       file_sm,XtNleftBitmap, None,XtNleftMargin,24,NULL),
          XtAddCallback(bsb,XtNcallback,filemenuCB,(XtPointer)&file_menu[i].id);
        file_menu[i].widget = bsb;
   }
-  if(!ctl->trace_playing)
+  if(!ctl->trace_playing) {
+       Dimension w2,h2;
        XtVaSetValues(file_menu[ID_HIDETRACE-100].widget,XtNsensitive,False,NULL);
+       XtVaSetValues(lyric_t,XtNwidth,TRACE_WIDTH_SHORT -12,NULL);
+       XtVaGetValues(toplevel,XtNheight,&i,NULL);
+       XtMakeResizeRequest(toplevel,TRACE_WIDTH_SHORT,i,&w2,&h2);
+  }
+  /* Please sleep here to make widgets arrange by Form Widget,
+   * otherwise the widget geometry is broken.
+   * Strange!!
+   */
   if(Cfg.hidetext || !Cfg.disptrace) {
-      /* Please sleep here, otherwise the widget geometry is broken.
-       * Strange!!
-       */
-      XSync(disp, False);
-      sleep(1);
+       XSync(disp, False);
+       usleep(10000);
   }
-  if (Cfg.autostart) filemenuCB(file_menu[ID_AUTOSTART-100].widget,
-                                                       &file_menu[ID_AUTOSTART-100].id,NULL);
-  if (Cfg.hidetext) filemenuCB(file_menu[ID_HIDETXT-100].widget,
-                                                  &file_menu[ID_HIDETXT-100].id,NULL);
-  if (!Cfg.disptrace) filemenuCB(file_menu[ID_HIDETRACE-100].widget,
-                                                        &file_menu[ID_HIDETRACE-100].id,NULL);
-
-  if (Cfg.repeat) repeatCB(NULL,&Cfg.repeat,NULL);
-  if (Cfg.shuffle) randomCB(NULL,&Cfg.shuffle,NULL);
-  if (Cfg.autostart)
+  if(Cfg.autostart)
+    filemenuCB(file_menu[ID_AUTOSTART-100].widget,
+               &file_menu[ID_AUTOSTART-100].id,NULL);
+  if(Cfg.hidetext)
+    filemenuCB(file_menu[ID_HIDETXT-100].widget,
+               &file_menu[ID_HIDETXT-100].id,NULL);
+  if(!Cfg.disptrace)
+    filemenuCB(file_menu[ID_HIDETRACE-100].widget,
+               &file_menu[ID_HIDETRACE-100].id,NULL);
+
+  if(Cfg.repeat) repeatCB(NULL,&Cfg.repeat,NULL);
+  if(Cfg.shuffle) randomCB(NULL,&Cfg.shuffle,NULL);
+  if(Cfg.autostart)
        playCB(NULL,NULL,NULL);
   else
        stopCB(NULL,NULL,NULL);
+  if(ctl->trace_playing) initStatus();
   XtAppMainLoop(app_con);
 }
index 479df6c..815ddbb 100644 (file)
@@ -103,6 +103,7 @@ VERSION = @VERSION@
 WISH = @WISH@
 dynamic_targets = @dynamic_targets@
 lispdir = @lispdir@
+program_transform_name = @program_transform_name@
 so = @so@
 tcltk_dep = @tcltk_dep@
 
@@ -281,6 +282,8 @@ arc_lzh.o: arc_lzh.c ../config.h ../timidity/timidity.h arc.h \
        ../utils/memb.h ../utils/mblock.h url.h
 arc_mime.o: arc_mime.c ../config.h ../timidity/timidity.h \
        ../utils/mblock.h zip.h arc.h ../utils/memb.h url.h
+arc_newsgroup.o: arc_newsgroup.c ../config.h ../timidity/timidity.h \
+       arc.h ../utils/memb.h ../utils/mblock.h url.h
 arc_tar.o: arc_tar.c ../config.h ../timidity/timidity.h \
        ../utils/mblock.h zip.h arc.h ../utils/memb.h url.h
 arc_zip.o: arc_zip.c ../config.h ../timidity/timidity.h arc.h \
@@ -301,11 +304,19 @@ url_cache.o: url_cache.c ../config.h ../timidity/timidity.h url.h \
 url_dir.o: url_dir.c ../config.h ../timidity/timidity.h url.h \
        ../utils/strtab.h ../utils/mblock.h
 url_file.o: url_file.c ../config.h ../timidity/timidity.h url.h
+url_ftp.o: url_ftp.c ../config.h ../timidity/timidity.h url.h \
+       ../utils/net.h
 url_hqxdecode.o: url_hqxdecode.c ../config.h ../timidity/timidity.h \
        url.h
+url_http.o: url_http.c ../config.h ../timidity/timidity.h url.h \
+       ../utils/net.h
 url_inflate.o: url_inflate.c ../config.h ../timidity/timidity.h url.h \
        ../utils/mblock.h zip.h
 url_mem.o: url_mem.c ../config.h ../timidity/timidity.h url.h
+url_news.o: url_news.c ../config.h ../timidity/timidity.h url.h \
+       ../utils/net.h
+url_newsgroup.o: url_newsgroup.c ../config.h ../timidity/timidity.h \
+       url.h ../utils/net.h
 url_pipe.o: url_pipe.c ../config.h ../timidity/timidity.h url.h
 url_qsdecode.o: url_qsdecode.c ../config.h ../timidity/timidity.h url.h
 url_uudecode.o: url_uudecode.c ../config.h ../timidity/timidity.h url.h
index f4ba400..d14bfa1 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "memb.h"
 
-#define ARC_LIB_VERSION "1.4.10"
+#define ARC_LIB_VERSION "1.4.11"
 #define ARC_DEFLATE_LEVEL 6    /* 1:Compress faster .. 9:Compress better */
 
 typedef struct _ArchiveStreamURL
index d3c1f7e..fdb34db 100644 (file)
@@ -100,15 +100,26 @@ ArchiveEntryNode *next_mime_entry(ArchiveHandler archiver)
                *p++ = '\0';
                while(*p == ' ')
                    p++;
-               if(strcasecmp(hdr.value, "multipart/mixed") == 0)
+               if(strncasecmp(hdr.value, "multipart/mixed", 15) == 0)
                {
                    /* Content-Type: multipart/mixed; boundary="XXXX" */
-                   if(strncasecmp(p, "boundary=\"", 10) == 0)
+                   if(strncasecmp(p, "boundary=", 9) == 0)
                    {
-                       p += 10;
-                       new_boundary = p;
-                       if((p = strchr(p, '"')) == NULL)
-                           continue;
+                       p += 9;
+                       if(*p == '"')
+                       {
+                           p++;
+                           new_boundary = p;
+                           if((p = strchr(p, '"')) == NULL)
+                               continue;
+                       }
+                       else
+                       {
+                           new_boundary = p;
+                           while(*p > '"' && *p < 0x7f)
+                               p++;
+                       }
+
                        *p = '\0';
                        new_boundary = strdup_mblock(&pool, new_boundary);
                    }
index 3753723..e530ed1 100644 (file)
@@ -485,7 +485,7 @@ static char *url_strerror_txt[] =
 char *url_strerror(int no)
 {
     if(no <= URLERR_NONE)
-       return (char *)sys_errlist[no];
+       return strerror(no);
     if(no >= URLERR_MAXNO)
        return "Internal error";
     return url_strerror_txt[no - URLERR_NONE];
index 2d5545a..a93407e 100644 (file)
 #include "timidity.h"
 #include "url.h"
 
-#ifdef __WIN32__
+
+#ifdef __W32_READDIR__
 #include "readdir.h"
+# define NAMLEN(dirent) strlen((dirent)->d_name)
 #else
-#include <sys/types.h>
-#if defined(sun)
-#include <dirent.h>
-#elif defined(SVR4) || defined(SYSTYPE_SVR4) || defined(__svr4__)
-#include <sys/dir.h>
-#define dirent direct
+
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
 #else
-#include <dirent.h>
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+#  include <ndir.h>
+# endif
 #endif
+
 #endif
 
+
 #ifdef URL_DIR_CACHE_ENABLE
 #include <sys/stat.h>
 #include "strtab.h"
@@ -79,12 +91,16 @@ static struct dir_cache_t *scan_cached_files(struct dir_cache_t *p,
     init_string_table(&stab);
     while((d = readdir(dirp)) != NULL)
     {
+       int dlen;
+
        /* Skip removed file. */
        if(d->d_ino == 0)
            continue;
+       if((dlen = NAMLEN(d)) == 0)
+           continue;
 
        /* put into string table */
-       if(put_string_table(&stab, d->d_name, strlen(d->d_name)) == NULL)
+       if(put_string_table(&stab, d->d_name, dlen) == NULL)
        {
            url_errno = errno;
            delete_string_table(&stab);
@@ -376,6 +392,7 @@ static char *url_dir_gets(URL url, char *buff, int n)
        }
        urlp->ptr = *urlp->fptr;
        urlp->fptr++;
+       urlp->len = strlen(urlp->ptr);
 #else
 
        do
@@ -384,9 +401,10 @@ static char *url_dir_gets(URL url, char *buff, int n)
                urlp->endp = 1;
                return NULL;
            }
-       while (urlp->d->d_ino == 0);
+       while (urlp->d->d_ino == 0 ||
+              NAMLEN(urlp->d) == 0);
        urlp->ptr = urlp->d->d_name;
+       urlp->len = NAMLEN(urlp->d);
 #endif
-       urlp->len = strlen(urlp->ptr);
     }
 }
index 67253c7..faa2762 100644 (file)
@@ -25,7 +25,6 @@ INCLUDES = \
        -I$(top_srcdir)/utils \
        $(EXTRAINCS)
 
-
 bin_PROGRAMS = timidity
 
 timidity_SOURCES = \
@@ -124,7 +123,7 @@ timidity_DEPENDENCIES = $(SYSEXTRAS:.c=.o) \
        $(top_builddir)/libarc/libarc.a \
        $(top_builddir)/utils/libutils.a
 
-version.o: version.c Makefile
+version.o: version.c ../configure
        $(CC) $(CFLAGS) -DTIMID_VERSION=\"$(VERSION)\" -c $(srcdir)/version.c
 
 $(top_builddir)/interface/libinterface.a:
index b656165..91d6bc3 100644 (file)
@@ -103,6 +103,7 @@ VERSION = @VERSION@
 WISH = @WISH@
 dynamic_targets = @dynamic_targets@
 lispdir = @lispdir@
+program_transform_name = @program_transform_name@
 so = @so@
 tcltk_dep = @tcltk_dep@
 
@@ -374,7 +375,8 @@ output.o: output.c ../config.h timidity.h output.h tables.h audio_cnv.h
 playmidi.o: playmidi.c ../config.h timidity.h common.h ../libarc/url.h \
        ../utils/mblock.h instrum.h playmidi.h readmidi.h output.h \
        mix.h controls.h miditrace.h recache.h ../libarc/arc.h \
-       ../utils/memb.h reverb.h wrd.h tables.h
+       ../utils/memb.h reverb.h wrd.h ../interface/soundspec.h \
+       tables.h
 raw_a.o: raw_a.c ../config.h timidity.h output.h controls.h
 rcp.o: rcp.c ../config.h timidity.h common.h ../libarc/url.h \
        ../utils/mblock.h instrum.h playmidi.h readmidi.h controls.h
@@ -404,8 +406,8 @@ tables.o: tables.c ../config.h timidity.h common.h ../libarc/url.h \
 timidity.o: timidity.c ../config.h ../interface.h timidity.h common.h \
        ../libarc/url.h ../utils/mblock.h instrum.h playmidi.h \
        readmidi.h output.h controls.h tables.h miditrace.h reverb.h \
-       recache.h ../libarc/arc.h ../utils/memb.h ../utils/strtab.h \
-       wrd.h mid.defs
+       ../interface/soundspec.h recache.h ../libarc/arc.h \
+       ../utils/memb.h ../utils/strtab.h wrd.h mid.defs
 wave_a.o: wave_a.c ../config.h timidity.h output.h controls.h
 wrd_read.o: wrd_read.c ../config.h timidity.h common.h ../libarc/url.h \
        ../utils/mblock.h instrum.h playmidi.h readmidi.h controls.h \
@@ -478,7 +480,7 @@ maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 include $(top_builddir)/common.makefile
 
-version.o: version.c Makefile
+version.o: version.c ../configure
        $(CC) $(CFLAGS) -DTIMID_VERSION=\"$(VERSION)\" -c $(srcdir)/version.c
 
 $(top_builddir)/interface/libinterface.a:
index 7354f05..cd719ad 100644 (file)
@@ -143,7 +143,7 @@ static int open_output(void)
        if(dpm.fd < 0)
        {
            ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
-                     dpm.name, sys_errlist[errno]);
+                     dpm.name, strerror(errno));
            return -1;
        }
     }
index 645b71f..9f8d018 100644 (file)
@@ -128,7 +128,7 @@ static int open_output(void)
        if(dpm.fd < 0)
        {
            ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
-                     dpm.name, sys_errlist[errno]);
+                     dpm.name, strerror(errno));
            return -1;
        }
        comment = dpm.name;
index fbdcaf7..c216816 100644 (file)
@@ -83,7 +83,7 @@ char audriv_errmsg[BUFSIZ];
 #ifndef SGI_OLDAL
 #define ALERROR alGetErrorString(oserror())
 #else
-#define ALERROR sys_errlist[oserror()]
+#define ALERROR strerror(oserror())
 #endif /* SGI_OLDAL */
 
 static void audriv_err(const char *msg)
index 6daef8a..0dbc3c2 100644 (file)
@@ -92,9 +92,6 @@ static long internal_play_encoding = AUDIO_ENCODING_ULAW;
 static int internal_play_channels = 1;
 
 char audriv_errmsg[BUFSIZ];
-#ifndef        __NetBSD__
-extern char *sys_errlist[];
-#endif
 
 static const long available_sample_rates[] =
 {
@@ -153,7 +150,7 @@ unsigned ualarm(unsigned, unsigned);
 
 static void audriv_syserr(const char *msg)
 {
-    sprintf(audriv_errmsg, "%s: %s", msg, sys_errlist[errno]);
+    sprintf(audriv_errmsg, "%s: %s", msg, strerror(errno));
     if(audriv_error_handler != NULL)
        audriv_error_handler(audriv_errmsg);
     else
index 9470c01..276911e 100644 (file)
@@ -82,7 +82,7 @@ static int open_output(void)
     if ((fd=open(dpm.name, O_RDWR | O_NDELAY, 0)) < 0)
     {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
-                 dpm.name, sys_errlist[errno]);
+                 dpm.name, strerror(errno));
        return -1;
     }
 
index 37658dc..0940962 100644 (file)
@@ -312,7 +312,7 @@ struct timidity_file *open_file(char *name, int decompress, int noise_mode)
     {
       if(noise_mode)
         ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
-                 current_filename, sys_errlist[errno]);
+                 current_filename, strerror(errno));
       return 0;
     }
 
@@ -342,7 +342,7 @@ struct timidity_file *open_file(char *name, int decompress, int noise_mode)
 #endif /* __MACOS__ */
          {
            ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
-                current_filename, sys_errlist[errno]);
+                current_filename, strerror(errno));
            return 0;
          }
        plp=plp->next;
@@ -354,7 +354,7 @@ struct timidity_file *open_file(char *name, int decompress, int noise_mode)
 
   if (noise_mode>=2)
       ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", name,
-               errno ? sys_errlist[errno] : "Can't open file");
+               errno ? strerror(errno) : "Can't open file");
 
   return 0;
 }
@@ -427,7 +427,7 @@ long tf_tell(struct timidity_file *tf)
     return pos;
 }
 
-static void safe_exit(int status)
+void safe_exit(int status)
 {
     if(play_mode->fd != -1)
     {
@@ -868,33 +868,3 @@ int check_file_extension(char *filename, char *ext, int decompress)
     }
     return 0;
 }
-
-#ifndef HAVE_VSNPRINTF
-void vsnprintf(char *buff, size_t bufsiz, const char *fmt, va_list ap)
-{
-    MBlockList pool;
-    char *tmpbuf = buff;
-
-    if(bufsiz < MIN_MBLOCK_SIZE)
-    {
-       init_mblock(&pool);
-       tmpbuf = (char *)new_segment(&pool, MIN_MBLOCK_SIZE);
-    }
-    vsprintf(tmpbuf, fmt, ap);
-    if(tmpbuf != buff)
-    {
-       strncpy(buff, tmpbuf, bufsiz);
-       reuse_mblock(&pool);
-    }
-}
-#endif /* HAVE_VSNPRINTF */
-
-#ifndef HAVE_SNPRINTF
-void snprintf(char *buff, size_t bufsiz, const char *fmt, ...)
-{
-    va_list ap;
-    va_start(ap, fmt);
-    vsnprintf(buff, bufsiz, fmt, ap);
-    va_end(ap);
-}
-#endif /* HAVE_VSNPRINTF */
index ff9a94a..9a06c02 100644 (file)
@@ -78,9 +78,7 @@ extern char **expand_file_archives(char **files, int *nfiles_in_out);
 extern void code_convert(char *in, char *out, int outsiz,
                         char *in_code, char *out_code);
 
-#ifndef HAVE_SNPRINTF
-void snprintf(char *buff, size_t bufsiz, const char *fmt, ...);
-#endif
+extern void safe_exit(int status);
 
 extern char *timidity_version;
 extern MBlockList tmpbuffer;
index 1a42f00..8783740 100644 (file)
@@ -18,7 +18,7 @@
 #endif
 
 #ifdef __NetBSD__
-# define dlerror() sys_errlist[errno]
+# define dlerror() strerror(errno)
 #endif
 
 
index 26691ff..9916125 100644 (file)
@@ -52,7 +52,7 @@ void *dl_load_file(char *filename)
     obj = shl_load(filename, bind_type | BIND_NOSTART, 0L);
     if(obj == NULL)
     {
-       fprintf(stderr, "%s\n", sys_errlist[errno]);
+       perror(filename);
        return NULL;
     }
     return (void *)obj;
@@ -78,7 +78,7 @@ void *dl_find_symbol(void *libhandle, char *symbolname)
 
     if(status == -1)
     {
-       fprintf(stderr, "%s\n", errno ? sys_errlist[errno] : "Symbol not found.");
+       fprintf(stderr, "%s\n", errno ? strerror(errno) : "Symbol not found.");
        return NULL;
     }
     return symaddr;
index cfe0f83..3014291 100644 (file)
@@ -86,7 +86,7 @@ dpm.fd = open(dpm.name, O_WRONLY, 0);
 if(dpm.fd == -1)
     {
       ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
-          dpm.name, sys_errlist[errno]);
+          dpm.name, strerror(errno));
       return -1;
     }
 
index 7483502..b393085 100644 (file)
@@ -154,7 +154,7 @@ static void fd_set_nonblocking(int fd, int noblock)
     if(ioctl(fd, FIONBIO, &arg) < 0)
     {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "ioctl:FIONBIO %s",
-                 sys_errlist[errno]);
+                 strerror(errno));
        sleep(3);
     }
 }
@@ -170,7 +170,7 @@ static int open_output(void)
   if (fd<0)
     {
       ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
-          dpm.name, sys_errlist[errno]);
+          dpm.name, strerror(errno));
       return -1;
     }
 
index 1e64e32..49f7f13 100644 (file)
@@ -36,7 +36,8 @@
  #endif
 #endif
 
-#define        TIMID_VERSION   "\p0.2i+AC3+R3.2.4 " TIMID_CPU
+#define        TIMID_VERSION   "1.0.0 " TIMID_CPU
+#define        TIMID_VERSION_PASCAL    "\p" TIMID_VERSION
 
 
 #define PI 3.14159265358979323846
@@ -50,7 +51,7 @@
 #undef  DEFAULT_RATE
 #define DEFAULT_RATE   22050
 
-#define        AU_MAC
+#define        AU_MACOS
 #define BIG_ENDIAN
 #undef  TILD_SCHEME_ENABLE
 #undef  JAPANESE
@@ -58,6 +59,7 @@
 #define DEFAULT_PATH   ""
 #undef  CONFIG_FILE
 #define CONFIG_FILE DEFAULT_PATH "timidity.cfg"
+#define ENABLE_SHERRY
 
 #define MAC_SOUNDBUF_QLENGTH (stdQLength*4)
 
index 9728678..90aa23b 100644 (file)
@@ -134,13 +134,10 @@ static void InitMenuBar()
        DrawMenuBar();
 }
 
-int  main()
+static void mac_init()
 {
-       EventRecord     event;
-       int32   output_rate=DEFAULT_RATE;
        long    gestaltResponse;
-       int             err;
-       
+
        InitGraf( &qd.thePort );
        InitFonts();
        FlushEvents( everyEvent,0 );
@@ -172,9 +169,17 @@ int  main()
        AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
                                        NewAEEventHandlerProc(myHandleODOC), 0, false);
        AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
-                                       NewAEEventHandlerProc(myHandleQUIT), 0, false);
-       
+                                       NewAEEventHandlerProc(myHandleQUIT), 0, false); 
        InitMenuBar();
+}
+
+int  main()
+{
+       EventRecord     event;
+       int32   output_rate=DEFAULT_RATE;
+       int             err;
+       
+       mac_init();     
        
        nPlaying=mac_n_files=0; skin_state=WAITING;
        
@@ -195,6 +200,7 @@ int  main()
     timidity_init_player();
        ctl->open(0, 0);
        play_mode->open_output();
+       init_load_soundfont();
        wrdt=wrdt_list[0];  //dirty!!
        if(wrdt->open("d"))
        {       //some errors
@@ -405,7 +411,7 @@ static void mac_AboutBox()
        dialog=GetNewDialog(200,0,(WindowRef)-1);
        if( dialog==0 ) return;
        SetDialogDefaultItem(dialog, 1);
-       ParamText(TIMID_VERSION, "\p", "\p", "\p");
+       ParamText(TIMID_VERSION_PASCAL, "\p", "\p", "\p");
        
        ShowWindow(dialog);
        for(;;){
@@ -478,6 +484,13 @@ void mac_HandleMenuSelect(long select)
        case iPref:     mac_SetPlayOption(); return;
        case iQuit:     DoQuit();                        return;
        
+       //Play menu
+       case iPlay:     SKIN_ACTION_PLAY(); break;
+       case iStop:     SKIN_ACTION_STOP();     break;
+       case iPause:    SKIN_ACTION_PAUSE(); break;
+       case iPrev:     SKIN_ACTION_PREV(); break;
+       case iNext:     SKIN_ACTION_NEXT(); break;
+       
                //Synth menu
        case iTiMidity:{
                MenuHandle menu=GetMenu(mSynth);
index 7ef5723..31c7287 100644 (file)
@@ -113,9 +113,18 @@ enum{
        //-                  F,
        iQuit=          0x00810010,
 
+       mPlay=0x0082,
+       iPlay=0x00820001,
+       iStop=0x00820002,
+       iPause=0x00820003,
+       //-            4
+       iPrev=0x00820005,
+       iNext=0x00820006,
+       
        mSynth=0x00A0,
        iTiMidity=0x00A00001,
        iQuickTime=0x00A00002
+       
 };
 
 #define        kPlayerWinID    128
index 7584b6a..ab2e919 100644 (file)
@@ -286,6 +286,43 @@ void s32toalaw(int32 *lp, int32 c)
     }
 }
 
+char *output_encoding_string(int enc)
+{
+    if(enc & PE_MONO)
+       if(enc & PE_16BIT)
+           if(enc & PE_SIGNED)
+               return "16bit (mono)";
+           else
+               return "unsigned 16bit (mono)";
+       else
+           if(enc & PE_ULAW)
+               return "U-law (mono)";
+           else if(enc & PE_ALAW)
+               return "A-law (mono)";
+           else
+               if(enc & PE_SIGNED)
+                   return "8bit (mono)";
+               else
+                   return "unsigned 8bit (mono)";
+    else
+       if(enc & PE_16BIT)
+           if(enc & PE_SIGNED)
+               return "16bit";
+           else
+               return "unsigned 16bit";
+       else
+           if(enc & PE_ULAW)
+               return "U-law";
+           else if(enc & PE_ALAW)
+               return "A-law";
+           else
+               if(enc & PE_SIGNED)
+                   return "8bit";
+               else
+                   return "unsigned 8bit";
+    /*NOTREACHED*/
+}
+
 int32 dumb_current_samples(void)
 {
     return -1;
index 6846bc8..9100048 100644 (file)
@@ -78,9 +78,11 @@ extern void s32toulaw(int32 *lp, int32 c);
 /* aLaw (8 bits) */
 extern void s32toalaw(int32 *lp, int32 c);
 
+extern char *output_encoding_string(int enc);
 extern int32 dumb_current_samples(void);
 extern int   dumb_play_loop(void);
 
+
 /* little-endian and big-endian specific */
 #ifdef LITTLE_ENDIAN
 #define s32tou16l s32tou16
index c8c8765..e349e85 100644 (file)
@@ -96,7 +96,9 @@ static int play_pause_flag = 0;
 static int file_from_stdin;
 static struct ReverbControls reverb_ctls[MAX_CHANNELS];
 static void set_reverb_level(int ch, int level);
-static int  make_rvid_flag = 0;
+static int make_rvid_flag = 0;
+static int data_output_count;
+#define fragment_start_count (play_mode->rate/2)
 
 /* Ring voice id for each notes */
 static uint8 vidq_head[128 * MAX_CHANNELS], vidq_tail[128 * MAX_CHANNELS];
@@ -2017,6 +2019,7 @@ static int32 sync_restart(int only_trace_ok)
        cur = current_sample;
     }
     play_mode->purge_output();
+    data_output_count = 0;
     skip_to(cur);
     return cur;
 }
@@ -2043,6 +2046,7 @@ int check_apply_control(void)
        break;
       case RC_SYNC_RESTART:
        play_mode->purge_output();
+       data_output_count = 0;
        trace_flush();
        break;
       case RC_TOGGLE_PAUSE:
@@ -2148,6 +2152,7 @@ static int apply_controls(void)
          case RC_NEXT:         /* >>| */
          case RC_REALLY_PREVIOUS: /* |<< */
            play_mode->purge_output();
+           data_output_count = 0;
            trace_flush();
            return rc;
 
@@ -2176,18 +2181,21 @@ static int apply_controls(void)
 
          case RC_PREVIOUS:     /* |<< */
            play_mode->purge_output();
+           data_output_count = 0;
            if (current_sample < 2*play_mode->rate)
                return RC_REALLY_PREVIOUS;
            return RC_RESTART;
 
          case RC_RESTART:      /* |<< */
            play_mode->purge_output();
+           data_output_count = 0;
            skip_to(0);
            jump_flag = 1;
            continue;
 
          case RC_JUMP:
            play_mode->purge_output();
+           data_output_count = 0;
            if (val >= sample_count)
                return RC_NEXT;
            skip_to(val);
@@ -2196,6 +2204,7 @@ static int apply_controls(void)
          case RC_FORWARD:      /* >> */
            cur = current_trace_samples();
            play_mode->purge_output();
+           data_output_count = 0;
            if(cur == -1)
                cur = current_sample;
            if(val + cur >= sample_count)
@@ -2206,6 +2215,7 @@ static int apply_controls(void)
          case RC_BACK:         /* << */
            cur = current_trace_samples();
            play_mode->purge_output();
+           data_output_count = 0;
            if(cur == -1)
                cur = current_sample;
            if(cur > val)
@@ -2226,6 +2236,7 @@ static int apply_controls(void)
                if(midi_restart_time == -1)
                    midi_restart_time = current_sample;
                play_mode->purge_output();
+               data_output_count = 0;
                play_pause_flag = 1;
            }
            jump_flag = 1;
@@ -2295,6 +2306,7 @@ static int apply_controls(void)
                SET_CHANNELMASK(current_file_info->drumchannels, val);
            }
            play_mode->purge_output();
+           data_output_count = 0;
            return RC_RELOAD;
 
          case RC_TOGGLE_SNDSPEC:
@@ -2332,6 +2344,7 @@ static int apply_controls(void)
            if(midi_restart_time == -1)
                midi_restart_time = current_sample;
            play_mode->purge_output();
+           data_output_count = 0;
            return RC_RELOAD;
        }
        if(play_pause_flag)
@@ -2708,7 +2721,10 @@ static int midi_play_end(void)
 
   midi_end:
     if(RC_IS_SKIP_FILE(rc))
+    {
        play_mode->purge_output();
+       data_output_count = 0;
+    }
 
     ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "Playing time: ~%d seconds",
              current_sample/play_mode->rate+2);
@@ -2766,8 +2782,8 @@ static int compute_data(int32 count)
       presence_resample(AUDIO_BUFFER_SIZE);
 #endif /* PRESENCE_HACK */
 
-      if(trace_loop())
-      {
+    if(trace_loop() && data_output_count > fragment_start_count)
+    {
          int i;
          int32 *bufp;
          static int j = 0, nfragm, d, ch;
@@ -2803,6 +2819,7 @@ static int compute_data(int32 count)
       }
       else
          play_mode->output_data(common_buffer, AUDIO_BUFFER_SIZE);
+      data_output_count += AUDIO_BUFFER_SIZE;
 
       buffer_pointer=common_buffer;
       buffered_count=0;
index 17c9f7f..d449a8a 100644 (file)
@@ -107,7 +107,7 @@ static int open_output(void)
       if (dpm.fd<0)
        {
          ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
-                   dpm.name, sys_errlist[errno]);
+                   dpm.name, strerror(errno));
          return -1;
        }
     }
index a0b3742..59ffd74 100644 (file)
@@ -354,7 +354,7 @@ static int32 getvl(struct timidity_file *tf)
     if(errno)
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
                  "%s: read_midi_event: %s",
-                 current_filename, sys_errlist[errno]);
+                 current_filename, strerror(errno));
     else
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
                  "Warning: %s: Too shorten midi file.",
@@ -907,7 +907,7 @@ static int read_smf_track(struct timidity_file *tf, int trackno, int rewindp)
            if(errno)
                ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
                          "%s: read_midi_event: %s",
-                         current_filename, sys_errlist[errno]);
+                         current_filename, strerror(errno));
            else
                ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
                          "Warning: %s: Too shorten midi file.",
@@ -1772,7 +1772,7 @@ static int read_smf_file(struct timidity_file *tf)
     {
        if(errno)
            ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", current_filename,
-                     sys_errlist[errno]);
+                     strerror(errno));
        else
            ctl->cmsg(CMSG_WARNING, VERB_NORMAL,
                      "%s: Not a MIDI file!", current_filename);
@@ -1968,7 +1968,7 @@ MidiEvent *read_midi_file(struct timidity_file *tf, int32 *count, int32 *sp,
     {
        if(errno)
            ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", current_filename,
-                     sys_errlist[errno]);
+                     strerror(errno));
        else
            ctl->cmsg(CMSG_WARNING, VERB_NORMAL,
                      "%s: Not a MIDI file!", current_filename);
@@ -2647,7 +2647,7 @@ int midi_file_save_as(char *in_name, char *out_name)
     {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
                  "%s: %s", out_name,
-                 errno ? sys_errlist[errno] : "Can't save file");
+                 errno ? strerror(errno) : "Can't save file");
        return -1;
     }
 
@@ -2656,7 +2656,7 @@ int midi_file_save_as(char *in_name, char *out_name)
     {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
                  "%s: %s", out_name,
-                 errno ? sys_errlist[errno] : "Can't save file");
+                 errno ? strerror(errno) : "Can't save file");
        close_file(tf);
        return -1;
     }
index 205a444..ed98b9b 100644 (file)
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-
- *****************************************************************************
- * REVERB EFFECT FOR TIMIDITY-0.2i+X (Version 0.06b  1998/2/27)
- *                      Copyright (C) 1997,1998  Masaki Kiryu <mkiryu@usa.net>
- *                                   (http://www.netq.or.jp/~user/hid/masaki/)
- *
- * reverb.c  -- main reverb engine.
- ****************************************************************************
 */
 
 /*
- * [CHANGES]
- *   0.06b (1998/2/27)
- *             - Improved presence. (NOTE: speed down reverb functions)
- *   0.06a (1998/2/15)
- *             - Speed up reverb functions.
- *             - Support for mono.
+ * REVERB EFFECT FOR TIMIDITY++-1.X (Version 0.06e  1999/1/28)
+ * 
+ * Copyright (C) 1997,1998,1999  Masaki Kiryu <mkiryu@usa.net>
+ *                           (http://w3mb.kcom.ne.jp/~mkiryu/)
+ *
+ * reverb.c  -- main reverb engine.
+ *
  */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
+
 #ifndef NO_STRING_H
 #include <string.h>
 #else
 #include "timidity.h"
 #include "controls.h"
 
-/* Delay Buffer @65kHz */
-#define REV_MAX_BUF0         344
-#define REV_MAX_BUF1         682
-#define REV_MAX_BUF2        2275
-#define REV_MAX_BUF3        1332
-
-#define REV_BASE_VAL0        5.3
-#define REV_BASE_VAL1       10.5
-#define REV_BASE_VAL2       35.0
-#define REV_BASE_VAL3       20.5
-
-#define REV_IN_LEVEL         0.7
-#define REV_FBK_LEVEL        0.15
-#define REV_MIX_LEVEL        0.8
-#define REV_CH_MIX_LEVEL     0.9
-#define REV_MONO_IN_LEVEL    0.8
-
-#define REV_HPF_LEVEL        0.5
-#define REV_LPF_LEVEL        0.45
-#define REV_LPF_INPUT        0.55
-
-int do_reverb_flag = 0;
-static int  def_bufp0, bufp0;
-static int  def_bufp1, bufp1;
-static int  def_bufp2, bufp2;
-static int  def_bufp3, bufp3;
-static unsigned int  sdp0, sdp1, sdp2, sdp3;
-static int32  HPF_L, HPF_R, LPF_L, LPF_R;
-static int32  buf0_L[REV_MAX_BUF0], buf0_R[REV_MAX_BUF0];
-static int32  buf1_L[REV_MAX_BUF1], buf1_R[REV_MAX_BUF1];
-static int32  buf2_L[REV_MAX_BUF2], buf2_R[REV_MAX_BUF2];
-static int32  buf3_L[REV_MAX_BUF2], buf3_R[REV_MAX_BUF2];
+/* delay buffers @65kHz */
+#define REV_BUF0       344
+#define REV_BUF1       684
+#define REV_BUF2      2868
+#define REV_BUF3      1368
+
+#define REV_VAL0         5.3
+#define REV_VAL1        10.5
+#define REV_VAL2        44.12
+#define REV_VAL3        21.0
+
+#define REV_INP_LEV      0.55
+#define REV_FBK_LEV      0.12
+
+#define REV_NMIX_LEV     0.7
+#define REV_CMIX_LEV     0.9
+#define REV_MONO_LEV     0.7
+
+#define REV_HPF_LEV      0.5
+#define REV_LPF_LEV      0.45
+#define REV_LPF_INP      0.55
+#define REV_EPF_LEV      0.4
+#define REV_EPF_INP      0.48
+
+#define REV_WIDTH        0.125
+
+int  do_reverb_flag = 0;
+
+static int  spt0, rpt0, def_rpt0;
+static int  spt1, rpt1, def_rpt1;
+static int  spt2, rpt2, def_rpt2;
+static int  spt3, rpt3, def_rpt3;
+static int32  buf0_L[REV_BUF0], buf0_R[REV_BUF0];
+static int32  buf1_L[REV_BUF1], buf1_R[REV_BUF1];
+static int32  buf2_L[REV_BUF2], buf2_R[REV_BUF2];
+static int32  buf3_L[REV_BUF3], buf3_R[REV_BUF3];
+
 static int32  effect_buffer[AUDIO_BUFFER_SIZE*2];
 static int32  direct_buffer[AUDIO_BUFFER_SIZE*2];
-static int32  effect_buffer_size=sizeof(effect_buffer);
-static int32  direct_buffer_size=sizeof(direct_buffer);
+static int32  effect_bufsize = sizeof(effect_buffer);
+static int32  direct_bufsize = sizeof(direct_buffer);
+
 static int32  ta, tb;
+static int32  HPFL, HPFR;
+static int32  LPFL, LPFR;
+static int32  EPFL, EPFR;
 
-/* macro functions */
-#define LPF_FUNC_L  LPF_L=LPF_L*REV_LPF_LEVEL+(buf2_L[sdp2]+tb)*REV_LPF_INPUT;\
-                    ta=buf3_L[sdp3];s=buf3_L[sdp3]=buf0_L[sdp0];\
-                    buf0_L[sdp0]=-LPF_L;
-#define LPF_FUNC_R  LPF_R=LPF_R*REV_LPF_LEVEL+(buf2_R[sdp2]+tb)*REV_LPF_INPUT;\
-                    ta=buf3_R[sdp3];s=buf3_R[sdp3]=buf0_R[sdp0];\
-                    buf0_R[sdp0]= LPF_R;
-#define HPF_FUNC_L  t=(HPF_L+fixp)*REV_HPF_LEVEL;HPF_L=t-fixp;
-#define HPF_FUNC_R  t=(HPF_R+fixp)*REV_HPF_LEVEL;HPF_R=t-fixp;
-#define FUNC_L(XX)  LPF_FUNC_L;HPF_FUNC_L;buf2_L[sdp2]=(s-fixp*REV_FBK_LEVEL)\
-                    *XX;tb=buf1_L[sdp1];buf1_L[sdp1]=t;
-#define FUNC_R(XX)  LPF_FUNC_R;HPF_FUNC_R;buf2_R[sdp2]=(s-fixp*REV_FBK_LEVEL)\
-                    *XX;tb=buf1_R[sdp1];buf1_R[sdp1]=t;
-#define FUNC_INC    sdp0++;if(sdp0==bufp0)sdp0=0;sdp1++;if(sdp1==bufp1)sdp1=0;\
-                    sdp2++;if(sdp2==bufp2)sdp2=0;sdp3++;if(sdp3==bufp3)sdp3=0;
-
-/* reverb send level table data (test version) */
-static FLOAT_T send_level_table[128] = {
-0.00, 0.01, 0.02, 0.04, 0.05, 0.06, 0.07, 0.08,
-0.10, 0.11, 0.12, 0.13, 0.14, 0.16, 0.17, 0.18,
-0.19, 0.20, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27,
-0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.37,
-0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45,
-0.46, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54,
-0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62,
-0.63, 0.64, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69,
-0.70, 0.71, 0.72, 0.72, 0.73, 0.74, 0.75, 0.76,
-0.76, 0.77, 0.78, 0.79, 0.79, 0.80, 0.81, 0.82,
-0.82, 0.83, 0.84, 0.84, 0.85, 0.86, 0.86, 0.87,
-0.87, 0.88, 0.89, 0.89, 0.90, 0.90, 0.91, 0.91,
-0.92, 0.92, 0.93, 0.93, 0.94, 0.94, 0.94, 0.95,
-0.95, 0.95, 0.96, 0.96, 0.96, 0.97, 0.97, 0.97,
-0.98, 0.98, 0.98, 0.98, 0.99, 0.99, 0.99, 0.99,
-0.99, 0.99, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00
-};
+#define rev_memset(xx)     memset(xx,0,sizeof(xx));
+
+#define rev_ptinc() \
+spt0++; if(spt0 == rpt0) spt0 = 0;\
+spt1++; if(spt1 == rpt1) spt1 = 0;\
+spt2++; if(spt2 == rpt2) spt2 = 0;\
+spt3++; if(spt3 == rpt3) spt3 = 0;
 
 void init_reverb(int32 output_rate)
 {
-    tb = 0;
-    HPF_L = 0; HPF_R = 0;
-    LPF_L = 0; LPF_R = 0;
-    sdp0 = 0; sdp1 = 0; sdp2 = 0; sdp3 = 0;
-    memset(buf0_L, 0, sizeof(buf0_L)); memset(buf0_R, 0, sizeof(buf0_R));
-    memset(buf1_L, 0, sizeof(buf1_L)); memset(buf1_R, 0, sizeof(buf1_R));
-    memset(buf2_L, 0, sizeof(buf2_L)); memset(buf2_R, 0, sizeof(buf2_R));
-    memset(buf3_L, 0, sizeof(buf3_L)); memset(buf3_R, 0, sizeof(buf3_R));
-    memset(effect_buffer, 0, effect_buffer_size);
-    memset(direct_buffer, 0, direct_buffer_size);
-
-    if(output_rate > 0)
-    {
-       def_bufp0 = bufp0 = REV_BASE_VAL0 * output_rate / 1000;
-       def_bufp1 = bufp1 = REV_BASE_VAL1 * output_rate / 1000;
-       def_bufp2 = bufp2 = REV_BASE_VAL2 * output_rate / 1000;
-       def_bufp3 = bufp3 = REV_BASE_VAL3 * output_rate / 1000;
-    }
+    ta = 0; tb = 0;
+    HPFL = 0; HPFR = 0;
+    LPFL = 0; LPFR = 0;
+    EPFL = 0; EPFR = 0;
+    spt0 = 0; spt1 = 0;
+    spt2 = 0; spt3 = 0;
+
+    rev_memset(buf0_L); rev_memset(buf0_R);
+    rev_memset(buf1_L); rev_memset(buf1_R);
+    rev_memset(buf2_L); rev_memset(buf2_R);
+    rev_memset(buf3_L); rev_memset(buf3_R);
+
+    memset(effect_buffer, 0, effect_bufsize);
+    memset(direct_buffer, 0, direct_bufsize);
+
+    if(output_rate > 65000) output_rate=65000;
+    if(output_rate < 4000)  output_rate=4000;
+
+    def_rpt0 = rpt0 = REV_VAL0 * output_rate / 1000;
+    def_rpt1 = rpt1 = REV_VAL1 * output_rate / 1000;
+    def_rpt2 = rpt2 = REV_VAL2 * output_rate / 1000;
+    def_rpt3 = rpt3 = REV_VAL3 * output_rate / 1000;
 }
 
+
 void set_ch_reverb(register int32 *sbuffer, int32 n, int level)
 {
     register int32  i;
-    FLOAT_T send_level = send_level_table[level];
+
+    FLOAT_T send_level = (FLOAT_T)level/127;
 
     for(i = 0; i < n; i++)
+    {
         direct_buffer[i] += sbuffer[i];
-    for(i = 0; i < n; i++)
-       effect_buffer[i] += sbuffer[i] * send_level;
+        effect_buffer[i] += sbuffer[i] * send_level;
+    }
 }
 
+
 void do_ch_reverb(int32 *comp, int32 n)
 {
-    register int32  fixp, s, t, i;
+    int32  fixp, s, t, i;
 
     for(i = 0; i < n; i++)
     {
-       fixp = effect_buffer[i] * REV_IN_LEVEL;
-       FUNC_L(REV_CH_MIX_LEVEL);
-       comp[i] = ta + direct_buffer[i] * REV_IN_LEVEL;
+        /* L */
+        fixp = effect_buffer[i] * REV_INP_LEV;
+        effect_buffer[i] = 0;
+
+        LPFL = LPFL*REV_LPF_LEV + (buf2_L[spt2]+tb)*REV_LPF_INP + ta*REV_WIDTH;
+        ta = buf3_L[spt3];
+        s  = buf3_L[spt3] = buf0_L[spt0];
+        buf0_L[spt0] = -LPFL;
 
-       fixp = effect_buffer[++i] * REV_IN_LEVEL;
-        FUNC_R(REV_CH_MIX_LEVEL);
-       comp[i] = ta + direct_buffer[i] * REV_IN_LEVEL;
+        t = (HPFL + fixp) * REV_HPF_LEV;
+        HPFL = t - fixp;
 
-       FUNC_INC;
+        buf2_L[spt2] = (s - fixp * REV_FBK_LEV) * REV_CMIX_LEV;
+        tb = buf1_L[spt1];
+        buf1_L[spt1] = t;
+
+        EPFL = EPFL * REV_EPF_LEV + ta * REV_EPF_INP;
+        comp[i] = ta + EPFL + direct_buffer[i] * REV_INP_LEV;
+        direct_buffer[i] = 0;
+
+        /* R */
+        fixp = effect_buffer[++i] * REV_INP_LEV;
+        effect_buffer[i] = 0;
+
+        LPFR = LPFR*REV_LPF_LEV + (buf2_R[spt2]+tb)*REV_LPF_INP + ta*REV_WIDTH;
+        ta = buf3_R[spt3];
+        s  = buf3_R[spt3] = buf0_R[spt0];
+        buf0_R[spt0] = LPFR;
+
+        t = (HPFR + fixp) * REV_HPF_LEV;
+        HPFR = t - fixp;
+
+        buf2_R[spt2] = (s - fixp * REV_FBK_LEV) * REV_CMIX_LEV;
+        tb = buf1_R[spt1];
+        buf1_R[spt1] = t;
+
+        EPFR = EPFR * REV_EPF_LEV + ta * REV_EPF_INP;
+        comp[i] = ta + EPFR + direct_buffer[i] * REV_INP_LEV;
+        direct_buffer[i] = 0;
+
+        rev_ptinc();
     }
-    memset(effect_buffer, 0, effect_buffer_size);
-    memset(direct_buffer, 0, direct_buffer_size);
 }
 
+
 void do_reverb(int32 *comp, int32 n)
 {
-    register int32  fixp, s, t, i;
+    int32  fixp, s, t, i;
 
     for(i = 0; i < n; i++)
     {
-       fixp = comp[i] * REV_IN_LEVEL;
-       FUNC_L(REV_MIX_LEVEL);
-       comp[i] = ta + fixp;
+        /* L */
+        fixp = comp[i] * REV_INP_LEV;
+
+        LPFL = LPFL*REV_LPF_LEV + (buf2_L[spt2]+tb)*REV_LPF_INP + ta*REV_WIDTH;
+        ta = buf3_L[spt3];
+        s  = buf3_L[spt3] = buf0_L[spt0];
+        buf0_L[spt0] = -LPFL;
+
+        t = (HPFL + fixp) * REV_HPF_LEV;
+        HPFL = t - fixp;
+
+        buf2_L[spt2] = (s - fixp * REV_FBK_LEV) * REV_NMIX_LEV;
+        tb = buf1_L[spt1];
+        buf1_L[spt1] = t;
+
+        EPFL = EPFL * REV_EPF_LEV + ta * REV_EPF_INP;
+        comp[i] = ta + EPFL + fixp;
+
+        /* R */
+        fixp = comp[++i] * REV_INP_LEV;
+
+        LPFR = LPFR*REV_LPF_LEV + (buf2_R[spt2]+tb)*REV_LPF_INP + ta*REV_WIDTH;
+        ta = buf3_R[spt3];
+        s  = buf3_R[spt3] = buf0_R[spt0];
+        buf0_R[spt0] = LPFR;
 
-        fixp = comp[++i] * REV_IN_LEVEL;
-       FUNC_R(REV_MIX_LEVEL);
-       comp[i] = ta + fixp;
+        t = (HPFR + fixp) * REV_HPF_LEV;
+        HPFR = t - fixp;
 
-       FUNC_INC;
+        buf2_R[spt2] = (s - fixp * REV_FBK_LEV) * REV_NMIX_LEV;
+        tb = buf1_R[spt1];
+        buf1_R[spt1] = t;
+
+        EPFR = EPFR * REV_EPF_LEV + ta * REV_EPF_INP;
+        comp[i] = ta + EPFR + fixp;
+
+        rev_ptinc();
     }
 }
 
+
 void do_mono_reverb(int32 *comp, int32 n)
 {
-    register int32  fixp, s, t, i;
+    int32  fixp, s, t, i;
 
     for(i = 0; i < n; i++)
     {
-       fixp = comp[i] * REV_MONO_IN_LEVEL;
-       FUNC_L(REV_MIX_LEVEL);
-       FUNC_R(REV_MIX_LEVEL);
-       comp[i] = ta + fixp;
+        /* L */
+        fixp = comp[i] * REV_MONO_LEV;
+
+        LPFL = LPFL*REV_LPF_LEV + (buf2_L[spt2]+tb)*REV_LPF_INP + ta*REV_WIDTH;
+        ta = buf3_L[spt3];
+        s  = buf3_L[spt3] = buf0_L[spt0];
+        buf0_L[spt0] = -LPFL;
+
+        t = (HPFL + fixp) * REV_HPF_LEV;
+        HPFL = t - fixp;
+
+        buf2_L[spt2] = (s - fixp * REV_FBK_LEV) * REV_NMIX_LEV;
+        tb = buf1_L[spt1];
+        buf1_L[spt1] = t;
+
+        /* R */
+        LPFR = LPFR*REV_LPF_LEV + (buf2_R[spt2]+tb)*REV_LPF_INP + ta*REV_WIDTH;
+        ta = buf3_R[spt3];
+        s  = buf3_R[spt3] = buf0_R[spt0];
+        buf0_R[spt0] = LPFR;
 
-       FUNC_INC;
+        t = (HPFR + fixp) * REV_HPF_LEV;
+        HPFR = t - fixp;
+
+        buf2_R[spt2] = (s - fixp * REV_FBK_LEV) * REV_NMIX_LEV;
+        tb = buf1_R[spt1];
+        buf1_R[spt1] = t;
+
+        EPFR = EPFR * REV_EPF_LEV + ta * REV_EPF_INP;
+        comp[i] = ta + EPFR + fixp;
+
+        rev_ptinc();
     }
 }
 
@@ -220,9 +287,4 @@ void reverb_rc_event(int rc, int32 val)
     }
 }
 
-/*
-void make_reverb_send_level_table()
-{
 
-}
-*/
index f0626c5..be91d88 100644 (file)
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
 */
 
-
-/*****************************************************************************
- * REVERB EFFECT FOR TIMIDITY-0.2i+X (Version 0.06a  1998/2/15)
- *                      Copyright (C) 1997,1998  Masaki Kiryu <mkiryu@usa.net>
- *                                   (http://www.netq.or.jp/~user/hid/masaki/)
+/*
+ * REVERB EFFECT FOR TIMIDITY++-1.X (Version 0.06e  1999/1/28)
+ *
+ * Copyright (C) 1997,1998,1999  Masaki Kiryu <mkiryu@usa.net>
+ *                           (http://w3mb.kcom.ne.jp/~mkiryu/)
  *
  * reverb.h
- *****************************************************************************/
+ *
+ */
 #ifndef ___REVERB_H_
 #define ___REVERB_H_
 
index e52dbde..866f144 100644 (file)
@@ -34,7 +34,6 @@
 #include <windows.h>
 extern int optind;
 extern char *optarg;
-int getopt(int, char **, char *);
 #else
 #include <unistd.h>
 #include <fcntl.h> /* for open */
@@ -1839,7 +1838,7 @@ static int read_config_file(char *name, int self)
     if(errno)
     {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
-                 "Can't read %s: %s", name, sys_errlist[errno]);
+                 "Can't read %s: %s", name, strerror(errno));
        errcnt++;
     }
     close_file(tf);
@@ -1913,7 +1912,7 @@ static int read_user_config_file(void)
            if((opencheck = open(path, 0)) < 0)
            {
                ctl->cmsg(CMSG_INFO, VERB_NOISY, "%s: %s",
-                         path, sys_errlist[errno]);
+                         path, strerror(errno));
                return 0;
            }
        }
@@ -1934,7 +1933,7 @@ static int read_user_config_file(void)
     if((opencheck = open(path, 0)) < 0)
     {
        ctl->cmsg(CMSG_INFO, VERB_NOISY, "%s: %s",
-                 path, sys_errlist[errno]);
+                 path, strerror(errno));
        return 0;
     }
 
@@ -2345,15 +2344,6 @@ static int set_tim_opt(int c, char *optarg)
       case 'i':
        if(set_ctl(optarg))
            return 1;
-#if defined(AU_LINUX) || defined(AU_WIN32) || defined(AU_BSDI)
-       else if(buffer_fragments == -1 && ctl->trace_playing)
-         /* user didn't specify anything, so use 2 for real-time response */
-#if defined(AU_LINUX) || defined(AU_BSDI)
-               buffer_fragments = 2;
-#else
-               buffer_fragments = 3;           /* On Win32 2 is chunky */
-#endif
-#endif
        break;
 
       case 'B':
@@ -2645,7 +2635,21 @@ MAIN_INTERFACE int timidity_play_main(int nfiles, char **files)
     __try
     {
 #endif /* BORLANDC_EXCEPTION */
+#ifdef __WIN32__
+       ctl->cmsg(CMSG_INFO, VERB_DEBUG_SILLY,
+                 "Initialize for Critical Section");
+       SetConsoleCtrlHandler (handler, TRUE);
+       InitializeCriticalSection (&critSect);
+       if(opt_evil_mode)
+           if (!SetThreadPriority(GetCurrentThread(),
+                                  THREAD_PRIORITY_ABOVE_NORMAL))
+               ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+                         "Error raising process priority");
+#endif
+
        /* Open output device */
+       ctl->cmsg(CMSG_INFO, VERB_DEBUG_SILLY,
+                 "open play_mode(%c)", play_mode->id_character);
        if(play_mode->open_output() < 0)
        {
            ctl->cmsg(CMSG_FATAL, VERB_NORMAL,
@@ -2668,15 +2672,6 @@ MAIN_INTERFACE int timidity_play_main(int nfiles, char **files)
        if(*def_instr_name)
            set_default_instrument(def_instr_name);
 
-#ifdef __WIN32__
-       SetConsoleCtrlHandler (handler, TRUE);
-       InitializeCriticalSection (&critSect);
-       if(opt_evil_mode)
-           if (!SetThreadPriority(GetCurrentThread(),
-                                  THREAD_PRIORITY_ABOVE_NORMAL))
-               ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
-                         "Error raising process priority");
-#endif
        trace_nodelay(!ctl->trace_playing);
 
        /* For safety */
@@ -2686,6 +2681,8 @@ MAIN_INTERFACE int timidity_play_main(int nfiles, char **files)
            play_mode->play_loop = dumb_play_loop;
 
        /* Return only when quitting */
+       ctl->cmsg(CMSG_INFO, VERB_DEBUG_SILLY,
+                 "pass_playing_list() nfiles=%d", nfiles);
        ctl->pass_playing_list(nfiles, files);
 
 #ifdef XP_UNIX
index 33faa5a..718f734 100644 (file)
@@ -256,14 +256,6 @@ typedef double FLOAT_T;
 /* #define TMPDIR "/var/tmp" */
 
 
-/* Define if union semun is exist. */
-/* #define HAVE_UNION_SEMUN */
-
-
-/* Undefine if your compiler supports `volatile' declare */
-/* #define NO_VOLATILE */
-
-
 /* To use GS drumpart setting. */
 #define GS_DRUMPART
 
@@ -374,71 +366,14 @@ extern int volatile_touch(void* dmy);
    fragments under the VoxWare (Linux & FreeBSD) audio driver */
 #define AUDIO_BUFFER_SIZE (1<<AUDIO_BUFFER_BITS)
 
-/* for solaris-x86 */
-#if defined(SOLARIS) && defined(__i386__)
-#define LITTLE_ENDIAN
-#endif /* SOLARIS && __i386__ */
-
-/* Byte order, defined in <machine/endian.h> for FreeBSD and DEC OSF/1 */
-#ifdef DEC
-#include <machine/endian.h>
-#include <errno.h>
-#endif /* DEC */
-
-#ifdef sgi
-#include <errno.h>
-#ifndef BIG_ENDIAN
+/* Byte order */
+#ifdef WORDS_BIGENDIAN
 #define BIG_ENDIAN
-#endif /* BIG_ENDIAN */
-#undef LITTLE_ENDIAN
-#endif /* sgi */
-
-#ifdef linux
-/*
- * Byte order is defined in <bytesex.h> as __BYTE_ORDER, that need to
- * be checked against __LITTLE_ENDIAN and __BIG_ENDIAN defined in <endian.h>
- * <endian.h> includes automagically <bytesex.h>
- * for Linux.
- */
-#include <endian.h>
-#include <errno.h>
-/*
- * We undef the two things to start with a clean situation
- * (oddly enough, <endian.h> defines under certain conditions
- * the two things below, as __LITTLE_ENDIAN and __BIG_ENDIAN, that
- * are useless for our plans)
- */
-#undef LITTLE_ENDIAN
-#undef BIG_ENDIAN
-
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define LITTLE_ENDIAN
-# elif __BYTE_ORDER == __BIG_ENDIAN
-#  define BIG_ENDIAN
-# else
-# error No byte sex defined
-# endif
-#endif /* linux */
-
-#if defined(__FreeBSD__) || defined(__bsdi__) || defined(__NetBSD__)
-#include <errno.h>
-#include <sys/types.h>
-#include <machine/endian.h>
-#if BYTE_ORDER == LITTLE_ENDIAN
-#undef BIG_ENDIAN
-#undef PDP_ENDIAN
-#elif BYTE_ORDER == BIG_ENDIAN
 #undef LITTLE_ENDIAN
-#undef PDP_ENDIAN
 #else
-# error No valid byte sex defined
+#undef BIG_ENDIAN
+#define LITTLE_ENDIAN
 #endif
-#endif /* __FreeBSD__ || __bsdi__ || __NetBSD__ */
-
-/* Win32 on Intel machines */
-#ifdef __WIN32__
-#  define LITTLE_ENDIAN
-#endif /* __WIN32__ */
 
 /* DEC MMS has 64 bit long words */
 #if defined(DEC)
@@ -571,14 +506,13 @@ typedef struct _ChannelBitMask
 
 #define VIBRATO_DEPTH_TUNING (1.0/4.0)
 
-#ifdef HPUX
+#include <stdio.h>
+#ifdef HAVE_ERRNO_H
 #include <errno.h>
-#ifndef BIG_ENDIAN
-#define BIG_ENDIAN
-#endif /* BIG_ENDIAN */
-#undef LITTLE_ENDIAN
+#endif /* HAVE_ERRNO_H */
+
+#ifdef HPUX
 #undef mono
-  extern char *sys_errlist[];
 #endif
 
 #ifdef sun
@@ -587,8 +521,6 @@ typedef struct _ChannelBitMask
 #include <memory.h>
 #define memcpy(x, y, n) bcopy(y, x, n)
 #endif /* SunOS 4.x */
-#include <errno.h>
-  extern char *sys_errlist[];
   extern int errno;
   extern int opterr;
   extern int optind;
@@ -607,18 +539,9 @@ typedef struct _ChannelBitMask
 
 
 #ifdef __WIN32__
-#  include <errno.h>
-#  undef DECOMPRESSOR_LIST
-#  undef PATCH_EXT_LIST
-#  define PATCH_EXT_LIST { ".pat", 0 }
+#undef PATCH_EXT_LIST
+#define PATCH_EXT_LIST { ".pat", 0 }
 
-#ifndef HAVE_USLEEP
-#define HAVE_USLEEP
-#endif /* HAVE_USLEEP */
-#define usleep(usec) Sleep((usec) / 1000)
-#define sleep(sec)   Sleep((sec)  * 1000)
-
-/* URL Directory is not work in Windows */
 #define URL_DIR_CACHE_DISABLE
 #endif
 
@@ -676,4 +599,33 @@ typedef struct _ChannelBitMask
 #undef PATCH_CONVERTERS
 #endif
 
+
+
+/* Follows are defined in utils/support.c */
+
+#ifndef HAVE_VSNPRINTF
+#include <stdarg.h> /* for va_list */
+extern void vsnprintf(char *buff, size_t bufsiz, const char *fmt, va_list ap);
+#endif
+
+#ifndef HAVE_SNPRINTF
+extern void snprintf(char *buff, size_t bufsiz, const char *fmt, ...);
+#endif /* HAVE_SNPRINTF */
+
+#ifndef HAVE_GETOPT
+extern int getopt(int argc, char *argv[], char *optionS)
+#endif /* HAVE_GETOPT */
+
+#ifndef HAVE_STRERROR
+extern char *strerror(int errnum);
+#endif /* HAVE_STRERROR */
+
+#ifndef HAVE_USLEEP
+extern int usleep(unsigned int usec)
+#endif
+
+#ifndef HAVE_SLEEP
+#define sleep(sec) usleep(sec * 1000000)
+#endif /* HAVE_SLEEP */
+
 #endif /* ___TIMIDITY_H_ */
index 9dd254d..bc5e17b 100644 (file)
@@ -135,7 +135,7 @@ static int open_output(void)
       if (dpm.fd<0)
        {
          ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
-              dpm.name, sys_errlist[errno]);
+              dpm.name, strerror(errno));
          return -1;
        }
     }
index a14f5af..3c19fe1 100644 (file)
@@ -1,28 +1,30 @@
 /*
-
-    TiMidity++ -- MIDI to WAVE converter and player
-    Copyright (C) 1999 Masanao Izumo <mo@goice.co.jp>
-    Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
-
-    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 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    win_audio.c
-
-    Functions to play sound on the Win32 audio driver (Win 95 or Win NT).
-
-*/
+   
+   TiMidity++ -- MIDI to WAVE converter and player
+   Copyright (C) 1999 Masanao Izumo <mo@goice.co.jp>
+   Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
+   
+   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 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   
+   win_audio.c
+   
+   Functions to play sound on the Win32 audio driver (Win 95 or Win NT).
+   
+   Modified by Masanao Izumo <mo@goice.co.jp>
+   
+   */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 #include <windows.h>
 
+#ifdef __CYGWIN32__
+#define HAVE_WAVEFORMAT_CBSIZE
+/* On cygnus, there is no header file for Multimedia API's. */
+/* Then declare some of them here. */
+
+#define NEAR
+#define FAR
+#define WOM_OPEN               0x3BB
+#define WOM_CLOSE              0x3BC
+#define WOM_DONE               0x3BD
+#define WAVE_FORMAT_QUERY      0x0001
+#define WAVE_ALLOWSYNC         0x0002
+#define WAVE_FORMAT_PCM                1
+#define CALLBACK_FUNCTION      0x00030000l
+#define WAVERR_BASE            32
+
+DECLARE_HANDLE(HWAVEOUT);
+DECLARE_HANDLE(HWAVE);
+typedef HWAVEOUT *LPHWAVEOUT;
+
+/* Define WAVEHDR, WAVEFORMAT, PCMWAVEFORMAT structure */
+typedef struct wavehdr_tag {
+    LPSTR       lpData;
+    DWORD       dwBufferLength;
+    DWORD       dwBytesRecorded;
+    DWORD       dwUser;
+    DWORD       dwFlags;
+    DWORD       dwLoops;
+    struct wavehdr_tag FAR *lpNext;
+    DWORD       reserved;
+} WAVEHDR;
+
+typedef struct {
+    WORD    wFormatTag;
+    WORD    nChannels;
+    DWORD   nSamplesPerSec;
+    DWORD   nAvgBytesPerSec;
+    WORD    nBlockAlign;
+#ifdef HAVE_WAVEFORMAT_CBSIZE
+    WORD    cbSize;
+#endif
+} WAVEFORMAT;
+
+typedef struct {
+    WAVEFORMAT  wf;
+    WORD        wBitsPerSample;
+} PCMWAVEFORMAT;
+
+typedef WAVEHDR *LPWAVEHDR;
+typedef WAVEFORMAT *LPWAVEFORMAT;
+typedef UINT MMRESULT;
+
+MMRESULT WINAPI waveOutOpen(LPHWAVEOUT, UINT,
+                           LPWAVEFORMAT, DWORD, DWORD, DWORD);
+MMRESULT WINAPI waveOutClose(HWAVEOUT);
+MMRESULT WINAPI waveOutPrepareHeader(HWAVEOUT, LPWAVEHDR, UINT);
+MMRESULT WINAPI waveOutUnprepareHeader(HWAVEOUT, LPWAVEHDR, UINT);
+MMRESULT WINAPI waveOutWrite(HWAVEOUT, LPWAVEHDR, UINT);
+UINT WINAPI waveOutGetNumDevs(void);
+MMRESULT WINAPI waveOutReset(HWAVEOUT);
+
+#endif /* __CYGWIN32__ */
+
+
 #include "timidity.h"
 #include "output.h"
 #include "controls.h"
@@ -57,303 +123,429 @@ static double play_start_time;
 
 extern int default_play_event(void *);
 
+/* #define DATA_BLOCK_SIZE (1024*2)  for small shared memory implementation */
+#define DATA_BLOCK_SIZE (1024*16)
+#define DATA_BLOCK_NUM  (dpm.extra_param[0])
+#define DATA_MIN_NBLOCKS (DATA_BLOCK_NUM-1)
+
+struct data_block_t
+{
+    HGLOBAL data_hg;
+    HGLOBAL head_hg;
+    void *data;
+    WAVEHDR *head;
+    int blockno;
+    struct data_block_t *next;
+};
+
+static struct data_block_t *all_data_block;
+static struct data_block_t *free_data_block;
+static void reuse_data_block(struct data_block_t *);
+static void reset_data_block(void);
+static struct data_block_t *new_data_block();
+
+static HWAVEOUT dev;
+static int nBlocks;
+static const char *mmerror_code_string(MMRESULT res);
+
 /* export the playback mode */
 
 #define dpm win32_play_mode
 
 PlayMode dpm = {
-  DEFAULT_RATE, PE_16BIT|PE_SIGNED, PF_NEED_INSTRUMENTS|PF_CAN_TRACE,
-  -1,
-  {16},
-  "Win32 audio driver", 'd',
-  NULL,
-  default_play_event,
-  open_output,
-  close_output,
-  output_data,
-  flush_output,
-  purge_output,
-  current_samples,
-  play_loop
+    DEFAULT_RATE, PE_16BIT|PE_SIGNED, PF_NEED_INSTRUMENTS|PF_CAN_TRACE,
+    -1,
+    {16},
+    "Win32 audio driver", 'd',
+    NULL,
+    default_play_event,
+    open_output,
+    close_output,
+    output_data,
+    flush_output,
+    purge_output,
+    current_samples,
+    play_loop
 };
 
-/* Max audio blocks waiting to be played */
-
-static LPHWAVEOUT dev;
-static int nBlocks;
-
 extern CRITICAL_SECTION critSect;
 /* Optional flag */
-int win32_wave_allowsync = 1; /* waveOutOpen() fdwOpen : WAVE_ALLOWSYNC */
+static int win32_wave_allowsync = 1; /* waveOutOpen() fdwOpen : WAVE_ALLOWSYNC */
+//static int win32_wave_allowsync = 0;
 
-static void wait (void)
-       {
-       while (nBlocks)
-               Sleep (0);
-       }
+static void wait(void)
+{
+    while(nBlocks)
+       Sleep(0);
+}
 
-static int play (void *mem, int len)
-       {
-       HGLOBAL hg;
-       LPWAVEHDR wh;
-       MMRESULT res;
-
-       while (nBlocks >= dpm.extra_param[0])
-               Sleep (0);
-
-       hg = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (WAVEHDR));
-       if (!hg)
-               {
-               ctl->cmsg (CMSG_INFO, VERB_NORMAL, "GlobalAlloc failed!");
-               return FALSE;
-               }
-       wh = GlobalLock (hg);
-       wh->dwBufferLength = len;
-       wh->lpData = mem;
-
-       res = waveOutPrepareHeader (dev, wh, sizeof (WAVEHDR));
-       if (res)
-               {
-               ctl->cmsg (CMSG_INFO, VERB_NORMAL, "waveOutPrepareHeader: %d", res);
-               GlobalUnlock (hg);
-               GlobalFree (hg);
-               return TRUE;
-               }
-       res = waveOutWrite (dev, wh, sizeof (WAVEHDR));
-       if (res)
-               {
-               ctl->cmsg (CMSG_INFO, VERB_NORMAL, "waveOutWrite: %d", res);
-               GlobalUnlock (hg);
-               GlobalFree (hg);
-               return TRUE;
-               }
-       EnterCriticalSection (&critSect);
-       nBlocks++;
-       LeaveCriticalSection (&critSect);
-//     cmsg (CMSG_INFO,VERB_NOISY, "Play: %d blocks", nBlocks);
-       return FALSE;
-       }
+static void CALLBACK wave_callback(HWAVE hWave, UINT uMsg,
+                                  DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
+{
+    ctl->cmsg(CMSG_INFO, VERB_DEBUG,
+             "MMCallback: Msg=0x%x, nBlocks=%d", uMsg, nBlocks);
 
-#pragma argsused
-static void CALLBACK wave_callback (HWAVE hWave, UINT uMsg,
-               DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
-       {
+    if(uMsg == WOM_DONE)
+    {
        WAVEHDR *wh;
-       HGLOBAL hg;
-
-       if (uMsg == WOM_DONE)
-               {
-               EnterCriticalSection (&critSect);
-               wh = (WAVEHDR *)dwParam1;
-               waveOutUnprepareHeader (dev, wh, sizeof (WAVEHDR));
-               hg = GlobalHandle (wh->lpData);
-               GlobalUnlock (hg);
-               GlobalFree (hg);
-               hg = GlobalHandle (wh);
-               GlobalUnlock (hg);
-               GlobalFree (hg);
-               nBlocks--;
-               LeaveCriticalSection (&critSect);
-//             cmsg (CMSG_INFO, VERB_NOISY, "Callback: %d blocks", nBlocks);
-               }
-       }
-
-static int open_output (void)
-       {
-       int i, j, mono, eight_bit, warnings = 0;
-       PCMWAVEFORMAT pcm;
-       MMRESULT res;
-
-       play_counter = reset_samples = 0;
 
-       /* Check if there is at least one audio device */
-       if (!waveOutGetNumDevs ())
-               {
-               ctl->cmsg (CMSG_ERROR, VERB_NORMAL, "No audio devices present!");
-               return -1;
-               }
+       EnterCriticalSection (&critSect);
+       wh = (WAVEHDR *)dwParam1;
+       waveOutUnprepareHeader(dev, wh, sizeof(WAVEHDR));
+       reuse_data_block(&all_data_block[wh->dwUser]);
+       LeaveCriticalSection (&critSect);
+    }
+}
 
-       /* They can't mean these */
-       dpm.encoding &= ~(PE_ULAW|PE_ALAW|PE_BYTESWAP);
+static int open_output(void)
+{
+    int i, j, mono, eight_bit, warnings = 0;
+    PCMWAVEFORMAT pcm;
+    MMRESULT res;
+
+    play_counter = reset_samples = 0;
+
+    /* Check if there is at least one audio device */
+    if (!(i=waveOutGetNumDevs ()))
+    {
+       ctl->cmsg (CMSG_ERROR, VERB_NORMAL, "No audio devices present!");
+       return -1;
+    }
+
+    /* They can't mean these */
+    dpm.encoding &= ~(PE_ULAW|PE_ALAW|PE_BYTESWAP);
+
+    if (dpm.encoding & PE_16BIT)
+       dpm.encoding |= PE_SIGNED;
+    else
+       dpm.encoding &= ~PE_SIGNED;
+
+    mono = (dpm.encoding & PE_MONO);
+    eight_bit = !(dpm.encoding & PE_16BIT);
+
+    memset(&pcm, 0, sizeof(pcm));
+    pcm.wf.wFormatTag = WAVE_FORMAT_PCM;
+    pcm.wf.nChannels = mono ? 1 : 2;
+    pcm.wf.nSamplesPerSec = i = dpm.rate;
+    j = 1;
+    if (!mono)
+    {
+       i *= 2;
+       j *= 2;
+    }
+    if (!eight_bit)
+    {
+       i *= 2;
+       j *= 2;
+    }
+    pcm.wf.nAvgBytesPerSec = i;
+    pcm.wf.nBlockAlign = j;
+    pcm.wBitsPerSample = eight_bit ? 8 : 16;
+#ifdef HAVE_WAVEFORMAT_CBSIZE
+    pcm.wf.cbSize=sizeof(WAVEFORMAT);
+#endif
 
-       if (dpm.encoding & PE_16BIT)
-               dpm.encoding |= PE_SIGNED;
-       else
-               dpm.encoding &= ~PE_SIGNED;
-
-       mono = (dpm.encoding & PE_MONO);
-       eight_bit = !(dpm.encoding & PE_16BIT);
-
-       pcm.wf.wFormatTag = WAVE_FORMAT_PCM;
-       pcm.wf.nChannels = mono ? 1 : 2;
-       pcm.wf.nSamplesPerSec = i = dpm.rate;
-       j = 1;
-       if (!mono)
-               {
-               i *= 2;
-               j *= 2;
-               }
-       if (!eight_bit)
-               {
-               i *= 2;
-               j *= 2;
-               }
-       pcm.wf.nAvgBytesPerSec = i;
-       pcm.wf.nBlockAlign = j;
-       pcm.wBitsPerSample = eight_bit ? 8 : 16;
-
-       if (win32_wave_allowsync)
-         res = waveOutOpen (NULL, 0, (LPWAVEFORMAT)&pcm, NULL, 0, WAVE_FORMAT_QUERY | WAVE_ALLOWSYNC);
-       else
-         res = waveOutOpen (NULL, 0, (LPWAVEFORMAT)&pcm, NULL, 0, WAVE_FORMAT_QUERY);
-       if (res)
-               {
-               ctl->cmsg (CMSG_ERROR, VERB_NORMAL, "Format not supported!");
-               return -1;
-               }
-       if (win32_wave_allowsync)
-         res = waveOutOpen (&dev, 0, (LPWAVEFORMAT)&pcm, (DWORD)wave_callback, 0, CALLBACK_FUNCTION | WAVE_ALLOWSYNC);
-       else
-         res = waveOutOpen (&dev, 0, (LPWAVEFORMAT)&pcm, (DWORD)wave_callback, 0, CALLBACK_FUNCTION);
-       if (res)
-               {
-               ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Can't open audio device");
-               return -1;
-               }
-       nBlocks = 0;
-       dpm.fd = 0;
-       return warnings;
-       }
+    dev = 0;
+    if (win32_wave_allowsync)
+       res = waveOutOpen (&dev, 0, (LPWAVEFORMAT)&pcm, (DWORD)wave_callback, 0, CALLBACK_FUNCTION | WAVE_ALLOWSYNC);
+    else
+       res = waveOutOpen (&dev, 0, (LPWAVEFORMAT)&pcm, (DWORD)wave_callback, 0, CALLBACK_FUNCTION);
+    if (res)
+    {
+       ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+                 "Can't open audio device: encoding=<%s>, rate=<%d>: %s",
+                 output_encoding_string(dpm.encoding),
+                 dpm.rate,
+                 mmerror_code_string(res));
+       return -1;
+    }
+
+    all_data_block = (struct data_block_t *)
+       safe_malloc(DATA_BLOCK_NUM * sizeof(struct data_block_t));
+    for(i = 0; i < DATA_BLOCK_NUM; i++)
+    {
+       struct data_block_t *block;
+       block = &all_data_block[i];
+       block->data_hg = GlobalAlloc(GMEM_ZEROINIT, DATA_BLOCK_SIZE);
+       block->data = GlobalLock(block->data_hg);
+       block->head_hg = GlobalAlloc(GMEM_ZEROINIT, sizeof(WAVEHDR));
+       block->head = GlobalLock(block->head_hg);
+    }
+    reset_data_block();
+    dpm.fd = 0;
+    return warnings;
+}
 
 static void add_sample_counter(int32 count)
 {
-    current_samples(); /* update play_counter */
+    current_samples();         /* update play_counter */
     play_counter += count;
 }
 
 static void output_data (int32 *buf, int32 count)
+{
+    int32 len = count, n;
+    HGLOBAL data_hg;
+    HGLOBAL head_hg;
+    void *b;
+    int32 count_arg = count;
+    struct data_block_t *block;
+    int32 total;
+    char *bp;
+    MMRESULT res;
+    LPWAVEHDR wh;
+
+    if(!(dpm.encoding & PE_MONO)) /* Stereo sample */
+    {
+       count *= 2;
+       len *= 2;
+    }
+
+    if(dpm.encoding & PE_16BIT)
+       len *= 2;
+
+    if (dpm.encoding & PE_16BIT)
+       /* Convert data to signed 16-bit PCM */
+       s32tos16 (buf, count);
+    else
+       /* Convert to 8-bit unsigned. */
+       s32tou8 (buf, count);
+
+    total = 0;
+    bp = (char *)buf;
+    add_sample_counter(count_arg);
+    while(len > 0)
+    {
+       if((block = new_data_block()) == NULL)
        {
-       int len = count;
-       HGLOBAL hg;
-       void *b;
-       int32 count_arg = count;
-       if (!(dpm.encoding & PE_MONO)) /* Stereo sample */
-               {
-               count *= 2;
-               len *= 2;
-               }
-
-       if (dpm.encoding & PE_16BIT)
-               len *= 2;
-
-       hg = GlobalAlloc (GMEM_MOVEABLE, len);
-       if (!hg)
-               {
-               ctl->cmsg (CMSG_INFO, VERB_NORMAL, "GlobalAlloc failed!");
-               return;
-               }
-       b = GlobalLock (hg);
-
-       if (dpm.encoding & PE_16BIT)
-               /* Convert data to signed 16-bit PCM */
-               s32tos16 (buf, count);
-       else
-               /* Convert to 8-bit unsigned. */
-               s32tou8 (buf, count);
-
-       CopyMemory(b, buf, len);
-       add_sample_counter(count_arg);
-       if (play (b, len))
-               {
-               GlobalUnlock (hg);
-               GlobalFree (hg);
-               }
+           Sleep(0);
+           continue;
        }
+       if(len <= DATA_BLOCK_SIZE)
+           n = len;
+       else
+           n = DATA_BLOCK_SIZE;
+       data_hg = block->data_hg;
+       head_hg = block->head_hg;
 
-static void close_output (void)
+       b = block->data;
+       CopyMemory(b, bp, n);
+
+       wh = block->head;
+       wh->dwBufferLength = n;
+       wh->lpData = b;
+       wh->dwUser = block->blockno;
+
+       res = waveOutPrepareHeader(dev, wh, sizeof(WAVEHDR));
+       if(res)
        {
-       int rc;
-
-       if(dpm.fd == -1)
-           return;
-       wait ();
-       waveOutClose (dev);
-       play_counter = reset_samples = 0;
-       dpm.fd = -1;
+           ctl->cmsg (CMSG_ERROR, VERB_NORMAL, "waveOutPrepareHeader(): %s",
+                      mmerror_code_string(res));
+           safe_exit(1);
        }
-
-static int flush_output (void)
+       res = waveOutWrite(dev, wh, sizeof(WAVEHDR));
+       if(res)
        {
-       int rc;
+           ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "waveOutWrite(): %s",
+                     mmerror_code_string(res));
+           safe_exit(1);
+       }
 
-       if(play_counter == 0 && reset_samples == 0)
-           return RC_NONE;
+       len -= n;
+       bp += n;
+    }
+}
 
-       /* extract all trace */
-       while(trace_loop())
-       {
-           rc = check_apply_control();
-           if(RC_IS_SKIP_FILE(rc))
-           {
-               purge_output();
-               return rc;
-           }
-           Sleep(0);
-       }
+static void close_output(void)
+{
+    int i;
+
+    if(dpm.fd == -1)
+       return;
+    wait();
+    waveOutClose(dev);
+    play_counter = reset_samples = 0;
+
+    for(i = 0; i < DATA_BLOCK_NUM; i++)
+    {
+       struct data_block_t *block;
+       block = &all_data_block[i];
+       GlobalUnlock(block->head_hg);
+       GlobalFree(block->head_hg);
+       GlobalUnlock(block->data_hg);
+       GlobalFree(block->data_hg);
+    }
+    free(all_data_block);
+
+    dpm.fd = -1;
+}
 
-       /* wait until play out */
-       do
-       {
-           rc = check_apply_control();
-           if(RC_IS_SKIP_FILE(rc))
-           {
-               purge_output();
-               return rc;
-           }
-           current_samples();
-           Sleep(0);
-       } while(play_counter > 0);
+static int flush_output(void)
+{
+    int rc;
 
-       wait ();
-       play_counter = reset_samples = 0;
+    if(play_counter == 0 && reset_samples == 0)
        return RC_NONE;
-       }
 
-static void purge_output (void)
+    /* extract all trace */
+    while(trace_loop())
+    {
+       rc = check_apply_control();
+       if(RC_IS_SKIP_FILE(rc))
+       {
+           purge_output();
+           return rc;
+       }
+       Sleep(0);
+    }
+
+    /* wait until play out */
+    do
+    {
+       rc = check_apply_control();
+       if(RC_IS_SKIP_FILE(rc))
        {
-       if(play_counter == 0 && reset_samples == 0)
-           return; /* Ignore */
-       waveOutReset (dev);
-       wait ();
-       play_counter = reset_samples = 0;
+           purge_output();
+           return rc;
        }
+       current_samples();
+       Sleep(0);
+    } while(play_counter > 0);
+
+    wait();
+    reset_data_block();
+    play_counter = reset_samples = 0;
+    return RC_NONE;
+}
+
+static void purge_output(void)
+{
+    if(play_counter == 0 && reset_samples == 0)
+       return;                 /* Ignore */
+    waveOutReset(dev);
+    wait();
+    reset_data_block();
+    play_counter = reset_samples = 0;
+}
 
 
 static int play_loop(void)
-       {
-       return 0;
-       }
+{
+    return 0;
+}
 
 static int32 current_samples(void)
-       {
-       double realtime, es;
+{
+    double realtime, es;
+
+    realtime = get_current_calender_time();
+    if(play_counter == 0)
+    {
+       play_start_time = realtime;
+       return reset_samples;
+    }
+    es = dpm.rate * (realtime - play_start_time);
+    if(es >= play_counter)
+    {
+       /* out of play counter */
+       reset_samples += play_counter;
+       play_counter = 0;
+       play_start_time = realtime;
+       return reset_samples;
+    }
+    if(es < 0)
+       return 0;               /* for safety */
+    return (int32)es + reset_samples;
+}
 
-       realtime = get_current_calender_time();
-       if(play_counter == 0)
-       {
-           play_start_time = realtime;
-           return reset_samples;
-       }
-       es = dpm.rate * (realtime - play_start_time);
-       if(es >= play_counter)
+
+#define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
+static const char *mmsyserr_code_string[] =
+{
+    "no error",
+    "unspecified error",
+    "device ID out of range",
+    "driver failed enable",
+    "device already allocated",
+    "device handle is invalid",
+    "no device driver present",
+    "memory allocation error",
+    "function isn't supported",
+    "error value out of range",
+    "invalid flag passed",
+    "invalid parameter passed",
+    "handle being used",
+};
+
+static const char *waverr_code_sring[] =
+{
+    "unsupported wave format",
+    "still something playing",
+    "header not prepared",
+    "device is synchronous",
+};
+
+static const char *mmerror_code_string(MMRESULT err_code)
+{
+    static char s[32];
+
+    if(err_code >= WAVERR_BASE)
+    {
+       err_code -= WAVERR_BASE;
+       if(err_code > ARRAY_SIZE(waverr_code_sring))
        {
-           /* out of play counter */
-           reset_samples += play_counter;
-           play_counter = 0;
-           play_start_time = realtime;
-           return reset_samples;
-       }
-       if(es < 0)
-           return 0; /* for safety */
-       return (int32)es + reset_samples;
+           sprintf(s, "WAVERR %d", err_code);
+           return s;
        }
+       return waverr_code_sring[err_code];
+    }
+    if(err_code > ARRAY_SIZE(mmsyserr_code_string))
+    {
+       sprintf(s, "MMSYSERR %d", err_code);
+       return s;
+    }
+    return mmsyserr_code_string[err_code];
+}
+
+
+static struct data_block_t *new_data_block()
+{
+    struct data_block_t *p;
+
+    p = NULL;
+    EnterCriticalSection (&critSect);
+    if(free_data_block != NULL)
+    {
+       p = free_data_block;
+       free_data_block = free_data_block->next;
+       nBlocks++;
+       p->next = NULL;
+    }
+    LeaveCriticalSection (&critSect);
+
+    return p;
+}
+
+static void reuse_data_block(struct data_block_t *block)
+{
+    block->next = free_data_block;
+    free_data_block = block;
+    nBlocks--;
+}
+
+static void reset_data_block(void)
+{
+    int i;
+
+    all_data_block[0].blockno = 0;
+    all_data_block[0].next = &all_data_block[1];
+    for(i = 1; i < DATA_BLOCK_NUM - 1; i++)
+    {
+       all_data_block[i].blockno = i;
+       all_data_block[i].next = &all_data_block[i + 1];
+    }
+    all_data_block[i].blockno = i;
+    all_data_block[i].next = NULL;
+    free_data_block = &all_data_block[0];
+    nBlocks = 0;
+}
index e719a58..7a048c5 100644 (file)
@@ -96,8 +96,8 @@ extern WRDTracer tty_wrdt_mode;
 extern WRDTracer x_wrdt_mode;
 #endif /* WRDT_X */
 
-#ifdef __WIN32__
-extern WRDTracer wincon_wrdt_mode;
+#if defined(__WIN32__)
+extern WRDTracer wincon_wrdt_mode; /* wrdt_wincon.c */
 #endif /* __WIN32__ */
 
 WRDTracer *wrdt_list[] =
index 8e6638a..c6b27ff 100644 (file)
@@ -36,13 +36,14 @@ libutils_a_SOURCES = \
        nkflib.h \
        strtab.c \
        strtab.h \
+       support.c \
        timer.c \
        timer.h
 
 EXTRA_libutils_a_SOURCES = \
        fft.c \
        fft.h \
-       getopt.c \
+       support.c \
        net.c \
        net.h \
        mac_util.c \
@@ -60,18 +61,13 @@ if ENABLE_SOUND_SPEC
 SOUND_SPEC_OBJS = fft.o
 endif
 
-if NEED_GETOPT
-GETOPT_OBJS = getopt.o
-endif
-
-if CYGWIN32
-CYGWIN32_OBJS = readdir_win.o
+if W32READDIR
+W32READDIR_OBJS = readdir_win.o
 endif
 
 libutils_a_LIBADD = \
        $(NET_OBJS) \
-       $(CYGWIN32_OBJS) \
-       $(GETOPT_OBJS) \
+       $(W32READDIR_OBJS) \
        $(SOUND_SPEC_OBJS)
 
-libutils_a_DEPENDENCIES = $(libutils_a_LIBADD)
\ No newline at end of file
+libutils_a_DEPENDENCIES = $(libutils_a_LIBADD)
index 79ec66d..d929dce 100644 (file)
@@ -103,6 +103,7 @@ VERSION = @VERSION@
 WISH = @WISH@
 dynamic_targets = @dynamic_targets@
 lispdir = @lispdir@
+program_transform_name = @program_transform_name@
 so = @so@
 tcltk_dep = @tcltk_dep@
 
@@ -124,13 +125,14 @@ libutils_a_SOURCES = \
        nkflib.h \
        strtab.c \
        strtab.h \
+       support.c \
        timer.c \
        timer.h
 
 EXTRA_libutils_a_SOURCES = \
        fft.c \
        fft.h \
-       getopt.c \
+       support.c \
        net.c \
        net.h \
        mac_util.c \
@@ -144,14 +146,11 @@ EXTRA_libutils_a_SOURCES = \
 
 @ENABLE_SOUND_SPEC_TRUE@SOUND_SPEC_OBJS = fft.o
 
-@NEED_GETOPT_TRUE@GETOPT_OBJS = getopt.o
-
-@CYGWIN32_TRUE@CYGWIN32_OBJS = readdir_win.o
+@W32READDIR_TRUE@W32READDIR_OBJS = readdir_win.o
 
 libutils_a_LIBADD = \
        $(NET_OBJS) \
-       $(CYGWIN32_OBJS) \
-       $(GETOPT_OBJS) \
+       $(W32READDIR_OBJS) \
        $(SOUND_SPEC_OBJS)
 
 libutils_a_DEPENDENCIES = $(libutils_a_LIBADD)
@@ -169,7 +168,8 @@ X_CFLAGS = @X_CFLAGS@
 X_LIBS = @X_LIBS@
 X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_PRE_LIBS = @X_PRE_LIBS@
-libutils_a_OBJECTS =  bitset.o mblock.o memb.o nkflib.o strtab.o timer.o
+libutils_a_OBJECTS =  bitset.o mblock.o memb.o nkflib.o strtab.o \
+support.o timer.o
 AR = ar
 CFLAGS = @CFLAGS@
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
@@ -267,12 +267,16 @@ distdir: $(DISTFILES)
        done
 bitset.o: bitset.c ../config.h ../timidity/timidity.h \
        ../timidity/common.h ../libarc/url.h mblock.h bitset.h
+fft.o: fft.c ../config.h ../timidity/timidity.h ../timidity/common.h \
+       ../libarc/url.h mblock.h fft.h
 mblock.o: mblock.c ../config.h ../timidity/timidity.h mblock.h
 memb.o: memb.c ../config.h ../timidity/timidity.h memb.h mblock.h \
        ../libarc/url.h
+net.o: net.c ../config.h ../timidity/timidity.h net.h
 nkflib.o: nkflib.c ../config.h ../timidity/timidity.h \
        ../timidity/common.h ../libarc/url.h mblock.h nkflib.h
 strtab.o: strtab.c ../config.h ../timidity/timidity.h mblock.h strtab.h
+support.o: support.c ../config.h ../timidity/timidity.h mblock.h
 timer.o: timer.c ../config.h ../timidity/timidity.h timer.h
 
 info:
diff --git a/utils/getopt.c b/utils/getopt.c
deleted file mode 100644 (file)
index ba8f55d..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
-       Copyright (c) 1986,1992 by Borland International Inc.
-       All Rights Reserved.
-*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-#ifndef NO_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#include <dos.h>
-#include <stdio.h>
-#include "timidity.h"
-
-int    optind  = 1;    /* index of which argument is next      */
-char   *optarg;                /* pointer to argument of current option */
-int    opterr  = 1;    /* allow error message  */
-
-static char   *letP = NULL;    /* remember next option char's location */
-
-#if 0
-static char    SW = 0;         /* DOS switch character, either '-' or '/' */
-#endif
-#define SW '-' /* On Win32 can't call DOS! */
-/*
-  Parse the command line options, System V style.
-
-  Standard option syntax is:
-
-    option ::= SW [optLetter]* [argLetter space* argument]
-
-  where
-    - SW is either '/' or '-', according to the current setting
-      of the MSDOS switchar (int 21h function 37h).
-    - there is no space before any optLetter or argLetter.
-    - opt/arg letters are alphabetic, not punctuation characters.
-        - optLetters, if present, must be matched in optionS.
-    - argLetters, if present, are found in optionS followed by ':'.
-    - argument is any white-space delimited string.  Note that it
-      can include the SW character.
-    - upper and lower case letters are distinct.
-
-  There may be multiple option clusters on a command line, each
-  beginning with a SW, but all must appear before any non-option
-  arguments (arguments not introduced by SW).  Opt/arg letters may
-  be repeated: it is up to the caller to decide if that is an error.
-
-  The character SW appearing alone as the last argument is an error.
-  The lead-in sequence SWSW ("--" or "//") causes itself and all the
-  rest of the line to be ignored (allowing non-options which begin
-  with the switch char).
-
-  The string *optionS allows valid opt/arg letters to be recognized.
-  argLetters are followed with ':'.  Getopt () returns the value of
-  the option character found, or EOF if no more options are in the
-  command line.         If option is an argLetter then the global optarg is
-  set to point to the argument string (having skipped any white-space).
-
-  The global optind is initially 1 and is always left as the index
-  of the next argument of argv[] which getopt has not taken.  Note
-  that if "--" or "//" are used then optind is stepped to the next
-  argument before getopt() returns EOF.
-
-  If an error occurs, that is an SW char precedes an unknown letter,
-  then getopt() will return a '?' character and normally prints an
-  error message via perror().  If the global variable opterr is set
-  to false (zero) before calling getopt() then the error message is
-  not printed.
-
-  For example, if the MSDOS switch char is '/' (the MSDOS norm) and
-
-    *optionS == "A:F:PuU:wXZ:"
-
-  then 'P', 'u', 'w', and 'X' are option letters and 'F', 'U', 'Z'
-  are followed by arguments.  A valid command line may be:
-
-    aCommand  /uPFPi /X /A L someFile
-
-  where:
-    - 'u' and 'P' will be returned as isolated option letters.
-    - 'F' will return with "Pi" as its argument string.
-    - 'X' is an isolated option.
-    - 'A' will return with "L" as its argument.
-    - "someFile" is not an option, and terminates getOpt.  The
-      caller may collect remaining arguments using argv pointers.
-*/
-
-int    getopt(int argc, char *argv[], char *optionS)
-{
-       unsigned char ch;
-       char *optP;
-
-#if 0
-       if (SW == 0) {
-               /* get SW using dos call 0x37 */
-               _AX = 0x3700;
-               geninterrupt(0x21);
-               SW = _DL;
-       }
-#endif
-       if (argc > optind) {
-               if (letP == NULL) {
-                       if ((letP = argv[optind]) == NULL ||
-                               *(letP++) != SW)  goto gopEOF;
-                       if (*letP == SW) {
-                               optind++;  goto gopEOF;
-                       }
-               }
-               if (0 == (ch = *(letP++))) {
-                       optind++;  goto gopEOF;
-               }
-               if (':' == ch  ||  (optP = strchr(optionS, ch)) == NULL)
-                       goto gopError;
-               if (':' == *(++optP)) {
-                       optind++;
-                       if (0 == *letP) {
-                               if (argc <= optind)  goto  gopError;
-                               letP = argv[optind++];
-                       }
-                       optarg = letP;
-                       letP = NULL;
-               } else {
-                       if (0 == *letP) {
-                               optind++;
-                               letP = NULL;
-                       }
-                       optarg = NULL;
-               }
-               return ch;
-       }
-gopEOF:
-       optarg = letP = NULL;
-       return EOF;
-
-gopError:
-        if (argc > optind)
-                optind++;
-        optarg = letP = NULL;
-       errno  = EINVAL;
-       if (opterr)
-               perror ("get command line option");
-       return ('?');
-}
index d71a5f1..2d70755 100644 (file)
@@ -25,7 +25,7 @@
 #endif /* HAVE_CONFIG_H */
 #include <stdio.h>
 #include <stdlib.h>
-#ifndef __WIN32__
+#if !defined(__WIN32__) || defined(__CYGWIN32__)
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #define INADDR_NONE 0xffffffff
 #endif /* INADDR_NONE */
 
-#ifndef __WIN32__
+#if !defined(__WIN32__) || defined(__CYGWIN32__)
 #ifndef INVALID_SOCKET
 #define INVALID_SOCKET -1
 #endif /* INVALID_SOCKET */
 #ifndef SOCKET_ERROR
 #define SOCKET_ERROR -1
 #endif /* SOCKET_ERROR */
-#endif /* __WIN32__ */
+#endif
 
 SOCKET open_socket(char *host, unsigned short port)
 {
@@ -83,7 +83,7 @@ SOCKET open_socket(char *host, unsigned short port)
     return fd;
 }
 
-#ifndef __WIN32__
+#if !defined(__WIN32__) || defined(__CYGWIN32__)
 long socket_write(SOCKET fd, char *buff, long bufsiz)
 {
     return write(fd, buff, bufsiz);
index 35b67fb..8d6a189 100644 (file)
 #ifndef ___NET_H_
 #define ___NET_H_
 
-#ifdef __WIN32__
-#include <winsock.h>
-#else
+#if !defined(__WIN32__) || defined(__CYGWIN32__)
 typedef int SOCKET;
 #define closesocket(fd) close(fd)
+#else
+#include <winsock.h>
 #endif
 
 extern SOCKET open_socket(char *host, unsigned short port);
diff --git a/utils/support.c b/utils/support.c
new file mode 100644 (file)
index 0000000..9bad152
--- /dev/null
@@ -0,0 +1,742 @@
+/*
+
+    TiMidity++ -- MIDI to WAVE converter and player
+    Copyright (C) 1999 Masanao Izumo <mo@goice.co.jp>
+    Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
+
+    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 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    support.c - Define missing function
+                Written by Masanao Izumo <mo@goice.co.jp>
+*/
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#ifndef NO_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+#include "timidity.h"
+#include "mblock.h"
+
+#ifndef HAVE_VSNPRINTF
+/* From glib-1.1.13:gstrfuncs.c
+ * Modified by Masanao Izumo <mo@goice.co.jp>
+ */
+static int printf_string_upper_bound (const char* format,
+                            va_list      args)
+{
+  int len = 1;
+
+  while (*format)
+    {
+      int long_int = 0;
+      int extra_long = 0;
+      char c;
+      
+      c = *format++;
+      
+      if (c == '%')
+       {
+         int done = 0;
+         
+         while (*format && !done)
+           {
+             switch (*format++)
+               {
+                 char *string_arg;
+                 
+               case '*':
+                 len += va_arg (args, int);
+                 break;
+               case '1':
+               case '2':
+               case '3':
+               case '4':
+               case '5':
+               case '6':
+               case '7':
+               case '8':
+               case '9':
+                 /* add specified format length, since it might exceed the
+                  * size we assume it to have.
+                  */
+                 format -= 1;
+                 len += strtol (format, (char**) &format, 10);
+                 break;
+               case 'h':
+                 /* ignore short int flag, since all args have at least the
+                  * same size as an int
+                  */
+                 break;
+               case 'l':
+                 if (long_int)
+                   extra_long = 1; /* linux specific */
+                 else
+                   long_int = 1;
+                 break;
+               case 'q':
+               case 'L':
+                 long_int = 1;
+                 extra_long = 1;
+                 break;
+               case 's':
+                 string_arg = va_arg (args, char *);
+                 if (string_arg)
+                   len += strlen (string_arg);
+                 else
+                   {
+                     /* add enough padding to hold "(null)" identifier */
+                     len += 16;
+                   }
+                 done = 1;
+                 break;
+               case 'd':
+               case 'i':
+               case 'o':
+               case 'u':
+               case 'x':
+               case 'X':
+#ifdef G_HAVE_GINT64
+                 if (extra_long)
+                   (void) va_arg (args, gint64);
+                 else
+#endif /* G_HAVE_GINT64 */
+                   {
+                     if (long_int)
+                       (void) va_arg (args, long);
+                     else
+                       (void) va_arg (args, int);
+                   }
+                 len += extra_long ? 64 : 32;
+                 done = 1;
+                 break;
+               case 'D':
+               case 'O':
+               case 'U':
+                 (void) va_arg (args, long);
+                 len += 32;
+                 done = 1;
+                 break;
+               case 'e':
+               case 'E':
+               case 'f':
+               case 'g':
+#ifdef HAVE_LONG_DOUBLE
+                 if (extra_long)
+                   (void) va_arg (args, long double);
+                 else
+#endif /* HAVE_LONG_DOUBLE */
+                   (void) va_arg (args, double);
+                 len += extra_long ? 64 : 32;
+                 done = 1;
+                 break;
+               case 'c':
+                 (void) va_arg (args, int);
+                 len += 1;
+                 done = 1;
+                 break;
+               case 'p':
+               case 'n':
+                 (void) va_arg (args, void*);
+                 len += 32;
+                 done = 1;
+                 break;
+               case '%':
+                 len += 1;
+                 done = 1;
+                 break;
+               default:
+                 /* ignore unknow/invalid flags */
+                 break;
+               }
+           }
+       }
+      else
+       len += 1;
+    }
+
+  return len;
+}
+
+void vsnprintf(char *buff, size_t bufsiz, const char *fmt, va_list ap)
+{
+    MBlockList pool;
+    char *tmpbuf = buff;
+
+    init_mblock(&pool);
+    tmpbuf = new_segment(&pool, printf_string_upper_bound(fmt, ap));
+    vsprintf(tmpbuf, fmt, ap);
+    strncpy(buff, tmpbuf, bufsiz);
+    reuse_mblock(&pool);
+}
+#endif /* HAVE_VSNPRINTF */
+
+#ifndef HAVE_SNPRINTF
+void snprintf(char *buff, size_t bufsiz, const char *fmt, ...)
+{
+    va_list ap;
+    va_start(ap, fmt);
+    vsnprintf(buff, bufsiz, fmt, ap);
+    va_end(ap);
+}
+#endif /* HAVE_VSNPRINTF */
+
+
+#ifndef HAVE_GETOPT
+/*
+       Copyright (c) 1986,1992 by Borland International Inc.
+       All Rights Reserved.
+*/
+#ifdef HAVE_DOS_H
+#include <dos.h>
+#endif /* HAVE_DOS_H */
+
+int    optind  = 1;    /* index of which argument is next      */
+char   *optarg;                /* pointer to argument of current option */
+int    opterr  = 1;    /* allow error message  */
+
+static char   *letP = NULL;    /* remember next option char's location */
+
+#if 0
+static char    SW = 0;         /* DOS switch character, either '-' or '/' */
+#endif
+#define SW '-' /* On Win32 can't call DOS! */
+/*
+  Parse the command line options, System V style.
+
+  Standard option syntax is:
+
+    option ::= SW [optLetter]* [argLetter space* argument]
+
+  where
+    - SW is either '/' or '-', according to the current setting
+      of the MSDOS switchar (int 21h function 37h).
+    - there is no space before any optLetter or argLetter.
+    - opt/arg letters are alphabetic, not punctuation characters.
+        - optLetters, if present, must be matched in optionS.
+    - argLetters, if present, are found in optionS followed by ':'.
+    - argument is any white-space delimited string.  Note that it
+      can include the SW character.
+    - upper and lower case letters are distinct.
+
+  There may be multiple option clusters on a command line, each
+  beginning with a SW, but all must appear before any non-option
+  arguments (arguments not introduced by SW).  Opt/arg letters may
+  be repeated: it is up to the caller to decide if that is an error.
+
+  The character SW appearing alone as the last argument is an error.
+  The lead-in sequence SWSW ("--" or "//") causes itself and all the
+  rest of the line to be ignored (allowing non-options which begin
+  with the switch char).
+
+  The string *optionS allows valid opt/arg letters to be recognized.
+  argLetters are followed with ':'.  Getopt () returns the value of
+  the option character found, or EOF if no more options are in the
+  command line.         If option is an argLetter then the global optarg is
+  set to point to the argument string (having skipped any white-space).
+
+  The global optind is initially 1 and is always left as the index
+  of the next argument of argv[] which getopt has not taken.  Note
+  that if "--" or "//" are used then optind is stepped to the next
+  argument before getopt() returns EOF.
+
+  If an error occurs, that is an SW char precedes an unknown letter,
+  then getopt() will return a '?' character and normally prints an
+  error message via perror().  If the global variable opterr is set
+  to false (zero) before calling getopt() then the error message is
+  not printed.
+
+  For example, if the MSDOS switch char is '/' (the MSDOS norm) and
+
+    *optionS == "A:F:PuU:wXZ:"
+
+  then 'P', 'u', 'w', and 'X' are option letters and 'F', 'U', 'Z'
+  are followed by arguments.  A valid command line may be:
+
+    aCommand  /uPFPi /X /A L someFile
+
+  where:
+    - 'u' and 'P' will be returned as isolated option letters.
+    - 'F' will return with "Pi" as its argument string.
+    - 'X' is an isolated option.
+    - 'A' will return with "L" as its argument.
+    - "someFile" is not an option, and terminates getOpt.  The
+      caller may collect remaining arguments using argv pointers.
+*/
+
+int    getopt(int argc, char *argv[], char *optionS)
+{
+       unsigned char ch;
+       char *optP;
+
+#if 0
+       if (SW == 0) {
+               /* get SW using dos call 0x37 */
+               _AX = 0x3700;
+               geninterrupt(0x21);
+               SW = _DL;
+       }
+#endif
+       if (argc > optind) {
+               if (letP == NULL) {
+                       if ((letP = argv[optind]) == NULL ||
+                               *(letP++) != SW)  goto gopEOF;
+                       if (*letP == SW) {
+                               optind++;  goto gopEOF;
+                       }
+               }
+               if (0 == (ch = *(letP++))) {
+                       optind++;  goto gopEOF;
+               }
+               if (':' == ch  ||  (optP = strchr(optionS, ch)) == NULL)
+                       goto gopError;
+               if (':' == *(++optP)) {
+                       optind++;
+                       if (0 == *letP) {
+                               if (argc <= optind)  goto  gopError;
+                               letP = argv[optind++];
+                       }
+                       optarg = letP;
+                       letP = NULL;
+               } else {
+                       if (0 == *letP) {
+                               optind++;
+                               letP = NULL;
+                       }
+                       optarg = NULL;
+               }
+               return ch;
+       }
+gopEOF:
+       optarg = letP = NULL;
+       return EOF;
+
+gopError:
+        if (argc > optind)
+                optind++;
+        optarg = letP = NULL;
+       errno  = EINVAL;
+       if (opterr)
+               perror ("get command line option");
+       return ('?');
+}
+#endif /* HAVE_GETOPT */
+
+
+#ifndef HAVE_STRERROR
+#ifndef HAVE_ERRNO_H
+char *strerror(int errnum) {
+    static char s[32];
+    sprintf(s, "ERROR %d", errnum);
+    return s;
+}
+#else
+char *strerror(int errnum)
+{
+    switch(errnum) {
+#ifdef EPERM
+      case EPERM: return "Not super-user";
+#endif /* EPERM */
+#ifdef ENOENT
+      case ENOENT: return "No such file or directory";
+#endif /* ENOENT */
+#ifdef ESRCH
+      case ESRCH: return "No such process";
+#endif /* ESRCH */
+#ifdef EINTR
+      case EINTR: return "interrupted system call";
+#endif /* EINTR */
+#ifdef EIO
+      case EIO: return "I/O error";
+#endif /* EIO */
+#ifdef ENXIO
+      case ENXIO: return "No such device or address";
+#endif /* ENXIO */
+#ifdef E2BIG
+      case E2BIG: return "Arg list too long";
+#endif /* E2BIG */
+#ifdef ENOEXEC
+      case ENOEXEC: return "Exec format error";
+#endif /* ENOEXEC */
+#ifdef EBADF
+      case EBADF: return "Bad file number";
+#endif /* EBADF */
+#ifdef ECHILD
+      case ECHILD: return "No children";
+#endif /* ECHILD */
+#ifdef EAGAIN
+      case EAGAIN: return "Resource temporarily unavailable";
+#endif /* EAGAIN */
+#ifdef EWOULDBLOCK
+#if !defined(EAGAIN) || defined(EAGAIN) && EAGAIN != EWOULDBLOCK
+      case EWOULDBLOCK: return "Resource temporarily unavailable";
+#endif
+#endif /* EWOULDBLOCK */
+#ifdef ENOMEM
+      case ENOMEM: return "Not enough core";
+#endif /* ENOMEM */
+#ifdef EACCES
+      case EACCES: return "Permission denied";
+#endif /* EACCES */
+#ifdef EFAULT
+      case EFAULT: return "Bad address";
+#endif /* EFAULT */
+#ifdef ENOTBLK
+      case ENOTBLK: return "Block device required";
+#endif /* ENOTBLK */
+#ifdef EBUSY
+      case EBUSY: return "Mount device busy";
+#endif /* EBUSY */
+#ifdef EEXIST
+      case EEXIST: return "File exists";
+#endif /* EEXIST */
+#ifdef EXDEV
+      case EXDEV: return "Cross-device link";
+#endif /* EXDEV */
+#ifdef ENODEV
+      case ENODEV: return "No such device";
+#endif /* ENODEV */
+#ifdef ENOTDIR
+      case ENOTDIR: return "Not a directory";
+#endif /* ENOTDIR */
+#ifdef EISDIR
+      case EISDIR: return "Is a directory";
+#endif /* EISDIR */
+#ifdef EINVAL
+      case EINVAL: return "Invalid argument";
+#endif /* EINVAL */
+#ifdef ENFILE
+      case ENFILE: return "File table overflow";
+#endif /* ENFILE */
+#ifdef EMFILE
+      case EMFILE: return "Too many open files";
+#endif /* EMFILE */
+#ifdef ENOTTY
+      case ENOTTY: return "Inappropriate ioctl for device";
+#endif /* ENOTTY */
+#ifdef ETXTBSY
+      case ETXTBSY: return "Text file busy";
+#endif /* ETXTBSY */
+#ifdef EFBIG
+      case EFBIG: return "File too large";
+#endif /* EFBIG */
+#ifdef ENOSPC
+      case ENOSPC: return "No space left on device";
+#endif /* ENOSPC */
+#ifdef ESPIPE
+      case ESPIPE: return "Illegal seek";
+#endif /* ESPIPE */
+#ifdef EROFS
+      case EROFS: return "Read only file system";
+#endif /* EROFS */
+#ifdef EMLINK
+      case EMLINK: return "Too many links";
+#endif /* EMLINK */
+#ifdef EPIPE
+      case EPIPE: return "Broken pipe";
+#endif /* EPIPE */
+#ifdef EDOM
+      case EDOM: return "Math arg out of domain of func";
+#endif /* EDOM */
+#ifdef ERANGE
+      case ERANGE: return "Math result not representable";
+#endif /* ERANGE */
+#ifdef ENOMSG
+      case ENOMSG: return "No message of desired type";
+#endif /* ENOMSG */
+#ifdef EIDRM
+      case EIDRM: return "Identifier removed";
+#endif /* EIDRM */
+#ifdef ECHRNG
+      case ECHRNG: return "Channel number out of range";
+#endif /* ECHRNG */
+#ifdef EL2NSYNC
+      case EL2NSYNC: return "Level 2 not synchronized";
+#endif /* EL2NSYNC */
+#ifdef EL3HLT
+      case EL3HLT: return "Level 3 halted";
+#endif /* EL3HLT */
+#ifdef EL3RST
+      case EL3RST: return "Level 3 reset";
+#endif /* EL3RST */
+#ifdef ELNRNG
+      case ELNRNG: return "Link number out of range";
+#endif /* ELNRNG */
+#ifdef EUNATCH
+      case EUNATCH: return "Protocol driver not attached";
+#endif /* EUNATCH */
+#ifdef ENOCSI
+      case ENOCSI: return "No CSI structure available";
+#endif /* ENOCSI */
+#ifdef EL2HLT
+      case EL2HLT: return "Level 2 halted";
+#endif /* EL2HLT */
+#ifdef EDEADLK
+      case EDEADLK: return "Deadlock condition.";
+#endif /* EDEADLK */
+#ifdef ENOLCK
+      case ENOLCK: return "No record locks available.";
+#endif /* ENOLCK */
+#ifdef ECANCELED
+      case ECANCELED: return "Operation canceled";
+#endif /* ECANCELED */
+#ifdef ENOTSUP
+      case ENOTSUP: return "Operation not supported";
+#endif /* ENOTSUP */
+#ifdef EDQUOT
+      case EDQUOT: return "Disc quota exceeded";
+#endif /* EDQUOT */
+#ifdef EBADE
+      case EBADE: return "invalid exchange";
+#endif /* EBADE */
+#ifdef EBADR
+      case EBADR: return "invalid request descriptor";
+#endif /* EBADR */
+#ifdef EXFULL
+      case EXFULL: return "exchange full";
+#endif /* EXFULL */
+#ifdef ENOANO
+      case ENOANO: return "no anode";
+#endif /* ENOANO */
+#ifdef EBADRQC
+      case EBADRQC: return "invalid request code";
+#endif /* EBADRQC */
+#ifdef EBADSLT
+      case EBADSLT: return "invalid slot";
+#endif /* EBADSLT */
+#ifdef EDEADLOCK
+      case EDEADLOCK: return "file locking deadlock error";
+#endif /* EDEADLOCK */
+#ifdef EBFONT
+      case EBFONT: return "bad font file fmt";
+#endif /* EBFONT */
+#ifdef ENOSTR
+      case ENOSTR: return "Device not a stream";
+#endif /* ENOSTR */
+#ifdef ENODATA
+      case ENODATA: return "no data (for no delay io)";
+#endif /* ENODATA */
+#ifdef ETIME
+      case ETIME: return "timer expired";
+#endif /* ETIME */
+#ifdef ENOSR
+      case ENOSR: return "out of streams resources";
+#endif /* ENOSR */
+#ifdef ENONET
+      case ENONET: return "Machine is not on the network";
+#endif /* ENONET */
+#ifdef ENOPKG
+      case ENOPKG: return "Package not installed";
+#endif /* ENOPKG */
+#ifdef EREMOTE
+      case EREMOTE: return "The object is remote";
+#endif /* EREMOTE */
+#ifdef ENOLINK
+      case ENOLINK: return "the link has been severed";
+#endif /* ENOLINK */
+#ifdef EADV
+      case EADV: return "advertise error";
+#endif /* EADV */
+#ifdef ESRMNT
+      case ESRMNT: return "srmount error";
+#endif /* ESRMNT */
+#ifdef ECOMM
+      case ECOMM: return "Communication error on send";
+#endif /* ECOMM */
+#ifdef EPROTO
+      case EPROTO: return "Protocol error";
+#endif /* EPROTO */
+#ifdef EMULTIHOP
+      case EMULTIHOP: return "multihop attempted";
+#endif /* EMULTIHOP */
+#ifdef EBADMSG
+      case EBADMSG: return "trying to read unreadable message";
+#endif /* EBADMSG */
+#ifdef ENAMETOOLONG
+      case ENAMETOOLONG: return "path name is too long";
+#endif /* ENAMETOOLONG */
+#ifdef EOVERFLOW
+      case EOVERFLOW: return "value too large to be stored in data type";
+#endif /* EOVERFLOW */
+#ifdef ENOTUNIQ
+      case ENOTUNIQ: return "given log. name not unique";
+#endif /* ENOTUNIQ */
+#ifdef EBADFD
+      case EBADFD: return "f.d. invalid for this operation";
+#endif /* EBADFD */
+#ifdef EREMCHG
+      case EREMCHG: return "Remote address changed";
+#endif /* EREMCHG */
+#ifdef ELIBACC
+      case ELIBACC: return "Can't access a needed shared lib.";
+#endif /* ELIBACC */
+#ifdef ELIBBAD
+      case ELIBBAD: return "Accessing a corrupted shared lib.";
+#endif /* ELIBBAD */
+#ifdef ELIBSCN
+      case ELIBSCN: return ".lib section in a.out corrupted.";
+#endif /* ELIBSCN */
+#ifdef ELIBMAX
+      case ELIBMAX: return "Attempting to link in too many libs.";
+#endif /* ELIBMAX */
+#ifdef ELIBEXEC
+      case ELIBEXEC: return "Attempting to exec a shared library.";
+#endif /* ELIBEXEC */
+#ifdef EILSEQ
+      case EILSEQ: return "Illegal byte sequence.";
+#endif /* EILSEQ */
+#ifdef ENOSYS
+      case ENOSYS: return "Unsupported file system operation";
+#endif /* ENOSYS */
+#ifdef ELOOP
+      case ELOOP: return "Symbolic link loop";
+#endif /* ELOOP */
+#ifdef ERESTART
+      case ERESTART: return "Restartable system call";
+#endif /* ERESTART */
+#ifdef ESTRPIPE
+      case ESTRPIPE: return "if pipe/FIFO, don't sleep in stream head";
+#endif /* ESTRPIPE */
+#ifdef ENOTEMPTY
+      case ENOTEMPTY: return "directory not empty";
+#endif /* ENOTEMPTY */
+#ifdef EUSERS
+      case EUSERS: return "Too many users (for UFS)";
+#endif /* EUSERS */
+#ifdef ENOTSOCK
+      case ENOTSOCK: return "Socket operation on non-socket";
+#endif /* ENOTSOCK */
+#ifdef EDESTADDRREQ
+      case EDESTADDRREQ: return "Destination address required";
+#endif /* EDESTADDRREQ */
+#ifdef EMSGSIZE
+      case EMSGSIZE: return "Message too long";
+#endif /* EMSGSIZE */
+#ifdef EPROTOTYPE
+      case EPROTOTYPE: return "Protocol wrong type for socket";
+#endif /* EPROTOTYPE */
+#ifdef ENOPROTOOPT
+      case ENOPROTOOPT: return "Protocol not available";
+#endif /* ENOPROTOOPT */
+#ifdef EPROTONOSUPPORT
+      case EPROTONOSUPPORT: return "Protocol not supported";
+#endif /* EPROTONOSUPPORT */
+#ifdef ESOCKTNOSUPPORT
+      case ESOCKTNOSUPPORT: return "Socket type not supported";
+#endif /* ESOCKTNOSUPPORT */
+#ifdef EOPNOTSUPP
+      case EOPNOTSUPP: return "Operation not supported on socket";
+#endif /* EOPNOTSUPP */
+#ifdef EPFNOSUPPORT
+      case EPFNOSUPPORT: return "Protocol family not supported";
+#endif /* EPFNOSUPPORT */
+#ifdef EAFNOSUPPORT
+      case EAFNOSUPPORT: return "Address family not supported by";
+#endif /* EAFNOSUPPORT */
+#ifdef EADDRINUSE
+      case EADDRINUSE: return "Address already in use";
+#endif /* EADDRINUSE */
+#ifdef EADDRNOTAVAIL
+      case EADDRNOTAVAIL: return "Can't assign requested address";
+#endif /* EADDRNOTAVAIL */
+#ifdef ENETDOWN
+      case ENETDOWN: return "Network is down";
+#endif /* ENETDOWN */
+#ifdef ENETUNREACH
+      case ENETUNREACH: return "Network is unreachable";
+#endif /* ENETUNREACH */
+#ifdef ENETRESET
+      case ENETRESET: return "Network dropped connection because";
+#endif /* ENETRESET */
+#ifdef ECONNABORTED
+      case ECONNABORTED: return "Software caused connection abort";
+#endif /* ECONNABORTED */
+#ifdef ECONNRESET
+      case ECONNRESET: return "Connection reset by peer";
+#endif /* ECONNRESET */
+#ifdef ENOBUFS
+      case ENOBUFS: return "No buffer space available";
+#endif /* ENOBUFS */
+#ifdef EISCONN
+      case EISCONN: return "Socket is already connected";
+#endif /* EISCONN */
+#ifdef ENOTCONN
+      case ENOTCONN: return "Socket is not connected";
+#endif /* ENOTCONN */
+#ifdef ESHUTDOWN
+      case ESHUTDOWN: return "Can't send after socket shutdown";
+#endif /* ESHUTDOWN */
+#ifdef ETOOMANYREFS
+      case ETOOMANYREFS: return "Too many references: can't splice";
+#endif /* ETOOMANYREFS */
+#ifdef ETIMEDOUT
+      case ETIMEDOUT: return "Connection timed out";
+#endif /* ETIMEDOUT */
+#ifdef ECONNREFUSED
+      case ECONNREFUSED: return "Connection refused";
+#endif /* ECONNREFUSED */
+#ifdef EHOSTDOWN
+      case EHOSTDOWN: return "Host is down";
+#endif /* EHOSTDOWN */
+#ifdef EHOSTUNREACH
+      case EHOSTUNREACH: return "No route to host";
+#endif /* EHOSTUNREACH */
+#ifdef EALREADY
+      case EALREADY: return "operation already in progress";
+#endif /* EALREADY */
+#ifdef EINPROGRESS
+      case EINPROGRESS: return "operation now in progress";
+#endif /* EINPROGRESS */
+#ifdef ESTALE
+      case ESTALE: return "Stale NFS file handle";
+#endif /* ESTALE */
+      default: {
+         static char s[32];
+         sprintf(s, "ERROR %d", errnum);
+         return s;
+      }
+    }
+    /*NOTREACHED*/
+}
+#endif /* HAVE_ERRNO_H */
+#endif /* HAVE_STRERROR */
+
+
+#ifndef HAVE_USLEEP
+int usleep(unsigned int usec)
+{
+#if defined(HAVE_SELECT)
+    struct timeval tv;
+    tv.tv_sec  = usec / 1000000;
+    tv.tv_usec = usec % 1000000;
+    select(0, NULL, NULL, NULL, &tv);
+#elif defined(__WIN32__)
+    Sleep(usec / 1000);
+#endif /* HAVE_SELECT */
+    return 0;
+}
+#endif /* HAVE_USLEEP */
index 908df3f..e6c4496 100644 (file)
@@ -24,7 +24,7 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#ifndef __WIN32__ /* UNIX */
+#if defined(HAVE_GETTIMEOFDAY)
 #include <sys/types.h>
 #include <sys/time.h>
 #include <time.h>
@@ -51,7 +51,7 @@ double get_current_calender_time(void)
     return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0 ;
 }
 
-#else /* Windows */
+#else /* Windows API */
 
 #include <sys/types.h>
 #include <time.h>