[chuck-dev] CVS commit pending... Autoconfuse almost done

Mikael Johansson mikael at johanssons.org
Thu Dec 16 17:49:42 EST 2004


Hey.

We have now adapted the CVS snapshot from cvs.cs.princeton.edu to 
succesful builds with autoconf/automake.

Before committing the changes; which include a few changes in directory 
structure and code; we'd like to announce the things that are changing 
here and showcase a patch and a tarball of the resulting structure.

Both patch and tarball will be available at
http://www.stacken.kth.se/~mik/chuck.tar.gz
http://www.stacken.kth.se/~mik/chuck.diff.gz

In addition, I'm appending the diff after the actual message and my 
signature in this email.

The most fundamental changes are:
* Moving the files out of notes/ and into the root of the repository.
   Autoconf expects to see THANKS, COPYING et.c. at the root instead of in
   some directory somewhere since the CVS structure is supposed to reflect
   the structure of the distribution tarball.
* Adding a "audio=none" driver with empty declarations; complete with all
   relevant changes to make it work.
* Putting a few of the uglier hacks within a #ifdef _WIN32 jail.
* Throwing out all previous makefile.foo and makefile; in favour of a
   Makefile.am which generates a Makefile.in which generates a Makefile
* Throwing out util_sndfile.[ch]. It's a really ugly hack that breaks most
   of the platforms we've been able to test on (including windows and
   MacOSX), and since libsndfile is available on all platforms anyway, it's
   presence is not really motivated.

We've had success building at least with Autoconf 2.13, automake 1.8.5.

In total, running the sequence
./HACKING
./configure --with-audio=foo
   foo being one of osx, alsa, oss, jack, win32
make
make install
makes exactly what you'd expect from it. This has been tested and verified 
on Linux/Gentoo, MacOSX and *BSD. Alas, we've been unable to make it build 
on MinGW, and unwilling to go through the changes that Cygwin applies; so 
we'd like for someone to try to build it and report on the problems.

We will be available for questions and tips and tricks for coding 
autoconf-friendly here on the mailinglist, or by direct email.

-- 
Mikael Johansson                 | To see the world in a grain of sand
mikael at johanssons.org            |  And heaven in a wild flower
http://www.mikael.johanssons.org | To hold infinity in the palm of your hand
                                  |  And eternity for an hour

Only in chuck_dev: AUTHORS
Only in chuck_dev: COPYING
Only in chuck_dev: ChangeLog
Only in chuck_dev: DEVELOPER
Only in chuck_dev: HACKING
Only in chuck_dev: INSTALL
Only in chuck_dev: Makefile.am
Only in chuck_dev: Makefile.in
Only in chuck_dev: NEWS
Only in chuck_dev: PROGRAMMER
Only in chuck_dev: QUICKSTART
Only in chuck_dev: README
Only in chuck_dev: THANKS
Only in chuck_dev: TODO
Only in chuck_dev: VERSIONS
Only in chuck_dev: aclocal.m4
Common subdirectories: chuck_princeton/ckx and chuck_dev/ckx
Only in chuck_dev: configure
Only in chuck_dev: configure.in
Only in chuck_dev: depcomp
Common subdirectories: chuck_princeton/doc and chuck_dev/doc
Common subdirectories: chuck_princeton/examples and chuck_dev/examples
Common subdirectories: chuck_princeton/exile and chuck_dev/exile
Only in chuck_dev: install-sh
Only in chuck_dev: missing
Only in chuck_dev: mkinstalldirs
Common subdirectories: chuck_princeton/notes and chuck_dev/notes
Common subdirectories: chuck_princeton/scripts and chuck_dev/scripts
Common subdirectories: chuck_princeton/src and chuck_dev/src
Common subdirectories: chuck_princeton/v2 and chuck_dev/v2
Only in chuck_dev/doc: Makefile.am
Only in chuck_dev/doc: Makefile.in
Only in chuck_dev/doc: chuck.1
Common subdirectories: chuck_princeton/examples/data and 
chuck_dev/examples/data
Only in chuck_princeton/notes: AUTHORS
Only in chuck_princeton/notes: COPYING
Only in chuck_princeton/notes: DEVELOPER
Only in chuck_princeton/notes: INSTALL
Only in chuck_princeton/notes: PROGRAMMER
Only in chuck_princeton/notes: QUICKSTART
Only in chuck_princeton/notes: README
Only in chuck_princeton/notes: THANKS
Only in chuck_princeton/notes: TODO
Only in chuck_princeton/notes: VERSIONS
Only in chuck_dev/src: Makefile.am
Only in chuck_dev/src: Makefile.in
diff -ur chuck_princeton/src/chuck.lex chuck_dev/src/chuck.lex
--- chuck_princeton/src/chuck.lex	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck.lex	Thu Dec 16 23:28:25 2004
@@ -50,7 +50,7 @@
  #include "chuck_errmsg.h"

  #ifndef __PLATFORM_WIN32__
-  #include "chuck.tab.h"
+  #include "y.tab.h"
  #else
    #include "chuck_win32.h"
  #endif
diff -ur chuck_princeton/src/chuck_absyn.cpp chuck_dev/src/chuck_absyn.cpp
--- chuck_princeton/src/chuck_absyn.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_absyn.cpp	Thu Dec 16 23:28:25 2004
@@ -30,6 +30,7 @@
  //         Perry R. Cook (prc at cs.princeton.edu)
  // date: Autumn 2002

