unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Updated patch for a Windows implementation of play-sound
@ 2002-10-23  4:59 Ben Key
  2002-10-23  5:30 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Key @ 2002-10-23  4:59 UTC (permalink / raw)
  Cc: jasonr, rms

[-- Attachment #1: Type: text/plain, Size: 2651 bytes --]

This is an updated version of my patch to provide a Windows compatible
implementation of play-sound.  Currently only Emacs version 21.3.5 is
supported by this patch.  I will later be releasing a version of this patch
that supports version 21.2.

The changes made by this patch are as follows:

* nt/nmake.defs and nt/gmake.defs have been modified so that the constant
WINMM is defined in such a way to indicate how to link with the library
WINMM.LIB.  This constant was defined much like the constants ADVAPI32,
COMDLG32, GDI32, MPR, SHELL32, USER32, and WSOCK32.

* src/lisp.h has been modified so that the preprocessor symbol
_USE_PLAY_SOUND_INTERNAL is defined.  In the pending 21.2 compatible version
of this patch, this change will not be included.  This change is necessary
for version 21.3 because the file w32sound.c is used for both versions and
the name of the play-sound internal function is different in version 21.3
(play-sound-internal) than it is in version 21.2 (play-sound).  If the
preprocessor function _USE_PLAY_SOUND_INTERNAL is defined, the primary
function in w32sound.c is defined as play-sound-internal and it is defined
as play-sound otherwise.

* src/makefile.w32-in has been modified to compile w32sound.c and to link
with WINMM.LIB.

* src/s/ms-w32.h has been modified so that the preprocessor symbol
HAVE_SOUND is defined.  This enables sound support in Emacs.

* src/sound.c has been modified to avoid any chance of a conflict between
w32sound.c and sound.c.  Previously the statement
  #ifdef HAVE_SOUND
was used to determine whether or not to compile the file.  This has been
changed to
  #if defined(HAVE_SOUND) && !defined(_WIN32)

* src/w32sound.c has been added.  This contains my Windows implementation of
play-sound.  It is conditionally compiled as follows:
  #if defined(HAVE_SOUND) && defined(_WIN32)

This compound test is used to eliminate any possibility of a conflict
between sound.c and w32sound.c.

Also included in this ZIP file is a shell script designed to make applying
this patch easier.  Simply copy both dopatch21_3.sh and
emacs-21.3.50-w32-play-sound.diff into the directory containing your Emacs
source and run the shell script.  Then compile as you normally would.

This version of this patch is much cleaner than my previous version.  I am
no longer defining _WIN32_WINNT or WINVER to 0x0501.  This will eliminate a
large number of compiler warnings.  I also was very careful to make certain
that no changes were added into the patch inadvertently.


This patch has been tested using MSVC 6.0 and MingW 2.0.

I hope that this patch addresses all the issues that arose from my previous
patch.

[-- Attachment #2: emacs-21.3.50-play-sound-patch.zip --]
[-- Type: application/x-zip-compressed, Size: 5642 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Updated patch for a Windows implementation of play-sound
  2002-10-23  4:59 Updated patch for a Windows implementation of play-sound Ben Key
@ 2002-10-23  5:30 ` Stefan Monnier
  2002-10-23  6:16   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2002-10-23  5:30 UTC (permalink / raw)
  Cc: emacs-devel, jasonr, rms

> This is an updated version of my patch to provide a Windows compatible
> implementation of play-sound.  Currently only Emacs version 21.3.5 is
> supported by this patch.  I will later be releasing a version of this patch
> that supports version 21.2.

If I were you I wouldn't bother with a 21.2 version.  It would
only be used by people who want sound but don't want to use 21.3.50
and yet are willing to get the source code and recompile.  I expect
this group of people to be pretty small (especially on w32).

> * src/lisp.h has been modified so that the preprocessor symbol
> _USE_PLAY_SOUND_INTERNAL is defined.  In the pending 21.2 compatible version
> of this patch, this change will not be included.  This change is necessary
> for version 21.3 because the file w32sound.c is used for both versions and
> the name of the play-sound internal function is different in version 21.3
> (play-sound-internal) than it is in version 21.2 (play-sound).  If the
> preprocessor function _USE_PLAY_SOUND_INTERNAL is defined, the primary
> function in w32sound.c is defined as play-sound-internal and it is defined
> as play-sound otherwise.

The main target should be 21.3.50 so it would be better not to add
unrelated cruft in it.

> * src/sound.c has been modified to avoid any chance of a conflict between
> w32sound.c and sound.c.  Previously the statement
>   #ifdef HAVE_SOUND
> was used to determine whether or not to compile the file.  This has been
> changed to
>   #if defined(HAVE_SOUND) && !defined(_WIN32)
> 
> * src/w32sound.c has been added.  This contains my Windows implementation of
> play-sound.  It is conditionally compiled as follows:
>   #if defined(HAVE_SOUND) && defined(_WIN32)

How about not adding a new file w32sound.c but instead adding the
corresponding code to sound.c (and of course wrap things in
#ifdef WINDOWSNT (or _WIN32, I don't know what is what: most of
the Emacs C code I've seen seems to be using WINDOWSNT)).
This way the parsing and other such things will be shared.

Oh, and please just send the plaintext patch as attachment,
so we don't need to save/unpack the zip archive to read it.


	Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Updated patch for a Windows implementation of play-sound
  2002-10-23  5:30 ` Stefan Monnier
@ 2002-10-23  6:16   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2002-10-23  6:16 UTC (permalink / raw)
  Cc: Ben Key, emacs-devel, jasonr


On Wed, 23 Oct 2002, Stefan Monnier wrote:

> How about not adding a new file w32sound.c but instead adding the
> corresponding code to sound.c (and of course wrap things in
> #ifdef WINDOWSNT

Yes, I agree wholeheartedly.  Platform-specific source files are a pain; 
adding one more is something we should avoid IMHO.

sound.c is sufficiently small and already has lots of #ifdef's that test 
for specific systems, so adding another such portion won't change 
anything.

> (or _WIN32, I don't know what is what: most of
> the Emacs C code I've seen seems to be using WINDOWSNT)).

It's WINDOWSNT to avoid calling Windows ``a win'' ;-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-23  6:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-23  4:59 Updated patch for a Windows implementation of play-sound Ben Key
2002-10-23  5:30 ` Stefan Monnier
2002-10-23  6:16   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).