[PD-dev] [ pure-data-Patches-3412977 ] replace MSW with _WIN32 (please please please)

SourceForge.net noreply at sourceforge.net
Mon Nov 7 16:28:44 CET 2011


Patches item #3412977, was opened at 2011-09-22 10:11
Message generated for change (Settings changed) made by eighthave
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=3412977&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
>Status: Closed
Resolution: Accepted
Priority: 8
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Miller Puckette (millerpuckette)
Summary: replace MSW with _WIN32 (please please please)

Initial Comment:
We are starting to port Pd to another interesting platform, (Google Chrome Native Client NaCl) and yet again we'll have to wade thru the #ifdefs to figure out what we need. Especially painful are things like #ifndef MSW.  Lots of people have wasted many hours on this stuff.  This MSW macro is unnecessary since every compiler for Windows defines _WIN32 automatically.  If _WIN32 ever disappears, we can easily add -D_WIN32, which is just as easy as doing -DMSW.  Or just replace -DMSW with -D_WIN32.

Also, having the MSW as _WIN32 makes it easier to solve MinGW and Cygwin build issues where those platforms differ from MSVC++

This can be achieved with this one liner, which I've tested on Mac OS X, Ubuntu/Maverick, and Windows XP:
cd pure-data.git/src && sed -i 's|\(^\#.*if.*\) MSW|\1 _WIN32|' *.[ch]

You can see the lines that this regexp would change by running this:
cd pure-data.git/src && sed -n 's|\(^\#.*if.*\) MSW|\1 _WIN32|p' *.[ch]|less


----------------------------------------------------------------------

Comment By: IOhannes m zmölnig (zmoelnig)
Date: 2011-11-07 01:17

Message:
applied with 338fd8017bca64b5163b6dff39a1268e49d9be27

----------------------------------------------------------------------

Comment By: Hans-Christoph Steiner (eighthave)
Date: 2011-11-03 11:39

Message:
so just to highlight the key point, this change has little risk, and a big
impact in future porting activities, like porting Pd to the Chrome native
code, Windows Mobile, etc.

----------------------------------------------------------------------

Comment By: Hans-Christoph Steiner (eighthave)
Date: 2011-11-03 11:37

Message:
> I can't log onto sourceforge right now but thought I whould ask you a
quick
> question about _WIN32  - would it be a good or a bad idea to try to
sneak
> this into 0.43-1?  I could either do that now or hold off for 0.44,
depending
> on which you think would cause less wreckage.

I checked out all the changes that the sed replacement does, and did some
build tests.  I think this is really a low risk change that would be great
to have in 0.43.1,

> And by the way, would it not be adequate just to put

> #ifdef _WIN32 
> #define MSW
> #endif

> in m_pd.h?

This will only help a little, and could confuse things.  It is not very
clear what exactly MSW means.  It is some combination of _MSC_VER (MS
compilers) and _WIN32 (Win32 platform SDKs) and even some other things. 
When doing things like porting to Cygwin or other Windows things, it'll be
much easier to be able to submit fixes if _WIN32 is there.  Also, when
changing things to use specific macros like HAVE_ALLOCA_H, it'll make
things more understandable.


----------------------------------------------------------------------

Comment By: Hans-Christoph Steiner (eighthave)
Date: 2011-11-03 07:06

Message:
putting the priority back since its an easy change that can save people a
lot of work.

----------------------------------------------------------------------

Comment By: IOhannes m zmölnig (zmoelnig)
Date: 2011-11-03 02:46

Message:
i'm all for doing this

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=3412977&group_id=55736



More information about the Pd-dev mailing list