//-----------------------------------------------------------------------------
+#include "config.h"
  #include <stdlib.h>
  #include <stdio.h>
  #include "chuck_absyn.h"
diff -ur chuck_princeton/src/chuck_bbq.cpp chuck_dev/src/chuck_bbq.cpp
--- chuck_princeton/src/chuck_bbq.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_bbq.cpp	Thu Dec 16 23:28:25 2004
@@ -29,6 +29,9 @@
  // author: Ge Wang (gewang at cs.princeton.edu)
  //         Perry R. Cook (prc at cs.princeton.edu)

//-----------------------------------------------------------------------------
+
+#include "config.h"
+
  #include "chuck_bbq.h"
  #include <math.h>
  #include <memory.h>
diff -ur chuck_princeton/src/chuck_bbq.h chuck_dev/src/chuck_bbq.h
--- chuck_princeton/src/chuck_bbq.h	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_bbq.h	Thu Dec 16 23:28:25 2004
@@ -49,9 +49,11 @@
    #elif defined(__WINDOWS_DS__)
      #include "digiio_win32.h"
      #include "midiio_win32.h"
+  #elif defined(__NOAUDIO__)
+    #include "midiio_none.h"
    #else
      #error "must define one:\
-    __LINUX_ALSA__ __LINUX_JACK__ __LINUX_OSS__ __MACOSX_CORE__ 
__WINDOWS_DS__"
+    __LINUX_ALSA__ __LINUX_JACK__ __LINUX_OSS__ __MACOSX_CORE__ 
__WINDOWS_DS__ __NOAUDIO__"
    #endif
  #else
    #include "digiio_rtaudio.h"
@@ -65,9 +67,11 @@
      #include "midiio_osx.h"
    #elif defined(__WINDOWS_DS__)
      #include "midiio_win32.h"
+  #elif defined(__NOAUDIO__)
+    #include "midiio_none.h"
    #else
      #error "must define one:\
-    __LINUX_ALSA__ __LINUX_JACK__ __LINUX_OSS__ __MACOSX_CORE__ 
__WINDOWS_DS__"
+    __LINUX_ALSA__ __LINUX_JACK__ __LINUX_OSS__ __MACOSX_CORE__ 
__WINDOWS_DS__ __NOAUDIO__"
    #endif
  #endif

diff -ur chuck_princeton/src/chuck_def.h chuck_dev/src/chuck_def.h
--- chuck_princeton/src/chuck_def.h	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_def.h	Thu Dec 16 23:28:25 2004
@@ -33,7 +33,7 @@
  #ifndef __CHUCK_DEF_H__
  #define __CHUCK_DEF_H__

-#include <stdlib.h>

+#include <stdlib.h>
  #include <memory.h>


@@ -40,8 +40,8 @@
  // types
  #define t_CKTIME                    double
  #define t_CKDUR                     double
-#define t_CKFLOAT                   double

-#define t_CKDOUBLE                  double

+#define t_CKFLOAT                   double
+#define t_CKDOUBLE                  double
  #define t_CKSINGLE                  float
  #define t_CKINT                     long
  #define t_CKDWORD                   unsigned long
@@ -65,17 +65,17 @@
  #ifndef SAFE_DELETE
  #define SAFE_DELETE(x)              { if(x){ delete x; x = NULL; } }
  #define SAFE_DELETE_ARRAY(x)        { if(x){ delete [] x; x = NULL; } }
-#endif

-

-#ifdef __MACOSX_CORE__

-#define __PLATFORM_MACOSX__

-#endif

-

-#if defined(__LINUX_ALSA__) || defined(__LINUX_JACK__) || 
defined(__LINUX_OSS__)
-#define __PLATFORM_LINUX__

-#endif

-

-#ifdef __PLATFORM_WIN32__

+#endif
+
+#ifdef __MACOSX_CORE__
+#define __PLATFORM_MACOSX__
+#endif
+
+#if defined(__LINUX_ALSA__) || defined(__LINUX_JACK__) || 
defined(__LINUX_OSS__) || defined(__NOAUDIO__)
+#define __PLATFORM_LINUX__
+#endif
+
+#ifdef __PLATFORM_WIN32__
  #define usleep(x) Sleep( x / 1000 )
  #pragma warning (disable : 4996)  //stdio deprecation
  #pragma warning (disable : 4312)  //type casts from void*
diff -ur chuck_princeton/src/chuck_dl.cpp chuck_dev/src/chuck_dl.cpp
--- chuck_princeton/src/chuck_dl.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_dl.cpp	Thu Dec 16 23:28:25 2004
@@ -32,6 +32,9 @@
  //
  // date: spring 2004

//-----------------------------------------------------------------------------
+
+#include "config.h"
+
  #include "chuck_dl.h"
  #ifndef __CKDL_NO_BBQ__
  #include "chuck_bbq.h"
diff -ur chuck_princeton/src/chuck_emit.cpp chuck_dev/src/chuck_emit.cpp
--- chuck_princeton/src/chuck_emit.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_emit.cpp	Thu Dec 16 23:28:25 2004
@@ -35,6 +35,8 @@
  #include <string>
  using namespace std;

+#include "config.h"
+
  #include "chuck_emit.h"
  #include "chuck_frame.h"
  #include "chuck_instr.h"
diff -ur chuck_princeton/src/chuck_errmsg.cpp 
chuck_dev/src/chuck_errmsg.cpp
--- chuck_princeton/src/chuck_errmsg.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_errmsg.cpp	Thu Dec 16 23:28:26 2004
@@ -28,6 +28,7 @@
   *
   */

+#include "config.h"
  #include <stdlib.h>
  #include <stdarg.h>
  #include <string.h>
diff -ur chuck_princeton/src/chuck_frame.cpp chuck_dev/src/chuck_frame.cpp
--- chuck_princeton/src/chuck_frame.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_frame.cpp	Thu Dec 16 23:28:26 2004
@@ -30,6 +30,7 @@
  //         Perry R. Cook (prc at cs.princeton.edu)
  // date: Autumn 2002

//-----------------------------------------------------------------------------
+#include "config.h"
  #include "chuck_frame.h"
  #include <vector>
  using namespace std;
diff -ur chuck_princeton/src/chuck_instr.cpp chuck_dev/src/chuck_instr.cpp
--- chuck_princeton/src/chuck_instr.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_instr.cpp	Thu Dec 16 23:28:26 2004
@@ -35,6 +35,8 @@
  #include <typeinfo>
  using namespace std;

+#include "config.h"
+
  #include "chuck_instr.h"
  #include "chuck_vm.h"
  #include "chuck_ugen.h"
Only in chuck_dev/src: chuck_lex.l
diff -ur chuck_princeton/src/chuck_main.cpp chuck_dev/src/chuck_main.cpp
--- chuck_princeton/src/chuck_main.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_main.cpp	Thu Dec 16 23:28:26 2004
@@ -42,6 +42,8 @@

  extern "C" int yyparse( void );

+#include "config.h"
+
  #include "chuck_type.h"
  #include "chuck_emit.h"
  #include "chuck_instr.h"
diff -ur chuck_princeton/src/chuck_otf.cpp chuck_dev/src/chuck_otf.cpp
--- chuck_princeton/src/chuck_otf.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_otf.cpp	Thu Dec 16 23:28:26 2004
@@ -31,6 +31,7 @@
  // date: Autumn 2004

//-----------------------------------------------------------------------------

+#include "config.h"
  #include "chuck_otf.h"
  #include "util_network.h"

diff -ur chuck_princeton/src/chuck_symbol.cpp 
chuck_dev/src/chuck_symbol.cpp
--- chuck_princeton/src/chuck_symbol.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_symbol.cpp	Thu Dec 16 23:28:26 2004
@@ -31,6 +31,7 @@
  //           Perry R. Cook (prc at cs.princeton.edu)
  // date: Autumn 2002

//-----------------------------------------------------------------------------
+#include "config.h"
  #include <stdio.h>
  #include <string.h>
  #include "chuck_utils.h"
diff -ur chuck_princeton/src/chuck_table.cpp chuck_dev/src/chuck_table.cpp
--- chuck_princeton/src/chuck_table.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_table.cpp	Thu Dec 16 23:28:26 2004
@@ -33,6 +33,7 @@
  //           Perry R. Cook (prc at cs.princeton.edu)
  // date: Autumn 2002

//-----------------------------------------------------------------------------
+#include "config.h"
  #include <stdio.h>
  #include <string.h>
  #include "chuck_table.h"
diff -ur chuck_princeton/src/chuck_temp.cpp chuck_dev/src/chuck_temp.cpp
--- chuck_princeton/src/chuck_temp.cpp	Thu Dec 16 23:28:09 2004
+++ chuck_dev/src/chuck_temp.cpp	Thu Dec 16 23:28:26 2004
@@ -33,6 +33,7 @@
  //           Perry R. Cook (prc at cs.princeton.edu)
  // date: Autumn 2002

//-----------------------------------------------------------------------------
+#include "config.h"
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
diff -ur chuck_princeton/src/chuck_type.cpp chuck_dev/src/chuck_type.cpp
--- chuck_princeton/src/chuck_type.cpp	Thu Dec 16 23:28:10 2004
+++ chuck_dev/src/chuck_type.cpp	Thu Dec 16 23:28:26 2004
@@ -30,6 +30,7 @@
  //         Perry R. Cook (prc at cs.princeton.edu)
  // date: Autumn 2002

//-----------------------------------------------------------------------------
+#include "config.h"
  #include <stdlib.h>
  #include <string>
  #include <vector>
diff -ur chuck_princeton/src/chuck_ugen.cpp chuck_dev/src/chuck_ugen.cpp
--- chuck_princeton/src/chuck_ugen.cpp	Thu Dec 16 23:28:10 2004
+++ chuck_dev/src/chuck_ugen.cpp	Thu Dec 16 23:28:26 2004
@@ -30,6 +30,7 @@
  //          Perry R. Cook (prc at cs.princeton.edu)
  // date: Spring 2004

//-----------------------------------------------------------------------------
+#include "config.h"
  #include "chuck_ugen.h"
  #include "chuck_vm.h"
  using namespace std;
diff -ur chuc04
+++ chuck_dev/src/ugen_filter.cpp	Thu Dec 16 23:28:26 2004
@@ -30,6 +30,7 @@
  //         Perry R. Cook (prc at cs.princeton.edu)
  // date: Spring 2004

//-----------------------------------------------------------------------------
+#include "config.h"
  #include "ugen_filter.h"
  #include <math.h>
  #include <stdlib.h>
diff -ur chuck_princeton/src/ugen_osc.cpp chuck_dev/src/ugen_osc.cpp
--- chuck_princeton/src/ugen_osc.cpp	Thu Dec 16 23:28:10 2004
+++ chuck_dev/src/ugen_osc.cpp	Thu Dec 16 23:28:26 2004
@@ -31,6 +31,7 @@
  //         Philip L. Davidson (philipd at alumni.princeton.edu)
  // date: Summer 2004

//-----------------------------------------------------------------------------
+#include "config.h"
  #include "ugen_osc.h"
  #include <math.h>
  #include <stdio.h>
diff -ur chuck_princeton/src/ugen_stk.cpp chuck_dev/src/ugen_stk.cpp
--- chuck_princeton/src/ugen_stk.cpp	Thu Dec 16 23:28:10 2004
+++ chuck_dev/src/ugen_stk.cpp	Thu Dec 16 23:28:26 2004
@@ -30,6 +30,7 @@
  //         Perry R. Cook (prc at cs.princeton.edu)
  // date: Spring 2004

//-----------------------------------------------------------------------------
+#include "config.h"
  #include "ugen_stk.h"
  #include <stdlib.h>
  #include <string.h>
@@ -156,13 +157,13 @@
    static void setRawwavePath(std::string newPath);

    //! Static method which byte-swaps a 16-bit data type.
-  static void swap16(unsigned char *ptr);
+  static void Swap16(unsigned char *ptr);

    //! Static method which byte-swaps a 32-bit data type.
-  static void swap32(unsigned char *ptr);
+  static void Swap32(unsigned char *ptr);

    //! Static method which byte-swaps a 64-bit data type.
-  static void swap64(unsigned char *ptr);
+  static void Swap64(unsigned char *ptr);

    //! Static cross-platform method to sleep for a number of milliseconds.
    static void sleep(unsigned long milliseconds);
@@ -15995,7 +15996,7 @@
      rawwavepath += "/";
  }

-void Stk :: swap16(unsigned char *ptr)
+void Stk :: Swap16(unsigned char *ptr)
  {
    register unsigned char val;

@@ -16005,7 +16006,7 @@
    *(ptr+1) = val;
  }

-void Stk :: swap32(unsigned char *ptr)
+void Stk :: Swap32(unsigned char *ptr)
  {
    register unsigned char val;

@@ -16021,7 +16022,7 @@
    *(ptr+1) = val;
  }

-void Stk :: swap64(unsigned char *ptr)
+void Stk :: Swap64(unsigned char *ptr)
  {
    register unsigned char val;

@@ -16184,7 +16185,7 @@
    double temp;
    while ( fread(&temp, 8, 1, fd) ) {
  if( little_endian )
-    swap64((unsigned char *)&temp);
+    Swap64((unsigned char *)&temp);

      data[i++] = (MY_FLOAT) temp;
    }
@@ -17977,7 +17978,7 @@
    while ( strncmp(id, "fmt ", 4) ) {
      if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error;
  if( !little_endian )
-    swap32((unsigned char *)&chunkSize);
+    Swap32((unsigned char *)&chunkSize);

      if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error;
      if ( fread(&id, 4, 1, fd) != 1 ) goto error;
@@ -17989,8 +17990,8 @@
    if ( fread(&format_tag, 2, 1, fd) != 1 ) goto error;
  if( !little_endian )
  {
-  swap16((unsigned char *)&format_tag);
-  swap32((unsigned char *)&chunkSize);
+  Swap16((unsigned char *)&format_tag);
+  Swap32((unsigned char *)&chunkSize);
  }
    if (format_tag != 1 && format_tag != 3 ) { // PCM = 1, FLOAT = 3
      sprintf(msg, "[chuck](via WvIn): %s contains an unsupported data 
format type (%d).", fileName, format_tag);
@@ -18001,7 +18002,7 @@
    SINT16 temp;
    if ( fread(&temp, 2, 1, fd) != 1 ) goto error;
  if( !little_endian )
-  swap16((unsigned char *)&temp);
+  Swap16((unsigned char *)&temp);

    channels = (unsigned int ) temp;

@@ -18009,7 +18010,7 @@
    SINT32 srate;
    if ( fread(&srate, 4, 1, fd) != 1 ) goto error;
  if( !little_endian )
-  swap32((unsigned char *)&srate);
+  Swap32((unsigned char *)&srate);

    fileRate = (MY_FLOAT) srate;

@@ -18021,7 +18022,7 @@
    if ( fseek(fd, 6, SEEK_CUR) == -1 ) goto error;   // Locate 
bits_per_sample info.
    if ( fread(&temp, 2, 1, fd) != 1 ) goto error;
  if( !little_endian )
-  swap16((unsigned char *)&temp);
+  Swap16((unsigned char *)&temp);

    if ( format_tag == 1 ) {
      if (temp == 8)
@@ -18051,7 +18052,7 @@
    while ( strncmp(id, "data", 4) ) {
      if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error;
  if( !little_endian )
-    swap32((unsigned char *)&chunkSize);
+    Swap32((unsigned char *)&chunkSize);

      if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error;
      if ( fread(&id, 4, 1, fd) != 1 ) goto error;
@@ -18061,7 +18062,7 @@
    SINT32 bytes;
    if ( fread(&bytes, 4, 1, fd) != 1 ) goto error;
  if( !little_endian )
-  swap32((unsigned char *)&bytes);
+  Swap32((unsigned char *)&bytes);

    fileSize = 8 * bytes / temp / channels;  // sample frames
    bufferSize = fileSize;
@@ -18089,7 +18090,7 @@
    if ( fseek(fd, 12, SEEK_SET) == -1 ) goto error;   // Locate format
    if ( fread(&format, 4, 1, fd) != 1 ) goto error;
  if( little_endian )
-    swap32((unsigned char *)&format);
+    Swap32((unsigned char *)&format);

    if (format == 2) dataType = STK_SINT8;
    else if (format == 3) dataType = STK_SINT16;
@@ -18105,7 +18106,7 @@
    SINT32 srate;
    if ( fread(&srate, 4, 1, fd) != 1 ) goto error;
  if( little_endian )
-  swap32((unsigned char *)&srate);
+  Swap32((unsigned char *)&srate);

    fileRate = (MY_FLOAT) srate;

@@ -18116,7 +18117,7 @@
    SINT32 chans;
    if ( fread(&chans, 4, 1, fd) != 1 ) goto error;
  if( little_endian )
-  swap32((unsigned char *)&chans);
+  Swap32((unsigned char *)&chans);

    channels = chans;

@@ -18123,12 +18124,12 @@
    if ( fseek(fd, 4, SEEK_SET) == -1 ) goto error;
    if ( fread(&dataOffset, 4, 1, fd) != 1 ) goto error;
  if( little_endian )
-  swap32((unsigned char *)&dataOffset);
+  Swap32((unsigned char *)&dataOffset);

    // Get length of data from the header.
    if ( fread(&fileSize, 4, 1, fd) != 1 ) goto error;
  if( little_endian )
-  swap32((unsigned char *)&fileSize);
+  Swap32((unsigned char *)&fileSize);

    fileSize /= 2 * channels;  // Convert to sample frames.
    bufferSize = fileSize;
@@ -18164,7 +18165,7 @@
    while ( strncmp(id, "COMM", 4) ) {
      if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error;
  if( little_endian )
-    swap32((unsigned char *)&chunkSize);
+    Swap32((unsigned char *)&chunkSize);

      if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error;
      if ( fread(&id, 4, 1, fd) != 1 ) goto error;
@@ -18175,7 +18176,7 @@
    if ( fseek(fd, 4, SEEK_CUR) == -1 ) goto error; // Jump over chunk size
    if ( fread(&temp, 2, 1, fd) != 1 ) goto error;
  if( little_endian )
-  swap16((unsigned char *)&temp);
+  Swap16((unsigned char *)&temp);

    channels = temp;

@@ -18183,7 +18184,7 @@
    SINT32 frames;
    if ( fread(&frames, 4, 1, fd) != 1 ) goto error;
  if( little_endian )
-  swap32((unsigned char *)&frames);
+  Swap32((unsigned char *)&frames);

    fileSize = frames; // sample frames
    bufferSize = fileSize;
@@ -18195,7 +18196,7 @@
    // Read the number of bits per sample.
    if ( fread(&temp, 2, 1, fd) != 1 ) goto error;
  if( little_endian )
-  swap16((unsigned char *)&temp);
+  Swap16((unsigned char *)&temp);

    // Get file sample rate from the header.  For AIFF files, this value
    // is stored in a 10-byte, IEEE Standard 754 floating point number,
@@ -18207,7 +18208,7 @@
    if ( fread(&srate, 10, 1, fd) != 1 ) goto error;
    mantissa = (unsigned long) *(unsigned long *)(srate+2);
  if( little_endian )
-  swap32((unsigned char *)&mantissa);
+  Swap32((unsigned char *)&mantissa);

    exp = 30 - *(srate+1);
    last = 0;
@@ -18246,7 +18247,7 @@
    while ( strncmp(id, "SSND", 4) ) {
      if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error;
  if( little_endian )
-    swap32((unsigned char *)&chunkSize);
+    Swap32((unsigned char *)&chunkSize);

      if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error;
      if ( fread(&id, 4, 1, fd) != 1 ) goto error;
@@ -18303,7 +18304,7 @@
    // Check the data element type
    SINT32 datatype;
    if ( fread(&datatype, 4, 1, fd) != 1 ) goto error;
-  if ( byteswap ) swap32((unsigned char *)&datatype);
+  if ( byteswap ) Swap32((unsigned char *)&datatype);
    if (datatype != 14) {
      sprintf(msg, "[chuck](via WvIn): The file does not contain a single 
Matlab array (or matrix) data element.");
      return false;
@@ -18314,10 +18315,10 @@
    SINT32 size;
    if ( fseek(fd, 168, SEEK_SET) == -1 ) goto error;
    if ( fread(&tmp, 4, 1, fd) != 1 ) goto error;
-  if (byteswap) swap32((unsigned char *)&tmp);
+  if (byteswap) Swap32((unsigned char *)&tmp);
    if (tmp == 1) {  // array name > 4 characters
      if ( fread(&tmp, 4, 1, fd) != 1 ) goto error;  // get array name 
length
-    if (byteswap) swap32((unsigned char *)&tmp);
+    if (byteswap) Swap32((unsigned char *)&tmp);
      size = (SINT32) ceil((float)tmp / 8);
      if ( fseek(fd, size*8, SEEK_CUR) == -1 ) goto error;  // jump over 
array name
    }
@@ -18325,7 +18326,7 @@
      if ( fseek(fd, 4, SEEK_CUR) == -1 ) goto error;
    }
    if ( fread(&tmp, 4, 1, fd) != 1 ) goto error;
-  if (byteswap) swap32((unsigned char *)&tmp);
+  if (byteswap) Swap32((unsigned char *)&tmp);
    if ( tmp == 1 ) dataType = STK_SINT8;
    else if ( tmp == 3 ) dataType = STK_SINT16;
    else if ( tmp == 5 ) dataType = STK_SINT32;
@@ -18340,12 +18341,12 @@
    SINT32 rows;
    if ( fseek(fd, 160, SEEK_SET) == -1 ) goto error;
    if ( fread(&rows, 4, 1, fd) != 1 ) goto error;
-  if (byteswap) swap32((unsigned char *)&rows);
+  if (byteswap) Swap32((unsigned char *)&rows);

    // Get number of columns from the header.
    SINT32 columns;
    if ( fread(&columns,4, 1, fd) != 1 ) goto error;
-  if (byteswap) swap32((unsigned char *)&columns);
+  if (byteswap) Swap32((unsigned char *)&columns);

    // Assume channels = smaller of rows or columns.
    if (rows < columns) {
@@ -18366,7 +18367,7 @@
    SINT32 headsize;
    if ( fseek(fd, 132, SEEK_SET) == -1 ) goto error;
    if ( fread(&headsize, 4, 1, fhar *)(ptr++));
      }
      for (i=length*channels-1; i>=0; i--)
        data[i] = buf[i];
@@ -18457,7 +18458,7 @@
      if ( byteswap ) {
        FLOAT64 *ptr = buf;
        for (i=length*channels-1; i>=0; i--)
-        swap64((unsigned char *)(ptr++));
+        Swap64((unsigned char *)(ptr++));
      }
      for (i=length*channels-1; i>=0; i--)
        data[i] = buf[i];
@@ -18946,14 +18947,14 @@
  if( !little_endian )
  {
    byteswap = true;
-  swap32((unsigned char *)&hdr.file_size);
-  swap32((unsigned char *)&hdr.chunk_size);
-  swap16((unsigned char *)&hdr.format_tag);
-  swap16((unsigned char *)&hdr.num_chans);
-  swap32((unsigned char *)&hdr.sample_rate);
-  swap32((unsigned char *)&hdr.bytes_per_sec);
-  swap16((unsigned char *)&hdr.bytes_per_samp);
-  swap16((unsigned char *)&hdr.bits_per_samp);
+  Swap32((unsigned char *)&hdr.file_size);
+  Swap32((unsigned char *)&hdr.chunk_size);
+  Swap16((unsigned char *)&hdr.format_tag);
+  Swap16((unsigned char *)&hdr.num_chans);
+  Swap32((unsigned char *)&hdr.sample_rate);
+  Swap32((unsigned char *)&hdr.bytes_per_sec);
+  Swap16((unsigned char *)&hdr.bytes_per_samp);
+  Swap16((unsigned char *)&hdr.bits_per_samp);
  }

    if ( fwrite(&hdr, 4, 11, fd) != 11 ) {
@@ -18977,7 +18978,7 @@

    SINT32 bytes = totalCount * channels * bytes_per_sample;
  if( !little_endian )
-  swap32((unsigned char *)&bytes);
+  Swap32((unsigned char *)&bytes);

    fseek(fd, 40, SEEK_SET); // jump to data length
    fwrite(&bytes, 4, 1, fd);
@@ -18984,7 +18985,7 @@

    bytes = totalCount * channels * bytes_per_sample + 44;
  if( !little_endian )
-  swap32((unsigned char *)&bytes);
+  Swap32((unsigned char *)&bytes);

    fseek(fd, 4, SEEK_SET); // jump to file size
    fwrite(&bytes, 4, 1, fd);
@@ -19020,10 +19021,10 @@
  if( little_endian )
  {
    byteswap = true;
-  swap32 ((unsigned char *)&hdr.hdr_length);
-  swap32 ((unsigned char *)&hdr.format);
-  swap32 ((unsigned char *)&hdr.sample_rate);
-  swap32 ((unsigned char *)&hdr.num_channels);
+  Swap32 ((unsigned char *)&hdr.hdr_length);
+  Swap32 ((unsigned char *)&hdr.format);
+  Swap32 ((unsigned char *)&hdr.sample_rate);
+  Swap32 ((unsigned char *)&hdr.num_channels);
  }

    if ( fwrite(&hdr, 4, 10, fd) != 10 ) {
@@ -19049,7 +19050,7 @@

    SINT32 bytes = totalCount * bytes_per_sample * channels;
  if( little_endian )
-  swap32 ((unsigned char *)&bytes);
+  Swap32 ((unsigned char *)&bytes);

    fseek(fd, 8, SEEK_SET); // jump to data size
    fwrite(&bytes, 4, 1, fd);
@@ -19106,7 +19107,7 @@
    }
    i += 16383;
  if( little_endian )
-  swap16((unsigned char *)&i);
+  Swap16((unsigned char *)&i);

    *(SINT16 *)(hdr.srate) = (SINT16) i;

@@ -19116,7 +19117,7 @@
    }

  if( little_endian )
-  swap32((unsigned char *)&rate);
+  Swap32((unsigned char *)&rate);

    *(unsigned long *)(hdr.srate+2) = (unsigned long) rate;

@@ -19124,13 +19125,13 @@
  if( little_endian )
  {
    byteswap = true;
-  swap32((unsigned char *)&hdr.form_size);
-  swap32((unsigned char *)&hdr.comm_size);
-  swap16((unsigned char *)&hdr.num_chans);
-  swap16((unsigned char *)&hdr.sample_size);
-  swap32((unsigned char *)&ssnd.ssnd_size);
-  swap32((unsigned char *)&ssnd.offset);
-  swap32((unsigned char *)&ssnd.block_size);
+  Swap32((unsigned char *)&hdr.form_size);
+  Swap32((unsigned char *)&hdr.comm_size);
+  Swap16((unsigned char *)&hdr.num_chans);
+  Swap16((unsigned char *)&hdr.sample_size);
+  Swap32((unsigned char *)&ssnd.ssnd_size);
+  Swap32((unsigned char *)&ssnd.offset);
+  Swap32((unsigned char *)&ssnd.block_size);
  }

    // The structure boundaries don't allow a single write of 54 bytes.
@@ -19167,7 +19168,7 @@
  {
    unsigned long frames = (unsigned long) totalCount;
  if( little_endian )
-  swap32((unsigned char *)&frames);
+  Swap32((unsigned char *)&frames);

    fseek(fd, 22, SEEK_SET); // jump to "COMM" sample_frames
    fwrite(&frames, 4, 1, fd);
@@ -19183,7 +19184,7 @@
    unsigned long bytes = totalCount * bytes_per_sample * channels + 46;
    if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) bytes += 6;
  if( little_endian )
-  swap32((unsigned char *)&bytes);
+  Swap32((unsigned char *)&bytes);

    fseek(fd, 4, SEEK_SET); // jump to file size
    fwrite(&bytes, 4, 1, fd);
@@ -19191,7 +19192,7 @@
    bytes = totalCount * bytes_per_sample * channels + 8;
    if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) bytes += 6;
  if( little_endian )
-  swap32((unsigned char *)&bytes);
+  Swap32((unsigned char *)&bytes);

    if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 )
      fseek(fd, 48, SEEK_SET); // jump to "SSND" chunk size
@@ -19361,7 +19362,7 @@
      for ( unsigned long k=0; k<frames*channels; k++ ) {
        sample = (SINT16) (data[k] * 32767.0);
        //sample = ((SINT16) (( data[k] + 1.0 ) * 32767.5 + 0.5)) - 32768;
-      if ( byteswap ) swap16( (unsigned char *)&sample );
+      if ( byteswap ) Swap16( (unsigned char *)&sample );
        if ( fwrite(&sample, 2, 1, fd) != 1 ) goto error;
      }
    }
@@ -19370,7 +19371,7 @@
      for ( unsigned long k=0; k<frames*channels; k++ ) {
        sample = (SINT32) (data[k] * 2147483647.0);
        //sample = ((SINT32) (( data[k] + 1.0 ) * 2147483647.5 + 0.5)) - 
2147483648;
-      if ( byteswap ) swap32( (unsigned char *)&sample );
+      if ( byteswap ) Swap32( (unsigned char *)&sample );
        if ( fwrite(&sample, 4, 1, fd) != 1 ) goto error;
      }
    }
@@ -19378,7 +19379,7 @@
      FLOAT32 sample;
      for ( unsigned long k=0; k<frames*channels; k++ ) {
        sample = (FLOAT32) (data[k]);
-      if ( byteswap ) swap32( (unsigned char *)&sample );
+      if ( byteswap ) Swap32( (unsigned char *)&sample );
        if ( fwrite(&sample, 4, 1, fd) != 1 ) goto error;
      }
    }
@@ -19386,7 +19387,7 @@
      FLOAT64 sample;
      for ( unsigned long k=0; k<frames*channels; k++ ) {
        sample = (FLOAT64) (data[k]);
-      if ( byteswap ) swap64( (unsigned char *)&sample );
+      if ( byteswap ) Swap64( (unsigned char *)&sample );
        if ( fwrite(&sample, 8, 1, fd) != 1 ) goto error;
      }
    }

diff -ur chuck_princeton/src/ugen_xxx.cpp chuck_dev/src/ugen_xxx.cpp
--- chuck_princeton/src/ugen_xxx.cpp	Thu Dec 16 23:28:10 2004
+++ chuck_dev/src/ugen_xxx.cpp	Thu Dec 16 23:28:27 2004
@@ -30,6 +30,9 @@
  //         Perry R. Cook (prc at cs.princeton.edu)
  // date: Spring 2004

//-----------------------------------------------------------------------------
+
+#include "config.h"
+
  #include "ugen_xxx.h"
  #include <math.h>
  #include <stdio.h>
@@ -1203,11 +1206,7 @@
  }


-#if defined(__CK_SNDFILE_NATIVE__)
  #include <sndfile.h>
-#else
-#include "util_sndfile.h"
-#endif

  #include "util_raw.h"

diff -ur chuck_princeton/src/ulib_machine.cpp 
chuck_dev/src/ulib_machine.cpp
--- chuck_princeton/src/ulib_machine.cpp	Thu Dec 16 23:28:10 2004
+++ chuck_dev/src/ulib_machine.cpp	Thu Dec 16 23:28:27 2004
@@ -30,6 +30,7 @@
  //         Perry R. Cook (prc at cs.princeton.edu)
  // date: Spring 2004

//-----------------------------------------------------------------------------
+#include "config.h"
  #include "ulib_machine.h"
  #include "chuck_vm.h"

diff -ur chuck_princeton/src/ulib_math.cpp chuck_dev/src/ulib_math.cpp
--- chuck_princeton/src/ulib_math.cpp	Thu Dec 16 23:28:11 2004
+++ chuck_dev/src/ulib_math.cpp	Thu Dec 16 23:28:27 2004
@@ -30,10 +30,10 @@
  //         Perry R. Cook (prc at cs.princeton.edu)
  // date: Spring 2004

//-----------------------------------------------------------------------------
+#include "config.h"
  #include "ulib_math.h"
  #include "util_math.h"

-
  static double g_pi = 3.14159265358979323846;
  static double g_twopi = 2.0 * 3.14159265358979323846;
  static double g_e = ::exp( 1.0 );
@@ -294,6 +294,22 @@
      RETURN->v_float = ::ceil( GET_CK_FLOAT(ARGS) );
  }

+#ifndef HAVE_ROUND
+double round( double a )
+{
+    double off = a - (long)a;
+    if( off > .5 ) return (double)(long)a + 1.0;
+    return (double)(long)a;
+}
+#endif
+
+#ifndef HAVE_TRUNC
+double trunc( double a )
+{
+    return (double)(long)a;
+}
+#endif
+
  // round
  CK_DLL_FUNC( round_impl )
  {
diff -ur chuck_princeton/src/ulib_net.cpp chuck_dev/src/ulib_net.cpp
--- chuck_princeton/src/ulib_net.cpp	Thu Dec 16 23:28:11 2004
+++ chuck_dev/src/ulib_net.cpp	Thu Dec 16 23:28:27 2004
@@ -30,6 +30,7 @@
  //         Perry R. Cook (prc at cs.princeton.edu)
  // date: Spring 2004

//-----------------------------------------------------------------------------
+#include "config.h"
  #include <iostream>
  #include "ulib_net.h"
  #include "util_network.h"
diff -ur chuck_princeton/src/ulib_std.cpp chuck_dev/src/ulib_std.cpp
--- chuck_princeton/src/ulib_std.cpp	Thu Dec 16 23:28:10 2004
+++ chuck_dev/src/ulib_std.cpp	Thu Dec 16 23:28:27 2004
@@ -30,6 +30,7 @@
  //         Perry R. Cook (prc at cs.princeton.edu)
  // date: Spring 2004

//-----------------------------------------------------------------------------
+#include "config.h"
  #include "ulib_std.h"
  #include <stdlib.h>
  #include <time.h>
diff -ur chuck_princeton/src/util_buffers.cpp 
chuck_dev/src/util_buffers.cpp
--- chuck_princeton/src/util_buffers.cpp	Thu Dec 16 23:28:11 2004
+++ chuck_dev/src/util_buffers.cpp	Thu Dec 16 23:28:27 2004
@@ -29,6 +29,7 @@
  // author: Ge Wang (gewang at cs.princeton.edu)
  //         Perry R. Cook (prc at cs.princeton.edu)

//-----------------------------------------------------------------------------
+#include "config.h"
  #include "util_buffers.h"
  #include <stdlib.h>

Only in chuck_princeton/src: util_sndfile.c
Only in chuck_princeton/src: util_sndfile.h
diff -ur chuck_princeton/src/util_thread.cpp chuck_dev/src/util_thread.cpp
--- chuck_princeton/src/util_thread.cpp	Thu Dec 16 23:28:11 2004
+++ chuck_dev/src/util_thread.cpp	Thu Dec 16 23:28:27 2004
@@ -32,6 +32,9 @@
  //          Perry R. Cook + Gary Scavone
  // date: autumn 2004

//-----------------------------------------------------------------------------
+
+#include "config.h"
+
  #include "util_thread.h"


diff -ur chuck_princeton/v2/chuck_win32.c chuck_dev/v2/chuck_win32.c
--- chuck_princeton/v2/chuck_win32.c	Thu Dec 16 23:28:12 2004
+++ chuck_dev/v2/chuck_win32.c	Thu Dec 16 23:28:29 2004
@@ -2439,7 +2439,7 @@
  /* A lexical scanner generated by flex */

  /* Scanner skeleton version:
- * $Header: /cvs/chuck_dev/v2/chuck_win32.c,v 1.1 2004/09/19 22:28:47 
gw-chuck Exp $
+ * $Header: 
/afs/stacken.kth.se/home/hin/chuck-repo//chuck_dev/v2/chuck_win32.c,v 
1.1.1.1 2004/12/09 23:10:38 mik Exp $
   */

  #define FLEX_SCANNER



More information about the chuck-dev mailing list