[SCM] csound/upstream: Imported Upstream version 5.16.6~dfsg

fsateler at users.alioth.debian.org fsateler at users.alioth.debian.org
Sun Mar 11 04:28:31 UTC 2012


The following commit has been merged in the upstream branch:
commit f17fe825f928654486d6ece0c42780eb4251747e
Author: Felipe Sateler <fsateler at debian.org>
Date:   Thu Mar 1 20:49:18 2012 -0300

    Imported Upstream version 5.16.6~dfsg

diff --git a/Before_release b/Before_release
deleted file mode 100644
index 2c804af..0000000
--- a/Before_release
+++ /dev/null
@@ -1,9 +0,0 @@
-To Do
-    Decide on ATS problems
-
-For Future
-    ogg encoding (libsndfile)
-    Finish adding Gabriel's opcodes
-
-Unknown
-    Lock up (StevenYi: Sat, 5 May 2007 18:41:11 -0400)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d928977..4837a61 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,8 @@ endif()
 set(PYTHON_MODULE_INSTALL_DIR ${LIBRARY_INSTALL_DIR})
 set(JAVA_MODULE_INSTALL_DIR ${LIBRARY_INSTALL_DIR})
 set(LUA_MODULE_INSTALL_DIR ${LIBRARY_INSTALL_DIR})
+set(LOCALE_INSTALL_DIR "share/locale")
+set(HEADER_INSTALL_DIR "include/csound")
 
 # Include this after the install path definitions so we can override them here.
 find_file(CUSTOM_CMAKE "Custom.cmake" HINTS ${CMAKE_HOME_DIRECTORY})
@@ -29,6 +31,7 @@ endif()
 include(TestBigEndian)
 include(CheckFunctionExists)
 include(CheckIncludeFile)
+include(CheckIncludeFileCXX)
 
 # Utility function to make plugins. All plugin targets should use this as it
 # sets up output directory set in top-level CmakeLists.txt
@@ -140,6 +143,7 @@ function(check_deps option)
     endif()
 endfunction(check_deps)
 
+
 if(WIN32 AND NOT MSVC)
     if(EXISTS "C:/MinGW/include")
         include_directories(C:/MinGW/include)
@@ -208,7 +212,11 @@ option(BUILD_MULTI_CORE "Enable building for multicore system (requires BUILD_NE
 
 option(FAIL_MISSING "Fail when a required external dependency is not present (useful for packagers)" OFF)
 
+option(USE_GETTEXT "Use the Gettext internationalization library" ON)
+
+option(BUILD_STATIC_LIBRARY "Also build a static version of the csound library" OFF)
 
+option(USE_OPEN_MP "Use OpenMP for Parallel Performance" ON)
 # Optional targets, they should all default to ON (check_deps will disable them if not possible to build)
 
 
@@ -220,6 +228,7 @@ if(USE_DOUBLE)
 endif(USE_DOUBLE)
 if(${CMAKE_C_COMPILER} MATCHES "gcc" AND LINUX)
     add_definitions("-fvisibility=hidden")
+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fvisibility=hidden")
 endif()
 
 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) 
@@ -250,6 +259,8 @@ SET(BUILD_SHARED_LIBS ON)
 
 ## HEADER/LIBRARY/OTHER CHECKS ##
 
+find_package(OpenMP)
+
 # First, required stuff
 find_library(LIBSNDFILE_LIBRARY sndfile)
 if(NOT LIBSNDFILE_LIBRARY)
@@ -279,8 +290,9 @@ set(CMAKE_REQUIRED_LIBRARIES pthread)
 # Now, non required library searches #
 
 find_library(VORBISFILE_LIBRARY vorbisfile)
-check_include_file(libintl.h USE_GETTEXT)
+check_include_file(libintl.h LIBINTL_HEADER)
 find_library(LIBINTL_LIBRARY intl)
+find_package(Gettext)
 
 set(HEADERS_TO_CHECK
     unistd.h io.h fcntl.h stdint.h
@@ -324,6 +336,13 @@ if(PTHREAD_BARRIER_INIT_EXISTS)
 endif()
 
 
+check_deps(USE_OPEN_MP OPENMP_FOUND PTHREAD_BARRIER_INIT_EXISTS) 
+if(USE_OPEN_MP)
+   list(APPEND libcsound_CFLAGS -DUSE_OPENMP)
+   list(APPEND CMAKE_C_FLAGS ${OpenMP_C_FLAGS})
+   list(APPEND CMAKE_CXX_FLAGS ${OpenMP_CXX_FLAGS})
+endif()
+
 
 #if(WIN32)
     include_directories(${LIBSNDFILE_INCLUDE_DIRECTORY})
@@ -389,6 +408,7 @@ set(libcsound_SRCS
     OOps/str_ops.c
     OOps/ugens1.c
     OOps/ugens2.c
+    OOps/ugens2a.c
     OOps/ugens3.c
     OOps/ugens4.c
     OOps/ugens5.c
@@ -449,6 +469,8 @@ set(libcsound_SRCS
     Opcodes/hrtfearly.c
     Opcodes/hrtfreverb.c
     Opcodes/cpumeter.c
+    Opcodes/gendy.c
+    Opcodes/tl/sc_noise.c
     Top/argdecode.c
     Top/cscore_internal.c
     Top/cscorfns.c
@@ -529,7 +551,18 @@ set(oldpvoc_SRCS
     Opcodes/vpvoc.c 
     Opcodes/pvoc.c)
 
-list(APPEND libcsound_SRCS ${stdopcod_SRCS} ${cs_pvs_ops_SRCS} ${oldpvoc_SRCS})
+set(mp3in_SRCS
+    Opcodes/mp3in.c
+    InOut/libmpadec/layer1.c
+    InOut/libmpadec/layer2.c
+    InOut/libmpadec/layer3.c
+    InOut/libmpadec/synth.c
+    InOut/libmpadec/tables.c
+    InOut/libmpadec/mpadec.c
+    InOut/libmpadec/mp3dec.c)
+
+
+list(APPEND libcsound_SRCS ${stdopcod_SRCS} ${cs_pvs_ops_SRCS} ${oldpvoc_SRCS} ${mp3in_SRCS})
 
 # Handling New Parser
 
@@ -543,13 +576,22 @@ if(BUILD_NEW_PARSER)
     set(LEX_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Engine/csound_orc.l)
     set(LEX_OUT ${CMAKE_CURRENT_BINARY_DIR}/csound_orclex.c)
 
+    set(PRELEX_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Engine/csound_pre.lex)
+    set(PRELEX_OUT ${CMAKE_CURRENT_BINARY_DIR}/csound_prelex.c)
+
     add_custom_command(
         SOURCE ${LEX_SRC}
-        COMMAND ${FLEX_EXECUTABLE} ARGS -Pcsound_orc -o${LEX_OUT} ${LEX_SRC}
+        COMMAND ${FLEX_EXECUTABLE} ARGS -B -t ${LEX_SRC} > ${LEX_OUT} 
         TARGET NewParser
         OUTPUTS ${LEX_OUT})
 
     add_custom_command(
+        SOURCE ${PRELEX_SRC}
+        COMMAND ${FLEX_EXECUTABLE} ARGS -B ${PRELEX_SRC} > ${PRELEX_OUT} 
+        TARGET NewParser
+        OUTPUTS ${PRELEX_OUT})
+
+    add_custom_command(
         SOURCE ${YACC_SRC}
         COMMAND ${BISON_EXECUTABLE}
         ARGS -pcsound_orc -d --report=itemset -o ${YACC_OUT} ${YACC_SRC} 
@@ -558,7 +600,7 @@ if(BUILD_NEW_PARSER)
         OUTPUTS ${YACC_OUT})
     
     list(APPEND libcsound_SRCS 
-                ${LEX_OUT} ${YACC_OUT}
+                ${LEX_OUT} ${YACC_OUT} ${PRELEX_OUT}
                 Engine/csound_orc_semantics.c
                 Engine/csound_orc_expressions.c
                 Engine/csound_orc_optimize.c
@@ -605,6 +647,7 @@ endif()
 
 set(CSOUNDLIB_STATIC "${CSOUNDLIB}-static")
 
+
 add_library(${CSOUNDLIB} SHARED ${libcsound_SRCS})
 set_target_properties(${CSOUNDLIB} PROPERTIES
     # Do not pull extra libs when linking against shared libcsound
@@ -626,7 +669,9 @@ if(WIN32)
 endif()
 
 # Linux does not have a separate libintl, it is part of libc
-if(USE_GETTEXT AND (LIBINTL_LIBRARY OR LINUX))
+set(LIBINTL_AVAIL (LIBINTL_LIBRARY OR LINUX))
+check_deps(USE_GETTEXT LIBINTL_HEADER LIBINTL_AVAIL GETTEXT_MSGFMT_EXECUTABLE)
+if(USE_GETTEXT)
     message(STATUS "Using GNU Gettext")
     if(NOT LINUX)
         list(APPEND libcsound_LIBS ${LIBINTL_LIBRARY})
@@ -703,25 +748,26 @@ set_target_properties(${CSOUNDLIB} PROPERTIES
     LIBRARY_OUTPUT_DIRECTORY ${BUILD_LIB_DIR}
     ARCHIVE_OUTPUT_DIRECTORY ${BUILD_LIB_DIR})
 
-
-add_library(${CSOUNDLIB_STATIC} STATIC ${libcsound_SRCS})
-SET_TARGET_PROPERTIES(${CSOUNDLIB_STATIC} PROPERTIES OUTPUT_NAME ${CSOUNDLIB})
-SET_TARGET_PROPERTIES(${CSOUNDLIB_STATIC} PROPERTIES PREFIX "lib")
-set_property(
-    TARGET ${CSOUNDLIB_STATIC}
-    PROPERTY COMPILE_FLAGS "${expanded_libcsound_CFLAGS}")
-
-target_link_libraries(${CSOUNDLIB_STATIC} ${libcsound_LIBS})
-
-set_target_properties(${CSOUNDLIB_STATIC} PROPERTIES
-    RUNTIME_OUTPUT_DIRECTORY ${BUILD_BIN_DIR}
-    LIBRARY_OUTPUT_DIRECTORY ${BUILD_LIB_DIR}
-    ARCHIVE_OUTPUT_DIRECTORY ${BUILD_LIB_DIR})
-
-# Add the install target
-install(TARGETS ${CSOUNDLIB_STATIC}
-    LIBRARY DESTINATION "${LIBRARY_INSTALL_DIR}"
-    ARCHIVE DESTINATION "${LIBRARY_INSTALL_DIR}")
+if(BUILD_STATIC_LIBRARY)
+    add_library(${CSOUNDLIB_STATIC} STATIC ${libcsound_SRCS})
+    SET_TARGET_PROPERTIES(${CSOUNDLIB_STATIC} PROPERTIES OUTPUT_NAME ${CSOUNDLIB})
+    SET_TARGET_PROPERTIES(${CSOUNDLIB_STATIC} PROPERTIES PREFIX "lib")
+    set_property(
+        TARGET ${CSOUNDLIB_STATIC}
+        PROPERTY COMPILE_FLAGS "${expanded_libcsound_CFLAGS}")
+
+    target_link_libraries(${CSOUNDLIB_STATIC} ${libcsound_LIBS})
+
+    set_target_properties(${CSOUNDLIB_STATIC} PROPERTIES
+        RUNTIME_OUTPUT_DIRECTORY ${BUILD_BIN_DIR}
+        LIBRARY_OUTPUT_DIRECTORY ${BUILD_LIB_DIR}
+        ARCHIVE_OUTPUT_DIRECTORY ${BUILD_LIB_DIR})
+
+    # Add the install target
+    install(TARGETS ${CSOUNDLIB_STATIC}
+        LIBRARY DESTINATION "${LIBRARY_INSTALL_DIR}"
+        ARCHIVE DESTINATION "${LIBRARY_INSTALL_DIR}")
+endif()
 
 option(BUILD_CATALOG "Build the opcode/library catalog" OFF)
 check_deps(BUILD_CATALOG)
@@ -739,3 +785,5 @@ add_subdirectory(frontends)
 add_subdirectory(util)
 add_subdirectory(util1)
 add_subdirectory(SDIF)
+add_subdirectory(po)
+add_subdirectory(H)
diff --git a/ChangeLog b/ChangeLog
index ba624f6..54ea5df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-02-09  john ffitch  <jpff at codemist.co.uk>
+
+	* Opcodes/ugsc.c (hilbertset): Remove unnecessary arrays
+
+2012-02-06  john ffitch  <jpff at codemist.co.uk>
+
+	* H/version.h: VERSION 5.16.1
+
 2011-11-30  john ffitch  <jpff at codemist.co.uk>
 
 	* Opcodes/pitch.c (impulse): If next is negative time, make it
diff --git a/Engine/corfiles.c b/Engine/corfiles.c
index f489142..f4d2447 100644
--- a/Engine/corfiles.c
+++ b/Engine/corfiles.c
@@ -183,7 +183,7 @@ CORFIL *copy_to_corefile(CSOUND *csound, char *fname, char *env, int fromScore)
     }
     corfile_putc('\0', mm);     /* For use in bison/flex */
     corfile_putc('\0', mm);     /* For use in bison/flex */
-    corfile_flush(mm);
+    if (fromScore) corfile_flush(mm);
     csoundFileClose(csound, fd);
     return mm;
 }
diff --git a/Engine/cs_par_base.c b/Engine/cs_par_base.c
index 9a1d7d6..c2e2773 100644
--- a/Engine/cs_par_base.c
+++ b/Engine/cs_par_base.c
@@ -171,7 +171,7 @@ void csp_barrier_dealloc(CSOUND *csound, pthread_barrier_t **barrier)
 //    if (*sem != NULL) {
 //      int val;
 //      sem_getvalue(*sem, &val);
-//      fprintf(stdout, "Already a semaphore: %d %p\n", val, *sem);
+//      csound->DebugMsg(csound, "Already a semaphore: %d %p\n", val, *sem);
 //      sem_destroy(*sem);
 //      csound->Free(csound, *sem);
 //    }
@@ -201,11 +201,11 @@ void csp_barrier_dealloc(CSOUND *csound, pthread_barrier_t **barrier)
 //    {
 //      /* int val, res; */
 //      /* res = sem_getvalue(sem, &val); */
-//      /* fprintf(stdout, "before sem_wait: %d %i:\t", val, */
+//      /* csound->DebugMsg(csound, "before sem_wait: %d %i:\t", val, */
 //      /*         csp_thread_index_get(csound)); */
 //      sem_wait(sem);
 //      /* res = sem_getvalue(sem, &val); */
-//      /* fprintf(stdout, "after sem_wait: %d %i\n", val, */
+//      /* csound->DebugMsg(csound, "after sem_wait: %d %i\n", val, */
 //      /*         csp_thread_index_get(csound)); */
 //    }
 //    TRACE_1("[%i] continue:\n", csp_thread_index_get(csound));
@@ -215,11 +215,11 @@ void csp_barrier_dealloc(CSOUND *csound, pthread_barrier_t **barrier)
 //{
 //    /* int val, res; */
 //    /* res = sem_getvalue(sem, &val); */
-//    /* fprintf(stdout, "before sem_grow: %d %i\t", 
+//    /* csound->DebugMsg(csound, "before sem_grow: %d %i\t", 
 //               val, csp_thread_index_get(csound)); */
 //    sem_post(sem);
 //    /* res = sem_getvalue(sem, &val); */
-//    /* fprintf(stdout, "after sem_grow: %d %i\n",
+//    /* csound->DebugMsg(csound, "after sem_grow: %d %i\n",
 //               val, csp_thread_index_get(csound)); */
 //}
 //
@@ -229,7 +229,7 @@ void csp_barrier_dealloc(CSOUND *csound, pthread_barrier_t **barrier)
 //    /* { */
 //    /*   int val, res; */
 //    /*   res = sem_getvalue(sem, &val); */
-//    /*   fprintf(stdout, "before sem_release: %d %i\n", */
+//    /*   csound->DebugMsg(csound, "before sem_release: %d %i\n", */
 //    /*           val, csp_thread_index_get(csound)); */
 //    /* } */
 //}
@@ -238,11 +238,11 @@ void csp_barrier_dealloc(CSOUND *csound, pthread_barrier_t **barrier)
 //{
 //    /* int val, res; */
 //    /* res = sem_getvalue(sem, &val); */
-//    /* fprintf(stdout, "before sem_release_end: %d %i\t", */
+//    /* csound->DebugMsg(csound, "before sem_release_end: %d %i\t", */
 //    /*         val, csp_thread_index_get(csound)); */
 //    sem_post(sem);
 //    /* res = sem_getvalue(sem, &val); */
-//    /* fprintf(stdout, "after sem_release_end: %d %i\n", */
+//    /* csound->DebugMsg(csound, "after sem_release_end: %d %i\n", */
 //    /*         val, csp_thread_index_get(csound)); */
 //}
 //
@@ -252,7 +252,7 @@ void csp_barrier_dealloc(CSOUND *csound, pthread_barrier_t **barrier)
 //    if (UNLIKELY(sem == NULL)) 
 //      csound->Die(csound, "Invalid NULL Parameter sem");
 //    res = sem_getvalue(sem, &val);
-//    fprintf(stdout, "sem_release_print: %d %p\n",
+//    csound->DebugMsg(csound, "sem_release_print: %d %p\n",
 //            val, csp_thread_index_get(csound));
 //}
 //
diff --git a/Engine/cs_par_dispatch.c b/Engine/cs_par_dispatch.c
index 2b35dc6..ecd8b2d 100644
--- a/Engine/cs_par_dispatch.c
+++ b/Engine/cs_par_dispatch.c
@@ -209,11 +209,17 @@ TREE *csp_locks_insert(CSOUND *csound, TREE *root)
     TREE *previous = NULL;
     INSTR_SEMANTICS *instr = NULL;
 
-    while(current != NULL) {
+    while (current != NULL) {
       switch(current->type) {
       case INSTR_TOKEN:
-        instr = csp_orc_sa_instr_get_by_name(csound,
-                                             current->left->value->lexeme);
+        if (current->left->type == T_INSTLIST) {
+          instr = csp_orc_sa_instr_get_by_name(csound,
+                                               current->left->left->value->lexeme);
+        }
+        else {
+          instr = csp_orc_sa_instr_get_by_name(csound,
+                                               current->left->value->lexeme);
+        }
         if (instr->read_write->count > 0 &&
             instr->read->count == 0 &&
             instr->write->count == 0) {
@@ -225,8 +231,9 @@ TREE *csp_locks_insert(CSOUND *csound, TREE *root)
       case IF_TOKEN:
         break;
 
-      default:
-        if (current->type == '=') {
+      case '=':
+        /*if (current->type == '=')*/
+        {
           struct set_t *left = NULL, *right  = NULL;
           left = csp_orc_sa_globals_find(csound, current->left);
           right = csp_orc_sa_globals_find(csound, current->right);
@@ -251,10 +258,14 @@ TREE *csp_locks_insert(CSOUND *csound, TREE *root)
             ORCTOKEN *unlock_tok = lookup_token(csound, "##globalunlock");
             ORCTOKEN *var_tok    = make_int(csound, buf);
 
-            TREE *lock_leaf = make_leaf(csound, current->line, T_OPCODE, lock_tok);
-            lock_leaf->right = make_leaf(csound, current->line, INTEGER_TOKEN, var_tok);
-            TREE *unlock_leaf = make_leaf(csound, current->line, T_OPCODE, unlock_tok);
-            unlock_leaf->right = make_leaf(csound, current->line, INTEGER_TOKEN, var_tok);
+            TREE *lock_leaf = make_leaf(csound, current->line, current->locn,
+                                        T_OPCODE, lock_tok);
+            lock_leaf->right = make_leaf(csound, current->line, current->locn,
+                                         INTEGER_TOKEN, var_tok);
+            TREE *unlock_leaf = make_leaf(csound, current->line, current->locn,
+                                          T_OPCODE, unlock_tok);
+            unlock_leaf->right = make_leaf(csound, current->line, current->locn,
+                                           INTEGER_TOKEN, var_tok);
 
             if (previous == NULL) {
               TREE *old_current = lock_leaf;
@@ -274,7 +285,8 @@ TREE *csp_locks_insert(CSOUND *csound, TREE *root)
           csp_set_dealloc(csound, &new);
           csp_set_dealloc(csound, &left);
           csp_set_dealloc(csound, &right);
-        }
+       }
+      default:
         break;
       }
 
@@ -421,12 +433,31 @@ void csp_weights_calculate(CSOUND *csound, TREE *root)
     while(current != NULL) {
       switch(current->type) {
       case INSTR_TOKEN:
-        instr = csp_orc_sa_instr_get_by_name(csound,
-                                             current->left->value->lexeme);
-        /* if (instr->weight == NULL) {
-           instr->weight = instr_weight_info_alloc(csound);
-           } */
-        csp_weights_calculate_instr(csound, current->right, instr);
+        if (current->left->type == T_INSTLIST) {
+          TREE *p =  current->left;
+          while (p) {
+            if (p->left) {
+              instr = csp_orc_sa_instr_get_by_name(csound,
+                                                   p->left->value->lexeme);
+              csp_weights_calculate_instr(csound, current->right, instr);
+            }
+            else {
+              instr = csp_orc_sa_instr_get_by_name(csound,
+                                                   p->value->lexeme);
+              csp_weights_calculate_instr(csound, current->right, instr);
+              break;
+            }
+            p = p->right;
+          }
+        }
+        else {
+          instr = csp_orc_sa_instr_get_by_name(csound,
+                                               current->left->value->lexeme);
+          /* if (instr->weight == NULL) {
+             instr->weight = instr_weight_info_alloc(csound);
+             } */
+          csp_weights_calculate_instr(csound, current->right, instr);
+        }
         break;
 
       default:
@@ -1232,11 +1263,15 @@ inline static DAG *csp_dag_build_initial(CSOUND *csound, INSDS *chain)
     while (chain != NULL) {
       INSTR_SEMANTICS *current_instr =
         csp_orc_sa_instr_get_by_num(csound, chain->insno);
-      if (current_instr == NULL)
-        csound->Die(csound,
-                    Str("Failed to find semantic information"
-                        " for instrument '%i'"),
-                        chain->insno);
+      if (current_instr == NULL) {
+        current_instr =
+          csp_orc_sa_instr_get_by_name(csound, csound->instrtxtp[chain->insno]->insname);
+        if (current_instr == NULL)
+          csound->Die(csound,
+                      Str("Failed to find semantic information"
+                          " for instrument '%i'"),
+                      chain->insno);
+      }
       csp_dag_add(csound, dag, current_instr, chain);
       dag->weight += current_instr->weight;
       chain = chain->nxtact;
diff --git a/Engine/cs_par_orc_semantic_analysis.c b/Engine/cs_par_orc_semantic_analysis.c
index 390bb8e..1efb616 100644
--- a/Engine/cs_par_orc_semantic_analysis.c
+++ b/Engine/cs_par_orc_semantic_analysis.c
@@ -116,7 +116,7 @@ void csp_orc_sa_global_read_write_add_list(CSOUND *csound,
                                            struct set_t *read)
 {
     if (csound->instCurr == NULL) {
-      csound->Message(csound,
+      csound->DebugMsg(csound,
                       "Add global read, write lists without any instruments\n");
     }
     else if (UNLIKELY(write == NULL  || read == NULL)) {
@@ -275,7 +275,7 @@ void csp_orc_sa_instr_add_tree(CSOUND *csound, TREE *x)
         return;
       }
       if (UNLIKELY(x->type != T_INSTLIST)) {
-        printf("type %d not T_INSTLIST\n", x->type);
+        csound->DebugMsg(csound,"type %d not T_INSTLIST\n", x->type);
         csound->Die(csound, "Not a proper list of ints");
       }
       csp_orc_sa_instr_add(csound, x->left->value->lexeme);
diff --git a/Engine/csound_orc.l b/Engine/csound_orc.l
index 5b012b2..1f78d28 100644
--- a/Engine/csound_orc.l
+++ b/Engine/csound_orc.l
@@ -46,14 +46,6 @@ ORCTOKEN *make_int(CSOUND *, char *);
 ORCTOKEN *make_num(CSOUND *, char *);
 ORCTOKEN *make_token(CSOUND *, char *s);
 ORCTOKEN *make_label(CSOUND *, char *s);
-void comment(yyscan_t);
-void do_comment(yyscan_t);
-void do_include(CSOUND *, int, yyscan_t);
-void do_macro_arg(CSOUND *, char *, yyscan_t);
-void do_macro(CSOUND *, char *, yyscan_t);
-void do_umacro(CSOUND *, char *, yyscan_t);
-void do_ifdef(CSOUND *, char *, yyscan_t);
-void do_ifdef_skip_code(CSOUND *, yyscan_t);
 #define udoflag csound->parserUdoflag
 #define namedInstrFlag csound->parserNamedInstrFlag
 //extern int udoflag;
@@ -69,7 +61,8 @@ void do_ifdef_skip_code(CSOUND *, yyscan_t);
 /*     if ( UNLIKELY( result <= 0  )) \ */
 /*       result = YY_NULL; \ */
 /*     } */
-#define YY_USER_INIT csound_orcset_lineno(csound->orcLineOffset, yyscanner);
+
+#define YY_USER_INIT 
 
 struct yyguts_t;
 ORCTOKEN *do_at(CSOUND *, int, struct yyguts_t*);
@@ -78,50 +71,38 @@ int get_next_char(char *, int, struct yyguts_t*);
 %option reentrant
 %option bison-bridge
 %option bison-locations
-
+%option prefix="csound_orc"
+%option outfile="Engine/csound_orclex.c"
+%option stdout
 
 STRCONST        \"(\\.|[^\"])*\"
 STRCONSTe       \"(\\.|[^\"])*$
-LABEL           ^[ \t]*[a-zA-Z_][a-zA-Z0-9_]*:
+LABEL           ^[ \t]*[a-zA-Z0-9_][a-zA-Z0-9_]*:
 IDENT           [a-zA-Z_][a-zA-Z0-9_]*
 IDENTN          [a-zA-Z0-9_]+
-MACRO           [a-zA-Z0-9_]+\(
-MACRONAME       "$"[a-zA-Z0-9_]+
-MACRONAMED      "$"[a-zA-Z0-9_]+\.
-MACRONAMEA      "$"[a-zA-Z0-9_]+\(
-MACRONAMEDA     "$"[a-zA-Z0-9_]+\.\(
 INTGR           [0-9]+
-NUMBER          [0-9]+\.[0-9]*(e[-+]?[0-9]+)?|\.[0-9]+(e[-+]?[0-9]+)?
-STCOM           \/\*
+NUMBER          [0-9]+\.?[0-9]*(e[-+]?[0-9]+)?|\.[0-9]+(e[-+]?[0-9]+)?
 WHITE           [ \t]+
 OPTWHITE        [ \t]*
-INCLUDE         "#include"
-DEFINE          "#define"
-UNDEF           "#undef"
-IFDEF           #ifn?def
-ELSE            #else[ \t]*(;.*)?$
-END             #end(if)?[ \t]*(;.*)?\n
 CONT            \\[ \t]*(;.*)?\n
 XSTR            "{{"
 EXSTR           "}}"
-
-%x incl
-%x macro
-%x umacro
-%x ifdef
+LINE            ^"#line"
+FILE            ^"#source"
+FNAME           [a-zA-Z0-9/:.+-_]+
+%x line
+%x src
 %x xstr
 
 %%
 "\r"            { } /* EATUP THIS PART OF WINDOWS NEWLINE */
+
 {CONT}          { csound_orcset_lineno(1+csound_orcget_lineno(yyscanner),
                                        yyscanner);
  }
 "\n"            { csound_orcset_lineno(1+csound_orcget_lineno(yyscanner),
                                        yyscanner);
                   return NEWLINE; }
-"//"            { comment(yyscanner); return NEWLINE; }
-";"             { comment(yyscanner); return NEWLINE; }
-{STCOM}         { do_comment(yyscanner); }
 "("             { return '('; }
 ")"             { return ')'; }
 "["             { return '['; }
@@ -156,16 +137,36 @@ EXSTR           "}}"
 "~"             { return '~'; }
 "@@"{OPTWHITE}{INTGR}     { *lvalp = do_at(csound, 1, yyg); return INTEGER_TOKEN; }
 "@"{OPTWHITE}{INTGR}      { *lvalp = do_at(csound, 0, yyg); return INTEGER_TOKEN; }
-"if"            { return IF_TOKEN; }
-"then"          { return THEN_TOKEN; }
-"ithen"         { return ITHEN_TOKEN; }
-"kthen"         { return KTHEN_TOKEN; }
-"elseif"        { return ELSEIF_TOKEN; }
-"else"          { return ELSE_TOKEN; }
-"endif"         { return ENDIF_TOKEN; }
-"until"         { return UNTIL_TOKEN; }
-"do"            { return DO_TOKEN; }
-"od"            { return OD_TOKEN; }
+"if"            { *lvalp = make_token(csound, yytext);
+                  (*lvalp)->type = IF_TOKEN;
+                  return IF_TOKEN; }
+"then"          { *lvalp = make_token(csound, yytext);
+                  (*lvalp)->type = THEN_TOKEN;
+                  return THEN_TOKEN; }
+"ithen"         { *lvalp = make_token(csound, yytext);
+                  (*lvalp)->type = ITHEN_TOKEN;
+                  return ITHEN_TOKEN; }
+"kthen"         { *lvalp = make_token(csound, yytext);
+                  (*lvalp)->type = KTHEN_TOKEN;
+                  return KTHEN_TOKEN; }
+"elseif"        { *lvalp = make_token(csound, yytext);
+                  (*lvalp)->type = ELSEIF_TOKEN;
+                  return ELSEIF_TOKEN; }
+"else"          { *lvalp = make_token(csound, yytext);
+                  (*lvalp)->type = ELSE_TOKEN;
+                  return ELSE_TOKEN; }
+"endif"         { *lvalp = make_token(csound, yytext);
+                  (*lvalp)->type = ENDIF_TOKEN;
+                  return ENDIF_TOKEN; }
+"until"         { *lvalp = make_token(csound, yytext);
+                  (*lvalp)->type = UNTIL_TOKEN;
+                  return UNTIL_TOKEN; }
+"do"            { *lvalp = make_token(csound, yytext);
+                  (*lvalp)->type = DO_TOKEN;
+                  return DO_TOKEN; }
+"od"            { *lvalp = make_token(csound, yytext);
+                  (*lvalp)->type = OD_TOKEN;
+                  return OD_TOKEN; }
 
 "goto"          { *lvalp = make_token(csound, yytext);
                   (*lvalp)->type = GOTO_TOKEN;
@@ -196,13 +197,15 @@ EXSTR           "}}"
                   namedInstrFlag = 1;
                   return INSTR_TOKEN;
                 }
-"endin"         { return ENDIN_TOKEN; }
+"endin"         { *lvalp = make_token(csound, yytext);
+                  (*lvalp)->type = ENDIN_TOKEN;
+                  return ENDIN_TOKEN; }
 "opcode"        {
                   PARM->clearBufferAfterEOF = 0;
                   return UDOSTART_DEFINITION;
                 }
 "endop"         {
-                  PARM->clearBufferAfterEOF = PARM->isInclude;
+                  PARM->clearBufferAfterEOF = 0;
                   *lvalp = new_token(csound, UDOEND_TOKEN); return UDOEND_TOKEN;
                 }
 
@@ -232,9 +235,9 @@ EXSTR           "}}"
                   if (PARM->xstrptr+2==PARM->xstrmax) {
                       PARM->xstrbuff = (char *)realloc(PARM->xstrbuff,
                                                        PARM->xstrmax+=80);
-                      printf("Extending xstr buffer\n");
+                      csound->DebugMsg(csound,"Extending xstr buffer\n");
                   }
-//                  printf("Adding newline (%.2x)\n", yytext[0]);
+//                  csound->DebugMsg(csound,"Adding newline (%.2x)\n", yytext[0]);
                   PARM->xstrbuff[PARM->xstrptr++] = yytext[0];
                   PARM->xstrbuff[PARM->xstrptr] = '\0';
                 }
@@ -242,9 +245,9 @@ EXSTR           "}}"
 <xstr>.     { if (PARM->xstrptr+2==PARM->xstrmax) {
                       PARM->xstrbuff = (char *)realloc(PARM->xstrbuff,
                                                        PARM->xstrmax+=80);
-                      printf("Extending xstr buffer\n");
+                      csound->DebugMsg(csound,"Extending xstr buffer\n");
                   }
-//                  printf("Adding (%.2x)\n", yytext[0]);
+//                  csound->DebugMsg(csound,"Adding (%.2x)\n", yytext[0]);
                   PARM->xstrbuff[PARM->xstrptr++] = yytext[0];
                   PARM->xstrbuff[PARM->xstrptr] = '\0';
                 }
@@ -266,162 +269,6 @@ EXSTR           "}}"
                   /* csound->Message(csound,"%s -> %d\n",
                                      yytext, (*lvalp)->type); */
                   return (*lvalp)->type; }
-{MACRONAME}     {
-                  MACRO     *mm = PARM->macros;
-                  while (mm != NULL) {  /* Find the definition */
-                    if (!(strcmp(yytext+1, mm->name)))
-                      break;
-                    mm = mm->next;
-                  }
-                  if (UNLIKELY(mm == NULL)) {
-                    csound->Message(csound,Str("Undefined macro: '%s'"), yytext);
-                    csound->LongJmp(csound, 1);
-                  }
-                  /* Need to read from macro definition */
-                  /* ??fiddle with buffers I guess */
-                  if (UNLIKELY(PARM->macro_stack_ptr >= MAX_INCLUDE_DEPTH )) {
-                    csound->Message(csound, Str("Includes nested too deeply"));
-                    exit(1);
-                  }
-                  PARM->alt_stack[PARM->macro_stack_ptr].n = 0;
-                  PARM->alt_stack[PARM->macro_stack_ptr++].s = NULL;
-                  /* printf("Push %p macro stack; new body #%s#\n",
-                            PARM->macros, mm->body); */
-                  /* printf("Push buffer %p -> ", YY_CURRENT_BUFFER); */
-                  yypush_buffer_state(YY_CURRENT_BUFFER, yyscanner);
-                  yy_scan_string(mm->body, yyscanner);
-                  /* printf("%p\n", YY_CURRENT_BUFFER); */
-                 }
-{MACRONAMED}    {
-                  MACRO     *mm = PARM->macros;
-                  yytext[yyleng-1] = '\0';
-                  while (mm != NULL) {  /* Find the definition */
-                    if (!(strcmp(yytext+1, mm->name)))
-                      break;
-                    mm = mm->next;
-                  }
-                  if (UNLIKELY(mm == NULL)) {
-                    csound->Message(csound,Str("Undefined macro: '%s'"), yytext);
-                    csound->LongJmp(csound, 1);
-                  }
-                  /* Need to read from macro definition */
-                  /* ??fiddle with buffers I guess */
-                  if (UNLIKELY(PARM->macro_stack_ptr >= MAX_INCLUDE_DEPTH )) {
-                    csound->Message(csound, Str("Includes nested too deeply"));
-                    exit(1);
-                  }
-                  PARM->alt_stack[PARM->macro_stack_ptr].n = 0;
-                  PARM->alt_stack[PARM->macro_stack_ptr++].s = NULL;
-                  /* printf("Push buffer %p -> ", YY_CURRENBUFFER_TOKEN); */
-                  yypush_buffer_state(YY_CURRENT_BUFFER, yyscanner);
-                  yy_scan_string(mm->body, yyscanner);
-                  /* printf("%p\n", YY_CURRENT_BUFFER); */
-                }
-{MACRONAMEA}    {
-                  MACRO     *mm = PARM->macros;
-                  int c, i, j;
-                  printf("Macro with arguments call %s\n", yytext);
-                  yytext[yyleng-1] = '\0';
-                  while (mm != NULL) {  /* Find the definition */
-                    /* printf("Check %s against %s\n", yytext+1, mm->name); */
-                    if (!(strcmp(yytext+1, mm->name)))
-                      break;
-                    mm = mm->next;
-                  }
-                  if (UNLIKELY(mm == NULL)) {
-                    csound->Message(csound,Str("Undefined macro: '%s'"), yytext);
-                    csound->LongJmp(csound, 1);
-                  }
-                  /* Need to read from macro definition */
-                  /* printf("Looking for %d args\n", mm->acnt); */
-                  for (j = 0; j < mm->acnt; j++) {
-                    char  term = (j == mm->acnt - 1 ? ')' : '\'');
-/* Compatability */
-                    char  trm1 = (j == mm->acnt - 1 ? ')' : '#');
-                    MACRO *nn = (MACRO*) mmalloc(csound, sizeof(MACRO));
-                    int   size = 100;
-                    nn->name = mmalloc(csound, strlen(mm->arg[j]) + 1);
-                    /* printf("Arg %d: %s\n", j+1, mm->arg[j]); */
-                    strcpy(nn->name, mm->arg[j]);
-                    /* csound->Message(csound, "defining argument %s ",
-                                       nn->name); */
-                    i = 0;
-                    nn->body = (char*) mmalloc(csound, 100);
-                    while ((c = input(yyscanner))!= term && c!=trm1) {
-                      if (UNLIKELY(i > 98)) {
-                        csound->Die(csound,
-                                    Str("Missing argument terminator\n%.98s"),
-                                    nn->body);
-                      }
-                      nn->body[i++] = c;
-                      if (UNLIKELY(i >= size))
-                        nn->body = mrealloc(csound, nn->body, size += 100);
-                    }
-                    nn->body[i] = '\0';
-                    /* csound->Message(csound, "as...#%s#\n", nn->body); */
-                    nn->acnt = 0;       /* No arguments for arguments */
-                    nn->next = PARM->macros;
-                    PARM->macros = nn;
-                  }
-                  /* printf("New body: ...#%s#\n", mm->body); */
-                  PARM->alt_stack[PARM->macro_stack_ptr].n = mm->acnt;
-                  PARM->alt_stack[PARM->macro_stack_ptr++].s = PARM->macros;
-                  /* printf("Push %p macro stack\n",PARM->macros); */
-                  yypush_buffer_state(YY_CURRENT_BUFFER, yyscanner);
-                  yy_scan_string(mm->body, yyscanner);
-                }
-{MACRONAMEDA}    {
-                  MACRO     *mm = PARM->macros;
-                  int c, i, j;
-                  printf("Macro with arguments call %s\n", yytext);
-                  yytext[yyleng-2] = '\0';
-                  while (mm != NULL) {  /* Find the definition */
-                    /* printf("Check %s against %s\n", yytext+1, mm->name); */
-                    if (!(strcmp(yytext+1, mm->name)))
-                      break;
-                    mm = mm->next;
-                  }
-                  if (UNLIKELY(mm == NULL)) {
-                    csound->Message(csound,Str("Undefined macro: '%s'"), yytext);
-                    csound->LongJmp(csound, 1);
-                  }
-                  /* Need to read from macro definition */
-                  /* printf("Looking for %d args\n", mm->acnt); */
-                  for (j = 0; j < mm->acnt; j++) {
-                    char  term = (j == mm->acnt - 1 ? ')' : '\'');
-/* Compatability */
-                    char  trm1 = (j == mm->acnt - 1 ? ')' : '#');
-                    MACRO *nn = (MACRO*) mmalloc(csound, sizeof(MACRO));
-                    int   size = 100;
-                    nn->name = mmalloc(csound, strlen(mm->arg[j]) + 1);
-                    /* printf("Arg %d: %s\n", j+1, mm->arg[j]); */
-                    strcpy(nn->name, mm->arg[j]);
-                    /* csound->Message(csound, "defining argument %s ",
-                                       nn->name); */
-                    i = 0;
-                    nn->body = (char*) mmalloc(csound, 100);
-                    while ((c = input(yyscanner))!= term && c!=trm1) {
-                      if (UNLIKELY(i > 98)) {
-                        csound->Die(csound,
-                                    Str("Missing argument terminator\n%.98s"),
-                                    nn->body);
-                      }
-                      nn->body[i++] = c;
-                      if (UNLIKELY(i >= size))
-                        nn->body = mrealloc(csound, nn->body, size += 100);
-                    }
-                    nn->body[i] = '\0';
-                    /* csound->Message(csound, "as...#%s#\n", nn->body); */
-                    nn->acnt = 0;       /* No arguments for arguments */
-                    nn->next = PARM->macros;
-                    PARM->macros = nn;
-                  }
-                  /* printf("New body: ...#%s#\n", mm->body); */
-                  PARM->alt_stack[PARM->macro_stack_ptr].n = mm->acnt;
-                  PARM->alt_stack[PARM->macro_stack_ptr++].s = PARM->macros;
-                  yypush_buffer_state(YY_CURRENT_BUFFER, yyscanner);
-                  yy_scan_string(mm->body, yyscanner);
-                }
 {INTGR}         {
                     if (udoflag == 0) {
                         *lvalp = make_string(csound, yytext);
@@ -438,152 +285,59 @@ EXSTR           "}}"
                 }
 {NUMBER}        { *lvalp = make_num(csound, yytext); return (NUMBER_TOKEN); }
 {WHITE}         { }
-{INCLUDE}       BEGIN(incl);
-<incl>[ \t]*     /* eat the whitespace */
-<incl>.         { /* got the include file name */
-                  do_include(csound, yytext[0], yyscanner);
-                  BEGIN(INITIAL);
-                }
-<<EOF>>         {
-                  MACRO *x, *y;
-                  int n;
-                  printf("Leaving buffer %p\n", YY_CURRENT_BUFFER);
-                  yypop_buffer_state(yyscanner);
-                  if ( !YY_CURRENT_BUFFER ) yyterminate();
-                  printf("End of input; popping to %p\n", YY_CURRENT_BUFFER);
-                  if (PARM->clearBufferAfterEOF)
-                    PARM->lBuffer =
-                      PARM->clearBufferAfterEOF =
-                      PARM->isInclude = 0;
-                  n = PARM->alt_stack[--PARM->macro_stack_ptr].n;
-                  printf("n=%d\n", n);
-                  if (n!=0) {
-                    /* We need to delete n macros starting with y */
-                    y = PARM->alt_stack[PARM->macro_stack_ptr].s;
-                    x = PARM->macros;
-                    if (x==y) {
-                      while (n>0) {
-                        mfree(csound, y->name); x=y->next;
-                        mfree(csound, y); y=x; n--;
-                      }
-                      PARM->macros = x;
-                    }
-                    else {
-                      MACRO *nxt = y->next;
-                      while (x->next != y) x = x->next;
-                      while (n>0) {
-                        nxt = y->next;
-                        mfree(csound, y->name); mfree(csound, y); y=nxt; n--;
-                      }
-                      x->next = nxt;
-                    }
-                    y->next = x;
-                  }
-                  /* printf("End of input segment: macro pop %p -> %p\n",
-                             y, PARM->macros); */
-                }
-{DEFINE}       BEGIN(macro);
-<macro>[ \t]*    /* eat the whitespace */
-<macro>{MACRO}  {
-                  yytext[yyleng-1] = '\0';
-                  printf("Define macro with args %s\n", yytext);
-                  do_macro_arg(csound, yytext, yyscanner);
-                  BEGIN(INITIAL);
-                }
-<macro>{IDENTN} {
-                  printf("Define macro %s\n", yytext);
-                  do_macro(csound, yytext, yyscanner);
-                  BEGIN(INITIAL);
-                }
-{UNDEF}        BEGIN(umacro);
-<umacro>[ \t]*    /* eat the whitespace */
-<umacro>{IDENT}  {
-                  printf("Undefine macro %s\n", yytext);
-                  do_umacro(csound, yytext, yyscanner);
-                  BEGIN(INITIAL);
-                }
 
-.               { csound->Message(csound,
-                                 Str("Line %d: Unknown character: '%c'(%2x)\n"),
-                                 csound_orcget_lineno(yyscanner),
-                                 yytext[0],yytext[0]);
-                }
-{IFDEF}         {
-                  PARM->isIfndef = (yytext[3] == 'n');  /* #ifdef or #ifndef */
-                  BEGIN(ifdef);
-                }
-<ifdef>[ \t]*     /* eat the whitespace */
-<ifdef>{IDENT}  {
-                  do_ifdef(csound, yytext, yyscanner);
-                  BEGIN(INITIAL);
-                }
-{ELSE}          { 
-                  if (PARM->ifdefStack == NULL) {
-                    csound->Message(csound, Str("#else without #if\n"));
-                    csound->LongJmp(csound, 1); 
-                  }
-                  else if (PARM->ifdefStack->isElse) {
-                    csound->Message(csound, Str("#else after #else\n"));
-                    csound->LongJmp(csound, 1);
-                  }
-                  PARM->ifdefStack->isElse = 1;
-                  do_ifdef_skip_code(csound, yyscanner);
-                }
-{END}           {
-                  IFDEFSTACK *pp = PARM->ifdefStack;
-                  if (UNLIKELY(pp == NULL)) {
-                    csound->Message(csound, Str("Unmatched #end\n"));
-                    csound->LongJmp(csound, 1);
-                  }
-                  PARM->ifdefStack = pp->prv;
-                  mfree(csound, pp);
-                }
+{LINE}          { BEGIN(line); }
 
+<line>[ \t]*     /* eat the whitespace */
+<line>{INTGR}   { csound_orcset_lineno(atoi(yytext), yyscanner); }
+<line>"\n"      {BEGIN(INITIAL);}
 
-%%
-void comment(yyscan_t yyscanner)              /* Skip until nextline */
-{
-    char c;
+{FILE}          { BEGIN(src); }
 
-    while ((c = input(yyscanner)) != '\n'); /* skip */
-    csound_orcset_lineno(1+csound_orcget_lineno(yyscanner),yyscanner);
-}
+<src>[ \t]*     /* eat the whitespace */
+<src>{FNAME}    { PARM->locn = atoi(yytext); }
+<src>"\n"       { BEGIN(INITIAL); }
 
-void do_comment(yyscan_t yyscanner)              /* Skip until * and / chars */
-{
-    char c;
-    for (;;) {
-      c = input(yyscanner);
-      if (UNLIKELY(c=='\n')) /* skip */
-          csound_orcset_lineno(1+csound_orcget_lineno(yyscanner),yyscanner);
-      if (c != '*') continue;
-      while ((c=input(yyscanner))=='*');
-      if (c=='/') return;
-      if (UNLIKELY(c=='\n'))
-        csound_orcset_lineno(1+csound_orcget_lineno(yyscanner),yyscanner);
-    }
-}
 
-void do_include(CSOUND *csound, int term, yyscan_t yyscanner)
-{
-    char buffer[100];
-    int p=0;
-    int c;
-    CORFIL *cf;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    while ((c=input(yyscanner))!=term) {
-      buffer[p] = c;
-      p++;
-    }
-    buffer[p] = '\0';
-    while ((c=input(yyscanner))!='\n');
-    cf = copy_to_corefile(csound, buffer, "INCDIR", 0);
-    PARM->alt_stack[PARM->macro_stack_ptr].n = 0;
-    PARM->alt_stack[PARM->macro_stack_ptr++].s = NULL;
-    PARM->isInclude = PARM->clearBufferAfterEOF = 1;
-    yypush_buffer_state(YY_CURRENT_BUFFER, yyscanner);
-    yy_scan_string(cf->body, yyscanner);
-}
+<<EOF>>         {
+                  yyterminate();
+                  /* int n; */
+                  /* csound->DebugMsg(csound,"Leaving buffer %p\n", YY_CURRENT_BUFFER); */
+                  /* yypop_buffer_state(yyscanner); */
+                  /* if ( !YY_CURRENT_BUFFER ) yyterminate(); */
+                  /* csound->DebugMsg(csound,"End of input; popping to %p\n", YY_CURRENT_BUFFER); */
+                  /* if (PARM->clearBufferAfterEOF) */
+                  /*   PARM->clearBufferAfterEOF = */
+                  /*     PARM->isInclude = 0; */
+                  /* n = PARM->alt_stack[--PARM->macro_stack_ptr].n; */
+                  /* csound->DebugMsg(csound,"n=%d\n", n); */
+                  /* if (n!=0) { */
+                  /*   /\* We need to delete n macros starting with y *\/ */
+                  /*   y = PARM->alt_stack[PARM->macro_stack_ptr].s; */
+                  /*   x = PARM->macros; */
+                  /*   if (x==y) { */
+                  /*     while (n>0) { */
+                  /*       mfree(csound, y->name); x=y->next; */
+                  /*       mfree(csound, y); y=x; n--; */
+                  /*     } */
+                  /*     PARM->macros = x; */
+                  /*   } */
+                  /*   else { */
+                  /*     MACRO *nxt = y->next; */
+                  /*     while (x->next != y) x = x->next; */
+                  /*     while (n>0) { */
+                  /*       nxt = y->next; */
+                  /*       mfree(csound, y->name); mfree(csound, y); y=nxt; n--; */
+                  /*     } */
+                  /*     x->next = nxt; */
+                  /*   } */
+                  /*   y->next = x; */
+                  /* } */
+                  /* /\* csound->DebugMsg(csound,"End of input segment: macro pop %p -> %p\n", */
+                  /*            y, PARM->macros); *\/ */
+                }
+
+%%
 
 static inline int isNameChar(int c, int pos)
 {
@@ -591,191 +345,6 @@ static inline int isNameChar(int c, int pos)
     return (isalpha(c) || (pos && (c == '_' || isdigit(c))));
 }
 
-void do_macro_arg(CSOUND *csound, char *name0, yyscan_t yyscanner)
-{
-    MACRO *mm = (MACRO*) mmalloc(csound, sizeof(MACRO));
-    int   arg = 0, i, c;
-    int   size = 100;
-    int mlen = 40;
-    char *mname = malloc(mlen);
-    mm->margs = MARGS;    /* Initial size */
-    mm->name = (char*)mmalloc(csound, strlen(name0) + 1);
-    strcpy(mm->name, name0);
-    do {
-      while (isspace((c = input(yyscanner))));
-      i = 0;
-
-      while (isNameChar(c, i)) {
-        mname[i++] = c;
-        if (UNLIKELY(i==mlen))
-          mname = (char *)realloc(mname, mlen+=40);
-        c = input(yyscanner);
-      }
-      mname[i] = '\0';
-      mm->arg[arg] = mmalloc(csound, i + 1);
-      strcpy(mm->arg[arg++], mname);
-      if (UNLIKELY(arg >= mm->margs)) {
-        mm = (MACRO*) mrealloc(csound, mm, sizeof(MACRO)
-                               + mm->margs * sizeof(char*));
-        mm->margs += MARGS;
-      }
-      while (isspace(c))
-        c = input(yyscanner);
-    } while (c == '\'' || c == '#');
-    if (UNLIKELY(c != ')'))
-      csound->Message(csound, Str("macro error\n"));
-    free(mname);
-    while (c!='#') c = input(yyscanner);
-    mm->acnt = arg;
-    i = 0;
-    mm->body = (char*) mmalloc(csound, 100);
-    while ((c = input(yyscanner)) != '#') {
-      mm->body[i++] = c;
-      if (UNLIKELY(i >= size))
-        mm->body = mrealloc(csound, mm->body, size += 100);
-      if (c == '\\') {                    /* allow escaped # */
-        mm->body[i++] = c = input(yyscanner);
-        if (UNLIKELY(i >= size))
-          mm->body = mrealloc(csound, mm->body, size += 100);
-      }
-      if (UNLIKELY(c == '\n'))
-        csound_orcset_lineno(1+csound_orcget_lineno(yyscanner),yyscanner);
-    }
-    mm->body[i] = '\0';
-    mm->next = PARM->macros;
-    PARM->macros = mm;
-}
-
-void do_macro(CSOUND *csound, char *name0, yyscan_t yyscanner)
-{
-    MACRO *mm = (MACRO*) mmalloc(csound, sizeof(MACRO));
-    int   i, c;
-    int   size = 100;
-    mm->margs = MARGS;    /* Initial size */
-    //    printf("Macro definition for %s\n", name0);
-    mm->name = (char*)mmalloc(csound, strlen(name0) + 1);
-    strcpy(mm->name, name0);
-    mm->acnt = 0;
-    i = 0;
-    while ((c = input(yyscanner)) != '#');
-    mm->body = (char*) mmalloc(csound, 100);
-    while ((c = input(yyscanner)) != '#') {
-      mm->body[i++] = c;
-      if (UNLIKELY(i >= size))
-        mm->body = mrealloc(csound, mm->body, size += 100);
-      if (c == '\\') {                    /* allow escaped # */
-        mm->body[i++] = c = input(yyscanner);
-        if (UNLIKELY(i >= size))
-          mm->body = mrealloc(csound, mm->body, size += 100);
-      }
-      if (UNLIKELY(c == '\n'))
-        csound_orcset_lineno(1+csound_orcget_lineno(yyscanner),yyscanner);
-    }
-    mm->body[i] = '\0';
-    //    printf("Body #%s#\n", mm->body);
-    mm->next = PARM->macros;
-    PARM->macros = mm;
-}
-
-void do_umacro(CSOUND *csound, char *name0, yyscan_t yyscanner)
-{
-    int i,c;
-    if (UNLIKELY(csound->oparms->msglevel))
-      csound->Message(csound,Str("macro %s undefined\n"), name0);
-    if (strcmp(name0, PARM->macros->name)==0) {
-      MACRO *mm=PARM->macros->next;
-      mfree(csound, PARM->macros->name); mfree(csound, PARM->macros->body);
-      for (i=0; i<PARM->macros->acnt; i++)
-        mfree(csound, PARM->macros->arg[i]);
-      mfree(csound, PARM->macros); PARM->macros = mm;
-    }
-    else {
-      MACRO *mm = PARM->macros;
-      MACRO *nn = mm->next;
-      while (strcmp(name0, nn->name) != 0) {
-        mm = nn; nn = nn->next;
-        if (UNLIKELY(nn == NULL)) {
-          csound->Message(csound, Str("Undefining undefined macro"));
-          csound->LongJmp(csound, 1);
-        }
-      }
-      mfree(csound, nn->name); mfree(csound, nn->body);
-      for (i=0; i<nn->acnt; i++)
-        mfree(csound, nn->arg[i]);
-      mm->next = nn->next; mfree(csound, nn);
-    }
-    while ((c=input(yyscanner)) != '\n' && c != EOF); /* ignore rest of line */
-    csound_orcset_lineno(1+csound_orcget_lineno(yyscanner),yyscanner);
-}
-
-void do_ifdef(CSOUND *csound, char *name0, yyscan_t yyscanner)
-{
-    int c;
-    MACRO *mm;
-    IFDEFSTACK *pp;
-    pp = (IFDEFSTACK*) mcalloc(csound, sizeof(IFDEFSTACK));
-    pp->prv = PARM->ifdefStack;
-    pp->isDef = PARM->isIfndef;
-    for (mm = PARM->macros; mm != NULL; mm = mm->next) {
-      if (strcmp(name0, mm->name) == 0) {
-        pp->isDef ^= (unsigned char) 1;
-        break;
-      }
-    }
-    PARM->ifdefStack = pp;
-    pp->isSkip = pp->isDef ^ (unsigned char) 1;
-    if (pp->isSkip)
-      do_ifdef_skip_code(csound, yyscanner);
-    else
-      while ((c = input(yyscanner)) != '\n' && c != EOF);
-}
-
-void do_ifdef_skip_code(CSOUND *csound, yyscan_t yyscanner)
-{
-    int i, c, nested_ifdef = 0;
-    char *buf;
-    IFDEFSTACK *pp;
-    buf = (char*)malloc(8*sizeof(char));
-    pp = PARM->ifdefStack;
-    c = input(yyscanner);
-    for (;;) {
-      while (c!='\n') {
-        if (UNLIKELY(c == EOF)) {
-          csound->Message(csound, Str("Unmatched #if%sdef\n"),
-                          PARM->isIfndef ? "n" : "");
-          csound->LongJmp(csound, 1);
-        }
-        c = input(yyscanner);
-      }
-      while (isblank(c = input(yyscanner)));  /* eat the whitespace */
-      if (c == '#') {
-        for (i=0; islower(c = input(yyscanner)) && i < 7; i++)
-          buf[i] = c;
-        buf[i] = '\0';
-        if (strcmp("end", buf) == 0 || strcmp("endif", buf) == 0) {
-          if (nested_ifdef-- == 0) {
-            PARM->ifdefStack = pp->prv;
-            mfree(csound, pp);
-            break;
-          }
-        }
-        else if (strcmp("ifdef", buf) == 0 || strcmp("ifndef", buf) == 0) {
-          nested_ifdef++;
-        }
-        else if (strcmp("else", buf) == 0 && nested_ifdef == 0) {
-          if (pp->isElse) {
-            csound->Message(csound, Str("#else after #else\n"));
-            csound->LongJmp(csound, 1);
-          }
-          pp->isElse = 1;
-          break;
-        }
-      }
-    }
-    free(buf);
-    while (c != '\n' && c != EOF) c = input(yyscanner);
-}
-
 ORCTOKEN *new_token(CSOUND *csound, int type)
 {
     ORCTOKEN *ans = (ORCTOKEN*)mcalloc(csound, sizeof(ORCTOKEN));
@@ -855,86 +424,6 @@ ORCTOKEN *make_num(CSOUND *csound, char *s)
     return ans;
 }
 
-static void add_math_const_macro(CSOUND *csound, void* yyscanner,
-                                 char * name, char *body)
-{
-    MACRO *mm;
-
-    mm = (MACRO*) mcalloc(csound, sizeof(MACRO));
-    mm->name = (char*) mcalloc(csound, strlen(name) + 3);
-    sprintf(mm->name, "M_%s", name);
-    mm->next = PARM->macros;
-    PARM->macros = mm;
-    mm->margs = MARGS;    /* Initial size */
-    mm->acnt = 0;
-    mm->body = (char*) mcalloc(csound, strlen(body) + 1);
-    mm->body = strcpy(mm->body, body);
-}
-
-/**
- * Add math constants from math.h as orc PARM->macros
- */
-void cs_init_math_constants_macros(CSOUND *csound, void* yyscanner)
- {
-     PARM->macros = NULL;
-     add_math_const_macro(csound, yyscanner, "E",     "2.71828182845904523536");
-     add_math_const_macro(csound, yyscanner, "LOG2E", "1.44269504088896340736");
-     add_math_const_macro(csound, yyscanner, "LOG10E","0.43429448190325182765");
-     add_math_const_macro(csound, yyscanner, "LN2",   "0.69314718055994530942");
-     add_math_const_macro(csound, yyscanner, "LN10",  "2.30258509299404568402");
-     add_math_const_macro(csound, yyscanner, "PI",    "3.14159265358979323846");
-     add_math_const_macro(csound, yyscanner, "PI_2",  "1.57079632679489661923");
-     add_math_const_macro(csound, yyscanner, "PI_4",  "0.78539816339744830962");
-     add_math_const_macro(csound, yyscanner, "1_PI",  "0.31830988618379067154");
-     add_math_const_macro(csound, yyscanner, "2_PI",  "0.63661977236758134308");
-     add_math_const_macro(csound, yyscanner,"2_SQRTPI", "1.12837916709551257390");
-     add_math_const_macro(csound, yyscanner, "SQRT2", "1.41421356237309504880");
-     add_math_const_macro(csound, yyscanner,"SQRT1_2","0.70710678118654752440");
-     add_math_const_macro(csound, yyscanner, "INF",   "2147483647.0"); /* ~7 years */
-}
-
-void cs_init_omacros(CSOUND *csound, void *yyscanner, NAMES *nn)
-{
-    while (nn) {
-      char  *s = nn->mac;
-      char  *p = strchr(s, '=');
-      char  *mname;
-      MACRO *mm;
-
-      if (p == NULL)
-        p = s + strlen(s);
-      if (csound->oparms->msglevel & 7)
-        csound->Message(csound, Str("Macro definition for %*s\n"), p - s, s);
-      s = strchr(s, ':') + 1;                   /* skip arg bit */
-      if (UNLIKELY(s == NULL || s >= p))
-        csound->Die(csound, Str("Invalid macro name for --omacro"));
-      mname = (char*) mmalloc(csound, (p - s) + 1);
-      strncpy(mname, s, p - s);
-      mname[p - s] = '\0';
-      /* check if macro is already defined */
-      for (mm = PARM->macros; mm != NULL; mm = mm->next) {
-        if (strcmp(mm->name, mname) == 0)
-          break;
-      }
-      if (mm == NULL) {
-        mm = (MACRO*) mcalloc(csound, sizeof(MACRO));
-        mm->name = mname;
-        mm->next = PARM->macros;
-        PARM->macros = mm;
-      }
-      else
-        mfree(csound, mname);
-      mm->margs = MARGS;    /* Initial size */
-      mm->acnt = 0;
-      if (*p != '\0')
-        p++;
-      mm->body = (char*) mmalloc(csound, strlen(p) + 1);
-      strcpy(mm->body, p);
-      nn = nn->next;
-    }
-}
-
-
 #if 0
 /* Functions for working with grabbing input one line at a time */
 /* These two functions assume reading from a file */
@@ -947,7 +436,7 @@ int get_next_line(struct yyguts_t * yyg)
     PARM->nBuffer = 0;
 
     p = fgets(yyextra->buffer, lMaxBuffer, yyin);
-    printf("get_next_line: %s\n", yyextra->buffer);
+    csound->DebugMsg(csound,"get_next_line: %s\n", yyextra->buffer);
     if (UNLIKELY(p == NULL)) {
       if (ferror(yyin))
         return -1;
@@ -967,7 +456,7 @@ int get_next_char(char *b, int maxBuffer, struct yyguts_t* yyg)
     void *yyscanner = yyg;
     if (UNLIKELY( feof(yyin)  ))
       return 0;
-    printf("get_next_char: %s\n", yyextra->buffer);
+    csound->DebugMsg(csound,"get_next_char: %s\n", yyextra->buffer);
     while (  PARM->nBuffer >= PARM->lBuffer  ) {
       frc = get_next_line(yyg);
       if (UNLIKELY(  frc != 0  ))
@@ -986,3 +475,9 @@ char *csound_orcget_current_pointer(void *yyscanner)
     struct yyguts_t *yyg  = (struct yyguts_t*)yyscanner;
     return yyg->yy_c_buf_p;
 }
+
+int csound_orcget_locn(void *yyscanner)
+{
+    struct yyguts_t *yyg  = (struct yyguts_t*)yyscanner;
+    return PARM->locn;
+}
diff --git a/Engine/csound_orc.y b/Engine/csound_orc.y
index 8a46b65..045abbc 100644
--- a/Engine/csound_orc.y
+++ b/Engine/csound_orc.y
@@ -113,23 +113,22 @@
 %token T_INSTLIST
 
 %start orcfile
+%left '?'
 %left S_AND S_OR
 %nonassoc THEN_TOKEN ITHEN_TOKEN KTHEN_TOKEN ELSE_TOKEN /* NOT SURE IF THIS IS NECESSARY */
+%left '|'
+%left '&'
+%left S_LT S_GT S_LEQ S_GEQ S_EQ S_NEQ
+%left S_BITSHIFT_LEFT S_BITSHIFT_RIGHT
 %left '+' '-'
 %left '*' '/' '%'
 %left '^'
-%left '|'
-%left '&'
 %left '#'
-%left S_BITSHIFT_LEFT
-%left S_BITSHIFT_RIGHT
 %right '~'
 %right S_UNOT
 %right S_UMINUS
 %right S_ATAT
 %right S_AT
-%left '?'
-%nonassoc S_LT S_GT S_LEQ S_GEQ S_EQ S_NEQ
 %token S_GOTO
 %token T_HIGHEST
 %pure_parser
@@ -171,6 +170,8 @@ extern void csound_orcerror(PARSE_PARM *, void *, CSOUND *, TREE*, const char*);
 extern void add_udo_definition(CSOUND*, char *, char *, char *);
 extern ORCTOKEN *lookup_token(CSOUND*,char*,void*);
 #define LINE csound_orcget_lineno(scanner)
+#define LOCN csound_orcget_locn(scanner)
+extern int csound_orcget_locn(void *);
 extern int csound_orcget_lineno(void *);
 %}
 %%
@@ -201,20 +202,35 @@ rootstatement     : rootstatement topstatement
                   ;
 
 instlist  : INTEGER_TOKEN ',' instlist
-              { $$ = make_node(csound,LINE, T_INSTLIST,
-                               make_leaf(csound, LINE,
+          { $$ = make_node(csound, LINE, LOCN, T_INSTLIST,
+                               make_leaf(csound, LINE,LOCN,
                                          INTEGER_TOKEN, (ORCTOKEN *)$1), $3); }
-          | T_IDENT ',' instlist
+          | label ',' instlist
               {
 #ifdef PARCS
                   csp_orc_sa_instr_add(csound, ((ORCTOKEN *)$1)->lexeme);
 #endif
-                  $$ = make_node(csound,LINE, T_INSTLIST,
-                               make_leaf(csound, LINE,
+                  $$ = make_node(csound,LINE,LOCN, T_INSTLIST,
+                               make_leaf(csound, LINE,LOCN,
                                          T_IDENT, (ORCTOKEN *)$1), $3); }
-          | INTEGER_TOKEN { $$ = make_leaf(csound, LINE,
+          | '+' label ',' instlist
+              {
+                  TREE *ans;
+                  ans = make_leaf(csound, LINE,LOCN, T_IDENT, (ORCTOKEN *)$2);
+                  ans->rate = (int) '+';
+#ifdef PARCS
+                  csp_orc_sa_instr_add(csound, ((ORCTOKEN *)$2)->lexeme);
+#endif
+                  $$ = make_node(csound,LINE,LOCN, T_INSTLIST, ans, $4); }
+          | '+' label
+              {
+                  TREE *ans;
+                  ans = make_leaf(csound, LINE,LOCN, T_IDENT, (ORCTOKEN *)$2);
+                  ans->rate = (int) '+';
+                  $$ = ans; }
+          | INTEGER_TOKEN { $$ = make_leaf(csound, LINE,LOCN,
                                            INTEGER_TOKEN, (ORCTOKEN *)$1); }
-          | T_IDENT { $$ = make_leaf(csound, LINE, T_IDENT, (ORCTOKEN *)$1); }
+          | label { $$ = make_leaf(csound, LINE,LOCN, T_IDENT, (ORCTOKEN *)$1); }
           ;
 
 instrdecl : INSTR_TOKEN
@@ -227,7 +243,7 @@ instrdecl : INSTR_TOKEN
                 }
             statementlist ENDIN_TOKEN NEWLINE
                 {
-                    $$ = make_node(csound, LINE, INSTR_TOKEN, $3, $6);
+                    $$ = make_node(csound, LINE,LOCN, INSTR_TOKEN, $3, $6);
 #ifdef PARCS
                     csp_orc_sa_instr_finalize(csound);
 #endif
@@ -242,9 +258,13 @@ instrdecl : INSTR_TOKEN
                 }
           ;
 
+udoname   : T_IDENT    { $$ = (TREE *)$1; }
+          | T_OPCODE   { $$ = (TREE *)$1; }
+          | T_OPCODE0  { $$ = (TREE *)$1; }
+
 udodecl   : UDOSTART_DEFINITION
                                                 { udoflag = -2; }
-                  T_IDENT
+                  udoname
                                                 { udoflag = -1; }
                   ','
                                                 { udoflag = 0;}
@@ -260,13 +280,13 @@ udodecl   : UDOSTART_DEFINITION
               }
               statementlist UDOEND_TOKEN NEWLINE
               {
-                TREE *udoTop = make_leaf(csound, LINE, UDO_TOKEN,
+                TREE *udoTop = make_leaf(csound, LINE,LOCN, UDO_TOKEN,
                                          (ORCTOKEN *)NULL);
-                TREE *ident = make_leaf(csound, LINE, T_IDENT,
+                TREE *ident = make_leaf(csound, LINE,LOCN, T_IDENT,
                                         (ORCTOKEN *)$3);
-                TREE *udoAns = make_leaf(csound, LINE, UDO_ANS_TOKEN,
+                TREE *udoAns = make_leaf(csound, LINE,LOCN, UDO_ANS_TOKEN,
                                          (ORCTOKEN *)$7);
-                TREE *udoArgs = make_leaf(csound, LINE, UDO_ARGS_TOKEN,
+                TREE *udoArgs = make_leaf(csound, LINE,LOCN, UDO_ARGS_TOKEN,
                                           (ORCTOKEN *)$10);
                 udoflag = -1;
                 if (UNLIKELY(PARSER_DEBUG))
@@ -297,7 +317,7 @@ statementlist : statementlist statement
 topstatement : rident '=' expr NEWLINE
                 {
 
-                  TREE *ans = make_leaf(csound,LINE, '=', (ORCTOKEN *)$2);
+                  TREE *ans = make_leaf(csound,LINE,LOCN, '=', (ORCTOKEN *)$2);
                   ans->left = (TREE *)$1;
                   ans->right = (TREE *)$3;
                   /* ans->value->lexeme = get_assignment_type(csound,
@@ -311,7 +331,7 @@ topstatement : rident '=' expr NEWLINE
 
 statement : ident '=' expr NEWLINE
                 {
-                  TREE *ans = make_leaf(csound,LINE, '=', (ORCTOKEN *)$2);
+                  TREE *ans = make_leaf(csound,LINE,LOCN, '=', (ORCTOKEN *)$2);
                   ans->left = (TREE *)$1;
                   ans->right = (TREE *)$3;
                   /* ans->value->lexeme = get_assignment_type(csound,
@@ -327,15 +347,15 @@ statement : ident '=' expr NEWLINE
           | T_IDENT_T '=' T_IDENT_T NEWLINE
           {
               ORCTOKEN *op = lookup_token(csound, "#copytab", NULL);
-              TREE *ans = make_leaf(csound,LINE, T_OPCODE, op);
-              ans->left = make_leaf(csound,LINE, T_IDENT_T, (ORCTOKEN *)$1);
-              ans->right = make_leaf(csound,LINE, T_IDENT_T, (ORCTOKEN *)$3);
+              TREE *ans = make_leaf(csound,LINE,LOCN, T_OPCODE, op);
+              ans->left = make_leaf(csound,LINE,LOCN, T_IDENT_T, (ORCTOKEN *)$1);
+              ans->right = make_leaf(csound,LINE,LOCN, T_IDENT_T, (ORCTOKEN *)$3);
               $$ = ans;
           }
           | T_IDENT_T '[' iexp ']' '=' expr NEWLINE
           {
-              TREE *ans = make_leaf(csound,LINE, '=', (ORCTOKEN *)$5);
-              ans->left = make_leaf(csound,LINE, T_IDENT_T, (ORCTOKEN *)$1);
+              TREE *ans = make_leaf(csound,LINE,LOCN, '=', (ORCTOKEN *)$5);
+              ans->left = make_leaf(csound,LINE,LOCN, T_IDENT_T, (ORCTOKEN *)$1);
               ans->right = appendToTree(csound, $3, $6);
                   /* ans->value->lexeme = get_assignment_type(csound,
                      ans->left->value->lexeme, ans->right->value->lexeme); */
@@ -376,26 +396,26 @@ statement : ident '=' expr NEWLINE
                 }
           | LABEL_TOKEN
                 {
-                    $$ = make_leaf(csound,LINE, LABEL_TOKEN, (ORCTOKEN *)$1);
+                    $$ = make_leaf(csound,LINE,LOCN, LABEL_TOKEN, (ORCTOKEN *)$1);
                 }
           | goto label NEWLINE
                 {
                     $1->left = NULL;
-                    $1->right = make_leaf(csound, LINE,
+                    $1->right = make_leaf(csound, LINE,LOCN,
                                           LABEL_TOKEN, (ORCTOKEN *)$2);
                     $$ = $1;
                 }
           | IF_TOKEN bexpr goto label NEWLINE
                 {
                     $3->left = NULL;
-                    $3->right = make_leaf(csound, LINE,
+                    $3->right = make_leaf(csound, LINE,LOCN,
                                           LABEL_TOKEN, (ORCTOKEN *)$4);
-                    $$ = make_node(csound,LINE, IF_TOKEN, $2, $3);
+                    $$ = make_node(csound,LINE,LOCN, IF_TOKEN, $2, $3);
                 }
           | ifthen
           | UNTIL_TOKEN bexpr DO_TOKEN statementlist OD_TOKEN
               {
-                  $$ = make_leaf(csound,LINE, UNTIL_TOKEN, (ORCTOKEN *)$1);
+                  $$ = make_leaf(csound,LINE,LOCN, UNTIL_TOKEN, (ORCTOKEN *)$1);
                   $$->left = $2;
                   $$->right = $4;
               }
@@ -420,15 +440,15 @@ ans       : ident               { $$ = $1; }
 ifthen    : IF_TOKEN bexpr then NEWLINE statementlist ENDIF_TOKEN NEWLINE
           {
             $3->right = $5;
-            $$ = make_node(csound,LINE, IF_TOKEN, $2, $3);
+            $$ = make_node(csound,LINE,LOCN, IF_TOKEN, $2, $3);
             //print_tree(csound, "if-endif", $$);
           }
           | IF_TOKEN bexpr then NEWLINE statementlist ELSE_TOKEN
                                         statementlist ENDIF_TOKEN NEWLINE
           {
             $3->right = $5;
-            $3->next = make_node(csound,LINE, ELSE_TOKEN, NULL, $7);
-            $$ = make_node(csound,LINE, IF_TOKEN, $2, $3);
+            $3->next = make_node(csound,LINE,LOCN, ELSE_TOKEN, NULL, $7);
+            $$ = make_node(csound,LINE,LOCN, IF_TOKEN, $2, $3);
             //print_tree(csound, "if-else", $$);
 
           }
@@ -438,7 +458,7 @@ ifthen    : IF_TOKEN bexpr then NEWLINE statementlist ENDIF_TOKEN NEWLINE
                 csound->Message(csound, "IF-ELSEIF FOUND!\n");
             $3->right = $5;
             $3->next = $6;
-            $$ = make_node(csound, LINE, IF_TOKEN, $2, $3);
+            $$ = make_node(csound, LINE,LOCN, IF_TOKEN, $2, $3);
             //print_tree(csound, "if-elseif\n", $$);
           }
           | IF_TOKEN bexpr then NEWLINE statementlist elseiflist ELSE_TOKEN
@@ -449,7 +469,7 @@ ifthen    : IF_TOKEN bexpr then NEWLINE statementlist ENDIF_TOKEN NEWLINE
             $3->right = $5;
             $3->next = $6;
 
-            $$ = make_node(csound, LINE, IF_TOKEN, $2, $3);
+            $$ = make_node(csound, LINE,LOCN, IF_TOKEN, $2, $3);
 
             tempLastNode = $$;
 
@@ -457,7 +477,7 @@ ifthen    : IF_TOKEN bexpr then NEWLINE statementlist ENDIF_TOKEN NEWLINE
                 tempLastNode = tempLastNode->right->next;
             }
 
-            tempLastNode->right->next = make_node(csound, LINE,
+            tempLastNode->right->next = make_node(csound, LINE,LOCN,
                                                   ELSE_TOKEN, NULL, $8);
             //print_tree(csound, "IF TREE", $$);
           }
@@ -483,30 +503,31 @@ elseif    : ELSEIF_TOKEN bexpr then NEWLINE statementlist
                 if (UNLIKELY(PARSER_DEBUG))
                   csound->Message(csound, "ELSEIF FOUND!\n");
                 $3->right = $5;
-                $$ = make_node(csound,LINE, ELSEIF_TOKEN, $2, $3);
+                $$ = make_node(csound,LINE,LOCN, ELSEIF_TOKEN, $2, $3);
                 //print_tree(csound, "ELSEIF", $$);
             }
           ;
 
 then      : THEN_TOKEN
-            { $$ = make_leaf(csound,LINE, THEN_TOKEN, (ORCTOKEN *)$1); }
+            { $$ = make_leaf(csound,LINE,LOCN, THEN_TOKEN, (ORCTOKEN *)$1); }
           | KTHEN_TOKEN
-            { $$ = make_leaf(csound,LINE, KTHEN_TOKEN, (ORCTOKEN *)$1); }
+            { $$ = make_leaf(csound,LINE,LOCN, KTHEN_TOKEN, (ORCTOKEN *)$1); }
           | ITHEN_TOKEN
-            { $$ = make_leaf(csound,LINE, ITHEN_TOKEN, (ORCTOKEN *)$1); }
+            { $$ = make_leaf(csound,LINE,LOCN, ITHEN_TOKEN, (ORCTOKEN *)$1); }
           ;
 
 goto  : GOTO_TOKEN
-            { $$ = make_leaf(csound,LINE, GOTO_TOKEN, (ORCTOKEN *)$1); }
+            { $$ = make_leaf(csound,LINE,LOCN, GOTO_TOKEN, (ORCTOKEN *)$1); }
           | KGOTO_TOKEN
-            { $$ = make_leaf(csound,LINE, KGOTO_TOKEN, (ORCTOKEN *)$1); }
+            { $$ = make_leaf(csound,LINE,LOCN, KGOTO_TOKEN, (ORCTOKEN *)$1); }
           | IGOTO_TOKEN
-            { $$ = make_leaf(csound,LINE, IGOTO_TOKEN, (ORCTOKEN *)$1); }
+            { $$ = make_leaf(csound,LINE,LOCN, IGOTO_TOKEN, (ORCTOKEN *)$1); }
           ;
 
 /* Allow all words as a label */
 label : T_OPCODE    { $$ = (TREE *)$1; }
       | T_OPCODE0   { $$ = (TREE *)$1; }
+      | T_FUNCTION  { $$ = (TREE *)$1; }
       | T_IDENT_P   { $$ = (TREE *)$1; }
       | T_IDENT_I   { $$ = (TREE *)$1; }
       | T_IDENT_GI  { $$ = (TREE *)$1; }
@@ -523,6 +544,17 @@ label : T_OPCODE    { $$ = (TREE *)$1; }
       | T_IDENT_T   { $$ = (TREE *)$1; }
       | T_IDENT_GT  { $$ = (TREE *)$1; }
       | T_IDENT     { $$ = (TREE *)$1; }
+      | IF_TOKEN    { $$ = (TREE *)$1; }
+      | THEN_TOKEN  { $$ = (TREE *)$1; }
+      | ITHEN_TOKEN { $$ = (TREE *)$1; }
+      | KTHEN_TOKEN { $$ = (TREE *)$1; }
+      | ELSEIF_TOKEN { $$ = (TREE *)$1; }
+      | ENDIF_TOKEN { $$ = (TREE *)$1; }
+      | UNTIL_TOKEN { $$ = (TREE *)$1; }
+      | DO_TOKEN    { $$ = (TREE *)$1; }
+      | OD_TOKEN    { $$ = (TREE *)$1; }
+      | INTEGER_TOKEN { $$ = (TREE *)$1; }
+      | ENDIN_TOKEN { $$ = (TREE *)$1; }
       ;
 
 
@@ -535,61 +567,76 @@ exprlist  : exprlist ',' expr
                 {
                     /* $$ = make_node(',', $1, $3); */
                     $$ = appendToTree(csound, $1,
-                                      make_leaf(csound, LINE,
+                                      make_leaf(csound, LINE,LOCN,
                                                 LABEL_TOKEN, (ORCTOKEN *)$3));
                 }
           | exprlist ',' error
           | expr { $$ = $1;     }
-          | T_IDENT { $$ = make_leaf(csound, LINE, LABEL_TOKEN, (ORCTOKEN *)$1); }
+          | bexpr { $$ = $1; }
+          | T_IDENT { $$ = make_leaf(csound, LINE,LOCN, LABEL_TOKEN, (ORCTOKEN *)$1); }
+          | T_OPCODE   { $$ = make_leaf(csound, LINE,LOCN, LABEL_TOKEN, (ORCTOKEN *)$1); }
+          | T_FUNCTION { $$ = make_leaf(csound, LINE,LOCN, LABEL_TOKEN, (ORCTOKEN *)$1); }
           | /* null */          { $$ = NULL; }
           ;
 
 bexpr     : '(' bexpr ')'       { $$ = $2; }
-          | expr S_LE expr      { $$ = make_node(csound, LINE, S_LE, $1, $3); }
+          | expr S_LE expr      { $$ = make_node(csound, LINE,LOCN, S_LE, $1, $3); }
           | expr S_LE error
-          | expr S_GE expr      { $$ = make_node(csound, LINE, S_GE, $1, $3); }
+          | expr S_GE expr      { $$ = make_node(csound, LINE,LOCN, S_GE, $1, $3); }
           | expr S_GE error
-          | expr S_NEQ expr     { $$ = make_node(csound, LINE, S_NEQ, $1, $3); }
+          | expr S_NEQ expr     { $$ = make_node(csound, LINE,LOCN, S_NEQ, $1, $3); }
           | expr S_NEQ error
-          | expr S_EQ expr      { $$ = make_node(csound, LINE, S_EQ, $1, $3); }
+          | expr S_EQ expr      { $$ = make_node(csound, LINE,LOCN, S_EQ, $1, $3); }
           | expr S_EQ error
-          | expr '=' expr       { $$ = make_node(csound, LINE, S_EQ, $1, $3); }
+          | expr '=' expr       { $$ = make_node(csound, LINE,LOCN, S_EQ, $1, $3); }
           | expr '=' error
-          | expr S_GT expr      { $$ = make_node(csound, LINE, S_GT, $1, $3); }
+          | expr S_GT expr      { $$ = make_node(csound, LINE,LOCN, S_GT, $1, $3); }
           | expr S_GT error
-          | expr S_LT expr      { $$ = make_node(csound, LINE, S_LT, $1, $3); }
+          | expr S_LT expr      { $$ = make_node(csound, LINE,LOCN, S_LT, $1, $3); }
           | expr S_LT error
-          | bexpr S_AND bexpr   { $$ = make_node(csound, LINE, S_AND, $1, $3); }
+          | bexpr S_AND bexpr   { $$ = make_node(csound, LINE,LOCN, S_AND, $1, $3); }
           | bexpr S_AND error
-          | bexpr S_OR bexpr    { $$ = make_node(csound, LINE, S_OR, $1, $3); }
+          | bexpr S_OR bexpr    { $$ = make_node(csound, LINE,LOCN, S_OR, $1, $3); }
           | bexpr S_OR error
-          | '!' bexpr %prec S_UNOT { $$ = make_node(csound, LINE,
+          | '!' bexpr %prec S_UNOT { $$ = make_node(csound, LINE,LOCN,
                                                     S_UNOT, $2, NULL); }
-          | '!' error
+          | '!' error           { $$ = NULL }
           ;
 
 expr      : bexpr '?' expr ':' expr %prec '?'
-            { $$ = make_node(csound,LINE, '?', $1,
-                             make_node(csound, LINE, ':', $3, $5)); }
+            { $$ = make_node(csound,LINE,LOCN, '?', $1,
+                             make_node(csound, LINE,LOCN, ':', $3, $5)); }
           | bexpr '?' expr ':' error
           | bexpr '?' expr error
           | bexpr '?' error
           | iexp                { $$ = $1; }
           ;
 
-iexp      : iexp '+' iterm   { $$ = make_node(csound, LINE, '+', $1, $3); }
+iexp      : iexp '+' iexp   { $$ = make_node(csound, LINE,LOCN, '+', $1, $3); }
           | iexp '+' error
-          | iexp '-' iterm  { $$ = make_node(csound ,LINE, '-', $1, $3); }
+          | iexp '-' iexp  { $$ = make_node(csound ,LINE,LOCN, '-', $1, $3); }
           | iexp '-' error
+          | '-' iexp %prec S_UMINUS
+            {
+                $$ = make_node(csound,LINE,LOCN, S_UMINUS, NULL, $2);
+            }
+          | '-' error           { $$ = NULL }
+          | '+' iexp %prec S_UMINUS
+            {
+                $$ = $2;
+            }
+          | '+' error           { $$ = NULL }
           | iterm               { $$ = $1; }
           ;
 
-iterm     : iterm '*' ifac  { $$ = make_node(csound, LINE, '*', $1, $3); }
-          | iterm '*' error
-          | iterm '/' ifac    { $$ = make_node(csound, LINE, '/', $1, $3); }
-          | iterm '/' error
-          | iterm '%' ifac    { $$ = make_node(csound, LINE, '%', $1, $3); }
-          | iterm '%' error
+iterm     : iexp '*' iexp    { $$ = make_node(csound, LINE,LOCN, '*', $1, $3); }
+          | iexp '*' error
+          | iexp '/' iexp    { $$ = make_node(csound, LINE,LOCN, '/', $1, $3); }
+          | iexp '/' error
+          | iexp '^' iexp    { $$ = make_node(csound, LINE,LOCN, '^', $1, $3); }
+          | iexp '^' error
+          | iexp '%' iexp    { $$ = make_node(csound, LINE,LOCN, '%', $1, $3); }
+          | iexp '%' error
           | ifac                { $$ = $1; }
           ;
 
@@ -597,32 +644,28 @@ ifac      : ident               { $$ = $1; }
           | constant            { $$ = $1; }
           | T_IDENT_T '[' iexp ']'
           {
-              $$ = make_node(csound,LINE, S_TABREF,
-                             make_leaf(csound, LINE,
+              $$ = make_node(csound,LINE,LOCN, S_TABREF,
+                             make_leaf(csound, LINE,LOCN,
                                        T_IDENT_T, (ORCTOKEN*)$1), $3);
           }
-          | '-' ifac %prec S_UMINUS
-            {
-                $$ = make_node(csound,LINE, S_UMINUS, NULL, $2);
-            }
-          | '+' ifac %prec S_UMINUS
-            {
-                $$ = $2;
-            }
-          | ifac '^' ifac        { $$ = make_node(csound, LINE, '^', $1, $3); }
-          | ifac '|' ifac        { $$ = make_node(csound, LINE, '|', $1, $3); }
-          | ifac '&' ifac        { $$ = make_node(csound, LINE, '&', $1, $3); }
-          | ifac '#' ifac        { $$ = make_node(csound, LINE, '#', $1, $3); }
-          | ifac S_BITSHIFT_LEFT ifac   
-                 { $$ = make_node(csound, LINE, S_BITSHIFT_LEFT, $1, $3); }
-          | ifac S_BITSHIFT_RIGHT ifac
-                 { $$ = make_node(csound, LINE, S_BITSHIFT_RIGHT, $1, $3); }
-          | '~' ifac %prec S_UMINUS
-            { $$ = make_node(csound, LINE, '~', NULL, $2);}
-          | '-' error
+          | iexp '|' iexp        { $$ = make_node(csound, LINE,LOCN, '|', $1, $3); }
+          | iexp '|' error
+          | iexp '&' iexp        { $$ = make_node(csound, LINE,LOCN, '&', $1, $3); }
+          | iexp '&' error
+          | iexp '#' iexp        { $$ = make_node(csound, LINE,LOCN, '#', $1, $3); }
+          | iexp '#' error
+          | iexp S_BITSHIFT_LEFT iexp   
+                 { $$ = make_node(csound, LINE,LOCN, S_BITSHIFT_LEFT, $1, $3); }
+          | iexp S_BITSHIFT_LEFT error
+          | iexp S_BITSHIFT_RIGHT iexp
+                 { $$ = make_node(csound, LINE,LOCN, S_BITSHIFT_RIGHT, $1, $3); }
+          | iexp S_BITSHIFT_RIGHT error
+          | '~' iexp %prec S_UMINUS
+            { $$ = make_node(csound, LINE,LOCN, '~', NULL, $2);}
+          | '~' error         { $$ = NULL }
           | '(' expr ')'      { $$ = $2; }
-          | '(' expr error
-          | '(' error
+          | '(' expr error    { $$ = NULL }
+          | '(' error         { $$ = NULL }
           | function '(' exprlist ')'
             {
                 $1->left = NULL;
@@ -634,67 +677,67 @@ ifac      : ident               { $$ = $1; }
           ;
 
 function  : T_FUNCTION  { 
-             printf("FUNCTION ans=%p, token=%p %p\n",
+             csound->DebugMsg(csound,"FUNCTION ans=%p, token=%p %p\n",
                     $1, ((ORCTOKEN *)$1)->value);
 #ifdef PARCS
     //                if ((ORCTOKEN *)$1->value != 0)
              csp_orc_sa_interlocksf(csound, ((ORCTOKEN *)$1)->value);
 #endif
-             $$ = make_leaf(csound, LINE, T_FUNCTION, (ORCTOKEN *)$1); 
+             $$ = make_leaf(csound, LINE,LOCN, T_FUNCTION, (ORCTOKEN *)$1); 
                 }
 
-rident    : SRATE_TOKEN     { $$ = make_leaf(csound, LINE,
+rident    : SRATE_TOKEN     { $$ = make_leaf(csound, LINE,LOCN,
                                              SRATE_TOKEN, (ORCTOKEN *)$1); }
-          | KRATE_TOKEN     { $$ = make_leaf(csound, LINE,
+          | KRATE_TOKEN     { $$ = make_leaf(csound, LINE,LOCN,
                                              KRATE_TOKEN, (ORCTOKEN *)$1); }
-          | KSMPS_TOKEN     { $$ = make_leaf(csound, LINE,
+          | KSMPS_TOKEN     { $$ = make_leaf(csound, LINE,LOCN,
                                              KSMPS_TOKEN, (ORCTOKEN *)$1); }
-          | NCHNLS_TOKEN    { $$ = make_leaf(csound, LINE,
+          | NCHNLS_TOKEN    { $$ = make_leaf(csound, LINE,LOCN,
                                              NCHNLS_TOKEN, (ORCTOKEN *)$1); }
-          | NCHNLSI_TOKEN   { $$ = make_leaf(csound, LINE,
+          | NCHNLSI_TOKEN   { $$ = make_leaf(csound, LINE,LOCN,
                                              NCHNLSI_TOKEN, (ORCTOKEN *)$1); }
-          | ZERODBFS_TOKEN  { $$ = make_leaf(csound, LINE,
+          | ZERODBFS_TOKEN  { $$ = make_leaf(csound, LINE,LOCN,
                                              ZERODBFS_TOKEN, (ORCTOKEN *)$1); }
           ;
 
-ident     : T_IDENT_I  { $$ = make_leaf(csound, LINE, T_IDENT_I, (ORCTOKEN *)$1); }
-          | T_IDENT_K  { $$ = make_leaf(csound, LINE, T_IDENT_K, (ORCTOKEN *)$1); }
-          | T_IDENT_F  { $$ = make_leaf(csound, LINE, T_IDENT_F, (ORCTOKEN *)$1); }
-          | T_IDENT_W  { $$ = make_leaf(csound, LINE, T_IDENT_W, (ORCTOKEN *)$1); }
-          | T_IDENT_S  { $$ = make_leaf(csound, LINE, T_IDENT_S, (ORCTOKEN *)$1); }
-          | T_IDENT_T  { $$ = make_leaf(csound, LINE, T_IDENT_T, (ORCTOKEN *)$1); }
-          | T_IDENT_A  { $$ = make_leaf(csound, LINE, T_IDENT_A, (ORCTOKEN *)$1); }
-          | T_IDENT_P  { $$ = make_leaf(csound, LINE, T_IDENT_P, (ORCTOKEN *)$1); }
+ident     : T_IDENT_I  { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_I, (ORCTOKEN *)$1); }
+          | T_IDENT_K  { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_K, (ORCTOKEN *)$1); }
+          | T_IDENT_F  { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_F, (ORCTOKEN *)$1); }
+          | T_IDENT_W  { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_W, (ORCTOKEN *)$1); }
+          | T_IDENT_S  { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_S, (ORCTOKEN *)$1); }
+          | T_IDENT_T  { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_T, (ORCTOKEN *)$1); }
+          | T_IDENT_A  { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_A, (ORCTOKEN *)$1); }
+          | T_IDENT_P  { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_P, (ORCTOKEN *)$1); }
           | gident     { $$ = $1; }
           ;
 
-gident    : T_IDENT_GI { $$ = make_leaf(csound, LINE, T_IDENT_GI, (ORCTOKEN *)$1); }
-          | T_IDENT_GK { $$ = make_leaf(csound, LINE, T_IDENT_GK, (ORCTOKEN *)$1); }
-          | T_IDENT_GF { $$ = make_leaf(csound, LINE, T_IDENT_GF, (ORCTOKEN *)$1); }
-          | T_IDENT_GW { $$ = make_leaf(csound, LINE, T_IDENT_GW, (ORCTOKEN *)$1); }
-          | T_IDENT_GS { $$ = make_leaf(csound, LINE, T_IDENT_GS, (ORCTOKEN *)$1); }
-          | T_IDENT_GT { $$ = make_leaf(csound, LINE, T_IDENT_GS, (ORCTOKEN *)$1); }
-          | T_IDENT_GA { $$ = make_leaf(csound, LINE, T_IDENT_GA, (ORCTOKEN *)$1); }
+gident    : T_IDENT_GI { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_GI, (ORCTOKEN *)$1); }
+          | T_IDENT_GK { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_GK, (ORCTOKEN *)$1); }
+          | T_IDENT_GF { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_GF, (ORCTOKEN *)$1); }
+          | T_IDENT_GW { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_GW, (ORCTOKEN *)$1); }
+          | T_IDENT_GS { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_GS, (ORCTOKEN *)$1); }
+          | T_IDENT_GT { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_GS, (ORCTOKEN *)$1); }
+          | T_IDENT_GA { $$ = make_leaf(csound, LINE,LOCN, T_IDENT_GA, (ORCTOKEN *)$1); }
           ;
 
-constant  : INTEGER_TOKEN { $$ = make_leaf(csound, LINE,
+constant  : INTEGER_TOKEN { $$ = make_leaf(csound, LINE,LOCN,
                                            INTEGER_TOKEN, (ORCTOKEN *)$1); }
-          | NUMBER_TOKEN  { $$ = make_leaf(csound, LINE,
+          | NUMBER_TOKEN  { $$ = make_leaf(csound, LINE,LOCN,
                                            NUMBER_TOKEN, (ORCTOKEN *)$1); }
-          | STRING_TOKEN  { $$ = make_leaf(csound, LINE,
+          | STRING_TOKEN  { $$ = make_leaf(csound, LINE,LOCN,
                                            STRING_TOKEN, (ORCTOKEN *)$1); }
-          | SRATE_TOKEN   { $$ = make_leaf(csound, LINE,
-                                           NUMBER_TOKEN, (ORCTOKEN *)$1); }
-          | KRATE_TOKEN   { $$ = make_leaf(csound, LINE,
-                                           NUMBER_TOKEN, (ORCTOKEN *)$1); }
-          | KSMPS_TOKEN   { $$ = make_leaf(csound, LINE,
-                                           NUMBER_TOKEN, (ORCTOKEN *)$1); }
-          | NCHNLS_TOKEN  { $$ = make_leaf(csound, LINE,
-                                           NUMBER_TOKEN, (ORCTOKEN *)$1); }
-          | NCHNLSI_TOKEN { $$ = make_leaf(csound, LINE,
-                                           NUMBER_TOKEN, (ORCTOKEN *)$1); }
-          | ZERODBFS_TOKEN { $$ = make_leaf(csound, LINE,
-                                            NUMBER_TOKEN, (ORCTOKEN *)$1); }
+          | SRATE_TOKEN   { $$ = make_leaf(csound, LINE,LOCN,
+                                           SRATE_TOKEN, (ORCTOKEN *)$1); }
+          | KRATE_TOKEN   { $$ = make_leaf(csound, LINE,LOCN,
+                                           KRATE_TOKEN, (ORCTOKEN *)$1); }
+          | KSMPS_TOKEN   { $$ = make_leaf(csound, LINE,LOCN,
+                                           KSMPS_TOKEN, (ORCTOKEN *)$1); }
+          | NCHNLS_TOKEN  { $$ = make_leaf(csound, LINE,LOCN,
+                                           NCHNLS_TOKEN, (ORCTOKEN *)$1); }
+          | NCHNLSI_TOKEN { $$ = make_leaf(csound, LINE,LOCN,
+                                           NCHNLSI_TOKEN, (ORCTOKEN *)$1); }
+          | ZERODBFS_TOKEN { $$ = make_leaf(csound, LINE,LOCN,
+                                            ZERODBFS_TOKEN, (ORCTOKEN *)$1); }
           ;
 
 opcode0   : T_OPCODE0
@@ -702,11 +745,11 @@ opcode0   : T_OPCODE0
                 if (UNLIKELY(PARSER_DEBUG))
                   csound->Message(csound, "opcode0 $1=%p (%s)\n",
                                   $1,((ORCTOKEN *)$1)->lexeme );
-                $$ = make_leaf(csound,LINE, T_OPCODE0, (ORCTOKEN *)$1);
+                $$ = make_leaf(csound,LINE,LOCN, T_OPCODE0, (ORCTOKEN *)$1);
             }
           ;
 
-opcode    : T_OPCODE    { $$ = make_leaf(csound,LINE, T_OPCODE, (ORCTOKEN *)$1); }
+opcode    : T_OPCODE    { $$ = make_leaf(csound,LINE,LOCN, T_OPCODE, (ORCTOKEN *)$1); }
           ;
 
 %%
diff --git a/Engine/csound_orc_compile.c b/Engine/csound_orc_compile.c
index 78e136d..e71f426 100644
--- a/Engine/csound_orc_compile.c
+++ b/Engine/csound_orc_compile.c
@@ -27,6 +27,7 @@
 #include "csound_orc.h"
 #include <math.h>
 #include <ctype.h>
+#include <string.h>
 
 #include "oload.h"
 #include "insert.h"
@@ -56,6 +57,7 @@ typedef struct {
     int32     *typemask_tabl;
     int32     *typemask_tabl_in, *typemask_tabl_out;
     int       lgprevdef;
+    char      *filedir[101];
 } OTRAN_GLOBALS;
 
 static  int     gexist(CSOUND *, char *), gbloffndx(CSOUND *, char *);
@@ -71,6 +73,7 @@ static  NAME    *lclnamset(CSOUND *, char *);
 static  void    delete_global_namepool(CSOUND *);
 static  void    delete_local_namepool(CSOUND *);
 static  int     pnum(char *s) ;
+static  int     lgexist2(CSOUND *csound, const char *s);
 
 extern void     print_tree(CSOUND *, char *, TREE *);
 
@@ -140,10 +143,9 @@ static void intyperr(CSOUND *csound, int n, char *s, char *opname,
             n+1, s, t, expect, opname, line);
 }
 
+#if 0
 static void lblrequest(CSOUND *csound, char *s)
 {
-    int     req;
-
     /* for (req=0; req<ST(lblcnt); req++) */
     /*   if (strcmp(ST(lblreq)[req].label,s) == 0) */
     /*     return; */
@@ -156,6 +158,7 @@ static void lblrequest(CSOUND *csound, char *s)
     /* ST(lblreq)[req].reqline = ST(curline); */
     /* ST(lblreq)[req].label =s; */
 }
+#endif
 
 static inline void resetouts(CSOUND *csound)
 {
@@ -289,7 +292,7 @@ void set_xincod(CSOUND *csound, TEXT *tp, OENTRY *ep, int line)
       csound->DebugMsg(csound, "%s(%d): treqd: %c\n", __FILE__, __LINE__, treqd);
       if (treqd == 'l') {             /* if arg takes lbl  */
         csound->DebugMsg(csound, "treqd = l");
-        lblrequest(csound, s);        /*      req a search */
+        //        lblrequest(csound, s);        /*      req a search */
         continue;                     /*      chk it later */
       }
       tfound = argtyp2(csound, s);     /* else get arg type */
@@ -375,12 +378,12 @@ void set_xoutcod(CSOUND *csound, TEXT *tp, OENTRY *ep, int line)
       if (tfound == 'S' && n < 31)
         tp->xoutcod_str |= (1 << n);
       csound->DebugMsg(csound, "treqd %c, tfound %c", treqd, tfound);
-      if (tfound_m & ARGTYP_w)
-        if (ST(lgprevdef)) {
-          synterr(csound, Str("output name previously used, "
-                              "type '%c' must be uniquely defined, line %d"),
-                  tfound, line);
-        }
+      /* if (tfound_m & ARGTYP_w) */
+      /*   if (ST(lgprevdef)) { */
+      /*     synterr(csound, Str("output name previously used, " */
+      /*                         "type '%c' must be uniquely defined, line %d"), */
+      /*             tfound, line); */
+      /*   } */
       /* IV - Oct 31 2002: simplified code */
       if (!(tfound_m & ST(typemask_tabl_out)[(unsigned char) treqd])) {
         synterr(csound, Str("output arg '%s' illegal type (for opcode %s),"
@@ -401,8 +404,10 @@ OPTXT *create_opcode(CSOUND *csound, TREE *root, INSTRTXT *ip)
     OPTXT *optxt, *retOptxt = NULL;
     char *arg;
     int opnum;
-    int n;
+    int n, nreqd;;
 
+    /* printf("%d(%d): tree=%p\n", __FILE__, __LINE__, root); */
+    /* print_tree(csound, "create_opcode", root); */
     optxt = (OPTXT *) mcalloc(csound, (int32)sizeof(OPTXT));
     tp = &(optxt->t);
 
@@ -433,7 +438,18 @@ OPTXT *create_opcode(CSOUND *csound, TREE *root, INSTRTXT *ip)
                         "create_opcode: Found node for opcode %s\n",
                         root->value->lexeme);
 
-      opnum = find_opcode(csound, root->value->lexeme);
+      nreqd = tree_arg_list_count(root->left);   /* outcount */
+      /* replace opcode if needed */
+      if (!strcmp(root->value->lexeme, "xin") &&
+          nreqd > OPCODENUMOUTS_LOW) {
+        if (nreqd > OPCODENUMOUTS_HIGH)
+          opnum = find_opcode(csound, ".xin256");
+        else
+          opnum = find_opcode(csound, ".xin64");
+      }
+      else {
+        opnum = find_opcode(csound, root->value->lexeme);
+      }
 
       /* INITIAL SETUP */
       tp->opnum = opnum;
@@ -447,8 +463,8 @@ OPTXT *create_opcode(CSOUND *csound, TREE *root, INSTRTXT *ip)
         int outcount = tree_arg_list_count(root->left);
         int argcount = 0;
 
-//            csound->Message(csound, "Tree: In Count: %d\n", incount);
-//            csound->Message(csound, "Tree: Out Count: %d\n", outcount);
+        //    csound->Message(csound, "Tree: In Count: %d\n", incount);
+        //    csound->Message(csound, "Tree: Out Count: %d\n", outcount);
 
         size_t m = sizeof(ARGLST) + (incount - 1) * sizeof(char*);
         tp->inlist = (ARGLST*) mrealloc(csound, tp->inlist, m);
@@ -462,7 +478,7 @@ OPTXT *create_opcode(CSOUND *csound, TREE *root, INSTRTXT *ip)
         for (inargs = root->right; inargs != NULL; inargs = inargs->next) {
           /* INARGS */
 
-//                csound->Message(csound, "IN ARG TYPE: %d\n", inargs->type);
+          //      csound->Message(csound, "IN ARG TYPE: %d\n", inargs->type);
 
           arg = inargs->value->lexeme;
 
@@ -496,6 +512,12 @@ OPTXT *create_opcode(CSOUND *csound, TREE *root, INSTRTXT *ip)
             if (n > ip->pmax)  ip->pmax = n;
           }
           else {
+            if (arg[0] == 'w' &&
+                lgexist2(csound, arg) != 0) {
+              synterr(csound, Str("output name previously used, "
+                                  "type 'w' must be uniquely defined, line %d"),
+                      root->line);
+            }
             lgbuild(csound, arg, 0);
           }
 
@@ -540,7 +562,7 @@ OPTXT *create_opcode(CSOUND *csound, TREE *root, INSTRTXT *ip)
       csound->Message(csound,
                       Str("create_opcode: No rule to handle statement of "
                           "type %d\n"), root->type);
-      print_tree(csound, NULL, root);
+      if (PARSER_DEBUG) print_tree(csound, NULL, root);
     }
 
     if (retOptxt == NULL) {
@@ -740,15 +762,17 @@ INSTRTXT *create_instrument(CSOUND *csound, TREE *root)
       ip->t.inlist->arg[0] = strsav_string(csound, c);
 
       csound->Free(csound, c);
-    } else if (root->left->type == T_IDENT) { /* named instrument */
+    } else if (root->left->type == T_IDENT &&
+               !(root->left->left != NULL &&
+                 root->left->left->type == UDO_ANS_TOKEN)) { /* named instrument */
       int32  insno_priority = -1L;
       c = root->left->value->lexeme;
 
       if (PARSER_DEBUG)
           csound->Message(csound, Str("create_instrument: instr name %s\n"), c);
 
-      if (UNLIKELY(*c == '+')) {
-        insno_priority--; c++;
+      if (UNLIKELY(root->left->rate == (int) '+')) {
+        insno_priority--;
       }
       /* IV - Oct 31 2002: some error checking */
       if (UNLIKELY(!check_instr_name(c))) {
@@ -1029,12 +1053,46 @@ void csound_orc_compile(CSOUND *csound, TREE *root)
             if (PARSER_DEBUG) print_tree(csound, "Top of loop\n", p);
             if (p->left) {
               //print_tree(csound, "Left\n", p->left);
-              if (p->left->type == INTEGER_TOKEN)
+              if (p->left->type == INTEGER_TOKEN) {
                 insert_instrtxt(csound, instrtxt, p->left->value->value);
+              }
+              else if (p->left->type == T_IDENT) {
+                int32  insno_priority = -1L;
+                char *c;
+                c = p->left->value->lexeme;
+
+                if (UNLIKELY(p->left->rate == (int) '+')) {
+                  insno_priority--;
+                }
+                if (UNLIKELY(!check_instr_name(c))) {
+                  synterr(csound, Str("invalid name for instrument"));
+                }
+                if (UNLIKELY(!named_instr_alloc(csound, c, instrtxt, insno_priority))) {
+                  synterr(csound, Str("instr %s redefined"), c);
+                }
+                instrtxt->insname = c;
+              }
             }
             else {
-              if (p->type == INTEGER_TOKEN)
+              if (p->type == INTEGER_TOKEN) {
                 insert_instrtxt(csound, instrtxt, p->value->value);
+              }
+              else if (p->type == T_IDENT) {
+                int32  insno_priority = -1L;
+                char *c;
+                c = p->value->lexeme;
+
+                if (UNLIKELY(p->rate == (int) '+')) {
+                  insno_priority--;
+                }
+                if (UNLIKELY(!check_instr_name(c))) {
+                  synterr(csound, Str("invalid name for instrument"));
+                }
+                if (UNLIKELY(!named_instr_alloc(csound, c, instrtxt, insno_priority))) {
+                  synterr(csound, Str("instr %s redefined"), c);
+                }
+                instrtxt->insname = c;
+              }
               break;
             }
             p = p->right;
@@ -1082,7 +1140,7 @@ void csound_orc_compile(CSOUND *csound, TREE *root)
         csound->Message(csound,
                         Str("Unknown TREE node of type %d found in root.\n"),
                         current->type);
-        /* if (PARSER_DEBUG) */ print_tree(csound, NULL, current);
+        if (PARSER_DEBUG) print_tree(csound, NULL, current);
       }
 
       current = current->next;
@@ -1801,3 +1859,27 @@ char argtyp2(CSOUND *csound, char *s)
       return(c);
     else return('?');
 }
+
+/* For diagnostics map file name or macro name to an index */
+int file_to_int(CSOUND *csound, const char *name)
+{
+    extern char *strdup(const char *);
+    int n = 0;
+    char **filedir = csound->filedir;
+    while (filedir[n] && n<63) {        /* Do we have it already? */
+      if (strcmp(filedir[n], name)==0) return n; /* yes */
+      n++;                                       /* look again */
+    }
+    // Not there so add
+    // ensure long enough?
+    if (n==63) {
+      //csound->Die(csound, "Too many file/macros\n");
+      filedir[n] = strdup("**unknown**");
+    }
+    else {
+      filedir[n] = strdup(name);
+      filedir[n+1] = NULL;
+    }
+    return n;
+}
+
diff --git a/Engine/csound_orc_expressions.c b/Engine/csound_orc_expressions.c
index 709fe95..b686d2c 100644
--- a/Engine/csound_orc_expressions.c
+++ b/Engine/csound_orc_expressions.c
@@ -33,15 +33,14 @@ extern ORCTOKEN *make_token(CSOUND *, char *);
 extern ORCTOKEN *make_label(CSOUND *, char *);
 extern int find_opcode(CSOUND *csound, char *opname);
 
-TREE* create_boolean_expression(CSOUND*, TREE*, int);
-TREE * create_expression(CSOUND *, TREE *, int);
+TREE* create_boolean_expression(CSOUND*, TREE*, int, int);
+TREE * create_expression(CSOUND *, TREE *, int, int);
 
 static int genlabs = 300;
 
 char *create_out_arg(CSOUND *csound, char outype)
 {
     char* s = (char *)csound->Malloc(csound, 16);
-    
     switch(outype) {
     case 'a': sprintf(s, "#a%d", csound->acount++); break;
     case 'K':
@@ -50,7 +49,6 @@ char *create_out_arg(CSOUND *csound, char outype)
     case 'b': sprintf(s, "#b%d", csound->bcount++); break;
     default:  sprintf(s, "#i%d", csound->icount++); break;
     }
-
     return s;
 }
 
@@ -95,7 +93,6 @@ char *set_expression_type(CSOUND *csound, char * op, char arg1, char arg2)
 char * get_boolean_arg(CSOUND *csound, int type)
 {
     char* s = (char *)csound->Malloc(csound, 8);
-    //    type = 1;
     sprintf(s, "#%c%d", type?'B':'b',csound->Bcount++);
 
     return s;
@@ -218,7 +215,7 @@ TREE * create_goto_token(CSOUND *csound, char * booleanVar,
     return opTree;
 }
 
-/* THIS PROBABLY NEEDS TO CHANGE TO RETURN DIFFERENT GOTO 
+/* THIS PROBABLY NEEDS TO CHANGE TO RETURN DIFFERENT GOTO
    TYPES LIKE IGOTO, ETC */
 TREE *create_simple_goto_token(CSOUND *csound, TREE *label, int type)
 {
@@ -283,11 +280,12 @@ static int is_boolean_expression_node(TREE *node)
     return 0;
 }
 
-static TREE *create_cond_expression(CSOUND *csound, TREE *root, int line)
+static TREE *create_cond_expression(CSOUND *csound, TREE *root, int line, int locn)
 {
     char *op = (char*)mmalloc(csound, 4), arg1, arg2, ans, *outarg = NULL;
     char outype;
-    TREE *anchor = create_boolean_expression(csound, root->left, line), *last;
+    TREE *anchor = create_boolean_expression(csound, root->left, line, locn);
+    TREE *last;
     TREE * opTree;
     TREE *b;
     TREE *c = root->right->left, *d = root->right->right;
@@ -297,7 +295,7 @@ static TREE *create_cond_expression(CSOUND *csound, TREE *root, int line)
     }
     b= create_ans_token(csound, last->left->value->lexeme);
     if (is_expression_node(c)) {
-      last->next = create_expression(csound, c, line);
+      last->next = create_expression(csound, c, line, locn);
       /* TODO - Free memory of old left node
          freetree */
       last = last->next;
@@ -307,7 +305,7 @@ static TREE *create_cond_expression(CSOUND *csound, TREE *root, int line)
       c = create_ans_token(csound, last->left->value->lexeme);
     }
     if (is_expression_node(d)) {
-      last->next = create_expression(csound, d, line);
+      last->next = create_expression(csound, d, line, locn);
       /* TODO - Free memory of old left node
          freetree */
       last = last->next;
@@ -349,7 +347,7 @@ static TREE *create_cond_expression(CSOUND *csound, TREE *root, int line)
  * Create a chain of Opcode (OPTXT) text from the AST node given. Called from
  * create_opcode when an expression node has been found as an argument
  */
-TREE * create_expression(CSOUND *csound, TREE *root, int line)
+TREE * create_expression(CSOUND *csound, TREE *root, int line, int locn)
 {
     char *op, arg1, arg2, c, *outarg = NULL;
     TREE *anchor = NULL, *last;
@@ -357,10 +355,10 @@ TREE * create_expression(CSOUND *csound, TREE *root, int line)
     int opnum;
     /* HANDLE SUB EXPRESSIONS */
 
-    if (root->type=='?') return create_cond_expression(csound, root, line);
+    if (root->type=='?') return create_cond_expression(csound, root, line, locn);
 
     if (is_expression_node(root->left)) {
-      anchor = create_expression(csound, root->left, line);
+      anchor = create_expression(csound, root->left, line, locn);
 
       /* TODO - Free memory of old left node
          freetree */
@@ -372,7 +370,7 @@ TREE * create_expression(CSOUND *csound, TREE *root, int line)
     }
 
     if (is_expression_node(root->right)) {
-      TREE * newRight = create_expression(csound, root->right, line);
+      TREE * newRight = create_expression(csound, root->right, line, locn);
       if (anchor == NULL) {
         anchor = newRight;
       }
@@ -448,17 +446,17 @@ TREE * create_expression(CSOUND *csound, TREE *root, int line)
       if (c == 'p' || c == 'c')   c = 'i';
       sprintf(op, "%s.%c", root->value->lexeme, c);
       if (UNLIKELY(PARSER_DEBUG))
-        csound->Message(csound, "Found OP: %s\n", op);   
-      /* VL: some non-existing functions were appearing here 
-         looking for opcodes that did not exist */   
-      if ((opnum = find_opcode(csound, op))==0) {    
+        csound->Message(csound, "Found OP: %s\n", op);
+      /* VL: some non-existing functions were appearing here
+         looking for opcodes that did not exist */
+      if ((opnum = find_opcode(csound, op))==0) {
                                 /* This is a little like overkill */
         strncpy(op, "##error", 80);
         opnum = find_opcode(csound, op);
-	csound->Warning(csound,
+        csound->Warning(csound,
                     Str("error: function %s with arg type %c not found, "
                         "line %d \n"),
-                    root->value->lexeme, c, line);        
+                    root->value->lexeme, c, line);
       }
       c = csound->opcodlst[opnum].outypes[0];
       outarg = create_out_arg(csound, c);
@@ -492,8 +490,20 @@ TREE * create_expression(CSOUND *csound, TREE *root, int line)
       outarg = set_expression_type(csound, op, arg1, arg2);
       break;
     case '~':
-      strncpy(op, "not", 80);
-      outarg = set_expression_type(csound, op, arg1, '\0');
+      { int outype = 'i';
+        strncpy(op, "not.", 80);
+        if (arg2 == 'a') {
+          strncat(op, "a", 80);
+          outype = 'a';
+        }
+        else if (arg2 == 'k') {
+          strncat(op, "k", 80);
+          outype = 'k';
+        }
+        else
+          strncat(op, "i", 80);
+        outarg = create_out_arg(csound, outype);
+      }
       break;
     }
     opTree = create_opcode_token(csound, op);
@@ -502,12 +512,14 @@ TREE * create_expression(CSOUND *csound, TREE *root, int line)
       opTree->right->next = root->right;
       opTree->left = create_ans_token(csound, outarg);
       opTree->line = line;
+      opTree->locn = locn;
       //print_tree(csound, "making expression", opTree);
     }
     else {
       opTree->right = root->right;
       opTree->left = create_ans_token(csound, outarg);
       opTree->line = line;
+      opTree->locn = locn;
     }
 
     if (anchor == NULL) {
@@ -528,7 +540,7 @@ TREE * create_expression(CSOUND *csound, TREE *root, int line)
  * Create a chain of Opcode (OPTXT) text from the AST node given. Called from
  * create_opcode when an expression node has been found as an argument
  */
-TREE * create_boolean_expression(CSOUND *csound, TREE *root, int line)
+TREE * create_boolean_expression(CSOUND *csound, TREE *root, int line, int locn)
 {
     char *op, *outarg;
     TREE *anchor = NULL, *last;
@@ -538,7 +550,7 @@ TREE * create_boolean_expression(CSOUND *csound, TREE *root, int line)
     csound->Message(csound, "Creating boolean expression\n");
     /* HANDLE SUB EXPRESSIONS */
     if (is_boolean_expression_node(root->left)) {
-      anchor = create_boolean_expression(csound, root->left, line);
+      anchor = create_boolean_expression(csound, root->left, line, locn);
       last = anchor;
       while (last->next != NULL) {
         last = last->next;
@@ -547,8 +559,8 @@ TREE * create_boolean_expression(CSOUND *csound, TREE *root, int line)
          freetree */
       root->left = create_ans_token(csound, last->left->value->lexeme);
     } else if (is_expression_node(root->left)) {
-      anchor = create_expression(csound, root->left, line);
-      
+      anchor = create_expression(csound, root->left, line, locn);
+
       /* TODO - Free memory of old left node
          freetree */
       last = anchor;
@@ -558,9 +570,9 @@ TREE * create_boolean_expression(CSOUND *csound, TREE *root, int line)
       root->left = create_ans_token(csound, last->left->value->lexeme);
     }
 
-    
+
     if (is_boolean_expression_node(root->right)) {
-      TREE * newRight = create_boolean_expression(csound, root->right, line);
+      TREE * newRight = create_boolean_expression(csound, root->right, line, locn);
       if (anchor == NULL) {
         anchor = newRight;
       }
@@ -581,7 +593,7 @@ TREE * create_boolean_expression(CSOUND *csound, TREE *root, int line)
       root->right = create_ans_token(csound, last->left->value->lexeme);
     }
     else if (is_expression_node(root->right)) {
-      TREE * newRight = create_expression(csound, root->right, line);
+      TREE * newRight = create_expression(csound, root->right, line, locn);
       if (anchor == NULL) {
         anchor = newRight;
       }
@@ -593,15 +605,16 @@ TREE * create_boolean_expression(CSOUND *csound, TREE *root, int line)
         last->next = newRight;
       }
       last = newRight;
-        
+
       while (last->next != NULL) {
         last = last->next;
       }
-        
+
       /* TODO - Free memory of old right node
          freetree */
       root->right = create_ans_token(csound, last->left->value->lexeme);
       root->line = line;
+      root->locn = locn;
     }
 
     op = mcalloc(csound, 80);
@@ -673,7 +686,7 @@ static TREE *create_synthetic_ident(CSOUND *csound, int32 count)
       csound->Message(csound, "Creating Synthetic T_IDENT: %s\n", label);
     token = make_token(csound, label);
     token->type = T_IDENT;
-    return make_leaf(csound, -1, T_IDENT, token);
+    return make_leaf(csound, -1, 0, T_IDENT, token);
 }
 
 TREE *create_synthetic_label(CSOUND *csound, int32 count)
@@ -683,7 +696,7 @@ TREE *create_synthetic_label(CSOUND *csound, int32 count)
     sprintf(label, "__synthetic_%ld:", count);
     if (UNLIKELY(PARSER_DEBUG))
       csound->Message(csound, "Creating Synthetic label: %s\n", label);
-    return make_leaf(csound, -1, LABEL_TOKEN, make_label(csound, label));
+    return make_leaf(csound, -1, 0, LABEL_TOKEN, make_label(csound, label));
 }
 
 /* Expands expression nodes into opcode calls
@@ -727,7 +740,7 @@ TREE *csound_orc_expand_expressions(CSOUND * csound, TREE *root)
         if (UNLIKELY(PARSER_DEBUG))
           csound->Message(csound, "Instrument found\n");
         current->right = csound_orc_expand_expressions(csound, current->right);
-        //        print_tree(csound, "AFTER", current);
+        //print_tree(csound, "AFTER", current);
         break;
       case UDO_TOKEN:
         if (UNLIKELY(PARSER_DEBUG)) csound->Message(csound, "UDO found\n");
@@ -747,7 +760,8 @@ TREE *csound_orc_expand_expressions(CSOUND * csound, TREE *root)
               right->type == GOTO_TOKEN) {
             if (UNLIKELY(PARSER_DEBUG))
               csound->Message(csound, "Found if-goto\n");
-            expressionNodes = create_boolean_expression(csound, left, right->line);
+            expressionNodes =
+              create_boolean_expression(csound, left, right->line, right->locn);
             /* Set as anchor if necessary */
             if (anchor == NULL) {
               anchor = expressionNodes;
@@ -803,7 +817,8 @@ TREE *csound_orc_expand_expressions(CSOUND * csound, TREE *root)
               else if (ifBlockCurrent->type == ELSEIF_TOKEN) { /* JPff code */
                 // print_tree(csound, "ELSEIF case\n", ifBlockCurrent);
                 ifBlockCurrent->type = IF_TOKEN;
-                ifBlockCurrent = make_node(csound, ifBlockCurrent->line, ELSE_TOKEN,
+                ifBlockCurrent = make_node(csound, ifBlockCurrent->line,
+                                           ifBlockCurrent->locn, ELSE_TOKEN,
                                            NULL, ifBlockCurrent);
                 //tempLeft = NULL;
                 /*   ifBlockLast->next = */
@@ -816,7 +831,8 @@ TREE *csound_orc_expand_expressions(CSOUND * csound, TREE *root)
               }
 
               expressionNodes =
-                create_boolean_expression(csound, tempLeft, tempLeft->line);
+                create_boolean_expression(csound, tempLeft,
+                                          tempLeft->line, tempLeft->locn);
                             /* Set as anchor if necessary */
               if (ifBlockStart == NULL) {
                 ifBlockStart = expressionNodes;
@@ -857,11 +873,11 @@ TREE *csound_orc_expand_expressions(CSOUND * csound, TREE *root)
                 gotoToken->next = statements;
                 /* VL: added as means of dealing with empty conditionals,
                    may need revision */
-                if(statements == NULL) 
+                if(statements == NULL)
                    csound->Die(csound,
                                Str("error: non-existent statement in "
                                    "conditional, line %d \n"),
-                               last->right->line); 
+                               last->right->line);
                 while (statements->next != NULL) {
                   statements = statements->next;
                 }
@@ -955,25 +971,28 @@ TREE *csound_orc_expand_expressions(CSOUND * csound, TREE *root)
           expressionNodes =
             ifBlockLast->next = create_boolean_expression(csound,
                                                           ifBlockCurrent->left,
-                                                          ifBlockCurrent->line);
-          ifBlockLast = ifBlockLast->next;
+                                                          ifBlockCurrent->line,
+                                                          ifBlockCurrent->locn);
+          while (ifBlockLast->next != NULL) {
+            ifBlockLast = ifBlockLast->next;
+          }
           /* *** Stage 3: Create the goto *** */
           statements = tempRight;     /* the body of the loop */
           labelEnd = create_synthetic_label(csound, endLabelCounter);
           gotoToken =
             create_goto_token(csound,
-                              expressionNodes->left->value->lexeme,
+                              ifBlockLast->left->value->lexeme,
                               labelEnd,
                               type =
                               ((argtyp2(csound,
-                                  expressionNodes->left->value->lexeme)=='B')
+                                  ifBlockLast->left->value->lexeme)=='B')
                                ||
                                (argtyp2(csound,
                                    tempRight->value->lexeme) == 'k')));
           /* relinking */
-          tempRight = ifBlockLast->next;
+          /* tempRight = ifBlockLast->next; */
           ifBlockLast->next = gotoToken;
-          ifBlockLast->next->next = tempRight;
+          /* ifBlockLast->next->next = tempRight; */
           gotoToken->right->next = labelEnd;
           gotoToken->next = statements;
           labelEnd = create_synthetic_label(csound, endLabelCounter);
@@ -990,32 +1009,105 @@ TREE *csound_orc_expand_expressions(CSOUND * csound, TREE *root)
             statements->next = gotoTopLabelToken;
             gotoTopLabelToken->next = labelEnd;
           }
+          labelEnd->next = ifBlockCurrent->next;
           ifBlockLast = labelEnd;
           ifBlockCurrent = tempRight->next;
         }
         break;
       case LABEL_TOKEN:
         break;
+      case '=':
+        {
+          TREE* currentArg = current->right;
+          TREE* currentAns = current->left;
+          //csound->Message(csound, "Assignment Statement.\n");
+          if (currentArg->left || currentArg->right) {
+            int anstype, argtype;
+            //csound->Message(csound, "expansion case\n");
+            anstype = argtyp2(csound, current->left->value->lexeme);
+            //print_tree(csound, "Assignment\n", current);
+            expressionNodes =
+              create_expression(csound, currentArg,
+                                currentArg->line, currentArg->locn);
+            //print_tree(csound, "expressionNodes\n", currentArg);
+            currentArg = expressionNodes;
+            while (currentArg->next) currentArg = currentArg->next;
+            //print_tree(csound, "currentArg\n", currentArg);
+            argtype = argtyp2(csound, currentArg->left->value->lexeme);
+            //printf("anstype = %c argtype = %c\n", anstype, argtype);
+            if (anstype=='a' && argtype!='a') {
+              //upsample
+              //goto maincase;                     /* Wastes time and space */
+              TREE* opTree = create_opcode_token(csound, "upsamp");
+              opTree->right = make_leaf(csound, current->line, current->locn,
+                                        T_IDENT_K, currentArg->left->value);
+              opTree->left = current->left;
+              opTree->line = current->line;
+              opTree->locn = current->locn;
+              opTree->next = current->next;
+              //print_tree(csound, "opTree\n", opTree);
+              currentArg->next = opTree;
+              //print_tree(csound, "currentArg\n", currentArg);
+              //print_tree(csound, "making expression", opTree);
+
+              /* current->right = currentArg->left; /\* Should this copy? *\/ */
+              /* current->next = NULL; */
+              /* currentArg->next = current; */
+              //print_tree(csound, "becomes\n", expressionNodes);
+              memmove(current, expressionNodes, sizeof(TREE));
+              //print_tree(csound, "current\n", current);
+              break;
+            }
+            else if (anstype=='k' && argtype=='i') {
+              TREE* opTree = create_opcode_token(csound, "k.i");
+              opTree->right = make_leaf(csound, current->line, current->locn,
+                                        T_IDENT_K, currentArg->left->value);
+              opTree->left = current->left;
+              opTree->line = current->line;
+              opTree->locn = current->locn;
+              opTree->next = current->next;
+              currentArg->next = opTree;
+              memmove(current, expressionNodes, sizeof(TREE));
+              //print_tree(csound, "current\n", current);
+              break;
+            }
+            else {
+              mfree(csound, currentArg->left);
+              currentArg->left = currentAns;
+              currentArg->next = current->next;
+              //print_tree(csound, "becomes\n", expressionNodes);
+              memmove(current, expressionNodes, sizeof(TREE));
+            }
+            break;
+          }
+        }
       default:
+        //maincase:
         { /* This is WRONG in optional argsq */
           TREE* previousArg = NULL;
           TREE* currentArg = current->right;
           if (UNLIKELY(PARSER_DEBUG))
             csound->Message(csound, "Found Statement.\n");
-
-          /* if (current->type == '=') { */
-          /*   //csound->Message(csound, "Assignment Statement.\n"); */
-          /* } */
           while (currentArg != NULL) {
             TREE* last;
             TREE *nextArg;
             TREE *newArgTree;
-            if (is_expression_node(currentArg)) {
+            int is_bool = 0;
+            if (is_expression_node(currentArg) ||
+                (is_bool = is_boolean_expression_node(currentArg))) {
               char * newArg;
               if (UNLIKELY(PARSER_DEBUG))
                 csound->Message(csound, "Found Expression.\n");
-              expressionNodes =
-                create_expression(csound, currentArg, currentArg->line);
+              if (is_bool == 0) {
+                expressionNodes =
+                  create_expression(csound, currentArg,
+                                    currentArg->line, currentArg->locn);
+              }
+              else {
+                expressionNodes =
+                  create_boolean_expression(csound, currentArg,
+                                            currentArg->line, currentArg->locn);
+              }
 
               /* Set as anchor if necessary */
               if (anchor == NULL) {
@@ -1077,4 +1169,3 @@ TREE *csound_orc_expand_expressions(CSOUND * csound, TREE *root)
 
     return anchor;
 }
-
diff --git a/Engine/csound_orc_semantics.c b/Engine/csound_orc_semantics.c
index b4286ce..400e854 100644
--- a/Engine/csound_orc_semantics.c
+++ b/Engine/csound_orc_semantics.c
@@ -39,34 +39,112 @@ void print_tree(CSOUND *, char *, TREE *);
 /*     return a; */
 /* } */
 
+static TREE * create_fun_token(CSOUND *csound, TREE *right, char *fname)
+{
+    TREE *ans;
+    ans = (TREE*)mmalloc(csound, sizeof(TREE));
+    if (UNLIKELY(ans == NULL)) exit(1);
+    ans->type = T_FUNCTION;
+    ans->value = make_token(csound, fname);
+    ans->value->type = T_FUNCTION;
+    ans->left = NULL;
+    ans->right = right;
+    ans->next = NULL;
+    ans->len = 0;
+    ans->rate = -1;
+    return ans;
+}
+
+static TREE * optimize_ifun(CSOUND *csound, TREE *root)
+{
+    /* print_tree(csound, "optimize_ifun: before", root); */
+    switch(root->right->type) {
+    case INTEGER_TOKEN:
+    case NUMBER_TOKEN:       /* i(num)    -> num      */
+    case T_IDENT_I:          /* i(ivar)   -> ivar     */
+    case T_IDENT_GI:         /* i(givar)  -> givar    */
+    case T_IDENT_P:          /* i(pN)     -> pN       */
+      root = root->right;
+      break;
+    case T_IDENT_K:          /* i(kvar)   -> i(kvar)  */
+    case T_IDENT_GK:         /* i(gkvar)  -> i(gkvar) */
+      break;
+    case T_FUNCTION:         /* i(fn(x))  -> fn(i(x)) */
+      {
+        TREE *funTree = root->right;
+        funTree->right = create_fun_token(csound, funTree->right, "i");
+        root = funTree;
+      }
+      break;
+    default:                 /* i(A op B) -> i(A) op i(B) */
+      if(root->right->left != NULL)
+        root->right->left = create_fun_token(csound, root->right->left, "i");
+      if(root->right->right != NULL)
+        root->right->right = create_fun_token(csound, root->right->right, "i");
+      root->right->next = root->next;
+      root = root->right;
+      break;
+    }
+    /* print_tree(csound, "optimize_ifun: after", root); */
+    return root;
+}
 
 /** Verifies and optimise; constant fold and opcodes and args are correct*/
-TREE * verify_tree(CSOUND *csound, TREE *root) 
+static TREE * verify_tree1(CSOUND *csound, TREE *root) 
 {
-    TREE* ans;
+    TREE *ans, *last;
     double lval, rval;
     //csound->Message(csound, "Verifying AST (NEED TO IMPLEMENT)\n");
-    //    print_tree(csound, "Verify", root);
-    if (root==NULL) return NULL;
-    if (root->right) {
-      root->right = verify_tree(csound, root->right);
+    //print_tree(csound, "Verify", root);
+    if (root->right && root->right->type != T_INSTLIST) {
+      if (root->type == T_OPCODE || root->type == T_OPCODE0) {
+        last = root->right;
+        while (last->next) {
+          /* we optimize the i() functions in the opcode */
+          if (last->next->type == T_FUNCTION &&
+              (strcmp(last->next->value->lexeme, "i") == 0)) {
+            TREE *temp = optimize_ifun(csound, last->next);
+            temp->next = last->next->next;
+            last->next = temp;
+          }
+          last = last->next;
+        }
+      }
+      if (root->right->type == T_FUNCTION &&                 
+          (strcmp(root->right->value->lexeme, "i") == 0)) {  /* i() function */
+        root->right = optimize_ifun(csound, root->right);
+      }
+      last = root->right;
+      while (last->next) {
+        last->next = verify_tree1(csound, last->next);
+        last = last->next;
+      }
+      root->right = verify_tree1(csound, root->right);
       if (root->left) {
-        root->left= verify_tree(csound, root->left);
-        if ((root->left->type  == INTEGER_TOKEN || root->left->type  == NUMBER_TOKEN) &&
-            (root->right->type == INTEGER_TOKEN || root->right->type == NUMBER_TOKEN)) {
+        if (root->left->type == T_FUNCTION &&                 
+            (strcmp(root->left->value->lexeme, "i") == 0)) {  /* i() function */
+          root->left = optimize_ifun(csound, root->left);
+        }
+        root->left= verify_tree1(csound, root->left);
+        if ((root->left->type  == INTEGER_TOKEN ||
+             root->left->type  == NUMBER_TOKEN) &&
+            (root->right->type == INTEGER_TOKEN ||
+             root->right->type == NUMBER_TOKEN)) {
+          //print_tree(csound, "numerical case\n", root);
           lval = (root->left->type == INTEGER_TOKEN ?
                   (double)root->left->value->value :root->left->value->fvalue);
           rval = (root->right->type == INTEGER_TOKEN ?
-                  (double)root->right->value->value :root->left->value->fvalue);
+                  (double)root->right->value->value :root->right->value->fvalue);
           ans = root->left;
           ans->type = ans->value->type = NUMBER_TOKEN;
-          /* **** Something wrong here -- subtractuon confuses memory **** */
+          /* **** Something wrong here -- subtraction confuses memory **** */
           switch (root->type) {
           case '+':
             ans->value->fvalue = lval+rval;
             ans->value->lexeme =
               (char*)mrealloc(csound, ans->value->lexeme, 24);
             sprintf(ans->value->lexeme, "%f", ans->value->fvalue);
+            ans->next = root->next;
             //Memory leak!! 
             //mfree(csound, root); mfree(csound root->right);
             return ans;
@@ -75,6 +153,7 @@ TREE * verify_tree(CSOUND *csound, TREE *root)
             ans->value->lexeme =
               (char*)mrealloc(csound, ans->value->lexeme, 24);
             sprintf(ans->value->lexeme, "%f", ans->value->fvalue);
+            ans->next = root->next;
             //Memory leak!! 
             //mfree(csound, root); mfree(csound, root->right);
             return ans;
@@ -83,6 +162,7 @@ TREE * verify_tree(CSOUND *csound, TREE *root)
             ans->value->lexeme =
               (char*)mrealloc(csound, ans->value->lexeme, 24);
             sprintf(ans->value->lexeme, "%f", ans->value->fvalue);
+            ans->next = root->next;
             //Memory leak!! 
             //mfree(csound, root); mfree(csound, root->right);
             return ans;
@@ -91,6 +171,7 @@ TREE * verify_tree(CSOUND *csound, TREE *root)
             ans->value->lexeme =
               (char*)mrealloc(csound, ans->value->lexeme, 24);
             sprintf(ans->value->lexeme, "%f", ans->value->fvalue);
+            ans->next = root->next;
             //Memory leak!! 
             //mfree(csound, root); mfree(csound, root->right);
             return ans;
@@ -118,7 +199,7 @@ TREE * verify_tree(CSOUND *csound, TREE *root)
                root->right->type == NUMBER_TOKEN) {
         switch (root->type) {
         case S_UMINUS:
-          print_tree(csound, "root", root);
+          /*print_tree(csound, "root", root);*/
           ans = root->right;
           ans->value->fvalue = -(ans->type==INTEGER_TOKEN ? ans->value->value
                                  : ans->value->fvalue);
@@ -126,7 +207,8 @@ TREE * verify_tree(CSOUND *csound, TREE *root)
             (char*)mrealloc(csound, ans->value->lexeme, 24);
           sprintf(ans->value->lexeme, "%f", ans->value->fvalue);
           ans->type = ans->value->type = NUMBER_TOKEN;
-          print_tree(csound, "ans", ans);
+          //print_tree(csound, "ans", ans);
+          ans->next = root->next;
           return ans;
         default:
           break;
@@ -136,11 +218,28 @@ TREE * verify_tree(CSOUND *csound, TREE *root)
     return root;
 }
 
+TREE * verify_tree(CSOUND *csound, TREE *root) 
+{
+    TREE *original=root, *last = NULL;
+    while (root) {
+      TREE *xx = verify_tree1(csound, root);
+      if (xx != root) {
+        xx->next = root->next;
+        if (last) last->next = xx;
+        else original = xx;
+      }
+      last = root;
+      root = root->next;
+    }
+    return original;
+}
 
 /* BISON PARSER FUNCTION */
 int csound_orcwrap()
 {
+#ifdef DEBUG
     printf("\n === END OF INPUT ===\n");
+#endif
     return (1);
 }
 
@@ -217,7 +316,8 @@ TREE* appendToTree(CSOUND * csound, TREE *first, TREE *newlast) {
 
 
 /* USED BY PARSER TO ASSEMBLE TREE NODES */
-TREE* make_node(CSOUND *csound, int line, int type, TREE* left, TREE* right)
+TREE* make_node(CSOUND *csound, int line, int locn, int type,
+                TREE* left, TREE* right)
 {
     TREE *ans;
     ans = (TREE*)mmalloc(csound, sizeof(TREE));
@@ -232,11 +332,12 @@ TREE* make_node(CSOUND *csound, int line, int type, TREE* left, TREE* right)
     ans->len = 2;
     ans->rate = -1;
     ans->line = line;
+    ans->locn  = locn;
     csound->DebugMsg(csound, "%s(%d) line = %d\n", __FILE__, __LINE__, line);
     return ans;
 }
 
-TREE* make_leaf(CSOUND *csound, int line, int type, ORCTOKEN *v)
+TREE* make_leaf(CSOUND *csound, int line, int locn, int type, ORCTOKEN *v)
 {
     TREE *ans;
     ans = (TREE*)mmalloc(csound, sizeof(TREE));
@@ -252,6 +353,7 @@ TREE* make_leaf(CSOUND *csound, int line, int type, ORCTOKEN *v)
     ans->rate = -1;
     ans->value = v;
     ans->line = line;
+    ans->locn  = locn;
     csound->DebugMsg(csound, "%s(%d) line = %d\n", __FILE__, __LINE__, line);
     return ans;
 }
@@ -313,69 +415,69 @@ void print_tree_i(CSOUND *csound, TREE *l, int n)
     case '(':
     case ')':
     case '=':
-      csound->Message(csound,"%c:(%d)\n", l->type, l->line); break;
+      csound->Message(csound,"%c:(%d:%d)\n", l->type, l->line, l->locn); break;
     case NEWLINE:
-      csound->Message(csound,"NEWLINE:(%d)\n", l->line); break;
+      csound->Message(csound,"NEWLINE:(%d:%d)\n", l->line, l->locn); break;
     case S_NEQ:
-      csound->Message(csound,"S_NEQ:(%d)\n", l->line); break;
+      csound->Message(csound,"S_NEQ:(%d:%d)\n", l->line, l->locn); break;
     case S_AND:
-      csound->Message(csound,"S_AND:(%d)\n", l->line); break;
+      csound->Message(csound,"S_AND:(%d:%d)\n", l->line, l->locn); break;
     case S_OR:
-      csound->Message(csound,"S_OR:(%d)\n", l->line); break;
+      csound->Message(csound,"S_OR:(%d:%d)\n", l->line, l->locn); break;
     case S_LT:
-      csound->Message(csound,"S_LT:(%d)\n", l->line); break;
+      csound->Message(csound,"S_LT:(%d:%d)\n", l->line, l->locn); break;
     case S_LE:
-      csound->Message(csound,"S_LE:(%d)\n", l->line); break;
+      csound->Message(csound,"S_LE:(%d:%d)\n", l->line, l->locn); break;
     case S_EQ:
-      csound->Message(csound,"S_EQ:(%d)\n", l->line); break;
+      csound->Message(csound,"S_EQ:(%d:%d)\n", l->line, l->locn); break;
     case S_TASSIGN:
-      csound->Message(csound,"S_TASSIGN:(%d)\n", l->line); break;
+      csound->Message(csound,"S_TASSIGN:(%d:%d)\n", l->line, l->locn); break;
     case S_TABREF:
-      csound->Message(csound,"S_TABREF:(%d)\n", l->line); break;
+      csound->Message(csound,"S_TABREF:(%d:%d)\n", l->line, l->locn); break;
     case S_GT:
-      csound->Message(csound,"S_GT:(%d)\n", l->line); break;
+      csound->Message(csound,"S_GT:(%d:%d)\n", l->line, l->locn); break;
     case S_GE:
-      csound->Message(csound,"S_GE:(%d)\n", l->line); break;
+      csound->Message(csound,"S_GE:(%d:%d)\n", l->line, l->locn); break;
     case LABEL_TOKEN:
       csound->Message(csound,"LABEL_TOKEN: %s\n", l->value->lexeme); break;
     case IF_TOKEN:
-      csound->Message(csound,"IF_TOKEN:(%d)\n", l->line); break;
+      csound->Message(csound,"IF_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case THEN_TOKEN:
-          csound->Message(csound,"THEN_TOKEN:(%d)\n", l->line); break;
+          csound->Message(csound,"THEN_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case ITHEN_TOKEN:
-          csound->Message(csound,"ITHEN_TOKEN:(%d)\n", l->line); break;
+          csound->Message(csound,"ITHEN_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case KTHEN_TOKEN:
-          csound->Message(csound,"KTHEN_TOKEN:(%d)\n", l->line); break;
+          csound->Message(csound,"KTHEN_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case ELSEIF_TOKEN:
-          csound->Message(csound,"ELSEIF_TOKEN:(%d)\n", l->line); break;
+          csound->Message(csound,"ELSEIF_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case ELSE_TOKEN:
-          csound->Message(csound,"ELSE_TOKEN:(%d)\n", l->line); break;
+          csound->Message(csound,"ELSE_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case UNTIL_TOKEN:
-          csound->Message(csound,"UNTIL_TOKEN:(%d)\n", l->line); break;
+          csound->Message(csound,"UNTIL_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case DO_TOKEN:
-          csound->Message(csound,"DO_TOKEN:(%d)\n", l->line); break;
+          csound->Message(csound,"DO_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case OD_TOKEN:
-          csound->Message(csound,"OD_TOKEN:(%d)\n", l->line); break;
+          csound->Message(csound,"OD_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case GOTO_TOKEN:
-      csound->Message(csound,"GOTO_TOKEN:(%d)\n", l->line); break;
+      csound->Message(csound,"GOTO_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case IGOTO_TOKEN:
-      csound->Message(csound,"IGOTO_TOKEN:(%d)\n", l->line); break;
+      csound->Message(csound,"IGOTO_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case KGOTO_TOKEN:
-      csound->Message(csound,"KGOTO_TOKEN:(%d)\n", l->line); break;
+      csound->Message(csound,"KGOTO_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case SRATE_TOKEN:
-      csound->Message(csound,"SRATE_TOKEN:(%d)\n", l->line); break;
+      csound->Message(csound,"SRATE_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case KRATE_TOKEN:
-      csound->Message(csound,"KRATE_TOKEN:(%d)\n", l->line); break;
+      csound->Message(csound,"KRATE_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case ZERODBFS_TOKEN:
-      csound->Message(csound,"ZERODFFS_TOKEN:(%d)\n", l->line); break;
+      csound->Message(csound,"ZERODFFS_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case KSMPS_TOKEN:
-      csound->Message(csound,"KSMPS_TOKEN:(%d)\n", l->line); break;
+      csound->Message(csound,"KSMPS_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case NCHNLS_TOKEN:
-      csound->Message(csound,"NCHNLS_TOKEN:(%d)\n", l->line); break;
+      csound->Message(csound,"NCHNLS_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case NCHNLSI_TOKEN:
-      csound->Message(csound,"NCHNLSI_TOKEN:(%d)\n", l->line); break;
+      csound->Message(csound,"NCHNLSI_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case INSTR_TOKEN:
-      csound->Message(csound,"INSTR_TOKEN:(%d)\n", l->line); break;
+      csound->Message(csound,"INSTR_TOKEN:(%d:%d)\n", l->line, l->locn); break;
     case STRING_TOKEN:
       csound->Message(csound,"STRING_TOKEN: %s\n", l->value->lexeme); break;
     case T_IDENT:
@@ -419,9 +521,9 @@ void print_tree_i(CSOUND *csound, TREE *l, int n)
     case NUMBER_TOKEN:
       csound->Message(csound,"NUMBER_TOKEN: %f\n", l->value->fvalue); break;
     case S_ANDTHEN:
-      csound->Message(csound,"S_ANDTHEN:(%d)\n", l->line); break;
+      csound->Message(csound,"S_ANDTHEN:(%d:%d)\n", l->line, l->locn); break;
     case S_APPLY:
-      csound->Message(csound,"S_APPLY:(%d)\n", l->line); break;
+      csound->Message(csound,"S_APPLY:(%d:%d)\n", l->line, l->locn); break;
     case T_OPCODE0:
       csound->Message(csound,"T_OPCODE0: %s\n", l->value->lexeme); break;
     case T_OPCODE:
@@ -429,11 +531,11 @@ void print_tree_i(CSOUND *csound, TREE *l, int n)
     case T_FUNCTION:
       csound->Message(csound,"T_FUNCTION: %s\n", l->value->lexeme); break;
     case S_UMINUS:
-        csound->Message(csound,"S_UMINUS:(%d)\n", l->line); break;
+        csound->Message(csound,"S_UMINUS:(%d:%d)\n", l->line, l->locn); break;
     case T_INSTLIST:
-        csound->Message(csound,"T_INSTLIST:(%d)\n", l->line); break;
+        csound->Message(csound,"T_INSTLIST:(%d:%d)\n", l->line, l->locn); break;
     default:
-      csound->Message(csound,"unknown:%d(%d)\n", l->type, l->line);
+      csound->Message(csound,"unknown:%d(%d:%d)\n", l->type, l->line, l->locn);
     }
 
     print_tree_i(csound, l->left,n+1);
@@ -636,7 +738,7 @@ static void print_tree_xml(CSOUND *csound, TREE *l, int n, int which)
       csound->Message(csound,"name=\"unknown\"(%d)", l->type);
     }
 
-    csound->Message(csound, " (%d)>\n", l->line);
+    csound->Message(csound, " (%d:%d)>\n", l->line, l->locn);
 
     print_tree_xml(csound, l->left,n+1, TREE_LEFT);
     print_tree_xml(csound, l->right,n+1, TREE_RIGHT);
@@ -689,36 +791,36 @@ void handle_optional_args(CSOUND *csound, TREE *l)
         switch (ep->intypes[incnt]) {
         case 'O':             /* Will this work?  Doubtful code.... */
         case 'o':
-          temp = make_leaf(csound, l->line, INTEGER_TOKEN, make_int(csound, "0"));
+          temp = make_leaf(csound, l->line, l->locn, INTEGER_TOKEN, make_int(csound, "0"));
           if (l->right==NULL) l->right = temp;
           else appendToTree(csound, l->right, temp);
           break;
         case 'P':
         case 'p':
-          temp = make_leaf(csound, l->line, INTEGER_TOKEN, make_int(csound, "1"));
+          temp = make_leaf(csound, l->line, l->locn, INTEGER_TOKEN, make_int(csound, "1"));
           if (l->right==NULL) l->right = temp;
           else appendToTree(csound, l->right, temp);
           break;
         case 'q':
-          temp = make_leaf(csound, l->line, INTEGER_TOKEN, make_int(csound, "10"));
+          temp = make_leaf(csound, l->line, l->locn, INTEGER_TOKEN, make_int(csound, "10"));
           if (l->right==NULL) l->right = temp;
           else appendToTree(csound, l->right, temp);
           break;
 
         case 'V':
         case 'v':
-          temp = make_leaf(csound, l->line, NUMBER_TOKEN, make_num(csound, ".5"));
+          temp = make_leaf(csound, l->line, l->locn, NUMBER_TOKEN, make_num(csound, ".5"));
           if (l->right==NULL) l->right = temp;
           else appendToTree(csound, l->right, temp);
           break;
         case 'h':
-          temp = make_leaf(csound, l->line, INTEGER_TOKEN, make_int(csound, "127"));
+          temp = make_leaf(csound, l->line, l->locn, INTEGER_TOKEN, make_int(csound, "127"));
           if (l->right==NULL) l->right = temp;
           else appendToTree(csound, l->right, temp);
           break;
         case 'J':
         case 'j':
-          temp = make_leaf(csound, l->line, INTEGER_TOKEN, make_int(csound, "-1"));
+          temp = make_leaf(csound, l->line, l->locn, INTEGER_TOKEN, make_int(csound, "-1"));
           if (l->right==NULL) l->right = temp;
           else appendToTree(csound, l->right, temp);
           break;
@@ -730,7 +832,7 @@ void handle_optional_args(CSOUND *csound, TREE *l)
         default:
           synterr(csound,
                   Str("insufficient required arguments for opcode %s on line %d\n"),
-                  ep->opname, l->line);
+                  ep->opname, l->line, l->locn);
         }
         incnt++;
       } while (incnt < nreqd);
diff --git a/Engine/csound_pre.lex b/Engine/csound_pre.lex
new file mode 100644
index 0000000..f006634
--- /dev/null
+++ b/Engine/csound_pre.lex
@@ -0,0 +1,951 @@
+%{
+
+ /*
+    csound_pre.l:
+
+    Copyright (C) 2011
+    John ffitch
+
+    This file is part of Csound.
+
+    The Csound Library is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    Csound 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 Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with Csound; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include "csoundCore.h"
+#include "corfile.h"
+#define YY_DECL int yylex (CSOUND *csound, yyscan_t yyscanner)
+void comment(yyscan_t);
+void do_comment(yyscan_t);
+void do_include(CSOUND *, int, yyscan_t);
+void do_macro_arg(CSOUND *, char *, yyscan_t);
+void do_macro(CSOUND *, char *, yyscan_t);
+void do_umacro(CSOUND *, char *, yyscan_t);
+void do_ifdef(CSOUND *, char *, yyscan_t);
+void do_ifdef_skip_code(CSOUND *, yyscan_t);
+// static void print_csound_predata(CSOUND *,char *,yyscan_t);
+void csound_pre_line(CORFIL*, yyscan_t);
+
+#include "parse_param.h"
+
+#define YY_EXTRA_TYPE  PRE_PARM *
+#define PARM    yyget_extra(yyscanner)
+
+#define YY_USER_INIT {csound_pre_scan_string(csound->orchstr->body, yyscanner); \
+    csound_preset_lineno(csound->orcLineOffset, yyscanner); yyg->yy_flex_debug_r=1;}
+%}
+%option reentrant
+%option noyywrap
+%option prefix="csound_pre"
+%option outfile="Engine/csound_prelex.c"
+%option stdout
+
+WHITE           ^[ \t]*
+NEWLINE         (\n|\r\n?)
+STSTR           \"
+ESCAPE          \\.
+XSTR            \{\{([^}]|\}[^}])*\}\}
+IDENT           [a-zA-Z_][a-zA-Z0-9_]*
+IDENTN          [a-zA-Z0-9_]+
+MACRONAME       "$"[a-zA-Z0-9_]+
+MACRONAMED      "$"[a-zA-Z0-9_]+\.
+MACRONAMEA      "$"[a-zA-Z0-9_]+\(
+MACRONAMEDA     "$"[a-zA-Z0-9_]+\.\(
+MACRO           [a-zA-Z0-9_]+\(
+
+STCOM           \/\*
+INCLUDE         "#include"
+DEFINE          #[ \t]*define
+UNDEF           "#undef"
+IFDEF           #ifn?def
+ELSE            #else[ \t]*(;.*)?$
+END             #end(if)?[ \t]*(;.*)?\n
+CONT            \\[ \t]*(;.*)?\n
+
+%x incl
+%x macro
+%x umacro
+%x ifdef
+
+%%
+
+{CONT}          { csound_preset_lineno(1+csound_preget_lineno(yyscanner),
+                                       yyscanner);
+                }
+{NEWLINE}       { csound_preset_lineno(1+csound_preget_lineno(yyscanner),
+                                       yyscanner);
+                  corfile_putc('\n', csound->expanded_orc); 
+                  csound_pre_line(csound->expanded_orc, yyscanner);
+                }
+"//"            {
+                  if (PARM->isString != 1) {
+                    comment(yyscanner);
+                    corfile_putc('\n', csound->expanded_orc); 
+                    csound_pre_line(csound->expanded_orc, yyscanner);
+                  }
+                  else {
+                    corfile_puts(yytext, csound->expanded_orc);
+                  }
+                }
+";"             {
+                  if (PARM->isString != 1) {
+                    comment(yyscanner); 
+                    corfile_putc('\n', csound->expanded_orc); 
+                    csound_pre_line(csound->expanded_orc, yyscanner);
+                  }
+                  else {
+                    corfile_puts(yytext, csound->expanded_orc);
+                  }
+                  //corfile_putline(csound_preget_lineno(yyscanner), csound->expanded_orc);
+                }
+{STCOM}         {
+                  if (PARM->isString != 1)
+                    do_comment(yyscanner);
+                  else
+                    corfile_puts(yytext, csound->expanded_orc);
+                }
+{ESCAPE}        { corfile_puts(yytext, csound->expanded_orc); }
+{STSTR}         {
+                  corfile_putc('"', csound->expanded_orc);
+                  PARM->isString = !PARM->isString;
+                }
+{XSTR}          {
+                  char c, *str = yytext;
+                  if (PARM->isString == 1)
+                    yyless(2);
+                  while ((c = *str++) != '\0') {
+                    switch(c) {
+                    case '\r': if (*str == '\n') continue;
+                    case '\n':
+                      csound_preset_lineno(1+csound_preget_lineno(yyscanner),
+                                           yyscanner);
+                      break;
+                    default: break;
+                    }
+                  }
+                  corfile_puts(yytext, csound->expanded_orc);
+                }
+{MACRONAME}     {
+                   MACRO     *mm, *mfound=NULL;
+                   int       i, len, mlen;
+                   //print_csound_predata(csound, "Macro call", yyscanner);
+                   len = strlen(yytext)-1;
+                   mlen = 0;
+                   for (i=len; i>0; i--) { /* Find the definition */
+                     mm = PARM->macros;
+                     while (mm != NULL) {
+                       if (!(strncmp(yytext+1, mm->name, i))) {
+                         mfound = mm;
+                         mlen = i;
+                         if (strlen(mm->name) == mlen)
+                           goto cont;
+                       }
+                       mm = mm->next;
+                     }
+                   }
+                   cont:
+                   mm = mfound;
+                   if (UNLIKELY(mm == NULL)) {
+                     csound->Message(csound,Str("Undefined macro: '%s'"), yytext);
+                     csound->LongJmp(csound, 1);
+                   }
+                   if (mlen<len) yyless(mlen+1);
+                   /* Need to read from macro definition */
+                   /* csound->DebugMsg(csound, "found macro %s\nstack ptr = %d\n", */
+                   /*         yytext+1, PARM->macro_stack_ptr); */
+                   /* print_csound_predata(csound, "macro found", yyscanner); */
+                   /* ??fiddle with buffers I guess */
+                   if (UNLIKELY(PARM->macro_stack_ptr >= MAX_INCLUDE_DEPTH )) {
+                     csound->Die(csound, Str("Includes nested too deeply"));
+                   }
+                   PARM->alt_stack[PARM->macro_stack_ptr].n = 0;
+                   PARM->alt_stack[PARM->macro_stack_ptr].line =
+                     csound_preget_lineno(yyscanner);
+                   PARM->alt_stack[PARM->macro_stack_ptr++].s = NULL;
+                   /* csound->DebugMsg(csound,"Push %p macro stack; new body #%s#\n", */
+                   /*           PARM->macros, mm->body); */
+                   /* csound->DebugMsg(csound,"Push buffer %p -> ", YY_CURRENT_BUFFER); */
+                   yypush_buffer_state(YY_CURRENT_BUFFER, yyscanner);
+                   csound_preset_lineno(1, yyscanner);
+                   PARM->lstack[++PARM->depth] =
+                     (strchr(mm->body,'\n') ?file_to_int(csound, yytext) : 63);
+                   yy_scan_string(mm->body, yyscanner);
+                   csound->DebugMsg(csound,"%p\n", YY_CURRENT_BUFFER);
+                  }
+{MACRONAMED}    {
+                   MACRO     *mm = PARM->macros;
+                   yytext[yyleng-1] = '\0';
+                   while (mm != NULL) {  /* Find the definition */
+                     if (!(strcmp(yytext+1, mm->name)))
+                       break;
+                     mm = mm->next;
+                   }
+                   if (UNLIKELY(mm == NULL)) {
+                     csound->Message(csound,Str("Undefined macro: '%s'"), yytext);
+                     csound->LongJmp(csound, 1);
+                   }
+                   /* Need to read from macro definition */
+                   /* ??fiddle with buffers I guess */
+                   if (UNLIKELY(PARM->macro_stack_ptr >= MAX_INCLUDE_DEPTH )) {
+                     csound->Message(csound, Str("Includes nested too deeply\n"));
+                     exit(1);
+                   }
+                   PARM->alt_stack[PARM->macro_stack_ptr].n = 0;
+                   PARM->alt_stack[PARM->macro_stack_ptr].line =
+                     csound_preget_lineno(yyscanner);
+                   PARM->alt_stack[PARM->macro_stack_ptr++].s = NULL;
+                   yypush_buffer_state(YY_CURRENT_BUFFER, yyscanner);
+                   csound_preset_lineno(1, yyscanner);
+                   PARM->lstack[++PARM->depth] =
+                     (strchr(mm->body,'\n') ?file_to_int(csound, yytext) : 63);
+                   yy_scan_string(mm->body, yyscanner);
+                   csound->DebugMsg(csound,"%p\n", YY_CURRENT_BUFFER);
+                 }
+{MACRONAMEA}    {
+                   MACRO     *mm = PARM->macros;
+                   int c, i, j;
+                   /* csound->DebugMsg(csound,"Macro with arguments call %s\n", yytext); */
+                   yytext[yyleng-1] = '\0';
+                   while (mm != NULL) {  /* Find the definition */
+                     csound->DebugMsg(csound,"Check %s against %s\n", yytext+1, mm->name);
+                     if (!(strcmp(yytext+1, mm->name)))
+                       break;
+                     mm = mm->next;
+                   }
+                   if (UNLIKELY(mm == NULL)) {
+                     csound->Message(csound,Str("Undefined macro: '%s'"), yytext);
+                     csound->LongJmp(csound, 1);
+                   }
+                   /* Need to read from macro definition */
+                   csound->DebugMsg(csound,"Looking for %d args\n", mm->acnt);
+                   for (j = 0; j < mm->acnt; j++) {
+                     char  term = (j == mm->acnt - 1 ? ')' : '\'');
+ /* Compatability */
+                     char  trm1 = (j == mm->acnt - 1 ? ')' : '#');
+                     MACRO *nn = (MACRO*) mmalloc(csound, sizeof(MACRO));
+                     int   size = 100;
+                     nn->name = mmalloc(csound, strlen(mm->arg[j]) + 1);
+                     csound->DebugMsg(csound,"Arg %d: %s\n", j+1, mm->arg[j]);
+                     strcpy(nn->name, mm->arg[j]);
+                     csound->Message(csound, "defining argument %s ",
+                                        nn->name);
+                     i = 0;
+                     nn->body = (char*) mmalloc(csound, 100);
+                     while ((c = input(yyscanner))!= term && c!=trm1) {
+                       if (UNLIKELY(i > 98)) {
+                         csound->Die(csound,
+                                     Str("Missing argument terminator\n%.98s"),
+                                     nn->body);
+                       }
+                       nn->body[i++] = c;
+                       if (UNLIKELY(i >= size))
+                         nn->body = mrealloc(csound, nn->body, size += 100);
+                     }
+                     nn->body[i] = '\0';
+                     csound->Message(csound, "as...#%s#\n", nn->body);
+                     nn->acnt = 0;       /* No arguments for arguments */
+                     nn->next = PARM->macros;
+                     PARM->macros = nn;
+                   }
+                   /* csound->DebugMsg(csound,"New body: ...#%s#\n", mm->body); */
+                   if (UNLIKELY(PARM->macro_stack_ptr >= MAX_INCLUDE_DEPTH )) {
+                     csound->Message(csound,
+                                     Str("macro_stack_ptr beyond end: %d \n"),
+                                     PARM->macro_stack_ptr);
+                     exit(1);
+                   }
+                   PARM->alt_stack[PARM->macro_stack_ptr].n = PARM->macros->acnt;
+                   PARM->alt_stack[PARM->macro_stack_ptr++].s = PARM->macros;
+                   PARM->alt_stack[PARM->macro_stack_ptr].n = 0;
+                   PARM->alt_stack[PARM->macro_stack_ptr].line =
+                     csound_preget_lineno(yyscanner);
+                   PARM->alt_stack[PARM->macro_stack_ptr].s = NULL;
+                   csound->DebugMsg(csound,"Push %p macro stack\n",PARM->macros);
+                   yypush_buffer_state(YY_CURRENT_BUFFER, yyscanner);
+                   csound_preset_lineno(1, yyscanner);
+                   PARM->lstack[++PARM->depth] =
+                     (strchr(mm->body,'\n') ?file_to_int(csound, yytext) : 63);
+                   yy_scan_string(mm->body, yyscanner);
+                 }
+{MACRONAMEDA}    {
+                   MACRO     *mm = PARM->macros;
+                   int c, i, j;
+                   /* csound->DebugMsg(csound,"Macro with arguments call %s\n", yytext); */
+                   yytext[yyleng-2] = '\0';
+                   while (mm != NULL) {  /* Find the definition */
+                     csound->DebugMsg(csound,"Check %s against %s\n", yytext+1, mm->name);
+                     if (!(strcmp(yytext+1, mm->name)))
+                       break;
+                     mm = mm->next;
+                   }
+                   if (UNLIKELY(mm == NULL)) {
+                     csound->Message(csound,Str("Undefined macro: '%s'"), yytext);
+                     csound->LongJmp(csound, 1);
+                   }
+                   /* Need to read from macro definition */
+                   csound->DebugMsg(csound,"Looking for %d args\n", mm->acnt);
+                   for (j = 0; j < mm->acnt; j++) {
+                     char  term = (j == mm->acnt - 1 ? ')' : '\'');
+ /* Compatability */
+                     char  trm1 = (j == mm->acnt - 1 ? ')' : '#');
+                     MACRO *nn = (MACRO*) mmalloc(csound, sizeof(MACRO));
+                     int   size = 100;
+                     nn->name = mmalloc(csound, strlen(mm->arg[j]) + 1);
+                     csound->DebugMsg(csound,"Arg %d: %s\n", j+1, mm->arg[j]);
+                     strcpy(nn->name, mm->arg[j]);
+                     csound->Message(csound, "defining argument %s ",
+                                        nn->name);
+                     i = 0;
+                     nn->body = (char*) mmalloc(csound, 100);
+                     while ((c = input(yyscanner))!= term && c!=trm1) {
+                       if (UNLIKELY(i > 98)) {
+                         csound->Die(csound,
+                                     Str("Missing argument terminator\n%.98s"),
+                                     nn->body);
+                       }
+                       nn->body[i++] = c;
+                       if (UNLIKELY(i >= size))
+                         nn->body = mrealloc(csound, nn->body, size += 100);
+                     }
+                     nn->body[i] = '\0';
+                     csound->Message(csound, "as...#%s#\n", nn->body);
+                     nn->acnt = 0;       /* No arguments for arguments */
+                     nn->next = PARM->macros;
+                     PARM->macros = nn;
+                   }
+                   csound->DebugMsg(csound,"New body: ...#%s#\n", mm->body);
+                   PARM->alt_stack[PARM->macro_stack_ptr].n = PARM->macros->acnt;
+                   PARM->alt_stack[PARM->macro_stack_ptr++].s = PARM->macros;
+                   PARM->alt_stack[PARM->macro_stack_ptr].n = 0;
+                   PARM->alt_stack[PARM->macro_stack_ptr].line =
+                     csound_preget_lineno(yyscanner);
+                   PARM->alt_stack[PARM->macro_stack_ptr].s = NULL;
+                   yypush_buffer_state(YY_CURRENT_BUFFER, yyscanner);
+                   if (PARM->depth++>1024) {
+                     csound->Die(csound, Str("Includes nested too deeply"));
+                   }
+                   csound_preset_lineno(1, yyscanner);
+                   PARM->lstack[PARM->depth] = 
+                     (strchr(mm->body,'\n') ?file_to_int(csound, yytext) : 63);
+                   yy_scan_string(mm->body, yyscanner);
+                 }
+{INCLUDE}       {
+                  if (PARM->isString != 1)
+                    BEGIN(incl);
+                  else
+                    corfile_puts(yytext, csound->expanded_orc);
+                }
+<incl>[ \t]*     /* eat the whitespace */
+<incl>.         { /* got the include file name */
+                  do_include(csound, yytext[0], yyscanner);
+                  BEGIN(INITIAL);
+                }
+#exit           { corfile_putc('\0', csound->expanded_orc);
+                  corfile_putc('\0', csound->expanded_orc);
+                  return 0;}
+<<EOF>>         {
+                  MACRO *x, *y=NULL;
+                  int n;
+                  csound->DebugMsg(csound,"*********Leaving buffer %p\n", YY_CURRENT_BUFFER);
+                  yypop_buffer_state(yyscanner);
+                  PARM->depth--;
+                  if (UNLIKELY(PARM->depth > 1024))
+                    csound->Die(csound, Str("unexpected EOF"));
+                  PARM->llocn = PARM->locn; PARM->locn = make_location(PARM);
+                  csound->DebugMsg(csound,"%s(%d): loc=%d; lastloc=%d\n", __FILE__, __LINE__,
+                         PARM->llocn, PARM->locn);
+                  if ( !YY_CURRENT_BUFFER ) yyterminate();
+                  /* csound->DebugMsg(csound,"End of input; popping to %p\n", */
+                  /*         YY_CURRENT_BUFFER); */
+                  csound_pre_line(csound->expanded_orc, yyscanner);
+                  if (PARM->clearBufferAfterEOF)
+                    PARM->clearBufferAfterEOF =
+                      PARM->isInclude = 0;
+                  n = PARM->alt_stack[--PARM->macro_stack_ptr].n;
+                  csound_preset_lineno(PARM->alt_stack[PARM->macro_stack_ptr].line,
+                                       yyscanner);
+                  csound->DebugMsg(csound,"%s(%d): line now %d at %d\n", __FILE__, __LINE__,
+                         csound_preget_lineno(yyscanner), PARM->macro_stack_ptr);
+                  /* csound->DebugMsg(csound,"n=%d\n", n); */
+                  if (n!=0) {
+                    /* We need to delete n macros starting with y */
+                    y = PARM->alt_stack[PARM->macro_stack_ptr].s;
+                    x = PARM->macros;
+                    if (x==y) {
+                      while (n>0) {
+                        mfree(csound, y->name); x=y->next;
+                        mfree(csound, y); y=x; n--;
+                      }
+                      PARM->macros = x;
+                    }
+                    else {
+                      MACRO *nxt = y->next;
+                      while (x->next != y) x = x->next;
+                      while (n>0) {
+                        nxt = y->next;
+                        mfree(csound, y->name); mfree(csound, y); y=nxt; n--;
+                      }
+                      x->next = nxt;
+                    }
+                    y->next = x;
+                  }
+                  /* csound->DebugMsg(csound,"End of input segment: macro pop %p -> %p\n", */
+                  /*            y, PARM->macros); */
+                  csound_pre_line(csound->orchstr, yyscanner);
+                }
+{DEFINE}        {
+                  if (PARM->isString != 1)
+                    BEGIN(macro);
+                  else
+                    corfile_puts(yytext, csound->expanded_orc);
+                }
+<macro>[ \t]*    /* eat the whitespace */
+<macro>{MACRO}  {
+                  yytext[yyleng-1] = '\0';
+                  /* csound->DebugMsg(csound,"Define macro with args %s\n", yytext); */
+                  /* print_csound_predata(csound, "Before do_macro_arg", yyscanner); */
+                  do_macro_arg(csound, yytext, yyscanner);
+                  //print_csound_predata(csound,"After do_macro_arg", yyscanner);
+                  BEGIN(INITIAL);
+                }
+<macro>{IDENTN} {
+                  /* csound->DebugMsg(csound,"Define macro %s\n", yytext); */
+                  /* print_csound_predata(csound,"Before do_macro", yyscanner); */
+                  do_macro(csound, yytext, yyscanner);
+                  //print_csound_predata(csound,"After do_macro", yyscanner);
+                  BEGIN(INITIAL);
+                }
+{UNDEF}         {
+                  if (PARM->isString != 1)
+                    BEGIN(umacro);
+                  else
+                    corfile_puts(yytext, csound->expanded_orc);
+                }
+<umacro>[ \t]*    /* eat the whitespace */
+<umacro>{IDENT}  {
+                  /* csound->DebugMsg(csound,"Undefine macro %s\n", yytext); */
+                  do_umacro(csound, yytext, yyscanner);
+                  BEGIN(INITIAL);
+                }
+
+{IFDEF}         {
+                  if (PARM->isString != 1) {
+                    PARM->isIfndef = (yytext[3] == 'n');  /* #ifdef or #ifndef */
+                    csound_preset_lineno(1+csound_preget_lineno(yyscanner),
+                                         yyscanner);
+                    corfile_putc('\n', csound->expanded_orc);
+                    csound_pre_line(csound->expanded_orc, yyscanner);
+                    BEGIN(ifdef);
+                  }
+                  else {
+                    corfile_puts(yytext, csound->expanded_orc);
+                  }
+                }
+<ifdef>[ \t]*     /* eat the whitespace */
+<ifdef>{IDENT}  {
+                  do_ifdef(csound, yytext, yyscanner);
+                  BEGIN(INITIAL);
+                }
+{ELSE}          { 
+                  if (PARM->isString != 1) {
+                    if (PARM->ifdefStack == NULL) {
+                      csound->Message(csound, Str("#else without #if\n"));
+                      csound->LongJmp(csound, 1); 
+                    }
+                    else if (PARM->ifdefStack->isElse) {
+                      csound->Message(csound, Str("#else after #else\n"));
+                      csound->LongJmp(csound, 1);
+                    }
+                    PARM->ifdefStack->isElse = 1;
+                    csound_preset_lineno(1+csound_preget_lineno(yyscanner),
+                                         yyscanner);
+                    corfile_putc('\n', csound->expanded_orc);
+                    csound_pre_line(csound->expanded_orc, yyscanner);
+                    do_ifdef_skip_code(csound, yyscanner);
+                  }
+                  else {
+                    corfile_puts(yytext, csound->expanded_orc);
+                  }
+                }
+{END}           {
+                  if (PARM->isString != 1) {
+                    IFDEFSTACK *pp = PARM->ifdefStack;
+                    if (UNLIKELY(pp == NULL)) {
+                      csound->Message(csound, Str("Unmatched #end\n"));
+                      csound->LongJmp(csound, 1);
+                    }
+                    PARM->ifdefStack = pp->prv;
+                    csound_preset_lineno(1+csound_preget_lineno(yyscanner),
+                                         yyscanner);
+                    corfile_putc('\n', csound->expanded_orc);
+                    csound_pre_line(csound->expanded_orc, yyscanner);
+                    mfree(csound, pp);
+                  }
+                  else {
+                    corfile_puts(yytext, csound->expanded_orc);
+                  }
+                }
+.               { corfile_putc(yytext[0], csound->expanded_orc); }
+
+%%
+void comment(yyscan_t yyscanner)              /* Skip until nextline */
+{
+    char c;
+    struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+    while ((c = input(yyscanner)) != '\n' && c != '\r'); /* skip */
+    if (c == '\r' && (c = input(yyscanner)) != '\n')
+      unput(c);
+    csound_preset_lineno(1+csound_preget_lineno(yyscanner),yyscanner);
+}
+
+void do_comment(yyscan_t yyscanner)              /* Skip until * and / chars */
+{
+    char c;
+    for (;;) {
+      c = input(yyscanner);
+      if (UNLIKELY(c=='\n')) /* skip */
+          csound_preset_lineno(1+csound_preget_lineno(yyscanner),yyscanner);
+      if (c != '*') continue;
+      while ((c=input(yyscanner))=='*');
+      if (c=='/') return;
+      if (UNLIKELY(c=='\n'))
+        csound_preset_lineno(1+csound_preget_lineno(yyscanner),yyscanner);
+    }
+}
+
+void do_include(CSOUND *csound, int term, yyscan_t yyscanner)
+{
+    char buffer[100];
+    int p=0;
+    int c;
+    CORFIL *cf;
+    struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+    while ((c=input(yyscanner))!=term) {
+      buffer[p] = c;
+      p++;
+    }
+    buffer[p] = '\0';
+    while ((c=input(yyscanner))!='\n');
+    if (PARM->depth++>=1024) {
+      csound->Die(csound, Str("Includes nested too deeply"));
+    }
+    csound_preset_lineno(1+csound_preget_lineno(yyscanner), yyscanner);
+    csound->DebugMsg(csound,"line %d at end of #include line\n", csound_preget_lineno(yyscanner));
+    {
+      uint8_t n = file_to_int(csound, buffer);
+      char bb[16];
+      PARM->lstack[PARM->depth] = n;
+      sprintf(bb, "#source %d\n", PARM->locn = make_location(PARM));
+      PARM->llocn = PARM->locn;
+      corfile_puts(bb, csound->expanded_orc);
+    }
+    cf = copy_to_corefile(csound, buffer, "INCDIR", 0);
+    if (cf == NULL)
+      csound->Die(csound,
+                  Str("Cannot open #include'd file %s\n"), buffer);
+    csound->DebugMsg(csound,"%s(%d): stacking line %d at %d\n", __FILE__, __LINE__,
+           csound_preget_lineno(yyscanner),PARM->macro_stack_ptr);
+    PARM->alt_stack[PARM->macro_stack_ptr].n = 0;
+    PARM->alt_stack[PARM->macro_stack_ptr].line = csound_preget_lineno(yyscanner);
+    PARM->alt_stack[PARM->macro_stack_ptr++].s = NULL;
+    PARM->isInclude = PARM->clearBufferAfterEOF = 1;
+    csound_prepush_buffer_state(YY_CURRENT_BUFFER, yyscanner);
+    csound_pre_scan_string(cf->body, yyscanner);
+    corfile_rm(&cf);
+    csound->DebugMsg(csound,"Set line number to 1\n");
+    csound_preset_lineno(1, yyscanner);
+}
+
+static inline int isNameChar(int c, int pos)
+{
+    c = (int) ((unsigned char) c);
+    return (isalpha(c) || (pos && (c == '_' || isdigit(c))));
+}
+
+void do_macro_arg(CSOUND *csound, char *name0, yyscan_t yyscanner)
+{
+    MACRO *mm = (MACRO*) mmalloc(csound, sizeof(MACRO));
+    int   arg = 0, i, c;
+    int   size = 100;
+    int mlen = 40;
+    char *mname = malloc(mlen);
+    mm->margs = MARGS;    /* Initial size */
+    mm->name = (char*)mmalloc(csound, strlen(name0) + 1);
+    strcpy(mm->name, name0);
+    do {
+      while (isspace((c = input(yyscanner))));
+      i = 0;
+
+      while (isNameChar(c, i)) {
+        mname[i++] = c;
+        if (UNLIKELY(i==mlen))
+          mname = (char *)realloc(mname, mlen+=40);
+        c = input(yyscanner);
+      }
+      mname[i] = '\0';
+      mm->arg[arg] = mmalloc(csound, i + 1);
+      strcpy(mm->arg[arg++], mname);
+      if (UNLIKELY(arg >= mm->margs)) {
+        mm = (MACRO*) mrealloc(csound, mm, sizeof(MACRO)
+                               + mm->margs * sizeof(char*));
+        mm->margs += MARGS;
+      }
+      while (isspace(c))
+        c = input(yyscanner);
+    } while (c == '\'' || c == '#');
+    if (UNLIKELY(c != ')')) {
+      csound->Message(csound, Str("macro error\n"));
+    }
+    free(mname);
+    while (c!='#') c = input(yyscanner);
+    mm->acnt = arg;
+    i = 0;
+    mm->body = (char*) mmalloc(csound, 100);
+    while ((c = input(yyscanner)) != '#') {
+      if (UNLIKELY(c == EOF))
+        csound->Die(csound, Str("define macro with args: unexpected EOF"));
+      mm->body[i++] = c;
+      if (UNLIKELY(i >= size))
+        mm->body = mrealloc(csound, mm->body, size += 100);
+      if (c == '\\') {                    /* allow escaped # */
+        mm->body[i++] = c = input(yyscanner);
+        if (UNLIKELY(i >= size))
+          mm->body = mrealloc(csound, mm->body, size += 100);
+      }
+      if (UNLIKELY(c == '\n')) {
+        csound_preset_lineno(1+csound_preget_lineno(yyscanner),yyscanner);
+        corfile_putc('\n', csound->expanded_orc);
+        csound_pre_line(csound->expanded_orc, yyscanner);
+      }
+    }
+    mm->body[i] = '\0';
+    mm->next = PARM->macros;
+    PARM->macros = mm;
+}
+
+void do_macro(CSOUND *csound, char *name0, yyscan_t yyscanner)
+{
+    MACRO *mm = (MACRO*) mmalloc(csound, sizeof(MACRO));
+    int   i, c;
+    int   size = 100;
+    mm->margs = MARGS;    /* Initial size */
+    /* csound->DebugMsg(csound,"Macro definition for %s\n", name0); */
+    mm->name = (char*)mmalloc(csound, strlen(name0) + 1);
+    strcpy(mm->name, name0);
+    mm->acnt = 0;
+    i = 0;
+    while ((c = input(yyscanner)) != '#');
+    mm->body = (char*) mmalloc(csound, 100);
+    while ((c = input(yyscanner)) != '#') {
+      if (UNLIKELY(c == EOF))
+        csound->Die(csound, Str("define macro: unexpected EOF"));
+      mm->body[i++] = c;
+      if (UNLIKELY(i >= size))
+        mm->body = mrealloc(csound, mm->body, size += 100);
+      if (c == '\\') {                    /* allow escaped # */
+        mm->body[i++] = c = input(yyscanner);
+        if (UNLIKELY(i >= size))
+          mm->body = mrealloc(csound, mm->body, size += 100);
+      }
+      if (UNLIKELY(c == '\n')) {
+        csound_preset_lineno(1+csound_preget_lineno(yyscanner),yyscanner);
+        corfile_putc('\n', csound->expanded_orc);
+        csound_pre_line(csound->expanded_orc, yyscanner);
+      }
+    }
+    mm->body[i] = '\0';
+    /* csound->DebugMsg(csound,"Body #%s#\n", mm->body); */
+    mm->next = PARM->macros;
+    PARM->macros = mm;
+}
+
+void do_umacro(CSOUND *csound, char *name0, yyscan_t yyscanner)
+{
+    int i,c;
+    if (UNLIKELY(csound->oparms->msglevel))
+      csound->Message(csound,Str("macro %s undefined\n"), name0);
+    /* csound->DebugMsg(csound, "macro %s undefined\n", name0); */
+    if (strcmp(name0, PARM->macros->name)==0) {
+      MACRO *mm=PARM->macros->next;
+      mfree(csound, PARM->macros->name); mfree(csound, PARM->macros->body);
+      for (i=0; i<PARM->macros->acnt; i++)
+        mfree(csound, PARM->macros->arg[i]);
+      mfree(csound, PARM->macros); PARM->macros = mm;
+    }
+    else {
+      MACRO *mm = PARM->macros;
+      MACRO *nn = mm->next;
+      while (strcmp(name0, nn->name) != 0) {
+        mm = nn; nn = nn->next;
+        if (UNLIKELY(nn == NULL)) {
+          csound->Message(csound, Str("Undefining undefined macro"));
+          csound->LongJmp(csound, 1);
+        }
+      }
+      mfree(csound, nn->name); mfree(csound, nn->body);
+      for (i=0; i<nn->acnt; i++)
+        mfree(csound, nn->arg[i]);
+      mm->next = nn->next; mfree(csound, nn);
+    }
+    while ((c=input(yyscanner)) != '\n' && c != EOF); /* ignore rest of line */
+    csound_preset_lineno(1+csound_preget_lineno(yyscanner),yyscanner);
+}
+
+void do_ifdef(CSOUND *csound, char *name0, yyscan_t yyscanner)
+{
+    int c;
+    MACRO *mm;
+    IFDEFSTACK *pp;
+    pp = (IFDEFSTACK*) mcalloc(csound, sizeof(IFDEFSTACK));
+    pp->prv = PARM->ifdefStack;
+    pp->isDef = PARM->isIfndef;
+    for (mm = PARM->macros; mm != NULL; mm = mm->next) {
+      if (strcmp(name0, mm->name) == 0) {
+        pp->isDef ^= (unsigned char) 1;
+        break;
+      }
+    }
+    PARM->ifdefStack = pp;
+    pp->isSkip = pp->isDef ^ (unsigned char) 1;
+    if (pp->isSkip)
+      do_ifdef_skip_code(csound, yyscanner);
+    else
+      while ((c = input(yyscanner)) != '\n' && c != EOF);
+}
+
+void do_ifdef_skip_code(CSOUND *csound, yyscan_t yyscanner)
+{
+    int i, c, nested_ifdef = 0;
+    char *buf;
+    IFDEFSTACK *pp;
+    buf = (char*)malloc(8*sizeof(char));
+    pp = PARM->ifdefStack;
+    c = input(yyscanner);
+    for (;;) {
+      while (c!='\n') {
+        if (UNLIKELY(c == EOF)) {
+          csound->Message(csound, Str("Unmatched #if%sdef\n"),
+                          PARM->isIfndef ? "n" : "");
+          csound->LongJmp(csound, 1);
+        }
+        c = input(yyscanner);
+      }
+      csound_preset_lineno(1+csound_preget_lineno(yyscanner),
+                           yyscanner);
+      corfile_putc('\n', csound->expanded_orc);
+      csound_pre_line(csound->expanded_orc, yyscanner);
+      while (isblank(c = input(yyscanner)));  /* eat the whitespace */
+      if (c == '#') {
+        for (i=0; islower(c = input(yyscanner)) && i < 7; i++)
+          buf[i] = c;
+        buf[i] = '\0';
+        if (strcmp("end", buf) == 0 || strcmp("endif", buf) == 0) {
+          if (nested_ifdef-- == 0) {
+            PARM->ifdefStack = pp->prv;
+            mfree(csound, pp);
+            break;
+          }
+        }
+        else if (strcmp("ifdef", buf) == 0 || strcmp("ifndef", buf) == 0) {
+          nested_ifdef++;
+        }
+        else if (strcmp("else", buf) == 0 && nested_ifdef == 0) {
+          if (pp->isElse) {
+            csound->Message(csound, Str("#else after #else\n"));
+            csound->LongJmp(csound, 1);
+          }
+          pp->isElse = 1;
+          break;
+        }
+      }
+    }
+    free(buf);
+    while (c != '\n' && c != EOF) c = input(yyscanner);
+}
+
+static void add_math_const_macro(CSOUND *csound, PRE_PARM* qq,
+                                 char * name, char *body)
+{
+    MACRO *mm;
+
+    mm = (MACRO*) mcalloc(csound, sizeof(MACRO));
+    mm->name = (char*) mcalloc(csound, strlen(name) + 3);
+    sprintf(mm->name, "M_%s", name);
+    mm->next = qq->macros;
+    qq->macros = mm;
+    mm->margs = MARGS;    /* Initial size */
+    mm->acnt = 0;
+    mm->body = (char*) mcalloc(csound, strlen(body) + 1);
+    mm->body = strcpy(mm->body, body);
+}
+
+/**
+ * Add math constants from math.h as orc PARM->macros
+ */
+void cs_init_math_constants_macros(CSOUND *csound, PRE_PARM* qq)
+{
+     qq->macros = NULL;
+     add_math_const_macro(csound, qq, "E",     "2.71828182845904523536");
+     add_math_const_macro(csound, qq, "LOG2E", "1.44269504088896340736");
+     add_math_const_macro(csound, qq, "LOG10E","0.43429448190325182765");
+     add_math_const_macro(csound, qq, "LN2",   "0.69314718055994530942");
+     add_math_const_macro(csound, qq, "LN10",  "2.30258509299404568402");
+     add_math_const_macro(csound, qq, "PI",    "3.14159265358979323846");
+     add_math_const_macro(csound, qq, "PI_2",  "1.57079632679489661923");
+     add_math_const_macro(csound, qq, "PI_4",  "0.78539816339744830962");
+     add_math_const_macro(csound, qq, "1_PI",  "0.31830988618379067154");
+     add_math_const_macro(csound, qq, "2_PI",  "0.63661977236758134308");
+     add_math_const_macro(csound, qq,"2_SQRTPI", "1.12837916709551257390");
+     add_math_const_macro(csound, qq, "SQRT2", "1.41421356237309504880");
+     add_math_const_macro(csound, qq,"SQRT1_2","0.70710678118654752440");
+     add_math_const_macro(csound, qq, "INF",   "2147483647.0"); /* ~7 years */
+}
+
+void cs_init_omacros(CSOUND *csound, PRE_PARM *qq, NAMES *nn)
+{
+    while (nn) {
+      char  *s = nn->mac;
+      char  *p = strchr(s, '=');
+      char  *mname;
+      MACRO *mm;
+
+      if (p == NULL)
+        p = s + strlen(s);
+      if (csound->oparms->msglevel & 7)
+        csound->Message(csound, Str("Macro definition for %*s\n"), p - s, s);
+      s = strchr(s, ':') + 1;                   /* skip arg bit */
+      if (UNLIKELY(s == NULL || s >= p)) {
+        csound->Die(csound, Str("Invalid macro name for --omacro"));
+      }
+      mname = (char*) mmalloc(csound, (p - s) + 1);
+      strncpy(mname, s, p - s);
+      mname[p - s] = '\0';
+      /* check if macro is already defined */
+      for (mm = qq->macros; mm != NULL; mm = mm->next) {
+        if (strcmp(mm->name, mname) == 0)
+          break;
+      }
+      if (mm == NULL) {
+        mm = (MACRO*) mcalloc(csound, sizeof(MACRO));
+        mm->name = mname;
+        mm->next = qq->macros;
+        qq->macros = mm;
+      }
+      else
+        mfree(csound, mname);
+      mm->margs = MARGS;    /* Initial size */
+      mm->acnt = 0;
+      if (*p != '\0')
+        p++;
+      mm->body = (char*) mmalloc(csound, strlen(p) + 1);
+      strcpy(mm->body, p);
+      nn = nn->next;
+    }
+}
+
+/* int csound_prewrap(void *yyscanner)  */
+/* {  */
+/*     return 1; */
+/* } */
+
+void csound_pre_line(CORFIL* cf, void *yyscanner)
+{
+    int n = csound_preget_lineno(yyscanner);
+    /* This assumes that the initial line was not written with this system  */
+    if (cf->body[cf->p-1]=='\n') {
+      int locn = PARM->locn;
+      int llocn = PARM->llocn;
+      if (locn != llocn) {
+      char bb[80];
+      sprintf(bb, "#source %d\n", locn);
+      corfile_puts(bb, cf);
+      }
+      PARM->llocn = locn;
+      if (n!=PARM->line+1) {
+        char bb[80];
+        sprintf(bb, "#line %d\n", n);
+        corfile_puts(bb, cf);
+      }
+    }
+    PARM->line = n;
+}
+
+#ifdef MAIN_NEEDED
+int main(void)
+{
+    PRE_PARM  qq;
+    int len=100, p=0, n;
+    char buff[1024];
+    FILE *fd = fopen("III", "r");
+
+    inp = (char*)calloc(100,1);
+    memset(buff, '\0', 1024);
+    while ((n = fread(buff, 1, 1023, fd))) {
+      while (p+n+1>=len)
+        inp = (char*) realloc(inp, len+=100);
+      strcat(inp, buff);
+      p += n;
+      memset(buff, '\0', 1024);
+    }
+    if (n+8>= len) inp = (char*) realloc(inp, len = n+9);
+    strcat(inp, "\n#exit\0\0");
+    rewind(fd);
+
+    memset(&qq, '\0', sizeof(PRE_PARM));
+    csound_prelex_init(&qq.yyscanner);
+    csound_preset_extra(&qq, qq.yyscanner);
+    //csound_preset_debug(1, &qq.yyscanner);
+    //csound_prepush_buffer_state(NULL, &qq.yyscanner);
+    //csound_pre_scan_string(inp, qq.yyscanner);
+    //csound_preset_in(NULL, qq.yyscanner);
+    qq.line = 1;
+    csound_prelex(NULL, qq.yyscanner);
+    //csound->DebugMsg(csound,corfile_body(expanded_pre));
+    //csound_prelex_destroy(&qq.yyscanner);
+    return 0;
+}
+#endif
+
+#if 0
+static void print_csound_predata(CSOUND *csound, char *mesg, void *yyscanner)
+{
+    struct yyguts_t *yyg =(struct yyguts_t*)yyscanner;
+    csound->DebugMsg(csound,"********* %s extra data ************\n", mesg);
+    csound->DebugMsg(csound,"yyscanner = %p\n", yyscanner);
+    csound->DebugMsg(csound,"yyextra_r = %p, yyin_r = %p, yyout_r = %p, yy_buffer_stack_top = %d\n", 
+           yyg->yyextra_r, yyg->yyin_r,yyg->yyout_r, yyg->yy_buffer_stack_top);
+    csound->DebugMsg(csound,"yy_buffer_stack_max = %d1, yy_buffer_stack = %p, yy_hold_char = %d '%c'\n", 
+           yyg->yy_buffer_stack_max, yyg->yy_buffer_stack, yyg->yy_hold_char,
+           yyg->yy_hold_char);
+    csound->DebugMsg(csound,"yy_n_chars = %d, yyleng_r = %d, yy_c_buf_p = %p %c\n",
+           yyg->yy_n_chars, yyg->yyleng_r, yyg->yy_c_buf_p, *yyg->yy_c_buf_p);
+    csound->DebugMsg(csound,"yy_init = %d, yy_start = %d, yy_did_buffer_switch_on_eof = %d\n",
+           yyg->yy_init, yyg->yy_start, yyg->yy_did_buffer_switch_on_eof);
+    csound->DebugMsg(csound,"yy_start_stack_ptr = %d, yy_start_stack_depth = %d, yy_start_stack = %p\n",
+           yyg->yy_start_stack_ptr, yyg->yy_start_stack_depth, yyg->yy_start_stack);
+
+    csound->DebugMsg(csound,"yy_last_accepting_state = %d, yy_last_accepting_cpos = %p %c\n",
+           yyg->yy_last_accepting_state, yyg->yy_last_accepting_cpos, *yyg->yy_last_accepting_cpos);
+    csound->DebugMsg(csound,"yylineno_r = %d, yy_flex_debug_r = %d, yytext_r = %p \"%s\", yy_more_flag = %d, yy_more_len = %d\n",
+           yyg->yylineno_r, yyg->yy_flex_debug_r, yyg->yytext_r, yyg->yytext_r, yyg->yy_more_flag, yyg->yy_more_len);
+    csound->DebugMsg(csound,"*********\n");
+}
+#endif
+
+
diff --git a/Engine/entry1.c b/Engine/entry1.c
index 6bdc39b..b705816 100644
--- a/Engine/entry1.c
+++ b/Engine/entry1.c
@@ -129,11 +129,12 @@ OENTRY opcodlst_1[] = {
 { "trirand", 0xffff                                                     },
 { "unirand", 0xffff,                                                    },
 { "weibull", 0xffff                                                     },
-{ "oscil",   0xfffe, TW                                                 },
-{ "oscil3",  0xfffe, TW                                                 },
-{ "oscili",  0xfffe, TW                                                 },
+{ "oscil",   0xfffe, TR                                                 },
+{ "oscil3",  0xfffe, TR                                                 },
+{ "oscili",  0xfffe, TR                                                 },
 { "peak",    0xfffd                                                     },
 { "rtclock", 0xffff                                                     },
+{ "ptablew",  0xfffe, TW                                                 },
 { "tablew",  0xfffe, TW                                                 },
 { "tablewkt",0xfffe, TW                                                 },
 { "ihold",  S(LINK),    1,      "",     "",     ihold                   },
@@ -346,13 +347,32 @@ OENTRY opcodlst_1[] = {
 { "table3.i", S(TABLE), 1,      "i",    "iiooo",itabl3                  },
 { "table3.k", S(TABLE), 3,      "k",    "xiooo",tblset, ktabl3          },
 { "table3.a", S(TABLE), 5,      "a",    "xiooo",tblset, NULL, tabl3     },
-{ "oscil1", S(OSCIL1),  TR|3,      "k",    "ikii", ko1set, kosc1           },
-{ "oscil1i",S(OSCIL1),  TR|3,      "k",    "ikii", ko1set, kosc1i          },
-{ "osciln", S(OSCILN),  TR|5,      "a",    "kiii", oscnset,NULL,   osciln  },
+{ "ptable",  0xffff, TR                                                 },
+{ "ptablei", 0xffff, TR                                                 },
+{ "ptable3", 0xffff, TR                                                 },
+{ "ptable.i",  S(TABLE), 1,     "i",    "iiooo",pitable                },
+{ "ptable.k",  S(TABLE), 3,     "k",    "xiooo",tblset, pktable        },
+{ "ptable.a",  S(TABLE), 5,     "a",    "xiooo",tblset, NULL, ptablefn },
+{ "ptablei.i", S(TABLE), 1,     "i",    "iiooo",pitabli                },
+{ "ptablei.k", S(TABLE), 3,     "k",    "xiooo",tblset, pktabli        },
+{ "ptablei.a", S(TABLE), 5,     "a",    "xiooo",tblset, NULL, ptabli   },
+{ "ptable3.i", S(TABLE), 1,     "i",    "iiooo",pitabl3                },
+{ "ptable3.k", S(TABLE), 3,     "k",    "xiooo",tblset, pktabl3        },
+{ "ptable3.a", S(TABLE), 5,     "a",    "xiooo",tblset, NULL, ptabl3   },
+{ "oscil1", S(OSCIL1),  TR|3,   "k",    "ikii", ko1set, kosc1         },
+{ "oscil1i",S(OSCIL1),  TR|3,   "k",    "ikii", ko1set, kosc1i        },
+{ "osciln", S(OSCILN),  TR|5,   "a",    "kiii", oscnset,NULL,   osciln  },
 { "oscil.kk",S(OSC),    7,      "s",    "kkio", oscset, koscil, osckk   },
 { "oscil.ka",S(OSC),    5,      "a",    "kaio", oscset, NULL,   oscka   },
 { "oscil.ak",S(OSC),    5,      "a",    "akio", oscset, NULL,   oscak   },
 { "oscil.aa",S(OSC),    5,      "a",    "aaio", oscset, NULL,   oscaa   },
+/* CHangerthese to
+{ "oscil.kk", S(POSC), 7, "s", "kkio", posc_set, kposc, posckk },
+{ "oscil.ka", S(POSC), 5, "a", "kaio", posc_set, NULL,  poscka },
+{ "oscil.ak", S(POSC), 5, "a", "akio", posc_set, NULL,  poscak },
+{ "oscil.aa", S(POSC), 5, "a", "aaio", posc_set, NULL,  poscaa },
+{ "oscil3.kk",  S(POSC),  7, "s", "kkio", posc_set, kposc3, posc3 },
+*/
 { "oscili.kk",S(OSC),   7,      "s",    "kkio", oscset, koscli, osckki  },
 { "oscili.ka",S(OSC),   5,      "a",    "kaio", oscset, NULL,   osckai  },
 { "oscili.ak",S(OSC),   5,      "a",    "akio", oscset, NULL,   oscaki  },
@@ -361,6 +381,7 @@ OENTRY opcodlst_1[] = {
 { "oscil3.ka",S(OSC),   5,      "a",    "kaio", oscset, NULL,   oscka3  },
 { "oscil3.ak",S(OSC),   5,      "a",    "akio", oscset, NULL,   oscak3  },
 { "oscil3.aa",S(OSC),   5,      "a",    "aaio", oscset, NULL,   oscaa3  },
+/* end change */
 { "foscil", S(FOSC),    TR|5,      "a",  "xkxxkio",foscset,NULL,   foscil  },
 { "foscili",S(FOSC),    TR|5,      "a",  "xkxxkio",foscset,NULL,   foscili },
 { "loscil", S(LOSC),    TR|5,      "mm","xkiojoojoo",losset,NULL, loscil   },
@@ -531,13 +552,16 @@ OENTRY opcodlst_1[] = {
 { "filepeak", S(SNDINFOPEAK), 1, "i",   "To",   filepeak, NULL, NULL       },
 { "filevalid", S(FILEVALID), 1,  "i",   "T",    filevalid, NULL, NULL      },
 /*  { "nlalp", S(NLALP),     5,     "a",    "akkoo", nlalp_set, NULL, nlalp }, */
+{ "ptableiw",  S(TABLEW),TW|1,   "",      "iiiooo", (SUBR)pitablew, NULL, NULL},
+{ "ptablew.kk", S(TABLEW),  3,  "", "kkiooo",(SUBR)itblchkw,(SUBR)pktablew, NULL},
+{ "ptablew.aa", S(TABLEW),  5,  "", "aaiooo",(SUBR)itblchkw, NULL, (SUBR)ptablew},
 /* Robin Whittle */
 { "tableiw",  S(TABLEW),TW|1,     "",      "iiiooo", (SUBR)itablew, NULL, NULL},
-{ "tablew.kk", S(TABLEW),TW|3,    "", "kkiooo",(SUBR)tblsetw,(SUBR)ktablew, NULL},
-{ "tablew.aa", S(TABLEW),TW|5,    "", "aaiooo",(SUBR)tblsetw, NULL, (SUBR)tablew},
-{ "tablewkt.kk", S(TABLEW),TW|3, "",  "kkkooo",
+{ "tablew.kk", S(TABLEW),  3,    "", "kkiooo",(SUBR)itblchkw,(SUBR)ktablew, NULL},
+{ "tablew.aa", S(TABLEW),  5,    "", "aaiooo",(SUBR)itblchkw, NULL, (SUBR)tablew},
+{ "tablewkt.kk", S(TABLEW),3, "",  "kkkooo",
                           (SUBR)tblsetwkt,(SUBR)ktablewkt,NULL},
-{ "tablewkt.aa", S(TABLEW),TW|5, "",  "aakooo",
+{ "tablewkt.aa", S(TABLEW),5, "",  "aakooo",
                           (SUBR)tblsetwkt,NULL,(SUBR)tablewkt},
 { "tableng.i", S(TABLENG),1,  "i",     "i",    (SUBR)itableng, NULL,  NULL},
 { "tableng.k",  S(TABLENG),2, "k",     "k",    NULL,   (SUBR)tableng, NULL},
@@ -707,7 +731,9 @@ OENTRY opcodlst_1[] = {
 { "turnoff2.i",S(TURNOFF2),2,     "",     "ikk",  NULL, turnoff2k, NULL     },
 { "turnoff2.r",S(TURNOFF2),2,     "",     "ikk",  NULL, turnoff2k, NULL     },
 { "cngoto", S(CGOTO),   3,      "",     "Bl",   ingoto, kngoto, NULL     },
+#ifdef VARGA
 { "cogoto", S(CGOTO),   3,      "",     "bl",   iingoto, kingoto, NULL   },
+#endif
 /* IV - Sep 8 2002 - added entries for user defined opcodes, xin, xout */
 /* and setksmps */
 { ".userOpcode", S(UOPCODE), 7, "", "", useropcdset, useropcd, useropcd },
diff --git a/Engine/fgens.c b/Engine/fgens.c
index ac60537..047f659 100644
--- a/Engine/fgens.c
+++ b/Engine/fgens.c
@@ -154,7 +154,7 @@ int hfgens(CSOUND *csound, FUNC **ftpp, const EVTBLK *evtblkp, int mode)
     }
     if (ff.e.pcnt>PMAX) {
 #ifdef BETA
-      fprintf(stderr, "T%d/%d(%d): x=%p memcpy from %p to %p length %d\n",
+      csound->DebugMsg(csound, "T%d/%d(%d): x=%p memcpy from %p to %p length %d\n",
               (int)evtblkp->p[1], (int)evtblkp->p[4], ff.e.pcnt, evtblkp->c.extra,
               &(ff.e.p[2]), &(evtblkp->p[2]), sizeof(MYFLT) * PMAX);
 #endif
@@ -350,7 +350,7 @@ static int gen02(FGDATA *ff, FUNC *ftp)
       *fp++ = *pp++;                            /*   copy into ftable   */
       if (UNLIKELY(nsw && pp>&ff->e.p[PMAX])) {
 #ifdef BETA
-        fprintf(stderr, "Switch to extra args\n");
+        csound->DebugMsg(csound, "Switch to extra args\n");
 #endif
         nsw = 0;                /* only switch once */
         pp = &(ff->e.c.extra[1]);
@@ -651,7 +651,7 @@ static int gen08(FGDATA *ff, FUNC *ftp)
         f2 = *valp++;                       /*    and the value at x2    */
         if (UNLIKELY(nsw && valp>&ff->e.p[PMAX])) {
 #ifdef BETA
-          fprintf(stderr, "Switch to extra args\n");
+          csound->DebugMsg(csound, "Switch to extra args\n");
 #endif
           nsw = 0;                /* only switch once */
           valp = &(ff->e.c.extra[1]);
@@ -713,7 +713,7 @@ static int gen09(FGDATA *ff, FUNC *ftp)
       inc = *(valp++) * tpdlen;
       if (UNLIKELY(nsw && valp>&ff->e.p[PMAX])) {
 #ifdef BETA
-        fprintf(stderr, "Switch to extra args\n");
+        csound->DebugMsg(csound, "Switch to extra args\n");
 #endif
         nsw = 0;                /* only switch once */
         valp = &(ff->e.c.extra[1]);
@@ -721,7 +721,7 @@ static int gen09(FGDATA *ff, FUNC *ftp)
       amp = *(valp++);
       if (UNLIKELY(nsw && valp>&ff->e.p[PMAX])) {
 #ifdef BETA
-        fprintf(stderr, "Switch to extra args\n");
+        csound->DebugMsg(csound, "Switch to extra args\n");
 #endif
         nsw = 0;                /* only switch once */
         valp = &(ff->e.c.extra[1]);
@@ -729,7 +729,7 @@ static int gen09(FGDATA *ff, FUNC *ftp)
       phs = *(valp++) * tpd360;
       if (UNLIKELY(nsw && valp>&ff->e.p[PMAX])) {
 #ifdef BETA
-        fprintf(stderr, "Switch to extra args\n");
+        csound->DebugMsg(csound, "Switch to extra args\n");
 #endif
         nsw = 0;                /* only switch once */
         valp = &(ff->e.c.extra[1]);
@@ -898,7 +898,7 @@ static int gn1314(FGDATA *ff, FUNC *ftp, MYFLT mxval, MYFLT mxscal)
       sum = *oddhp++;                           /* sum = diag(=1) * this h   */
       if (UNLIKELY(nsw && oddhp>&ff->e.p[PMAX])) {
 #ifdef BETA
-        fprintf(stderr, "Switch to extra args\n");
+        csound->DebugMsg(csound, "Switch to extra args\n");
 #endif
         nsw = 0;                /* only switch once */
         oddhp = &(ff->e.c.extra[1]);
@@ -908,7 +908,7 @@ static int gn1314(FGDATA *ff, FUNC *ftp, MYFLT mxval, MYFLT mxscal)
         oddhp++;                                /*  + odd terms * h+2,h+4,.. */
         if (UNLIKELY(nnsw && oddhp>&ff->e.p[PMAX])) {
 #ifdef BETA
-          fprintf(stderr, "Switch to extra args\n");
+          csound->DebugMsg(csound, "Switch to extra args\n");
 #endif
           nnsw = 0;                /* only switch once */
           oddhp = &(ff->e.c.extra[1]);
@@ -916,7 +916,7 @@ static int gn1314(FGDATA *ff, FUNC *ftp, MYFLT mxval, MYFLT mxscal)
         sum += *mp++ * *oddhp++;
         if (UNLIKELY(nnsw && oddhp>&ff->e.p[PMAX])) {
 #ifdef BETA
-          fprintf(stderr, "Switch to extra args\n");
+          csound->DebugMsg(csound, "Switch to extra args\n");
 #endif
           nnsw = 0;                /* only switch once */
           oddhp = &(ff->e.c.extra[1]);
@@ -925,7 +925,7 @@ static int gn1314(FGDATA *ff, FUNC *ftp, MYFLT mxval, MYFLT mxscal)
       *hp++ = sum * mxscal;                     /* repl this h w. coef (sum) */
       if (UNLIKELY(nsw && hp>&ff->e.p[PMAX])) {
 #ifdef BETA
-        fprintf(stderr, "Switch to extra args\n");
+        csound->DebugMsg(csound, "Switch to extra args\n");
 #endif
         nsw = 0;                /* only switch once */
         hp = &(ff->e.c.extra[1]);
@@ -964,7 +964,7 @@ static int gen15(FGDATA *ff, FUNC *ftp)
       h = *fp++;                                /* rpl h,angle pairs */
       if (UNLIKELY(nsw && fp>&ff->e.p[PMAX])) {
 #ifdef BETA
-        fprintf(stderr, "Switch to extra args\n");
+        csound->DebugMsg(csound, "Switch to extra args\n");
 #endif
         nsw = 0;                /* only switch once */
         fp = &(ff->e.c.extra[1]);
@@ -974,9 +974,9 @@ static int gen15(FGDATA *ff, FUNC *ftp)
       *sinp++ = h * SIN(angle);  /* and save the sine */
     }
     nargs -= nh;
+    ff->e.pcnt = (int16)(nargs + 4);            /* added by F. Pinot 16-01-2012 */
     if (gen13(ff, ftp) != OK)                   /* call gen13   */
       return NOTOK;
-    ftresdisp(ff, ftp);                         /* and display fno   */
     lp13 = (void*) ftp;
     ff->fno++;                                  /* alloc eq. space for fno+1 */
     ftp = ftalloc(ff);                          /* & copy header */
@@ -990,15 +990,20 @@ static int gen15(FGDATA *ff, FUNC *ftp)
       *fp++ = *sinp++;                          /* & copy rem hn*sin */
       if (UNLIKELY(nsw && fp>&ff->e.p[PMAX])) {
 #ifdef BETA
-        fprintf(stderr, "Switch to extra args\n");
+        csound->DebugMsg(csound, "Switch to extra args\n");
 #endif
         nsw = 0;                /* only switch once */
         fp = &(ff->e.c.extra[1]);
       }
     }
     nargs--;
+    ff->e.pcnt = (int16)(nargs + 4);            /* added by F. Pinot 16-01-2012 */
     free(hsin);
-    return gen14(ff, ftp);                      /* now draw ftable   */
+    n = gen14(ff, ftp);                         /* now draw ftable   */
+    ftresdisp(ff, ftp);                         /* added by F. Pinot 16-01-2012 */
+    ff->fno--;                                  /* F. Pinot, the first function table */
+                                                /* is scaled and displayed by hfgens */
+    return n;
 }
 
 static int gen16(FGDATA *ff, FUNC *ftp)
@@ -1326,6 +1331,7 @@ static int gen23(FGDATA *ff, FUNC *ftp)
       /* Allocate memory and read them in now */
   /*  ff->flen      = ff->flen + 2;        ??? */
       ftp           = ftalloc(ff);
+      ftp->lenmask  = 0xFFFFFFFF; /* avoid the error in csoundFTFind */
     }
     fp = ftp->ftable;
     j = 0;
@@ -2684,7 +2690,7 @@ static int gen49raw(FGDATA *ff, FUNC *ftp)
     uint32_t bufsize, bufused = 0;
     uint8_t *buffer;
     int size = 0x1000;
-    int flen;
+    int flen, nchanls, def = 0;
 
     if (UNLIKELY(ff->e.pcnt < 7)) {
       return fterror(ff, Str("insufficient arguments"));
@@ -2708,7 +2714,6 @@ static int gen49raw(FGDATA *ff, FUNC *ftp)
       else
         sprintf(sfname, "soundin.%d", filno);   /* soundin.filno */
     }
-    skip = ff->e.p[6];
     chan  = (int) MYFLT2LRND(ff->e.p[7]);
     if (UNLIKELY(chan < 0)) {
       return fterror(ff, Str("channel %d illegal"), (int) chan);
@@ -2750,7 +2755,6 @@ static int gen49raw(FGDATA *ff, FUNC *ftp)
       mp3dec_uninit(mpa);
       return fterror(ff, mp3dec_error(r));
     }
-    ftp->gen01args.sample_rate = mpainfo.frequency;
     /* maxsize = mpainfo.decoded_sample_size */
     /*   *mpainfo.decoded_frame_samples */
     /*   *mpainfo.frames; */
@@ -2762,13 +2766,14 @@ static int gen49raw(FGDATA *ff, FUNC *ftp)
       if (mpainfo.layer == 1) strcat(temp, "Layer I");
       else if (mpainfo.layer == 2) strcat(temp, "Layer II");
       else strcat(temp, "Layer III");
-      fprintf(stderr, "Input:  %s, %s, %d kbps, %d Hz  (%d:%02d)\n",
+      csound->DebugMsg(csound, "Input:  %s, %s, %d kbps, %d Hz  (%d:%02d)\n",
               temp, ((mpainfo.channels > 1) ? "stereo" : "mono"),
               mpainfo.bitrate, mpainfo.frequency, mpainfo.duration/60,
               mpainfo.duration%60);
     }
     buffer = (uint8_t *)malloc(size);
     bufsize = size/mpainfo.decoded_sample_size;
+    skip = (int)(ff->e.p[6] * mpainfo.frequency);
     while (skip > 0) {
       uint32_t xx = skip;
       if ((uint32_t)xx > bufsize) xx = bufsize;
@@ -2778,13 +2783,33 @@ static int gen49raw(FGDATA *ff, FUNC *ftp)
     }
     //bufsize *= mpainfo.decoded_sample_size;
     r = mp3dec_decode(mpa, buffer, size, &bufused);
+    nchanls = (chan == 2 && mpainfo.channels == 2 ? 2 : 1);
+    if (ff->flen == 0) {    /* deferred ftalloc */
+      int fsize, frames;
+      frames = mpainfo.frames * mpainfo.decoded_frame_samples;
+      fsize  = frames * nchanls;
+      if (UNLIKELY((ff->flen = fsize) <= 0))
+        return fterror(ff, Str("deferred size, but filesize unknown"));
+      if (UNLIKELY(ff->flen > MAXLEN))
+        return fterror(ff, Str("illegal table length"));
+      if (csound->oparms->msglevel & 7)
+        csound->Message(csound, Str("  defer length %d\n"), ff->flen);
+      ftp = ftalloc(ff);
+      ftp->lenmask  = 0L;
+      ftp->flenfrms = frames;
+      ftp->nchanls  = nchanls;
+      fp = ftp->ftable;
+      def = 1;
+    }
+    ftp->gen01args.sample_rate = mpainfo.frequency;
+    ftp->cvtbas = LOFACT * mpainfo.frequency * csound->onedsr;
     flen = ftp->flen;
     //printf("gen49: flen=%d size=%d bufsize=%d\n", flen, size, bufsize);
     while ((r == MP3DEC_RETCODE_OK) && bufused) {
       int i;
       short *bb = (short*)buffer;
       //printf("gen49: p=%d bufused=%d\n", p, bufused);
-      for (i=0; i<bufused/mpainfo.decoded_sample_size; i++)  {
+      for (i=0; i<bufused*nchanls/mpainfo.decoded_sample_size; i++)  {
         if (p>=flen) {
           free(buffer);
           //printf("gen49: i=%d p=%d exit as at end of table\n", i, p);
@@ -2801,6 +2826,7 @@ static int gen49raw(FGDATA *ff, FUNC *ftp)
 
     free(buffer);
     r |= mp3dec_uninit(mpa);
+    if (def) ftresdisp(ff, ftp);
     return ((r == MP3DEC_RETCODE_OK) ? OK : NOTOK);
 }
 
@@ -2825,6 +2851,7 @@ static int gen49(FGDATA *ff, FUNC *ftp)
     return gen49raw(ff, ftp);
 }
 
+#if 0
 static CS_NOINLINE FUNC *gen49_defer_load(CSOUND *csound, int fno)
 {
     FGDATA  ff;
@@ -2850,6 +2877,7 @@ static CS_NOINLINE FUNC *gen49_defer_load(CSOUND *csound, int fno)
     }
     return csound->flist[fno];
 }
+#endif
 
 static int gen51(FGDATA *ff, FUNC *ftp)    /* Gab 1/3/2005 */
 {
diff --git a/Engine/linevent.c b/Engine/linevent.c
index c3420d1..9ccb6fe 100644
--- a/Engine/linevent.c
+++ b/Engine/linevent.c
@@ -108,7 +108,7 @@ void RTLineset(CSOUND *csound)      /* set up Linebuf & ready the input files */
 #define O_RDONLY _O_RDONLY
 #endif
     else
-      if (UNLIKELY((csound->Linefd = open(O->Linename, O_RDONLY|O_NDELAY MODE)) < 0))
+      if (UNLIKELY((csound->Linefd=open(O->Linename, O_RDONLY|O_NDELAY MODE)) < 0))
         csoundDie(csound, Str("Cannot open %s"), O->Linename);
     csound->Message(csound, Str("stdmode = %.8x Linefd = %d\n"),
                     ST(stdmode), csound->Linefd);
diff --git a/Engine/memalloc.c b/Engine/memalloc.c
index 6cd086c..7b9d930 100644
--- a/Engine/memalloc.c
+++ b/Engine/memalloc.c
@@ -66,7 +66,7 @@ void *mmalloc(CSOUND *csound, size_t size)
 
 #ifdef MEMDEBUG
     if (UNLIKELY(size == (size_t) 0)) {
-      fprintf(stderr,
+      csound->DebugMsg(csound,
               " *** internal error: mmalloc() called with zero nbytes\n");
       return NULL;
     }
@@ -97,7 +97,7 @@ void *mcalloc(CSOUND *csound, size_t size)
 
 #ifdef MEMDEBUG
     if (UNLIKELY(size == (size_t) 0)) {
-      fprintf(stderr,
+      csound->DebugMsg(csound,
               " *** internal error: mcalloc() called with zero nbytes\n");
       return NULL;
     }
@@ -131,7 +131,7 @@ void mfree(CSOUND *csound, void *p)
     pp = HDR_PTR(p);
 #ifdef MEMDEBUG
     if (UNLIKELY(pp->magic != MEMALLOC_MAGIC || pp->ptr != p)) {
-      fprintf(stderr, " *** internal error: mfree() called with invalid "
+      csound->DebugMsg(csound, " *** internal error: mfree() called with invalid "
                       "pointer (%p)\n", p);
       /* exit() is ugly, but this is a fatal error that can only occur */
       /* as a result of a bug */
@@ -169,7 +169,7 @@ void *mrealloc(CSOUND *csound, void *oldp, size_t size)
     pp = HDR_PTR(oldp);
 #ifdef MEMDEBUG
     if (UNLIKELY(pp->magic != MEMALLOC_MAGIC || pp->ptr != oldp)) {
-      fprintf(stderr, " *** internal error: mrealloc() called with invalid "
+      csound->DebugMsg(csound, " *** internal error: mrealloc() called with invalid "
                       "pointer (%p)\n", oldp);
       /* exit() is ugly, but this is a fatal error that can only occur */
       /* as a result of a bug */
diff --git a/Engine/musmon.c b/Engine/musmon.c
index bef5a64..c6f7ff0 100644
--- a/Engine/musmon.c
+++ b/Engine/musmon.c
@@ -39,7 +39,6 @@ extern  int     MIDIinsert(CSOUND *, int, MCHNBLK*, MEVENT*);
 extern  int     insert(CSOUND *, int, EVTBLK*);
 extern  void    MidiOpen(CSOUND *);
 extern  void    m_chn_init_all(CSOUND *);
-extern  void    scsort(CSOUND *, FILE *, FILE *);
 extern  void    scsortstr(CSOUND *, CORFIL *);
 extern  void    infoff(CSOUND*, MYFLT), orcompact(CSOUND*);
 extern  void    beatexpire(CSOUND *, double), timexpire(CSOUND *, double);
@@ -290,20 +289,32 @@ int musmon(CSOUND *csound)
       /* call cscore, optionally re-enter via lplay() */
       csound->cscoreCallback_(csound);
       fclose(csound->oscfp); csound->oscfp = NULL;
-      fclose(csound->scfp); csound->scfp = NULL;
+      if (csound->scfp != NULL) {
+        fclose(csound->scfp);
+        csound->scfp = NULL;
+      }
       if (ST(lplayed))
         return 0;
 
       /*  read from cscore.out */
-      if (UNLIKELY(!(csound->scfp = fopen("cscore.out", "r"))))
+      if (UNLIKELY(!(csound->scfp = fopen("cscore.out", "r")))) {
         csoundDie(csound, Str("cannot reopen cscore.out"));
+      }
+      else {
+        CORFIL *inf = corfile_create_w();
+        int c;
+        while ((c=getc(csound->scfp))!=EOF) corfile_putc(c, inf);
+        corfile_rewind(inf);
+        csound->scorestr = inf;
+        corfile_rm(&csound->scstr);
+      }
       csoundNotifyFileOpened(csound, "cscore.out", CSFTYPE_SCORE_OUT, 0, 0);
       /* write to cscore.srt */
      if (UNLIKELY(!(csound->oscfp = fopen("cscore.srt", "w"))))
         csoundDie(csound, Str("cannot reopen cscore.srt"));
       csoundNotifyFileOpened(csound, "cscore.srt", CSFTYPE_SCORE_OUT, 1, 0);
       csound->Message(csound, Str("sorting cscore.out ..\n"));
-      csound->scorestr = copy_to_corefile(csound, "cscore.srt", NULL, 1);
+      /* csound->scorestr = copy_to_corefile(csound, "cscore.srt", NULL, 1); */
       scsortstr(csound, csound->scorestr);  /* call the sorter again */
       fclose(csound->scfp); csound->scfp = NULL;
       fputs(corfile_body(csound->scstr), csound->oscfp);
diff --git a/Engine/namedins.c b/Engine/namedins.c
index b51b176..e1c0ca5 100644
--- a/Engine/namedins.c
+++ b/Engine/namedins.c
@@ -537,9 +537,10 @@ char *strsav_string(CSOUND *csound, char *s)
          sp = (STRSAV_SPACE*)mcalloc(csound, sizeof(STRSAV_SPACE));
          sp->sp =
           (char*)mcalloc(csound, sp->size = n+STRSPACE);
-         csound->Message(csound,
+         csound->DebugMsg(csound,
                         "internal message: strsav: buffer length now %d\n", 
                         sp->size);
+
        }
        else {
          sp = (STRSAV_SPACE*) mcalloc(csound, sizeof(STRSAV_SPACE));
diff --git a/Engine/new_orc_parser.c b/Engine/new_orc_parser.c
index dc17611..9caed43 100644
--- a/Engine/new_orc_parser.c
+++ b/Engine/new_orc_parser.c
@@ -1,4 +1,4 @@
- /*
+/*
     new_orc_parser.c:
 
     Copyright (C) 2006
@@ -29,18 +29,24 @@
 #include "parse_param.h"
 #include "corfile.h"
 
-//#include "yyguts.h"
-
 #define ST(x)   (((RDORCH_GLOBALS*) csound->rdorchGlobals)->x)
 
 extern void csound_orcrestart(FILE*, void *);
 
 extern int csound_orcdebug;
 
+extern void print_csound_predata(void *);
+extern void csound_prelex_init(void *);
+extern void csound_preset_extra(void *, void *);
+
+extern void csound_prelex(CSOUND*, void*);
+extern void csound_prelex_destroy(void *);
+
+extern void csound_orc_scan_buffer (const char *, size_t, void*);
 extern int csound_orcparse(PARSE_PARM *, void *, CSOUND*, TREE*);
 extern void csound_orclex_init(void *);
 extern void csound_orcset_extra(void *, void *);
-extern void csound_orc_scan_string(char *, void *);
+//extern void csound_orc_scan_string(char *, void *);
 extern void csound_orcset_lineno(int, void*);
 extern void csound_orclex_destroy(void *);
 extern void init_symbtab(CSOUND*);
@@ -56,89 +62,132 @@ void csp_weights_calculate(CSOUND *, TREE *);
 #endif
 
 
+void csound_print_preextra(CSOUND *csound, PRE_PARM  *x)
+{
+    csound->DebugMsg(csound,"********* Extra Pre Data %p *********\n", x);
+    csound->DebugMsg(csound,"macros = %p, macro_stack_ptr = %u, ifdefStack=%p, isIfndef=%d\n"
+           "isInclude=%d, clearBufferAfterEOF=%d, line=%d\n",
+           x->macros, x->macro_stack_ptr, x->ifdefStack, x->isIfndef, 
+           x->isInclude, x->clearBufferAfterEOF, x->line);
+    csound->DebugMsg(csound,"******************\n");
+}
+
+uint32_t make_location(PRE_PARM *qq)
+{
+    int d = qq->depth;
+    uint32_t loc = 0;
+    int n = (d>6?d-5:0);
+    for (; n<=d; n++) {
+      loc = (loc<<6)+(qq->lstack[n]);
+    }
+    return loc;
+}
+
 int new_orc_parser(CSOUND *csound)
 {
     int retVal;
-    TREE* astTree = (TREE *)mcalloc(csound, sizeof(TREE));
     OPARMS *O = csound->oparms;
-    PARSE_PARM  pp;
-    //    struct yyguts_t* yyg;
-
-    memset(&pp, '\0', sizeof(PARSE_PARM));
-    init_symbtab(csound);
-
-    pp.buffer = (char*)csound->Calloc(csound, lMaxBuffer);
-
-    if (UNLIKELY(PARSER_DEBUG)) csound->Message(csound, "Testing...\n");
-
-    csound_orcdebug = O->odebug;
-    csound_orclex_init(&pp.yyscanner);
-    //    yyg = (struct yyguts_t*)pp.yyscanner;
-
-    csound_orcset_extra(&pp, pp.yyscanner);
-
-    csound_orc_scan_string(corfile_body(csound->orchstr), pp.yyscanner);
-    /*     These relate to file input only       */
-    /*     csound_orcset_in(ttt, pp.yyscanner); */
-    /*     csound_orcrestart(ttt, pp.yyscanner); */
-    //csound_orcset_lineno(csound->orcLineOffset, pp.yyscanner);
-    cs_init_math_constants_macros(csound, pp.yyscanner);
-    cs_init_omacros(csound, pp.yyscanner, csound->omacros);
-
-    retVal = csound_orcparse(&pp, pp.yyscanner, csound, astTree);
-    if (csound->synterrcnt) retVal = 3;
-    if (UNLIKELY(pp.ifdefStack != NULL)) {
-      csound->Message(csound, Str("Unmatched #ifdef\n"));
-      csound->LongJmp(csound, 1);
-    }
-    if (LIKELY(retVal == 0)) {
-      csound->Message(csound, "Parsing successful!\n");
+    {
+      PRE_PARM    qq;
+      /* Preprocess */
+      memset(&qq, 0, sizeof(PRE_PARM));
+      csound_prelex_init(&qq.yyscanner);
+      csound_preset_extra(&qq, qq.yyscanner);
+      qq.line = csound->orcLineOffset;
+      csound->expanded_orc = corfile_create_w();
+      {
+        char bb[80];
+        file_to_int(csound, "**unknown**");
+        if (csound->orchname==NULL ||
+            csound->orchname[0]=='\0') csound->orchname = csound->csdname;
+        /* We know this is the start so stack is empty so far */
+        sprintf(bb, "#source %d\n",
+                qq.lstack[0] = file_to_int(csound, csound->orchname));
+        corfile_puts(bb, csound->expanded_orc);
+        sprintf(bb, "#line %d\n", csound->orcLineOffset);
+        corfile_puts(bb, csound->expanded_orc);
+      }
+      csound->DebugMsg(csound, "Calling preprocess on >>%s<<\n", 
+              corfile_body(csound->orchstr));
+      //csound->DebugMsg(csound,"FILE: %s \n", csound->orchstr->body);
+      //    csound_print_preextra(&qq);
+      cs_init_math_constants_macros(csound, &qq);
+      cs_init_omacros(csound, &qq, csound->omacros);
+      //    csound_print_preextra(&qq);
+      csound_prelex(csound, qq.yyscanner);
+      if (UNLIKELY(qq.ifdefStack != NULL)) {
+        csound->Message(csound, Str("Unmatched #ifdef\n"));
+        csound->LongJmp(csound, 1);
+      }
+      csound_prelex_destroy(qq.yyscanner);
+      csound->DebugMsg(csound, "yielding >>%s<<\n", corfile_body(csound->expanded_orc));
+      free(csound->orchstr); csound->orchstr=NULL;
     }
-    else {
-      if (retVal == 1){
-        csound->Message(csound, "Parsing failed due to invalid input!\n");
+    {
+      TREE* astTree = (TREE *)mcalloc(csound, sizeof(TREE));
+      PARSE_PARM  pp;
+      /* Parse */
+      memset(&pp, '\0', sizeof(PARSE_PARM));
+      init_symbtab(csound);
+
+      csound_orcdebug = O->odebug;
+      csound_orclex_init(&pp.yyscanner);
+
+      csound_orcset_extra(&pp, pp.yyscanner);
+      csound_orc_scan_buffer(corfile_body(csound->expanded_orc),
+                             corfile_tell(csound->expanded_orc), pp.yyscanner);
+      free(csound->expanded_orc);
+      //csound_orcset_lineno(csound->orcLineOffset, pp.yyscanner);
+      retVal = csound_orcparse(&pp, pp.yyscanner, csound, astTree);
+      if (csound->synterrcnt) retVal = 3;
+      if (LIKELY(retVal == 0)) {
+        csound->Message(csound, "Parsing successful!\n");
       }
-      else if (retVal == 2){
-        csound->Message(csound, "Parsing failed due to memory exhaustion!\n");
+      else {
+        if (retVal == 1){
+          csound->Message(csound, "Parsing failed due to invalid input!\n");
+        }
+        else if (retVal == 2){
+          csound->Message(csound, "Parsing failed due to memory exhaustion!\n");
+        }
+        else if (retVal == 3){
+          csound->Message(csound, "Parsing failed due to %d syntax error%s!\n",
+                          csound->synterrcnt, csound->synterrcnt==1?"":"s");
+        }
+        goto ending;
       }
-      else if (retVal == 3){
-        csound->Message(csound, "Parsing failed due to %d syntax error%s!\n",
-                        csound->synterrcnt, csound->synterrcnt==1?"":"s");
+      if (UNLIKELY(PARSER_DEBUG)) {
+        print_tree(csound, "AST - INITIAL\n", astTree);
       }
-      goto ending;
-    }
-    if (UNLIKELY(PARSER_DEBUG)) {
-      print_tree(csound, "AST - INITIAL\n", astTree);
-    }
-
-    astTree = verify_tree(csound, astTree);
+      //print_tree(csound, "AST - INITIAL\n", astTree);
+      astTree = verify_tree(csound, astTree);
+      //print_tree(csound, "AST - FOLDED\n", astTree);
 #ifdef PARCS
-    if (LIKELY(O->numThreads > 1)) {
-      /* insert the locks around global variables before expr expansion */
-      astTree = csp_locks_insert(csound, astTree);
-      csp_locks_cache_build(csound);
-    }
+      if (LIKELY(O->numThreads > 1)) {
+        /* insert the locks around global variables before expr expansion */
+        astTree = csp_locks_insert(csound, astTree);
+        csp_locks_cache_build(csound);
+      }
 #endif /* PARCS */
 
-    astTree = csound_orc_expand_expressions(csound, astTree);
+      astTree = csound_orc_expand_expressions(csound, astTree);
 
-    if (UNLIKELY(PARSER_DEBUG)) {
-      print_tree(csound, "AST - AFTER EXPANSION\n", astTree);
-    }     
+      if (UNLIKELY(PARSER_DEBUG)) {
+        print_tree(csound, "AST - AFTER EXPANSION\n", astTree);
+      }     
 #ifdef PARCS
-    if (LIKELY(O->numThreads > 1)) {
-      /* calculate the weights for the instruments */
-      csp_weights_calculate(csound, astTree);
-    }
+      if (LIKELY(O->numThreads > 1)) {
+        /* calculate the weights for the instruments */
+        csp_weights_calculate(csound, astTree);
+      }
 #endif /* PARCS */
- 
-    astTree = csound_orc_optimize(csound, astTree);
-    csound_orc_compile(csound, astTree);
-
- ending:
-    csound->Free(csound, pp.buffer);
-    corfile_rm(&csound->orchstr);
-    csound_orclex_destroy(pp.yyscanner);
+      
+      astTree = csound_orc_optimize(csound, astTree);
+      csound_orc_compile(csound, astTree);
+
+    ending:
+      csound_orclex_destroy(pp.yyscanner);
+    }
     return retVal;
 }
 
diff --git a/Engine/parse_param.h b/Engine/parse_param.h
index 387be22..dd37005 100644
--- a/Engine/parse_param.h
+++ b/Engine/parse_param.h
@@ -3,7 +3,8 @@
 struct MACRO;
 
 typedef struct MACRON {
-  int      n;
+  int             n;
+  unsigned int    line; 
   struct MACRO    *s;
 } MACRON;
 
@@ -25,27 +26,35 @@ typedef struct IFDEFSTACK_ {
                                 /*   #ifdef, 2: skipping due to parent      */
 } IFDEFSTACK;
 
-typedef struct parse_parm_s {
+
+typedef struct pre_parm_s {  
     void            *yyscanner;
-    char            *buffer;
-//  int             pos;
-//  int             length;
-//  double          result;
     MACRO           *macros;
-//  unsigned int    macro_stack_ptr;
-    int             nBuffer;
-    int             lBuffer;
     MACRON alt_stack[MAX_INCLUDE_DEPTH];
     unsigned int macro_stack_ptr;
-    char            *xstrbuff;
-    int             xstrptr,xstrmax;
     IFDEFSTACK      *ifdefStack;
     unsigned char   isIfndef;
     unsigned char   isInclude;
+    unsigned char   isString;
+    unsigned char   clearBufferAfterEOF;
+    uint16_t        line;
+    uint32_t        locn;
+    uint32_t        llocn;
+    uint16_t        depth;
+    uint8_t         lstack[1024]; 
+} PRE_PARM;
+
+typedef struct parse_parm_s {
+    void            *yyscanner;
+    int             locn;
+    MACRO           *macros;
+    char            *xstrbuff;
+    int             xstrptr,xstrmax;
     unsigned char   clearBufferAfterEOF;
 } PARSE_PARM;
 
-#define lMaxBuffer (1000)
-void    cs_init_math_constants_macros(CSOUND*, void*);
-void    cs_init_omacros(CSOUND*, void*, NAMES*);
+void    cs_init_math_constants_macros(CSOUND*, PRE_PARM*);
+void    cs_init_omacros(CSOUND*, PRE_PARM*, NAMES*);
 
+uint32_t make_location(PRE_PARM *);
+extern uint8_t file_to_int(CSOUND*, char*);
diff --git a/Engine/rdorch.c b/Engine/rdorch.c
index 7c2ebe6..0e6b837 100644
--- a/Engine/rdorch.c
+++ b/Engine/rdorch.c
@@ -900,7 +900,7 @@ void rdorchfile(CSOUND *csound)     /* read entire orch file into txt space */
           goto ifdefSkipCode;
         if (preprocName == NULL)
           lexerr(csound, Str("Unexpected # character"));
-        else
+        else if (strcmp("exit", preprocName)) /* VL: ignore #exit */
           lexerr(csound, Str("Unknown # option: '%s'"), preprocName);
       }
       free(mname);
diff --git a/Engine/rdscor.c b/Engine/rdscor.c
index 4c4542e..bde13b1 100644
--- a/Engine/rdscor.c
+++ b/Engine/rdscor.c
@@ -108,7 +108,9 @@ int rdscor(CSOUND *csound, EVTBLK *e) /* read next score-line from scorefile */
 
     if (csound->scstr == NULL ||
         csound->scstr->body[0] == '\0') {   /* if no concurrent scorefile  */
+#ifdef BETA
       csound->Message(csound, "THIS SHOULD NOT HAPPEN -- CONTACT jpff");
+#endif
       e->opcod = 'f';             /*     return an 'f 0 3600'    */
       e->p[1] = FL(0.0);
       e->p[2] = FL(INF);
@@ -156,6 +158,8 @@ int rdscor(CSOUND *csound, EVTBLK *e) /* read next score-line from scorefile */
         e->opcod = c;
         e->pcnt = 0;
         return(1);
+      case EOF:                          /* necessary for cscoreGetEvent */
+        return(0);
       default:                                /* WARPED scorefile:       */
         if (!csound->warped) goto unwarped;
         e->opcod = c;                                       /* opcod */
@@ -179,7 +183,7 @@ int rdscor(CSOUND *csound, EVTBLK *e) /* read next score-line from scorefile */
                     if (pp >= plim) {
                       MYFLT *q;
                       int c=1;
-                      fprintf(stderr, "Extra p-fields (%d %d %d %d)\n",
+                      csound->DebugMsg(csound, "Extra p-fields (%d %d %d %d)\n",
                               (int)e->p[1],(int)e->p[2],
                               (int)e->p[3],(int)e->p[4]);
                       e->c.extra = (MYFLT*)realloc(e->c.extra,sizeof(MYFLT)*PMAX);
@@ -188,7 +192,7 @@ int rdscor(CSOUND *csound, EVTBLK *e) /* read next score-line from scorefile */
                       while ((corfile_getc(csound->scstr) != '\n') &&
                              (scanflt(csound, &q[c++]))) {
                         if (c > (int) e->c.extra[0]) {
-                          fprintf(stderr, "and more extra p-fields [%d](%d)%d\n",
+                          csound->DebugMsg(csound, "and more extra p-fields [%d](%d)%d\n",
                                   c, (int) e->c.extra[0],
                                   sizeof(MYFLT)*((int)e->c.extra[0]+PMAX) );
                           q = e->c.extra =
diff --git a/Engine/scsort.c b/Engine/scsort.c
index 8713b4d..d26222a 100644
--- a/Engine/scsort.c
+++ b/Engine/scsort.c
@@ -32,6 +32,7 @@ extern int  sread(CSOUND *csound);
 /* called from smain.c or some other main */
 /* reads,sorts,timewarps each score sect in turn */
 
+#ifdef OLD_CODE
 void scsort(CSOUND *csound, FILE *scin, FILE *scout)
 {
     int     n;
@@ -48,6 +49,7 @@ void scsort(CSOUND *csound, FILE *scin, FILE *scout)
     }
     sfree(csound);              /* return all memory used */
 }
+#endif
 
 extern void sread_initstr(CSOUND *);
 void scsortstr(CSOUND *csound, CORFIL *scin)
diff --git a/Engine/scxtract.c b/Engine/scxtract.c
index 9a8a006..d8e69d8 100644
--- a/Engine/scxtract.c
+++ b/Engine/scxtract.c
@@ -22,16 +22,19 @@
 */
 
 #include "csoundCore.h"                            /*  SCXTRACT.C  */
+#include "corfile.h"
 
 extern void readxfil(CSOUND *, FILE *), extract(CSOUND *), swrite(CSOUND *);
 extern void sfree(CSOUND *csound);
 extern int  sread(CSOUND *csound);
 extern void sread_init(CSOUND *csound);
+extern void swritestr(CSOUND *csound);
 
 /* called from xmain.c or some other main */
 /*   extracts events from each score sect */
 /*   according to the controlling xfile   */
 
+#ifdef OLD_CODE
 int scxtract(CSOUND *csound, FILE *scin, FILE * scout, FILE *xfile)
 {
     int     n;
@@ -52,4 +55,27 @@ int scxtract(CSOUND *csound, FILE *scin, FILE * scout, FILE *xfile)
     sfree(csound);              /* return all memory used */
     return 0;
 }
+#endif
 
+extern void sread_initstr(CSOUND *);
+int scxtract(CSOUND *csound, CORFIL *scin, FILE *xfile)
+{
+    int     n;
+
+    csound->scoreout = NULL;
+    csound->scorestr = scin;
+    csound->scstr = corfile_create_w();
+    csound->sectcnt = 0;
+    readxfil(csound, xfile);
+    sread_initstr(csound);
+
+    while ((n = sread(csound)) > 0) {
+      /*  allout();   */
+      /*  textout();  */
+      extract(csound);
+      swritestr(csound);
+    }
+    corfile_flush(csound->scstr);
+    sfree(csound);              /* return all memory used */
+    return 0;
+}
diff --git a/Engine/sort.c b/Engine/sort.c
index 5ad1121..c8a11f8 100644
--- a/Engine/sort.c
+++ b/Engine/sort.c
@@ -280,7 +280,7 @@ void sort(CSOUND *csound)
     for (i=1; i<n-1; i++ ) {
       bp = A[i]; bp->prvblk = A[i-1]; bp->nxtblk = A[i+1];
     }
-    bp = A[n-1]; bp->nxtblk = NULL; bp->prvblk = A[n-2];
+    if (n>1) bp = A[n-1]; bp->nxtblk = NULL; bp->prvblk = A[n-2];
     /* and return temporary space */
     free(A);
 }
diff --git a/Engine/sread.c b/Engine/sread.c
index e75dc5a..abb97ed 100644
--- a/Engine/sread.c
+++ b/Engine/sread.c
@@ -270,7 +270,7 @@ static int undefine_score_macro(CSOUND *csound, const char *name)
         corfile_rm(&(ST(macros)->body));
       mfree(csound, ST(macros)->name);
  #ifdef MACDEBUG
-     printf("%s(%d): corfile is %p\n", __FILE__, __LINE__, ST(macros)->body);
+     csound->DebugMsg(csound,"%s(%d): corfile is %p\n", __FILE__, __LINE__, ST(macros)->body);
  #endif
      for (i = 0; i < ST(macros)->acnt; i++)
         mfree(csound, ST(macros)->arg[i]);
@@ -333,11 +333,14 @@ static int getscochar(CSOUND *csound, int expand)
       goto top;
     }
 #ifdef MACDEBUG
-    printf("%s(%d): character = %c(%.2d)\n", __FILE__, __LINE__, c, c);
+    csound->DebugMsg(csound,"%s(%d): character = %c(%.2d)\n", __FILE__, __LINE__, c, c);
 #endif
     if (c == '\r') {    /* can only occur in files, and not in macros */
-      if ((c = corfile_getc(ST(str)->cf)) != '\n')
+      if ((c = corfile_getc(ST(str)->cf)) != '\n') {
+        if (c == EOF)
+          goto top;
         corfile_ungetc(ST(str)->cf);
+      }
       c = '\n';
     }
     if (c == '\n') {
@@ -410,9 +413,11 @@ static int getscochar(CSOUND *csound, int expand)
 #endif
           nn->body = corfile_create_w();
 #ifdef MACDEBUG
-          printf("%s(%d): creating\n", __FILE__, __LINE__, nn->body);
+          csound->DebugMsg(csound,"%s(%d): creating\n", __FILE__, __LINE__, nn->body);
 #endif
           while ((c = getscochar(csound, 1))!= term && c != trm1) {
+            if (UNLIKELY(c==EOF))
+              scorerr(csound, Str("Syntax error in macro call"));
             corfile_putc(c, nn->body);
           }
           corfile_rewind(nn->body);
@@ -603,7 +608,7 @@ static int getscochar(CSOUND *csound, int expand)
         strcpy(nn->name, "[");
         nn->body = corfile_create_r(buffer);
 #ifdef MACDEBUG
-        printf("%s(%d): creating arg %p\n", __FILE__, __LINE__, nn->body);
+        csound->DebugMsg(csound,"%s(%d): creating arg %p\n", __FILE__, __LINE__, nn->body);
 #endif
         nn->acnt = 0;   /* No arguments for arguments */
         nn->next = ST(macros);
@@ -661,9 +666,9 @@ static int nested_repeat(CSOUND *csound)                /* gab A9*/
       sscanf(corfile_current(ST(repeat_mm_n)[ST(repeat_index)]->body),
              "%d", &i);
 #ifdef MACDEBUG
-      printf("%s(%d) reset point to %d\n", __FILE__, __LINE__,
+      csound->DebugMsg(csound,"%s(%d) reset point to %d\n", __FILE__, __LINE__,
              ST(repeat_point_n)[ST(repeat_index)], i);
-      printf("%s(%d) corefile: %s %d %d\n", __FILE__, __LINE__, 
+      csound->DebugMsg(csound,"%s(%d) corefile: %s %d %d\n", __FILE__, __LINE__, 
              ST(repeat_mm_n)[ST(repeat_index)]->body->body,
              ST(repeat_mm_n)[ST(repeat_index)]->body->p,
              ST(repeat_mm_n)[ST(repeat_index)]->body->len);
@@ -673,13 +678,13 @@ static int nested_repeat(CSOUND *csound)                /* gab A9*/
         char buffer[128];
         sprintf(buffer, "%d", i);
 #ifdef MACDEBUG
-        printf("%s(%d) new i = %s\n", __FILE__, __LINE__,  buffer);
+        csound->DebugMsg(csound,"%s(%d) new i = %s\n", __FILE__, __LINE__,  buffer);
 #endif
         corfile_reset(ST(repeat_mm_n)[ST(repeat_index)]->body);
         corfile_puts(buffer, ST(repeat_mm_n)[ST(repeat_index)]->body);
         corfile_rewind(ST(repeat_mm_n)[ST(repeat_index)]->body);
 #ifdef MACDEBUG
-        printf("%s(%d) corefile: %s %d %d\n", __FILE__, __LINE__, 
+        csound->DebugMsg(csound,"%s(%d) corefile: %s %d %d\n", __FILE__, __LINE__, 
                ST(repeat_mm_n)[ST(repeat_index)]->body->body,
                ST(repeat_mm_n)[ST(repeat_index)]->body->p,
                ST(repeat_mm_n)[ST(repeat_index)]->body->len);
@@ -727,7 +732,9 @@ static int do_repeat(CSOUND *csound)
         {
           char buffer[128];
           sprintf(buffer, "%d", i);
+          corfile_reset(ST(repeat_mm)->body);
           corfile_puts(buffer, ST(repeat_mm)->body);
+          corfile_rewind(ST(repeat_mm)->body);
         }
         if (csound->oparms->msglevel & TIMEMSG)
           csound->Message(csound, Str("Repeat section (%d)\n"), i);
@@ -781,7 +788,7 @@ static void init_smacros(CSOUND *csound, NAMES *nn)
         p++;
       mm->body = corfile_create_r(p);
 #ifdef MACDEBUG
-      printf("%s(%d): init %s %p\n", __FILE__, __LINE__, mm->name, mm->body);
+      csound->DebugMsg(csound,"%s(%d): init %s %p\n", __FILE__, __LINE__, mm->name, mm->body);
 #endif
       nn = nn->next;
     }
@@ -790,7 +797,7 @@ static void init_smacros(CSOUND *csound, NAMES *nn)
     strcpy(mm->name, "INF");
     mm->body = corfile_create_r("2147483647.0");
 #ifdef MACDEBUG
-    printf("%s(%d): INF %p\n", __FILE__, __LINE__, mm->body);
+    csound->DebugMsg(csound,"%s(%d): INF %p\n", __FILE__, __LINE__, mm->body);
 #endif
     mm->next = ST(macros);
     ST(macros) = mm;
@@ -898,9 +905,10 @@ int sread(CSOUND *csound)       /*  called from main,  reads from SCOREIN   */
            we must pop those inputs before doing an 'r' repeat. */
         while (ST(str)->is_marked_repeat && ST(input_cnt) > 0) {
           /* close all marked repeat inputs */
-          if (ST(str)->fd != NULL) {
-            csound->FileClose(csound, ST(str)->fd); ST(str)->fd = NULL;
-          }
+          /* if (ST(str)->fd != NULL) { */
+          /*   csound->FileClose(csound, ST(str)->fd); ST(str)->fd = NULL; */
+          /* } */
+          corfile_rm(&(ST(str)->cf));
           ST(str)--; ST(input_cnt)--;
         }
         if (ST(repeat_cnt) != 0) {
@@ -981,7 +989,7 @@ int sread(CSOUND *csound)       /*  called from main,  reads from SCOREIN   */
           ST(repeat_mm_n)[ST(repeat_index)]->acnt = 0;
           ST(repeat_mm_n)[ST(repeat_index)]->body = corfile_create_r("0");
 #ifdef MACDEBUG
-          printf("%s(%d): repeat %s zero %p\n", __FILE__, __LINE__,
+          csound->DebugMsg(csound,"%s(%d): repeat %s zero %p\n", __FILE__, __LINE__,
                  ST(repeat_name_n)[ST(repeat_index)],
                  ST(repeat_mm_n)[ST(repeat_index)]->body);
 #endif
@@ -1008,9 +1016,10 @@ int sread(CSOUND *csound)       /*  called from main,  reads from SCOREIN   */
         if (ST(str)->is_marked_repeat) {
           while (ST(str)->is_marked_repeat && ST(input_cnt) > 0) {
             /* close all marked repeat inputs */
-            if (ST(str)->fd != NULL) {
-              csound->FileClose(csound, ST(str)->fd); ST(str)->fd = NULL;
-            }
+            /* if (ST(str)->fd != NULL) { */
+            /*   csound->FileClose(csound, ST(str)->fd); ST(str)->fd = NULL; */
+            /* } */
+            corfile_rm(&(ST(str)->cf));
             ST(str)--; ST(input_cnt)--;
           }
           /* last time thru an 'r', cleanup up 'r' before finishing 'n' */
@@ -1065,7 +1074,7 @@ int sread(CSOUND *csound)       /*  called from main,  reads from SCOREIN   */
             ST(repeat_mm)->acnt = 0;
             ST(repeat_mm)->body = corfile_create_r("1");
 #ifdef MACDEBUG
-            printf("%s(%d): 1 %p\n", __FILE__, __LINE__,ST(repeat_mm)->body);
+            csound->DebugMsg(csound,"%s(%d): 1 %p\n", __FILE__, __LINE__,ST(repeat_mm)->body);
 #endif
             ST(repeat_mm)->next = ST(macros);
             ST(macros) = ST(repeat_mm);
@@ -1144,7 +1153,8 @@ int sread(CSOUND *csound)       /*  called from main,  reads from SCOREIN   */
             }
             ST(str)++;
             ST(str)->is_marked_repeat = 1;
-            ST(str)->cf = copy_to_corefile(csound, ST(names)[i].file, NULL, 1);
+            /* ST(str)->cf = copy_to_corefile(csound, ST(names)[i].file, NULL, 1); */
+            ST(str)->cf = corfile_create_r(ST(names)[i].file);
 //            ST(str)->cf = corfile_create_r(csound->GetFileName(ST(str)->fd));
             ST(str)->line = ST(names)[i].line;
             corfile_set(ST(str)->cf, ST(names)[i].posit);
@@ -1309,8 +1319,9 @@ static void ifa(CSOUND *csound)
       else switch (ST(bp)->pcnt) {      /*  watch for p1,p2,p3, */
       case 1:                           /*   & MYFLT, setinsno..*/
         if ((ST(op) == 'i' || ST(op) == 'q') && *ST(sp) == '"') {
-        /*   printf("***Entering second dubious code scnt=%d\n", csound->scnt0); */
-        /*   ST(bp)->p1val = ((int[4]){SSTRCOD,SSTRCOD1,SSTRCOD2,SSTRCOD3})[csound->scnt0++]; */
+        /*   csound->DebugMsg(csound,"***Entering second dubious code scnt=%d\n", csound->scnt0); */
+        /*   ST(bp)->p1val = ((int[4]){SSTRCOD,SSTRCOD1,
+                                       SSTRCOD2,SSTRCOD3})[csound->scnt0++]; */
         /*   if (csound->scnt0>3) { */
         /*     csound->scnt0 = 3; */
         /*   } */
@@ -1611,12 +1622,17 @@ static int sget1(CSOUND *csound)    /* get first non-white, non-comment char */
           }
         }
         mm->acnt = arg;
-        while ((c = getscochar(csound, 1)) != '#');   /* Skip to next # */
+        while ((c = getscochar(csound, 1)) != '#') {   /* Skip to next # */
+          if (UNLIKELY(c==EOF))
+            scorerr(csound, Str("Syntax error in macro definition"));
+        }
         mm->body = corfile_create_w();
 #ifdef MACDEBUG
-        printf("%s(%d): macro %s %p\n", __FILE__, __LINE__, mname, mm->body);
+        csound->DebugMsg(csound,"%s(%d): macro %s %p\n", __FILE__, __LINE__, mname, mm->body);
 #endif
         while ((c = getscochar(csound, 0)) != '#') {  /* Do not expand here!! */
+          if (UNLIKELY(c==EOF))
+            scorerr(csound, Str("Syntax error in macro definition"));
           corfile_putc(c, mm->body);
           if (c=='\\') {
             corfile_putc(getscochar(csound, 0), mm->body);    /* Allow escaped # */
diff --git a/Engine/symbtab.c b/Engine/symbtab.c
index 36b86fd..398d29d 100644
--- a/Engine/symbtab.c
+++ b/Engine/symbtab.c
@@ -180,6 +180,8 @@ void init_symbtab(CSOUND *csound)
     add_token(csound, "pchmidinn", T_FUNCTION);
     add_token(csound, "db", T_FUNCTION);
     add_token(csound, "p", T_FUNCTION);
+    add_token(csound, "qinf", T_FUNCTION);
+    add_token(csound, "qnan", T_FUNCTION);
     add_token(csound, "##error", T_FUNCTION);
 }
 
@@ -341,14 +343,14 @@ ORCTOKEN *lookup_token(CSOUND *csound, char *s, void *yyscanner)
       case 'w': type = T_IDENT_GW; break;
       case 't': type = T_IDENT_GT; break;
       case 'S': type = T_IDENT_GS; break;
-      default: 
-        csound->Message(csound, Str("Unknown word type for %s on line %d\n"),
-                        s, csound_orcget_lineno(yyscanner));
-        exit(1);
+      /* default:  */
+      /*   csound->Message(csound, Str("Unknown word type for %s on line %d\n"), */
+      /*                   s, csound_orcget_lineno(yyscanner)); */
+      /*   exit(1); */
       }
     default: /*
-      printf("IDENT Token: %i : %i", ans->type, T_IDENT);
-      printf("Unknown word type for %s on line %d\n", s, yyline);
+      csound->DebugMsg(csound,"IDENT Token: %i : %i", ans->type, T_IDENT);
+      csound->DebugMsg(csound,"Unknown word type for %s on line %d\n", s, yyline);
       exit(1);
              */
       break;
diff --git a/H/CMakeLists.txt b/H/CMakeLists.txt
new file mode 100644
index 0000000..df3ccf3
--- /dev/null
+++ b/H/CMakeLists.txt
@@ -0,0 +1,79 @@
+
+set(csheaders
+    cfgvar.h
+    cscore.h
+    csdl.h
+    csound.h
+    csound.hpp
+    csoundCore.h
+    cwindow.h
+    msg_attr.h
+    OpcodeBase.hpp
+    pstream.h
+    pvfileio.h
+    soundio.h
+    sysdep.h
+    text.h
+    version.h
+    float-version.h)
+
+# These don't live here... but we list them here to have all headers
+# in one place
+list(APPEND csheaders
+    ../interfaces/CsoundFile.hpp
+    ../interfaces/CppSound.hpp
+    ../interfaces/filebuilding.h
+    ../interfaces/csPerfThread.hpp)
+
+set(csacheaders
+    ../frontends/CsoundAC/Cell.hpp
+    ../frontends/CsoundAC/ChordLindenmayer.hpp
+    ../frontends/CsoundAC/Composition.hpp
+    ../frontends/CsoundAC/Conversions.hpp
+    ../frontends/CsoundAC/Counterpoint.hpp
+    ../frontends/CsoundAC/CounterpointNode.hpp
+    ../frontends/CsoundAC/Event.hpp
+    ../frontends/CsoundAC/Exception.hpp
+    ../frontends/CsoundAC/Hocket.hpp
+    ../frontends/CsoundAC/ImageToScore.hpp
+    ../frontends/CsoundAC/Lindenmayer.hpp
+    ../frontends/CsoundAC/MCRM.hpp
+    ../frontends/CsoundAC/Midifile.hpp
+    ../frontends/CsoundAC/MusicModel.hpp
+    ../frontends/CsoundAC/Node.hpp
+    ../frontends/CsoundAC/OrchestraNode.hpp
+    ../frontends/CsoundAC/Platform.hpp
+    ../frontends/CsoundAC/Random.hpp
+    ../frontends/CsoundAC/Rescale.hpp
+    ../frontends/CsoundAC/Score.hpp
+    ../frontends/CsoundAC/ScoreModel.hpp
+    ../frontends/CsoundAC/ScoreNode.hpp
+    ../frontends/CsoundAC/Sequence.hpp
+    ../frontends/CsoundAC/Shell.hpp
+    ../frontends/CsoundAC/Silence.hpp
+    ../frontends/CsoundAC/Soundfile.hpp
+    ../frontends/CsoundAC/StrangeAttractor.hpp
+    ../frontends/CsoundAC/System.hpp
+    ../frontends/CsoundAC/Voicelead.hpp
+    ../frontends/CsoundAC/VoiceleadingNode.hpp
+    )
+
+set(csvstheaders
+    frontends/CsoundVST/CsoundVstFltk.hpp
+    frontends/CsoundVST/CsoundVST.hpp
+    frontends/CsoundVST/CsoundVstUi.h
+    frontends/CsoundVST/Platform.hpp
+    frontends/CsoundVST/ScoreGenerator.hpp
+    frontends/CsoundVST/ScoreGeneratorVstFltk.hpp
+    frontends/CsoundVST/ScoreGeneratorVst.hpp
+    frontends/CsoundVST/ScoreGeneratorVstUi.h
+    )
+
+INSTALL(FILES ${csheaders} DESTINATION ${HEADER_INSTALL_DIR})
+
+IF( BUILD_CSOUND_AC )
+    INSTALL(FILES ${csacheaders} DESTINATION ${HEADER_INSTALL_DIR})
+endif()
+
+# Enable this when we build CsoundVST
+#INSTALL(FILES ${csvstheaders} DESTINATION ${HEADER_INSTALL_DIR})
diff --git a/H/csound.h b/H/csound.h
index c35bafd..b027cb4 100644
--- a/H/csound.h
+++ b/H/csound.h
@@ -214,7 +214,7 @@
 
 #if (defined(WIN32) || defined(_WIN32)) && !defined(SWIG)
 #  define PUBLIC        __declspec(dllexport)
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) && !defined(__MACH__)
 #  define PUBLIC        __attribute__ ( (visibility("default")) )
 #else
 #  define PUBLIC
diff --git a/H/csoundCore.h b/H/csoundCore.h
index eda4c5f..3231c07 100644
--- a/H/csoundCore.h
+++ b/H/csoundCore.h
@@ -1367,8 +1367,10 @@ typedef struct {
     char          *sstrbuf0[3]; /* For extra strings in scores */
     int           sstrlen0[3];  /* lengths for extra strings */
     int           genlabs;      /* Count for generated labels */
-    MYFLT  *powerof2;         /* pow2 table */
-    MYFLT  *cpsocfrc;         /* cps conv table */
+    MYFLT         *powerof2;    /* pow2 table */
+    MYFLT         *cpsocfrc;    /* cps conv table */
+    CORFIL*       expanded_orc; /* output of preprocessor */
+    char          *filedir[64]; /* for location directory */
 #endif  /* __BUILDING_LIBCSOUND */
   };
 
@@ -1378,11 +1380,11 @@ typedef struct {
  */
 
 #define LINKAGE1(name)                                         \
-PUBLIC long name##_init(CSOUND *csound, OENTRY **ep)           \
+long name##_init(CSOUND *csound, OENTRY **ep)           \
 {   (void) csound; *ep = name; return (long) (sizeof(name));  } 
 
 #define FLINKAGE1(name)                                                 \
-PUBLIC NGFENS* name##_init(CSOUND *csound)                         \
+NGFENS* name##_init(CSOUND *csound)                         \
 {   (void) csound; return name;                                     } 
 
 #ifdef __cplusplus
diff --git a/H/csound_orc.h b/H/csound_orc.h
index 416fb23..4339906 100644
--- a/H/csound_orc.h
+++ b/H/csound_orc.h
@@ -8,6 +8,7 @@ typedef struct TREE {
   int           rate;
   int           len;
   int           line;
+  int           locn;
   struct TREE   *left;
   struct TREE   *right;
   struct TREE   *next;
@@ -25,8 +26,8 @@ enum {
 #define PARSER_DEBUG (0)
 #endif
 
-TREE* make_node(CSOUND *, int, int, TREE*, TREE*);
-TREE* make_leaf(CSOUND *, int, int, ORCTOKEN*);
+TREE* make_node(CSOUND *, int, int, int, TREE*, TREE*);
+TREE* make_leaf(CSOUND *, int, int, int, ORCTOKEN*);
 ORCTOKEN* make_int(CSOUND *,char *);
 ORCTOKEN* make_num(CSOUND *,char *);
 ORCTOKEN *make_token(CSOUND *csound, char *s);
diff --git a/H/entry1.h b/H/entry1.h
index 010c4f3..7e84640 100644
--- a/H/entry1.h
+++ b/H/entry1.h
@@ -169,7 +169,14 @@ int     itabl3(CSOUND *, void *), tabl3(CSOUND *, void *);
 int     ktabl3(CSOUND *, void *), tblset(CSOUND *, void *);
 int     ktable(CSOUND *, void *), ktabli(CSOUND *, void *);
 int     tabli(CSOUND *, void *), tablefn(CSOUND *, void *);
+int     pitable(CSOUND *, void *), pitabli(CSOUND *, void *);
+int     pitabl3(CSOUND *, void *), ptabl3(CSOUND *, void *);
+int     pktabl3(CSOUND *, void *), itblchkw(CSOUND *, void *);
+int     pktable(CSOUND *, void *), pktabli(CSOUND *, void *);
+int     ptabli(CSOUND *, void *), ptablefn(CSOUND *, void *);
 int     tblsetkt(CSOUND *, void *), ktablekt(CSOUND *, void *);
+int     pitablew(CSOUND *, void *), ptblsetw(CSOUND *, void *);
+int     pktablew(CSOUND *, void *), ptablew(CSOUND *, void *);
 int     tablekt(CSOUND *, void *), ktablikt(CSOUND *, void *);
 int     tablikt(CSOUND *, void *), ko1set(CSOUND *, void *);
 int     kosc1(CSOUND *, void *), kosc1i(CSOUND *, void *);
diff --git a/InOut/libmpadec/mp3dec_internal.h b/H/mp3dec_internal.h
similarity index 98%
copy from InOut/libmpadec/mp3dec_internal.h
copy to H/mp3dec_internal.h
index 12fdede..c1644a3 100644
--- a/InOut/libmpadec/mp3dec_internal.h
+++ b/H/mp3dec_internal.h
@@ -22,7 +22,6 @@
 #ifndef __MP3DEC_INTERNAL_H
 #define __MP3DEC_INTERNAL_H
 
-#include "mpadec_config.h"
 #include "mp3dec.h"
 
 #define MP3DEC_FLAG_INITIALIZED 1
diff --git a/InOut/libmpadec/mpadec_internal.h b/H/mpadec_internal.h
similarity index 87%
copy from InOut/libmpadec/mpadec_internal.h
copy to H/mpadec_internal.h
index d21950d..36dfda6 100644
--- a/InOut/libmpadec/mpadec_internal.h
+++ b/H/mpadec_internal.h
@@ -22,7 +22,7 @@
 #ifndef __MPADEC_INTERNAL_H
 #define __MPADEC_INTERNAL_H
 
-#include "mpadec_config.h"
+#include "csoundCore.h"
 #include "mpadec.h"
 
 #define MPADEC_STATE_UNDEFINED 0
@@ -39,20 +39,20 @@
 #define SCALE_BLOCK 12
 
 typedef struct {
-  FLOAT decwin[512 + 32];
-  FLOAT muls[27][64];
-  FLOAT gainpow2[256 + 122];
-  FLOAT ispow[8207];
-  FLOAT win[2][4][36];
-  FLOAT *istabs[3][2][2];
-  FLOAT tan1_1[16];
-  FLOAT tan2_1[16];
-  FLOAT tan1_2[16];
-  FLOAT tan2_2[16];
-  FLOAT pow1_1[2][16];
-  FLOAT pow2_1[2][16];
-  FLOAT pow1_2[2][16];
-  FLOAT pow2_2[2][16];
+  MYFLT decwin[512 + 32];
+  MYFLT muls[27][64];
+  MYFLT gainpow2[256 + 122];
+  MYFLT ispow[8207];
+  MYFLT win[2][4][36];
+  MYFLT *istabs[3][2][2];
+  MYFLT tan1_1[16];
+  MYFLT tan2_1[16];
+  MYFLT tan1_2[16];
+  MYFLT tan2_2[16];
+  MYFLT pow1_1[2][16];
+  MYFLT pow2_1[2][16];
+  MYFLT pow1_2[2][16];
+  MYFLT pow2_2[2][16];
   int32_t long_limit[9][23];
   int32_t short_limit[9][14];
   int32_t n_slen2[512];
@@ -134,8 +134,8 @@ typedef struct {
   uint32_t region1start;
   uint32_t region2start;
   uint32_t count1table_select;
-  FLOAT *full_gain[3];
-  FLOAT *pow2gain;
+  MYFLT *full_gain[3];
+  MYFLT *pow2gain;
 } grinfo_t;
 
 typedef struct {
@@ -171,8 +171,8 @@ struct mpadec_t {
   uint32_t decoded_samples;
   mp3tag_info_t tag_info;
   uint32_t synth_size;
-  FLOAT replay_gain;
-  void (*synth_func)(void *mpadec, FLOAT block[SBLIMIT], int channel, uint8_t *buffer);
+  MYFLT replay_gain;
+  void (*synth_func)(void *mpadec, MYFLT block[SBLIMIT], int channel, uint8_t *buffer);
   uint32_t reservoir_size;
   uint8_t reservoir[2048];
   frameinfo_t frame;
@@ -181,10 +181,10 @@ struct mpadec_t {
   mpadec_tables_t tables;
   uint32_t synth_bufoffs;
   uint8_t hybrid_block[4];
-  FLOAT hybrid_in[2][SBLIMIT][SSLIMIT];
-  FLOAT hybrid_out[2][SSLIMIT][SBLIMIT];
-  FLOAT hybrid_buffers[2][2][SBLIMIT*SSLIMIT];
-  FLOAT synth_buffers[2][2][0x110];
+  MYFLT hybrid_in[2][SBLIMIT][SSLIMIT];
+  MYFLT hybrid_out[2][SSLIMIT][SBLIMIT];
+  MYFLT hybrid_buffers[2][2][SBLIMIT*SSLIMIT];
+  MYFLT synth_buffers[2][2][0x110];
 };
 
 struct mpabuffer_t {
diff --git a/H/prototyp.h b/H/prototyp.h
index a36cfc1..bcfaa07 100644
--- a/H/prototyp.h
+++ b/H/prototyp.h
@@ -58,7 +58,7 @@ void    dispinit(CSOUND *);
 int     init0(CSOUND *);
 void    scsort(CSOUND *, FILE *, FILE *);
 void    scsortstr(CSOUND *, CORFIL *);
-int     scxtract(CSOUND *, FILE *, FILE *, FILE *);
+int     scxtract(CSOUND *, CORFIL *, FILE *);
 int     rdscor(CSOUND *, EVTBLK *);
 int     musmon(CSOUND *);
 void    RTLineset(CSOUND *);
diff --git a/H/version.h b/H/version.h
index 61c263e..55a12d2 100644
--- a/H/version.h
+++ b/H/version.h
@@ -24,6 +24,8 @@
 #ifndef CSOUND_VERSION_H
 #define CSOUND_VERSION_H
 
+#define VERSION "5.16"
+
 /* Define to the full name of this package. */
 #ifndef PARCS
 #define CS_PACKAGE_NAME     "Csound"
@@ -33,19 +35,19 @@
 
 /* Define to the full name and version of this package. */
 #ifndef PARCS
-#define CS_PACKAGE_STRING   "Csound 5.15"
+#define CS_PACKAGE_STRING   "Csound " VERSION
 #else /* PARCS */
-#define CS_PACKAGE_STRING   "ParCsound 5.15"
+#define CS_PACKAGE_STRING   "ParCsound " VERSION
 #endif /* PARCS */
 
 /* Define to the one symbol short name of this package. */
 #define CS_PACKAGE_TARNAME  "csound"
 
 /* Define to the version of this package. */
-#define CS_PACKAGE_VERSION  "5.15"
+#define CS_PACKAGE_VERSION  VERSION
 #define CS_VERSION          (5)
-#define CS_SUBVER           (15)
-#define CS_PATCHLEVEL       (0)
+#define CS_SUBVER           (16)
+#define CS_PATCHLEVEL       (6)
 
 #define CS_APIVERSION       2   /* should be increased anytime a new version
                                    contains changes that an older host will
diff --git a/How_to_Build_Csound_on_Windows.doc b/How_to_Build_Csound_on_Windows.doc
index abc1a4d..9c0d095 100644
Binary files a/How_to_Build_Csound_on_Windows.doc and b/How_to_Build_Csound_on_Windows.doc differ
diff --git a/InOut/libmpadec/mp3dec.c b/InOut/libmpadec/mp3dec.c
index ee3d577..8e4261f 100644
--- a/InOut/libmpadec/mp3dec.c
+++ b/InOut/libmpadec/mp3dec.c
@@ -158,6 +158,7 @@ int mp3dec_uninit(mp3dec_t mp3dec)
     mp3->flags = 0;
     mpadec_uninit(mp3->mpadec);
     mp3->size = 0;
+    free(mp3);
     return MP3DEC_RETCODE_OK;
 }
 
diff --git a/InOut/libmpadec/mpadec.c b/InOut/libmpadec/mpadec.c
index a305f67..19c5a2d 100644
--- a/InOut/libmpadec/mpadec.c
+++ b/InOut/libmpadec/mpadec.c
@@ -26,10 +26,12 @@
 extern const uint16_t crc_table[256];
 extern void *synth_table[2][2][4][4];
 
-const uint32_t bitmask[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F,
-                               0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
+const uint32_t bitmask[17] = {
+  0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F,
+  0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
 
-const int32_t frequency_table[9] = { 44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000 };
+const int32_t frequency_table[9] = {
+  44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000 };
 
 const int16_t bitrate_table[2][3][16] = {
   { { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 560 },
@@ -47,534 +49,584 @@ extern void decode_layer3(mpadec_t mpadec, uint8_t *buffer);
 
 uint32_t getbits(mpadec_t mpadec, unsigned n)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
 
-  while ((mpa->bits_left <= 24) && mpa->bytes_left) {
-    mpa->bit_buffer = (mpa->bit_buffer << 8) | *mpa->next_byte++;
-    mpa->bits_left += (uint8_t)8;
-    mpa->bytes_left--;
-  }
-  while (mpa->bits_left <= 24) {
-    mpa->bit_buffer = (mpa->bit_buffer << 8);
-    mpa->bits_left += (uint8_t)8;
-  }
-  mpa->bits_left -= (uint8_t)n;
-  return (mpa->bit_buffer >> mpa->bits_left) & bitmask[n];
+    while ((mpa->bits_left <= 24) && mpa->bytes_left) {
+      mpa->bit_buffer = (mpa->bit_buffer << 8) | *mpa->next_byte++;
+      mpa->bits_left += (uint8_t)8;
+      mpa->bytes_left--;
+    }
+    while (mpa->bits_left <= 24) {
+      mpa->bit_buffer = (mpa->bit_buffer << 8);
+      mpa->bits_left += (uint8_t)8;
+    }
+    mpa->bits_left -= (uint8_t)n;
+    return (mpa->bit_buffer >> mpa->bits_left) & bitmask[n];
 }
 
 uint16_t update_crc(uint16_t init, uint8_t *buf, int length)
 {
-  register uint32_t crc = (uint32_t)init, tmp;
-  register int l = length;
-  register uint8_t *b = buf;
-
-  for (; l >= 8; l -= 8) crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (*b++)) & 0xFF];
-  tmp = (uint32_t)(*b) << 8;
-  while (l--) {
-    tmp <<= 1;
-    crc <<= 1;
-    if ((crc ^ tmp) & 0x10000) crc ^= 0x8005;
-  }
-  return (uint16_t)crc;
+    register uint32_t crc = (uint32_t)init, tmp;
+    register int l = length;
+    register uint8_t *b = buf;
+
+    for (; l >= 8; l -= 8)
+      crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (*b++)) & 0xFF];
+    tmp = (uint32_t)(*b) << 8;
+    while (l--) {
+      tmp <<= 1;
+      crc <<= 1;
+      if ((crc ^ tmp) & 0x10000) crc ^= 0x8005;
+    }
+    return (uint16_t)crc;
 }
 
 static uint32_t detect_frame_size(mpadec_t mpadec)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-  register uint8_t *buf = mpa->next_byte;
-  uint32_t i = mpa->bytes_left, hdr = 0;
-
-  if (i < (mpa->frame.frame_size + 4)) return 0;
-  buf += mpa->frame.frame_size;
-  i -= mpa->frame.frame_size;
-  while (i >= 4) {
-    register uint32_t tmp = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
-    if (((tmp & 0xFFE00000) == 0xFFE00000) && (tmp & (3 << 17)) && ((tmp & (3 << 10)) != (3 << 10))) {
-      if ((mpa->frame.layer == (uint8_t)(4 - ((tmp >> 17) & 3))) &&
-          (mpa->frame.frequency_index == (((tmp >> 10) & 3) + 3*(mpa->frame.LSF + mpa->frame.MPEG25))) &&
-          (mpa->frame.channels == ((((tmp >> 6) & 3) == MPG_MD_MONO) ? 1 : 2))) {
-        if (mpa->config.dblsync) {
-          uint32_t fs = mpa->bytes_left - i - mpa->frame.padding + ((tmp >> 9) & 1);
-          if (i >= (fs + 4)) {
-            buf += fs;
-            tmp = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
-            buf -= fs;
-            if (((tmp & 0xFFE00000) == 0xFFE00000) && (tmp & (3 << 17)) && ((tmp & (3 << 10)) != (3 << 10))) {
-              if ((mpa->frame.layer == (uint8_t)(4 - ((tmp >> 17) & 3))) &&
-                  (mpa->frame.frequency_index == (((tmp >> 10) & 3) + 3*(mpa->frame.LSF + mpa->frame.MPEG25))) &&
-                  (mpa->frame.channels == ((((tmp >> 6) & 3) == MPG_MD_MONO) ? 1 : 2))) {
-                hdr = tmp;
-                break;
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    register uint8_t *buf = mpa->next_byte;
+    uint32_t i = mpa->bytes_left, hdr = 0;
+
+    if (i < (mpa->frame.frame_size + 4)) return 0;
+    buf += mpa->frame.frame_size;
+    i -= mpa->frame.frame_size;
+    while (i >= 4) {
+      register uint32_t tmp = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
+      if (((tmp & 0xFFE00000) == 0xFFE00000) &&
+          (tmp & (3 << 17)) &&
+          ((tmp & (3 << 10)) != (3 << 10))) {
+        if ((mpa->frame.layer == (uint8_t)(4 - ((tmp >> 17) & 3))) &&
+            (mpa->frame.frequency_index ==
+             (((tmp >> 10) & 3) + 3*(mpa->frame.LSF + mpa->frame.MPEG25))) &&
+            (mpa->frame.channels == ((((tmp >> 6) & 3) == MPG_MD_MONO) ? 1 : 2))) {
+          if (mpa->config.dblsync) {
+            uint32_t fs = mpa->bytes_left - i - mpa->frame.padding + ((tmp>>9) & 1);
+            if (i >= (fs + 4)) {
+              buf += fs;
+              tmp = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
+              buf -= fs;
+              if (((tmp & 0xFFE00000) == 0xFFE00000) &&
+                  (tmp & (3 << 17))                  &&
+                  ((tmp & (3 << 10)) != (3 << 10))) {
+                if ((mpa->frame.layer == (uint8_t)(4 - ((tmp >> 17) & 3))) &&
+                    (mpa->frame.frequency_index ==
+                     (((tmp>>10)&3) + 3*(mpa->frame.LSF + mpa->frame.MPEG25))) &&
+                    (mpa->frame.channels == ((((tmp>>6)&3) == MPG_MD_MONO)?1:2))) {
+                  hdr = tmp;
+                  break;
+                }
               }
-            }
-          } else return 0;
-        } else {
-          hdr = tmp;
-          break;
+            } else return 0;
+          } else {
+            hdr = tmp;
+            break;
+          }
         }
       }
+      buf++; i--;
     }
-    buf++; i--;
-  }
-  return (hdr ? (mpa->bytes_left - i) : 0);
+    return (hdr ? (mpa->bytes_left - i) : 0);
 }
 
 static int decode_header(mpadec_t mpadec, uint32_t header)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-  unsigned int layer, bridx, fridx;
-
-  layer = 4 - ((header >> 17) & 3);
-  bridx = ((header >> 12) & 0x0F);
-  fridx = ((header >> 10) & 3);
-  if ((fridx == 3) || (layer == 4) || ((layer != 3) && !bridx)) return FALSE;
-  if (header & (1 << 20)) {
-    mpa->frame.LSF = (uint8_t)((header & (1 << 19)) ? FALSE : TRUE);
-    mpa->frame.MPEG25 = FALSE;
-  } else mpa->frame.LSF = mpa->frame.MPEG25 = TRUE;
-  mpa->frame.layer = (uint8_t)layer;
-  mpa->frame.bitrate_index = bridx;
-  mpa->frame.bitrate = bitrate_table[mpa->frame.LSF][layer - 1][bridx];
-  mpa->frame.frequency_index = (fridx += 3*(mpa->frame.LSF + mpa->frame.MPEG25));
-  mpa->frame.frequency = frequency_table[fridx];
-  mpa->frame.decoded_frequency = mpa->frame.frequency >> mpa->config.quality;
-  mpa->frame.CRC = (uint8_t)(((header >> 16) & 1) ^ 1);
-  mpa->frame.padding = ((header >> 9) & 1);
-  mpa->frame.extension = (uint8_t)((header >> 8) & 1);
-  mpa->frame.mode = (uint8_t)((header >> 6) & 3);
-  mpa->frame.mode_ext = (uint8_t)((header >> 4) & 3);
-  mpa->frame.copyright = (uint8_t)((header >> 3) & 1);
-  mpa->frame.original = (uint8_t)((header >> 2) & 1);
-  mpa->frame.emphasis = (uint8_t)(header & 3);
-  mpa->frame.channels = (uint8_t)((mpa->frame.mode == MPG_MD_MONO) ? 1 : 2);
-  switch (mpa->config.mode) {
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    unsigned int layer, bridx, fridx;
+
+    layer = 4 - ((header >> 17) & 3);
+    bridx = ((header >> 12) & 0x0F);
+    fridx = ((header >> 10) & 3);
+    if ((fridx == 3) || (layer == 4) || ((layer != 3) && !bridx)) return FALSE;
+    if (header & (1 << 20)) {
+      mpa->frame.LSF = (uint8_t)((header & (1 << 19)) ? FALSE : TRUE);
+      mpa->frame.MPEG25 = FALSE;
+    } else mpa->frame.LSF = mpa->frame.MPEG25 = TRUE;
+    mpa->frame.layer = (uint8_t)layer;
+    mpa->frame.bitrate_index = bridx;
+    mpa->frame.bitrate = bitrate_table[mpa->frame.LSF][layer - 1][bridx];
+    mpa->frame.frequency_index = (fridx += 3*(mpa->frame.LSF + mpa->frame.MPEG25));
+    mpa->frame.frequency = frequency_table[fridx];
+    mpa->frame.decoded_frequency = mpa->frame.frequency >> mpa->config.quality;
+    mpa->frame.CRC = (uint8_t)(((header >> 16) & 1) ^ 1);
+    mpa->frame.padding = ((header >> 9) & 1);
+    mpa->frame.extension = (uint8_t)((header >> 8) & 1);
+    mpa->frame.mode = (uint8_t)((header >> 6) & 3);
+    mpa->frame.mode_ext = (uint8_t)((header >> 4) & 3);
+    mpa->frame.copyright = (uint8_t)((header >> 3) & 1);
+    mpa->frame.original = (uint8_t)((header >> 2) & 1);
+    mpa->frame.emphasis = (uint8_t)(header & 3);
+    mpa->frame.channels = (uint8_t)((mpa->frame.mode == MPG_MD_MONO) ? 1 : 2);
+    switch (mpa->config.mode) {
     case MPADEC_CONFIG_CHANNEL1:
     case MPADEC_CONFIG_CHANNEL2:
     case MPADEC_CONFIG_MONO:     mpa->frame.decoded_channels = 1; break;
     case MPADEC_CONFIG_STEREO:   mpa->frame.decoded_channels = 2; break;
     default:                     mpa->frame.decoded_channels = mpa->frame.channels;
   }
-  mpa->free_format = FALSE;
-  switch (mpa->frame.layer) {
+    mpa->free_format = FALSE;
+    switch (mpa->frame.layer) {
     case 1: mpa->frame.frame_samples = 384;
-            mpa->frame.frame_size = (12000*mpa->frame.bitrate/mpa->frame.frequency + mpa->frame.padding) << 2;
-            mpa->ssize = 0;
-            break;
+      mpa->frame.frame_size =
+        (12000*mpa->frame.bitrate/mpa->frame.frequency + mpa->frame.padding) << 2;
+      mpa->ssize = 0;
+      break;
     case 2: mpa->frame.frame_samples = 1152;
-            mpa->frame.frame_size = 144000*mpa->frame.bitrate/mpa->frame.frequency + mpa->frame.padding;
-            mpa->ssize = 0;
-            break;
+      mpa->frame.frame_size =
+        144000*mpa->frame.bitrate/mpa->frame.frequency + mpa->frame.padding;
+      mpa->ssize = 0;
+      break;
     case 3: mpa->frame.frame_samples = 1152 >> mpa->frame.LSF;
-            if (mpa->frame.LSF) mpa->ssize = (mpa->frame.channels > 1) ? 17 : 9;
-            else mpa->ssize = (mpa->frame.channels > 1) ? 32 : 17;
-            if (mpa->frame.bitrate_index) {
-              mpa->frame.frame_size = 144000*mpa->frame.bitrate/(mpa->frame.frequency << mpa->frame.LSF) + mpa->frame.padding;
-              mpa->prev_frame_size = 0;
-            } else {
-              register uint32_t div = 125*mpa->frame.frame_samples;
-              if (!mpa->prev_frame_size) {
-                mpa->frame.frame_size = (mpa->frame.CRC ? 6 : 4) + mpa->ssize + mpa->frame.padding;
-                mpa->prev_frame_size = detect_frame_size(mpa);
-                if (mpa->prev_frame_size) mpa->prev_frame_size -= mpa->frame.padding;
-              }
-              mpa->frame.frame_size = mpa->prev_frame_size + mpa->frame.padding;
-              mpa->frame.bitrate = (mpa->frame.frame_size*mpa->frame.frequency + (div >> 1))/div;
-              mpa->free_format = TRUE;
-            }
-            break;
-  }
-  mpa->frame.decoded_samples = mpa->frame.frame_samples >> mpa->config.quality;
-  mpa->frame.downsample = FALSE;
-  mpa->frame.downsample_sblimit = SBLIMIT;
-  mpa->frame.decoded_size = mpa->frame.decoded_samples*mpa->frame.decoded_channels;
-  switch (mpa->config.format) {
+      if (mpa->frame.LSF) mpa->ssize = (mpa->frame.channels > 1) ? 17 : 9;
+      else mpa->ssize = (mpa->frame.channels > 1) ? 32 : 17;
+      if (mpa->frame.bitrate_index) {
+        mpa->frame.frame_size =
+          144000*mpa->frame.bitrate/(mpa->frame.frequency << mpa->frame.LSF) +
+          mpa->frame.padding;
+        mpa->prev_frame_size = 0;
+      } else {
+        register uint32_t div = 125*mpa->frame.frame_samples;
+        if (!mpa->prev_frame_size) {
+          mpa->frame.frame_size =
+            (mpa->frame.CRC ? 6 : 4) + mpa->ssize + mpa->frame.padding;
+          mpa->prev_frame_size = detect_frame_size(mpa);
+          if (mpa->prev_frame_size) mpa->prev_frame_size -= mpa->frame.padding;
+        }
+        mpa->frame.frame_size = mpa->prev_frame_size + mpa->frame.padding;
+        mpa->frame.bitrate =
+          (mpa->frame.frame_size*mpa->frame.frequency + (div >> 1))/div;
+        mpa->free_format = TRUE;
+      }
+      break;
+    }
+    mpa->frame.decoded_samples = mpa->frame.frame_samples >> mpa->config.quality;
+    mpa->frame.downsample = FALSE;
+    mpa->frame.downsample_sblimit = SBLIMIT;
+    mpa->frame.decoded_size =
+      mpa->frame.decoded_samples*mpa->frame.decoded_channels;
+    switch (mpa->config.format) {
     case MPADEC_CONFIG_24BIT: mpa->frame.decoded_size *= 3; break;
     case MPADEC_CONFIG_32BIT:
     case MPADEC_CONFIG_FLOAT: mpa->frame.decoded_size <<= 2; break;
     default:                  mpa->frame.decoded_size <<= 1; break;
-  }
-  mpa->hsize = mpa->frame.CRC ? 6 : 4;
-  if (mpa->frame.frame_size < (mpa->hsize + mpa->ssize)) mpa->frame.frame_size = mpa->hsize + mpa->ssize;
-  mpa->dsize = mpa->frame.frame_size - (mpa->hsize + mpa->ssize);
-  return TRUE;
+    }
+    mpa->hsize = mpa->frame.CRC ? 6 : 4;
+    if (mpa->frame.frame_size < (mpa->hsize + mpa->ssize))
+      mpa->frame.frame_size = mpa->hsize + mpa->ssize;
+    mpa->dsize = mpa->frame.frame_size - (mpa->hsize + mpa->ssize);
+    return TRUE;
 }
 
 static uint32_t sync_buffer(mpadec_t mpadec)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-  register uint8_t *buf = mpa->next_byte;
-  uint32_t retval = 0, i = mpa->bytes_left;
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    register uint8_t *buf = mpa->next_byte;
+    uint32_t retval = 0, i = mpa->bytes_left;
 
-  if (mpa->state == MPADEC_STATE_START) {
-    while (i >= 4) {
-      register uint32_t tmp = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
-      if (((tmp & 0xFFE00000) == 0xFFE00000) && (tmp & (3 << 17)) && ((tmp & (3 << 10)) != (3 << 10))) {
-        if (mpa->config.dblsync) {
-          if (decode_header(mpa, tmp)) {
-            if ((i < (mpa->frame.frame_size + 4)) || (mpa->free_format && !mpa->prev_frame_size)) break;
-            else {
-              register uint32_t tmp2 = (buf[mpa->frame.frame_size] << 24) | (buf[mpa->frame.frame_size + 1] << 16) | (buf[mpa->frame.frame_size + 2] << 8) | buf[mpa->frame.frame_size + 3];
-              if (((tmp2 & 0xFFE00000) == 0xFFE00000) && (tmp2 & (3 << 17)) && ((tmp2 & (3 << 10)) != (3 << 10))) {
-                if ((mpa->frame.layer == (uint8_t)(4 - ((tmp2 >> 17) & 3))) &&
-                    (mpa->frame.frequency_index == (((tmp2 >> 10) & 3) + 3*(mpa->frame.LSF + mpa->frame.MPEG25))) &&
-                    (mpa->frame.channels == ((((tmp2 >> 6) & 3) == MPG_MD_MONO) ? 1 : 2))) {
-                  retval = tmp;
-                  break;
+    if (mpa->state == MPADEC_STATE_START) {
+      while (i >= 4) {
+        register uint32_t tmp = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
+        if (((tmp & 0xFFE00000) == 0xFFE00000) &&
+            (tmp & (3<<17))                    &&
+            ((tmp & (3<<10)) != (3<<10))) {
+          if (mpa->config.dblsync) {
+            if (decode_header(mpa, tmp)) {
+              if ((i < (mpa->frame.frame_size + 4)) ||
+                  (mpa->free_format && !mpa->prev_frame_size)) break;
+              else {
+                register uint32_t tmp2 =
+                  (buf[mpa->frame.frame_size]<<24)     |
+                  (buf[mpa->frame.frame_size + 1]<<16) |
+                  (buf[mpa->frame.frame_size + 2]<<8)  |
+                  buf[mpa->frame.frame_size + 3];
+                if (((tmp2 & 0xFFE00000) == 0xFFE00000) &&
+                    (tmp2 & (3<<17))                    &&
+                    ((tmp2 & (3<<10)) != (3<<10))) {
+                  if ((mpa->frame.layer == (uint8_t)(4 - ((tmp2 >> 17) & 3))) &&
+                      (mpa->frame.frequency_index ==
+                       (((tmp2>>10)&3) + 3*(mpa->frame.LSF + mpa->frame.MPEG25))) &&
+                      (mpa->frame.channels == ((((tmp2>>6)&3)==MPG_MD_MONO)?1:2))) {
+                    retval = tmp;
+                    break;
+                  }
                 }
               }
             }
+          } else {
+            retval = tmp;
+            break;
           }
-        } else {
-          retval = tmp;
-          break;
         }
+        buf++; i--;
       }
-      buf++; i--;
-    }
-  } else {
-    while (i >= 4) {
-      register uint32_t tmp = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
-      if (((tmp & 0xFFE00000) == 0xFFE00000) && (tmp & (3 << 17)) && ((tmp & (3 << 10)) != (3 << 10))) {
-        if ((mpa->frame.layer == (uint8_t)(4 - ((tmp >> 17) & 3))) &&
-            (mpa->frame.frequency_index == (((tmp >> 10) & 3) + 3*(mpa->frame.LSF + mpa->frame.MPEG25))) &&
-            (mpa->frame.channels == ((((tmp >> 6) & 3) == MPG_MD_MONO) ? 1 : 2))) {
-          retval = tmp;
-          break;
+    } else {
+      while (i >= 4) {
+        register uint32_t tmp = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
+        if (((tmp & 0xFFE00000) == 0xFFE00000) &&
+            (tmp & (3<<17))                    &&
+            ((tmp & (3<<10)) != (3<<10))) {
+          if ((mpa->frame.layer == (uint8_t)(4 - ((tmp >> 17) & 3))) &&
+              (mpa->frame.frequency_index ==
+               (((tmp >> 10) & 3) + 3*(mpa->frame.LSF + mpa->frame.MPEG25))) &&
+              (mpa->frame.channels == ((((tmp>>6)&3) == MPG_MD_MONO) ? 1 : 2))) {
+            retval = tmp;
+            break;
+          }
         }
+        buf++; i--;
       }
-      buf++; i--;
     }
-  }
-  if (i < mpa->bytes_left) {
-    i = mpa->bytes_left - i;
-    mpa->next_byte = buf;;
-    mpa->bytes_left -= i;
-    if (i >= 512) {
-      mpa->reservoir_size = 0;
-      i = 512;
+    if (i < mpa->bytes_left) {
+      i = mpa->bytes_left - i;
+      mpa->next_byte = buf;;
+      mpa->bytes_left -= i;
+      if (i >= 512) {
+        mpa->reservoir_size = 0;
+        i = 512;
+      }
+      memcpy(mpa->reservoir + mpa->reservoir_size, mpa->next_byte - i, i);
+      mpa->reservoir_size += i;
     }
-    memcpy(mpa->reservoir + mpa->reservoir_size, mpa->next_byte - i, i);
-    mpa->reservoir_size += i;
-  }
-  return retval;
+    return retval;
 }
 
 static int first_frame(mpadec_t mpadec)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-  int i, skip = FALSE;
-  uint32_t framesize; MYFLT scale;
-
-  if (mpa->frame.channels > 1) i = ((mpa->config.mode == MPADEC_CONFIG_STEREO) || (mpa->config.mode == MPADEC_CONFIG_AUTO)) ? 3 : 2;
-  else i = (mpa->config.mode == MPADEC_CONFIG_STEREO) ? 1 : 0;
-  mpa->synth_func = synth_table[mpa->config.quality][mpa->config.endian][mpa->config.format][i];
-  mpa->sample_size = mpa->frame.decoded_channels;
-  switch (mpa->config.format) {
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    int i, skip = FALSE;
+    uint32_t framesize; MYFLT scale;
+    
+    if (mpa->frame.channels > 1)
+      i = ((mpa->config.mode == MPADEC_CONFIG_STEREO) ||
+           (mpa->config.mode == MPADEC_CONFIG_AUTO)) ? 3 : 2;
+    else i = (mpa->config.mode == MPADEC_CONFIG_STEREO) ? 1 : 0;
+    mpa->synth_func =
+      synth_table[mpa->config.quality][mpa->config.endian][mpa->config.format][i];
+    mpa->sample_size = mpa->frame.decoded_channels;
+    switch (mpa->config.format) {
     case MPADEC_CONFIG_24BIT: mpa->sample_size *= 3; scale = 0x800000; break;
     case MPADEC_CONFIG_32BIT: mpa->sample_size <<= 2; scale = 0x80000000; break;
     case MPADEC_CONFIG_FLOAT: mpa->sample_size <<= 2; scale = 1; break;
     default:                  mpa->sample_size <<= 1; scale = 0x8000; break;
-  }
-  mpa->synth_size = (mpa->sample_size << 5) >> mpa->config.quality;
-  if (mpa->config.replaygain != MPADEC_CONFIG_REPLAYGAIN_CUSTOM) {
-    mpa->config.gain = 0.0;
-    mpa->replay_gain = 1.0;
-  }
-  mpa->skip_samples = 0;
-  mpa->padding_samples = 0;
-  mpa->decoded_frames = 0;
-  mpa->decoded_samples = 0;
-  memset(&mpa->tag_info, 0, sizeof(mpa->tag_info));
-  framesize = (mpa->frame.frame_size < mpa->bytes_left) ? mpa->frame.frame_size : mpa->bytes_left;
-  if ((mpa->frame.layer == 3) && (framesize >= (mpa->ssize + 124))) {
-    register uint8_t *buf = mpa->next_byte + 4 + mpa->ssize;
-    if (((buf[0] == 'X') && (buf[1] == 'i') && (buf[2] == 'n') && (buf[3] == 'g')) ||
-        ((buf[0] == 'I') && (buf[1] == 'n') && (buf[2] == 'f') && (buf[3] == 'o'))) {
-      skip = TRUE;
-      mpa->next_byte += framesize;
-      mpa->bytes_left -= framesize;
-      buf += 4;
-      mpa->tag_info.flags = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
-      buf += 4;
-      if (mpa->tag_info.flags & 1) {
-        mpa->tag_info.frames = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
-        buf += 4;
-      };
-      if (mpa->tag_info.flags & 2) {
-        mpa->tag_info.bytes = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
+    }
+    mpa->synth_size = (mpa->sample_size<<5) >> mpa->config.quality;
+    if (mpa->config.replaygain != MPADEC_CONFIG_REPLAYGAIN_CUSTOM) {
+      mpa->config.gain = 0.0;
+      mpa->replay_gain = 1.0;
+    }
+    mpa->skip_samples = 0;
+    mpa->padding_samples = 0;
+    mpa->decoded_frames = 0;
+    mpa->decoded_samples = 0;
+    memset(&mpa->tag_info, 0, sizeof(mpa->tag_info));
+    framesize = (mpa->frame.frame_size < mpa->bytes_left) ?
+      mpa->frame.frame_size : mpa->bytes_left;
+    if ((mpa->frame.layer == 3) && (framesize >= (mpa->ssize + 124))) {
+      register uint8_t *buf = mpa->next_byte + 4 + mpa->ssize;
+      if (((buf[0] == 'X') && (buf[1] == 'i') &&
+           (buf[2] == 'n') && (buf[3] == 'g')) ||
+          ((buf[0] == 'I') && (buf[1] == 'n') &&
+           (buf[2] == 'f') && (buf[3] == 'o'))) {
+        skip = TRUE;
+        mpa->next_byte += framesize;
+        mpa->bytes_left -= framesize;
         buf += 4;
-      };
-      if (mpa->tag_info.flags & 4) {
-        memcpy(mpa->tag_info.toc, buf, 100);
-        buf += 100;
-      };
-      if (mpa->tag_info.flags & 8) buf += 4;
-      mpa->tag_info.flags &= 7;
-      if (framesize >= mpa->ssize + 160) {
-        buf += 15;
-        mpa->tag_info.replay_gain[0] = ((buf[0] << 8) | buf[1]) & 0x1FF;
-        if (buf[0] & 2) mpa->tag_info.replay_gain[0] = -mpa->tag_info.replay_gain[0];
-        buf += 2;
-        mpa->tag_info.replay_gain[1] = ((buf[0] << 8) | buf[1]) & 0x1FF;
-        if (buf[0] & 2) mpa->tag_info.replay_gain[1] = -mpa->tag_info.replay_gain[1];
+        mpa->tag_info.flags = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
         buf += 4;
-        mpa->tag_info.enc_delay = (buf[0] << 4) | ((buf[1] >> 4) & 0x0F);
-        mpa->tag_info.enc_padding = ((buf[1] & 0x0F) << 8) | buf[2];
-        if (((mpa->tag_info.enc_delay < 0) || (mpa->tag_info.enc_delay > 3000)) ||
-            ((mpa->tag_info.enc_padding < 0) || (mpa->tag_info.enc_padding > 3000))) {
-          mpa->tag_info.replay_gain[0] = mpa->tag_info.replay_gain[1] = 0;
-          mpa->tag_info.enc_delay = 0;
-          mpa->tag_info.enc_padding = 0;
-        } else {
-          if (mpa->config.replaygain == MPADEC_CONFIG_REPLAYGAIN_RADIO) {
-            mpa->config.gain = ((MYFLT)mpa->tag_info.replay_gain[0])/10.0;
-          } else if (mpa->config.replaygain == MPADEC_CONFIG_REPLAYGAIN_AUDIOPHILE) {
-            mpa->config.gain = ((MYFLT)mpa->tag_info.replay_gain[1])/10.0;
+        if (mpa->tag_info.flags & 1) {
+          mpa->tag_info.frames = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
+          buf += 4;
+        };
+        if (mpa->tag_info.flags & 2) {
+          mpa->tag_info.bytes = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
+          buf += 4;
+        };
+        if (mpa->tag_info.flags & 4) {
+          memcpy(mpa->tag_info.toc, buf, 100);
+          buf += 100;
+        };
+        if (mpa->tag_info.flags & 8) buf += 4;
+        mpa->tag_info.flags &= 7;
+        if (framesize >= mpa->ssize + 160) {
+          buf += 15;
+          mpa->tag_info.replay_gain[0] = ((buf[0]<<8) | buf[1]) & 0x1FF;
+          if (buf[0] & 2)
+            mpa->tag_info.replay_gain[0] = -mpa->tag_info.replay_gain[0];
+          buf += 2;
+          mpa->tag_info.replay_gain[1] = ((buf[0]<<8) | buf[1]) & 0x1FF;
+          if (buf[0] & 2)
+            mpa->tag_info.replay_gain[1] = -mpa->tag_info.replay_gain[1];
+          buf += 4;
+          mpa->tag_info.enc_delay = (buf[0]<<4) | ((buf[1] >> 4) & 0x0F);
+          mpa->tag_info.enc_padding = ((buf[1] & 0x0F)<<8) | buf[2];
+          if (((mpa->tag_info.enc_delay < 0)     ||
+               (mpa->tag_info.enc_delay > 3000)) ||
+              ((mpa->tag_info.enc_padding < 0)   ||
+               (mpa->tag_info.enc_padding > 3000))) {
+            mpa->tag_info.replay_gain[0] = mpa->tag_info.replay_gain[1] = 0;
+            mpa->tag_info.enc_delay = 0;
+            mpa->tag_info.enc_padding = 0;
+          } else {
+            if (mpa->config.replaygain == MPADEC_CONFIG_REPLAYGAIN_RADIO) {
+              mpa->config.gain = ((MYFLT)mpa->tag_info.replay_gain[0])/10.0;
+            }
+            else
+              if (mpa->config.replaygain == MPADEC_CONFIG_REPLAYGAIN_AUDIOPHILE) {
+                mpa->config.gain = ((MYFLT)mpa->tag_info.replay_gain[1])/10.0;
+              }
           }
+          mpa->skip_samples = mpa->tag_info.enc_delay;
+          mpa->padding_samples = mpa->tag_info.enc_padding;
         }
-        mpa->skip_samples = mpa->tag_info.enc_delay;
-        mpa->padding_samples = mpa->tag_info.enc_padding;
       }
     }
-  }
-  mpa->replay_gain = pow(10.0, mpa->config.gain/20.0);
-  if (mpa->config.replaygain != MPADEC_CONFIG_REPLAYGAIN_NONE) scale *= mpa->replay_gain;
-  init_tables(mpa, scale, SBLIMIT >> mpa->config.quality);
-  if (mpa->frame.layer == 3) {
-    mpa->skip_samples += 529;
-    if ((mpa->tag_info.flags & 1) && (mpa->padding_samples > 529)) mpa->padding_samples -= 529;
-    else mpa->padding_samples = 0;
-  } else {
-    mpa->skip_samples += 241;
-    mpa->padding_samples = 0;
-  }
-  mpa->padding_start = mpa->tag_info.frames*mpa->frame.frame_samples;
-  if (mpa->padding_start > mpa->padding_samples) mpa->padding_start -= mpa->padding_samples;
-  else mpa->padding_start = 0;
-  mpa->state = MPADEC_STATE_DECODE;
-  return skip;
+    mpa->replay_gain = pow(10.0, mpa->config.gain/20.0);
+    if (mpa->config.replaygain != MPADEC_CONFIG_REPLAYGAIN_NONE)
+      scale *= mpa->replay_gain;
+    init_tables(mpa, scale, SBLIMIT >> mpa->config.quality);
+    if (mpa->frame.layer == 3) {
+      mpa->skip_samples += 529;
+      if ((mpa->tag_info.flags & 1) && (mpa->padding_samples > 529))
+        mpa->padding_samples -= 529;
+      else mpa->padding_samples = 0;
+    } else {
+      mpa->skip_samples += 241;
+      mpa->padding_samples = 0;
+    }
+    mpa->padding_start = mpa->tag_info.frames*mpa->frame.frame_samples;
+    if (mpa->padding_start > mpa->padding_samples)
+      mpa->padding_start -= mpa->padding_samples;
+    else mpa->padding_start = 0;
+    mpa->state = MPADEC_STATE_DECODE;
+    return skip;
 }
 
 mpadec_t mpadec_init(void)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)malloc(sizeof(struct mpadec_t));
-  uint8_t temp[2];
-
-  if (!mpa) return NULL;
-  memset(mpa, 0, sizeof(struct mpadec_t));
-  mpa->size = sizeof(struct mpadec_t);
-  *((int16_t *)temp) = 1;
-  mpa->config.quality = MPADEC_CONFIG_FULL_QUALITY;
-  mpa->config.mode = MPADEC_CONFIG_AUTO;
-  mpa->config.format = MPADEC_CONFIG_16BIT;
-  mpa->config.endian = (uint8_t)((uint8_t)temp[0] ? MPADEC_CONFIG_LITTLE_ENDIAN : MPADEC_CONFIG_BIG_ENDIAN);
-  mpa->config.replaygain = MPADEC_CONFIG_REPLAYGAIN_NONE;
-  mpa->config.skip = TRUE;
-  mpa->config.crc = TRUE;
-  mpa->config.dblsync = TRUE;
-  mpa->config.gain = 0.0;
-  mpa->replay_gain = 1.0;
-  init_tables(mpa, 0x8000, SBLIMIT);
-  mpa->synth_bufoffs = 1;
-  mpa->state = MPADEC_STATE_START;
-  return mpa;
+    register struct mpadec_t *mpa =
+      (struct mpadec_t *)malloc(sizeof(struct mpadec_t));
+    union {
+      uint8_t  t8[2];
+      uint16_t t16;
+    } ch;
+    if (!mpa) return NULL;
+    memset(mpa, 0, sizeof(struct mpadec_t));
+    mpa->size = sizeof(struct mpadec_t);
+    ch.t16 = 1;
+    //*((int16_t *)temp) = 1;
+    mpa->config.quality = MPADEC_CONFIG_FULL_QUALITY;
+    mpa->config.mode = MPADEC_CONFIG_AUTO;
+    mpa->config.format = MPADEC_CONFIG_16BIT;
+    mpa->config.endian =
+      (uint8_t)(ch.t8[0] ? MPADEC_CONFIG_LITTLE_ENDIAN :
+                           MPADEC_CONFIG_BIG_ENDIAN);
+    mpa->config.replaygain = MPADEC_CONFIG_REPLAYGAIN_NONE;
+    mpa->config.skip = TRUE;
+    mpa->config.crc = TRUE;
+    mpa->config.dblsync = TRUE;
+    mpa->config.gain = 0.0;
+    mpa->replay_gain = 1.0;
+    init_tables(mpa, 0x8000, SBLIMIT);
+    mpa->synth_bufoffs = 1;
+    mpa->state = MPADEC_STATE_START;
+    return mpa;
 }
 
 int mpadec_uninit(mpadec_t mpadec)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
 
-  if (mpa && (mpa->size == sizeof(struct mpadec_t))) {
-    mpa->size = mpa->state = 0;
-    free(mpa);
-    return MPADEC_RETCODE_OK;
-  } else return MPADEC_RETCODE_INVALID_HANDLE;
+    if (mpa && (mpa->size == sizeof(struct mpadec_t))) {
+      mpa->size = mpa->state = 0;
+      free(mpa);
+      return MPADEC_RETCODE_OK;
+    } else return MPADEC_RETCODE_INVALID_HANDLE;
 }
 
 int mpadec_reset(mpadec_t mpadec)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-
-  if (mpa && (mpa->size == sizeof(struct mpadec_t))) {
-    memset(mpa->hybrid_in, 0, sizeof(mpa->hybrid_in));
-    memset(mpa->hybrid_out, 0, sizeof(mpa->hybrid_out));
-    memset(mpa->hybrid_buffers, 0, sizeof(mpa->hybrid_buffers));
-    memset(mpa->synth_buffers, 0, sizeof(mpa->synth_buffers));
-    mpa->hybrid_block[0] = mpa->hybrid_block[1] = 0;
-    mpa->synth_bufoffs = 1;
-    memset(&mpa->tag_info, 0, sizeof(mpa->tag_info));
-    if (mpa->config.replaygain != MPADEC_CONFIG_REPLAYGAIN_CUSTOM) mpa->config.gain = 0.0;
-    mpa->prev_frame_size = 0;
-    mpa->free_format = FALSE;
-    mpa->error = FALSE;
-    mpa->reservoir_size = 0;
-    mpa->replay_gain = 1.0;
-    mpa->skip_samples = 0;
-    mpa->padding_samples = 0;
-    mpa->decoded_frames = 0;
-    mpa->decoded_samples = 0;
-    mpa->state = MPADEC_STATE_START;
-    return MPADEC_RETCODE_OK;
-  } else return MPADEC_RETCODE_INVALID_HANDLE;
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+
+    if (mpa && (mpa->size == sizeof(struct mpadec_t))) {
+      memset(mpa->hybrid_in, 0, sizeof(mpa->hybrid_in));
+      memset(mpa->hybrid_out, 0, sizeof(mpa->hybrid_out));
+      memset(mpa->hybrid_buffers, 0, sizeof(mpa->hybrid_buffers));
+      memset(mpa->synth_buffers, 0, sizeof(mpa->synth_buffers));
+      mpa->hybrid_block[0] = mpa->hybrid_block[1] = 0;
+      mpa->synth_bufoffs = 1;
+      memset(&mpa->tag_info, 0, sizeof(mpa->tag_info));
+      if (mpa->config.replaygain != MPADEC_CONFIG_REPLAYGAIN_CUSTOM)
+        mpa->config.gain = 0.0;
+      mpa->prev_frame_size = 0;
+      mpa->free_format = FALSE;
+      mpa->error = FALSE;
+      mpa->reservoir_size = 0;
+      mpa->replay_gain = 1.0;
+      mpa->skip_samples = 0;
+      mpa->padding_samples = 0;
+      mpa->decoded_frames = 0;
+      mpa->decoded_samples = 0;
+      mpa->state = MPADEC_STATE_START;
+      return MPADEC_RETCODE_OK;
+    } else return MPADEC_RETCODE_INVALID_HANDLE;
 }
 
 int mpadec_configure(mpadec_t mpadec, mpadec_config_t *cfg)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-  int32_t i, sblimit; MYFLT scale;
-
-  if (mpa && (mpa->size == sizeof(struct mpadec_t))) {
-    if (!cfg) return MPADEC_RETCODE_INVALID_PARAMETERS;
-    if ((cfg->quality > MPADEC_CONFIG_HALF_QUALITY) || (cfg->mode > MPADEC_CONFIG_CHANNEL2) ||
-        (cfg->format > MPADEC_CONFIG_FLOAT) || (cfg->endian > MPADEC_CONFIG_BIG_ENDIAN) ||
-        (cfg->replaygain > MPADEC_CONFIG_REPLAYGAIN_CUSTOM)) return MPADEC_RETCODE_INVALID_PARAMETERS;
-    mpa->config.quality = cfg->quality;
-    mpa->config.mode = cfg->mode;
-    mpa->config.format = cfg->format;
-    mpa->config.endian = cfg->endian;
-    mpa->config.replaygain = cfg->replaygain;
-    mpa->config.skip = (uint8_t)(cfg->skip ? TRUE : FALSE);
-    mpa->config.crc = (uint8_t)(cfg->crc ? TRUE : FALSE);
-    mpa->config.dblsync = (uint8_t)(cfg->dblsync ? TRUE : FALSE);
-    if (mpa->config.replaygain == MPADEC_CONFIG_REPLAYGAIN_CUSTOM) {
-      mpa->config.gain = cfg->gain;
-    } else {
-      mpa->config.gain = 0.0;
-      if (mpa->tag_info.flags) {
-        if (mpa->config.replaygain == MPADEC_CONFIG_REPLAYGAIN_RADIO) {
-          mpa->config.gain = ((MYFLT)mpa->tag_info.replay_gain[0])/10.0;
-        } else if (mpa->config.replaygain == MPADEC_CONFIG_REPLAYGAIN_AUDIOPHILE) {
-          mpa->config.gain = ((MYFLT)mpa->tag_info.replay_gain[1])/10.0;
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    int32_t i, sblimit; MYFLT scale;
+
+    if (mpa && (mpa->size == sizeof(struct mpadec_t))) {
+      if (!cfg) return MPADEC_RETCODE_INVALID_PARAMETERS;
+      if ((cfg->quality > MPADEC_CONFIG_HALF_QUALITY) || (cfg->mode > MPADEC_CONFIG_CHANNEL2) ||
+          (cfg->format > MPADEC_CONFIG_FLOAT) || (cfg->endian > MPADEC_CONFIG_BIG_ENDIAN) ||
+          (cfg->replaygain > MPADEC_CONFIG_REPLAYGAIN_CUSTOM)) return MPADEC_RETCODE_INVALID_PARAMETERS;
+      mpa->config.quality = cfg->quality;
+      mpa->config.mode = cfg->mode;
+      mpa->config.format = cfg->format;
+      mpa->config.endian = cfg->endian;
+      mpa->config.replaygain = cfg->replaygain;
+      mpa->config.skip = (uint8_t)(cfg->skip ? TRUE : FALSE);
+      mpa->config.crc = (uint8_t)(cfg->crc ? TRUE : FALSE);
+      mpa->config.dblsync = (uint8_t)(cfg->dblsync ? TRUE : FALSE);
+      if (mpa->config.replaygain == MPADEC_CONFIG_REPLAYGAIN_CUSTOM) {
+        mpa->config.gain = cfg->gain;
+      } else {
+        mpa->config.gain = 0.0;
+        if (mpa->tag_info.flags) {
+          if (mpa->config.replaygain == MPADEC_CONFIG_REPLAYGAIN_RADIO) {
+            mpa->config.gain = ((MYFLT)mpa->tag_info.replay_gain[0])/10.0;
+          } else if (mpa->config.replaygain == MPADEC_CONFIG_REPLAYGAIN_AUDIOPHILE) {
+            mpa->config.gain = ((MYFLT)mpa->tag_info.replay_gain[1])/10.0;
+          }
         }
       }
-    }
-    mpa->replay_gain = pow(10.0, mpa->config.gain/20.0);
-    switch (mpa->config.format) {
+      mpa->replay_gain = pow(10.0, mpa->config.gain/20.0);
+      switch (mpa->config.format) {
       case MPADEC_CONFIG_24BIT: scale = 0x800000; break;
       case MPADEC_CONFIG_32BIT: scale = 0x80000000; break;
       case MPADEC_CONFIG_FLOAT: scale = 1; break;
       default:                  scale = 0x8000; break;
-    }
-    sblimit = SBLIMIT >> mpa->config.quality;
-    if (mpa->config.replaygain != MPADEC_CONFIG_REPLAYGAIN_NONE) scale *= mpa->replay_gain;
-    init_tables(mpa, scale, sblimit);
-    if ((mpa->state > MPADEC_STATE_START) && mpa->header) {
-      decode_header(mpa, mpa->header);
-      if (mpa->frame.channels < 2) i = (mpa->config.mode == MPADEC_CONFIG_STEREO) ? 1 : 0;
-      else i = ((mpa->config.mode == MPADEC_CONFIG_STEREO) || (mpa->config.mode == MPADEC_CONFIG_AUTO)) ? 3 : 2;
-      mpa->synth_func = synth_table[mpa->config.quality][mpa->config.endian][mpa->config.format][i];
-      mpa->sample_size = mpa->frame.decoded_channels;
-      switch (mpa->config.format) {
+      }
+      sblimit = SBLIMIT >> mpa->config.quality;
+      if (mpa->config.replaygain != MPADEC_CONFIG_REPLAYGAIN_NONE) scale *= mpa->replay_gain;
+      init_tables(mpa, scale, sblimit);
+      if ((mpa->state > MPADEC_STATE_START) && mpa->header) {
+        decode_header(mpa, mpa->header);
+        if (mpa->frame.channels < 2) i = (mpa->config.mode == MPADEC_CONFIG_STEREO) ? 1 : 0;
+        else i = ((mpa->config.mode == MPADEC_CONFIG_STEREO) || (mpa->config.mode == MPADEC_CONFIG_AUTO)) ? 3 : 2;
+        mpa->synth_func = synth_table[mpa->config.quality][mpa->config.endian][mpa->config.format][i];
+        mpa->sample_size = mpa->frame.decoded_channels;
+        switch (mpa->config.format) {
         case MPADEC_CONFIG_24BIT: mpa->sample_size *= 3; break;
         case MPADEC_CONFIG_32BIT:
         case MPADEC_CONFIG_FLOAT: mpa->sample_size <<= 2; break;
         default:                  mpa->sample_size <<= 1; break;
-      }
-      mpa->synth_size = (mpa->sample_size << 5) >> mpa->config.quality;
-    } else mpa->state = MPADEC_STATE_START;
-    return MPADEC_RETCODE_OK;
-  } else return MPADEC_RETCODE_INVALID_HANDLE;
+        }
+        mpa->synth_size = (mpa->sample_size<<5) >> mpa->config.quality;
+      } else mpa->state = MPADEC_STATE_START;
+      return MPADEC_RETCODE_OK;
+    } else return MPADEC_RETCODE_INVALID_HANDLE;
 }
 
 int mpadec_get_info(mpadec_t mpadec, void *info, int info_type)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-
-  if (!mpa || (mpa->size != sizeof(struct mpadec_t))) return MPADEC_RETCODE_INVALID_HANDLE;
-  if (!info) return MPADEC_RETCODE_INVALID_PARAMETERS;
-  if (info_type == MPADEC_INFO_CONFIG) {
-    register mpadec_config_t *cfg = (mpadec_config_t *)info;
-    cfg->quality = mpa->config.quality;
-    cfg->mode = mpa->config.mode;
-    cfg->format = mpa->config.format;
-    cfg->endian = mpa->config.endian;
-    cfg->replaygain = mpa->config.replaygain;
-    cfg->skip = mpa->config.skip;
-    cfg->crc = mpa->config.crc;
-    cfg->dblsync = mpa->config.dblsync;
-    cfg->gain = mpa->config.gain;
-  } else if (info_type == MPADEC_INFO_TAG) {
-    register mp3tag_info_t *tag = (mp3tag_info_t *)info;
-    if (mpa->state < MPADEC_STATE_DECODE) {
-      memset(tag, 0, sizeof(mp3tag_info_t));
-      return MPADEC_RETCODE_BAD_STATE;
-    } else memcpy(tag, &mpa->tag_info, sizeof(mpa->tag_info));
-  } else if (info_type == MPADEC_INFO_STREAM) {
-    register mpadec_info_t *inf = (mpadec_info_t *)info;
-    if (mpa->state < MPADEC_STATE_DECODE) {
-      memset(inf, 0, sizeof(mpadec_info_t));
-      return MPADEC_RETCODE_BAD_STATE;
-    } else {
-      inf->layer = mpa->frame.layer;
-      inf->channels = mpa->frame.channels;
-      inf->frequency = mpa->frame.frequency;
-      inf->bitrate = mpa->frame.bitrate;
-      inf->mode = mpa->frame.mode;
-      inf->copyright = mpa->frame.copyright;
-      inf->original = mpa->frame.original;
-      inf->emphasis = mpa->frame.emphasis;
-      inf->decoded_channels = mpa->frame.decoded_channels;
-      inf->decoded_frequency = mpa->frame.decoded_frequency;
-      inf->decoded_sample_size = mpa->sample_size;
-      inf->frame_size = mpa->frame.frame_size;
-      inf->frame_samples = mpa->frame.frame_samples;
-      inf->decoded_frame_samples = mpa->frame.decoded_samples;
-      if (mpa->tag_info.flags & 1) {
-        inf->frames = mpa->tag_info.frames;
-        inf->duration = (mpa->tag_info.frames*mpa->frame.frame_samples + (mpa->frame.frequency >> 1))/mpa->frame.frequency;
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+
+    if (!mpa || (mpa->size != sizeof(struct mpadec_t))) return MPADEC_RETCODE_INVALID_HANDLE;
+    if (!info) return MPADEC_RETCODE_INVALID_PARAMETERS;
+    if (info_type == MPADEC_INFO_CONFIG) {
+      register mpadec_config_t *cfg = (mpadec_config_t *)info;
+      cfg->quality = mpa->config.quality;
+      cfg->mode = mpa->config.mode;
+      cfg->format = mpa->config.format;
+      cfg->endian = mpa->config.endian;
+      cfg->replaygain = mpa->config.replaygain;
+      cfg->skip = mpa->config.skip;
+      cfg->crc = mpa->config.crc;
+      cfg->dblsync = mpa->config.dblsync;
+      cfg->gain = mpa->config.gain;
+    } else if (info_type == MPADEC_INFO_TAG) {
+      register mp3tag_info_t *tag = (mp3tag_info_t *)info;
+      if (mpa->state < MPADEC_STATE_DECODE) {
+        memset(tag, 0, sizeof(mp3tag_info_t));
+        return MPADEC_RETCODE_BAD_STATE;
+      } else memcpy(tag, &mpa->tag_info, sizeof(mpa->tag_info));
+    } else if (info_type == MPADEC_INFO_STREAM) {
+      register mpadec_info_t *inf = (mpadec_info_t *)info;
+      if (mpa->state < MPADEC_STATE_DECODE) {
+        memset(inf, 0, sizeof(mpadec_info_t));
+        return MPADEC_RETCODE_BAD_STATE;
       } else {
-        inf->frames = 0;
-        inf->duration = 0;
+        inf->layer = mpa->frame.layer;
+        inf->channels = mpa->frame.channels;
+        inf->frequency = mpa->frame.frequency;
+        inf->bitrate = mpa->frame.bitrate;
+        inf->mode = mpa->frame.mode;
+        inf->copyright = mpa->frame.copyright;
+        inf->original = mpa->frame.original;
+        inf->emphasis = mpa->frame.emphasis;
+        inf->decoded_channels = mpa->frame.decoded_channels;
+        inf->decoded_frequency = mpa->frame.decoded_frequency;
+        inf->decoded_sample_size = mpa->sample_size;
+        inf->frame_size = mpa->frame.frame_size;
+        inf->frame_samples = mpa->frame.frame_samples;
+        inf->decoded_frame_samples = mpa->frame.decoded_samples;
+        if (mpa->tag_info.flags & 1) {
+          inf->frames = mpa->tag_info.frames;
+          inf->duration = (mpa->tag_info.frames*mpa->frame.frame_samples + (mpa->frame.frequency >> 1))/mpa->frame.frequency;
+        } else {
+          inf->frames = 0;
+          inf->duration = 0;
+        }
       }
-    }
-  } else return MPADEC_RETCODE_INVALID_PARAMETERS;
-  return MPADEC_RETCODE_OK;
+    } else return MPADEC_RETCODE_INVALID_PARAMETERS;
+    return MPADEC_RETCODE_OK;
 }
 
 int mpadec_decode(mpadec_t mpadec, uint8_t *srcbuf, uint32_t srcsize, uint8_t *dstbuf, uint32_t dstsize, uint32_t *srcused, uint32_t *dstused)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-  int retcode = MPADEC_RETCODE_OK;
-  uint32_t decoded_size = 0;
-
-  if (srcused) *srcused = 0;
-  if (dstused) *dstused = 0;
-  if (!dstbuf) dstsize = 0;
-  if (!mpa || (mpa->size != sizeof(struct mpadec_t))) return MPADEC_RETCODE_INVALID_HANDLE;
-  if (mpa->state < MPADEC_STATE_START) return MPADEC_RETCODE_BAD_STATE;
-  if (!srcbuf || ((mpa->state > MPADEC_STATE_START) && !dstbuf )) return MPADEC_RETCODE_INVALID_PARAMETERS;
-  mpa->next_byte = srcbuf;
-  mpa->bytes_left = srcsize;
-  while (mpa->bytes_left >= 4) {
-    mpa->error = FALSE;
-    mpa->bits_left = 0;
-    mpa->header = sync_buffer(mpa);
-    if (!mpa->header) {
-      if (!decoded_size) retcode = MPADEC_RETCODE_NO_SYNC;
-      break;
-    }
-    decode_header(mpa, mpa->header);
-    if ((mpa->bytes_left < mpa->frame.frame_size) || (mpa->free_format && !mpa->prev_frame_size)) {
-      retcode =  MPADEC_RETCODE_NEED_MORE_DATA;
-      break;
-    }
-    if (mpa->state == MPADEC_STATE_START) {
-      if (first_frame(mpa)) continue;
-    } else if ((mpa->frame.layer == 3) && (mpa->frame.frame_size >= (mpa->ssize + 12))) {
-      register uint8_t *buf = mpa->next_byte + 4 + mpa->ssize;
-      if (((buf[0] == 'X') && (buf[1] == 'i') && (buf[2] == 'n') && (buf[3] == 'g')) ||
-          ((buf[0] == 'I') && (buf[1] == 'n') && (buf[2] == 'f') && (buf[3] == 'o'))) {
-        mpa->next_byte += mpa->frame.frame_size;
-        mpa->bytes_left -= mpa->frame.frame_size;
-        continue;
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    int retcode = MPADEC_RETCODE_OK;
+    uint32_t decoded_size = 0;
+
+    if (srcused) *srcused = 0;
+    if (dstused) *dstused = 0;
+    if (!dstbuf) dstsize = 0;
+    if (!mpa || (mpa->size != sizeof(struct mpadec_t))) return MPADEC_RETCODE_INVALID_HANDLE;
+    if (mpa->state < MPADEC_STATE_START) return MPADEC_RETCODE_BAD_STATE;
+    if (!srcbuf || ((mpa->state > MPADEC_STATE_START) && !dstbuf )) return MPADEC_RETCODE_INVALID_PARAMETERS;
+    mpa->next_byte = srcbuf;
+    mpa->bytes_left = srcsize;
+    while (mpa->bytes_left >= 4) {
+      mpa->error = FALSE;
+      mpa->bits_left = 0;
+      mpa->header = sync_buffer(mpa);
+      if (!mpa->header) {
+        if (!decoded_size) retcode = MPADEC_RETCODE_NO_SYNC;
+        break;
       }
-    }
-    if (dstsize < mpa->frame.decoded_size) {
-      retcode = MPADEC_RETCODE_BUFFER_TOO_SMALL;
-      break;
-    }
-    if (mpa->config.crc && mpa->frame.CRC) {
-      mpa->frame.crc = (uint16_t)((mpa->next_byte[4] << 8) | mpa->next_byte[5]);
+      decode_header(mpa, mpa->header);
+      if ((mpa->bytes_left < mpa->frame.frame_size) || (mpa->free_format && !mpa->prev_frame_size)) {
+        retcode =  MPADEC_RETCODE_NEED_MORE_DATA;
+        break;
+      }
+      if (mpa->state == MPADEC_STATE_START) {
+        if (first_frame(mpa)) continue;
+      } else if ((mpa->frame.layer == 3) && (mpa->frame.frame_size >= (mpa->ssize + 12))) {
+        register uint8_t *buf = mpa->next_byte + 4 + mpa->ssize;
+        if (((buf[0] == 'X') && (buf[1] == 'i') && (buf[2] == 'n') && (buf[3] == 'g')) ||
+            ((buf[0] == 'I') && (buf[1] == 'n') && (buf[2] == 'f') && (buf[3] == 'o'))) {
+          mpa->next_byte += mpa->frame.frame_size;
+          mpa->bytes_left -= mpa->frame.frame_size;
+          continue;
+        }
+      }
+      if (dstsize < mpa->frame.decoded_size) {
+        retcode = MPADEC_RETCODE_BUFFER_TOO_SMALL;
+        break;
+      }
+      if (mpa->config.crc && mpa->frame.CRC) {
+        mpa->frame.crc = (uint16_t)((mpa->next_byte[4]<<8) | mpa->next_byte[5]);
       mpa->crc = update_crc(0xFFFF, mpa->next_byte + 2, 16);
     }
     mpa->next_byte += mpa->hsize;
diff --git a/InOut/libmpadec/tables.c b/InOut/libmpadec/tables.c
index ce28b00..8a4a4ff 100644
--- a/InOut/libmpadec/tables.c
+++ b/InOut/libmpadec/tables.c
@@ -94,54 +94,82 @@ const MYFLT ca[8] = {
 
 bandinfo_t band_info[9] = {
   /* MPEG 1.0 */
-  { { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196, 238, 288, 342, 418, 576 },
-    { 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10, 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158 },
-    { 0, 4*3, 8*3, 12*3, 16*3, 22*3, 30*3, 40*3, 52*3, 66*3, 84*3, 106*3, 136*3, 192*3 },
+  { { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162,
+      196, 238, 288, 342, 418, 576 },
+    { 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10, 12, 16, 20, 24, 28, 34, 42, 50,
+      54, 76, 158 },
+    { 0, 4*3, 8*3, 12*3, 16*3, 22*3, 30*3, 40*3, 52*3, 66*3, 84*3, 106*3,
+      136*3, 192*3 },
     { 4, 4, 4, 4, 6, 8, 10, 12, 14, 18, 22, 30, 56 } },
-  { { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190, 230, 276, 330, 384, 576 },
-    { 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10, 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192 },
-    { 0, 4*3, 8*3, 12*3, 16*3, 22*3, 28*3, 38*3, 50*3, 64*3, 80*3, 100*3, 126*3, 192*3 },
+  { { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156,
+      190, 230, 276, 330, 384, 576 },
+    { 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10, 12, 16, 18, 22, 28, 34, 40, 46,
+      54, 54, 192 },
+    { 0, 4*3, 8*3, 12*3, 16*3, 22*3, 28*3, 38*3, 50*3, 64*3, 80*3, 100*3,
+      126*3, 192*3 },
     { 4, 4, 4, 4, 6, 6, 10, 12, 14, 16, 20, 26, 66 } },
-  { { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240, 296, 364, 448, 550, 576 },
-    { 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12, 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26 },
-    { 0, 4*3, 8*3, 12*3, 16*3, 22*3, 30*3, 42*3, 58*3, 78*3, 104*3, 138*3, 180*3, 192*3 },
+  { { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194,
+      240, 296, 364, 448, 550, 576 },
+    { 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12, 16, 20, 24, 30, 38, 46, 56, 68,
+      84, 102, 26 },
+    { 0, 4*3, 8*3, 12*3, 16*3, 22*3, 30*3, 42*3, 58*3, 78*3, 104*3, 138*3,
+      180*3, 192*3 },
     { 4, 4, 4, 4, 6, 8, 12, 16, 20, 26, 34, 42, 12 } },
   /* MPEG 2.0 */
-  { { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576 },
-    { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54 },
-    { 0, 4*3, 8*3, 12*3, 18*3, 24*3, 32*3, 42*3, 56*3, 74*3, 100*3, 132*3, 174*3, 192*3 },
+  { { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200,
+      238, 284, 336, 396, 464, 522, 576 },
+    { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60,
+      68, 58, 54 },
+    { 0, 4*3, 8*3, 12*3, 18*3, 24*3, 32*3, 42*3, 56*3, 74*3, 100*3, 132*3,
+      174*3, 192*3 },
     { 4, 4, 4, 6, 6, 8, 10, 14, 18, 26, 32, 42, 18 } },
-  { { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232, 278, 330, 394, 464, 540, 576 },
-    { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 18, 22, 26, 32, 38, 46, 52, 64, 70, 76, 36 },
-    { 0, 4*3, 8*3, 12*3, 18*3, 26*3, 36*3, 48*3, 62*3, 80*3, 104*3, 136*3, 180*3, 192*3 },
+  { { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194,
+      232, 278, 330, 394, 464, 540, 576 },
+    { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 18, 22, 26, 32, 38, 46, 52, 64,
+      70, 76, 36 },
+    { 0, 4*3, 8*3, 12*3, 18*3, 26*3, 36*3, 48*3, 62*3, 80*3, 104*3, 136*3,
+      180*3, 192*3 },
     { 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 32, 44, 12 } },
-  { { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576 },
-    { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54 },
-    { 0, 4*3, 8*3, 12*3, 18*3, 26*3, 36*3, 48*3, 62*3, 80*3, 104*3, 134*3, 174*3, 192*3 },
+  { { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200,
+      238, 284, 336, 396, 464, 522, 576 },
+    { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60,
+      68, 58, 54 },
+    { 0, 4*3, 8*3, 12*3, 18*3, 26*3, 36*3, 48*3, 62*3, 80*3, 104*3, 134*3,
+      174*3, 192*3 },
     { 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18 } },
   /* MPEG 2.5 */
-  { { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576 },
-    { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54 },
+  { { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200,
+        238, 284, 336, 396, 464, 522, 576 },
+    { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60,
+        68, 58, 54 },
     { 0, 12, 24, 36, 54, 78, 108, 144, 186, 240, 312, 402, 522, 576 },
     { 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18 } },
-  { { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576 },
-    { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54 },
+  { { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200,
+        238, 284, 336, 396, 464, 522, 576 },
+    { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60,
+        68, 58, 54 },
     { 0, 12, 24, 36, 54, 78, 108, 144, 186, 240, 312, 402, 522, 576 },
     { 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18 } },
-  { { 0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568, 570, 572, 574, 576 },
-    { 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32, 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2 },
+  { { 0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336,
+        400, 476, 566, 568, 570, 572, 574, 576 },
+    { 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32, 40, 48, 56, 64, 76, 90,
+        2, 2, 2, 2, 2 },
     { 0, 24, 48, 72, 108, 156, 216, 288, 372, 480, 486, 492, 498, 576 },
     { 8, 8, 8, 12, 16, 20, 24, 28, 36, 2, 2, 2, 26 } },
 };
 
 static alloc_table_t alloc_0[] = {
-  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127}, {9,-255}, {10,-511},
+  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
+  {9,-255}, {10,-511},
   {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
-  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127}, {9,-255}, {10,-511},
+  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
+  {9,-255}, {10,-511},
   {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
-  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127}, {9,-255}, {10,-511},
+  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
+  {9,-255}, {10,-511},
   {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
-  {4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
+  {4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31},
+  {7,-63}, {8,-127},
   {9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
   {4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
   {9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
@@ -176,11 +204,14 @@ static alloc_table_t alloc_0[] = {
 };
 
 static alloc_table_t alloc_1[] = {
-  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127}, {9,-255}, {10,-511},
+  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
+  {9,-255}, {10,-511},
   {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
-  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127}, {9,-255}, {10,-511},
+  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
+  {9,-255}, {10,-511},
   {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
-  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127}, {9,-255}, {10,-511},
+  {4,0}, {5,3}, {3,-3}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
+  {9,-255}, {10,-511},
   {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383}, {16,-32767},
   {4,0}, {5,3}, {7,5}, {3,-3}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127},
   {9,-255}, {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {16,-32767},
@@ -220,9 +251,11 @@ static alloc_table_t alloc_1[] = {
 };
 
 static alloc_table_t alloc_2[] = {
-  {4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127}, {9,-255},
+  {4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
+         {8,-127}, {9,-255},
   {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383},
-  {4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127}, {9,-255},
+  {4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
+         {8,-127}, {9,-255},
   {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383},
   {3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
   {3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
@@ -233,9 +266,11 @@ static alloc_table_t alloc_2[] = {
 };
 
 static alloc_table_t alloc_3[] = {
-  {4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127}, {9,-255},
+  {4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
+         {8,-127}, {9,-255},
   {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383},
-  {4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63}, {8,-127}, {9,-255},
+  {4,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
+         {8,-127}, {9,-255},
   {10,-511}, {11,-1023}, {12,-2047}, {13,-4095}, {14,-8191}, {15,-16383},
   {3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
   {3,0}, {5,3}, {7,5}, {10,9}, {4,-7}, {5,-15}, {6,-31}, {7,-63},
@@ -293,248 +328,428 @@ static int16_t tab0[] = { 0 };
 static int16_t tab1[] = { -5, -3, -1, 17,  1, 16,  0 };
 
 static int16_t tab2[] = {
-   -15,  -11,   -9,   -5,   -3,   -1,   34,    2,   18,  -1,  33,  32,  17,  -1,   1,
-    16,    0
+   -15,  -11,   -9,   -5,   -3,   -1,   34,    2,   18,  -1,  33,  32,
+   17,  -1,   1,  16,    0
 };
 
 static int16_t tab3[] = {
-   -13,  -11,   -9,   -5,   -3,   -1,   34,    2,   18,  -1,  33,  32,  16,  17,  -1,
-     1,    0
+   -13,  -11,   -9,   -5,   -3,   -1,   34,    2,   18,  -1,  33,  32,
+   16,  17,  -1,  1,    0
 };
 
 static int16_t tab5[] = {
-   -29,  -25,  -23,  -15,   -7,   -5,   -3,   -1,   51,  35,  50,  49,  -3,  -1,  19,
-     3,   -1,   48,   34,   -3,   -1,   18,   33,   -1,   2,  32,  17,  -1,   1,  16,
+   -29,  -25,  -23,  -15,   -7,   -5,   -3,   -1,   51,  35,  50,  49,
+   -3,  -1,  19,
+     3,   -1,   48,   34,   -3,   -1,   18,   33,   -1,   2,  32,  17,
+   -1,   1,  16,
      0
 };
 
 static int16_t tab6[] = {
-   -25,  -19,  -13,   -9,   -5,   -3,   -1,   51,    3,  35,  -1,  50,  48,  -1,  19,
-    49,   -3,   -1,   34,    2,   18,   -3,   -1,   33,  32,   1,  -1,  17,  -1,  16,
+   -25,  -19,  -13,   -9,   -5,   -3,   -1,   51,    3,  35,  -1,  50,
+   48,  -1,  19,
+    49,   -3,   -1,   34,    2,   18,   -3,   -1,   33,  32,   1,  -1,
+   17,  -1,  16,
      0
 };
 
 static int16_t tab7[] = {
-   -69,  -65,  -57,  -39,  -29,  -17,  -11,   -7,   -3,  -1,  85,  69,  -1,  84,  83,
-    -1,   53,   68,   -3,   -1,   37,   82,   21,   -5,  -1,  81,  -1,   5,  52,  -1,
-    80,   -1,   67,   51,   -5,   -3,   -1,   36,   66,  20,  -1,  65,  64, -11,  -7,
-    -3,   -1,    4,   35,   -1,   50,    3,   -1,   19,  49,  -3,  -1,  48,  34,  18,
+   -69,  -65,  -57,  -39,  -29,  -17,  -11,   -7,   -3,  -1,  85,  69,
+   -1,  84,  83,
+    -1,   53,   68,   -3,   -1,   37,   82,   21,   -5,  -1,  81,  -1,
+   5,  52,  -1,
+    80,   -1,   67,   51,   -5,   -3,   -1,   36,   66,  20,  -1,  65,
+   64, -11,  -7,
+    -3,   -1,    4,   35,   -1,   50,    3,   -1,   19,  49,  -3,  -1,
+   48,  34,  18,
     -5,   -1,   33,   -1,    2,   32,   17,   -1,    1,  16,   0
 };
 
 static int16_t tab8[] = {
-   -65,  -63,  -59,  -45,  -31,  -19,  -13,   -7,   -5,  -3,  -1,  85,  84,  69,  83,
-    -3,   -1,   53,   68,   37,   -3,   -1,   82,    5,  21,  -5,  -1,  81,  -1,  52,
-    67,   -3,   -1,   80,   51,   36,   -5,   -3,   -1,  66,  20,  65,  -3,  -1,   4,
-    64,   -1,   35,   50,   -9,   -7,   -3,   -1,   19,  49,  -1,   3,  48,  34,  -1,
+   -65,  -63,  -59,  -45,  -31,  -19,  -13,   -7,   -5,  -3,  -1,  85,
+   84,  69,  83,
+    -3,   -1,   53,   68,   37,   -3,   -1,   82,    5,  21,  -5,  -1,
+   81,  -1,  52,
+    67,   -3,   -1,   80,   51,   36,   -5,   -3,   -1,  66,  20,  65,
+   -3,  -1,   4,
+    64,   -1,   35,   50,   -9,   -7,   -3,   -1,   19,  49,  -1,   3,
+   48,  34,  -1,
      2,   32,   -1,   18,   33,   17,   -3,   -1,    1,  16,   0
 };
 
 static int16_t tab9[] = {
-   -63,  -53,  -41,  -29,  -19,  -11,   -5,   -3,   -1,  85,  69,  53,  -1,  83,   -1,
-    84,    5,   -3,   -1,   68,   37,   -1,   82,   21,  -3,  -1,  81,  52,  -1,   67,
-    -1,   80,    4,   -7,   -3,   -1,   36,   66,   -1,  51,  64,  -1,  20,  65,   -5,
-    -3,   -1,   35,   50,   19,   -1,   49,   -1,    3,  48,  -5,  -3,  -1,  34,    2,
+   -63,  -53,  -41,  -29,  -19,  -11,   -5,   -3,   -1,  85,  69,  53,
+   -1,  83,   -1,
+    84,    5,   -3,   -1,   68,   37,   -1,   82,   21,  -3,  -1,  81,
+   52,  -1,   67,
+    -1,   80,    4,   -7,   -3,   -1,   36,   66,   -1,  51,  64,  -1,
+   20,  65,   -5,
+    -3,   -1,   35,   50,   19,   -1,   49,   -1,    3,  48,  -5,  -3,
+   -1,  34,    2,
     18,   -1,   33,   32,   -3,   -1,   17,    1,   -1,  16,   0
 };
 
 static int16_t tab10[] = {
-  -125, -121, -111,  -83,  -55,  -35,  -21,  -13,   -7,  -3,  -1, 119, 103,  -1,  118,
-    87,   -3,   -1,  117,  102,   71,   -3,   -1,  116,  86,  -1, 101,  55,  -9,   -3,
-    -1,  115,   70,   -3,   -1,   85,   84,   99,   -1,  39, 114, -11,  -5,  -3,   -1,
-   100,    7,  112,   -1,   98,   -1,   69,   53,   -5,  -1,   6,  -1,  83,  68,   23,
-   -17,   -5,   -1,  113,   -1,   54,   38,   -5,   -3,  -1,  37,  82,  21,  -1,   81,
-    -1,   52,   67,   -3,   -1,   22,   97,   -1,   96,  -1,   5,  80, -19, -11,   -7,
-    -3,   -1,   36,   66,   -1,   51,    4,   -1,   20,  65,  -3,  -1,  64,  35,   -1,
-    50,    3,   -3,   -1,   19,   49,   -1,   48,   34,  -7,  -3,  -1,  18,  33,   -1,
+  -125, -121, -111,  -83,  -55,  -35,  -21,  -13,   -7,  -3,  -1, 119,
+  103,  -1,  118,
+    87,   -3,   -1,  117,  102,   71,   -3,   -1,  116,  86,  -1, 101,
+  55,  -9,   -3,
+    -1,  115,   70,   -3,   -1,   85,   84,   99,   -1,  39, 114, -11,
+  -5,  -3,   -1,
+   100,    7,  112,   -1,   98,   -1,   69,   53,   -5,  -1,   6,  -1,
+  83,  68,   23,
+   -17,   -5,   -1,  113,   -1,   54,   38,   -5,   -3,  -1,  37,  82,
+  21,  -1,   81,
+    -1,   52,   67,   -3,   -1,   22,   97,   -1,   96,  -1,   5,  80,
+  -19, -11,   -7,
+    -3,   -1,   36,   66,   -1,   51,    4,   -1,   20,  65,  -3,  -1,
+  64,  35,   -1,
+    50,    3,   -3,   -1,   19,   49,   -1,   48,   34,  -7,  -3,  -1,
+  18,  33,   -1,
      2,   32,   17,   -1,    1,   16,    0
 };
 
 static int16_t tab11[] = {
-  -121, -113,  -89,  -59,  -43,  -27,  -17,   -7,   -3,  -1, 119, 103,  -1, 118,  117,
-    -3,   -1,  102,   71,   -1,  116,   -1,   87,   85,  -5,  -3,  -1,  86, 101,   55,
-    -1,  115,   70,   -9,   -7,   -3,   -1,   69,   84,  -1,  53,  83,  39,  -1,  114,
-    -1,  100,    7,   -5,   -1,  113,   -1,   23,  112,  -3,  -1,  54,  99,  -1,   96,
-    -1,   68,   37,  -13,   -7,   -5,   -3,   -1,   82,   5,  21,  98,  -3,  -1,   38,
-     6,   22,   -5,   -1,   97,   -1,   81,   52,   -5,  -1,  80,  -1,  67,  51,   -1,
-    36,   66,  -15,  -11,   -7,   -3,   -1,   20,   65,  -1,   4,  64,  -1,  35,   50,
-    -1,   19,   49,   -5,   -3,   -1,    3,   48,   34,  33,  -5,  -1,  18,  -1,    2,
+  -121, -113,  -89,  -59,  -43,  -27,  -17,   -7,   -3,  -1, 119, 103,
+  -1, 118,  117,
+    -3,   -1,  102,   71,   -1,  116,   -1,   87,   85,  -5,  -3,  -1,
+  86, 101,   55,
+    -1,  115,   70,   -9,   -7,   -3,   -1,   69,   84,  -1,  53,  83,
+  39,  -1,  114,
+    -1,  100,    7,   -5,   -1,  113,   -1,   23,  112,  -3,  -1,  54,
+  99,  -1,   96,
+    -1,   68,   37,  -13,   -7,   -5,   -3,   -1,   82,   5,  21,  98,
+  -3,  -1,   38,
+     6,   22,   -5,   -1,   97,   -1,   81,   52,   -5,  -1,  80,  -1,
+  67,  51,   -1,
+    36,   66,  -15,  -11,   -7,   -3,   -1,   20,   65,  -1,   4,  64,
+  -1,  35,   50,
+    -1,   19,   49,   -5,   -3,   -1,    3,   48,   34,  33,  -5,  -1,
+  18,  -1,    2,
     32,   17,   -3,   -1,    1,   16,    0
 };
 
 static int16_t tab12[] = {
-  -115,  -99,  -73,  -45,  -27,  -17,   -9,   -5,   -3,  -1, 119, 103, 118,  -1,   87,
-   117,   -3,   -1,  102,   71,   -1,  116,  101,   -3,  -1,  86,  55,  -3,  -1,  115,
-    85,   39,   -7,   -3,   -1,  114,   70,   -1,  100,  23,  -5,  -1, 113,  -1,    7,
-   112,   -1,   54,   99,  -13,   -9,   -3,   -1,   69,  84,  -1,  68,  -1,   6,    5,
-    -1,   38,   98,   -5,   -1,   97,   -1,   22,   96,  -3,  -1,  53,  83,  -1,   37,
-    82,  -17,   -7,   -3,   -1,   21,   81,   -1,   52,  67,  -5,  -3,  -1,  80,    4,
-    36,   -1,   66,   20,   -3,   -1,   51,   65,   -1,  35,  50, -11,  -7,  -5,   -3,
-    -1,   64,    3,   48,   19,   -1,   49,   34,   -1,  18,  33,  -7,  -5,  -3,   -1,
+  -115,  -99,  -73,  -45,  -27,  -17,   -9,   -5,   -3,  -1, 119, 103,
+  118,  -1,   87,
+   117,   -3,   -1,  102,   71,   -1,  116,  101,   -3,  -1,  86,  55,
+  -3,  -1,  115,
+    85,   39,   -7,   -3,   -1,  114,   70,   -1,  100,  23,  -5,  -1,
+  113,  -1,    7,
+   112,   -1,   54,   99,  -13,   -9,   -3,   -1,   69,  84,  -1,  68,
+  -1,   6,    5,
+    -1,   38,   98,   -5,   -1,   97,   -1,   22,   96,  -3,  -1,  53,
+  83,  -1,   37,
+    82,  -17,   -7,   -3,   -1,   21,   81,   -1,   52,  67,  -5,  -3,
+  -1,  80,    4,
+    36,   -1,   66,   20,   -3,   -1,   51,   65,   -1,  35,  50, -11,
+  -7,  -5,   -3,
+    -1,   64,    3,   48,   19,   -1,   49,   34,   -1,  18,  33,  -7,
+  -5,  -3,   -1,
      2,   32,    0,   17,   -1,    1,   16
 };
 
 static int16_t tab13[] = {
-  -509, -503, -475, -405, -333, -265, -205, -153, -115, -83, -53, -35, -21, -13,   -9,
-    -7,   -5,   -3,   -1,  254,  252,  253,  237,  255,  -1, 239, 223,  -3,  -1,  238,
-   207,   -1,  222,  191,   -9,   -3,   -1,  251,  206,  -1, 220,  -1, 175, 233,   -1,
-   236,  221,   -9,   -5,   -3,   -1,  250,  205,  190,  -1, 235, 159,  -3,  -1,  249,
-   234,   -1,  189,  219,  -17,   -9,   -3,   -1,  143, 248,  -1, 204,  -1, 174,  158,
-    -5,   -1,  142,   -1,  127,  126,  247,   -5,   -1, 218,  -1, 173, 188,  -3,   -1,
-   203,  246,  111,  -15,   -7,   -3,   -1,  232,   95,  -1, 157, 217,  -3,  -1,  245,
-   231,   -1,  172,  187,   -9,   -3,   -1,   79,  244,  -3,  -1, 202, 230, 243,   -1,
-    63,   -1,  141,  216,  -21,   -9,   -3,   -1,   47, 242,  -3,  -1, 110, 156,   15,
-    -5,   -3,   -1,  201,   94,  171,   -3,   -1,  125, 215,  78, -11,  -5,  -3,   -1,
-   200,  214,   62,   -1,  185,   -1,  155,  170,   -1,  31, 241, -23, -13,  -5,   -1,
-   240,   -1,  186,  229,   -3,   -1,  228,  140,   -1, 109, 227,  -5,  -1, 226,   -1,
-    46,   14,   -1,   30,  225,  -15,   -7,   -3,   -1, 224,  93,  -1, 213, 124,   -3,
-    -1,  199,   77,   -1,  139,  184,   -7,   -3,   -1, 212, 154,  -1, 169, 108,   -1,
-   198,   61,  -37,  -21,   -9,   -5,   -3,   -1,  211, 123,  45,  -1, 210,  29,   -5,
-    -1,  183,   -1,   92,  197,   -3,   -1,  153,  122, 195,  -7,  -5,  -3,  -1,  167,
-   151,   75,  209,   -3,   -1,   13,  208,   -1,  138, 168, -11,  -7,  -3,  -1,   76,
-   196,   -1,  107,  182,   -1,   60,   44,   -3,   -1, 194,  91,  -3,  -1, 181,  137,
-    28,  -43,  -23,  -11,   -5,   -1,  193,   -1,  152,  12,  -1, 192,  -1, 180,  106,
-    -5,   -3,   -1,  166,  121,   59,   -1,  179,   -1, 136,  90, -11,  -5,  -1,   43,
-    -1,  165,  105,   -1,  164,   -1,  120,  135,   -5,  -1, 148,  -1, 119, 118,  178,
-   -11,   -3,   -1,   27,  177,   -3,   -1,   11,  176,  -1, 150,  74,  -7,  -3,   -1,
-    58,  163,   -1,   89,  149,   -1,   42,  162,  -47, -23,  -9,  -3,  -1,  26,  161,
-    -3,   -1,   10,  104,  160,   -5,   -3,   -1,  134,  73, 147,  -3,  -1,  57,   88,
-    -1,  133,  103,   -9,   -3,   -1,   41,  146,   -3,  -1,  87, 117,  56,  -5,   -1,
-   131,   -1,  102,   71,   -3,   -1,  116,   86,   -1, 101, 115, -11,  -3,  -1,   25,
-   145,   -3,   -1,    9,  144,   -1,   72,  132,   -7,  -5,  -1, 114,  -1,  70,  100,
-    40,   -1,  130,   24,  -41,  -27,  -11,   -5,   -3,  -1,  55,  39,  23,  -1,  113,
-    -1,   85,    7,   -7,   -3,   -1,  112,   54,   -1,  99,  69,  -3,  -1,  84,   38,
-    -1,   98,   53,   -5,   -1,  129,   -1,    8,  128,  -3,  -1,  22,  97,  -1,    6,
-    96,  -13,   -9,   -5,   -3,   -1,   83,   68,   37,  -1,  82,   5,  -1,  21,   81,
-    -7,   -3,   -1,   52,   67,   -1,   80,   36,   -3,  -1,  66,  51,  20, -19,  -11,
-    -5,   -1,   65,   -1,    4,   64,   -3,   -1,   35,  50,  19,  -3,  -1,  49,    3,
-    -1,   48,   34,   -3,   -1,   18,   33,   -1,    2,  32,  -3,  -1,  17,   1,   16,
+  -509, -503, -475, -405, -333, -265, -205, -153, -115, -83, -53, -35,
+  -21, -13,   -9,
+    -7,   -5,   -3,   -1,  254,  252,  253,  237,  255,  -1, 239, 223,
+  -3,  -1,  238,
+   207,   -1,  222,  191,   -9,   -3,   -1,  251,  206,  -1, 220,  -1,
+  175, 233,   -1,
+   236,  221,   -9,   -5,   -3,   -1,  250,  205,  190,  -1, 235, 159,
+  -3,  -1,  249,
+   234,   -1,  189,  219,  -17,   -9,   -3,   -1,  143, 248,  -1, 204,
+  -1, 174,  158,
+    -5,   -1,  142,   -1,  127,  126,  247,   -5,   -1, 218,  -1, 173,
+  188,  -3,   -1,
+   203,  246,  111,  -15,   -7,   -3,   -1,  232,   95,  -1, 157, 217,
+  -3,  -1,  245,
+   231,   -1,  172,  187,   -9,   -3,   -1,   79,  244,  -3,  -1, 202,
+  230, 243,   -1,
+    63,   -1,  141,  216,  -21,   -9,   -3,   -1,   47, 242,  -3,  -1,
+  110, 156,   15,
+    -5,   -3,   -1,  201,   94,  171,   -3,   -1,  125, 215,  78, -11,
+  -5,  -3,   -1,
+   200,  214,   62,   -1,  185,   -1,  155,  170,   -1,  31, 241, -23,
+  -13,  -5,   -1,
+   240,   -1,  186,  229,   -3,   -1,  228,  140,   -1, 109, 227,  -5,
+  -1, 226,   -1,
+    46,   14,   -1,   30,  225,  -15,   -7,   -3,   -1, 224,  93,  -1,
+  213, 124,   -3,
+    -1,  199,   77,   -1,  139,  184,   -7,   -3,   -1, 212, 154,  -1,
+  169, 108,   -1,
+   198,   61,  -37,  -21,   -9,   -5,   -3,   -1,  211, 123,  45,  -1,
+  210,  29,   -5,
+    -1,  183,   -1,   92,  197,   -3,   -1,  153,  122, 195,  -7,  -5,
+  -3,  -1,  167,
+   151,   75,  209,   -3,   -1,   13,  208,   -1,  138, 168, -11,  -7,
+  -3,  -1,   76,
+   196,   -1,  107,  182,   -1,   60,   44,   -3,   -1, 194,  91,  -3,
+  -1, 181,  137,
+    28,  -43,  -23,  -11,   -5,   -1,  193,   -1,  152,  12,  -1, 192,
+  -1, 180,  106,
+    -5,   -3,   -1,  166,  121,   59,   -1,  179,   -1, 136,  90, -11,
+  -5,  -1,   43,
+    -1,  165,  105,   -1,  164,   -1,  120,  135,   -5,  -1, 148,  -1,
+  119, 118,  178,
+   -11,   -3,   -1,   27,  177,   -3,   -1,   11,  176,  -1, 150,  74,
+  -7,  -3,   -1,
+    58,  163,   -1,   89,  149,   -1,   42,  162,  -47, -23,  -9,  -3,
+  -1,  26,  161,
+    -3,   -1,   10,  104,  160,   -5,   -3,   -1,  134,  73, 147,  -3,
+  -1,  57,   88,
+    -1,  133,  103,   -9,   -3,   -1,   41,  146,   -3,  -1,  87, 117,
+  56,  -5,   -1,
+   131,   -1,  102,   71,   -3,   -1,  116,   86,   -1, 101, 115, -11,
+  -3,  -1,   25,
+   145,   -3,   -1,    9,  144,   -1,   72,  132,   -7,  -5,  -1, 114,
+  -1,  70,  100,
+    40,   -1,  130,   24,  -41,  -27,  -11,   -5,   -3,  -1,  55,  39,
+  23,  -1,  113,
+    -1,   85,    7,   -7,   -3,   -1,  112,   54,   -1,  99,  69,  -3,
+  -1,  84,   38,
+    -1,   98,   53,   -5,   -1,  129,   -1,    8,  128,  -3,  -1,  22,
+  97,  -1,    6,
+    96,  -13,   -9,   -5,   -3,   -1,   83,   68,   37,  -1,  82,   5,
+  -1,  21,   81,
+    -7,   -3,   -1,   52,   67,   -1,   80,   36,   -3,  -1,  66,  51,
+  20, -19,  -11,
+    -5,   -1,   65,   -1,    4,   64,   -3,   -1,   35,  50,  19,  -3,
+  -1,  49,    3,
+    -1,   48,   34,   -3,   -1,   18,   33,   -1,    2,  32,  -3,  -1,
+  17,   1,   16,
      0
 };
 
 static int16_t tab15[] = {
-  -495, -445, -355, -263, -183, -115,  -77,  -43,  -27, -13,  -7,  -3,  -1, 255,  239,
-    -1,  254,  223,   -1,  238,   -1,  253,  207,   -7,  -3,  -1, 252, 222,  -1,  237,
-   191,   -1,  251,   -1,  206,  236,   -7,   -3,   -1, 221, 175,  -1, 250, 190,   -3,
-    -1,  235,  205,   -1,  220,  159,  -15,   -7,   -3,  -1, 249, 234,  -1, 189,  219,
-    -3,   -1,  143,  248,   -1,  204,  158,   -7,   -3,  -1, 233, 127,  -1, 247,  173,
-    -3,   -1,  218,  188,   -1,  111,   -1,  174,   15, -19, -11,  -3,  -1, 203,  246,
-    -3,   -1,  142,  232,   -1,   95,  157,   -3,   -1, 245, 126,  -1, 231, 172,   -9,
-    -3,   -1,  202,  187,   -3,   -1,  217,  141,   79,  -3,  -1, 244,  63,  -1,  243,
-   216,  -33,  -17,   -9,   -3,   -1,  230,   47,   -1, 242,  -1, 110, 240,  -3,   -1,
-    31,  241,   -1,  156,  201,   -7,   -3,   -1,   94, 171,  -1, 186, 229,  -3,   -1,
-   125,  215,   -1,   78,  228,  -15,   -7,   -3,   -1, 140, 200,  -1,  62, 109,   -3,
-    -1,  214,  227,   -1,  155,  185,   -7,   -3,   -1,  46, 170,  -1, 226,  30,   -5,
-    -1,  225,   -1,   14,  224,   -1,   93,  213,  -45, -25, -13,  -7,  -3,  -1,  124,
-   199,   -1,   77,  139,   -1,  212,   -1,  184,  154,  -7,  -3,  -1, 169, 108,   -1,
-   198,   61,   -1,  211,  210,   -9,   -5,   -3,   -1,  45,  13,  29,  -1, 123,  183,
-    -5,   -1,  209,   -1,   92,  208,   -1,  197,  138, -17,  -7,  -3,  -1, 168,   76,
-    -1,  196,  107,   -5,   -1,  182,   -1,  153,   12,  -1,  60, 195,  -9,  -3,   -1,
-   122,  167,   -1,  166,   -1,  192,   11,   -1,  194,  -1,  44,  91, -55, -29,  -15,
-    -7,   -3,   -1,  181,   28,   -1,  137,  152,   -3,  -1, 193,  75,  -1, 180,  106,
-    -5,   -3,   -1,   59,  121,  179,   -3,   -1,  151, 136,  -1,  43,  90, -11,   -5,
-    -1,  178,   -1,  165,   27,   -1,  177,   -1,  176, 105,  -7,  -3,  -1, 150,   74,
-    -1,  164,  120,   -3,   -1,  135,   58,  163,  -17,  -7,  -3,  -1,  89, 149,   -1,
-    42,  162,   -3,   -1,   26,  161,   -3,   -1,   10, 160, 104,  -7,  -3,  -1,  134,
-    73,   -1,  148,   57,   -5,   -1,  147,   -1,  119,   9,  -1,  88, 133, -53,  -29,
-   -13,   -7,   -3,   -1,   41,  103,   -1,  118,  146,  -1, 145,  -1,  25, 144,   -7,
-    -3,   -1,   72,  132,   -1,   87,  117,   -3,   -1,  56, 131,  -1, 102,  71,   -7,
-    -3,   -1,   40,  130,   -1,   24,  129,   -7,   -3,  -1, 116,   8,  -1, 128,   86,
-    -3,   -1,  101,   55,   -1,  115,   70,  -17,   -7,  -3,  -1,  39, 114,  -1,  100,
-    23,   -3,   -1,   85,  113,   -3,   -1,    7,  112,  54,  -7,  -3,  -1,  99,   69,
-    -1,   84,   38,   -3,   -1,   98,   22,   -3,   -1,   6,  96,  53, -33, -19,   -9,
-    -5,   -1,   97,   -1,   83,   68,   -1,   37,   82,  -3,  -1,  21,  81,  -3,   -1,
-     5,   80,   52,   -7,   -3,   -1,   67,   36,   -1,  66,  51,  -1,  65,  -1,   20,
-     4,   -9,   -3,   -1,   35,   50,   -3,   -1,   64,   3,  19,  -3,  -1,  49,   48,
-    34,   -9,   -7,   -3,   -1,   18,   33,   -1,    2,  32,  17,  -3,  -1,   1,   16,
+  -495, -445, -355, -263, -183, -115,  -77,  -43,  -27, -13,  -7,  -3,
+  -1, 255,  239,
+    -1,  254,  223,   -1,  238,   -1,  253,  207,   -7,  -3,  -1, 252,
+  222,  -1,  237,
+   191,   -1,  251,   -1,  206,  236,   -7,   -3,   -1, 221, 175,  -1,
+  250, 190,   -3,
+    -1,  235,  205,   -1,  220,  159,  -15,   -7,   -3,  -1, 249, 234,
+  -1, 189,  219,
+    -3,   -1,  143,  248,   -1,  204,  158,   -7,   -3,  -1, 233, 127,
+  -1, 247,  173,
+    -3,   -1,  218,  188,   -1,  111,   -1,  174,   15, -19, -11,  -3,
+  -1, 203,  246,
+    -3,   -1,  142,  232,   -1,   95,  157,   -3,   -1, 245, 126,  -1,
+  231, 172,   -9,
+    -3,   -1,  202,  187,   -3,   -1,  217,  141,   79,  -3,  -1, 244,
+  63,  -1,  243,
+   216,  -33,  -17,   -9,   -3,   -1,  230,   47,   -1, 242,  -1, 110,
+  240,  -3,   -1,
+    31,  241,   -1,  156,  201,   -7,   -3,   -1,   94, 171,  -1, 186,
+  229,  -3,   -1,
+   125,  215,   -1,   78,  228,  -15,   -7,   -3,   -1, 140, 200,  -1,
+  62, 109,   -3,
+    -1,  214,  227,   -1,  155,  185,   -7,   -3,   -1,  46, 170,  -1,
+  226,  30,   -5,
+    -1,  225,   -1,   14,  224,   -1,   93,  213,  -45, -25, -13,  -7,
+  -3,  -1,  124,
+   199,   -1,   77,  139,   -1,  212,   -1,  184,  154,  -7,  -3,  -1,
+  169, 108,   -1,
+   198,   61,   -1,  211,  210,   -9,   -5,   -3,   -1,  45,  13,  29,
+  -1, 123,  183,
+    -5,   -1,  209,   -1,   92,  208,   -1,  197,  138, -17,  -7,  -3,
+  -1, 168,   76,
+    -1,  196,  107,   -5,   -1,  182,   -1,  153,   12,  -1,  60, 195,
+  -9,  -3,   -1,
+   122,  167,   -1,  166,   -1,  192,   11,   -1,  194,  -1,  44,  91,
+  -55, -29,  -15,
+    -7,   -3,   -1,  181,   28,   -1,  137,  152,   -3,  -1, 193,  75,
+  -1, 180,  106,
+    -5,   -3,   -1,   59,  121,  179,   -3,   -1,  151, 136,  -1,  43,
+  90, -11,   -5,
+    -1,  178,   -1,  165,   27,   -1,  177,   -1,  176, 105,  -7,  -3,
+  -1, 150,   74,
+    -1,  164,  120,   -3,   -1,  135,   58,  163,  -17,  -7,  -3,  -1,
+  89, 149,   -1,
+    42,  162,   -3,   -1,   26,  161,   -3,   -1,   10, 160, 104,  -7,
+  -3,  -1,  134,
+    73,   -1,  148,   57,   -5,   -1,  147,   -1,  119,   9,  -1,  88,
+  133, -53,  -29,
+   -13,   -7,   -3,   -1,   41,  103,   -1,  118,  146,  -1, 145,  -1,
+  25, 144,   -7,
+    -3,   -1,   72,  132,   -1,   87,  117,   -3,   -1,  56, 131,  -1,
+  102,  71,   -7,
+    -3,   -1,   40,  130,   -1,   24,  129,   -7,   -3,  -1, 116,   8,
+  -1, 128,   86,
+    -3,   -1,  101,   55,   -1,  115,   70,  -17,   -7,  -3,  -1,  39,
+  114,  -1,  100,
+    23,   -3,   -1,   85,  113,   -3,   -1,    7,  112,  54,  -7,  -3,
+  -1,  99,   69,
+    -1,   84,   38,   -3,   -1,   98,   22,   -3,   -1,   6,  96,  53,
+  -33, -19,   -9,
+    -5,   -1,   97,   -1,   83,   68,   -1,   37,   82,  -3,  -1,  21,
+  81,  -3,   -1,
+     5,   80,   52,   -7,   -3,   -1,   67,   36,   -1,  66,  51,  -1,
+  65,  -1,   20,
+     4,   -9,   -3,   -1,   35,   50,   -3,   -1,   64,   3,  19,  -3,
+  -1,  49,   48,
+    34,   -9,   -7,   -3,   -1,   18,   33,   -1,    2,  32,  17,  -3,
+  -1,   1,   16,
      0
 };
 
 static int16_t tab16[] = {
-  -509, -503, -461, -323, -103,  -37,  -27,  -15,   -7,  -3,  -1, 239, 254,  -1,  223,
-   253,   -3,   -1,  207,  252,   -1,  191,  251,   -5,  -1, 175,  -1, 250, 159,   -3,
-    -1,  249,  248,  143,   -7,   -3,   -1,  127,  247,  -1, 111, 246, 255,  -9,   -5,
-    -3,   -1,   95,  245,   79,   -1,  244,  243,  -53,  -1, 240,  -1,  63, -29,  -19,
-   -13,   -7,   -5,   -1,  206,   -1,  236,  221,  222,  -1, 233,  -1, 234, 217,   -1,
-   238,   -1,  237,  235,   -3,   -1,  190,  205,   -3,  -1, 220, 219, 174, -11,   -5,
-    -1,  204,   -1,  173,  218,   -3,   -1,  126,  172, 202,  -5,  -3,  -1, 201,  125,
-    94,  189,  242,  -93,   -5,   -3,   -1,   47,   15,  31,  -1, 241, -49, -25,  -13,
-    -5,   -1,  158,   -1,  188,  203,   -3,   -1,  142, 232,  -1, 157, 231,  -7,   -3,
-    -1,  187,  141,   -1,  216,  110,   -1,  230,  156, -13,  -7,  -3,  -1, 171,  186,
-    -1,  229,  215,   -1,   78,   -1,  228,  140,   -3,  -1, 200,  62,  -1, 109,   -1,
-   214,  155,  -19,  -11,   -5,   -3,   -1,  185,  170, 225,  -1, 212,  -1, 184,  169,
-    -5,   -1,  123,   -1,  183,  208,  227,   -7,   -3,  -1,  14, 224,  -1,  93,  213,
-    -3,   -1,  124,  199,   -1,   77,  139,  -75,  -45, -27, -13,  -7,  -3,  -1,  154,
-   108,   -1,  198,   61,   -3,   -1,   92,  197,   13,  -7,  -3,  -1, 138, 168,   -1,
-   153,   76,   -3,   -1,  182,  122,   60,  -11,   -5,  -3,  -1,  91, 137,  28,   -1,
-   192,   -1,  152,  121,   -1,  226,   -1,   46,   30, -15,  -7,  -3,  -1, 211,   45,
-    -1,  210,  209,   -5,   -1,   59,   -1,  151,  136,  29,  -7,  -3,  -1, 196,  107,
-    -1,  195,  167,   -1,   44,   -1,  194,  181,  -23, -13,  -7,  -3,  -1, 193,   12,
-    -1,   75,  180,   -3,   -1,  106,  166,  179,   -5,  -3,  -1,  90, 165,  43,   -1,
-   178,   27,  -13,   -5,   -1,  177,   -1,   11,  176,  -3,  -1, 105, 150,  -1,   74,
-   164,   -5,   -3,   -1,  120,  135,  163,   -3,   -1,  58,  89,  42, -97, -57,  -33,
-   -19,  -11,   -5,   -3,   -1,  149,  104,  161,   -3,  -1, 134, 119, 148,  -5,   -3,
-    -1,   73,   87,  103,  162,   -5,   -1,   26,   -1,  10, 160,  -3,  -1,  57,  147,
-    -1,   88,  133,   -9,   -3,   -1,   41,  146,   -3,  -1, 118,   9,  25,  -5,   -1,
-   145,   -1,  144,   72,   -3,   -1,  132,  117,   -1,  56, 131, -21, -11,  -5,   -3,
-    -1,  102,   40,  130,   -3,   -1,   71,  116,   24,  -3,  -1, 129, 128,  -3,   -1,
-     8,   86,   55,   -9,   -5,   -1,  115,   -1,  101,  70,  -1,  39, 114,  -5,   -3,
-    -1,  100,   85,    7,   23,  -23,  -13,   -5,   -1, 113,  -1, 112,  54,  -3,   -1,
-    99,   69,   -1,   84,   38,   -3,   -1,   98,   22,  -1,  97,  -1,   6,  96,   -9,
-    -5,   -1,   83,   -1,   53,   68,   -1,   37,   82,  -1,  81,  -1,  21,   5,  -33,
-   -23,  -13,   -7,   -3,   -1,   52,   67,   -1,   80,  36,  -3,  -1,  66,  51,   20,
-    -5,   -1,   65,   -1,    4,   64,   -1,   35,   50,  -3,  -1,  19,  49,  -3,   -1,
-     3,   48,   34,   -3,   -1,   18,   33,   -1,    2,  32,  -3,  -1,  17,   1,   16,
+  -509, -503, -461, -323, -103,  -37,  -27,  -15,   -7,  -3,  -1, 239,
+  254,  -1,  223,
+   253,   -3,   -1,  207,  252,   -1,  191,  251,   -5,  -1, 175,  -1,
+  250, 159,   -3,
+    -1,  249,  248,  143,   -7,   -3,   -1,  127,  247,  -1, 111, 246,
+  255,  -9,   -5,
+    -3,   -1,   95,  245,   79,   -1,  244,  243,  -53,  -1, 240,  -1,
+  63, -29,  -19,
+   -13,   -7,   -5,   -1,  206,   -1,  236,  221,  222,  -1, 233,  -1,
+  234, 217,   -1,
+   238,   -1,  237,  235,   -3,   -1,  190,  205,   -3,  -1, 220, 219,
+  174, -11,   -5,
+    -1,  204,   -1,  173,  218,   -3,   -1,  126,  172, 202,  -5,  -3,
+  -1, 201,  125,
+    94,  189,  242,  -93,   -5,   -3,   -1,   47,   15,  31,  -1, 241,
+  -49, -25,  -13,
+    -5,   -1,  158,   -1,  188,  203,   -3,   -1,  142, 232,  -1, 157,
+  231,  -7,   -3,
+    -1,  187,  141,   -1,  216,  110,   -1,  230,  156, -13,  -7,  -3,
+  -1, 171,  186,
+    -1,  229,  215,   -1,   78,   -1,  228,  140,   -3,  -1, 200,  62,
+  -1, 109,   -1,
+   214,  155,  -19,  -11,   -5,   -3,   -1,  185,  170, 225,  -1, 212,
+  -1, 184,  169,
+    -5,   -1,  123,   -1,  183,  208,  227,   -7,   -3,  -1,  14, 224,
+  -1,  93,  213,
+    -3,   -1,  124,  199,   -1,   77,  139,  -75,  -45, -27, -13,  -7,
+  -3,  -1,  154,
+   108,   -1,  198,   61,   -3,   -1,   92,  197,   13,  -7,  -3,  -1,
+  138, 168,   -1,
+   153,   76,   -3,   -1,  182,  122,   60,  -11,   -5,  -3,  -1,  91,
+  137,  28,   -1,
+   192,   -1,  152,  121,   -1,  226,   -1,   46,   30, -15,  -7,  -3,
+  -1, 211,   45,
+    -1,  210,  209,   -5,   -1,   59,   -1,  151,  136,  29,  -7,  -3,
+  -1, 196,  107,
+    -1,  195,  167,   -1,   44,   -1,  194,  181,  -23, -13,  -7,  -3,
+  -1, 193,   12,
+    -1,   75,  180,   -3,   -1,  106,  166,  179,   -5,  -3,  -1,  90,
+  165,  43,   -1,
+   178,   27,  -13,   -5,   -1,  177,   -1,   11,  176,  -3,  -1, 105,
+  150,  -1,   74,
+   164,   -5,   -3,   -1,  120,  135,  163,   -3,   -1,  58,  89,  42,
+  -97, -57,  -33,
+   -19,  -11,   -5,   -3,   -1,  149,  104,  161,   -3,  -1, 134, 119,
+  148,  -5,   -3,
+    -1,   73,   87,  103,  162,   -5,   -1,   26,   -1,  10, 160,  -3,
+  -1,  57,  147,
+    -1,   88,  133,   -9,   -3,   -1,   41,  146,   -3,  -1, 118,   9,
+  25,  -5,   -1,
+   145,   -1,  144,   72,   -3,   -1,  132,  117,   -1,  56, 131, -21,
+  -11,  -5,   -3,
+    -1,  102,   40,  130,   -3,   -1,   71,  116,   24,  -3,  -1, 129,
+  128,  -3,   -1,
+     8,   86,   55,   -9,   -5,   -1,  115,   -1,  101,  70,  -1,  39,
+  114,  -5,   -3,
+    -1,  100,   85,    7,   23,  -23,  -13,   -5,   -1, 113,  -1, 112,
+  54,  -3,   -1,
+    99,   69,   -1,   84,   38,   -3,   -1,   98,   22,  -1,  97,  -1,
+  6,  96,   -9,
+    -5,   -1,   83,   -1,   53,   68,   -1,   37,   82,  -1,  81,  -1,
+  21,   5,  -33,
+   -23,  -13,   -7,   -3,   -1,   52,   67,   -1,   80,  36,  -3,  -1,
+  66,  51,   20,
+    -5,   -1,   65,   -1,    4,   64,   -1,   35,   50,  -3,  -1,  19,
+  49,  -3,   -1,
+     3,   48,   34,   -3,   -1,   18,   33,   -1,    2,  32,  -3,  -1,
+  17,   1,   16,
      0
 };
 
 static int16_t tab24[] = {
-  -451, -117,  -43,  -25,  -15,   -7,   -3,   -1,  239, 254,  -1, 223, 253,  -3,   -1,
-   207,  252,   -1,  191,  251,   -5,   -1,  250,   -1, 175, 159,  -1, 249, 248,   -9,
-    -5,   -3,   -1,  143,  127,  247,   -1,  111,  246,  -3,  -1,  95, 245,  -1,   79,
-   244,  -71,   -7,   -3,   -1,   63,  243,   -1,   47, 242,  -5,  -1, 241,  -1,   31,
-   240,  -25,   -9,   -1,   15,   -3,   -1,  238,  222,  -1, 237, 206,  -7,  -3,   -1,
-   236,  221,   -1,  190,  235,   -3,   -1,  205,  220,  -1, 174, 234, -15,  -7,   -3,
-    -1,  189,  219,   -1,  204,  158,   -3,   -1,  233, 173,  -1, 218, 188,  -7,   -3,
-    -1,  203,  142,   -1,  232,  157,   -3,   -1,  217, 126,  -1, 231, 172, 255, -235,
-  -143,  -77,  -45,  -25,  -15,   -7,   -3,   -1,  202, 187,  -1, 141, 216,  -5,   -3,
-    -1,   14,  224,   13,  230,   -5,   -3,   -1,  110, 156, 201,  -1,  94, 186,   -9,
-    -5,   -1,  229,   -1,  171,  125,   -1,  215,  228,  -3,  -1, 140, 200,  -3,   -1,
-    78,   46,   62,  -15,   -7,   -3,   -1,  109,  214,  -1, 227, 155,  -3,  -1,  185,
-   170,   -1,  226,   30,   -7,   -3,   -1,  225,   93,  -1, 213, 124,  -3,  -1,  199,
-    77,   -1,  139,  184,  -31,  -15,   -7,   -3,   -1, 212, 154,  -1, 169, 108,   -3,
-    -1,  198,   61,   -1,  211,   45,   -7,   -3,   -1, 210,  29,  -1, 123, 183,   -3,
-    -1,  209,   92,   -1,  197,  138,  -17,   -7,   -3,  -1, 168, 153,  -1,  76,  196,
-    -3,   -1,  107,  182,   -3,   -1,  208,   12,   60,  -7,  -3,  -1, 195, 122,   -1,
-   167,   44,   -3,   -1,  194,   91,   -1,  181,   28, -57, -35, -19,  -7,  -3,   -1,
-   137,  152,   -1,  193,   75,   -5,   -3,   -1,  192,  11,  59,  -3,  -1, 176,   10,
-    26,   -5,   -1,  180,   -1,  106,  166,   -3,   -1, 121, 151,  -3,  -1, 160,    9,
-   144,   -9,   -3,   -1,  179,  136,   -3,   -1,   43,  90, 178,  -7,  -3,  -1,  165,
-    27,   -1,  177,  105,   -1,  150,  164,  -17,   -9,  -5,  -3,  -1,  74, 120,  135,
-    -1,   58,  163,   -3,   -1,   89,  149,   -1,   42, 162,  -7,  -3,  -1, 161,  104,
-    -1,  134,  119,   -3,   -1,   73,  148,   -1,   57, 147, -63, -31, -15,  -7,   -3,
-    -1,   88,  133,   -1,   41,  103,   -3,   -1,  118, 146,  -1,  25, 145,  -7,   -3,
-    -1,   72,  132,   -1,   87,  117,   -3,   -1,   56, 131,  -1, 102,  40, -17,   -7,
-    -3,   -1,  130,   24,   -1,   71,  116,   -5,   -1, 129,  -1,   8, 128,  -1,   86,
-   101,   -7,   -5,   -1,   23,   -1,    7,  112,  115,  -3,  -1,  55,  39, 114,  -15,
-    -7,   -3,   -1,   70,  100,   -1,   85,  113,   -3,  -1,  54,  99,  -1,  69,   84,
-    -7,   -3,   -1,   38,   98,   -1,   22,   97,   -5,  -3,  -1,   6,  96,  53,   -1,
-    83,   68,  -51,  -37,  -23,  -15,   -9,   -3,   -1,  37,  82,  -1,  21,  -1,    5,
-    80,   -1,   81,   -1,   52,   67,   -3,   -1,   36,  66,  -1,  51,  20,  -9,   -5,
-    -1,   65,   -1,    4,   64,   -1,   35,   50,   -1,  19,  49,  -7,  -5,  -3,   -1,
-     3,   48,   34,   18,   -1,   33,   -1,    2,   32,  -3,  -1,  17,   1,  -1,   16,
+  -451, -117,  -43,  -25,  -15,   -7,   -3,   -1,  239, 254,  -1, 223,
+  253,  -3,   -1,
+   207,  252,   -1,  191,  251,   -5,   -1,  250,   -1, 175, 159,  -1,
+  249, 248,   -9,
+    -5,   -3,   -1,  143,  127,  247,   -1,  111,  246,  -3,  -1,  95,
+  245,  -1,   79,
+   244,  -71,   -7,   -3,   -1,   63,  243,   -1,   47, 242,  -5,  -1,
+  241,  -1,   31,
+   240,  -25,   -9,   -1,   15,   -3,   -1,  238,  222,  -1, 237, 206,
+  -7,  -3,   -1,
+   236,  221,   -1,  190,  235,   -3,   -1,  205,  220,  -1, 174, 234,
+  -15,  -7,   -3,
+    -1,  189,  219,   -1,  204,  158,   -3,   -1,  233, 173,  -1, 218,
+  188,  -7,   -3,
+    -1,  203,  142,   -1,  232,  157,   -3,   -1,  217, 126,  -1, 231,
+  172, 255, -235,
+  -143,  -77,  -45,  -25,  -15,   -7,   -3,   -1,  202, 187,  -1, 141,
+  216,  -5,   -3,
+    -1,   14,  224,   13,  230,   -5,   -3,   -1,  110, 156, 201,  -1,
+  94, 186,   -9,
+    -5,   -1,  229,   -1,  171,  125,   -1,  215,  228,  -3,  -1, 140,
+  200,  -3,   -1,
+    78,   46,   62,  -15,   -7,   -3,   -1,  109,  214,  -1, 227, 155,
+  -3,  -1,  185,
+   170,   -1,  226,   30,   -7,   -3,   -1,  225,   93,  -1, 213, 124,
+  -3,  -1,  199,
+    77,   -1,  139,  184,  -31,  -15,   -7,   -3,   -1, 212, 154,  -1,
+  169, 108,   -3,
+    -1,  198,   61,   -1,  211,   45,   -7,   -3,   -1, 210,  29,  -1,
+  123, 183,   -3,
+    -1,  209,   92,   -1,  197,  138,  -17,   -7,   -3,  -1, 168, 153,
+  -1,  76,  196,
+    -3,   -1,  107,  182,   -3,   -1,  208,   12,   60,  -7,  -3,  -1,
+  195, 122,   -1,
+   167,   44,   -3,   -1,  194,   91,   -1,  181,   28, -57, -35, -19,
+  -7,  -3,   -1,
+   137,  152,   -1,  193,   75,   -5,   -3,   -1,  192,  11,  59,  -3,
+  -1, 176,   10,
+    26,   -5,   -1,  180,   -1,  106,  166,   -3,   -1, 121, 151,  -3,
+  -1, 160,    9,
+   144,   -9,   -3,   -1,  179,  136,   -3,   -1,   43,  90, 178,  -7,
+  -3,  -1,  165,
+    27,   -1,  177,  105,   -1,  150,  164,  -17,   -9,  -5,  -3,  -1,
+  74, 120,  135,
+    -1,   58,  163,   -3,   -1,   89,  149,   -1,   42, 162,  -7,  -3,
+  -1, 161,  104,
+    -1,  134,  119,   -3,   -1,   73,  148,   -1,   57, 147, -63, -31,
+  -15,  -7,   -3,
+    -1,   88,  133,   -1,   41,  103,   -3,   -1,  118, 146,  -1,  25,
+  145,  -7,   -3,
+    -1,   72,  132,   -1,   87,  117,   -3,   -1,   56, 131,  -1, 102,
+  40, -17,   -7,
+    -3,   -1,  130,   24,   -1,   71,  116,   -5,   -1, 129,  -1,   8,
+  128,  -1,   86,
+   101,   -7,   -5,   -1,   23,   -1,    7,  112,  115,  -3,  -1,  55,
+  39, 114,  -15,
+    -7,   -3,   -1,   70,  100,   -1,   85,  113,   -3,  -1,  54,  99,
+  -1,  69,   84,
+    -7,   -3,   -1,   38,   98,   -1,   22,   97,   -5,  -3,  -1,   6,
+  96,  53,   -1,
+    83,   68,  -51,  -37,  -23,  -15,   -9,   -3,   -1,  37,  82,  -1,
+  21,  -1,    5,
+    80,   -1,   81,   -1,   52,   67,   -3,   -1,   36,  66,  -1,  51,
+  20,  -9,   -5,
+    -1,   65,   -1,    4,   64,   -1,   35,   50,   -1,  19,  49,  -7,
+  -5,  -3,   -1,
+     3,   48,   34,   18,   -1,   33,   -1,    2,   32,  -3,  -1,  17,
+  1,  -1,   16,
      0
 };
 
 static int16_t tab_c0[] = {
-   -29,  -21,  -13,   -7,   -3,   -1,   11,   15,   -1,  13,  14,  -3,  -1,   7,    5,
-     9,   -3,   -1,    6,    3,   -1,   10,   12,   -3,  -1,   2,   1,  -1,   4,    8,
+   -29,  -21,  -13,   -7,   -3,   -1,   11,   15,   -1,  13,  14,  -3,
+   -1,   7,    5,
+     9,   -3,   -1,    6,    3,   -1,   10,   12,   -3,  -1,   2,   1,
+   -1,   4,    8,
      0
 };
 
 static int16_t tab_c1[] = {
-   -15,   -7,   -3,   -1,   15,   14,   -1,   13,   12,  -3,  -1,  11,  10,  -1,    9,
-     8,   -7,   -3,   -1,    7,    6,   -1,    5,    4,  -3,  -1,   3,   2,  -1,    1,
+   -15,   -7,   -3,   -1,   15,   14,   -1,   13,   12,  -3,  -1,  11,
+   10,  -1,    9,
+     8,   -7,   -3,   -1,    7,    6,   -1,    5,    4,  -3,  -1,   3,
+   2,  -1,    1,
      0
 };
 
@@ -582,242 +797,261 @@ static int32_t intwinbase[] = {
 
 static void make_synth_window(mpadec_t mpadec, MYFLT scale)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-  register int i, j, k;
-
-  scale = -scale;
-  for (i = 0, j = 0, k = 0; i < 256; i++, j++, k += 32) {
-    if (k < (512 + 16)) mpa->tables.decwin[k] = mpa->tables.decwin[k + 16] = ((MYFLT)intwinbase[j]/65536.0)*scale;
-    if ((i & 31) == 31) k -= 1023;
-    if ((i & 63) == 63) scale = -scale;
-  }
-  for (; i < 512; i++, j--, k += 32) {
-    if (k < (512 + 16)) mpa->tables.decwin[k] = mpa->tables.decwin[k + 16] = ((MYFLT)intwinbase[j]/65536.0)*scale;
-    if ((i & 31) == 31) k -= 1023;
-    if ((i & 63) == 63) scale = -scale;
-  }
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    register int i, j, k;
+
+    scale = -scale;
+    for (i = 0, j = 0, k = 0; i < 256; i++, j++, k += 32) {
+      if (k < (512 + 16))
+        mpa->tables.decwin[k] =
+          mpa->tables.decwin[k + 16] = ((MYFLT)intwinbase[j]/65536.0)*scale;
+      if ((i & 31) == 31) k -= 1023;
+      if ((i & 63) == 63) scale = -scale;
+    }
+    for (; i < 512; i++, j--, k += 32) {
+      if (k < (512 + 16))
+        mpa->tables.decwin[k] =
+          mpa->tables.decwin[k + 16] = ((MYFLT)intwinbase[j]/65536.0)*scale;
+      if ((i & 31) == 31) k -= 1023;
+      if ((i & 63) == 63) scale = -scale;
+    }
 }
 
 static void init_limits(mpadec_t mpadec, int32_t sblimit)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-  register int i, j;
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    register int i, j;
 
-  for (i = 0; i < 9; i++) {
-    for (j = 0; j < 23; j++) {
-      mpa->tables.long_limit[i][j] = (band_info[i].long_idx[j] + 7)/SSLIMIT + 1;
-      if (mpa->tables.long_limit[i][j] > sblimit) mpa->tables.long_limit[i][j] = sblimit;
-    }
-    for (j = 0; j < 14; j++) {
-      mpa->tables.short_limit[i][j] = (band_info[i].short_idx[j] - 1)/SSLIMIT + 1;
-      if (mpa->tables.short_limit[i][j] > sblimit) mpa->tables.short_limit[i][j] = sblimit;
+    for (i = 0; i < 9; i++) {
+      for (j = 0; j < 23; j++) {
+        mpa->tables.long_limit[i][j] = (band_info[i].long_idx[j] + 7)/SSLIMIT + 1;
+        if (mpa->tables.long_limit[i][j] > sblimit)
+          mpa->tables.long_limit[i][j] = sblimit;
+      }
+      for (j = 0; j < 14; j++) {
+        mpa->tables.short_limit[i][j] =
+          (band_info[i].short_idx[j] - 1)/SSLIMIT + 1;
+        if (mpa->tables.short_limit[i][j] > sblimit)
+          mpa->tables.short_limit[i][j] = sblimit;
+      }
     }
-  }
 }
 
 static void init_layer2(mpadec_t mpadec)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-  int i, j, k; uint8_t *tab;
-  static MYFLT mulmul[27] = { 0.0, -2.0/3.0, 2.0/3.0, 2.0/7.0, 2.0/15.0, 2.0/31.0, 2.0/63.0,
-                              2.0/127.0, 2.0/255.0, 2.0/511.0, 2.0/1023.0, 2.0/2047.0,
-                              2.0/4095.0, 2.0/8191.0, 2.0/16383.0, 2.0/32767.0, 2.0/65535.0,
-                             -4.0/5.0, -2.0/5.0, 2.0/5.0, 4.0/5.0, -8.0/9.0,
-                             -4.0/9.0, -2.0/9.0, 2.0/9.0, 4.0/9.0,  8.0/9.0 };
-  static uint8_t base[3][9] = { { 1, 0, 2, }, { 17, 18, 0, 19, 20, },
-                                { 21, 1, 22, 23, 0, 24, 25, 2, 26 } };
-
-  tab = mpa->tables.grp3tab;
-  for (i = 0; i < 3; i++)
-    for (j = 0; j < 3; j++)
-      for (k = 0; k < 3; k++, tab += 3) {
-        tab[0] = base[0][k];
-        tab[1] = base[0][j];
-        tab[2] = base[0][i];
-      }
-  tab = mpa->tables.grp5tab;
-  for (i = 0; i < 5; i++)
-    for (j = 0; j < 5; j++)
-      for (k = 0; k < 5; k++, tab += 3) {
-        tab[0] = base[1][k];
-        tab[1] = base[1][j];
-        tab[2] = base[1][i];
-      }
-  tab = mpa->tables.grp9tab;
-  for (i = 0; i < 9; i++)
-    for (j = 0; j < 9; j++)
-      for (k = 0; k < 9; k++, tab += 3) {
-        tab[0] = base[2][k];
-        tab[1] = base[2][j];
-        tab[2] = base[2][i];
-      }
-  mpa->tables.mp2tables[0] = mpa->tables.mp2tables[1] = mpa->tables.mp2tables[2] = NULL;
-  mpa->tables.mp2tables[3] = mpa->tables.grp3tab;
-  mpa->tables.mp2tables[4] = NULL;
-  mpa->tables.mp2tables[5] = mpa->tables.grp5tab;
-  mpa->tables.mp2tables[6] = mpa->tables.mp2tables[7] = mpa->tables.mp2tables[8] = NULL;
-  mpa->tables.mp2tables[9] = mpa->tables.grp9tab;
-  for (i = 0; i < 27; i++) {
-    for (j = 0, k = 3; j < 63; j++, k--) mpa->tables.muls[i][j] = mulmul[i]*pow(2.0, (MYFLT)k/3.0);
-    mpa->tables.muls[i][63] = 0.0;
-  }
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    int i, j, k; uint8_t *tab;
+    static MYFLT mulmul[27] = { 0.0, -2.0/3.0, 2.0/3.0, 2.0/7.0, 2.0/15.0,
+                                2.0/31.0, 2.0/63.0, 2.0/127.0, 2.0/255.0,
+                                2.0/511.0, 2.0/1023.0, 2.0/2047.0, 2.0/4095.0,
+                                2.0/8191.0, 2.0/16383.0, 2.0/32767.0, 2.0/65535.0,
+                                -4.0/5.0, -2.0/5.0, 2.0/5.0, 4.0/5.0, -8.0/9.0,
+                                -4.0/9.0, -2.0/9.0, 2.0/9.0, 4.0/9.0,  8.0/9.0 };
+    static uint8_t base[3][9] = { { 1, 0, 2, }, { 17, 18, 0, 19, 20, },
+                                  { 21, 1, 22, 23, 0, 24, 25, 2, 26 } };
+
+    tab = mpa->tables.grp3tab;
+    for (i = 0; i < 3; i++)
+      for (j = 0; j < 3; j++)
+        for (k = 0; k < 3; k++, tab += 3) {
+          tab[0] = base[0][k];
+          tab[1] = base[0][j];
+          tab[2] = base[0][i];
+        }
+    tab = mpa->tables.grp5tab;
+    for (i = 0; i < 5; i++)
+      for (j = 0; j < 5; j++)
+        for (k = 0; k < 5; k++, tab += 3) {
+          tab[0] = base[1][k];
+          tab[1] = base[1][j];
+          tab[2] = base[1][i];
+        }
+    tab = mpa->tables.grp9tab;
+    for (i = 0; i < 9; i++)
+      for (j = 0; j < 9; j++)
+        for (k = 0; k < 9; k++, tab += 3) {
+          tab[0] = base[2][k];
+          tab[1] = base[2][j];
+          tab[2] = base[2][i];
+        }
+    mpa->tables.mp2tables[0] = mpa->tables.mp2tables[1] =
+      mpa->tables.mp2tables[2] = NULL;
+    mpa->tables.mp2tables[3] = mpa->tables.grp3tab;
+    mpa->tables.mp2tables[4] = NULL;
+    mpa->tables.mp2tables[5] = mpa->tables.grp5tab;
+    mpa->tables.mp2tables[6] = mpa->tables.mp2tables[7] =
+      mpa->tables.mp2tables[8] = NULL;
+    mpa->tables.mp2tables[9] = mpa->tables.grp9tab;
+    for (i = 0; i < 27; i++) {
+      for (j = 0, k = 3; j < 63; j++, k--)
+        mpa->tables.muls[i][j] = mulmul[i]*pow(2.0, (MYFLT)k/3.0);
+      mpa->tables.muls[i][63] = 0.0;
+    }
 }
 
 static void init_layer3(mpadec_t mpadec)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-  int i, j, k, l;
-
-  for (i = -256; i < 122; i++) mpa->tables.gainpow2[i + 256] = pow(2.0, -0.25*(i + 210));
-  for (i = 0; i < 8207; i++) mpa->tables.ispow[i] = pow(i, 4.0/3.0);
-  for (i = 0; i < 18; i++) {
-    mpa->tables.win[0][0][i] = mpa->tables.win[0][1][i] = 0.5*sin((2*i + 1)*M_PI/72.0)/cos((2*i + 19)*M_PI/72.0);
-    mpa->tables.win[0][0][i + 18] = mpa->tables.win[0][3][i + 18] = 0.5*sin((2*(i + 18) + 1)*M_PI/72.0)/cos((2*(i + 18) + 19)*M_PI/72.0);
-  }
-  for (i = 0; i < 6; i++) {
-    mpa->tables.win[0][1][i + 18] = 0.5/cos((2*(i + 18) + 19)*M_PI/72.0);
-    mpa->tables.win[0][3][i + 12] = 0.5/cos((2*(i + 12) + 19)*M_PI/72.0);
-    mpa->tables.win[0][1][i + 24] = 0.5*sin((2*i + 13)*M_PI/24.0)/cos((2*(i + 24) + 19)*M_PI/72.0);
-    mpa->tables.win[0][1][i + 30] = mpa->tables.win[0][3][i] = 0.0;
-    mpa->tables.win[0][3][i + 6] = 0.5*sin((2*i + 1)*M_PI/24.0)/cos((2*(i + 6) + 19)*M_PI/72.0);
-  }
-  for (i = 0; i < 12; i++) {
-    mpa->tables.win[0][2][i] = 0.5*sin((2*i + 1)*M_PI/24.0)/cos((2*i + 7)*M_PI/24.0);
-  }
-  for (i = 0; i < 4; i++) {
-    int len = (i == 2) ? 12 : 36;
-    for (j = 0; j < len; j += 2) {
-      mpa->tables.win[1][i][j] = mpa->tables.win[0][i][j];
-      mpa->tables.win[1][i][j + 1] = -mpa->tables.win[0][i][j + 1];
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+    int i, j, k, l;
+
+    for (i = -256; i < 122; i++)
+      mpa->tables.gainpow2[i + 256] = pow(2.0, -0.25*(i + 210));
+    for (i = 0; i < 8207; i++) mpa->tables.ispow[i] = pow(i, 4.0/3.0);
+    for (i = 0; i < 18; i++) {
+      mpa->tables.win[0][0][i] =
+        mpa->tables.win[0][1][i] =
+          0.5*sin((2*i + 1)*M_PI/72.0)/cos((2*i + 19)*M_PI/72.0);
+      mpa->tables.win[0][0][i + 18] =
+        mpa->tables.win[0][3][i + 18] =
+          0.5*sin((2*(i + 18) + 1)*M_PI/72.0)/cos((2*(i + 18) + 19)*M_PI/72.0);
     }
-  }
-  for (i = 0; i < 16; i++) {
-    MYFLT tmp = tan(i*M_PI/12.0);
-    mpa->tables.tan1_1[i] = tmp/(1.0 + tmp);
-    mpa->tables.tan2_1[i] = 1.0/(1.0 + tmp);
-    mpa->tables.tan1_2[i] = M_SQRT2*tmp/(1.0 + tmp);
-    mpa->tables.tan2_2[i] = M_SQRT2/(1.0 + tmp);
-    for (j = 0; j < 2; j++) {
-      MYFLT base = pow(2.0, -0.25*(j + 1));
-      MYFLT p1 = 1.0, p2 = 1.0;
-      if (i > 0) {
-        if (i & 1) p1 = pow(base, 0.5*(i + 1));
-        else p2 = pow(base, 0.5*i);
-      }
-      mpa->tables.pow1_1[j][i] = p1;
-      mpa->tables.pow2_1[j][i] = p2;
-      mpa->tables.pow1_2[j][i] = M_SQRT2*p1;
-      mpa->tables.pow2_2[j][i] = M_SQRT2*p2;
+    for (i = 0; i < 6; i++) {
+      mpa->tables.win[0][1][i + 18] = 0.5/cos((2*(i + 18) + 19)*M_PI/72.0);
+      mpa->tables.win[0][3][i + 12] = 0.5/cos((2*(i + 12) + 19)*M_PI/72.0);
+      mpa->tables.win[0][1][i + 24] =
+        0.5*sin((2*i + 13)*M_PI/24.0)/cos((2*(i + 24) + 19)*M_PI/72.0);
+      mpa->tables.win[0][1][i + 30] = mpa->tables.win[0][3][i] = 0.0;
+      mpa->tables.win[0][3][i + 6] =
+        0.5*sin((2*i + 1)*M_PI/24.0)/cos((2*(i + 6) + 19)*M_PI/72.0);
     }
-  }
-  mpa->tables.istabs[0][0][0] = mpa->tables.tan1_1;
-  mpa->tables.istabs[0][0][1] = mpa->tables.tan2_1;
-  mpa->tables.istabs[0][1][0] = mpa->tables.tan1_2;
-  mpa->tables.istabs[0][1][1] = mpa->tables.tan2_2;
-  mpa->tables.istabs[1][0][0] = mpa->tables.pow1_1[0];
-  mpa->tables.istabs[1][0][1] = mpa->tables.pow2_1[0];
-  mpa->tables.istabs[1][1][0] = mpa->tables.pow1_2[0];
-  mpa->tables.istabs[1][1][1] = mpa->tables.pow2_2[0];
-  mpa->tables.istabs[2][0][0] = mpa->tables.pow1_1[1];
-  mpa->tables.istabs[2][0][1] = mpa->tables.pow2_1[1];
-  mpa->tables.istabs[2][1][0] = mpa->tables.pow1_2[1];
-  mpa->tables.istabs[2][1][1] = mpa->tables.pow2_2[1];
-  for (i = 0; i < 9; i++) {
-    bandinfo_t *bi = &band_info[i];
-    int32_t *mp, cb, lwin; int16_t *bdf;
-    mp = mpa->tables.map[i][0] = mpa->tables.mapbuf0[i];
-    bdf = bi->long_diff;
-    for (cb = 0, j = 0; cb < 8; cb++, j += *bdf++, mp += 4) {
-      mp[0] = (*bdf) >> 1;
-      mp[1] = j;
-      mp[2] = 3;
-      mp[3] = cb;
+    for (i = 0; i < 12; i++) {
+      mpa->tables.win[0][2][i] =
+        0.5*sin((2*i + 1)*M_PI/24.0)/cos((2*i + 7)*M_PI/24.0);
     }
-    bdf = bi->short_diff + 3;
-    for (cb = 3; cb < 13; cb++) {
-      int l = (*bdf++) >> 1;
-      for (lwin = 0; lwin < 3; lwin++, mp += 4) {
-        mp[0] = l;
-        mp[1] = j + lwin;
-        mp[2] = lwin;
-        mp[3] = cb;
+    for (i = 0; i < 4; i++) {
+      int len = (i == 2) ? 12 : 36;
+      for (j = 0; j < len; j += 2) {
+        mpa->tables.win[1][i][j] = mpa->tables.win[0][i][j];
+        mpa->tables.win[1][i][j + 1] = -mpa->tables.win[0][i][j + 1];
       }
-      j += 6*l;
     }
-    mpa->tables.mapend[i][0] = mp;
-    mp = mpa->tables.map[i][1] = mpa->tables.mapbuf1[i];
-    bdf = bi->short_diff;
-    for (cb = 0, j = 0; cb < 13; cb++) {
-      int l = (*bdf++) >> 1;
-      for (lwin = 0; lwin < 3; lwin++, mp += 4) {
-        mp[0] = l;
-        mp[1] = j + lwin;
-        mp[2] = lwin;
-        mp[3] = cb;
+    for (i = 0; i < 16; i++) {
+      MYFLT tmp = tan(i*M_PI/12.0);
+      mpa->tables.tan1_1[i] = tmp/(1.0 + tmp);
+      mpa->tables.tan2_1[i] = 1.0/(1.0 + tmp);
+      mpa->tables.tan1_2[i] = M_SQRT2*tmp/(1.0 + tmp);
+      mpa->tables.tan2_2[i] = M_SQRT2/(1.0 + tmp);
+      for (j = 0; j < 2; j++) {
+        MYFLT base = pow(2.0, -0.25*(j + 1));
+        MYFLT p1 = 1.0, p2 = 1.0;
+        if (i > 0) {
+          if (i & 1) p1 = pow(base, 0.5*(i + 1));
+          else p2 = pow(base, 0.5*i);
+        }
+        mpa->tables.pow1_1[j][i] = p1;
+        mpa->tables.pow2_1[j][i] = p2;
+        mpa->tables.pow1_2[j][i] = M_SQRT2*p1;
+        mpa->tables.pow2_2[j][i] = M_SQRT2*p2;
       }
-      j += 6*l;
     }
-    mpa->tables.mapend[i][1] = mp;
-    mp = mpa->tables.map[i][2] = mpa->tables.mapbuf2[i];
-    bdf = bi->long_diff;
-    for (cb = 0; cb < 22; cb++, mp += 2) {
-      mp[0] = (*bdf++) >> 1;
-      mp[1] = cb;
+    mpa->tables.istabs[0][0][0] = mpa->tables.tan1_1;
+    mpa->tables.istabs[0][0][1] = mpa->tables.tan2_1;
+    mpa->tables.istabs[0][1][0] = mpa->tables.tan1_2;
+    mpa->tables.istabs[0][1][1] = mpa->tables.tan2_2;
+    mpa->tables.istabs[1][0][0] = mpa->tables.pow1_1[0];
+    mpa->tables.istabs[1][0][1] = mpa->tables.pow2_1[0];
+    mpa->tables.istabs[1][1][0] = mpa->tables.pow1_2[0];
+    mpa->tables.istabs[1][1][1] = mpa->tables.pow2_2[0];
+    mpa->tables.istabs[2][0][0] = mpa->tables.pow1_1[1];
+    mpa->tables.istabs[2][0][1] = mpa->tables.pow2_1[1];
+    mpa->tables.istabs[2][1][0] = mpa->tables.pow1_2[1];
+    mpa->tables.istabs[2][1][1] = mpa->tables.pow2_2[1];
+    for (i = 0; i < 9; i++) {
+      bandinfo_t *bi = &band_info[i];
+      int32_t *mp, cb, lwin; int16_t *bdf;
+      mp = mpa->tables.map[i][0] = mpa->tables.mapbuf0[i];
+      bdf = bi->long_diff;
+      for (cb = 0, j = 0; cb < 8; cb++, j += *bdf++, mp += 4) {
+        mp[0] = (*bdf) >> 1;
+        mp[1] = j;
+        mp[2] = 3;
+        mp[3] = cb;
+      }
+      bdf = bi->short_diff + 3;
+      for (cb = 3; cb < 13; cb++) {
+        int l = (*bdf++) >> 1;
+        for (lwin = 0; lwin < 3; lwin++, mp += 4) {
+          mp[0] = l;
+          mp[1] = j + lwin;
+          mp[2] = lwin;
+          mp[3] = cb;
+        }
+        j += 6*l;
+      }
+      mpa->tables.mapend[i][0] = mp;
+      mp = mpa->tables.map[i][1] = mpa->tables.mapbuf1[i];
+      bdf = bi->short_diff;
+      for (cb = 0, j = 0; cb < 13; cb++) {
+        int l = (*bdf++) >> 1;
+        for (lwin = 0; lwin < 3; lwin++, mp += 4) {
+          mp[0] = l;
+          mp[1] = j + lwin;
+          mp[2] = lwin;
+          mp[3] = cb;
+        }
+        j += 6*l;
+      }
+      mpa->tables.mapend[i][1] = mp;
+      mp = mpa->tables.map[i][2] = mpa->tables.mapbuf2[i];
+      bdf = bi->long_diff;
+      for (cb = 0; cb < 22; cb++, mp += 2) {
+        mp[0] = (*bdf++) >> 1;
+        mp[1] = cb;
+      }
+      mpa->tables.mapend[i][2] = mp;
     }
-    mpa->tables.mapend[i][2] = mp;
-  }
-  for (i = 0; i < 5; i++) {
-    for (j = 0; j < 6; j++) {
-      for (k = 0; k < 6; k++) {
-        register int n = k + 6*j + 36*i;
-        mpa->tables.i_slen2[n] = i | (j << 3) | (k << 6) | (3 << 12);
+    for (i = 0; i < 5; i++) {
+      for (j = 0; j < 6; j++) {
+        for (k = 0; k < 6; k++) {
+          register int n = k + 6*j + 36*i;
+          mpa->tables.i_slen2[n] = i | (j << 3) | (k << 6) | (3 << 12);
+        }
       }
     }
-  }
-  for (i = 0; i < 4; i++) {
-    for (j = 0; j < 4; j++) {
-      for (k = 0; k < 4; k++) {
-        register int n = k + 4*j + 16*i;
-        mpa->tables.i_slen2[n + 180] = i | (j << 3) | (k << 6) | (4 << 12);
+    for (i = 0; i < 4; i++) {
+      for (j = 0; j < 4; j++) {
+        for (k = 0; k < 4; k++) {
+          register int n = k + 4*j + 16*i;
+          mpa->tables.i_slen2[n + 180] = i | (j << 3) | (k << 6) | (4 << 12);
+        }
       }
     }
-  }
-  for (i = 0; i < 4; i++) {
-    for (j = 0; j < 3; j++) {
-      register int n = j + 3*i;
-      mpa->tables.i_slen2[n + 244] = i | (j << 3) | (5 << 12);
-      mpa->tables.n_slen2[n + 500] = i | (j << 3) | (2 << 12) | (1 << 15);
+    for (i = 0; i < 4; i++) {
+      for (j = 0; j < 3; j++) {
+        register int n = j + 3*i;
+        mpa->tables.i_slen2[n + 244] = i | (j << 3) | (5 << 12);
+        mpa->tables.n_slen2[n + 500] = i | (j << 3) | (2 << 12) | (1 << 15);
+      }
     }
-  }
-  for (i = 0; i < 5; i++) {
-    for (j = 0; j < 5; j++) {
-      for (k = 0; k < 4; k++) {
-        for (l = 0; l < 4; l++) {
-          register int n = l + 4*k + 16*j + 80*i;
-          mpa->tables.n_slen2[n] = i | (j << 3) | (k << 6) | (l << 9);
+    for (i = 0; i < 5; i++) {
+      for (j = 0; j < 5; j++) {
+        for (k = 0; k < 4; k++) {
+          for (l = 0; l < 4; l++) {
+            register int n = l + 4*k + 16*j + 80*i;
+            mpa->tables.n_slen2[n] = i | (j << 3) | (k << 6) | (l << 9);
+          }
         }
       }
     }
-  }
-  for (i = 0; i < 5; i++) {
-    for (j = 0; j < 5; j++) {
-      for (k = 0; k < 4; k++) {
-        register int n = k + 4*j + 20*i;
-        mpa->tables.n_slen2[n + 400] = i | (j << 3) | (k << 6) | (1 << 12);
+    for (i = 0; i < 5; i++) {
+      for (j = 0; j < 5; j++) {
+        for (k = 0; k < 4; k++) {
+          register int n = k + 4*j + 20*i;
+          mpa->tables.n_slen2[n + 400] = i | (j << 3) | (k << 6) | (1 << 12);
+        }
       }
     }
-  }
 }
 
 void init_tables(mpadec_t mpadec, MYFLT scale, int32_t sblimit)
 {
-  register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
-
-  if (mpa->state < MPADEC_STATE_START) {
-    init_layer2(mpa);
-    init_layer3(mpa);
-  }
-  init_limits(mpa, sblimit);
-  make_synth_window(mpa, scale);
+    register struct mpadec_t *mpa = (struct mpadec_t *)mpadec;
+
+    if (mpa->state < MPADEC_STATE_START) {
+      init_layer2(mpa);
+      init_layer3(mpa);
+    }
+    init_limits(mpa, sblimit);
+    make_synth_window(mpa, scale);
 }
 
diff --git a/InOut/rtalsa.c b/InOut/rtalsa.c
index 36ae308..a6082a7 100644
--- a/InOut/rtalsa.c
+++ b/InOut/rtalsa.c
@@ -28,6 +28,9 @@
 #ifndef _POSIX_SOURCE
 #define _POSIX_SOURCE 1
 #endif
+#ifndef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 1
+#endif
 #ifndef _BSD_SOURCE
 #define _BSD_SOURCE 1
 #endif
diff --git a/InOut/widgets.cpp b/InOut/widgets.cpp
index d269db0..994f349 100644
--- a/InOut/widgets.cpp
+++ b/InOut/widgets.cpp
@@ -1272,7 +1272,7 @@ int SNAPSHOT::get(vector<ADDR_SET_VALUE>& valuators, int snapGroup)
       }
       Fl_Widget* o = (Fl_Widget*) (valuators[k].WidgAddress);
       void *opcode = valuators[k].opcode;
-      //CSOUND *csound = (CSOUND*) (((OPDS*) opcode)->insdshead->csound); //Not used
+//CSOUND *csound = (CSOUND*) (((OPDS*) opcode)->insdshead->csound); //Not used
       VALUATOR_FIELD* fld = &fields[j];
       string opcode_name = fld->opcode_name;
 
@@ -1328,11 +1328,12 @@ int SNAPSHOT::get(vector<ADDR_SET_VALUE>& valuators, int snapGroup)
           if(fld->value >= *p->ioff - 0.0001 &&
              fld->value <= *p->ioff + 0.0001)  // to avoid eventual  math rounding
             ((Fl_Button*) o)->value(0);
-          else if (fld->value >= *p->ion - 0.0001 &&
-                   fld->value <= *p->ion + 0.0001) // to avoid eventual math rounding
-            ((Fl_Button*) o)->value(1);
-          else
-            ((Fl_Button*) o)->value((int)fld->value);
+          else 
+            if (fld->value >= *p->ion - 0.0001 &&
+                fld->value <= *p->ion + 0.0001) // to avoid eventual math rounding
+              ((Fl_Button*) o)->value(1);
+            else
+              ((Fl_Button*) o)->value((int)fld->value);
           o->do_callback(o, opcode);
         }
       }
@@ -1518,7 +1519,7 @@ extern "C" {
           Fl_lock(csound);
           n = fl_choice("%s", Str("Saving could overwrite the old file.\n"
                                   "Are you sure you want to save ?"),
-                        Str("No"), Str("Yes"), NULL);
+                        Str("No"), Str("Yes"), (char*)NULL); // should thing be "" ?
           Fl_unlock(csound);
           if (!n)
             return OK;
@@ -2870,7 +2871,8 @@ extern "C" {
           break;
         case EXP_:        // exponential
           #if defined(sun)
-            log_base = (MYFLT) log(::pow(v.max / (double)v.min, 1.0 / (v.max - v.min)));
+            log_base = (MYFLT) log(::pow(v.max / (double)v.min,
+                                         1.0 / (v.max - v.min)));
           #else
             log_base = (MYFLT) log(::pow(v.max / v.min, 1.0 / (v.max - v.min)));
           #endif
@@ -2907,7 +2909,8 @@ extern "C" {
           break;
         case EXP_:        // exponential
           #if defined(sun)
-            log_base = (MYFLT) log(::pow(v.max / (double)v.min, 1.0 / (v.max - v.min)));
+            log_base = (MYFLT) log(::pow(v.max / (double)v.min, 
+                                   1.0 / (v.max - v.min)));
           #else
             log_base = (MYFLT) log(::pow(v.max / v.min, 1.0 / (v.max - v.min)));
           #endif
@@ -3269,7 +3272,8 @@ extern "C" {
       Fl_Slider *o;
       if (itype <= 10) o = new Fl_Slider(ix, iy, iwidth, iheight, controlName);
       else {
-        o = new Fl_Value_Slider_Input(csound, ix, iy, iwidth, iheight, controlName);
+        o = new Fl_Value_Slider_Input(csound, ix, iy, 
+                                      iwidth, iheight, controlName);
         itype -=10;
         //o->labelsize(20);
         ((Fl_Value_Slider_Input*) o)->textboxsize(50);
@@ -3355,7 +3359,7 @@ extern "C" {
 
       if (*p->ioutable  < 1) {
         if (LIKELY(csound->zkstart != NULL &&
-                   csound->zklast > (long)(*p->inumsliders + *p->ioutablestart_ndx)))
+                   csound->zklast > (long)(*p->inumsliders+*p->ioutablestart_ndx)))
           outable = csound->zkstart + (long) *p->ioutablestart_ndx;
         else {
           return csound->InitError(csound, "%s",
@@ -3781,7 +3785,8 @@ extern "C" {
         break;
       case 2:
         {
-          o = new Fl_Value_Input_Spin(csound, ix, iy, iwidth, iheight, controlName);
+          o = new Fl_Value_Input_Spin(csound, ix, iy,
+                                      iwidth, iheight, controlName);
           ((Fl_Value_Input *) o)->step(istep);
           ((Fl_Value_Input *) o)->range(*p->imin,*p->imax);
         }
@@ -4431,7 +4436,7 @@ extern "C" {
 
       if (*p->ioutable  < 1) {
         if (LIKELY(csound->zkstart != NULL &&
-                   csound->zklast>(long)(*p->inumsliders + *p->ioutablestart_ndx)))
+                   csound->zklast>(long)(*p->inumsliders+*p->ioutablestart_ndx)))
           outable = csound->zkstart + (long) *p->ioutablestart_ndx;
         else {
           return csound->InitError(csound, "%s",
@@ -5249,7 +5254,8 @@ extern "C" {
       if (p->numslid == 0) p->numslid = p->q->elements - p->startslid;
       if (UNLIKELY( p->q->elements < p->startslid + p->numslid)) {
         return csound->InitError(csound, "%s",
-                                 Str("FLslidBnkSetk: too many sliders to reset!"));
+                                 Str("FLslidBnkSetk:"
+                                     " too many sliders to reset!"));
       }
       return OK;
   }
diff --git a/OOps/diskin2.c b/OOps/diskin2.c
index 510a111..f4abff7 100644
--- a/OOps/diskin2.c
+++ b/OOps/diskin2.c
@@ -327,7 +327,8 @@ int diskin2_perf(CSOUND *csound, DISKIN2 *p)
     int32   ndx;
     int     i, nn, chn, wsized2, warp;
 
-    if (UNLIKELY(p->fdch.fd == NULL)) {
+    if (UNLIKELY(p->fdch.fd == NULL) ) goto file_error;
+    if(!p->initDone && !p->iSkipInit){
       return csound->PerfError(csound, Str("diskin2: not initialised"));
     }
     if (*(p->kTranspose) != p->prv_kTranspose) {
@@ -492,6 +493,9 @@ int diskin2_perf(CSOUND *csound, DISKIN2 *p)
       for (nn = 0; nn < csound->ksmps; nn++)
         p->aOut[chn][nn] *= csound->e0dbfs;
     return OK;
+ file_error:
+    csound->ErrorMsg(csound, "diskin2: file descriptor closed or invalid\n");
+   return NOTOK;
 }
 
 /* -------- soundin opcode: simplified version of diskin2 -------- */
diff --git a/OOps/goto_ops.c b/OOps/goto_ops.c
index a79d467..7ff9b4c 100644
--- a/OOps/goto_ops.c
+++ b/OOps/goto_ops.c
@@ -71,6 +71,7 @@ int kngoto(CSOUND *csound, CGOTO *p)
     return OK;
 }
 
+#ifdef VARGS
 /* an i-rate version that ALWAYS jumps at p-time */
 
 int iingoto(CSOUND *csound, CGOTO *p)
@@ -85,6 +86,7 @@ int kingoto(CSOUND *csound, CGOTO *p)
     csound->pds = p->lblblk->prvp;
     return OK;
 }
+#endif
 
 int timset(CSOUND *csound, TIMOUT *p)
 {
diff --git a/OOps/ugens2.c b/OOps/ugens2.c
index bebdd83..234d54b 100644
--- a/OOps/ugens2.c
+++ b/OOps/ugens2.c
@@ -589,7 +589,7 @@ int ktabli(CSOUND *csound, TABLE   *p)
         indx  = length - 1;
         fract = FL(1.0);
       }
-      else if (UNLIKELY(ndx < 0)) {
+      else if (UNLIKELY(indx < 0L)) {
         indx  = 0L;
         fract = FL(0.0);
       }
@@ -667,7 +667,7 @@ int ktabl3(CSOUND *csound, TABLE   *p)
         indx  = length - 1;
         fract = FL(1.0);
       }
-      else if (UNLIKELY(ndx < 0)) {
+      else if (UNLIKELY(indx < 0L)) {
         indx  = 0L;
         fract = FL(0.0);
       }
@@ -728,7 +728,7 @@ int tabli(CSOUND *csound, TABLE   *p)
          * the offset.  */
         ndx = (pxndx[n] * xbmul) + offset;
         indx = (int32) ndx;
-        if (UNLIKELY(ndx <= FL(0.0))) {
+        if (UNLIKELY(indx <= 0L)) {
           rslt[n] = tab[0];
           continue;
         }
@@ -806,7 +806,7 @@ int tabl3(CSOUND *csound, TABLE *p)     /* Like tabli but cubic interpolation */
           indx  = length - 1;
           fract = FL(1.0);
         }
-        else if (UNLIKELY(ndx < 0)) {
+        else if (UNLIKELY(indx < 0L)) {
           indx  = 0L;
           fract = FL(0.0);
         }
diff --git a/OOps/ugens2a.c b/OOps/ugens2a.c
new file mode 100644
index 0000000..e691962
--- /dev/null
+++ b/OOps/ugens2a.c
@@ -0,0 +1,615 @@
+/*
+    ugens2a.c:
+
+    Copyright (C) 2012 John ffitch
+    Based in part on code from Vercoe and Whittle
+
+    This file is part of Csound.
+
+    The Csound Library is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    Csound 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 Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with Csound; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+*/
+
+#include "csoundCore.h" /*                              UGENS2.C        */
+#include "ugens2.h"
+#include "ugrw1.h"
+#include <math.h>
+
+#define MYFLOOR(x) (x >= FL(0.0) ? (int32)x : (int32)((double)x - 0.99999999))
+
+/*****************************************************************************/
+
+/* Table read code - see TABLE data structure in ugens2.h.  */
+
+/*************************************/
+
+static int itblchk(CSOUND *csound, TABLE *p)
+{
+    if (UNLIKELY((p->ftp = csound->FTFind(csound, p->xfn)) == NULL))
+      return csound->InitError(csound, Str("table does not exist"));
+
+    /* Although TABLE has an integer variable for the table number
+     * (p->pfn) we do not need to write it.  We know that the k
+     * and a rate functions which will follow will not be
+     * expecting a changed table number.
+     *
+     * p->pfn exists only for checking table number changes for
+     * functions which are expecting a k rate table number.  */
+
+    /* Set denormalisation factor to 1 or table length, depending
+     * on the state of ixmode. */
+    if (*p->ixmode)
+      p->xbmul = p->ftp->flen;
+    else
+      p->xbmul = 1L;
+
+    /* Multiply the ixoff value by the xbmul denormalisation
+     * factor and then check it is between 0 and the table length.
+     *
+     * Bug fix: was p->offset * *p->ixoff */
+
+    if (UNLIKELY((p->offset = p->xbmul * *p->ixoff) < FL(0.0) ||
+                 p->offset > p->ftp->flen)) {
+      return csound->InitError(csound, Str("Offset %f < 0 or > tablelength"),
+                                       p->offset);
+    }
+
+    p->wrap   = (int)*p->iwrap;
+    return OK;
+}
+
+int pktable(CSOUND *,TABLE*);
+int pktabli(CSOUND *,TABLE*);
+int pktabl3(CSOUND *,TABLE*);
+
+int pitable(CSOUND *csound, TABLE *p)
+{
+    if (LIKELY(itblchk(csound,p)==OK)) return pktable(csound,p);
+    return NOTOK;
+}
+
+int pitabli(CSOUND *csound, TABLE *p)
+{
+    if (LIKELY(itblchk(csound,p)==OK)) return pktabli(csound,p);
+    return NOTOK;
+}
+
+int pitabl3(CSOUND *csound, TABLE *p)
+{
+    if (LIKELY(itblchk(csound,p)==OK)) return pktabl3(csound,p);
+    return NOTOK;
+}
+
+/*---------------------------------------------------------------------------*/
+
+/* Functions which read the table. */
+
+int pktable(CSOUND *csound, TABLE   *p)
+{
+    FUNC        *ftp;
+    int32        indx, length;
+    MYFLT       ndx;
+
+    ftp = p->ftp;
+    if (UNLIKELY(ftp==NULL)) goto err1;            /* RWD fix */
+    ndx = *p->xndx;
+    length = ftp->flen;
+    /* Multiply ndx by denormalisation factor, and add in the offset
+     * - already denormalised - by tblchk().
+     * xbmul = 1 or table length depending on state of ixmode.  */
+
+    ndx = ( ndx * p->xbmul) + p->offset;
+
+    /* ndx now includes the offset and is ready to address the table.
+     *
+     * The original code was:
+     *  indx = (long) (ndx + p->offset);
+     *
+     * This is a problem, causes problems with negative numbers.
+     *
+     */
+     indx = (int32) MYFLOOR((double)ndx);
+
+    /* Now for "limit mode" - the "non-wrap" function, depending on
+     * iwrap.
+     *
+     * The following section of code limits the final index to 0 and
+     * the last location in the table.
+     *
+     * It is only used when wrap is OFF.  The wrapping is achieved by
+     * code after this - when this code is not run.  */
+    if (!p->wrap) {
+      /* Previously this code limited the upper range of the indx to
+       * the table length - for instance 8.  Then the result was ANDed
+       * with a mask (for instance 7).
+       *
+       * This meant that when the input index was 8 or above, it got
+       * reduced to 0.  What we want is for it to stick at the index
+       * which reads the last value from the table - in this example
+       * from location 7.
+       *
+       * So instead of limiting to the table length, we limit to
+       * (table length - 1).  */
+      if (UNLIKELY(indx > length - 1))
+        indx = length - 1;
+
+      /* Now limit negative values to zero.  */
+      else if (UNLIKELY(indx < 0L))
+        indx = 0L;
+    }
+    /* The following code used to use an AND with an integer like 0000 0111
+     * to wrap the current index within the range of the table.  In
+     * the original version, this code always ran, but with the new
+     * (length - 1) code above, it would have no effect, so it is now
+     * an else operation - running only when iwrap = 1.  This may save
+     * half a usec or so.  */
+    /* Now safe against non power-of-2 tables */
+    else if (indx>=length) indx = indx % length;
+    else if (indx<0) indx = length - (-indx)%length;
+
+    /* Now find the address of the start of the table, add it to the
+     * index, read the value from there and write it to the
+     * destination.  */
+    *p->rslt = *(ftp->ftable + indx);
+    return OK;
+ err1:
+    return csound->PerfError(csound, Str("ptable(krate): not initialised"));
+}
+
+/* ptablefn()  */
+
+int ptablefn(CSOUND *csound, TABLE *p)
+{
+    FUNC        *ftp;
+    MYFLT       *rslt, *pxndx, *tab;
+    int32       indx, length;
+    int         n, nsmps=csound->ksmps;
+    MYFLT       ndx, xbmul, offset;
+    int         wrap = p->wrap;
+
+    ftp = p->ftp;
+    if (UNLIKELY(ftp==NULL)) goto err1;            /* RWD fix */
+    rslt = p->rslt;
+    length = ftp->flen;
+    pxndx = p->xndx;
+    xbmul = (MYFLT)p->xbmul;
+    offset = p->offset;
+    //mask = ftp->lenmask;
+    tab = ftp->ftable;
+    for (n=0; n<nsmps; n++) {
+      /* Read in the next raw index and increment the pointer ready
+       * for the next cycle.
+       *
+       * Then multiply the ndx by the denormalising factor and add in
+       * the offset.  */
+
+      ndx = (pxndx[n] * xbmul) + offset;
+      indx = (int32) MYFLOOR((double)ndx);
+
+      /* Limit = non-wrap.  Limits to 0 and (length - 1), or does the
+       * wrap code.  See notes above in ktable().  */
+      if (!wrap) {
+        if (UNLIKELY(indx >= length))
+          indx = length - 1;
+        else if (UNLIKELY(indx < (int32)0))
+          indx = (int32)0;
+      }
+      /* do the wrap code only if we are not doing the non-wrap code.  */
+      else if (indx >= length) indx %= length;
+      else if (indx < 0) indx = length - (-indx)%length;
+      rslt[n] = tab[indx];
+    }
+    return OK;
+ err1:
+    return csound->PerfError(csound, Str("table: not initialised"));
+}
+
+/* pktabli() */
+
+int pktabli(CSOUND *csound, TABLE   *p)
+{
+    FUNC        *ftp;
+    int32       indx, length;
+    MYFLT       v1, v2, fract, ndx;
+
+    ftp = p->ftp;
+    if (UNLIKELY(ftp==NULL)) goto err1;
+    ndx = *p->xndx;
+    length = ftp->flen;
+    /* Multiply ndx by denormalisation factor.
+     * xbmul is 1 or table length depending on state of ixmode.
+     * Add in the offset, which has already been denormalised by
+     * tblchk().  */
+
+    ndx    = (ndx * p->xbmul) + p->offset;
+    indx = (int32) MYFLOOR((double)ndx);
+
+    /* We need to generate a fraction - How much above indx is ndx?
+     * It will be between 0 and just below 1.0.  */
+    fract = ndx - indx;
+
+    if (!p->wrap) {
+      if (UNLIKELY(ndx >= length)) {
+        indx  = length - 1;
+        fract = FL(1.0);
+      }
+      else if (UNLIKELY(ndx < 0)) {
+        indx  = 0L;
+        fract = FL(0.0);
+      }
+    }
+    /* We are in wrap mode, so do the wrap function.  */
+    else if (indx>=length) indx %= length;
+    else if (indx<0) indx = length - (-indx)%length;
+
+    /* Now read the value at indx and the one beyond */
+    v1 = *(ftp->ftable + indx);
+    indx++;
+    if (indx>=length) indx -= length;
+    v2 = *(ftp->ftable + indx);
+    *p->rslt = v1 + (v2 - v1) * fract;
+    return OK;
+ err1:
+    return csound->PerfError(csound, Str("ptablei(krate): not initialised"));
+}
+
+
+int pktabl3(CSOUND *csound, TABLE   *p)
+{
+    FUNC        *ftp;
+    int32        indx, length;
+    MYFLT       v1, v2, fract, ndx;
+
+    ftp = p->ftp;
+    if (UNLIKELY(ftp==NULL)) goto err1;
+    ndx = *p->xndx;
+    length = ftp->flen;
+    /* Multiply ndx by denormalisation factor.
+     * xbmul is 1 or table length depending on state of ixmode.
+     * Add in the offset, which has already been denormalised by
+     * tblchk().  */
+
+    ndx    = (ndx * p->xbmul) + p->offset;
+    indx = (int32) MYFLOOR((double)ndx);
+
+    /* We need to generate a fraction - How much above indx is ndx?
+     * It will be between 0 and just below 1.0.  */
+    fract = ndx - indx;
+
+    if (!p->wrap) {
+      if (UNLIKELY(ndx >= length)) {
+        indx  = length - 1;
+        fract = FL(1.0);
+      }
+      else if (UNLIKELY(ndx < 0)) {
+        indx  = 0L;
+        fract = FL(0.0);
+      }
+    }
+    /* We are in wrap mode, so do the wrap function.  */
+    else if (indx>=length) indx %= length;
+    else if (indx<0) indx = length - (-indx)%length;
+
+    /* interpolate with cubic if we can, else linear */
+    if (UNLIKELY(indx<1 || indx==length-2 || length <4)) {
+      v1 = *(ftp->ftable + indx);
+      v2 = *(ftp->ftable + indx + 1);
+      *p->rslt = v1 + (v2 - v1) * fract;
+    }
+    else {
+      MYFLT *tab = ftp->ftable;
+      MYFLT ym1 = tab[indx-1], y0 = tab[indx];
+      MYFLT y1 = tab[indx+1], y2 = tab[indx+2];
+      MYFLT frsq = fract*fract;
+      MYFLT frcu = frsq*ym1;
+      MYFLT t1 = y2 + y0+y0+y0;
+      *p->rslt = y0 + FL(0.5)*frcu
+        + fract*(y1 - frcu/FL(6.0) - t1/FL(6.0) - ym1/FL(3.0))
+        + frsq*fract*(t1/FL(6.0) - FL(0.5)*y1) + frsq*(FL(0.5)* y1 - y0);
+    }
+    return OK;
+ err1:
+    return csound->PerfError(csound, Str("ptable3(krate): not initialised"));
+}
+
+int ptabli(CSOUND *csound, TABLE   *p)
+{
+    FUNC        *ftp;
+    int32       indx, length;
+    int         n, nsmps=csound->ksmps;
+    MYFLT       *rslt, *pxndx, *tab;
+    MYFLT       fract, v1, v2, ndx, xbmul, offset;
+
+    ftp = p->ftp;
+    if (UNLIKELY(ftp==NULL)) goto err1;
+    rslt   = p->rslt;
+    length = ftp->flen;
+    pxndx  = p->xndx;
+    xbmul  = (MYFLT)p->xbmul;
+    offset = p->offset;
+    //mask   = ftp->lenmask;
+    tab    = ftp->ftable;
+    /* As for ktabli() code to handle non wrap mode, and wrap mode.  */
+    if (!p->wrap) {
+      for (n=0; n<nsmps; n++) {
+        /* Read in the next raw index and increment the pointer ready
+         * for the next cycle.
+         * Then multiply the ndx by the denormalising factor and add in
+         * the offset.  */
+        ndx = (pxndx[n] * xbmul) + offset;
+        indx = (int32) ndx;
+        if (UNLIKELY(ndx <= FL(0.0))) {
+          rslt[n] = tab[0];
+          continue;
+        }
+        if (UNLIKELY(indx >= length)) {
+          rslt[n] = tab[length-1];
+          continue;
+        }
+        /* We need to generate a fraction - How much above indx is ndx?
+         * It will be between 0 and just below 1.0.  */
+        fract = ndx - indx;
+        /* As for ktabli(), read two values and interpolate between
+         * them.  */
+        v1 = tab[indx];
+        indx++;
+        if (indx>=length) indx = length-1;
+        v2 = tab[indx];
+        rslt[n] = v1 + (v2 - v1)*fract;
+      }
+    }
+    else {                      /* wrap mode */
+      for (n=0; n<nsmps; n++) {
+        int j;
+        /* Read in the next raw index and increment the pointer ready
+         * for the next cycle.
+         * Then multiply the ndx by the denormalising factor and add in
+         * the offset.  */
+        ndx = (pxndx[n] * xbmul) + offset;
+        indx = (int32) MYFLOOR(ndx);
+        /* We need to generate a fraction - How much above indx is ndx?
+         * It will be between 0 and just below 1.0.  */
+        fract = ndx - indx;
+        if (indx >= length) indx %= length;
+        else if (indx<0) indx = length-(-indx)%length;
+        /* As for ktabli(), read two values and interpolate between
+         * them.  */
+        v1 = tab[indx];
+        j = indx + 1;
+        if (j >= length) j -= length;
+        v2 = tab[j];
+        rslt[n] = v1 + (v2 - v1)*fract;
+      }
+    }
+    return OK;
+ err1:
+    return csound->PerfError(csound, Str("ptablei: not initialised"));
+}
+
+int ptabl3(CSOUND *csound, TABLE *p)     /* Like ptabli but cubic interpolation */
+{
+    FUNC        *ftp;
+    int32       indx, length;
+    int         n, nsmps=csound->ksmps;
+    MYFLT       *rslt, *pxndx, *tab;
+    MYFLT       fract, v1, v2, ndx, xbmul, offset;
+    int         wrap = p->wrap;
+
+    ftp = p->ftp;
+    if (UNLIKELY(ftp==NULL)) goto err1;
+    rslt = p->rslt;
+    length = ftp->flen;
+    pxndx = p->xndx;
+    xbmul = (MYFLT)p->xbmul;
+    offset = p->offset;
+    tab = ftp->ftable;
+    for (n=0; n<nsmps; n++) {
+      /* Read in the next raw index and increment the pointer ready
+       * for the next cycle.
+       * Then multiply the ndx by the denormalising factor and add in
+       * the offset.  */
+
+      ndx = (pxndx[n] * xbmul) + offset;
+      indx = (int32) MYFLOOR((double)ndx);
+
+      /* We need to generate a fraction - How much above indx is ndx?
+       * It will be between 0 and just below 1.0.  */
+      fract = ndx - indx;
+      /* As for pktabli() code to handle non wrap mode, and wrap mode.  */
+      if (!wrap) {
+        if (UNLIKELY(ndx >= length)) {
+          indx  = length - 1;
+          fract = FL(1.0);
+        }
+        else if (UNLIKELY(ndx < 0)) {
+          indx  = 0L;
+          fract = FL(0.0);
+        }
+      }
+      else if (UNLIKELY(indx>=length)) indx %= length;
+      else if (UNLIKELY(indx<0)) indx = length-(-indx)%length;
+      /* interpolate with cubic if we can */
+      if (UNLIKELY(indx <1 || indx == length-2 || length<4)) {
+        /* Too short or at ends */
+        v1 = tab[indx];
+        v2 = tab[indx + 1];
+        rslt[n] = v1 + (v2 - v1)*fract;
+      }
+      else {
+        MYFLT ym1 = tab[indx-1], y0 = tab[indx];
+        int j = (indx+1<length ? indx+1 : indx+1-length);
+        int k = (indx+2<length ? indx+2 : indx+2-length);
+        MYFLT y1 = tab[j], y2 = tab[k];
+        MYFLT frsq = fract*fract;
+        MYFLT frcu = frsq*ym1;
+        MYFLT t1 = y2 + y0+y0+y0;
+        rslt[n] = y0 + FL(0.5)*frcu +
+          fract*(y1 - frcu/FL(6.0) - t1/FL(6.0) - ym1/FL(3.0)) +
+          frsq*fract*(t1/FL(6.0) - FL(0.5)*y1) + frsq*(FL(0.5)* y1 - y0);
+      }
+    }
+    return OK;
+ err1:
+    return csound->PerfError(csound, Str("ptable3: not initialised"));
+}
+
+extern int itblchkw(CSOUND *, TABLEW*);
+int pktablew(CSOUND *, TABLEW*);
+int pitablew(CSOUND *csound, TABLEW *p)
+{
+    if (LIKELY(itblchkw(csound, p) == OK))
+      return pktablew(csound, p);
+    return NOTOK;
+}
+
+/*---------------------------------------------------------------------------*/
+
+/* pktablew is called with p pointing to the TABLEW data structure -
+ * which contains the input arguments.  */
+
+int pktablew(CSOUND *csound, TABLEW   *p)
+{
+/* Pointer to data structure for accessing the table we will be
+ * writing to.
+ */
+    FUNC        *ftp;
+    int32        indx, length;
+    MYFLT       ndx;            /*  for calculating index of read.  */
+    MYFLT       *ptab;          /* Where we will write */
+
+    /*-----------------------------------*/
+    /* Assume that TABLEW has been set up correctly.  */
+
+    ftp    = p->ftp;
+    ndx    = *p->xndx;
+    length = ftp->flen;
+    /* Multiply ndx by denormalisation factor.  and add in the
+     * offset - already denormalised - by tblchkw().
+     * xbmul = 1 or table length depending on state of ixmode.  */
+
+    ndx = (ndx * p->xbmul) + p->offset;
+
+    /* ndx now includes the offset and is ready to address the table.
+     * However we have three modes to consider:
+     * igwm = 0     Limit mode.
+     *        1     Wrap mode.
+     *        2     Guardpoint mode.
+     */
+    if (p->iwgm == 0) {
+      /* Limit mode - when igmode = 0.
+       *
+       * Limit the final index to 0 and the last location in the table.
+       */
+      indx = (int32) MYFLOOR(ndx); /* Limit to (table length - 1) */
+      if (UNLIKELY(indx > length - 1))
+        indx = length - 1;      /* Limit the high values. */
+      else if (UNLIKELY(indx < 0L)) indx = 0L; /* limit negative values to zero. */
+    }
+    /* Wrap and guard point mode.
+     * In guard point mode only, add 0.5 to the index. */
+    else {
+      if (p->iwgm == 2) ndx += FL(0.5);
+      indx = (int32) MYFLOOR(ndx);
+
+      /* Both wrap and guard point mode.
+       * The following code uses an AND with an integer like 0000 0111 to wrap
+       * the current index within the range of the table. */
+      if (UNLIKELY(indx>=length)) indx %= length;
+      else if (UNLIKELY(indx<0)) indx = length-(-indx)%length;
+    }
+                                /* Calculate the address of where we
+                                 * want to write to, from indx and the
+                                 * starting address of the table.
+                                 */
+    ptab = ftp->ftable + indx;
+    *ptab = *p->xsig;           /* Write the input value to the table. */
+                                /* If this is guard point mode and we
+                                 * have just written to location 0,
+                                 * then also write to the guard point.
+                                 */
+    if ((p->iwgm == 2) && indx == 0) { /* Fix -- JPff 2000/1/5 */
+      ptab += ftp->flen;
+      *ptab = *p->xsig;
+    }
+    return OK;
+}
+
+/*---------------------------------------------------------------------------*/
+
+/* tablew() is similar to ktablew()  above, except that it processes
+ * two arrays of input values and indexes.  These arrays are ksmps long. */
+int ptablew(CSOUND *csound, TABLEW *p)
+{
+    FUNC        *ftp;   /* Pointer to function table data structure. */
+    MYFLT       *psig;  /* Array of input values to be written to table. */
+    MYFLT       *pxndx; /* Array of input index values */
+    MYFLT       *ptab;  /* Pointer to start of table we will write. */
+    MYFLT       *pwrite;/* Pointer to location in table where we will write */
+    int32        indx;   /* Used to read table. */
+    int32        length; /* Length of table */
+    int         liwgm;          /* Local copy of iwgm for speed */
+    int         n, nsmps = csound->ksmps;
+    MYFLT       ndx, xbmul, offset;
+                                /*-----------------------------------*/
+    /* Assume that TABLEW has been set up correctly. */
+
+    ftp    = p->ftp;
+    psig   = p->xsig;
+    pxndx  = p->xndx;
+    ptab   = ftp->ftable;
+    length = ftp->flen;
+    liwgm  = p->iwgm;
+    xbmul  = (MYFLT)p->xbmul;
+    offset = p->offset;
+                /* Main loop - for the number of a samples in a k cycle. */
+    for (n=0; n<nsmps; n++) {
+      /* Read in the next raw index and increment the pointer ready for the
+         next cycle.  Then multiply the ndx by the denormalising factor and
+         add in the offset.  */
+      ndx = (pxndx[n] * xbmul) + offset;
+      if (liwgm == 0) {         /* Limit mode - when igmode = 0. */
+        indx = (int32) MYFLOOR(ndx);
+        if (UNLIKELY(indx > length - 1)) indx = length - 1;
+        else if (UNLIKELY(indx < 0L)) indx = 0L;
+      }
+      else {
+        if (liwgm == 2) ndx += FL(0.5);
+        indx = (int32) MYFLOOR(ndx);
+        /* Both wrap and guard point mode. */
+        if (UNLIKELY(indx>=length)) indx %= length;
+        else if (UNLIKELY(indx<0)) indx = length-(-indx)%length;
+      }
+      pwrite = ptab + indx;
+      *pwrite = psig[n];
+                                        /* If this is guard point mode and we
+                                         * have just written to location 0,
+                                         * then also write to the guard point.
+                                         */
+      if ((liwgm == 2) && indx == 0) {  /* Fix -- JPff 2000/1/5 */
+                                        /* Note that since pwrite is a pointer
+                                         * to a float, adding length to it
+                                         * adds (4 * length) to its value since
+                                         * the length of a float is 4 bytes.
+                                         */
+        pwrite += length;
+                                        /* Decrement psig to make it point
+                                         * to the same input value.
+                                         * Write to guard point.
+                                         */
+        *pwrite = psig[n];
+      }
+    }
+    return OK;
+}
diff --git a/OOps/ugrw1.c b/OOps/ugrw1.c
index 73e6649..4593c0c 100644
--- a/OOps/ugrw1.c
+++ b/OOps/ugrw1.c
@@ -858,8 +858,8 @@
 /*---------------------------------------------------------------------------*/
 
 static int ftkrchkw(CSOUND *, TABLEW *p);
-static int itblchkw(CSOUND *, TABLEW *p);
-static int ptblchkw(CSOUND *, TABLEW *p);
+       int itblchkw(CSOUND *, TABLEW *p);
+static int tblchkw(CSOUND *, TABLEW *p);
 
 /* Table write code
  *
@@ -875,7 +875,7 @@ static int ptblchkw(CSOUND *, TABLEW *p);
  *
  * Also called by itablew().
  *
- * A similar function ptblchkw() does the same job at performance time
+ * A similar function tblchkw() does the same job at performance time
  * - k processing cycles.
  *
  * Both these functions are virtually identical to those itblchk() and
@@ -886,7 +886,7 @@ static int ptblchkw(CSOUND *, TABLEW *p);
  * 3 -  There is an igwmode parameter.
 */
 
-static int itblchkw(CSOUND *csound, TABLEW *p)
+int itblchkw(CSOUND *csound, TABLEW *p)
 {
     /* Get pointer to the function table data structure of the table
      * number specified in xfn. Return 0 if it cannot be found.
@@ -928,7 +928,7 @@ static int itblchkw(CSOUND *csound, TABLEW *p)
 
 /*************************************/
 
-/* ptblchkw()
+/* tblchkw()
  *
  * This is called at init time by tblsetwkt() to set up the TABLEW
  * data structure for subsequent k and a rate operations which are
@@ -946,7 +946,7 @@ static int itblchkw(CSOUND *csound, TABLEW *p)
  * ktablewkt tablewkt
  *
  */
-static int ptblchkw(CSOUND *csound, TABLEW *p)
+static int tblchkw(CSOUND *csound, TABLEW *p)
 {
     /* TABLEW has an integer variable for the previous table number
      * (p->pfn).
@@ -964,29 +964,16 @@ static int ptblchkw(CSOUND *csound, TABLEW *p)
 
 /*---------------------------------------------------------------------------*/
 
-/* tblsetw()
- *
- * This is called at init time to set up TABLEW for the a and k rate
- * table read functions which are expecting the table number to be
- * fixed at i time.
- *
- * Call the itblchkw() function to do the work.
- */
-int tblsetw(CSOUND *csound, TABLEW *p)
-{
-    return itblchkw(csound, p);
-}
-
 /* tblsetwkt()
  *
  * This is called at init time to set up TABLEW for the a and k rate
  * table read functions which are expecting the table number to be a k
  * rate variable.
  *
- * Call the ptblchkw() function to do the work.  */
+ * Call the tblchkw() function to do the work.  */
 int tblsetwkt(CSOUND *csound, TABLEW *p)
 {
-    return ptblchkw(csound, p);
+    return tblchkw(csound, p);
 }
 
 /* itablew()
diff --git a/Opcodes/CMakeLists.txt b/Opcodes/CMakeLists.txt
index 95865f2..133fa88 100644
--- a/Opcodes/CMakeLists.txt
+++ b/Opcodes/CMakeLists.txt
@@ -1,3 +1,26 @@
+option(BUILD_CHUA_OPCODES "Build the chua opcodes (requires boost)" ON)
+option(BUILD_DSSI_OPCODES "Build the DSSI opcodes" ON)
+option(BUILD_FLUID_OPCODES "Build the fluidsynth opcodes" ON)
+option(BUILD_JACK_OPCODES "Build the JACK related opcodes" ON)
+option(BUILD_LINEAR_ALGEBRA_OPCODES "Build the Linear Algebra Opcodes" ON)
+option(BUILD_OSC_OPCODES "Build the OSC Opcodes" ON)
+option(BUILD_IMAGE_OPCODES "Build the image opcodes" ON)
+option(BUILD_PYTHON_OPCODES "Build the Python opcodes" ON)
+option(BUILD_LUA_OPCODES "Build the Lua opcodes" ON)
+
+find_package(Boost)
+check_include_file(ladspa.h LADSPA_H)
+check_include_file(fluidsynth.h FLUIDSYNTH_H)
+find_library(JACK_LIBRARY jack)
+find_library(JACKDMP_LIBRARY jackdmp)
+check_include_file(jack/jack.h JACK_HEADER)
+check_include_file_cxx(gmm/gmm.h GMM_HEADER)
+check_include_file(lo/lo.h OSC_HEADER)
+find_package(PNG)
+find_package(PythonLibs)
+find_package(Lua51)
+
+
 ## OPCODE LIBS WITH NO EXTERNAL DEPENDENCIES ##
 
 make_plugin(mixer mixer.cpp)
@@ -6,14 +29,17 @@ make_plugin(signalflowgraph signalflowgraph.cpp)
 make_plugin(ampmidid ampmidid.cpp)
 make_plugin(cs_date date.c)
 make_plugin(system_call system_call.c)
-make_plugin(mutexops mutexops.cpp)
 make_plugin(doppler doppler.cpp)
+make_plugin(fractalnoise tl/fractalnoise.cpp)
+
+make_plugin(fareygen fareygen.c)
 
 # temporarily do not build on Windows until these opcodes are fixed
 # to compile
 if(NOT WIN32) 
     make_plugin(udprecv sockrecv.c)
     make_plugin(udpsend socksend.c)
+
 endif()
 
 set(scansyn_SRCS
@@ -24,8 +50,73 @@ if(UNIX)
     make_plugin(control control.c)
 endif()
 
+if(LINUX)
+    make_plugin(urandom urandom.c)
+endif()
+
 ## OPCODES WITH EXTERNAL DEPENDENCIES ##
 
+check_deps(BUILD_CHUA_OPCODES Boost_FOUND)
+if(BUILD_CHUA_OPCODES)
+    include_directories(${Boost_INCLUDE_DIRS})
+    make_plugin(chua chua/ChuaOscillator.cpp)
+endif()
+
+check_deps(BUILD_DSSI_OPCODES LADSPA_H)
+if(BUILD_DSSI_OPCODES)
+    set(dssi_SRC dssi4cs/src/load.c dssi4cs/src/dssi4cs.c)
+    make_plugin(dssi4cs "${dssi_SRC}" )
+endif()
+
+check_deps(BUILD_FLUID_OPCODES FLUIDSYNTH_H)
+if(BUILD_FLUID_OPCODES)
+    make_plugin(fluidOpcodes fluidOpcodes/fluidOpcodes.cpp fluidsynth)
+endif()
+
+set(JACK_LIB (JACK_LIBRARY OR JACKDMP_LIBRARY))
+check_deps(BUILD_JACK_OPCODES JACK_HEADER JACK_LIB)
+if(BUILD_JACK_OPCODES)
+    set(jack_LIBS ${PTHREAD_LIBRARY})
+    if(JACKDMP_LIBRARY)
+        list(APPEND jack_LIBS ${JACKDMP_LIBRARY})
+    else()
+        list(APPEND jack_LIBS ${JACK_LIBRARY})
+    endif()
+    make_plugin(jacko jacko.cpp "${jack_LIBS}")
+    make_plugin(jackTransport jackTransport.c "${jack_LIBS}")
+endif()
+
+check_deps(BUILD_LINEAR_ALGEBRA_OPCODES GMM_HEADER)
+if(BUILD_LINEAR_ALGEBRA_OPCODES)
+    make_plugin(linear_algebra linear_algebra.cpp)
+endif()
+
+check_deps(BUILD_OSC_OPCODES OSC_HEADER)
+if(BUILD_OSC_OPCODES)
+    make_plugin(osc OSC.c)
+    target_link_libraries(osc lo pthread)
+endif()
+
+check_deps(BUILD_IMAGE_OPCODES PNG_FOUND)
+if(BUILD_IMAGE_OPCODES)
+    include_directories(${PNG_INCLUDE_DIR})
+    make_plugin(image imageOpcodes.c "${PNG_LIBRARIES}")
+    set_target_properties(image
+        PROPERTIES COMPILER_FLAGS "${PNG_DEFINITIONS}")
+endif()
+
+check_deps(BUILD_PYTHON_OPCODES PYTHONLIBS_FOUND)
+if(BUILD_PYTHON_OPCODES)
+    include_directories(${PYTHON_INCLUDE_DIRS})
+    make_plugin(py py/pythonopcodes.c ${PYTHON_LIBRARIES})
+endif()
+
+check_deps(BUILD_LUA_OPCODES LUA51_FOUND)
+if(BUILD_LUA_OPCODES)
+    include_directories(${LUA_INCLUDE_DIR})
+    make_plugin(LuaCsound LuaCsound.cpp ${LUA_LIBRARIES})
+endif()
+
 # OGG Opcode previously was built only for OLPC
 #if(VORBISFILE_LIBRARY)
 #    set(vorbis_LIBS ${libcsound_LIBS} ${VORBISFILE_LIBRARY})
@@ -50,8 +141,6 @@ endif()
     
           
 
-#if mpafound==1:
-#  makePlugin(pluginEnvironment, 'mp3in', ['mp3in.c'])
 #if wiifound==1:
 #  WiiEnvironment = pluginEnvironment.Clone()
 #  makePlugin(WiiEnvironment, 'wiimote', ['wiimote.c'])
diff --git a/Opcodes/OSC.c b/Opcodes/OSC.c
index 1872488..5b67f19 100644
--- a/Opcodes/OSC.c
+++ b/Opcodes/OSC.c
@@ -47,12 +47,14 @@ typedef struct {
     int   cnt;
 } OSCSEND;
 
+#ifdef VARGA
 typedef struct {
     OPDS    h;
     MYFLT   *i_port;
     MYFLT   *S_path;
     MYFLT   *i_absp2;
 } OSCRECV;
+#endif
 
 typedef struct osc_pat {
     struct osc_pat *next;
@@ -74,12 +76,14 @@ typedef struct {
     /* for OSCinit/OSClisten */
     int     nPorts;
     OSC_PORT  *ports;
+#ifdef VARGA
     /* for OSCrecv */
     rtEvt_t *eventQueue;
     void    *mutex_;
     lo_server_thread  st;
     double  baseTime;
     int     absp2mode;
+#endif
 } OSC_GLOBALS;
 
 /* opcode for starting the OSC listener (called once from orchestra header) */
@@ -255,6 +259,7 @@ static int osc_send(CSOUND *csound, OSCSEND *p)
     return OK;
 }
 
+#ifdef VARGA
 /* callback function called by sensevents() once in every control period */
 
 static void event_sense_callback(CSOUND *csound, OSC_GLOBALS *p)
@@ -381,6 +386,7 @@ static void osc_error_handler(int n, const char *msg, const char *path)
 {
     return;
 }
+#endif
 
 /* RESET routine for cleaning up */
 
@@ -388,6 +394,7 @@ static int OSC_reset(CSOUND *csound, OSC_GLOBALS *p)
 {
     int i;
 
+#ifdef VARGA
     if (p->mutex_ != NULL) {
       /* stop and destroy OSC thread */
       lo_server_thread_stop(p->st);
@@ -404,6 +411,7 @@ static int OSC_reset(CSOUND *csound, OSC_GLOBALS *p)
       csound->UnlockMutex(p->mutex_);
       csound->DestroyMutex(p->mutex_);
     }
+#endif
     for (i = 0; i < p->nPorts; i++)
       if (p->ports[i].thread) {
         lo_server_thread_stop(p->ports[i].thread);
@@ -433,6 +441,7 @@ static CS_NOINLINE OSC_GLOBALS *alloc_globals(CSOUND *csound)
     return pp;
 }
 
+#ifdef VARGA
 /* OSCrecv opcode (called once from orchestra header) */
 
 static int OSCrecv_init(CSOUND *csound, OSCRECV *p)
@@ -465,6 +474,7 @@ static int OSCrecv_init(CSOUND *csound, OSCRECV *p)
                                                  event_sense_callback, pp);
     return OK;
 }
+#endif
 
  /* ------------------------------------------------------------------------ */
 
@@ -754,7 +764,9 @@ static int OSC_list(CSOUND *csound, OSCLISTEN *p)
 
 static OENTRY localops[] = {
 { "OSCsend", S(OSCSEND), 3, "", "kSiSSN", (SUBR)osc_send_set, (SUBR)osc_send },
+#ifdef VARGA
 { "OSCrecv", S(OSCRECV), 1, "", "iSo",    (SUBR)OSCrecv_init },
+#endif
 { "OSCinit", S(OSCINIT), 1, "i", "i", (SUBR)osc_listener_init },
 { "OSClisten", S(OSCLISTEN),3, "k", "iSSN", (SUBR)OSC_list_init, (SUBR)OSC_list}
 };
diff --git a/Opcodes/cellular.c b/Opcodes/cellular.c
new file mode 100644
index 0000000..430aa0e
--- /dev/null
+++ b/Opcodes/cellular.c
@@ -0,0 +1,120 @@
+
+/*
+    pitch.c:
+
+    Copyright (C) 2011 Gleb Rogozinsky
+
+    This file is part of Csound.
+
+    The Csound Library is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    Csound 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 Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with Csound; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+*/
+
+#include "csdl.h"
+
+// classical 1-D Cellular Automaton by Gleb Rogozinsky.
+// It is the modified version of vcella opcode by Gabriel Maldonado
+
+typedef struct {
+    OPDS    h;
+    MYFLT   *ktrig, *kreinit, *ioutFunc, *initStateFunc,
+            *iRuleFunc, *ielements;
+    MYFLT   *currLine, *outVec, *initVec, *ruleVec;
+    int     elements, NewOld;
+    AUXCH   auxch;
+} CELL;
+
+static int cell_set(CSOUND *csound,CELL *p)
+{
+    FUNC        *ftp;
+    int elements;
+    MYFLT *currLine, *initVec = NULL;
+	
+    if (LIKELY((ftp = csound->FTnp2Find(csound,p->ioutFunc)) != NULL)) {
+      p->outVec = ftp->ftable;
+      elements = (p->elements = (int) *p->ielements);
+      if (UNLIKELY( elements > ftp->flen ))
+        return csound->InitError(csound, Str("cell: invalid num of elements"));
+    }
+    else return csound->InitError(csound, Str("cell: invalid output table"));
+    if (LIKELY((ftp = csound->FTnp2Find(csound,p->initStateFunc)) != NULL)) {
+      initVec = (p->initVec = ftp->ftable);
+      if (UNLIKELY(elements > ftp->flen ))
+        return csound->InitError(csound, Str("cell: invalid num of elements"));
+    }
+    else
+      return csound->InitError(csound, Str("cell: invalid initial state table"));
+    if (LIKELY((ftp = csound->FTnp2Find(csound,p->iRuleFunc)) != NULL)) {
+      p->ruleVec = ftp->ftable;
+    }
+    else
+      return csound->InitError(csound, Str("cell: invalid rule table"));
+    
+    if (p->auxch.auxp == NULL)
+      csound->AuxAlloc(csound, elements * sizeof(MYFLT) * 2, &p->auxch);
+    currLine = (p->currLine = (MYFLT *) p->auxch.auxp);
+    p->NewOld = 0;
+    memcpy(currLine, initVec, sizeof(MYFLT)*elements);
+    /* do { */
+    /*   *currLine++ = *initVec++; */
+    /* } while (--elements); */
+    return OK;
+}
+
+static int cell(CSOUND *csound,CELL *p)
+{
+    if (*p->kreinit) {
+      p->NewOld = 0;
+      memcpy(p->currLine, p->initVec, sizeof(MYFLT)*p->elements);
+      /* do { */
+      /*   *currLine++ = *initVec++; */
+      /* } while (--elements); */
+    }
+    if (*p->ktrig) {
+      int j, elements = p->elements, jm1;
+      MYFLT *actual, *previous, *outVec = p->outVec , *ruleVec = p->ruleVec;
+      previous = &(p->currLine[elements * p->NewOld]);
+      p->NewOld += 1;
+      p->NewOld %= 2;
+      actual   = &(p->currLine[elements * p->NewOld]);
+// Cellular Engine		
+      for (j=0; j < elements; j++) {
+        jm1 = (j < 1) ? elements-1 : j-1;
+        outVec[j] = previous[j];
+        actual[j] = ruleVec[(int)(previous[jm1]*4 + previous[j]*2 +
+                                  previous[(j+1) % elements])]; 
+      }
+      
+    } else {
+      int elements =  p->elements;
+      MYFLT *actual = &(p->currLine[elements * !(p->NewOld)]);
+      memcpy(p->outVec, actual, sizeof(MYFLT)*elements);
+      /* do { */
+      /*   *outVec++ = *actual++ ; */
+      /* } while (--elements); */
+    }
+    return OK;
+}
+
+
+#define S sizeof
+
+static OENTRY localops[] = {
+	{"cell",  S(CELL),  3, "",  "kkiiii",(SUBR)cell_set, (SUBR)cell        }
+	};
+
+LINKAGE 
+
+// Author: Gleb Rogozinsky, October 2011
diff --git a/Opcodes/fm4op.c b/Opcodes/fm4op.c
index 417b077..3a1d3c6 100644
--- a/Opcodes/fm4op.c
+++ b/Opcodes/fm4op.c
@@ -258,6 +258,7 @@ MYFLT FM4Alg5_tick(FM4OP *p, MYFLT c1, MYFLT c2)
 int tubebellset(CSOUND *csound, FM4OP *p)
 {
     MYFLT       amp = *p->amp * AMP_RSCALE; /* Normalised */
+    MYFLT       opt = *p->opt;
 
     if (UNLIKELY(make_FM4Op(csound,p))) return NOTOK;
     if (UNLIKELY(FM4Op_loadWaves(csound,p))) return NOTOK; /* 4 x "rawwaves/sinewave.raw" */
@@ -270,10 +271,11 @@ int tubebellset(CSOUND *csound, FM4OP *p)
     p->gains[1] = amp * FM4Op_gains[76];
     p->gains[2] = amp * FM4Op_gains[99];
     p->gains[3] = amp * FM4Op_gains[71];
-    ADSR_setAllTimes(csound, &p->adsr[0], FL(0.005), FL(4.0), FL(0.0), FL(0.04));
-    ADSR_setAllTimes(csound, &p->adsr[1], FL(0.005), FL(4.0), FL(0.0), FL(0.04));
-    ADSR_setAllTimes(csound, &p->adsr[2], FL(0.001), FL(2.0), FL(0.0), FL(0.04));
-    ADSR_setAllTimes(csound, &p->adsr[3], FL(0.004), FL(4.0), FL(0.0), FL(0.04));
+    if (opt<= FL(0.0)) opt = FL(4.0);
+    ADSR_setAllTimes(csound, &p->adsr[0], FL(0.005), opt, FL(0.0), FL(0.04));
+    ADSR_setAllTimes(csound, &p->adsr[1], FL(0.005), opt, FL(0.0), FL(0.04));
+    ADSR_setAllTimes(csound, &p->adsr[2], FL(0.001),FL(0.5)*opt,FL(0.0), FL(0.04));
+    ADSR_setAllTimes(csound, &p->adsr[3], FL(0.004), opt, FL(0.0), FL(0.04));
     /*      ADSR_setAll(csound, &p->adsr[0], 0.03f,0.00001f,FL(0.0),0.02f); */
     /*      ADSR_setAll(csound, &p->adsr[1], 0.03f,0.00001f,FL(0.0),0.02f); */
     /*      ADSR_setAll(csound, &p->adsr[2], 0.07f,0.00002f,FL(0.0),0.02f); */
diff --git a/Opcodes/fm4op.h b/Opcodes/fm4op.h
index 0449c90..dcfe1c3 100644
--- a/Opcodes/fm4op.h
+++ b/Opcodes/fm4op.h
@@ -65,7 +65,7 @@ typedef struct FM4OP {
     MYFLT       *control1, *control2, *modDepth; /* Control1 doubles as vowel */
     MYFLT       *vibFreq;
     MYFLT       *ifn0, *ifn1, *ifn2, *ifn3, *vifn;
-
+    MYFLT       *opt;
     ADSR        adsr[4];
     FUNC        *waves[4];
     MYFLT       w_rate[4];         /* Parameters for vibrato */
diff --git a/Opcodes/gab/gab.c b/Opcodes/gab/gab.c
index da4be2b..2b93fd8 100644
--- a/Opcodes/gab/gab.c
+++ b/Opcodes/gab/gab.c
@@ -114,7 +114,7 @@ static int fastab_set(CSOUND *csound, FASTAB *p)
     p->tablen = ftp->flen;
     p->xmode = (int) *p->ixmode;
     if (p->xmode)
-      p->xbmul = (MYFLT) ftp->flen;
+      p->xbmul = (MYFLT) p->tablen /*- FL(0.001)*/;
     else
       p->xbmul = FL(1.0);
     return OK;
@@ -129,7 +129,7 @@ static int fastabw(CSOUND *csound, FASTAB *p)
       MYFLT xbmul = p->xbmul;   /* load once */
       for (n=0; n<nsmps; n++)  { /* for loops compile better */
         int i = (int)(ndx[n]*xbmul);
-        if (UNLIKELY(i >= p->tablen || i<0)) {
+        if (UNLIKELY(i > p->tablen || i<0)) {
           csound->Message(csound, "ndx: %f \n", ndx[n]);
           return csound->PerfError(csound, Str("tabw off end"));
         }
@@ -139,7 +139,7 @@ static int fastabw(CSOUND *csound, FASTAB *p)
     else {
       for (n=0; n<nsmps; n++) {
         int i = ndx[n];
-        if (UNLIKELY(i >= p->tablen || i<0)) {
+        if (UNLIKELY(i > p->tablen || i<0)) {
           return csound->PerfError(csound, Str("tabw off end"));
         }
         tab[i] = rslt[n];
@@ -155,7 +155,7 @@ static int fastabk(CSOUND *csound, FASTAB *p)
       i = (int) (*p->xndx * p->xbmul);
     else
       i = (int) *p->xndx;
-    if (UNLIKELY(i >= p->tablen || i<0)) {
+    if (UNLIKELY(i > p->tablen || i<0)) {
       return csound->PerfError(csound, Str("tab off end"));
     }
     *p->rslt =  p->table[i];
@@ -169,7 +169,7 @@ static int fastabkw(CSOUND *csound, FASTAB *p)
       i = (int) (*p->xndx * p->xbmul);
     else
       i = (int) *p->xndx;
-    if (UNLIKELY(i >= p->tablen || i<0)) {
+    if (UNLIKELY(i > p->tablen || i<0)) {
       return csound->PerfError(csound, Str("tabw off end"));
     }
     p->table[i] = *p->rslt;
@@ -223,7 +223,7 @@ static int fastab(CSOUND *csound, FASTAB *p)
       MYFLT xbmul = p->xbmul;
       for (i=0; i<nsmps; i++) {
         int n = (int) (ndx[i] * xbmul);
-        if (UNLIKELY(n >= p->tablen || n<0)) {
+        if (UNLIKELY(n > p->tablen || n<0)) {
           return csound->PerfError(csound, Str("tab off end"));
         }
         rslt[i] = tab[n];
@@ -232,7 +232,7 @@ static int fastab(CSOUND *csound, FASTAB *p)
     else {
       for (i=0; i<nsmps; i++) {
         int n = (int) ndx[i];
-        if (UNLIKELY(n >= p->tablen || n<0)) {
+        if (UNLIKELY(n > p->tablen || n<0)) {
           return csound->PerfError(csound, Str("tab off end"));
         }
         rslt[i] = tab[n];
diff --git a/Opcodes/gab/newgabopc.c b/Opcodes/gab/newgabopc.c
index 3332132..f1627d3 100644
--- a/Opcodes/gab/newgabopc.c
+++ b/Opcodes/gab/newgabopc.c
@@ -856,7 +856,7 @@ int tabmorph_init_(CSOUND *csound);
 int rbatonopc_init_(CSOUND *csound);
 
 
-PUBLIC int newgabopc_ModuleInit(CSOUND *csound)
+int newgabopc_ModuleInit(CSOUND *csound)
 {
         int               err = 0;
         err |= hvs_init_(csound);
diff --git a/Opcodes/gab/sliderTable.c b/Opcodes/gab/sliderTable.c
index 92c0b4e..f0a11b8 100644
--- a/Opcodes/gab/sliderTable.c
+++ b/Opcodes/gab/sliderTable.c
@@ -368,9 +368,8 @@ static int sliderTable64(CSOUND *csound, SLIDER64t *p) /* GAB */
             break;                                                              \
         }                                                                       \
         *outTable++ =                                                           \
-            *yt1++ = *c1++ * value + *c2++ * *yt1; /* filters the output */     \
-                                                                                \
-        min++; max++; j++; ftp++;                                               \
+            *yt1 = *c1++ * value + *c2++ * *yt1; /* filters the output */       \
+        yt1++; min++; max++; j++; ftp++;                                        \
     }                                                                           \
 }                                                                               \
 return OK;
diff --git a/Opcodes/gendy.c b/Opcodes/gendy.c
new file mode 100644
index 0000000..1adf4a7
--- /dev/null
+++ b/Opcodes/gendy.c
@@ -0,0 +1,526 @@
+/*
+    gendy.c:
+
+    Implementation of the dynamic stochastic synthesis generator
+    conceived by Iannis Xenakis.
+
+    Based on Nick Collins's Gendy1 ugen (SuperCollider).
+
+    (c) Tito Latini, 2012
+
+    This file is part of Csound.
+
+    The Csound Library is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    Csound 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 Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with Csound; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+*/
+
+#include "csoundCore.h"
+
+typedef struct {
+        OPDS    h;
+        MYFLT   *out, *kamp, *ampdist, *durdist, *adpar, *ddpar;
+        MYFLT   *minfreq, *maxfreq, *ampscl, *durscl, *initcps, *knum;
+        MYFLT   phase, amp, nextamp, dur, speed;
+        int32   index, rand, points;
+        AUXCH   memamp, memdur;
+} GENDY;
+
+typedef struct {
+        OPDS    h;
+        MYFLT   *out, *kamp, *ampdist, *durdist, *adpar, *ddpar;
+        MYFLT   *minfreq, *maxfreq, *ampscl, *durscl;
+        MYFLT   *kcurveup, *kcurvedown, *initcps, *knum;
+        MYFLT   phase, amp, nextamp, dur, speed;
+        int32   index, rand, points;
+        AUXCH   memamp, memdur;
+} GENDYX;
+
+typedef struct {
+        OPDS    h;
+        MYFLT   *out, *kamp, *ampdist, *durdist, *adpar, *ddpar;
+        MYFLT   *minfreq, *maxfreq, *ampscl, *durscl, *initcps, *knum;
+        MYFLT   amp, nextamp, dur, slope, midpnt, curve;
+        int32   phase, index, rand, points;
+        AUXCH   memamp, memdur;
+} GENDYC;
+
+#define BIPOLAR      0x7FFFFFFF    /* Constant to make bipolar */
+#define dv2_31       (FL(4.656612873077392578125e-10))
+#define GENDYMAXCPS  8192          /* Max number of control points */
+
+static MYFLT gendy_distribution(CSOUND *csound, int which, MYFLT a, int32 rnd)
+{
+    MYFLT   c, r;
+    if (a > FL(1.0))
+      a = FL(1.0);
+    else if (a < FL(0.0001))
+      a = FL(0.0001);
+    switch (which) {
+    case 0: // linear
+      break;
+    case 1: // cauchy
+      c = ATAN(FL(10.0)*a);
+      r = (MYFLT)((int32)((unsigned)rnd<<1)-BIPOLAR) * dv2_31;
+      r = (FL(1.0)/a) * TAN(c*r) * FL(0.1);
+      return r;
+    case 2: // logist
+      c = FL(0.5)+(FL(0.499)*a);
+      c = LOG((FL(1.0)-c)/c);
+      r = (((MYFLT)rnd*dv2_31 - FL(0.5)) * FL(0.998)*a) + FL(0.5);
+      r = LOG((FL(1.0)-r)/r)/c;
+      return r;
+    case 3: // hyperbcos
+      c = TAN(FL(1.5692255)*a);
+      r = TAN(FL(1.5692255)*a*(MYFLT)rnd*dv2_31)/c;
+      r = (LOG(r*FL(0.999)+FL(0.001)) * FL(-0.1447648))*FL(2.0) - FL(1.0);
+      return r;
+    case 4: // arcsine
+      c = SIN(FL(1.5707963)*a);
+      r = SIN(PI_F * ((MYFLT)rnd*dv2_31 - FL(0.5))*a)/c;
+      return r;
+    case 5: // expon
+      c = LOG(FL(1.0)-(FL(0.999)*a));
+      r = (MYFLT)rnd*dv2_31*FL(0.999)*a;
+      r = (LOG(FL(1.0)-r)/c)*FL(2.0) - FL(1.0);
+      return r;
+    case 6: // external sig
+      return a*FL(2.0) - FL(1.0);
+    default:
+      break;
+    }
+    r = (MYFLT)((int32)((unsigned)rnd<<1)-BIPOLAR) * dv2_31;
+    return r;
+}
+
+static int gendyset(CSOUND *csound, GENDY *p)
+{
+    int     i;
+    MYFLT   *memamp, *memdur;
+    p->amp     = FL(0.0);
+    p->nextamp = FL(0.0);
+    p->phase   = FL(1.0);
+    p->speed   = FL(100.0);
+    p->index   = 0;
+    if (*p->initcps < FL(1.0))
+      p->points = 12;
+    else if (*p->initcps > GENDYMAXCPS)
+      p->points = GENDYMAXCPS;
+    else
+      p->points = (int32)*p->initcps;
+    csound->AuxAlloc(csound, p->points*sizeof(MYFLT), &p->memamp);
+    csound->AuxAlloc(csound, p->points*sizeof(MYFLT), &p->memdur);
+    memamp  = p->memamp.auxp;
+    memdur  = p->memdur.auxp;
+    p->rand = csoundRand31(&csound->randSeed1);
+    for (i=0; i < p->points; i++) {
+      p->rand = csoundRand31(&p->rand);
+      memamp[i] = (MYFLT)((int32)((unsigned)p->rand<<1)-BIPOLAR)*dv2_31;
+      p->rand = csoundRand31(&p->rand);
+      memdur[i] = (MYFLT)p->rand * dv2_31;
+    }
+    return OK;
+}
+
+static int kgendy(CSOUND *csound, GENDY *p)
+{
+    int     knum;
+    MYFLT   *memamp, *memdur, minfreq, maxfreq, dist;
+    knum = (int)*p->knum;
+    memamp  = p->memamp.auxp;
+    memdur  = p->memdur.auxp;
+    minfreq = *p->minfreq;
+    maxfreq = *p->maxfreq;
+    if (p->phase >= FL(1.0)) {
+      int index = p->index;
+      p->phase -= FL(1.0);
+      if (knum > p->points || knum < 1)
+        knum = p->points;
+      p->index = index = (index+1) % knum;
+      p->amp = p->nextamp;
+      p->rand = csoundRand31(&p->rand);
+      dist = gendy_distribution(csound, *p->ampdist, *p->adpar, p->rand);
+      p->nextamp = memamp[index] + *p->ampscl * dist;
+      /* amplitude variations within the boundaries of a mirror */
+      if (p->nextamp < FL(-1.0) || p->nextamp > FL(1.0)) {
+        if (p->nextamp < FL(0.0))
+          p->nextamp += FL(4.0);
+        p->nextamp = FMOD(p->nextamp, FL(4.0));
+        if (p->nextamp > FL(1.0)) {
+          p->nextamp =
+            (p->nextamp < FL(3.0) ? FL(2.0) - p->nextamp : p->nextamp - FL(4.0));
+        }
+      }
+      memamp[index] = p->nextamp;
+      p->rand = csoundRand31(&p->rand);
+      dist = gendy_distribution(csound, *p->durdist, *p->ddpar, p->rand);
+      p->dur = memdur[index] + *p->durscl * dist;
+      /* time variations within the boundaries of a mirror */
+      if (p->dur > FL(1.0))
+        p->dur = FL(2.0) - FMOD(p->dur, FL(2.0));
+      else if (p->dur < FL(0.0))
+        p->dur = FL(2.0) - FMOD(p->dur + FL(2.0), FL(2.0));
+      memdur[index] = p->dur;
+      p->speed =
+        (minfreq + (maxfreq - minfreq) * p->dur) * csound->onedsr * knum;
+    }
+    *p->out = *p->kamp * ((FL(1.0) - p->phase) * p->amp + p->phase * p->nextamp);
+    p->phase += p->speed;
+    return OK;
+}
+
+static int agendy(CSOUND *csound, GENDY *p)
+{
+    int     knum, n, nn = csound->ksmps;
+    MYFLT   *out, *memamp, *memdur, minfreq, maxfreq, dist;
+    out  = p->out;
+    knum = (int)*p->knum;
+    memamp  = p->memamp.auxp;
+    memdur  = p->memdur.auxp;
+    minfreq = *p->minfreq;
+    maxfreq = *p->maxfreq;
+    for (n=0; n<nn; n++) {
+      if (p->phase >= FL(1.0)) {
+        int index = p->index;
+        p->phase -= FL(1.0);
+        if (knum > p->points || knum < 1)
+          knum = p->points;
+        p->index = index = (index+1) % knum;
+        p->amp = p->nextamp;
+        p->rand = csoundRand31(&p->rand);
+        dist = gendy_distribution(csound, *p->ampdist, *p->adpar, p->rand);
+        p->nextamp = memamp[index] + *p->ampscl * dist;
+        if (p->nextamp < FL(-1.0) || p->nextamp > FL(1.0)) {
+          if (p->nextamp < FL(0.0))
+            p->nextamp += FL(4.0);
+          p->nextamp = FMOD(p->nextamp, FL(4.0));
+          if (p->nextamp > FL(1.0)) {
+            p->nextamp =
+              (p->nextamp < FL(3.0) ? FL(2.0) - p->nextamp : p->nextamp - FL(4.0));
+          }
+        }
+        memamp[index] = p->nextamp;
+        p->rand = csoundRand31(&p->rand);
+        dist = gendy_distribution(csound, *p->durdist, *p->ddpar, p->rand);
+        p->dur = memdur[index] + *p->durscl * dist;
+        if (p->dur > FL(1.0))
+          p->dur = FL(2.0) - FMOD(p->dur, FL(2.0));
+        else if (p->dur < FL(0.0))
+          p->dur = FL(2.0) - FMOD(p->dur + FL(2.0), FL(2.0));
+        memdur[index] = p->dur;
+        p->speed =
+          (minfreq + (maxfreq - minfreq) * p->dur) * csound->onedsr * knum;
+      }
+      out[n] = *p->kamp * ((FL(1.0) - p->phase) * p->amp + p->phase * p->nextamp);
+      p->phase += p->speed;
+    }
+    return OK;
+}
+
+static int gendyxset(CSOUND *csound, GENDYX *p)
+{
+    int     i;
+    MYFLT   *memamp, *memdur;
+    p->amp     = FL(0.0);
+    p->nextamp = FL(0.0);
+    p->phase   = FL(1.0);
+    p->speed   = FL(100.0);
+    p->index   = 0;
+    if (*p->initcps < FL(1.0))
+      p->points = 12;
+    else if (*p->initcps > GENDYMAXCPS)
+      p->points = GENDYMAXCPS;
+    else
+      p->points = (int32)*p->initcps;
+    csound->AuxAlloc(csound, p->points*sizeof(MYFLT), &p->memamp);
+    csound->AuxAlloc(csound, p->points*sizeof(MYFLT), &p->memdur);
+    memamp  = p->memamp.auxp;
+    memdur  = p->memdur.auxp;
+    p->rand = csoundRand31(&csound->randSeed1);
+    for (i=0; i < p->points; i++) {
+      p->rand   = (int32)csoundRand31(&p->rand);
+      memamp[i] = (MYFLT)((int32)((unsigned)p->rand<<1)-BIPOLAR)*dv2_31;
+      p->rand   = csoundRand31(&p->rand);
+      memdur[i] = (MYFLT)p->rand * dv2_31;
+    }
+    return OK;
+}
+
+static int kgendyx(CSOUND *csound, GENDYX *p)
+{
+    int     knum;
+    MYFLT   *memamp, *memdur, minfreq, maxfreq, dist, curve;
+    knum = (int)*p->knum;
+    memamp  = p->memamp.auxp;
+    memdur  = p->memdur.auxp;
+    minfreq = *p->minfreq;
+    maxfreq = *p->maxfreq;
+    if (p->phase >= FL(1.0)) {
+      int index = p->index;
+      p->phase -= FL(1.0);
+      if (knum > p->points || knum < 1)
+        knum = p->points;
+      p->index = index = (index+1) % knum;
+      p->amp = p->nextamp;
+      p->rand = csoundRand31(&p->rand);
+      dist = gendy_distribution(csound, *p->ampdist, *p->adpar, p->rand);
+      p->nextamp = memamp[index] + *p->ampscl * dist;
+      if (p->nextamp < FL(-1.0) || p->nextamp > FL(1.0)) {
+        if (p->nextamp < FL(0.0))
+          p->nextamp += FL(4.0);
+        p->nextamp = FMOD(p->nextamp, FL(4.0));
+        if (p->nextamp > FL(1.0)) {
+          p->nextamp =
+            (p->nextamp < FL(3.0) ? FL(2.0) - p->nextamp : p->nextamp - FL(4.0));
+        }
+      }
+      memamp[index] = p->nextamp;
+      p->rand = csoundRand31(&p->rand);
+      dist = gendy_distribution(csound, *p->durdist, *p->ddpar, p->rand);
+      p->dur = memdur[index] + *p->durscl * dist;
+      if (p->dur > FL(1.0))
+        p->dur = FL(2.0) - FMOD(p->dur, FL(2.0));
+      else if (p->dur < FL(0.0))
+        p->dur = FL(2.0) - FMOD(p->dur + FL(2.0), FL(2.0));
+      memdur[index] = p->dur;
+      p->speed =
+        (minfreq + (maxfreq - minfreq) * p->dur) * csound->onedsr * knum;
+    }
+    if (*p->kcurveup < FL(0.0))
+      *p->kcurveup = FL(0.0);
+    if (*p->kcurvedown < FL(0.0))
+      *p->kcurvedown = FL(0.0);
+    curve = ((p->nextamp - p->amp) > FL(0.0) ? *p->kcurveup : *p->kcurvedown);
+    *p->out = *p->kamp * (p->amp + POWER(p->phase, curve) * (p->nextamp - p->amp));
+    p->phase += p->speed;
+    return OK;
+}
+
+static int agendyx(CSOUND *csound, GENDYX *p)
+{
+    int     knum, n, nn = csound->ksmps;
+    MYFLT   *out, *memamp, *memdur, minfreq, maxfreq, dist, curve;
+    out  = p->out;
+    knum = (int)*p->knum;
+    memamp  = p->memamp.auxp;
+    memdur  = p->memdur.auxp;
+    minfreq = *p->minfreq;
+    maxfreq = *p->maxfreq;
+    for (n=0; n<nn; n++) {
+      if (p->phase >= FL(1.0)) {
+        int index = p->index;
+        p->phase -= FL(1.0);
+        if (knum > p->points || knum < 1)
+          knum = p->points;
+        p->index = index = (index+1) % knum;
+        p->amp = p->nextamp;
+        p->rand = csoundRand31(&p->rand);
+        dist = gendy_distribution(csound, *p->ampdist, *p->adpar, p->rand);
+        p->nextamp = memamp[index] + *p->ampscl * dist;
+        if (p->nextamp < FL(-1.0) || p->nextamp > FL(1.0)) {
+          if (p->nextamp < FL(0.0))
+            p->nextamp += FL(4.0);
+          p->nextamp = FMOD(p->nextamp, FL(4.0));
+          if (p->nextamp > FL(1.0)) {
+            p->nextamp =
+              (p->nextamp < FL(3.0) ? FL(2.0) - p->nextamp : p->nextamp - FL(4.0));
+          }
+        }
+        memamp[index] = p->nextamp;
+        p->rand = csoundRand31(&p->rand);
+        dist = gendy_distribution(csound, *p->durdist, *p->ddpar, p->rand);
+        p->dur = memdur[index] + *p->durscl * dist;
+        if (p->dur > FL(1.0))
+          p->dur = FL(2.0) - FMOD(p->dur, FL(2.0));
+        else if (p->dur < FL(0.0))
+          p->dur = FL(2.0) - FMOD(p->dur + FL(2.0), FL(2.0));
+        memdur[index] = p->dur;
+        p->speed =
+          (minfreq + (maxfreq - minfreq) * p->dur) * csound->onedsr * knum;
+      }
+      if (*p->kcurveup < FL(0.0))
+        *p->kcurveup = FL(0.0);
+      if (*p->kcurvedown < FL(0.0))
+        *p->kcurvedown = FL(0.0);
+      curve = ((p->nextamp - p->amp) > FL(0.0) ? *p->kcurveup : *p->kcurvedown);
+      out[n] = *p->kamp * (p->amp + POWER(p->phase, curve) * (p->nextamp - p->amp));
+      p->phase += p->speed;
+    }
+    return OK;
+}
+
+/* version with cubic interpolation based from Bhob Rainey's Gendy4 */
+static int gendycset(CSOUND *csound, GENDYC *p)
+{
+    int     i;
+    MYFLT   *memamp, *memdur;
+    p->amp     = FL(0.0);
+    p->nextamp = FL(0.0);
+    p->slope   = FL(0.0);
+    p->midpnt  = FL(0.0);
+    p->curve   = FL(0.0);
+    p->phase   = 0;
+    p->index   = 0;
+    if (*p->initcps < FL(1.0))
+      p->points = 12;
+    else if (*p->initcps > GENDYMAXCPS)
+      p->points = GENDYMAXCPS;
+    else
+      p->points = (int32)*p->initcps;
+    csound->AuxAlloc(csound, p->points*sizeof(MYFLT), &p->memamp);
+    csound->AuxAlloc(csound, p->points*sizeof(MYFLT), &p->memdur);
+    memamp  = p->memamp.auxp;
+    memdur  = p->memdur.auxp;
+    p->rand = csoundRand31(&csound->randSeed1);
+    for (i=0; i < p->points; i++) {
+      p->rand = csoundRand31(&p->rand);
+      memamp[i] = (MYFLT)((int32)((unsigned)p->rand<<1)-BIPOLAR)*dv2_31;
+      p->rand = csoundRand31(&p->rand);
+      memdur[i] = (MYFLT)p->rand * dv2_31;
+    }
+    return OK;
+}
+
+static int kgendyc(CSOUND *csound, GENDYC *p)
+{
+    int     knum;
+    MYFLT   *memamp, *memdur, minfreq, maxfreq, dist;
+    knum = (int)*p->knum;
+    memamp  = p->memamp.auxp;
+    memdur  = p->memdur.auxp;
+    minfreq = *p->minfreq;
+    maxfreq = *p->maxfreq;
+    if (p->phase <= 0) {
+      int     index = p->index;
+      MYFLT   fphase, next_midpnt;
+      if (knum > p->points || knum < 1)
+        knum = p->points;
+      p->index = index = (index+1) % knum;
+      p->amp = p->nextamp;
+      p->rand = csoundRand31(&p->rand);
+      dist = gendy_distribution(csound, *p->ampdist, *p->adpar, p->rand);
+      p->nextamp = memamp[index] + *p->ampscl * dist;
+      if (p->nextamp < FL(-1.0) || p->nextamp > FL(1.0)) {
+        if (p->nextamp < FL(0.0))
+          p->nextamp += FL(4.0);
+        p->nextamp = FMOD(p->nextamp, FL(4.0));
+        if (p->nextamp > FL(1.0)) {
+          p->nextamp =
+            (p->nextamp < FL(3.0) ? FL(2.0) - p->nextamp : p->nextamp - FL(4.0));
+        }
+      }
+      next_midpnt = (p->amp + p->nextamp) * 0.5;
+      memamp[index] = p->nextamp;
+      p->rand = csoundRand31(&p->rand);
+      dist = gendy_distribution(csound, *p->durdist, *p->ddpar, p->rand);
+      p->dur = memdur[index] + *p->durscl * dist;
+      if (p->dur > FL(1.0))
+        p->dur = FL(2.0) - FMOD(p->dur, FL(2.0));
+      else if (p->dur < FL(0.0))
+        p->dur = FL(2.0) - FMOD(p->dur + FL(2.0), FL(2.0));
+      memdur[index] = p->dur;
+      fphase = (minfreq + (maxfreq - minfreq) * p->dur) * knum;
+      fphase = (fphase > FL(0.001) ? fphase : FL(0.001));
+      p->phase = (int32)(csound->esr / fphase);
+      if (p->phase < 2) p->phase = 2;
+      p->curve = FL(2.0) * (next_midpnt - p->midpnt - p->phase * p->slope);
+      p->curve = p->curve / (p->phase * p->phase + p->phase);
+    }
+    p->phase--;
+    *p->out = *p->kamp * p->midpnt;
+    p->slope  += p->curve;
+    p->midpnt += p->slope;
+
+    return OK;
+}
+
+static int agendyc(CSOUND *csound, GENDYC *p)
+{
+    int     knum, remain = csound->ksmps;
+    MYFLT   *out, *memamp, *memdur, minfreq, maxfreq, dist;
+    out  = p->out;
+    knum = (int)*p->knum;
+    memamp  = p->memamp.auxp;
+    memdur  = p->memdur.auxp;
+    minfreq = *p->minfreq;
+    maxfreq = *p->maxfreq;
+    do {
+      int nsmps, n;
+      if (p->phase <= 0) {
+        int     index = p->index;
+        MYFLT   fphase, next_midpnt;
+        if (knum > p->points || knum < 1)
+          knum = p->points;
+        p->index = index = (index+1) % knum;
+        p->amp = p->nextamp;
+        p->rand = csoundRand31(&p->rand);
+        dist = gendy_distribution(csound, *p->ampdist, *p->adpar, p->rand);
+        p->nextamp = memamp[index] + *p->ampscl * dist;
+        if (p->nextamp < FL(-1.0) || p->nextamp > FL(1.0)) {
+          if (p->nextamp < FL(0.0))
+            p->nextamp += FL(4.0);
+          p->nextamp = FMOD(p->nextamp, FL(4.0));
+          if (p->nextamp > FL(1.0)) {
+            p->nextamp =
+              (p->nextamp < FL(3.0) ? FL(2.0) - p->nextamp : p->nextamp - FL(4.0));
+          }
+        }
+        next_midpnt = (p->amp + p->nextamp) * 0.5;
+        memamp[index] = p->nextamp;
+        p->rand = csoundRand31(&p->rand);
+        dist = gendy_distribution(csound, *p->durdist, *p->ddpar, p->rand);
+        p->dur = memdur[index] + *p->durscl * dist;
+        if (p->dur > FL(1.0))
+          p->dur = FL(2.0) - FMOD(p->dur, FL(2.0));
+        else if (p->dur < FL(0.0))
+          p->dur = FL(2.0) - FMOD(p->dur + FL(2.0), FL(2.0));
+        memdur[index] = p->dur;
+        fphase = (minfreq + (maxfreq - minfreq) * p->dur) * knum;
+        fphase = (fphase > FL(0.001) ? fphase : FL(0.001));
+        p->phase = (int32)(csound->esr / fphase);
+        if (p->phase < 2) p->phase = 2;
+        p->curve = FL(2.0) * (next_midpnt - p->midpnt - p->phase * p->slope);
+        p->curve = p->curve / (p->phase * p->phase + p->phase);
+      }
+      nsmps = (remain < p->phase ? remain : p->phase);
+      remain   -= nsmps;
+      p->phase -= nsmps;
+      for (n=0; n<nsmps; n++) {
+        *(out++) = *p->kamp * p->midpnt;
+        p->slope  += p->curve;
+        p->midpnt += p->slope;
+      }
+    } while (remain);
+    return OK;
+}
+
+static OENTRY gendy_localops[] = {
+  { "gendy",    0xffff                                   },
+  { "gendyx",   0xffff                                   },
+  { "gendyc",   0xffff                                   },
+  { "gendy.k",  sizeof(GENDY),  3, "k", "kkkkkkkkkoO",
+    (SUBR)gendyset,  (SUBR)kgendy,  (SUBR)NULL           },
+  { "gendy.a",  sizeof(GENDY),  5, "a", "kkkkkkkkkoO",
+    (SUBR)gendyset,  (SUBR)NULL,    (SUBR)agendy         },
+  { "gendyx.k", sizeof(GENDYX), 3, "k", "kkkkkkkkkkkoO",
+    (SUBR)gendyxset, (SUBR)kgendyx, (SUBR)NULL           },
+  { "gendyx.a", sizeof(GENDYX), 5, "a", "kkkkkkkkkkkoO",
+    (SUBR)gendyxset, (SUBR)NULL,    (SUBR)agendyx        },
+  { "gendyc.k", sizeof(GENDYC), 3, "k", "kkkkkkkkkoO",
+    (SUBR)gendycset, (SUBR)kgendyc, (SUBR)NULL           },
+  { "gendyc.a", sizeof(GENDYC), 5, "a", "kkkkkkkkkoO",
+    (SUBR)gendycset, (SUBR)NULL,    (SUBR)agendyc        }
+};
+
+LINKAGE1(gendy_localops)
diff --git a/Opcodes/hrtfopcodes.c b/Opcodes/hrtfopcodes.c
index 53ed39f..3587c62 100644
--- a/Opcodes/hrtfopcodes.c
+++ b/Opcodes/hrtfopcodes.c
@@ -1227,12 +1227,12 @@ static int hrtfmove_process(CSOUND *csound, hrtfmove *p)
                       {
                         outl[i] = ((outlold[i] +
                                     (i<overlapsize ? overlapoldl[i] : 0)) *
-                                   (FL(1.0) - l / fadebuffer)) +
+                                   (FL(1.0) - FL(l) / fadebuffer)) +
                           ((outl[i] + (i < overlapsize ? overlapl[i] : 0)) *
                            FL(l)/fadebuffer);
                         outr[i] = ((outrold[i] +
                                     (i<overlapsize ? overlapoldr[i] : 0)) *
-                                   (FL(1.0) - l / fadebuffer)) +
+                                   (FL(1.0) - FL(l) / fadebuffer)) +
                           ((outr[i] + (i < overlapsize ? overlapr[i] : 0)) *
                            FL(l)/fadebuffer);
                         l++;
diff --git a/Opcodes/hrtfreverb.c b/Opcodes/hrtfreverb.c
index bdc6dfe..ff57680 100644
--- a/Opcodes/hrtfreverb.c
+++ b/Opcodes/hrtfreverb.c
@@ -874,7 +874,7 @@ int hrtfreverb_process(CSOUND *csound, hrtfreverb *p)
 
     /* delay line iterators */
     int u, v, w, x, y, z;
-    int ut, vt, wt, xt, yt, zt;
+    int ut=0, vt=0, wt=0, xt=0, yt=0, zt=0;
     int utf1=0, vtf1=0, wtf1=0, xtf1=0, ytf1=0, ztf1=0;
     int utf2=0, vtf2=0, wtf2=0, xtf2=0, ytf2=0, ztf2=0;
 
@@ -975,10 +975,10 @@ int hrtfreverb_process(CSOUND *csound, hrtfreverb *p)
         yt = p->yt;
         zt = p->zt;
       }
-    else {
-      printf("Should not get here\n");
-      ut = vt = wt = xt = yt = zt = 0;
-    }
+    /* else { */
+    /*   printf("Should not get here\n"); */
+    /*   ut = vt = wt = xt = yt = zt = 0; */
+    /* } */
     if(M==24)
       {
         utf1 = p->utf1;
diff --git a/Opcodes/jacko.cpp b/Opcodes/jacko.cpp
index 2cb5657..486663b 100644
--- a/Opcodes/jacko.cpp
+++ b/Opcodes/jacko.cpp
@@ -1565,7 +1565,7 @@ extern "C"
       sizeof(JackoMidiOut),
       3,
       (char *)"",
-      (char *)"Skkkj",
+      (char *)"SkkkO",
       (SUBR)&JackoMidiOut::init_,
       (SUBR)&JackoMidiOut::kontrol_,
       0,
diff --git a/Opcodes/midiops2.c b/Opcodes/midiops2.c
index c1bee5d..be3814e 100644
--- a/Opcodes/midiops2.c
+++ b/Opcodes/midiops2.c
@@ -52,6 +52,9 @@ static int imidic7(CSOUND *csound, MIDICTL2 *p)
     FUNC  *ftp;
     int32  ctlno;
 
+    if (!p->h.insdshead->m_chnbp) {
+      return OK;
+    }
     if (UNLIKELY((ctlno = (int32)*p->ictlno) < 0 || ctlno > 127))
       return csound->InitError(csound, Str("illegal controller number"));
     else {
@@ -87,6 +90,9 @@ static int midic7(CSOUND *csound, MIDICTL2 *p)
     MYFLT value;
     INSDS *lcurip = p->h.insdshead;
 
+    if (!p->h.insdshead->m_chnbp) {
+      return OK;
+    }
     value = (MYFLT) (lcurip->m_chnbp->ctl_val[p->ctlno] * oneTOf7bit);
     if (p->flag)  {             /* if valid ftable,use value as index   */
       value = *(p->ftp->ftable +
@@ -106,6 +112,9 @@ static int imidic14(CSOUND *csound, MIDICTL3 *p)
     int32  ctlno1;
     int32  ctlno2;
 
+    if (!p->h.insdshead->m_chnbp) {
+      return OK;
+    }
     if (UNLIKELY((ctlno1 = (int32)*p->ictlno1) < 0 || ctlno1 > 127 ||
                  (ctlno2 = (int32)*p->ictlno2) < 0 || ctlno2 > 127 ))
       return csound->InitError(csound, Str("illegal controller number"));
@@ -161,6 +170,9 @@ static int midic14(CSOUND *csound, MIDICTL3 *p)
     MYFLT value;
     INSDS *lcurip = p->h.insdshead;
 
+    if (!p->h.insdshead->m_chnbp) {
+      return OK;
+    }
     value =     (MYFLT) ((lcurip->m_chnbp->ctl_val[p->ctlno1] *128  +
                           lcurip->m_chnbp->ctl_val[p->ctlno2] )
                          * oneTOf14bit);
@@ -200,6 +212,9 @@ static int imidic21(CSOUND *csound, MIDICTL4 *p)
     int32   ctlno2;
     int32   ctlno3;
 
+    if (!p->h.insdshead->m_chnbp) {
+      return OK;
+    }
     if (UNLIKELY((ctlno1 = (int32)*p->ictlno1) < 0 || ctlno1 > 127 ||
         (ctlno2 = (int32)*p->ictlno2) < 0 || ctlno2 > 127 ||
                  (ctlno3 = (int32)*p->ictlno3) < 0 || ctlno3 > 127))
@@ -255,6 +270,9 @@ static int midic21(CSOUND *csound, MIDICTL4 *p)
     MYFLT value;
     INSDS *lcurip = p->h.insdshead;
 
+    if (!p->h.insdshead->m_chnbp) {
+      return OK;
+    }
     value = (MYFLT)((lcurip->m_chnbp->ctl_val[p->ctlno1] * 16384 +
                      lcurip->m_chnbp->ctl_val[p->ctlno2] * 128   +
                      lcurip->m_chnbp->ctl_val[p->ctlno3] )  * oneTOf21bit);
diff --git a/Opcodes/mp3in.c b/Opcodes/mp3in.c
index 7a92959..41b5dff 100644
--- a/Opcodes/mp3in.c
+++ b/Opcodes/mp3in.c
@@ -51,6 +51,13 @@ typedef struct {
     MYFLT   *iFileCode;
 } MP3LEN;
 
+int mp3in_cleanup(CSOUND *csound, MP3IN *p)
+{
+    if (p->mpa != NULL)
+      mp3dec_uninit(p->mpa);
+    return OK;
+}
+
 int mp3ininit(CSOUND *csound, MP3IN *p)
 {
     char    name[1024];
@@ -89,6 +96,7 @@ int mp3ininit(CSOUND *csound, MP3IN *p)
     if (UNLIKELY(csound->FileOpen2(csound, &fd, CSFILE_FD_R,
                                    name, "rb", "SFDIR;SSDIR",
                                    CSFTYPE_OTHER_BINARY, 0) == NULL)) {
+      mp3dec_uninit(mpa);
       return
         csound->InitError(csound, Str("mp3in: %s: failed to open file"), name);
     }
@@ -105,7 +113,7 @@ int mp3ininit(CSOUND *csound, MP3IN *p)
       mp3dec_uninit(mpa);
       return csound->InitError(csound, mp3dec_error(r));
     }
-    skip = (int)(*p->iSkipTime*csound->esr);
+    skip = (int)(*p->iSkipTime*csound->esr+1);
     /* maxsize = mpainfo.decoded_sample_size */
     /*          *mpainfo.decoded_frame_samples */
     /*          *mpainfo.frames; */
@@ -158,6 +166,8 @@ int mp3ininit(CSOUND *csound, MP3IN *p)
     /* done initialisation */
     p->initDone = -1;
     p->pos = 0;
+    csound->RegisterDeinitCallback(csound, p,
+                                   (int (*)(CSOUND*, void*)) mp3in_cleanup);
     return OK;
 }
 
@@ -227,6 +237,7 @@ int mp3len(CSOUND *csound, MP3LEN *p)
     if (UNLIKELY(csound->FileOpen2(csound, &fd, CSFILE_FD_R,
                                    name, "rb", "SFDIR;SSDIR",
                                    CSFTYPE_OTHER_BINARY, 0) == NULL)) {
+      mp3dec_uninit(mpa);
       return
         csound->InitError(csound, Str("mp3in: %s: failed to open file"), name);
     }
@@ -242,6 +253,7 @@ int mp3len(CSOUND *csound, MP3LEN *p)
     }
     close(fd);
     *p->ir = (MYFLT)mpainfo.duration;
+    mp3dec_uninit(mpa);
     return OK;
 }
 
diff --git a/Opcodes/mutexops.cpp b/Opcodes/mutexops.cpp
deleted file mode 100644
index e610015..0000000
--- a/Opcodes/mutexops.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-    mutexops.cpp:
-
-    Copyright (C) 2007 by Steven Yi
-
-    Mutex lock and unlocking opcodes, used for when running Csound with
-    multiple threads
-
-    This file is part of Csound.
-
-    The Csound Library is free software; you can redistribute it
-    and/or modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    Csound 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 Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with Csound; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-    02111-1307 USA
-*/
-#include "csdl.h"
-#include "csGblMtx.h"
-#include <map>
-
-static std::map<CSOUND *, std::map<size_t, std::map<size_t, void *> > > mutexes;
-
-typedef struct {
-        OPDS    h;
-        MYFLT   *ilocknum;
-        void    *mutex;
-} OPCODE_MUTEX;
-
-static void * getMutex(CSOUND *csound, size_t instrNum, size_t lockNum)
-{
-
-    csound_global_mutex_lock();
-    if(mutexes.find(csound) == mutexes.end()) {
-        std::map<size_t, std::map<size_t, void *> > values;
-        mutexes[csound] = values;
-    }
-
-    if(mutexes[csound].find(instrNum) == mutexes[csound].end()) {
-        std::map<size_t, void*> mutexMap;
-        mutexes[csound][instrNum] = mutexMap;
-    }
-
-    if (mutexes[csound][instrNum].find(lockNum) ==
-        mutexes[csound][instrNum].end()) {
-        void * mutex = csound->Create_Mutex(0);
-        mutexes[csound][instrNum][lockNum] = mutex;
-
-        csound->Message(csound, "Created new mutex [%ld:%ld]\n",
-                        (long)instrNum, (long)lockNum);
-    }
-    csound_global_mutex_unlock();
-
-    return mutexes[csound][instrNum][lockNum];
-
-}
-
-static int mutexLock(CSOUND *csound, OPCODE_MUTEX *p)
-{
-
-    if(p->mutex == NULL) {
-        size_t instrNum = static_cast<size_t>(p->h.insdshead->p1);
-        size_t lockNum = static_cast<size_t>(*p->ilocknum);
-
-        p->mutex = getMutex(csound, instrNum, lockNum);
-    }
-
-    csound->LockMutex(p->mutex);
-
-    return OK;
-}
-
-static int mutexUnlock(CSOUND *csound, OPCODE_MUTEX *p)
-{
-    if(p->mutex == NULL) {
-        size_t instrNum = static_cast<size_t>(p->h.insdshead->p1);
-        size_t lockNum = static_cast<size_t>(*p->ilocknum);
-
-        p->mutex = getMutex(csound, instrNum, lockNum);
-    }
-
-    csound->UnlockMutex(p->mutex);
-
-    return OK;
-}
-
-#define S(x)    sizeof(x)
-
-OENTRY mutex_localops[] = {
-  { (char*)"mutex_lock",   S(OPCODE_MUTEX),  2, (char*)"", (char*)"i",
-    NULL, (SUBR)mutexLock, NULL   },
-  { (char*)"mutex_unlock",  S(OPCODE_MUTEX), 2, (char*)"", (char*)"i",
-    NULL, (SUBR)mutexUnlock, NULL },
-  { (char*)"mutex_locki",  S(OPCODE_MUTEX),  1, (char*)"", (char*)"i",
-    (SUBR)mutexLock, NULL, NULL   },
-  { (char*)"mutex_unlocki", S(OPCODE_MUTEX), 1, (char*)"", (char*)"i",
-    (SUBR)mutexUnlock, NULL, NULL }
-};
-
-
-LINKAGE1(mutex_localops)
diff --git a/Opcodes/physmod.c b/Opcodes/physmod.c
index cfa693b..186fc15 100644
--- a/Opcodes/physmod.c
+++ b/Opcodes/physmod.c
@@ -927,7 +927,7 @@ static OENTRY physmod_localops[] = {
 { "wgbrass", S(BRASS), TR|5, "a", "kkkikkio", (SUBR)brassset, NULL,     (SUBR)brass},
 { "mandol", S(MANDOL), TR|5, "a", "kkkkkkio", (SUBR)mandolinset, NULL,(SUBR)mandolin},
 { "voice", S(VOICF),   TR|5, "a", "kkkkkkii", (SUBR)voicformset, NULL,(SUBR)voicform},
-{ "fmbell",  S(FM4OP), TR|5, "a", "kkkkkkiiiii",
+{ "fmbell",  S(FM4OP), TR|5, "a", "kkkkkkiiiiio",
                                             (SUBR)tubebellset,NULL,(SUBR)tubebell},
 { "fmrhode", S(FM4OP), TR|5, "a", "kkkkkkiiiii",(SUBR)rhodeset,NULL,  (SUBR)tubebell},
 { "fmwurlie", S(FM4OP),TR|5, "a", "kkkkkkiiiii",(SUBR)wurleyset, NULL,(SUBR) wurley },
diff --git a/Opcodes/pitch.c b/Opcodes/pitch.c
index c4061cf..2778754 100644
--- a/Opcodes/pitch.c
+++ b/Opcodes/pitch.c
@@ -1544,141 +1544,6 @@ int clip(CSOUND *csound, CLIP *p)
     return OK;
 }
 
-#ifdef BETA
-/* ********************************************************************** */
-/* *************** EXPERIMENT ******************************************* */
-/* ********************************************************************** */
-
-#include "ugens2.h"
-
-int Foscset(CSOUND *csound, XOSC *p)
-{
-    FUNC        *ftp;
-
-    if ((ftp = csound->FTnp2Find(csound,p->ifn)) != NULL) { /*Allow any length*/
-      p->ftp = ftp;
-      if (*p->iphs >= 0) {
-        p->lphs = *p->iphs * ftp->flen;
-        while (p->lphs>ftp->flen) p->lphs -= ftp->flen;
-      }
-      else
-        p->lphs = FL(0.0);
-    }
-    return OK;
-}
-
-int Fosckk(CSOUND *csound, XOSC *p)
-{
-    FUNC        *ftp;
-    MYFLT       amp, *ar, *ftbl;
-    MYFLT       inc, phs;
-    int n, nsmps = csound->ksmps;
-    int flen;
-
-    ftp = p->ftp;
-    if (UNLIKELY(ftp==NULL)) {
-      return csound->PerfError(csound, Str("oscil: not initialised"));
-    }
-    flen = ftp->flen;
-    ftbl = ftp->ftable;
-    phs = p->lphs;
-    inc = (*p->xcps * flen) * csound->onedsr;
-    amp = *p->xamp;
-    ar = p->sr;
-    for (n=0; n<nsmps; n++) {
-      ar[n] = *(ftbl + (int)(phs)) * amp;
-      phs += inc;
-      if (phs>flen) phs -= flen;
-    }
-    p->lphs = phs;
-    return OK;
-}
-
-int Foscak(CSOUND *csound, XOSC *p)
-{
-    FUNC        *ftp;
-    MYFLT       *ampp, *ar, *ftbl;
-    MYFLT       inc, phs;
-    int n, nsmps = csound->ksmps;
-    int flen;
-
-    ftp = p->ftp;
-    if (UNLIKELY(ftp==NULL)) {
-      return csound->PerfError(csound, Str("oscil: not initialised"));
-    }
-    flen = ftp->flen;
-    ftbl = ftp->ftable;
-    phs = p->lphs;
-    inc = (*p->xcps * flen) * csound->onedsr;
-    ampp = p->xamp;
-    ar = p->sr;
-    for (n=0; n<nsmps; n++) {
-      ar[n] = *(ftbl + (int)(phs)) * ampp[n];
-      phs += inc;
-      if (phs>flen) phs -= flen;
-    }
-    p->lphs = phs;
-    return OK;
-}
-
-int Foscka(CSOUND *csound, XOSC *p)
-{
-    FUNC        *ftp;
-    MYFLT       amp, *ar, *cpsp, *ftbl;
-    MYFLT       inc, phs;
-    int n, nsmps = csound->ksmps;
-    int flen;
-
-    ftp = p->ftp;
-    if (UNLIKELY(ftp==NULL)) {
-      return csound->PerfError(csound, Str("oscil: not initialised"));
-    }
-    flen = ftp->flen;
-    ftbl = ftp->ftable;
-    phs = p->lphs;
-    inc = (*p->xcps * flen) * csound->onedsr;
-    amp = *p->xamp;
-    cpsp = p->xcps;
-    ar = p->sr;
-    for (n=0; n<nsmps; n++) {
-      MYFLT inc = (cpsp[n] *flen * csound->onedsr);
-      ar[n] = *(ftbl + (int)(phs)) * amp;
-      phs += inc;
-      if (phs>flen) phs -= flen;
-    }
-    p->lphs = phs;
-    return OK;
-}
-
-int Foscaa(CSOUND *csound, XOSC *p)
-{
-    FUNC        *ftp;
-    MYFLT       *ampp, *ar, *ftbl;
-    MYFLT       phs;
-    int n, nsmps = csound->ksmps;
-    int flen;
-
-    ftp = p->ftp;
-    if (UNLIKELY(ftp==NULL)) {
-      return csound->PerfError(csound, Str("oscil: not initialised"));
-    }
-    flen = ftp->flen;
-    ftbl = ftp->ftable;
-    phs = p->lphs;
-    ampp = p->xamp;
-    ar = p->sr;
-    for (n=0; n<nsmps; n++) {
-      MYFLT inc = (p->xcps[n] * flen) * csound->onedsr;
-      ar[n] = *(ftbl + (int)(phs)) * ampp[n];
-      phs += inc;
-      if (phs>flen) phs -= flen;
-    }
-    p->lphs = phs;
-    return OK;
-}
-
-#endif
-
 /* ********************************************************************** */
 /* *************** IMPULSE ********************************************** */
 /* ********************************************************************** */
diff --git a/Opcodes/pitch.h b/Opcodes/pitch.h
index 1d9f3c8..6f683b5 100644
--- a/Opcodes/pitch.h
+++ b/Opcodes/pitch.h
@@ -235,6 +235,13 @@ typedef struct {
 typedef struct {
         OPDS    h;
         MYFLT   *ans;
+        MYFLT   *pnum;
+        AUXCH   pfield;
+} PFUNK;
+
+typedef struct {
+        OPDS    h;
+        MYFLT   *ans;
         MYFLT   *asig;
         MYFLT   *kwind;
         MYFLT   *imaxsize;
@@ -279,6 +286,8 @@ int macset(CSOUND *, SUM *p);
 int maxalloc(CSOUND *, CPU_PERC *p);
 int mute_inst(CSOUND *, MUTE *p);
 int pfun(CSOUND *, PFUN *p);
+int pfunk_init(CSOUND *, PFUNK *p);
+int pfunk(CSOUND *, PFUNK *p);
 int phsbnkset(CSOUND *, PHSORBNK *p);
 int phsorbnk(CSOUND *, PHSORBNK *p);
 int pinkish(CSOUND *, PINKISH *p);
diff --git a/Opcodes/pitch0.c b/Opcodes/pitch0.c
index b80c8b3..817f9e3 100644
--- a/Opcodes/pitch0.c
+++ b/Opcodes/pitch0.c
@@ -90,3 +90,32 @@ int pfun(CSOUND *csound, PFUN *p)
     return OK;
 }
 
+int pfunk_init(CSOUND *csound, PFUNK *p)
+{
+    int i, n = (int)MYFLT2LONG(*p->pnum);
+    MYFLT ans, *pfield;
+    if (n<1 || n>PMAX) ans = FL(0.0);
+    else ans = csound->currevent->p[n];
+    /* save the pfields of the current event */
+    csound->AuxAlloc(csound, (csound->currevent->pcnt+1)*sizeof(MYFLT), &p->pfield);
+    pfield = p->pfield.auxp;
+    for (i=1; i<=csound->currevent->pcnt; i++)
+      pfield[i] = csound->currevent->p[i];
+    *p->ans = ans;
+    return OK;
+}
+
+int pfunk(CSOUND *csound, PFUNK *p)
+{
+    int n = (int)MYFLT2LONG(*p->pnum);
+    MYFLT ans, *pfield;
+    if (n<1 || n>PMAX) {
+      ans = FL(0.0);
+    }
+    else {
+      pfield = p->pfield.auxp;
+      ans = pfield[n];
+    }
+    *p->ans = ans;
+    return OK;
+}
diff --git a/Opcodes/pvs_ops.c b/Opcodes/pvs_ops.c
index 255c8ee..a603e64 100644
--- a/Opcodes/pvs_ops.c
+++ b/Opcodes/pvs_ops.c
@@ -29,7 +29,7 @@ PUBLIC int csoundModuleCreate(CSOUND *csound)
 }
 */
 
-PUBLIC int pvsopc_ModuleInit(CSOUND *csound)
+int pvsopc_ModuleInit(CSOUND *csound)
 {
     int     err = 0;
 
diff --git a/Opcodes/pvsbasic.c b/Opcodes/pvsbasic.c
index b282511..247da60 100644
--- a/Opcodes/pvsbasic.c
+++ b/Opcodes/pvsbasic.c
@@ -2142,13 +2142,14 @@ typedef struct pvs2tab_t {
     PVSDAT *fsig;
 } PVS2TAB_T;
 
-int pvs2tab_init(CSOUND *csound, PVS2TAB_T *p){
-  if (UNLIKELY(!(p->fsig->format == PVS_AMP_FREQ) ||
+int pvs2tab_init(CSOUND *csound, PVS2TAB_T *p)
+{
+    if (UNLIKELY(!(p->fsig->format == PVS_AMP_FREQ) ||
                  (p->fsig->format == PVS_AMP_PHASE)))
       return csound->InitError(csound, Str("pvs2tab: signal format "
                                            "must be amp-phase or amp-freq."));
-  if (LIKELY(p->ans->data)) return OK;
-  return csound->InitError(csound, Str("t-variable not initialised"));
+    if (LIKELY(p->ans->data)) return OK;
+    return csound->InitError(csound, Str("t-variable not initialised"));
 }
 
 int  pvs2tab(CSOUND *csound, PVS2TAB_T *p){
@@ -2169,38 +2170,40 @@ typedef struct tab2pvs_t {
     uint32  lastframe;
 } TAB2PVS_T;
 
-int tab2pvs_init(CSOUND *csound, TAB2PVS_T *p){
-  if (LIKELY(p->in->data)){
-    int N;
-    p->fout->N = N = p->in->size - 2;
-    p->fout->overlap = (int32)(*p->olap ? *p->olap : N/4);
-    p->fout->winsize = (int32)(*p->winsize ? *p->winsize : N);
-    p->fout->wintype = (int32) *p->wintype;
-    p->fout->format = 0;
-    p->fout->framecount = 1;
-    p->lastframe = 0;
-   if (p->fout->frame.auxp == NULL || p->fout->frame.size < sizeof(float) * (N + 2)) {
-          csound->AuxAlloc(csound, (N + 2) * sizeof(float), &p->fout->frame);
-     }
+int tab2pvs_init(CSOUND *csound, TAB2PVS_T *p)
+{
+    if (LIKELY(p->in->data)){
+      int N;
+      p->fout->N = N = p->in->size - 2;
+      p->fout->overlap = (int32)(*p->olap ? *p->olap : N/4);
+      p->fout->winsize = (int32)(*p->winsize ? *p->winsize : N);
+      p->fout->wintype = (int32) *p->wintype;
+      p->fout->format = 0;
+      p->fout->framecount = 1;
+      p->lastframe = 0;
+      if (p->fout->frame.auxp == NULL ||
+          p->fout->frame.size < sizeof(float) * (N + 2)) {
+        csound->AuxAlloc(csound, (N + 2) * sizeof(float), &p->fout->frame);
+      }
 
-  memset(p->fout->frame.auxp, sizeof(float)*(N+2), 0);
-  return OK;
-  }
-  else return csound->InitError(csound, Str("t-variable not initialised"));
+      memset(p->fout->frame.auxp, 0, sizeof(float)*(N+2));
+      return OK;
+    }
+    else return csound->InitError(csound, Str("t-variable not initialised"));
 }
 
-int  tab2pvs(CSOUND *csound, TAB2PVS_T *p){
- 
-  int size = p->in->size, i;
-  float *fout = (float *) p->fout->frame.auxp;
+int  tab2pvs(CSOUND *csound, TAB2PVS_T *p)
+{
+    int size = p->in->size, i;
+    float *fout = (float *) p->fout->frame.auxp;
   
-  if(p->lastframe < p->fout->framecount){
-    for(i = 0; i < size; i++){
-      fout[i] = (float) p->in->data[i]; 
-    } 
-    p->lastframe = p->fout->framecount;
-  }
-  return OK;
+    if (p->lastframe < p->fout->framecount){
+      for (i = 0; i < size; i++){
+        fout[i] = (float) p->in->data[i]; 
+      } 
+      p->lastframe = p->fout->framecount;
+    }
+    return OK;
 }
 
 
diff --git a/Opcodes/sfont.c b/Opcodes/sfont.c
index 82cd1e4..c679e32 100644
--- a/Opcodes/sfont.c
+++ b/Opcodes/sfont.c
@@ -67,7 +67,7 @@ typedef struct _sfontg {
   MYFLT pitches[128];
 } sfontg;
 
-PUBLIC int sfont_ModuleDestroy(CSOUND *csound)
+int sfont_ModuleDestroy(CSOUND *csound)
 {
     int j,k,l;
     SFBANK *sfArray;
@@ -2525,7 +2525,7 @@ static OENTRY localops[] = {
 { NULL, 0, 0, NULL, NULL, (SUBR) NULL, (SUBR) NULL, (SUBR) NULL }
 };
 
-PUBLIC int sfont_ModuleCreate(CSOUND *csound)
+int sfont_ModuleCreate(CSOUND *csound)
 {
     int j;
     sfontg *globals;
@@ -2546,7 +2546,7 @@ PUBLIC int sfont_ModuleCreate(CSOUND *csound)
     return OK;
 }
 
-PUBLIC int sfont_ModuleInit(CSOUND *csound)
+int sfont_ModuleInit(CSOUND *csound)
 {
     OENTRY  *ep = (OENTRY*) &(localops[0]);
     int     err = 0;
diff --git a/Opcodes/singwave.c b/Opcodes/singwave.c
index 5f5da2d..ac6d1c8 100644
--- a/Opcodes/singwave.c
+++ b/Opcodes/singwave.c
@@ -420,7 +420,7 @@ int voicform(CSOUND *csound, VOICF *p)
       lastOutput *= p->lastGain;
       //      printf("%f ", lastOutput);
       //      printf("->%f\n", lastOutput* AMP_SCALE);
-      ar[n] = lastOutput * FL(0.22) * AMP_SCALE;
+      ar[n] = lastOutput * FL(0.22) * AMP_SCALE * *p->amp;
     }
 
     return OK;
diff --git a/Opcodes/sndloop.c b/Opcodes/sndloop.c
index 2ce8c3c..74b3f6c 100644
--- a/Opcodes/sndloop.c
+++ b/Opcodes/sndloop.c
@@ -652,11 +652,11 @@ static int flooper2_process(CSOUND *csound, flooper2 *p)
 }
 
 
-
+/*
 static int flooper3_init(CSOUND *csound, flooper3 *p)
 {
     int len,i,p2s,lomod;
-    p->sfunc = csound->FTnp2Find(csound, p->ifn);  /* function table */
+    p->sfunc = csound->FTnp2Find(csound, p->ifn);  
     if (UNLIKELY(p->sfunc==NULL)) {
       return csound->InitError(csound,Str("function table not found\n"));
     }
@@ -703,7 +703,7 @@ static int flooper3_process(CSOUND *csound, flooper3 *p)
     int *firsttime = &p->firsttime, elen, init = p->init;
     uint32 tndx0, tndx1;
 
-    /* loop parameters & check */
+
     if (pitch < FL(0.0)) pitch = FL(0.0);
     if (*firsttime) {
       int loopsize;
@@ -832,7 +832,7 @@ static int flooper3_process(CSOUND *csound, flooper3 *p)
       }
       else if (mode == 2){
         out[i] = 0;
-        /* this is the forward reader */
+        
         tndx0 = ndx[0]>>lobits;
         frac0 = (ndx[0] & lomask)*lodiv;
         if (init && tndx0 < loop_start + crossfade) {
@@ -870,7 +870,7 @@ static int flooper3_process(CSOUND *csound, flooper3 *p)
           count  += ei;
         }
 
-        /* this is the backward reader */
+        
         tndx1 = ndx[1]>>lobits;
         frac1 = (ndx[1] & lomask)*lodiv;
         if (tndx1 > loop_end - crossfade) {
@@ -923,7 +923,7 @@ static int flooper3_process(CSOUND *csound, flooper3 *p)
     p->init = init;
     return OK;
 }
-
+*/
 
 static int pvsarp_init(CSOUND *csound, pvsarp *p)
 {
@@ -1133,8 +1133,8 @@ static OENTRY localops[] = {
    "f", "ffkkO", (SUBR)pvsvoc_init, (SUBR)pvsvoc_process},
   {"flooper2", sizeof(flooper2), TR|5,
    "a", "kkkkkiooooO", (SUBR)flooper2_init, NULL, (SUBR)flooper2_process},
- {"flooper3", sizeof(flooper3), TR|5,
-  "a", "kkkkkioooo", (SUBR)flooper3_init, NULL, (SUBR)flooper3_process},
+  /* {"flooper3", sizeof(flooper3), TR|5,
+     "a", "kkkkkioooo", (SUBR)flooper3_init, NULL, (SUBR)flooper3_process},*/
  {"pvsmorph", sizeof(pvsvoc), 3,
    "f", "ffkk", (SUBR)pvsmorph_init, (SUBR)pvsmorph_process}
 };
diff --git a/Opcodes/sndwarp.c b/Opcodes/sndwarp.c
index b398c27..f892fe1 100644
--- a/Opcodes/sndwarp.c
+++ b/Opcodes/sndwarp.c
@@ -70,7 +70,7 @@ static int sndwarpgetset(CSOUND *csound, SNDWARP *p)
     for (i=0; i< *p->ioverlap; i++) {
       if (i==0) {
         exp[i].wsize = (int)iwsize;
-        exp[1].cnt = 0;
+        exp[i].cnt = 0;
         exp[i].ampphs = FL(0.0);
       }
       else {
diff --git a/Opcodes/spectra.c b/Opcodes/spectra.c
index 005dda4..0f8d945 100644
--- a/Opcodes/spectra.c
+++ b/Opcodes/spectra.c
@@ -1247,15 +1247,8 @@ static OENTRY spectra_localops[] = {
 { "active.i", S(INSTCNT),1,     "i",    "To",    (SUBR)instcount, NULL, NULL },
 { "active.k", S(INSTCNT),2,     "k",    "Uo",    NULL, (SUBR)instcount, NULL },
 { "p.i", S(PFUN),        1,     "i",    "i",     (SUBR)pfun, NULL, NULL     },
-{ "p.k", S(PFUN),        2,     "k",    "k",     NULL, (SUBR)pfun, NULL     },
+{ "p.k", S(PFUNK),       3,     "k",    "k",     (SUBR)pfunk_init, (SUBR)pfunk, NULL },
 { "mute", S(MUTE), 1,          "",      "To",   (SUBR)mute_inst             },
-#ifdef BETA
-{ "oscilv",  0xfffe,    TR                                                     },
-{ "oscilv.kk", S(XOSC),  5,     "a",   "kkio", (SUBR)Foscset, NULL, (SUBR)Fosckk },
-{ "oscilv.ka", S(XOSC),  5,     "a",   "kaio", (SUBR)Foscset, NULL, (SUBR)Foscka },
-{ "oscilv.ak", S(XOSC),  5,     "a",   "akio", (SUBR)Foscset, NULL, (SUBR)Foscak },
-{ "oscilv.aa", S(XOSC),  5,     "a",   "aaio", (SUBR)Foscset, NULL, (SUBR)Foscaa },
-#endif
 { "median", S(MEDFILT),  5,     "a", "akio", (SUBR)medfiltset, NULL, (SUBR)medfilt},
 { "mediank", S(MEDFILT), 5,     "k", "kkio", (SUBR)medfiltset, (SUBR)kmedfilt},
 };
diff --git a/Opcodes/stdopcod.c b/Opcodes/stdopcod.c
index ab35dbd..f4de1b5 100644
--- a/Opcodes/stdopcod.c
+++ b/Opcodes/stdopcod.c
@@ -28,7 +28,7 @@
 }
 */
 
-PUBLIC int stdopc_ModuleInit(CSOUND *csound)
+int stdopc_ModuleInit(CSOUND *csound)
 {
     STDOPCOD_GLOBALS  *p;
     int               err = 0;
diff --git a/Opcodes/stk/CMakeLists.txt b/Opcodes/stk/CMakeLists.txt
index c137642..9aaf761 100644
--- a/Opcodes/stk/CMakeLists.txt
+++ b/Opcodes/stk/CMakeLists.txt
@@ -3,7 +3,9 @@ option(BUILD_STK_OPCODES "Build the stk opcodes" ON)
 if(BUILD_STK_OPCODES)
     find_library(STK_LIBRARY stk)
     if(STK_LIBRARY)
-        make_plugin(stkOpcodes stkOpcodes.cpp stk)
+        make_plugin(stk-ops stkOpcodes.cpp "stk")
+        set_target_properties(stk-ops PROPERTIES
+            OUTPUT_NAME stk)
     else()
         set(stk_srcs
             src/InetWvIn.cpp    src/InetWvOut.cpp
diff --git a/Opcodes/tl/fractalnoise.cpp b/Opcodes/tl/fractalnoise.cpp
new file mode 100644
index 0000000..a7bb797
--- /dev/null
+++ b/Opcodes/tl/fractalnoise.cpp
@@ -0,0 +1,442 @@
+/*
+    fractalnoise.cpp:
+
+    Code generated with Faust 0.9.43
+
+    (c) Tito Latini, 2012
+
+    This file is part of Csound.
+
+    The Csound Library is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    Csound 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 Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with Csound; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+*/
+
+#include <OpcodeBase.hpp>
+
+#define max(x,y) (((x)>(y)) ? (x) : (y))
+#define min(x,y) (((x)<(y)) ? (x) : (y))
+#define dv2_31   (FL(4.656612873077392578125e-10))
+
+inline int lsr (int x, int n)
+{
+    return int(((unsigned int)x) >> n);
+}
+
+/* VECTOR INTRINSICS */
+
+inline void *aligned_calloc(size_t nmemb, size_t size)
+{
+    return (void*)(((unsigned long)(calloc((nmemb*size)+15,
+                                           (sizeof(char))))+15) & 0xfffffff0);
+}
+
+/* ABSTRACT USER INTERFACE */
+
+struct Meta 
+{
+    void declare (const char* key, const char* value) { }
+};
+
+class UserInterface
+{
+  bool	fStopped;
+public:
+  UserInterface() : fStopped(false) {}
+  virtual ~UserInterface() {}
+  virtual void addButton(char* label, MYFLT* zone) = 0;
+  virtual void addToggleButton(char* label, MYFLT* zone) = 0;
+  virtual void addCheckButton(char* label, MYFLT* zone) = 0;
+  virtual void addVerticalSlider(char* label, MYFLT* zone, MYFLT init, 
+				 MYFLT min, MYFLT max, MYFLT step) = 0;
+  virtual void addHorizontalSlider(char* label, MYFLT* zone, MYFLT init, 
+				   MYFLT min, MYFLT max, MYFLT step) = 0;
+  virtual void addNumEntry(char* label, MYFLT* zone, MYFLT init, MYFLT min, 
+                           MYFLT max, MYFLT step) = 0;
+  virtual void openFrameBox(char* label) = 0;
+  virtual void openTabBox(char* label) = 0;
+  virtual void openHorizontalBox(char* label) = 0;
+  virtual void openVerticalBox(char* label) = 0;
+  virtual void closeBox() = 0;
+  virtual void run() = 0;
+  void stop() { fStopped = true; }
+  bool stopped() { return fStopped; }
+};
+
+class csUI : public UserInterface {
+private:
+  MYFLT* args[2];
+  int ctrlCount;
+  
+  void addZone(MYFLT* zone) {
+      args[ctrlCount++] = zone;
+  }
+
+public:
+  csUI() : UserInterface(), ctrlCount(0) {};
+  virtual ~csUI() {};
+
+  virtual void addButton(char* label, MYFLT* zone)
+  {
+      addZone(zone);
+  }
+  virtual void addToggleButton(char* label, MYFLT* zone)
+  {
+      addZone(zone);
+  }
+  virtual void addCheckButton(char* label, MYFLT* zone)
+  {
+      addZone(zone);
+  }
+  virtual void addVerticalSlider(char* label, MYFLT* zone, MYFLT init,
+                                 MYFLT min, MYFLT max, MYFLT step)
+  {
+      addZone(zone);
+  }
+  virtual void addHorizontalSlider(char* label, MYFLT* zone, MYFLT init,
+                                   MYFLT min, MYFLT max, MYFLT step)
+  {
+      addZone(zone);
+  }
+  virtual void addNumEntry(char* label, MYFLT* zone, MYFLT init,
+                           MYFLT min, MYFLT max, MYFLT step)
+  {
+      addZone(zone);
+  }
+  virtual void openFrameBox(char*) {}
+  virtual void openTabBox(char*) {}
+  virtual void openHorizontalBox(char*) {}
+  virtual void openVerticalBox(char*) {}
+  virtual void closeBox() {}
+  virtual void show() {}
+  virtual void run() {}
+
+  void updateCtrlZones(MYFLT* cs_amp, MYFLT* cs_beta)
+  {
+      *args[0] = *cs_amp;
+      *args[1] = *cs_beta;
+  }
+};
+
+/* FAUST DSP */
+
+/* abstract definition of a signal processor */
+class dsp {
+protected:
+  int fSamplingFreq;
+public:
+  dsp() {}
+  virtual ~dsp() {}
+  virtual int getNumInputs() = 0;
+  virtual int getNumOutputs() = 0;
+  virtual void buildUserInterface(UserInterface* userInterface) = 0;
+  virtual void init(int samplingRate) = 0;
+  virtual void compute(CSOUND* csound, MYFLT* output) = 0;
+};
+
+/* FAUST generated code */
+
+class mydsp : public dsp {
+  private:
+	int 	iConst0;
+	MYFLT 	fConst1;
+	MYFLT 	fConst2;
+	int 	iRec8[2];
+	MYFLT 	fConst3;
+	MYFLT 	fConst4;
+	MYFLT 	fConst5;
+	MYFLT 	fConst6;
+	MYFLT 	fConst7;
+	MYFLT 	fConst8;
+	MYFLT 	fRec7[3];
+	MYFLT 	fslider0;
+	MYFLT 	fConst9;
+	MYFLT 	fConst10;
+	MYFLT 	fConst11;
+	MYFLT 	fConst12;
+	MYFLT 	fConst13;
+	MYFLT 	fConst14;
+	MYFLT 	fRec6[3];
+	MYFLT 	fConst15;
+	MYFLT 	fConst16;
+	MYFLT 	fConst17;
+	MYFLT 	fConst18;
+	MYFLT 	fConst19;
+	MYFLT 	fConst20;
+	MYFLT 	fRec5[3];
+	MYFLT 	fConst21;
+	MYFLT 	fConst22;
+	MYFLT 	fConst23;
+	MYFLT 	fConst24;
+	MYFLT 	fConst25;
+	MYFLT 	fConst26;
+	MYFLT 	fRec4[3];
+	MYFLT 	fConst27;
+	MYFLT 	fConst28;
+	MYFLT 	fConst29;
+	MYFLT 	fConst30;
+	MYFLT 	fConst31;
+	MYFLT 	fConst32;
+	MYFLT 	fRec3[3];
+	MYFLT 	fConst33;
+	MYFLT 	fConst34;
+	MYFLT 	fConst35;
+	MYFLT 	fConst36;
+	MYFLT 	fConst37;
+	MYFLT 	fConst38;
+	MYFLT 	fRec2[3];
+	MYFLT 	fConst39;
+	MYFLT 	fConst40;
+	MYFLT 	fConst41;
+	MYFLT 	fConst42;
+	MYFLT 	fConst43;
+	MYFLT 	fConst44;
+	MYFLT 	fRec1[3];
+	MYFLT 	fRec0[2];
+	MYFLT 	fslider1;
+  public:
+	static void metadata(Meta* m)
+        { 
+            m->declare("name", "Fractal Noise");
+            m->declare("author", "Tito Latini");
+            m->declare("license", "GNU LGPL");
+            m->declare("copyright", "Tito Latini");
+            m->declare("version", "1.0");
+            m->declare("music.lib/name", "Music Library");
+            m->declare("music.lib/author", "GRAME");
+            m->declare("music.lib/copyright", "GRAME");
+            m->declare("music.lib/version", "1.0");
+            m->declare("music.lib/license", "LGPL");
+            m->declare("math.lib/name", "Math Library");
+            m->declare("math.lib/author", "GRAME");
+            m->declare("math.lib/copyright", "GRAME");
+            m->declare("math.lib/version", "1.0");
+            m->declare("math.lib/license", "LGPL");
+	}
+
+	virtual int getNumInputs()  { return 0; }
+	virtual int getNumOutputs() { return 1; }
+	static  void classInit(int samplingFreq) { }
+	virtual void instanceInit(int samplingFreq)
+        {
+            fSamplingFreq = samplingFreq;
+            iConst0 = min(192000, max(1, fSamplingFreq));
+            fConst1 = FL(67683.56194843161) / iConst0;
+            fConst2 = (- EXP(-fConst1));
+            for (int i=0; i<2; i++) iRec8[i] = 0;
+            fConst3 = FL(314.1592653589793) / iConst0;
+            fConst4 = EXP(-fConst3);
+            fConst5 = FL(461.1227396105972) / iConst0;
+            fConst6 = EXP(-fConst5);
+            fConst7 = -fConst6 - fConst4;
+            fConst8 = -fConst6 * -fConst4;
+            for (int i=0; i<3; i++) fRec7[i] = 0;
+            fslider0 = FL(1.75);
+            fConst9  = FL(676.8356194843168) / iConst0;
+            fConst10 = EXP(-fConst9);
+            fConst11 = FL(993.4588265796098) / iConst0;
+            fConst12 = EXP(-fConst11);
+            fConst13 = -fConst12 - fConst10;
+            fConst14 = -fConst12 * -fConst10;
+            for (int i=0; i<3; i++) fRec6[i] = 0;
+            fConst15 = FL(1458.1981380662319) / iConst0;
+            fConst16 = EXP(-fConst15);
+            fConst17 = FL(2140.3421591014803) / iConst0;
+            fConst18 = EXP(-fConst17);
+            fConst19 = -fConst18 - fConst16;
+            fConst20 = -fConst18 * -fConst16;
+            for (int i=0; i<3; i++) fRec5[i] = 0;
+            fConst21 = FL(3141.5926535897916) / iConst0;
+            fConst22 = EXP(-fConst21);
+            fConst23 = FL(4611.22739610597) / iConst0;
+            fConst24 = EXP(-fConst23);
+            fConst25 = -fConst24 - fConst22;
+            fConst26 = -fConst24 * -fConst22;
+            for (int i=0; i<3; i++) fRec4[i] = 0;
+            fConst27 = FL(6768.356194843165) / iConst0;
+            fConst28 = EXP(-fConst27);
+            fConst29 = FL(9934.588265796094) / iConst0;
+            fConst30 = EXP(-fConst29);
+            fConst31 = -fConst30 - fConst28;
+            fConst32 = -fConst30 * -fConst28;
+            for (int i=0; i<3; i++) fRec3[i] = 0;
+            fConst33 = FL(14581.981380662311) / iConst0;
+            fConst34 = EXP(-fConst33);
+            fConst35 = FL(21403.421591014794) / iConst0;
+            fConst36 = EXP(-fConst35);
+            fConst37 = -fConst36 - fConst34;
+            fConst38 = -fConst36 * -fConst34;
+            for (int i=0; i<3; i++) fRec2[i] = 0;
+            fConst39 = FL(31415.926535897903) / iConst0;
+            fConst40 = EXP(-fConst39);
+            fConst41 = FL(46112.27396105968f) / iConst0;
+            fConst42 = EXP(-fConst41);
+            fConst43 = -fConst42 - fConst40;
+            fConst44 = -fConst42 * -fConst40;
+            for (int i=0; i<3; i++) fRec1[i] = 0;
+            for (int i=0; i<2; i++) fRec0[i] = 0;
+            fslider1 = FL(1.0);
+	}
+	virtual void init(int samplingFreq)
+        {
+            classInit(samplingFreq);
+            instanceInit(samplingFreq);
+	}
+	virtual void buildUserInterface(UserInterface* userInterface)
+        {
+            userInterface->openVerticalBox((char*)"fractalnoise");
+            userInterface->addVerticalSlider((char*)"amp", &fslider1, FL(1.0),
+                                         FL(0.0), FL(20.0), FL(0.01));
+            userInterface->addVerticalSlider((char*)"beta", &fslider0, FL(1.75),
+                                         FL(0.0), FL(10.0), FL(0.01));
+            userInterface->closeBox();
+	}
+        virtual void compute (CSOUND* csound, MYFLT* output)
+        {
+            int     nn = csound->ksmps;
+            MYFLT   fSlow0  = POWER(FL(10.0),(FL(0.08333333333333333) * fslider0));
+            MYFLT   fSlow1  = EXP(-(fConst3 * fSlow0));
+            MYFLT   fSlow2  = EXP(-(fConst5 * fSlow0));
+            MYFLT   fSlow3  = -fSlow2 * -fSlow1;
+            MYFLT   fSlow4  = -fSlow2 - fSlow1;
+            MYFLT   fSlow5  = EXP(-(fConst9 * fSlow0));
+            MYFLT   fSlow6  = EXP(-(fConst11 * fSlow0));
+            MYFLT   fSlow7  = -fSlow6 * -fSlow5;
+            MYFLT   fSlow8  = -fSlow6 - fSlow5;
+            MYFLT   fSlow9  = EXP(-(fConst15 * fSlow0));
+            MYFLT   fSlow10 = EXP(-(fConst17 * fSlow0));
+            MYFLT   fSlow11 = -fSlow10 * -fSlow9;
+            MYFLT   fSlow12 = -fSlow10 - fSlow9;
+            MYFLT   fSlow13 = EXP(-(fConst21 * fSlow0));
+            MYFLT   fSlow14 = EXP(-(fConst23 * fSlow0));
+            MYFLT   fSlow15 = -fSlow14 * -fSlow13;
+            MYFLT   fSlow16 = (FL(0.0) - (fSlow14 + fSlow13));
+            MYFLT   fSlow17 = EXP(-(fConst27 * fSlow0));
+            MYFLT   fSlow18 = EXP(-(fConst29 * fSlow0));
+            MYFLT   fSlow19 = -fSlow18 * -fSlow17;
+            MYFLT   fSlow20 = -fSlow18 - fSlow17;
+            MYFLT   fSlow21 = EXP(-(fConst33 * fSlow0));
+            MYFLT   fSlow22 = EXP(-(fConst35 * fSlow0));
+            MYFLT   fSlow23 = -fSlow22 * -fSlow21;
+            MYFLT   fSlow24 = -fSlow22 - fSlow21;
+            MYFLT   fSlow25 = EXP(-(fConst39 * fSlow0));
+            MYFLT   fSlow26 = EXP(-(fConst41 * fSlow0));
+            MYFLT   fSlow27 = -fSlow26 * -fSlow25;
+            MYFLT   fSlow28 = -fSlow26 - fSlow25;
+            MYFLT   fSlow29 = (- EXP(-(fConst1 * fSlow0)));
+            MYFLT   fSlow30 = fslider1;
+            MYFLT*  output0 = output;
+            for (int i=0; i<nn; i++) {
+              iRec8[0] = (csound->randSeed1 + (1103515245 * iRec8[1]));
+              fRec7[0] = -((fConst8 * fRec7[2]) + (fConst7 * fRec7[1])) + (iRec8[0] * dv2_31);
+              fRec6[0] = (0 - (((fConst14 * fRec6[2]) + (fConst13 * fRec6[1]))
+                               - ((fSlow4 * fRec7[1]) + (fRec7[0] + (fSlow3 * fRec7[2])))));
+              fRec5[0] = (0 - (((fConst20 * fRec5[2]) + (fConst19 * fRec5[1]))
+                               - ((fSlow8 * fRec6[1]) + (fRec6[0] + (fSlow7 * fRec6[2])))));
+              fRec4[0] = (0 - (((fConst26 * fRec4[2]) + (fConst25 * fRec4[1]))
+                               - ((fSlow12 * fRec5[1]) + (fRec5[0] + (fSlow11 * fRec5[2])))));
+              fRec3[0] = (0 - (((fConst32 * fRec3[2]) + (fConst31 * fRec3[1]))
+                               - ((fSlow16 * fRec4[1]) + (fRec4[0] + (fSlow15 * fRec4[2])))));
+              fRec2[0] = (0 - (((fConst38 * fRec2[2]) + (fConst37 * fRec2[1]))
+                               - ((fSlow20 * fRec3[1]) + (fRec3[0] + (fSlow19 * fRec3[2])))));
+              fRec1[0] = (0 - (((fConst44 * fRec1[2]) + (fConst43 * fRec1[1]))
+                               - ((fSlow24 * fRec2[1]) + (fRec2[0] + (fSlow23 * fRec2[2])))));
+              fRec0[0] = (((fSlow28 * fRec1[1]) + (fRec1[0] + (fSlow27 * fRec1[2])))
+                          - (fConst2 * fRec0[1]));
+              output0[i] = (MYFLT)(fSlow30 * (fRec0[0] + (fSlow29 * fRec0[1])));
+              // post processing
+              fRec0[1] = fRec0[0];
+              fRec1[2] = fRec1[1]; fRec1[1] = fRec1[0];
+              fRec2[2] = fRec2[1]; fRec2[1] = fRec2[0];
+              fRec3[2] = fRec3[1]; fRec3[1] = fRec3[0];
+              fRec4[2] = fRec4[1]; fRec4[1] = fRec4[0];
+              fRec5[2] = fRec5[1]; fRec5[1] = fRec5[0];
+              fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
+              fRec7[2] = fRec7[1]; fRec7[1] = fRec7[0];
+              iRec8[1] = iRec8[0];
+            }
+	}
+};
+
+//typedef struct mydsp FaustCode;
+
+typedef struct {
+        OPDS       h;
+        MYFLT      *out, *kamp, *kbeta;
+        mydsp  *faust;
+        csUI       *cs_interface;
+} FRACTALNOISE;
+
+extern "C"
+{
+    int fractalnoise_cleanup(CSOUND *csound, FRACTALNOISE *p)
+    {
+        delete p->faust;
+        delete p->cs_interface;
+        p->faust = 0;
+        p->cs_interface = 0;
+        return OK;
+    }
+
+    int fractalnoise_init(CSOUND *csound, FRACTALNOISE *p)
+    {
+        p->faust = new mydsp;
+        p->cs_interface = new csUI;
+        p->faust->init((int)csound->esr);
+        p->faust->buildUserInterface(p->cs_interface);
+        csound->RegisterDeinitCallback(csound, p,
+                                       (int (*)(CSOUND*, void*)) fractalnoise_cleanup);
+        return OK;
+    }
+
+    int fractalnoise_process(CSOUND *csound, FRACTALNOISE *p)
+    {
+        p->cs_interface->updateCtrlZones(p->kamp, p->kbeta);
+        p->faust->compute(csound, p->out);
+        return OK;
+    }
+
+    static OENTRY localops[] = {
+      { (char*)"fractalnoise", sizeof(FRACTALNOISE), 5, (char*)"a", (char*)"kk", 
+        (SUBR)fractalnoise_init, NULL, (SUBR)fractalnoise_process },
+      { 0, 0, 0, 0, 0, 0, 0, 0, }
+    };
+
+    PUBLIC int csoundModuleCreate(CSOUND *csound)
+    {
+        return OK;
+    }
+
+    PUBLIC int csoundModuleInit(CSOUND *csound)
+    {
+        int status = 0;
+        for(OENTRY *oentry = &localops[0]; oentry->opname; oentry++) {
+          status |= csound->AppendOpcode(csound,
+                                         oentry->opname,
+                                         oentry->dsblksiz,
+                                         oentry->thread,
+                                         oentry->outypes,
+                                         oentry->intypes,
+                                         (int (*)(CSOUND*,void*)) oentry->iopadr,
+                                         (int (*)(CSOUND*,void*)) oentry->kopadr,
+                                         (int (*)(CSOUND*,void*)) oentry->aopadr);
+        }
+        return status;
+    }
+
+    PUBLIC int csoundModuleDestroy(CSOUND *csound)
+    {
+        return OK;
+    }
+}
diff --git a/Opcodes/tl/fractalnoise.dsp b/Opcodes/tl/fractalnoise.dsp
new file mode 100644
index 0000000..e4efa9b
--- /dev/null
+++ b/Opcodes/tl/fractalnoise.dsp
@@ -0,0 +1,106 @@
+declare name      "Fractal Noise";
+declare author    "Tito Latini";
+declare license   "GNU LGPL";
+declare copyright "Tito Latini";
+declare version   "1.0";
+
+import("music.lib"); 
+
+/* density of the poles */
+h = 6.0;
+
+amp = vslider("amp", 1.0, 0.0, 20.0, 0.01);
+
+/*
+ *   beta = 0,   white noise
+ *   beta = 1,   pink noise
+ *   beta = 2,   brownian noise
+ */
+beta = vslider("beta", 1.75, 0.0, 10.0, 0.01); 
+
+c1 = pow(10.0, 1 / h);
+c2 = pow(10.0, beta / (2.0 * h)); 
+T = 1.0 / SR ; 
+
+/* poles */
+p1  = 50;  /* pole with lowest frequency */
+p2  = p1  * c1;
+p3  = p2  * c1;
+p4  = p3  * c1;
+p5  = p4  * c1;
+p6  = p5  * c1;
+p7  = p6  * c1;
+p8  = p7  * c1;
+p9  = p8  * c1;
+p10 = p9  * c1;
+p11 = p10 * c1;
+p12 = p11 * c1;
+p13 = p12 * c1;
+p14 = p13 * c1;
+p15 = p14 * c1;
+
+coeffCalc(frq) = 0.0 - exp(0.0 - (2.0 * PI * frq * T));
+
+/* coeff a */
+a1  = coeffCalc(p1);
+a2  = coeffCalc(p2);
+a3  = coeffCalc(p3);
+a4  = coeffCalc(p4);
+a5  = coeffCalc(p5);
+a6  = coeffCalc(p6);
+a7  = coeffCalc(p7);
+a8  = coeffCalc(p8);
+a9  = coeffCalc(p9);
+a10 = coeffCalc(p10);
+a11 = coeffCalc(p11);
+a12 = coeffCalc(p12);
+a13 = coeffCalc(p13);
+a14 = coeffCalc(p14);
+a15 = coeffCalc(p15);
+
+/* zeros */
+z1  = p1  * c2;
+z2  = p2  * c2;
+z3  = p3  * c2;
+z4  = p4  * c2;
+z5  = p5  * c2;
+z6  = p6  * c2;
+z7  = p7  * c2;
+z8  = p8  * c2;
+z9  = p9  * c2;
+z10 = p10 * c2;
+z11 = p11 * c2;
+z12 = p12 * c2;
+z13 = p13 * c2;
+z14 = p14 * c2;
+z15 = p15 * c2;
+
+/* coeff b */
+b1  = coeffCalc(z1);
+b2  = coeffCalc(z2);
+b3  = coeffCalc(z3);
+b4  = coeffCalc(z4);
+b5  = coeffCalc(z5);
+b6  = coeffCalc(z6);
+b7  = coeffCalc(z7);
+b8  = coeffCalc(z8);
+b9  = coeffCalc(z9);
+b10 = coeffCalc(z10);
+b11 = coeffCalc(z11);
+b12 = coeffCalc(z12);
+b13 = coeffCalc(z13);
+b14 = coeffCalc(z14);
+b15 = coeffCalc(z15);
+
+sezioni = TF2(1, b1+b2, b1*b2, a1+a2, a1*a2) 
+    : TF2(1, b3+b4,   b3*b4,   a3+a4,   a3*a4) 
+    : TF2(1, b5+b6,   b5*b6,   a5+a6,   a5*a6)
+    : TF2(1, b7+b8,   b7*b8,   a7+a8,   a7*a8)
+    : TF2(1, b9+b10,  b9*b10,  a9+a10,  a9*a10)
+    : TF2(1, b11+b12, b11*b12, a11+a12, a11*a12)
+    : TF2(1, b13+b14, b13*b14, a13+a14, a13*a14)
+    : TF2(1, b15    , 0,       a15,     0) * amp;
+
+fractalNoise = noise : sezioni;
+
+process = fractalNoise;
diff --git a/Opcodes/tl/sc_noise.c b/Opcodes/tl/sc_noise.c
new file mode 100644
index 0000000..4b43cd9
--- /dev/null
+++ b/Opcodes/tl/sc_noise.c
@@ -0,0 +1,248 @@
+/*
+    sc_noise.c:
+
+    Based on the noise ugens of SuperCollider.
+
+    (c) Tito Latini, 2012
+
+    This file is part of Csound.
+
+    The Csound Library is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    Csound 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 Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with Csound; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+*/
+
+#include "csoundCore.h"
+
+typedef struct {
+        OPDS    h;
+        MYFLT   *out, *kamp, *kdensity, density0, thresh, scale;
+        int32   rand;
+} DUST;
+
+typedef struct {
+        OPDS    h;
+        MYFLT   *out, *kamp, *kfrq, *kdev, *imode, frq0;
+        int32   count, rand, mmode;
+} GAUSSTRIG;
+
+#define BIPOLAR   0x7FFFFFFF    /* Constant to make bipolar */
+#define dv2_31    (FL(4.656612873077392578125e-10))
+
+static int dust_init(CSOUND *csound, DUST *p)
+{
+    p->density0 = FL(0.0);
+    p->thresh   = FL(0.0);
+    p->scale    = FL(0.0);
+    p->rand     = csoundRand31(&csound->randSeed1);
+    return OK;
+}
+
+static int dust_process_krate(CSOUND *csound, DUST *p)
+{
+    MYFLT   density, thresh, scale, r;
+    density = *p->kdensity;
+
+    if (density != p->density0) {
+      thresh = p->thresh = density * csound->onedsr;
+      scale  = p->scale  = (thresh > FL(0.0) ? FL(1.0) / thresh : FL(0.0));
+      p->density0 = density;
+    }
+    else {
+      thresh = p->thresh;
+      scale  = p->scale;
+    }
+    p->rand = csoundRand31(&p->rand);
+    r = (MYFLT)p->rand * dv2_31;
+    *p->out = *p->kamp * (r < thresh ? r*scale : FL(0.0));
+    return OK;
+}
+
+static int dust_process_arate(CSOUND *csound, DUST *p)
+{
+    int     n, nn = csound->ksmps;
+    MYFLT   *out, density, thresh, scale;
+    out = p->out;
+    density = *p->kdensity;
+
+    if (density != p->density0) {
+      thresh = p->thresh = density * csound->onedsr;
+      scale  = p->scale  = (thresh > FL(0.0) ? FL(1.0) / thresh : FL(0.0));
+      p->density0 = density;
+    }
+    else {
+      thresh = p->thresh;
+      scale  = p->scale;
+    }
+    for (n=0; n<nn; n++) {
+      MYFLT r;
+      p->rand = csoundRand31(&p->rand);
+      r = (MYFLT)p->rand * dv2_31;
+      out[n] = *p->kamp * (r < thresh ? r*scale : FL(0.0));
+    }
+    return OK;
+}
+
+static int dust2_process_krate(CSOUND *csound, DUST *p)
+{
+    MYFLT   density, thresh, scale, r;
+    density = *p->kdensity;
+
+    if (density != p->density0) {
+      thresh = p->thresh = density * csound->onedsr;
+      scale = p->scale = (thresh > FL(0.0) ? FL(2.0) / thresh : FL(0.0));
+      p->density0 = density;
+    }
+    else {
+      thresh = p->thresh;
+      scale  = p->scale;
+    }
+    p->rand = csoundRand31(&p->rand);
+    r = (MYFLT)p->rand * dv2_31;
+    *p->out = *p->kamp * (r < thresh ? r*scale - FL(1.0) : FL(0.0));
+    return OK;
+}
+
+static int dust2_process_arate(CSOUND *csound, DUST *p)
+{
+    int     n, nn = csound->ksmps;
+    MYFLT   *out, density, thresh, scale;
+    out = p->out;
+    density = *p->kdensity;
+
+    if (density != p->density0) {
+      thresh = p->thresh = density * csound->onedsr;
+      scale = p->scale = (thresh > FL(0.0) ? FL(2.0) / thresh : FL(0.0));
+      p->density0 = density;
+    }
+    else {
+      thresh = p->thresh;
+      scale  = p->scale;
+    }
+    for (n=0; n<nn; n++) {
+      MYFLT r;
+      p->rand = csoundRand31(&p->rand);
+      r = (MYFLT)p->rand * dv2_31;
+      out[n] = *p->kamp * (r < thresh ? r*scale - FL(1.0) : FL(0.0));
+    }
+    return OK;
+}
+
+/* gausstrig opcode based on Bhob Rainey's GaussTrig ugen */
+static int gausstrig_init(CSOUND* csound, GAUSSTRIG *p)
+{
+    p->rand  = csoundRand31(&csound->randSeed1);
+    p->count = 0;
+    /*
+     * imode > 0 means better frequency modulation. If the frequency
+     * changes, the delay before the next impulse is calculed again.
+     * With the default imode value we have the classic behavior of
+     * the GaussTrig ugen, where the freq modulation is bypassed
+     * during the delay time that precedes the next impulse.
+     */
+    p->mmode = (*p->imode <= FL(0.0) ? 0 : 1);
+    return OK;
+}
+
+static int gausstrig_process_krate(CSOUND* csound, GAUSSTRIG *p)
+{
+    if (p->count <= 0) {
+      int     nextsamps;
+      MYFLT   nextcount, frq, dev, r1, r2;
+      p->frq0 = *p->kfrq;
+      frq = (*p->kfrq > FL(0.001) ? *p->kfrq : FL(0.001));
+      dev = *p->kdev;
+      nextsamps = (int)(csound->esr / frq);
+      p->rand = csoundRand31(&p->rand);
+      r1 = (MYFLT)p->rand * dv2_31;
+      p->rand = csoundRand31(&p->rand);
+      r2 = (MYFLT)p->rand * dv2_31;
+      nextcount = SQRT(FL(-2.0) * LOG(r1)) * SIN(r2 * TWOPI_F);
+      if (nextcount < FL(-1.0)) {
+        MYFLT diff = FL(-1.0) - nextcount;
+        nextcount  = (FL(1.0) < FL(-1.0) + diff ? FL(1.0) : FL(-1.0) + diff);
+      }
+      else if (nextcount > FL(1.0)) {
+        MYFLT diff = nextcount - FL(1.0);
+        nextcount  = (FL(-1.0) > FL(1.0) - diff ? FL(-1.0) : FL(1.0) - diff);
+      }
+      p->count = (int)(nextsamps + nextcount * dev * nextsamps);
+      *p->out = *p->kamp;
+    }
+    else {
+      if (p->mmode && *p->kfrq != p->frq0)
+        p->count = 0;
+      *p->out = FL(0.0);
+    }
+    p->count--;
+    return OK;
+}
+
+static int gausstrig_process_arate(CSOUND* csound, GAUSSTRIG *p)
+{
+    int     n, nn = csound->ksmps;
+    MYFLT   *out = p->out;
+    for (n=0; n<nn; n++) {
+      if (p->count <= 0) {
+        int     nextsamps;
+        MYFLT   nextcount, frq, dev, r1, r2;
+        p->frq0 = *p->kfrq;
+        frq = (*p->kfrq > FL(0.001) ? *p->kfrq : FL(0.001));
+        dev = *p->kdev;
+        nextsamps = (int)(csound->esr / frq);
+        p->rand = csoundRand31(&p->rand);
+        r1 = (MYFLT)p->rand * dv2_31;
+        p->rand = csoundRand31(&p->rand);
+        r2 = (MYFLT)p->rand * dv2_31;
+        nextcount = SQRT(FL(-2.0) * LOG(r1)) * SIN(r2 * TWOPI_F);
+        if (nextcount < FL(-1.0)) {
+          MYFLT diff = FL(-1.0) - nextcount;
+          nextcount  = (FL(1.0) < FL(-1.0) + diff ? FL(1.0) : FL(-1.0) + diff);
+        }
+        else if (nextcount > FL(1.0)) {
+          MYFLT diff = nextcount - FL(1.0);
+          nextcount  = (FL(-1.0) > FL(1.0) - diff ? FL(-1.0) : FL(1.0) - diff);
+        }
+        p->count = (int)(nextsamps + nextcount * dev * nextsamps);
+        out[n] = *p->kamp;
+      }
+      else {
+        if (p->mmode && *p->kfrq != p->frq0)
+          p->count = 0;
+        out[n] = FL(0.0);
+      }
+      p->count--;
+    }
+    return OK;
+}
+
+static OENTRY scnoise_localops[] = {
+  { "dust",      0xffff },
+  { "dust2",     0xffff },
+  { "gausstrig", 0xffff },
+  { "dust.k",      sizeof(DUST), 3, "k", "kk",
+    (SUBR)dust_init, (SUBR)dust_process_krate, NULL },
+  { "dust.a",      sizeof(DUST), 5, "a", "kk",
+    (SUBR)dust_init, NULL, (SUBR)dust_process_arate },
+  { "dust2.k",     sizeof(DUST), 3, "k", "kk",
+    (SUBR)dust_init, (SUBR)dust2_process_krate, NULL },
+  { "dust2.a",     sizeof(DUST), 5, "a", "kk",
+    (SUBR)dust_init, NULL, (SUBR)dust2_process_arate },
+  { "gausstrig.k", sizeof(GAUSSTRIG), 3, "k", "kkko",
+    (SUBR)gausstrig_init, (SUBR)gausstrig_process_krate, NULL },
+  { "gausstrig.a", sizeof(GAUSSTRIG), 5, "a", "kkko",
+    (SUBR)gausstrig_init, NULL, (SUBR)gausstrig_process_arate }
+};
+
+LINKAGE1(scnoise_localops)
diff --git a/Opcodes/uggab.c b/Opcodes/uggab.c
index 78bf3bd..329dc9d 100644
--- a/Opcodes/uggab.c
+++ b/Opcodes/uggab.c
@@ -211,7 +211,8 @@ static int posc_set(CSOUND *csound, POSC *p)
 {
     FUNC *ftp;
 
-    if (UNLIKELY((ftp = csound->FTnp2Find(csound, p->ift)) == NULL)) return NOTOK;
+    if (UNLIKELY((ftp = csound->FTnp2Find(csound, p->ift)) == NULL)) 
+      return csound->InitError(csound, Str("table not found in poscil"));
     p->ftp        = ftp;
     p->tablen     = ftp->flen;
     p->tablenUPsr = p->tablen * csound->onedsr;
@@ -221,13 +222,17 @@ static int posc_set(CSOUND *csound, POSC *p)
 
 static int posckk(CSOUND *csound, POSC *p)
 {
-    MYFLT       *out = p->out, *ft = p->ftp->ftable;
+    FUNC        *ftp = p->ftp;
+    MYFLT       *out = p->out, *ft;
     MYFLT       *curr_samp, fract;
     double      phs = p->phs;
     double      si = *p->freq * p->tablenUPsr; /* gab c3 */
     int32       n,nsmps = csound->ksmps;
     MYFLT       amp = *p->amp;
 
+    if (UNLIKELY(ftp==NULL))
+      return csound->PerfError(csound, Str("poscil: not initialised"));
+    ft = p->ftp->ftable;
     for (n=0; n<nsmps; n++) {
       curr_samp = ft + (int32)phs;
       fract     = (MYFLT)(phs - (int32)phs);
@@ -244,15 +249,17 @@ static int posckk(CSOUND *csound, POSC *p)
 
 static int poscaa(CSOUND *csound, POSC *p)
 {
+    FUNC        *ftp = p->ftp;
     MYFLT       *out = p->out, *ft = p->ftp->ftable;
     MYFLT       *curr_samp, fract;
     double      phs = p->phs;
-    /*double      si = *p->freq * p->tablen * csound->onedsr;*/
-
     MYFLT       *freq = p->freq;
     int32       n,nsmps = csound->ksmps;
     MYFLT       *amp = p->amp; /*gab c3*/
 
+    if (UNLIKELY(ftp==NULL))
+      return csound->PerfError(csound, Str("poscil: not initialised"));
+    ft = p->ftp->ftable;
     for (n=0; n<nsmps; n++) {
       MYFLT ff = freq[n];
       curr_samp = ft + (int32)phs;
@@ -271,13 +278,17 @@ static int poscaa(CSOUND *csound, POSC *p)
 
 static int poscka(CSOUND *csound, POSC *p)
 {
-    MYFLT       *out = p->out, *ft = p->ftp->ftable;
+    FUNC        *ftp = p->ftp;
+    MYFLT       *out = p->out, *ft;
     MYFLT       *curr_samp, fract;
     double      phs = p->phs;
     int32       n,nsmps = csound->ksmps;
     MYFLT       amp = *p->amp;
     MYFLT       *freq = p->freq;
 
+    if (UNLIKELY(ftp==NULL))
+      return csound->PerfError(csound, Str("poscil: not initialised"));
+    ft = p->ftp->ftable;
     for (n=0; n<nsmps; n++) {
       MYFLT ff = freq[n];
       curr_samp = ft + (int32)phs;
@@ -295,13 +306,17 @@ static int poscka(CSOUND *csound, POSC *p)
 
 static int poscak(CSOUND *csound, POSC *p)
 {
-    MYFLT       *out = p->out, *ft = p->ftp->ftable;
+    FUNC        *ftp = p->ftp;
+    MYFLT       *out = p->out, *ft;
     MYFLT       *curr_samp, fract;
     double      phs = p->phs;
     double      si = *p->freq * p->tablenUPsr;
     int32       n,nsmps = csound->ksmps;
     MYFLT       *amp = p->amp; /*gab c3*/
 
+    if (UNLIKELY(ftp==NULL))
+      return csound->PerfError(csound, Str("poscil: not initialised"));
+    ft = p->ftp->ftable;
     for (n=0; n<nsmps; n++) {
       curr_samp = ft + (int32)phs;
       fract     = (MYFLT)(phs - (int32)phs);
@@ -334,9 +349,10 @@ static int kposc(CSOUND *csound, POSC *p)
     return OK;
 }
 
-static int posc3(CSOUND *csound, POSC *p)
+static int posc3kk(CSOUND *csound, POSC *p)
 {
-    MYFLT       *out = p->out, *ftab = p->ftp->ftable;
+    FUNC        *ftp = p->ftp;
+    MYFLT       *out = p->out, *ftab;
     MYFLT       fract;
     double      phs  = p->phs;
     double      si   = *p->freq * p->tablen * csound->onedsr;
@@ -345,6 +361,9 @@ static int posc3(CSOUND *csound, POSC *p)
     int         x0;
     MYFLT       y0, y1, ym1, y2;
 
+    if (UNLIKELY(ftp==NULL))
+      return csound->PerfError(csound, Str("poscil3: not initialised"));
+    ftab = p->ftp->ftable;
     for (n=0; n<nsmps; n++) {
       x0    = (int32)phs;
       fract = (MYFLT)(phs - (double)x0);
@@ -377,6 +396,151 @@ static int posc3(CSOUND *csound, POSC *p)
     return OK;
 }
 
+static int posc3ak(CSOUND *csound, POSC *p)
+{
+    FUNC        *ftp = p->ftp;
+    MYFLT       *out = p->out, *ftab;
+    MYFLT       fract;
+    double      phs  = p->phs;
+    double      si   = *p->freq * p->tablen * csound->onedsr;
+    int32       n, nsmps = csound->ksmps;
+    MYFLT       *ampp = p->amp;
+    int         x0;
+    MYFLT       y0, y1, ym1, y2;
+
+    if (UNLIKELY(ftp==NULL))
+      return csound->PerfError(csound, Str("poscil3: not initialised"));
+    ftab = p->ftp->ftable;
+    for (n=0; n<nsmps; n++) {
+      x0    = (int32)phs;
+      fract = (MYFLT)(phs - (double)x0);
+      x0--;
+      if (UNLIKELY(x0<0)) {
+        ym1 = ftab[p->tablen-1]; x0 = 0;
+      }
+      else ym1 = ftab[x0++];
+      y0    = ftab[x0++];
+      y1    = ftab[x0++];
+      if (UNLIKELY(x0>p->tablen)) y2 = ftab[1];
+      else y2 = ftab[x0];
+      {
+        MYFLT frsq = fract*fract;
+        MYFLT frcu = frsq*ym1;
+        MYFLT t1   = y2 + y0+y0+y0;
+        out[n]     = ampp[n] * (y0 + FL(0.5)*frcu +
+                            fract*(y1 - frcu/FL(6.0) - t1/FL(6.0)
+                                   - ym1/FL(3.0)) +
+                            frsq*fract*(t1/FL(6.0) - FL(0.5)*y1) +
+                            frsq*(FL(0.5)* y1 - y0));
+      }
+      phs += si;
+      while (UNLIKELY(phs >= p->tablen))
+        phs -= p->tablen;
+      while (UNLIKELY(phs < 0.0) )
+        phs += p->tablen;
+    }
+    p->phs = phs;
+    return OK;
+}
+
+static int posc3ka(CSOUND *csound, POSC *p)
+{
+    FUNC        *ftp = p->ftp;
+    MYFLT       *out = p->out, *ftab;
+    MYFLT       fract;
+    double      phs  = p->phs;
+    /*double      si   = *p->freq * p->tablen * csound->onedsr;*/
+    MYFLT       *freq = p->freq;
+    int32       n, nsmps = csound->ksmps;
+    MYFLT       amp = *p->amp;
+    int         x0;
+    MYFLT       y0, y1, ym1, y2;
+
+    if (UNLIKELY(ftp==NULL))
+      return csound->PerfError(csound, Str("poscil3: not initialised"));
+    ftab = p->ftp->ftable;
+    for (n=0; n<nsmps; n++) {
+      MYFLT ff = freq[n];
+      x0    = (int32)phs;
+      fract = (MYFLT)(phs - (double)x0);
+      x0--;
+      if (UNLIKELY(x0<0)) {
+        ym1 = ftab[p->tablen-1]; x0 = 0;
+      }
+      else ym1 = ftab[x0++];
+      y0    = ftab[x0++];
+      y1    = ftab[x0++];
+      if (UNLIKELY(x0>p->tablen)) y2 = ftab[1];
+      else y2 = ftab[x0];
+      {
+        MYFLT frsq = fract*fract;
+        MYFLT frcu = frsq*ym1;
+        MYFLT t1   = y2 + y0+y0+y0;
+        out[n]     = amp * (y0 + FL(0.5)*frcu +
+                            fract*(y1 - frcu/FL(6.0) - t1/FL(6.0)
+                                   - ym1/FL(3.0)) +
+                            frsq*fract*(t1/FL(6.0) - FL(0.5)*y1) +
+                            frsq*(FL(0.5)* y1 - y0));
+      }
+      phs      += ff * p->tablenUPsr;
+      while (UNLIKELY(phs >= p->tablen))
+        phs -= p->tablen;
+      while (UNLIKELY(phs < 0.0) )
+        phs += p->tablen;
+    }
+    p->phs = phs;
+    return OK;
+}
+
+static int posc3aa(CSOUND *csound, POSC *p)
+{
+    FUNC        *ftp = p->ftp;
+    MYFLT       *out = p->out, *ftab;
+    MYFLT       fract;
+    double      phs  = p->phs;
+    /*double      si   = *p->freq * p->tablen * csound->onedsr;*/
+    MYFLT       *freq = p->freq;
+    int32       n, nsmps = csound->ksmps;
+    MYFLT       *ampp = p->amp;
+    int         x0;
+    MYFLT       y0, y1, ym1, y2;
+
+    if (UNLIKELY(ftp==NULL))
+      return csound->PerfError(csound, Str("poscil3: not initialised"));
+    ftab = p->ftp->ftable;
+    for (n=0; n<nsmps; n++) {
+      MYFLT ff = freq[n];
+      x0    = (int32)phs;
+      fract = (MYFLT)(phs - (double)x0);
+      x0--;
+      if (UNLIKELY(x0<0)) {
+        ym1 = ftab[p->tablen-1]; x0 = 0;
+      }
+      else ym1 = ftab[x0++];
+      y0    = ftab[x0++];
+      y1    = ftab[x0++];
+      if (UNLIKELY(x0>p->tablen)) y2 = ftab[1];
+      else y2 = ftab[x0];
+      {
+        MYFLT frsq = fract*fract;
+        MYFLT frcu = frsq*ym1;
+        MYFLT t1   = y2 + y0+y0+y0;
+        out[n]     = ampp[n] * (y0 + FL(0.5)*frcu +
+                                fract*(y1 - frcu/FL(6.0) - t1/FL(6.0)
+                                       - ym1/FL(3.0)) +
+                                frsq*fract*(t1/FL(6.0) - FL(0.5)*y1) +
+                                frsq*(FL(0.5)* y1 - y0));
+        phs       += ff * p->tablenUPsr;
+      }
+      while (UNLIKELY(phs >= p->tablen))
+        phs -= p->tablen;
+      while (UNLIKELY(phs < 0.0) )
+        phs += p->tablen;
+    }
+    p->phs = phs;
+    return OK;
+}
+
 static int kposc3(CSOUND *csound, POSC *p)
 {
     double      phs   = p->phs;
@@ -385,6 +549,7 @@ static int kposc3(CSOUND *csound, POSC *p)
     int         x0    = (int32)phs;
     MYFLT       fract = (MYFLT)(phs - (double)x0);
     MYFLT       y0, y1, ym1, y2;
+    MYFLT       amp = *p->amp;
 
     x0--;
     if (UNLIKELY(x0<0)) {
@@ -399,11 +564,11 @@ static int kposc3(CSOUND *csound, POSC *p)
       MYFLT frsq = fract*fract;
       MYFLT frcu = frsq*ym1;
       MYFLT t1 = y2 + y0+y0+y0;
-      *p->out  = *p->amp * (y0 + FL(0.5)*frcu +
-                            fract*(y1 - frcu/FL(6.0) - t1/FL(6.0)
-                                   - ym1/FL(3.0)) +
-                            frsq*fract*(t1/FL(6.0) - FL(0.5)*y1) +
-                            frsq*(FL(0.5)* y1 - y0));
+      *p->out  = amp * (y0 + FL(0.5)*frcu +
+                        fract*(y1 - frcu/FL(6.0) - t1/FL(6.0)
+                               - ym1/FL(3.0)) +
+                        frsq*fract*(t1/FL(6.0) - FL(0.5)*y1) +
+                        frsq*(FL(0.5)* y1 - y0));
     }
     phs += si;
     while (UNLIKELY(phs >= p->tablen))
@@ -1707,7 +1872,11 @@ static OENTRY localops[] = {
 { "poscil.ak", S(POSC), 5, "a", "akio", (SUBR)posc_set, NULL,  (SUBR)poscak },
 { "poscil.aa", S(POSC), 5, "a", "aaio", (SUBR)posc_set, NULL,  (SUBR)poscaa },
 { "lposcil",  S(LPOSC), TR|5, "a", "kkkkio", (SUBR)lposc_set, NULL, (SUBR)lposc},
-{ "poscil3",  S(POSC),  TR|7, "s", "kkio", (SUBR)posc_set,(SUBR)kposc3,(SUBR)posc3 },
+{ "poscil3", 0xfffe, TR                                                          },
+{ "poscil3.kk",S(POSC), 7, "s", "kkio", (SUBR)posc_set,(SUBR)kposc3,(SUBR)posc3kk },
+{ "poscil3.ak", S(POSC), 5, "a", "akio", (SUBR)posc_set, NULL, (SUBR)posc3ak },
+{ "poscil3.ka", S(POSC), 5, "a", "kaio", (SUBR)posc_set, NULL, (SUBR)posc3ka },
+{ "poscil3.aa", S(POSC), 5, "a", "aaio", (SUBR)posc_set, NULL, (SUBR)posc3aa },
 { "lposcil3", S(LPOSC), TR|5, "a", "kkkkio", (SUBR)lposc_set, NULL,(SUBR)lposc3},
 { "trigger",  S(TRIG),  3, "k", "kkk",  (SUBR)trig_set, (SUBR)trig,   NULL  },
 { "sum",      S(SUM),   4, "a", "y",    NULL, NULL, (SUBR)sum               },
diff --git a/Opcodes/ugsc.c b/Opcodes/ugsc.c
index e3b07ea..bc17330 100644
--- a/Opcodes/ugsc.c
+++ b/Opcodes/ugsc.c
@@ -107,25 +107,25 @@ static int hilbertset(CSOUND *csound, HILBERT *p)
     /* pole values taken from Bernie Hutchins, "Musical Engineer's Handbook" */
     double poles[12] = {0.3609, 2.7412, 11.1573, 44.7581, 179.6242, 798.4578,
                         1.2524, 5.5671, 22.3423, 89.6271, 364.7914, 2770.1114};
-    double polefreq[12], rc[12], alpha[12], beta[12];
+    double polefreq, rc, alpha, beta;
     /* calculate coefficients for allpass filters, based on sampling rate */
     for (j=0; j<12; j++) {
       /*      p->coef[j] = (1 - (15 * PI * pole[j]) / csound->esr) /
               (1 + (15 * PI * pole[j]) / csound->esr); */
-      polefreq[j] = poles[j] * 15.0;
-      rc[j] = 1.0 / (2.0 * PI * polefreq[j]);
-      alpha[j] = 1.0 / rc[j];
-      beta[j] = (1.0 - (alpha[j] * 0.5 * (double)csound->onedsr)) /
-                (1.0 + (alpha[j] * 0.5 * (double)csound->onedsr));
+      polefreq = poles[j] * 15.0;
+      rc = 1.0 / (2.0 * PI * polefreq);
+      alpha = 1.0 / rc;
+      alpha = alpha * 0.5 * (double)csound->onedsr;
+      beta = (1.0 - alpha) / (1.0 + alpha);
       p->xnm1[j] = p->ynm1[j] = FL(0.0);
-      p->coef[j] = -(MYFLT)beta[j];
+      p->coef[j] = -(MYFLT)beta;
     }
     return OK;
 }
 
 static int hilbert(CSOUND *csound, HILBERT *p)
 {
-    MYFLT xn1 = FL(0.0), yn1 = FL(0.0), xn2 = FL(0.0), yn2 = FL(0.0);
+    MYFLT xn1, yn1, xn2, yn2;
     MYFLT *out1, *out2, *in;
     MYFLT *coef;
     int n, nsmps = csound->ksmps;
@@ -395,8 +395,9 @@ static int phaser2set(CSOUND *csound, PHASER2 *p)
     csound->AuxAlloc(csound, (size_t)loop*sizeof(MYFLT), &p->aux2);
     p->nm1 = (MYFLT *) p->aux1.auxp;
     p->nm2 = (MYFLT *) p->aux2.auxp;
-    for (j=0; j< loop; j++)
-      p->nm1[j] = p->nm2[j] = FL(0.0);
+    /* *** This is unnecessary as AuxAlloc zeros *** */
+    /* for (j=0; j< loop; j++) */
+    /*   p->nm1[j] = p->nm2[j] = FL(0.0); */
     return OK;
 }
 
@@ -429,6 +430,7 @@ static int phaser2(CSOUND *csound, PHASER2 *p)
       ksep = -ksep;
 
     for (n=0; n<nsmps; n++) {
+      MYFLT kk = FL(1.0);
       xn = in[n] + feedback * fbgain;
       /* The following code is used to determine
        * how the frequencies of the notches are calculated.
@@ -439,8 +441,11 @@ static int phaser2(CSOUND *csound, PHASER2 *p)
       for (j=0; j < p->loop; j++) {
         if (p->modetype == 1)
           freq = kbf + (kbf * ksep * j);
-        else
-          freq = kbf * csound->intpow(ksep,(int32)j);
+        else {
+          freq = kbf * kk;
+          kk *= ksep;
+          //freq = kbf * csound->intpow(ksep,(int32)j);
+        }
         /* Note similarities of following equations to
          * equations in resonr/resonz. The 2nd-order
          * allpass filter used here is similar to the
diff --git a/SConstruct b/SConstruct
index d7f7c07..987f033 100644
--- a/SConstruct
+++ b/SConstruct
@@ -428,8 +428,8 @@ elif commonEnvironment['gcc3opt'] != '0' or commonEnvironment['gcc4opt'] != '0':
         commonEnvironment.Prepend(CXXFLAGS = Split('-O3 -arch i386 -arch ppc '))
         commonEnvironment.Prepend(LINKFLAGS = Split('-arch i386 -arch ppc '))
       elif cpuType == 'universalX86':
-        commonEnvironment.Prepend(CCFLAGS = Split('-O3 -arch i386 -arch x86_64 '))
-        commonEnvironment.Prepend(CXXFLAGS = Split('-O3 -arch i386 -arch x86_64 '))
+        commonEnvironment.Prepend(CCFLAGS = Split('-O3 -arch i386 -arch x86_64 -msse -mfpmath=sse'))
+        commonEnvironment.Prepend(CXXFLAGS = Split('-O3 -arch i386 -arch x86_64 -msse -mfpmath=sse '))
         commonEnvironment.Prepend(LINKFLAGS = Split('-arch i386 -arch x86_64 '))
       else:
         commonEnvironment.Prepend(CCFLAGS = Split('-O3 -arch %s' % cpuType))
@@ -492,13 +492,13 @@ else:
 # Define different build environments for different types of targets.
 
 if getPlatform() == 'linux':
-    commonEnvironment.Append(CCFLAGS = "-DLINUX")
+    commonEnvironment.Append(CCFLAGS = ["-DLINUX"])
     commonEnvironment.Append(CPPFLAGS = ['-DHAVE_SOCKETS'])
-    commonEnvironment.Append(CPPPATH = '/usr/local/include')
-    commonEnvironment.Append(CPPPATH = '/usr/include')
-    commonEnvironment.Append(CPPPATH = '/usr/include')
-    commonEnvironment.Append(CPPPATH = '/usr/X11R6/include')
-    commonEnvironment.Append(CCFLAGS = "-DPIPES")
+    commonEnvironment.Append(CPPPATH = ['/usr/local/include'])
+    commonEnvironment.Append(CPPPATH = ['/usr/include'])
+    commonEnvironment.Append(CPPPATH = ['/usr/include'])
+    commonEnvironment.Append(CPPPATH = ['/usr/X11R6/include'])
+    commonEnvironment.Append(CCFLAGS = ["-DPIPES"])
     commonEnvironment.Append(LINKFLAGS = ['-Wl,-Bdynamic'])
 elif getPlatform() == 'sunos':
     commonEnvironment.Append(CCFLAGS = "-D_SOLARIS")
@@ -526,7 +526,7 @@ elif getPlatform() == 'win32':
     commonEnvironment.Append(CXXFLAGS = '-DOS_IS_WIN32')
     commonEnvironment.Append(CXXFLAGS = '-DFL_DLL')
     if compilerGNU():
-        commonEnvironment.Prepend(CCFLAGS = "-Wall")
+        commonEnvironment.Prepend(CCFLAGS = ["-Wall"])
         commonEnvironment.Append(CPPPATH = '/usr/local/include')
         commonEnvironment.Append(CPPPATH = '/usr/include')
         commonEnvironment.Append(SHLINKFLAGS = Split(' -mno-cygwin -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc'))
@@ -605,16 +605,16 @@ elif getPlatform() == 'darwin':
     # or if the MacPython version equals the expected Apple Python version
     if vers[1] == sysPyVers:
         print "Current Python version is %s, using Apple Python Framework" % pvers
-        pyBasePath = '/System/Library/Frameworks/Python.framework'
+        pyBasePath = '/System/Library/Frameworks'
     else:
         print "Current Python version is %s, using MacPython Framework" % pvers
-        pyBasePath = '/Library/Frameworks/Python.framework'
+        pyBasePath = '/Library/Frameworks'
     if commonEnvironment['pythonVersion'] != pvers:
         commonEnvironment['pythonVersion'] = pvers
         print "WARNING python version used is " + pvers
-    pythonIncludePath = ['%s/Headers' % pyBasePath]
+    pythonIncludePath = ['%s/Python.Framework/Headers' % pyBasePath]
     pythonLinkFlags = [ '-F' + pyBasePath, '-framework', 'python']
-    path1 = '%s/Versions/Current/lib' % pyBasePath
+    path1 = '%s/Python.framework/Versions/Current/lib' % pyBasePath
     path2 = '%s/python%s/config' % (path1, commonEnvironment['pythonVersion'])
     pythonLibraryPath = [path1, path2]
     pythonLibs = []
@@ -783,7 +783,10 @@ print 'Checking for SWIG... %s' % (['no', 'yes'][int(swigFound)])
 print "Python Version: " + commonEnvironment['pythonVersion']
 pythonFound = configure.CheckHeader("Python.h", language = "C")
 if not pythonFound:
-    for i in pythonIncludePath:
+    if getPlatform() == 'darwin':
+      pythonFound = configure.CheckHeader('%s/Python.h' % pythonIncludePath[0], language = "C")
+    else:
+      for i in pythonIncludePath:
         tmp = '%s/Python.h' % i
         pythonFound = pythonFound or configure.CheckHeader(tmp, language = "C")
 if getPlatform() == 'darwin':
@@ -897,13 +900,15 @@ if commonEnvironment['buildNewParser'] != '0':
     print 'CONFIGURATION DECISION: Building with new parser enabled'
     reportflag='--report=itemset'
     csoundLibraryEnvironment.Append(YACCFLAGS = ['-d', reportflag, '-p','csound_orc'])
-    csoundLibraryEnvironment.Append(LEXFLAGS = ['-Pcsound_orc'])
+    csoundLibraryEnvironment.Append(LEXFLAGS = ['-B'])
     csoundLibraryEnvironment.Append(CPPFLAGS = ['-DENABLE_NEW_PARSER'])
     csoundLibraryEnvironment.Append(CPPPATH = ['Engine'])
     yaccBuild = csoundLibraryEnvironment.CFile(target = 'Engine/csound_orcparse.c',
                                source = 'Engine/csound_orc.y')
     lexBuild = csoundLibraryEnvironment.CFile(target = 'Engine/csound_orclex.c',
                                source = 'Engine/csound_orc.l')
+    preBuild = csoundLibraryEnvironment.CFile(target = 'Engine/csound_prelex.c',
+                               source = 'Engine/csound_pre.lex')
     if commonEnvironment['NewParserDebug'] != '0':
         print 'CONFIGURATION DECISION: Building with new parser debugging'
         csoundLibraryEnvironment.Append(CPPFLAGS = ['-DPARSER_DEBUG=1'])
@@ -936,6 +941,7 @@ if getPlatform() == 'win32':
     # These are the Windows system call libraries.
     if compilerGNU():
         csoundWindowsLibraries = Split('''
+setupapi 
 advapi32
 comctl32
 comdlg32
@@ -952,7 +958,8 @@ uuid
 winmm
 winspool
 ws2_32
-wsock32
+wsock32 
+setupapi 
 advapi32
 comctl32
 comdlg32
@@ -971,10 +978,10 @@ ws2_32
         ''')
     else:
         csoundWindowsLibraries = Split('''
-            kernel32 gdi32 wsock32 ole32 uuid winmm user32.lib ws2_32.lib
+            setupapi kernel32 gdi32 wsock32 ole32 uuid winmm user32.lib ws2_32.lib
             comctl32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib
             ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
-            kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
+            setupapi kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
             advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
             odbc32.lib odbccp32.lib pthread.lib
         ''')
@@ -1111,6 +1118,7 @@ OOps/sndinfUG.c
 OOps/str_ops.c
 OOps/ugens1.c
 OOps/ugens2.c
+OOps/ugens2a.c
 OOps/ugens3.c
 OOps/ugens4.c
 OOps/ugens5.c
@@ -1139,6 +1147,7 @@ Top/utility.c
 ''')
 
 newParserSources = Split('''
+Engine/csound_prelex.c
 Engine/csound_orclex.c
 Engine/csound_orcparse.c
 Engine/csound_orc_semantics.c
@@ -1190,7 +1199,8 @@ Opcodes/vbap_eight.c Opcodes/vbap_four.c Opcodes/vbap_sixteen.c
 Opcodes/vbap_zak.c Opcodes/vaops.c Opcodes/ugakbari.c Opcodes/harmon.c 
 Opcodes/pitchtrack.c Opcodes/partikkel.c Opcodes/shape.c Opcodes/tabsum.c
 Opcodes/crossfm.c Opcodes/pvlock.c Opcodes/fareyseq.c  Opcodes/hrtfearly.c
-Opcodes/hrtfreverb.c Opcodes/cpumeter.c Opcodes/mp3in.c
+Opcodes/hrtfreverb.c Opcodes/cpumeter.c Opcodes/mp3in.c Opcodes/gendy.c
+Opcodes/tl/sc_noise.c
 ''')
 
 oldpvoc = Split('''
@@ -1440,6 +1450,7 @@ else:
         option = '-I' + option
         csoundWrapperEnvironment.Append(SWIGFLAGS = [option])
     swigflags = csoundWrapperEnvironment['SWIGFLAGS']
+    print 'swigflags:', swigflags
     luaWrapper = None
     if not (luaFound and commonEnvironment['buildLuaWrapper'] != '0'):
         print 'CONFIGURATION DECISION: Not building Lua wrapper to Csound C++ interface library.'
@@ -1448,13 +1459,16 @@ else:
 	luaWrapperEnvironment = csoundWrapperEnvironment.Clone()
         if getPlatform() != 'win32':
             csoundWrapperEnvironment.Append(CPPPATH=['/usr/include/lua5.1'])
-        csoundLuaInterface = luaWrapperEnvironment.SharedObject(
-            'interfaces/lua_interface.i',
-            SWIGFLAGS = [swigflags, '-module', 'luaCsnd', '-lua', '-outdir', '.'])
         if getPlatform() == 'win32':
-            luaWrapperEnvironment.Prepend(LIBS = ['csnd','lua51'])
-        else:
-            luaWrapperEnvironment.Prepend(LIBS = ['csnd','lua'])
+            csoundLuaInterface = luaWrapperEnvironment.SharedObject(
+		    'interfaces/lua_interface.i',
+		    SWIGFLAGS = [swigflags, '-lua', '-module', 'luaCsnd', '-lua51', '-outdir', '.'])
+	    luaWrapperEnvironment.Prepend(LIBS = ['csnd','luaj51'])
+	else:
+	    csoundLuaInterface = luaWrapperEnvironment.SharedObject(
+			'interfaces/lua_interface.i',
+			SWIGFLAGS = [swigflags, '-lua', '-module', 'luaCsnd', '-outdir', '.'])
+            luaWrapperEnvironment.Prepend(LIBS = ['csnd','luajit-5.1'])
        	luaWrapper = makeLuaModule(luaWrapperEnvironment, 'luaCsnd', [csoundLuaInterface])
 	Depends(luaWrapper, csoundLuaInterface)
 
@@ -1527,6 +1541,7 @@ else:
 	    # os.symlink('lib_csnd.so', '_csnd.so')
 	    pythonWrapperEnvironment.Append(LINKFLAGS = ['-Wl,-rpath-link,.'])
 	if getPlatform() == 'darwin':
+            pythonWrapperEnvironment.Append(LINKFLAGS = pythonLinkFlags)
 	    if commonEnvironment['dynamicCsoundLibrary'] == '1':
 		#ilibName = "lib_csnd.dylib"
 		#ilibVersion = csoundLibraryVersion
@@ -1534,7 +1549,6 @@ else:
 		#pythonWrapperEnvironment.Append(SHLINKFLAGS = Split('''-Xlinker -current_version -Xlinker %s''' % ilibVersion))
 		#pythonWrapperEnvironment.Append(SHLINKFLAGS = Split('''-install_name /Library/Frameworks/%s/%s''' % (OSXFrameworkCurrentVersion, ilibName)))
                 pythonWrapperEnvironment.Append(CPPPATH = pythonIncludePath)
-                pythonWrapperEnvironment.Append(LINKFLAGS = ['-framework','python'])
 		#pythonWrapper = pythonWrapperEnvironment.SharedLibrary('_csnd', pythonWrapperSources)
 		pyVersToken = '-DPYTHON_24_or_newer'
 	        csoundPythonInterface = pythonWrapperEnvironment.SharedObject(
@@ -1664,10 +1678,10 @@ makePlugin(pluginEnvironment, 'system_call', ['Opcodes/system_call.c'])
 
 # C++ opcodes
 makePlugin(pluginEnvironment, 'ampmidid', ['Opcodes/ampmidid.cpp'])
-makePlugin(pluginEnvironment, 'mutexops', ['Opcodes/mutexops.cpp'])
 makePlugin(pluginEnvironment, 'doppler', ['Opcodes/doppler.cpp'])
 makePlugin(pluginEnvironment, 'mixer', ['Opcodes/mixer.cpp'])
 makePlugin(pluginEnvironment, 'signalflowgraph', ['Opcodes/signalflowgraph.cpp'])
+makePlugin(pluginEnvironment, 'fractalnoise', ['Opcodes/tl/fractalnoise.cpp'])
 
 # platform-specific
 if (getPlatform() == 'linux' or getPlatform() == 'darwin'):
@@ -1685,6 +1699,9 @@ makePlugin(pluginEnvironment, 'scansyn',
 makePlugin(pluginEnvironment, 'fareygen', ['Opcodes/fareygen.c'])
 ##makePlugin(pluginEnvironment, 'ftest', ['Opcodes/ftest.c'])
 
+# Cellular automaton
+makePlugin(pluginEnvironment, 'cellular', ['Opcodes/cellular.c'])
+
 #############################################################################
 #
 # Plugins with External Dependencies
@@ -1754,7 +1771,7 @@ if commonEnvironment['buildImageOpcodes'] == '1':
     if getPlatform() == 'win32':
         if configure.CheckHeader("png.h", language="C") and zlibhfound:
             print 'CONFIGURATION DECISION: Building image opcodes'
-            imEnv = pluginEnvironment.cClone()
+            imEnv = pluginEnvironment.Clone()
             imEnv.Append(LIBS= Split(''' fltk_png fltk_z '''))
             makePlugin(imEnv, 'image', ['Opcodes/imageOpcodes.c'])
     else:
@@ -1787,8 +1804,8 @@ if getPlatform() == 'darwin':
     vstEnvironment.Append(LIBS = ['fltk', 'fltk_images']) # png z jpeg are not on OSX at the mo
 if getPlatform() == 'win32':
     if compilerGNU():
-        vstEnvironment.Append(LINKFLAGS = "--subsystem:windows")
-        guiProgramEnvironment.Append(LINKFLAGS = "--subsystem:windows")
+        vstEnvironment.Append(LINKFLAGS = "-mwindows")
+        guiProgramEnvironment.Append(LINKFLAGS = "-mwindows")
         #vstEnvironment.Append(LIBS = ['stdc++', 'supc++'])
         #guiProgramEnvironment.Append(LIBS = ['stdc++', 'supc++'])
     else:
@@ -2152,7 +2169,6 @@ else:
         pyEnvironment.Append(LIBS = ['dl', 'm'])
     elif getPlatform() == 'win32':
         pyEnvironment['ENV']['PATH'] = os.environ['PATH']
-        pyEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
     pythonOpcodes = makePlugin(pyEnvironment, 'py',
                                ['Opcodes/py/pythonopcodes.c'])
     if getPlatform() == 'win32' and pythonLibs[0] < 'python24':
@@ -2168,13 +2184,13 @@ else:
     
     if getPlatform() == 'linux':
        if(luaFound == 1):
-         luaEnvironment.Append(LIBS = ['lua51'])
+         luaEnvironment.Append(LIBS = ['luajit-5.1'])
          luaEnvironment.Append(LIBS = ['util', 'dl', 'm'])
+         luaEnvironment.Append(CPPPATH = '/usr/local/include/luajit-2.0')
     elif getPlatform() == 'win32':
        if(luaFound == 1):
         luaEnvironment.Append(LIBS = ['lua51'])
         luaEnvironment['ENV']['PATH'] = os.environ['PATH']
-        luaEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
     elif getPlatform() == 'darwin':
         luaEnvironment.Append(LIBS = 'luajit-51')
         luaEnvironment.Append(CPPPATH = '/usr/local/include/luajit-2.0')
@@ -2428,7 +2444,7 @@ else:
         acEnvironment['LINKFLAGS'].remove(flag)
     if getPlatform() == 'linux':
         acEnvironment.Append(LIBS = ['util', 'dl', 'm'])
-        acEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
+        #acEnvironment.Append(SHLINKFLAGS = '--no-export-dynamic')
         acEnvironment.Append(LINKFLAGS = ['-Wl,-rpath-link,.'])
         acEnvironment.Append(LIBS = ['fltk_images'])
         guiProgramEnvironment.Prepend(LINKFLAGS = ['-Wl,-rpath-link,.'])
@@ -2528,7 +2544,7 @@ else:
        	  luaCsoundACWrapperEnvironment.Prepend(LIBS = Split('luaCsnd lua51 CsoundAC csnd fltk_images'))
        else:
        	  luaCsoundACWrapperEnvironment.Prepend(LIBS = [luaWrapper])
-       	  luaCsoundACWrapperEnvironment.Prepend(LIBS = Split('lua CsoundAC csnd fltk_images'))
+       	  luaCsoundACWrapperEnvironment.Prepend(LIBS = Split('luajit-5.1 CsoundAC csnd fltk_images'))
        luaCsoundACWrapper = luaCsoundACWrapperEnvironment.SharedObject(
        	 'frontends/CsoundAC/luaCsoundAC.i', SWIGFLAGS = [swigflags, Split('-lua ')])
        luaCsoundACWrapperEnvironment.Clean('.', 'frontends/CsoundAC/luaCsoundAC_wrap.h')
@@ -2554,7 +2570,7 @@ else:
     vstEnvironment.Append(LIBS = libCsoundLibs)
     if getPlatform() == 'linux':
         vstEnvironment.Append(LIBS = ['util', 'dl', 'm'])
-        vstEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
+        #vstEnvironment.Append(SHLINKFLAGS = '-Wl,--no-export-dynamic')
         vstEnvironment.Append(LINKFLAGS = ['-Wl,-rpath-link,.'])
         guiProgramEnvironment.Prepend(LINKFLAGS = ['-Wl,-rpath-link,.'])
     elif getPlatform() == 'darwin':
@@ -2566,7 +2582,7 @@ else:
     elif getPlatform() == 'win32':
         if compilerGNU():
             vstEnvironment['ENV']['PATH'] = os.environ['PATH']
-            vstEnvironment.Append(SHLINKFLAGS = Split('-Wl,--add-stdcall-alias --no-export-all-symbols'))
+            vstEnvironment.Append(SHLINKFLAGS = Split('-Wl,--add-stdcall-alias'))
             vstEnvironment.Append(CCFLAGS = ['-DNDEBUG'])
             guiProgramEnvironment.Prepend(LINKFLAGS = Split('''
                                    -mwindows -Wl,--enable-runtime-pseudo-reloc
diff --git a/SuSE/README.SuSE b/SuSE/README.SuSE
new file mode 100644
index 0000000..e4b4844
--- /dev/null
+++ b/SuSE/README.SuSE
@@ -0,0 +1,19 @@
+Plugin Directories
+==================
+
+The plugin binaries are installed under /usr/lib/csound/plugins
+(/usr/lib64/csound/plugins in x86_64).  Please set the environment variable
+"OPCODEDIR" to this direcrory before starting csound.
+in bash style,
+	export OPCODEDIR64=/usr/lib/csound/plugins
+in tcsh style,
+	setenv OPCODEDIR64 /usr/lib/csound/plugins
+
+
+Binary Renaming
+===============
+
+sndinfo is renamed to csndinfo in this package due to the name
+confliction with snd package.
+
+Simiarly, extract was renamed to csound-extract.
diff --git a/SuSE/csound-python-2.6-fix.diff b/SuSE/csound-python-2.6-fix.diff
new file mode 100644
index 0000000..23ac7a0
--- /dev/null
+++ b/SuSE/csound-python-2.6-fix.diff
@@ -0,0 +1,145 @@
+--- SConstruct-dist	2008-10-01 14:46:05.000000000 +0200
++++ SConstruct	2008-10-01 15:25:35.000000000 +0200
+@@ -266,19 +266,19 @@
+     Tool('mingw')(commonEnvironment)
+ 
+ customCPPPATH = commonEnvironment['customCPPPATH']
+-commonEnvironment.Prepend(CPPPATH = customCPPPATH)
++commonEnvironment.Prepend(CPPPATH = Split(customCPPPATH))
+ customCCFLAGS = commonEnvironment['customCCFLAGS']
+-commonEnvironment.Prepend(CCFLAGS = customCCFLAGS)
++commonEnvironment.Prepend(CCFLAGS = Split(customCCFLAGS))
+ customCXXFLAGS = commonEnvironment['customCXXFLAGS']
+-commonEnvironment.Prepend(CXXFLAGS = customCXXFLAGS)
++commonEnvironment.Prepend(CXXFLAGS = Split(customCXXFLAGS))
+ customLIBS = commonEnvironment['customLIBS']
+-commonEnvironment.Prepend(LIBS = customLIBS)
++commonEnvironment.Prepend(LIBS = Split(customLIBS))
+ customLIBPATH = commonEnvironment['customLIBPATH']
+-commonEnvironment.Prepend(LIBPATH = customLIBPATH)
++commonEnvironment.Prepend(LIBPATH = Split(customLIBPATH))
+ customSHLINKFLAGS = commonEnvironment['customSHLINKFLAGS']
+-commonEnvironment.Prepend(SHLINKFLAGS = customSHLINKFLAGS)
++commonEnvironment.Prepend(SHLINKFLAGS = Split(customSHLINKFLAGS))
+ customSWIGFLAGS = commonEnvironment['customSWIGFLAGS']
+-commonEnvironment.Prepend(SWIGFLAGS = customSWIGFLAGS)
++commonEnvironment.Prepend(SWIGFLAGS = Split(customSWIGFLAGS))
+ 
+ # Define options for different platforms.
+ if getPlatform() != 'win32':
+@@ -339,15 +339,15 @@
+ # Define different build environments for different types of targets.
+ 
+ if not withMSVC():
+-    commonEnvironment.Prepend(CCFLAGS = "-Wall")
++    commonEnvironment.Prepend(CCFLAGS = ["-Wall"])
+ 
+ if getPlatform() == 'linux':
+-    commonEnvironment.Append(CCFLAGS = "-DLINUX")
+-    commonEnvironment.Append(CPPFLAGS = '-DHAVE_SOCKETS')
+-    commonEnvironment.Append(CPPPATH = '/usr/local/include')
+-    commonEnvironment.Append(CPPPATH = '/usr/include')
+-    commonEnvironment.Append(CPPPATH = '/usr/X11R6/include')
+-    commonEnvironment.Append(CCFLAGS = "-DPIPES")
++    commonEnvironment.Append(CCFLAGS = ["-DLINUX"])
++    commonEnvironment.Append(CPPFLAGS = ['-DHAVE_SOCKETS'])
++    commonEnvironment.Append(CPPPATH = ['/usr/local/include'])
++    commonEnvironment.Append(CPPPATH = ['/usr/include'])
++    commonEnvironment.Append(CPPPATH = ['/usr/X11R6/include'])
++    commonEnvironment.Append(CCFLAGS = ["-DPIPES"])
+     commonEnvironment.Append(LINKFLAGS = ['-Wl,-Bdynamic'])
+ elif getPlatform() == 'darwin':
+     commonEnvironment.Append(CCFLAGS = "-DMACOSX")
+@@ -519,9 +519,9 @@
+ 
+ if getPlatform() == 'win32':
+     if configure.CheckHeader("winsock.h", language = "C"):
+-        commonEnvironment.Append(CPPFLAGS = '-DHAVE_SOCKETS')
++        commonEnvironment.Append(CPPFLAGS = ['-DHAVE_SOCKETS'])
+ elif configure.CheckHeader("sys/socket.h", language = "C"):
+-    commonEnvironment.Append(CPPFLAGS = '-DHAVE_SOCKETS')
++    commonEnvironment.Append(CPPFLAGS = ['-DHAVE_SOCKETS'])
+ 
+ if getPlatform() == 'darwin':
+     commonEnvironment.Append(CPPFLAGS = '-DHAVE_DIRENT_H')
+@@ -954,7 +954,7 @@
+         pyModule_ = env.Program('_%s.so' % targetName, srcs)
+     else:
+         if  getPlatform() == 'linux':
+-         pyModule_ = env.SharedLibrary('%s' % targetName, srcs, SHLIBPREFIX="_", SHLIBSUFFIX = '.so')
++         pyModule_ = env.SharedLibrary('%s' % targetName, srcs, SHLIBPREFIX="_", SHLIBSUFFIX = ['.so'])
+         else:
+ 	 pyModule_ = env.SharedLibrary('_%s' % targetName, srcs, SHLIBSUFFIX = '.pyd')
+         if getPlatform() == 'win32' and pythonLibs[0] < 'python24':
+@@ -992,7 +992,7 @@
+     '''))
+     csoundWrapperEnvironment = csoundInterfacesEnvironment.Copy()
+     fixCFlagsForSwig(csoundWrapperEnvironment)
+-    csoundWrapperEnvironment.Append(CPPFLAGS = '-D__BUILDING_CSOUND_INTERFACES')
++    csoundWrapperEnvironment.Append(CPPFLAGS = ['-D__BUILDING_CSOUND_INTERFACES'])
+     for option in csoundWrapperEnvironment['CCFLAGS']:
+         if string.find(option, '-D') == 0:
+             csoundWrapperEnvironment.Append(SWIGFLAGS = [option])
+@@ -1407,11 +1407,11 @@
+     # distribution into the csound5/Opcodes/Loris directory, e.g.
+     # csound5/Opcodes/Loris/src/*, etc.
+     lorisEnvironment = pluginEnvironment.Copy()
+-    lorisEnvironment.Append(CCFLAGS = '-DHAVE_FFTW3_H')
++    lorisEnvironment.Append(CCFLAGS = ['-DHAVE_FFTW3_H'])
+     if commonEnvironment['buildRelease'] == '0':
+-        lorisEnvironment.Append(CCFLAGS = '-DDEBUG_LORISGENS')
++        lorisEnvironment.Append(CCFLAGS = ['-DDEBUG_LORISGENS'])
+     if getPlatform() == 'win32':
+-        lorisEnvironment.Append(CCFLAGS = '-D_MSC_VER')
++        lorisEnvironment.Append(CCFLAGS = ['-D_MSC_VER'])
+     if not withMSVC():
+         lorisEnvironment.Append(CCFLAGS = Split('''
+             -Wno-comment -Wno-unknown-pragmas -Wno-sign-compare
+@@ -1474,15 +1474,15 @@
+     ''')
+     stkEnvironment = pluginEnvironment.Copy()
+     if getPlatform() == 'win32':
+-        stkEnvironment.Append(CCFLAGS = '-D__OS_WINDOWS__')
++        stkEnvironment.Append(CCFLAGS = ['-D__OS_WINDOWS__'])
+     elif getPlatform() == 'linux':
+-        stkEnvironment.Append(CCFLAGS = '-D__OS_LINUX__')
++        stkEnvironment.Append(CCFLAGS = ['-D__OS_LINUX__'])
+     elif getPlatform() == 'darwin':
+-        stkEnvironment.Append(CCFLAGS = '-D__OS_MACOSX__')
++        stkEnvironment.Append(CCFLAGS = ['-D__OS_MACOSX__'])
+     if sys.byteorder == 'big':
+-        stkEnvironment.Append(CCFLAGS = '-D__BIG_ENDIAN__')
++        stkEnvironment.Append(CCFLAGS = ['-D__BIG_ENDIAN__'])
+     else:
+-        stkEnvironment.Append(CCFLAGS = '-D__LITTLE_ENDIAN__')
++        stkEnvironment.Append(CCFLAGS = ['-D__LITTLE_ENDIAN__'])
+     stkEnvironment.Prepend(CPPPATH = Split('''
+         Opcodes/stk/include Opcodes/stk/src ./ ./../include
+     '''))
+@@ -1523,7 +1523,7 @@
+         pyEnvironment.Append(LIBS = ['dl', 'm'])
+     elif getPlatform() == 'win32':
+         pyEnvironment['ENV']['PATH'] = os.environ['PATH']
+-        pyEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
++        pyEnvironment.Append(SHLINKFLAGS = ['--no-export-all-symbols'])
+     pythonOpcodes = makePlugin(pyEnvironment, 'py',
+                                ['Opcodes/py/pythonopcodes.c'])
+     if getPlatform() == 'win32' and pythonLibs[0] < 'python24':
+@@ -1713,7 +1713,7 @@
+     vstEnvironment.Append(SWIGFLAGS = Split('-c++ -includeall -verbose -outdir .'))
+     if getPlatform() == 'linux':
+         vstEnvironment.Append(LIBS = ['util', 'dl', 'm'])
+-        vstEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
++        vstEnvironment.Append(SHLINKFLAGS = ['--no-export-all-symbols'])
+         vstEnvironment.Append(LINKFLAGS = ['-Wl,-rpath-link,.'])
+         guiProgramEnvironment.Prepend(LINKFLAGS = ['-Wl,-rpath-link,.'])
+         os.spawnvp(os.P_WAIT, 'rm', ['rm', '-f', '_CsoundVST.so'])
+@@ -2029,7 +2029,7 @@
+ print "...Building csLadspa"
+ csLadspaEnv = commonEnvironment.Copy()
+ csLadspaEnv.Append(LIBS=libCsoundLibs)
+-csLadspaEnv.Append(CCFLAGS='-I./frontends/csladspa')
++csLadspaEnv.Append(CCFLAGS=['-I./frontends/csladspa'])
+ csladspa = csLadspaEnv.SharedLibrary('frontends/csladspa/csladspa.cpp', PREFIX="")
+ Depends(csladspa, csoundLibrary)
+ libs.append(csladspa)
diff --git a/SuSE/csound.changes b/SuSE/csound.changes
new file mode 100644
index 0000000..657707c
--- /dev/null
+++ b/SuSE/csound.changes
@@ -0,0 +1,100 @@
+-------------------------------------------------------------------
+Thu Dec 22 -- John ffitch
+
+- Brought into line with csound 5.15
+
+-------------------------------------------------------------------
+Sun Sep 18 00:04:38 UTC 2011 - jengelh at medozas.de
+
+- Remove redundant tags/sections from specfile
+
+-------------------------------------------------------------------
+Thu Jul 16 18:04:52 CEST 2009 - tiwai at suse.de
+
+- fix scons argument to build for 64bit archs (bnc#521979)
+
+-------------------------------------------------------------------
+Wed Jan 28 14:40:46 CET 2009 - tiwai at suse.de
+
+- Fix python module search path insecure issue (bnc#470095)
+  This package is unaffected; the patch is included just for any
+  possible cases in future.
+
+-------------------------------------------------------------------
+Wed Oct  1 15:28:52 CEST 2008 - tiwai at suse.de
+
+- fix build with python-2.6
+
+-------------------------------------------------------------------
+Wed Jun 20 15:44:26 CEST 2007 - tiwai at suse.de
+
+- fix fdupes usage
+
+-------------------------------------------------------------------
+Mon Jun 11 17:57:22 CEST 2007 - tiwai at suse.de
+
+- updated to version 5.06:
+  * fix k-rate, vrandh and vrandi scaling problems, mod fix
+  * new opcodes: partikkel, partikkelsync
+
+-------------------------------------------------------------------
+Tue Mar 27 18:08:43 CEST 2007 - tiwai at suse.de
+
+- update to version 5.05:
+  * fixes/improvements on FLTK support
+  * fix heap overflow
+  * clean up old codes
+
+-------------------------------------------------------------------
+Mon Jan 22 13:11:02 CET 2007 - tiwai at suse.de
+
+- major update to version 5.04
+  (not built with fltk due to lack of threading support)
+
+-------------------------------------------------------------------
+Mon Mar 27 18:54:23 CEST 2006 - pth at suse.de
+
+- Add missing parameter in printf call (bug #129676).
+
+-------------------------------------------------------------------
+Wed Jan 25 21:35:15 CET 2006 - mls at suse.de
+
+- converted neededforbuild to BuildRequires
+
+-------------------------------------------------------------------
+Fri Oct 15 10:54:27 CEST 2004 - tiwai at suse.de
+
+- renamed extract to csound-extract to avoid name confliction
+  (bug #45347).
+
+-------------------------------------------------------------------
+Wed Jun  2 17:05:41 CEST 2004 - tiwai at suse.de
+
+- fixed the ALSA RT plugin with the new API.
+
+-------------------------------------------------------------------
+Sat Jan 10 18:11:42 CET 2004 - adrian at suse.de
+
+- add %run_ldconfig and %defattr
+
+-------------------------------------------------------------------
+Tue Aug  5 12:48:27 CEST 2003 - tiwai at suse.de
+
+- renamed sndinfo to csndinfo to avoid name confliction with snd.
+
+-------------------------------------------------------------------
+Wed Jul 30 12:48:59 CEST 2003 - tiwai at suse.de
+
+- fixed the build on x86-64.
+
+-------------------------------------------------------------------
+Mon Jul 28 16:11:55 CEST 2003 - tiwai at suse.de
+
+- updated to 4.24.1.
+- fixed tmpnam with mkstemp.
+
+-------------------------------------------------------------------
+Thu Feb  1 19:18:36 CET 2001 - tiwai at suse.de
+
+- Initial vesrion: unofficial-4.10.0.0c
+
diff --git a/SuSE/csound.spec b/SuSE/csound.spec
new file mode 100644
index 0000000..69da068
--- /dev/null
+++ b/SuSE/csound.spec
@@ -0,0 +1,97 @@
+#
+# spec file for package csound
+#
+# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
+
+
+Name:           csound
+%define support_fltk	0
+BuildRequires:  alsa-devel fdupes fluidsynth-devel gcc-c++ jack-devel liblo-devel portaudio-devel python-devel scons swig
+%if %support_fltk
+BuildRequires:  fltk-devel libjpeg-devel libpng-devel xorg-x11-devel
+%endif
+Summary:        Computer Sound Synthesis and Composition Program
+Version:        5.16.1
+Release:        130
+License:        GFDL-1.2 ; LGPL-2.1+ ; MIT
+Group:          Productivity/Multimedia/Sound/Utilities
+Source:         Csound%{version}.tar.bz2
+Source1:        README.SuSE
+Url:            http://www.csounds.com
+AutoReq:        on
+Autoprov:       off
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+
+%description
+Csound is a software synthesis program. It is fully modular and
+supports an unlimited amount of oscillators and filters.
+
+For detailed information, refer to http://www.csounds.com.
+
+
+
+%prep
+%setup -q -n Csound%{version}
+cp %{SOURCE1} .
+# fix encoding
+iconv -f latin1 -t utf8 readme-csound5.txt > readme-csound5.txt.utf8
+mv readme-csound5.txt.utf8 readme-csound5.txt
+test -f custom.py || cp custom.py.mkg custom.py
+
+%build
+%if %_lib == "lib64"
+args="Word64=1 Lib64=1"
+%else
+args=""
+%endif
+scons prefix=%{_prefix} buildRelease=1 useDouble=1 useOSC=1 \
+  buildVirtual=1 buildBeats=1 $args \
+  customCCFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
+  customCXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
+
+%install
+%if %_lib == "lib64"
+args="--word64"
+%else
+args=""
+%endif
+mkdir -pv $RPM_BUILD_ROOT%{_datadir}/csound
+./install.py --prefix=%{_prefix} --instdir="$RPM_BUILD_ROOT" $args
+rm -f $RPM_BUILD_ROOT%{_prefix}/csound5-*.md5sums
+rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/csound
+# rename conflicting binary names
+mv $RPM_BUILD_ROOT%{_bindir}/sndinfo $RPM_BUILD_ROOT%{_bindir}/csndinfo
+mv $RPM_BUILD_ROOT%{_bindir}/extract $RPM_BUILD_ROOT%{_bindir}/csound-extract
+# remove devel files
+rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
+rm -rf $RPM_BUILD_ROOT%{_includedir}
+%fdupes -s $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root)
+%doc COPYING ChangeLog INSTALL readme-csound5.txt README.SuSE
+%{_bindir}/*
+%{_libdir}/csound
+%{_datadir}/csound
+%{_datadir}/locale
+# %{_includedir}/*
+# %{_libdir}/lib*
+
+%changelog
diff --git a/To-fix-and-do b/To-fix-and-do
index 99787b7..43c2e62 100644
--- a/To-fix-and-do
+++ b/To-fix-and-do
@@ -1,3 +1,57 @@
+POWER OF TWO ISSUES
+-------------------
+
+envlpx
+envlpxr
+
+oscil
+
+oscil1
+oscili1
+
+foscil
+foscili
+
+loscil
+loscil3 (these don't depend on pow2 but maths could be simplified with
+floating point).
+
+tablei
+table3
+
+buzz
+gbuzz
+
+tablew
+
+vco
+
+fof
+fog
+fof2
+
+grain
+
+partikkel
+
+specscal
+specfilt
+atsadd
+atscross
+
+pitch
+
+oscbank
+
+grain2
+grain3
+oscilikt
+osciliktp
+oscilitkts
+vco2
+
+
+
 KNOWN AREAS OF INCOMPLETENESS
 -----------------------------
 
@@ -45,24 +99,3 @@ KNOWN AREAS OF INCOMPLETENESS
     -look into creating API functions for programmatically building orc from
     opcodes, exposing INSTRTXT chain
 
-================================================================================
-Language Changes
-
--Signal Arrays
-
--Opcode Arrays
-
--new operators: +=, -=, *=, /=
-
-================================================================================
-
-BUGS NOT FIXED
---------------
-
-B2.     Many differences between FL code on Csound and CsoundAV
-
-DOCUMENTATION
--------------
-
- cogoto
-
diff --git a/Top/argdecode.c b/Top/argdecode.c
index ad68dba..f7559fb 100644
--- a/Top/argdecode.c
+++ b/Top/argdecode.c
@@ -133,7 +133,7 @@ static const char *longUsageList[] = {
   Str_noop("--noheader\t\tRaw format"),
   Str_noop("--nopeaks\t\tDo not write peak information"),
   " ",
-  Str_noop("--nodisplays\t\tsUppress all displays"),
+  Str_noop("--nodisplays\t\tSuppress all displays"),
   Str_noop("--asciidisplay\t\tSuppress graphics, use ascii displays"),
   Str_noop("--postscriptdisplay\tSuppress graphics, use Postscript displays"),
   " ",
@@ -424,6 +424,8 @@ static int decode_long(CSOUND *csound, char *s, int argc, char **argv)
     }
     else if (!(strcmp (s, "nodisplays"))) {
       O->displays = 0;                  /* no func displays */
+      O->graphsoff = 1;
+      O->postscript = 0;
       return 1;
     }
     else if (!(strcmp (s, "displays"))) {
@@ -1026,6 +1028,8 @@ int argdecode(CSOUND *csound, int argc, char **argv_)
             break;
           case 'd':
             O->displays = 0;              /* no func displays */
+            O->graphsoff = 1;
+            O->postscript = 0;                  
             break;
           case 'g':
             O->graphsoff = 1;             /* don't use graphics */
diff --git a/Top/cscorfns.c b/Top/cscorfns.c
index 7cc3e32..a7a46c7 100644
--- a/Top/cscorfns.c
+++ b/Top/cscorfns.c
@@ -23,6 +23,7 @@
 
 #include "csoundCore.h"     /*                      CSCORFNS.C      */
 #include "cscore.h"
+#include "corfile.h"
 
 #define TYP_FREE   0
 #define TYP_EVENT  1
@@ -290,7 +291,7 @@ PUBLIC EVENT * cscoreGetEvent(CSOUND *csound)
 {
     EVENT *e;
 
-    if (csound->scfp != NULL && !atEOF && nxtevt->op != '\0')
+    if (!atEOF && nxtevt->op != '\0')
       e = cscoreCopyEvent(csound, nxtevt);
     else e = NULL;
     if (!(rdscor(csound, nxtevtblk))) {
@@ -389,6 +390,8 @@ PUBLIC EVLIST * cscoreListGetSection(CSOUND *csound)
 
     a = cscoreListCreate(csound, NSLOTS);
     p = &a->e[1];
+    if (csound->scstr == NULL || csound->scstr->body[0] == '\0')
+      return a;
     while ((e = cscoreGetEvent(csound)) != NULL) {
       if (e->op == 's' || e->op == 'e')
         break;
@@ -796,7 +799,9 @@ static void makecurrent(CSOUND *csound, FILE *fp)
           atEOF = infp->atEOF;
           csound->warped = infp->warped;
           if (nxtevt->op == '\0')
-            if (!(rdscor(csound, nxtevtblk))) {
+            if (csound->scstr == NULL ||
+                csound->scstr->body[0] == '\0' ||
+                !(rdscor(csound, nxtevtblk))) {
               nxtevt->op = '\0';
               atEOF = 1;
             }
@@ -809,7 +814,7 @@ static void makecurrent(CSOUND *csound, FILE *fp)
 
 /* verify initial scfp, init other data */
 /* record & make all this current       */
-
+#ifdef OLD_CODE
 PUBLIC int csoundInitializeCscore(CSOUND *csound, FILE* insco, FILE* outsco)
 {
     EVENT   *next;
@@ -835,6 +840,38 @@ PUBLIC int csoundInitializeCscore(CSOUND *csound, FILE* insco, FILE* outsco)
 
     return CSOUND_SUCCESS;
 }
+#endif
+
+PUBLIC int csoundInitializeCscore(CSOUND *csound, FILE* insco, FILE* outsco)
+{
+    EVENT  *next;
+
+    if (insco != NULL) {
+      CORFIL *inf = corfile_create_w();
+      int c;
+      while ((c=getc(insco))!=EOF) corfile_putc(c, inf);
+      corfile_rewind(inf);
+      csound->scstr = inf;
+    }
+    if (outsco == NULL) {
+      csound->ErrorMsg(csound,
+                       Str("csoundInitializeCscore: no output score given."));
+      return CSOUND_INITIALIZATION;
+    }
+    csound->scfp = insco;
+    csound->oscfp = outsco;
+
+    next = cscoreCreateEvent(csound, PMAX); /* creat EVENT blk receiving buf */
+    next->op = '\0';
+
+    savinfdata(csound, csound->scfp,
+               next, FL(0.0), 1, 0, 0);    /* curuntil 0, wasend, non-warp, not eof */
+    makecurrent(csound, csound->scfp);  /* make all this current         */
+
+    return CSOUND_SUCCESS;
+}
+
+
 
 /* open new cscore input file, init data */
 /* & save;  no rdscor until made current */
@@ -896,6 +933,17 @@ PUBLIC FILE *cscoreFileGetCurrent(CSOUND *csound)
 
 PUBLIC void cscoreFileSetCurrent(CSOUND *csound, FILE *fp)
 {
+    if (fp != NULL) {
+      CORFIL *inf = corfile_create_w();
+      int c;
+      fseek(fp, 0, SEEK_SET);
+      while ((c=getc(fp))!=EOF) corfile_putc(c, inf);
+      corfile_rewind(inf);
+      corfile_rm(&csound->scstr);
+      csound->scstr = inf;
+      nxtevt->op = NULL;
+      atEOF = 0;
+    }
     if (csound->scfp != NULL)
       savinfdata(csound,
                  csound->scfp, nxtevt, curuntil, wasend, csound->warped, atEOF);
diff --git a/Top/csmodule.c b/Top/csmodule.c
index 7ff29fe..f3c1f75 100644
--- a/Top/csmodule.c
+++ b/Top/csmodule.c
@@ -350,9 +350,8 @@ static CS_NOINLINE int csoundLoadExternal(CSOUND *csound,
     return CSOUND_SUCCESS;
 }
 
-static int csoundCheckOpcodeDeny(CSOUND *csound, const char *fname)
+static int csoundCheckOpcodeDeny(const char *fname)
 {
-    (void *)csound;
     /* Check to see if the fname is on the do-not-load list */
     char buff[256];
     char *p, *deny;
@@ -733,7 +732,7 @@ int csoundLoadModules(CSOUND *csound)
         continue;
       }
       /* printf("DEBUG %s(%d): possibly deny %s\n", __FILE__, __LINE__,fname); */
-      if (csoundCheckOpcodeDeny(csound, fname)) {
+      if (csoundCheckOpcodeDeny(fname)) {
         csound->Warning(csound, Str("Library %s omitted\n"), fname);
         continue;
       }
@@ -1318,6 +1317,8 @@ extern long pvlock_localops_init(CSOUND *, void *);
 extern long fareyseq_localops_init(CSOUND *, void *);
 extern long cpumeter_localops_init(CSOUND *, void *);
 extern long mp3in_localops_init(CSOUND *, void *);
+extern long gendy_localops_init(CSOUND *, void *);
+extern long scnoise_localops_init(CSOUND *, void *);
 
 extern int stdopc_ModuleInit(CSOUND *csound);
 extern int pvsopc_ModuleInit(CSOUND *csound);
@@ -1347,7 +1348,8 @@ const INITFN staticmodules[] = { hrtfopcodes_localops_init, babo_localops_init,
 #ifndef WIN32
                                  cpumeter_localops_init,
 #endif
-                                 mp3in_localops_init, NULL };
+                                 mp3in_localops_init, gendy_localops_init,
+                                 scnoise_localops_init, NULL };
 
 typedef NGFENS* (*FGINITFN)(CSOUND *);
 
diff --git a/Top/csound.c b/Top/csound.c
index dd96579..67b1e45 100644
--- a/Top/csound.c
+++ b/Top/csound.c
@@ -654,13 +654,7 @@ extern "C" {
       1,            /*    numThreads        */
       0,            /*    syntaxCheckOnly   */
       1,            /*    useCsdLineCounts  */
-#if defined(PARCS) ||  defined(ENABLE_NEW_PARSER)
-#ifdef BETA
       1,            /*    newParser   */
-#else
-      0,            /*    newParser   */
-#endif
-#endif
       0,            /*    calculateWeights   */
     },
     0L, 0L,         /*  instxtcount, optxtsize  */
@@ -711,8 +705,10 @@ extern "C" {
     {NULL, NULL, NULL}, /* For extra strings in scores */
     {0, 0, 0},      /* For extra strings in scores */
     300,             /* Count for generated labels */
-    NULL,
-    NULL
+    NULL,            /* pow2 table */
+    NULL,            /* cps conv table */
+    NULL,            /* output of preprocessor */
+    { NULL, NULL, NULL}/* for location directory */
   };
 
   /* from threads.c */
@@ -1600,7 +1596,8 @@ extern "C" {
           TRACE_1("[%i] Barrier2 Done\n", 0);
           TIMER_END(thread, "");
 
-#if !defined(LINEAR_CACHE) && !defined(HASH_CACHE)
+/* #if !defined(LINEAR_CACHE) && !defined(HASH_CACHE) */
+#if defined(LINEAR_CACHE) || defined(HASH_CACHE)
             csp_dag_dealloc(csound, &dag2);
 #else
           dag2 = NULL;
@@ -2628,6 +2625,7 @@ extern "C" {
       CSOUND    *saved_env;
       void      *p1, *p2;
       uintptr_t length;
+      int n = 0;
      
       csoundCleanup(csound);
  
@@ -2680,6 +2678,8 @@ extern "C" {
       memcpy(&(csound->exitjmp), &(saved_env->exitjmp), sizeof(jmp_buf));
       csound->memalloc_db = saved_env->memalloc_db;
       free(saved_env);
+      while (csound->filedir[n])        /* Clear source directoiry */
+        free(csound->filedir[n++]);
    
   }
 
diff --git a/Top/main.c b/Top/main.c
index 94c2949..7781858 100644
--- a/Top/main.c
+++ b/Top/main.c
@@ -84,8 +84,8 @@ PUBLIC int csoundCompile(CSOUND *csound, int argc, char **argv)
     OPARMS  *O = csound->oparms;
     char    *s;
     char    *sortedscore = NULL;
-    char    *xtractedscore = "score.xtr";
-    FILE    *scorin = NULL, *scorout = NULL, *xfile = NULL;
+    //    char    *xtractedscore = "score.xtr";
+    FILE    *xfile = NULL;
     int     n;
     int     csdFound = 0;
     char    *fileDir;
@@ -313,7 +313,15 @@ PUBLIC int csoundCompile(CSOUND *csound, int argc, char **argv)
       /*  does not deal with search paths */
       csound->Message(csound, Str("orchname:  %s\n"), csound->orchname);
       csound->orchstr = copy_to_corefile(csound, csound->orchname, NULL, 0);
-      csound->orchname = NULL;
+      if (csound->orchstr==NULL)
+        csound->Die(csound,
+                    Str("Failed to open input file %s\n"), csound->orchname);
+#ifdef ENABLE_NEW_PARSER
+      if (O->newParser) corfile_puts("\n#exit\n", csound->orchstr);
+#endif
+      corfile_putc('\0', csound->orchstr);
+      corfile_putc('\0', csound->orchstr);
+      //csound->orchname = NULL;
     }
     if (csound->xfilename != NULL)
       csound->Message(csound, "xfilename: %s\n", csound->xfilename);
@@ -327,14 +335,14 @@ PUBLIC int csoundCompile(CSOUND *csound, int argc, char **argv)
 #ifdef ENABLE_NEW_PARSER
     if (O->newParser) {
       int new_orc_parser(CSOUND *);
-      csound->Message(csound, "********************\n");
-      csound->Message(csound, "* USING NEW PARSER *\n");
-      csound->Message(csound, "********************\n");
       if (new_orc_parser(csound)) {
         csoundDie(csound, Str("Stopping on parser failure\n"));
       }
     }
     else {
+      csound->Message(csound, "********************\n");
+      csound->Message(csound, "* USING OLD PARSER *\n");
+      csound->Message(csound, "********************\n");
       otran(csound);                  /* read orcfile, setup desblks & spaces */
     }
 #else
@@ -377,24 +385,12 @@ PUBLIC int csoundCompile(CSOUND *csound, int argc, char **argv)
       }
     }
     if (csound->xfilename != NULL) {            /* optionally extract */
-      if (!strcmp(csound->scorename, "score.xtr"))
-        csoundDie(csound, Str("cannot extract %s, name conflict"),
-                  csound->scorename);
       if (!(xfile = fopen(csound->xfilename, "r")))
         csoundDie(csound, Str("cannot open extract file %s"),csound->xfilename);
       csoundNotifyFileOpened(csound, csound->xfilename,
                              CSFTYPE_EXTRACT_PARMS, 0, 0);
-      if (!(scorin = fopen(sortedscore, "r")))
-        csoundDie(csound, Str("cannot reopen %s"), sortedscore);
-      csoundNotifyFileOpened(csound, sortedscore, CSFTYPE_SCORE_OUT,  0,
-                             (csound->tempStatus & csScoSortMask)!=0);
-      if (!(scorout = fopen(xtractedscore, "w")))
-        csoundDie(csound, Str("cannot open %s for writing"), xtractedscore);
-      csoundNotifyFileOpened(csound, xtractedscore, CSFTYPE_SCORE_OUT, 1, 0);
       csound->Message(csound, Str("  ... extracting ...\n"));
-      scxtract(csound, scorin, scorout, xfile);
-      fclose(scorin);
-      fclose(scorout);
+      scxtract(csound, csound->scstr, xfile);
       fclose(xfile);
       csound->tempStatus &= ~csPlayScoMask;
     }
diff --git a/Top/one_file.c b/Top/one_file.c
index 276ebc1..1a427cc 100644
--- a/Top/one_file.c
+++ b/Top/one_file.c
@@ -26,6 +26,7 @@
 int mkstemp(char *);
 #include <ctype.h>
 #include <errno.h>
+#include <stdlib.h>
 #include "corfile.h"
 
 #if defined(LINUX) || defined(__MACH__) || defined(WIN32)
@@ -106,8 +107,13 @@ CS_NOINLINE char *csoundTmpFileName(CSOUND *csound, char *buf, const char *ext)
       do {
 #endif
 #ifndef WIN32
-        if (UNLIKELY(mytmpnam(buf) == NULL))
+        //        if (UNLIKELY(mytmpnam(buf) == NULL))
+        //          csound->Die(csound, Str(" *** cannot create temporary file"));
+        int fd;
+        strcpy(buf, "/tmp/csoundXXXXXX");
+        if (UNLIKELY((fd = mkstemp(buf)) < 0))
           csound->Die(csound, Str(" *** cannot create temporary file"));
+        close(fd);
 #else
         {
           char  *s = (char*) csoundGetEnv(csound, "SFDIR");
@@ -344,7 +350,12 @@ static int createOrchestra(CSOUND *csound, FILE *unf)
       p = buffer;
       while (*p == ' ' || *p == '\t') p++;
       if (strstr(p, "</CsInstruments>") == p) {
-        corfile_flush(incore);
+        //corfile_flush(incore);
+#ifdef ENABLE_NEW_PARSER
+        if (csound->oparms->newParser) corfile_puts("\n#exit\n", incore);
+#endif
+        corfile_putc('\0', incore);
+        corfile_putc('\0', incore);
         csound->orchstr = incore;
         return TRUE;
       }
@@ -521,13 +532,13 @@ static int createMIDI2(CSOUND *csound, FILE *unf)
     return FALSE;
 }
 
-static int createSample(CSOUND *csound, FILE *unf)
+static int createSample(CSOUND *csound, char *buffer, FILE *unf)
 {
     int   num;
     FILE  *smpf;
     void  *fd;
     char  sampname[256];
-    char  buffer[CSD_MAX_LINE_LEN];
+    /* char  buffer[CSD_MAX_LINE_LEN]; */
 
     sscanf(buffer, "<CsSampleB filename=\"%d\">", &num);
     sprintf(sampname, "soundin.%d", num);
@@ -556,12 +567,12 @@ static int createSample(CSOUND *csound, FILE *unf)
     return FALSE;
 }
 
-static int createFile(CSOUND *csound, FILE *unf)
+static int createFile(CSOUND *csound, char *buffer, FILE *unf)
 {
     FILE  *smpf;
     void  *fd;
     char  filename[256];
-    char  buffer[CSD_MAX_LINE_LEN];
+    /* char  buffer[CSD_MAX_LINE_LEN]; */
     char *p = buffer, *q;
 
     filename[0] = '\0';
@@ -772,11 +783,11 @@ int read_unified_file(CSOUND *csound, char **pname, char **score)
         result = r && result;
       }
       else if (strstr(p, "<CsSampleB filename=") == p) {
-        r = createSample(csound, unf);
+        r = createSample(csound, buffer,unf);
         result = r && result;
       }
       else if (strstr(p, "<CsFileB filename=") == p) {
-        r = createFile(csound, unf);
+        r = createFile(csound, buffer, unf);
         result = r && result;
       }
       else if (strstr(p, "<CsVersion>") == p) {
diff --git a/Top/utility.c b/Top/utility.c
index 4f8c5ed..ee5086b 100644
--- a/Top/utility.c
+++ b/Top/utility.c
@@ -23,6 +23,7 @@
 
 #include "csoundCore.h"
 #include <setjmp.h>
+#include "corfile.h"
 
 typedef struct csUtility_s {
     char                *name;
@@ -243,11 +244,19 @@ PUBLIC const char *csoundGetUtilityDescription(CSOUND *csound,
 PUBLIC int csoundScoreSort(CSOUND *csound, FILE *inFile, FILE *outFile)
 {
     int   err;
-
+    CORFIL *inf = corfile_create_w();
+    int c;
     if ((err = setjmp(csound->exitjmp)) != 0) {
       return ((err - CSOUND_EXITJMP_SUCCESS) | CSOUND_EXITJMP_SUCCESS);
     }
-    scsort(csound, inFile, outFile);
+    while ((c=getc(inFile))!=EOF) corfile_putc(c, inf);
+    corfile_rewind(inf);
+    /* scsortstr() ignores the second arg - Jan 5 2012 */
+    csound->scorestr = inf;
+    scsortstr(csound, inf);
+    while ((c=corfile_getc(csound->scstr))!=EOF)
+      putc(c, outFile);
+    corfile_rm(&csound->scstr);
     return 0;
 }
 
@@ -262,11 +271,16 @@ PUBLIC int csoundScoreExtract(CSOUND *csound,
                               FILE *inFile, FILE *outFile, FILE *extractFile)
 {
     int   err;
-
+    CORFIL *inf = corfile_create_w();
+    int c;
     if ((err = setjmp(csound->exitjmp)) != 0) {
       return ((err - CSOUND_EXITJMP_SUCCESS) | CSOUND_EXITJMP_SUCCESS);
     }
-    scxtract(csound, inFile, outFile, extractFile);
+    while ((c=getc(inFile))!=EOF) corfile_putc(c, inf);
+    corfile_rewind(inf);
+    scxtract(csound, inf, extractFile);
+    while ((c=corfile_getc(csound->scstr))!=EOF)
+      putc(c, outFile);
+    corfile_rm(&csound->scstr);
     return 0;
 }
-
diff --git a/build-linux-double.sh b/build-linux-double.sh
index 796fcae..b8c84ff 100755
--- a/build-linux-double.sh
+++ b/build-linux-double.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-scons usePortMIDI=0 custom=custom-linux-mkg.py buildLuaWrapper=1 buildPythonWrapper=1 useJack=1 buildCsoundVST=1 buildvst4cs=0 buildInterfaces=1 buildCsoundAC=1 buildJavaWrapper=0 useOSC=1 buildPythonOpcodes=1 buildLoris=0 buildStkOpcodes=1 buildWinsound=1 noFLTKThreads=0 useLrint=1 usePortAudio=0 buildPDClass=1 buildVirtual=1 buildTclcsound=0 buildLua=1 useDouble=1 dynamicCsoundLibrary=1 buildRelease=0 buildDSSI=1 noDebug=0 gcc4opt=atom $1 $2 $3 $4
+scons usePortMIDI=0 custom=custom-linux-mkg.py buildLuaWrapper=1 buildLuaOpcodes=1 buildPythonWrapper=1 useJack=1 buildCsoundVST=0 buildvst4cs=0 buildInterfaces=1 buildCsoundAC=1 buildJavaWrapper=0 useOSC=1 buildPythonOpcodes=1 buildLoris=0 buildStkOpcodes=1 buildWinsound=1 noFLTKThreads=0 useLrint=1 usePortAudio=0 buildPDClass=1 buildVirtual=1 buildTclcsound=1 buildLua=1 useDouble=1 dynamicCsoundLibrary=1 buildRelease=0 buildDSSI=1 noDebug=0 gcc4opt=atom $1 $2 $3 $4
 
 # doxygen
diff --git a/custom-linux-mkg.py b/custom-linux-mkg.py
index b96d37d..b5e3a44 100644
--- a/custom-linux-mkg.py
+++ b/custom-linux-mkg.py
@@ -17,6 +17,7 @@ customSWIGFLAGS = []
 
 if sys.platform[:5] == 'linux':
     platform = 'linux'
+    customCPPPATH.append('/usr/include')
     customCPPPATH.append('/usr/include/fltk-1.1')
     customLIBPATH.append('/usr/lib/fltk-1.1')
     customCPPPATH.append('/usr/share/musicxml-v2/src/elements')
@@ -25,10 +26,11 @@ if sys.platform[:5] == 'linux':
     customCPPPATH.append('/usr/share/musicxml-v2/src/lib')
     customCPPPATH.append('/usr/share/musicxml-v2/src/visitors')
     customLIBPATH.append('/usr/share/musicxml-v2')
-    customCPPPATH.append('/home/mkg/share/LuaJIT-1.1.5/src')
-    customLIBPATH.append('/home/mkg/share/LuaJIT-1.1.5/src')
+    customCPPPATH.append('/usr/include/luajit-2.0')
+    customCPPPATH.append('/usr/include/lua5.1')
     customCPPPATH.append('/home/mkg/csound5/frontends/CsoundVST')    
     customCPPPATH.append('/home/mkg/csound5/frontends/CsoundVST/vstsdk2.4')    
+    customCPPPATH.append('/usr/include/tcl8.5')
 elif sys.platform == 'darwin':
     platform = 'darwin'
     customCPPPATH.append('/usr/include/malloc')
@@ -77,8 +79,8 @@ elif sys.platform[:3] == 'win':
     #customCPPPATH.append('C:/Python24/include')
     #customLIBPATH.append('C:/Python24/Libs')    
     #customLIBPATH.append('D:/utah/msys/1.0/local/lib')
-    customCPPPATH.append('C:/Python25/include')
-    customLIBPATH.append('C:/Python25/Libs')    
+    #customCPPPATH.append('C:/Python25/include')
+    #customLIBPATH.append('C:/Python25/Libs')    
     ###############################################################
     # If you want to build vst4cs you need the include
     # path to the VST SDK header files. Add them there:
diff --git a/examples/csoundapi_tilde/csoundapi.pd b/examples/csoundapi_tilde/csoundapi.pd
index 0148a1f..032340d 100755
--- a/examples/csoundapi_tilde/csoundapi.pd
+++ b/examples/csoundapi_tilde/csoundapi.pd
@@ -1,4 +1,4 @@
-#N canvas 121 78 1080 708 10;
+#N canvas 460 170 1299 880 10;
 #X obj 346 558 dac~;
 #X msg 359 202 event e;
 #X obj 297 23 vsl 15 128 0.1 4 0 0 empty empty empty 0 -8 0 8 -257472
@@ -64,8 +64,7 @@ run 1 re-starts it;
 #X text 464 436 console messages on/off;
 #X text 467 109 unlike invalue channels \, chnget channels do not need
 to be registered;
-#X text 454 94 comment;
-#X text 454 80 chnset messages send in k-rate numbers or strings \,
+#X text 448 71 chnset messages send in k-rate numbers or strings \,
 they work with chnget opcode;
 #X text 440 603 csoundapi~ is built with the number of audio output
 channels taken from the orchestra \, or it can be built with a set
@@ -73,6 +72,570 @@ number of out/inlets (when its 1st argument is numeric);
 #X text 566 481 the CSD or ORC/SCO files should be either in the canvas
 directory or should be given a full-path relative to the canvas directory
 ;
+#N canvas 0 22 450 300 (subpatch) 0;
+#X array table1 4096 float 3;
+#A 0 0 0.00465754 0.00931496 0.0139722 0.018629 0.0232854 0.0279413
+0.0325964 0.0372508 0.0419043 0.0465567 0.051208 0.0558581 0.0605068
+0.065154 0.0697996 0.0744436 0.0790857 0.0837259 0.0883641 0.0930002
+0.0976339 0.102265 0.106894 0.111521 0.116144 0.120765 0.125383 0.129998
+0.134609 0.139218 0.143823 0.148424 0.153022 0.157616 0.162207 0.166793
+0.171375 0.175954 0.180528 0.185097 0.189662 0.194223 0.198779 0.20333
+0.207876 0.212417 0.216953 0.221484 0.226009 0.230529 0.235043 0.239552
+0.244054 0.248551 0.253042 0.257527 0.262006 0.266478 0.270944 0.275403
+0.279856 0.284302 0.288741 0.293173 0.297599 0.302017 0.306427 0.310831
+0.315227 0.319615 0.323996 0.328369 0.332734 0.337091 0.34144 0.34578
+0.350113 0.354437 0.358753 0.36306 0.367358 0.371648 0.375929 0.380201
+0.384464 0.388717 0.392962 0.397197 0.401422 0.405638 0.409845 0.414041
+0.418228 0.422405 0.426572 0.430729 0.434875 0.439011 0.443137 0.447253
+0.451358 0.455452 0.459535 0.463608 0.467669 0.47172 0.47576 0.479788
+0.483805 0.487811 0.491805 0.495788 0.499759 0.503718 0.507666 0.511602
+0.515525 0.519437 0.523337 0.527224 0.531099 0.534962 0.538812 0.54265
+0.546475 0.550287 0.554087 0.557874 0.561648 0.565409 0.569156 0.572891
+0.576612 0.580321 0.584015 0.587697 0.591364 0.595019 0.598659 0.602286
+0.605899 0.609498 0.613083 0.616654 0.620211 0.623754 0.627282 0.630797
+0.634296 0.637782 0.641253 0.644709 0.648151 0.651578 0.654991 0.658388
+0.661771 0.665139 0.668492 0.67183 0.675152 0.67846 0.681752 0.685029
+0.68829 0.691537 0.694767 0.697983 0.701182 0.704366 0.707535 0.710687
+0.713824 0.716945 0.72005 0.72314 0.726213 0.72927 0.732311 0.735336
+0.738345 0.741338 0.744314 0.747274 0.750218 0.753145 0.756056 0.758951
+0.761828 0.76469 0.767534 0.770363 0.773174 0.775969 0.778747 0.781508
+0.784252 0.786979 0.78969 0.792383 0.79506 0.79772 0.800362 0.802988
+0.805596 0.808187 0.810762 0.813318 0.815858 0.818381 0.820886 0.823374
+0.825844 0.828297 0.830733 0.833152 0.835553 0.837936 0.840302 0.842651
+0.844982 0.847296 0.849592 0.85187 0.854131 0.856374 0.8586 0.860808
+0.862998 0.865171 0.867326 0.869463 0.871583 0.873685 0.875769 0.877836
+0.879885 0.881916 0.883929 0.885924 0.887902 0.889862 0.891804 0.893728
+0.895635 0.897524 0.899395 0.901248 0.903083 0.9049 0.9067 0.908482
+0.910246 0.911992 0.913721 0.915432 0.917125 0.9188 0.920457 0.922096
+0.923718 0.925322 0.926908 0.928477 0.930028 0.931561 0.933076 0.934573
+0.936053 0.937515 0.93896 0.940387 0.941796 0.943188 0.944562 0.945918
+0.947257 0.948578 0.949881 0.951168 0.952436 0.953687 0.954921 0.956137
+0.957336 0.958517 0.959681 0.960828 0.961957 0.963069 0.964164 0.965241
+0.966301 0.967344 0.96837 0.969379 0.97037 0.971345 0.972302 0.973242
+0.974166 0.975072 0.975961 0.976834 0.97769 0.978528 0.97935 0.980156
+0.980944 0.981716 0.982471 0.98321 0.983932 0.984637 0.985326 0.985999
+0.986655 0.987295 0.987918 0.988525 0.989116 0.989691 0.990249 0.990791
+0.991318 0.991828 0.992322 0.9928 0.993263 0.993709 0.99414 0.994555
+0.994955 0.995338 0.995706 0.996059 0.996396 0.996718 0.997024 0.997315
+0.99759 0.997851 0.998096 0.998326 0.998541 0.998741 0.998926 0.999096
+0.999251 0.999392 0.999517 0.999629 0.999725 0.999807 0.999874 0.999927
+0.999966 0.99999 1 0.999996 0.999977 0.999945 0.999899 0.999838 0.999764
+0.999676 0.999574 0.999459 0.99933 0.999187 0.999031 0.998861 0.998678
+0.998482 0.998273 0.99805 0.997814 0.997566 0.997304 0.997029 0.996742
+0.996442 0.996129 0.995804 0.995466 0.995115 0.994753 0.994377 0.99399
+0.993591 0.993179 0.992755 0.99232 0.991872 0.991413 0.990942 0.990459
+0.989965 0.989459 0.988942 0.988414 0.987874 0.987323 0.986761 0.986187
+0.985603 0.985008 0.984402 0.983786 0.983158 0.98252 0.981872 0.981213
+0.980544 0.979864 0.979175 0.978475 0.977765 0.977045 0.976316 0.975576
+0.974827 0.974068 0.9733 0.972522 0.971735 0.970938 0.970132 0.969317
+0.968493 0.96766 0.966818 0.965967 0.965108 0.96424 0.963363 0.962478
+0.961584 0.960682 0.959772 0.958854 0.957927 0.956993 0.95605 0.9551
+0.954142 0.953176 0.952203 0.951222 0.950234 0.949238 0.948236 0.947226
+0.946209 0.945185 0.944154 0.943116 0.942071 0.94102 0.939962 0.938898
+0.937827 0.93675 0.935667 0.934577 0.933482 0.93238 0.931273 0.93016
+0.92904 0.927916 0.926786 0.92565 0.924509 0.923362 0.92221 0.921053
+0.919891 0.918724 0.917552 0.916376 0.915194 0.914008 0.912817 0.911622
+0.910423 0.909219 0.90801 0.906798 0.905582 0.904361 0.903137 0.901909
+0.900677 0.899441 0.898202 0.896959 0.895713 0.894463 0.893211 0.891955
+0.890696 0.889433 0.888168 0.886901 0.88563 0.884356 0.88308 0.881802
+0.880521 0.879238 0.877952 0.876664 0.875374 0.874082 0.872788 0.871492
+0.870194 0.868894 0.867593 0.86629 0.864986 0.86368 0.862373 0.861064
+0.859754 0.858444 0.857132 0.855819 0.854505 0.85319 0.851875 0.850559
+0.849242 0.847925 0.846607 0.845289 0.84397 0.842652 0.841333 0.840014
+0.838695 0.837376 0.836057 0.834738 0.83342 0.832102 0.830784 0.829467
+0.82815 0.826834 0.825518 0.824204 0.82289 0.821577 0.820265 0.818954
+0.817644 0.816335 0.815027 0.813721 0.812416 0.811112 0.80981 0.80851
+0.807211 0.805913 0.804618 0.803324 0.802032 0.800742 0.799454 0.798168
+0.796884 0.795603 0.794323 0.793046 0.791771 0.790498 0.789228 0.787961
+0.786696 0.785434 0.784174 0.782917 0.781663 0.780412 0.779164 0.777919
+0.776677 0.775438 0.774202 0.772969 0.771739 0.770513 0.76929 0.768071
+0.766854 0.765642 0.764433 0.763228 0.762026 0.760828 0.759634 0.758443
+0.757257 0.756074 0.754895 0.75372 0.75255 0.751383 0.75022 0.749062
+0.747908 0.746758 0.745613 0.744471 0.743335 0.742202 0.741074 0.739951
+0.738832 0.737718 0.736608 0.735503 0.734403 0.733308 0.732217 0.731131
+0.73005 0.728974 0.727903 0.726837 0.725776 0.72472 0.723669 0.722623
+0.721582 0.720547 0.719517 0.718491 0.717472 0.716457 0.715448 0.714444
+0.713446 0.712453 0.711465 0.710483 0.709507 0.708536 0.70757 0.70661
+0.705656 0.704708 0.703765 0.702827 0.701896 0.70097 0.70005 0.699136
+0.698227 0.697325 0.696428 0.695537 0.694652 0.693773 0.692899 0.692032
+0.691171 0.690315 0.689466 0.688622 0.687785 0.686954 0.686128 0.685309
+0.684496 0.683689 0.682888 0.682093 0.681304 0.680522 0.679745 0.678975
+0.678211 0.677453 0.676701 0.675955 0.675216 0.674483 0.673756 0.673035
+0.672321 0.671613 0.670911 0.670215 0.669525 0.668842 0.668165 0.667494
+0.66683 0.666172 0.66552 0.664874 0.664235 0.663601 0.662974 0.662354
+0.661739 0.661131 0.660529 0.659934 0.659344 0.658761 0.658184 0.657614
+0.657049 0.656491 0.655939 0.655393 0.654854 0.654321 0.653793 0.653272
+0.652758 0.652249 0.651747 0.65125 0.65076 0.650276 0.649798 0.649326
+0.64886 0.648401 0.647947 0.647499 0.647058 0.646622 0.646193 0.645769
+0.645352 0.64494 0.644534 0.644134 0.643741 0.643353 0.642971 0.642594
+0.642224 0.641859 0.6415 0.641147 0.6408 0.640459 0.640123 0.639793
+0.639468 0.639149 0.638836 0.638528 0.638226 0.63793 0.637639 0.637354
+0.637074 0.636799 0.63653 0.636266 0.636008 0.635755 0.635507 0.635265
+0.635028 0.634796 0.634569 0.634348 0.634132 0.63392 0.633714 0.633513
+0.633317 0.633126 0.63294 0.632759 0.632583 0.632412 0.632245 0.632083
+0.631927 0.631774 0.631627 0.631484 0.631346 0.631213 0.631084 0.630959
+0.630839 0.630724 0.630613 0.630506 0.630404 0.630306 0.630212 0.630123
+0.630038 0.629957 0.62988 0.629807 0.629738 0.629673 0.629613 0.629556
+0.629503 0.629454 0.629409 0.629367 0.62933 0.629296 0.629265 0.629239
+0.629216 0.629196 0.62918 0.629167 0.629158 0.629152 0.62915 0.62915
+0.629154 0.629162 0.629172 0.629185 0.629202 0.629221 0.629244 0.629269
+0.629298 0.629329 0.629363 0.6294 0.629439 0.629482 0.629526 0.629574
+0.629624 0.629676 0.629731 0.629788 0.629848 0.62991 0.629974 0.630041
+0.630109 0.63018 0.630253 0.630328 0.630404 0.630483 0.630564 0.630646
+0.630731 0.630817 0.630905 0.630994 0.631085 0.631178 0.631272 0.631367
+0.631464 0.631563 0.631662 0.631764 0.631866 0.631969 0.632074 0.632179
+0.632286 0.632394 0.632502 0.632612 0.632722 0.632833 0.632945 0.633058
+0.633171 0.633285 0.6334 0.633515 0.63363 0.633746 0.633862 0.633979
+0.634096 0.634213 0.63433 0.634447 0.634565 0.634682 0.6348 0.634917
+0.635035 0.635152 0.635269 0.635386 0.635502 0.635618 0.635734 0.635849
+0.635964 0.636078 0.636192 0.636305 0.636417 0.636529 0.63664 0.63675
+0.636859 0.636968 0.637075 0.637182 0.637287 0.637391 0.637494 0.637596
+0.637697 0.637797 0.637895 0.637992 0.638087 0.638181 0.638273 0.638364
+0.638454 0.638541 0.638627 0.638712 0.638794 0.638875 0.638954 0.639031
+0.639106 0.639179 0.639251 0.63932 0.639386 0.639451 0.639514 0.639574
+0.639632 0.639688 0.639742 0.639793 0.639841 0.639887 0.639931 0.639972
+0.640011 0.640046 0.640079 0.64011 0.640138 0.640162 0.640184 0.640204
+0.64022 0.640233 0.640243 0.640251 0.640255 0.640256 0.640254 0.640248
+0.64024 0.640228 0.640213 0.640195 0.640173 0.640148 0.64012 0.640088
+0.640052 0.640013 0.639971 0.639924 0.639874 0.639821 0.639764 0.639703
+0.639638 0.63957 0.639497 0.639421 0.639341 0.639257 0.639169 0.639077
+0.638981 0.638881;
+#A 1000 0.638776 0.638668 0.638556 0.638439 0.638318 0.638193 0.638064
+0.637931 0.637793 0.63765 0.637504 0.637353 0.637198 0.637038 0.636874
+0.636705 0.636531 0.636354 0.636171 0.635984 0.635793 0.635596 0.635395
+0.63519 0.63498 0.634764 0.634545 0.63432 0.634091 0.633857 0.633618
+0.633374 0.633125 0.632871 0.632613 0.632349 0.632081 0.631807 0.631529
+0.631246 0.630957 0.630664 0.630365 0.630062 0.629753 0.629439 0.62912
+0.628796 0.628467 0.628132 0.627793 0.627448 0.627098 0.626743 0.626383
+0.626017 0.625646 0.62527 0.624889 0.624502 0.62411 0.623713 0.62331
+0.622902 0.622489 0.62207 0.621646 0.621217 0.620782 0.620342 0.619897
+0.619446 0.61899 0.618528 0.618061 0.617588 0.617111 0.616627 0.616139
+0.615645 0.615145 0.61464 0.61413 0.613614 0.613092 0.612566 0.612034
+0.611496 0.610953 0.610404 0.609851 0.609291 0.608726 0.608156 0.60758
+0.606999 0.606413 0.605821 0.605223 0.60462 0.604012 0.603399 0.602779
+0.602155 0.601525 0.60089 0.600249 0.599603 0.598952 0.598295 0.597632
+0.596965 0.596292 0.595614 0.59493 0.594241 0.593547 0.592848 0.592143
+0.591433 0.590717 0.589997 0.589271 0.58854 0.587803 0.587062 0.586315
+0.585563 0.584806 0.584043 0.583276 0.582503 0.581726 0.580943 0.580155
+0.579362 0.578564 0.57776 0.576952 0.576139 0.575321 0.574498 0.57367
+0.572837 0.571999 0.571156 0.570308 0.569455 0.568598 0.567735 0.566868
+0.565996 0.565119 0.564238 0.563352 0.562461 0.561565 0.560665 0.55976
+0.55885 0.557936 0.557018 0.556094 0.555166 0.554234 0.553297 0.552356
+0.55141 0.55046 0.549506 0.548547 0.547584 0.546616 0.545645 0.544669
+0.543689 0.542704 0.541716 0.540723 0.539726 0.538725 0.53772 0.536711
+0.535698 0.534681 0.53366 0.532635 0.531606 0.530574 0.529537 0.528497
+0.527453 0.526405 0.525354 0.524299 0.52324 0.522178 0.521112 0.520042
+0.518969 0.517893 0.516813 0.515729 0.514643 0.513553 0.512459 0.511362
+0.510263 0.509159 0.508053 0.506943 0.505831 0.504715 0.503596 0.502475
+0.50135 0.500222 0.499092 0.497958 0.496822 0.495683 0.494541 0.493396
+0.492249 0.491099 0.489947 0.488791 0.487634 0.486474 0.485311 0.484146
+0.482978 0.481809 0.480636 0.479462 0.478285 0.477106 0.475925 0.474742
+0.473557 0.472369 0.47118 0.469989 0.468795 0.4676 0.466403 0.465204
+0.464004 0.462801 0.461597 0.460391 0.459184 0.457975 0.456765 0.455553
+0.454339 0.453124 0.451908 0.45069 0.449471 0.448251 0.447029 0.445807
+0.444583 0.443358 0.442132 0.440905 0.439677 0.438448 0.437218 0.435987
+0.434756 0.433523 0.43229 0.431056 0.429822 0.428587 0.427351 0.426115
+0.424878 0.423641 0.422403 0.421165 0.419927 0.418688 0.417449 0.41621
+0.414971 0.413731 0.412491 0.411252 0.410012 0.408772 0.407533 0.406293
+0.405054 0.403815 0.402576 0.401337 0.400099 0.398861 0.397623 0.396386
+0.395149 0.393913 0.392677 0.391442 0.390207 0.388973 0.38774 0.386507
+0.385276 0.384045 0.382815 0.381586 0.380357 0.37913 0.377904 0.376679
+0.375454 0.374231 0.37301 0.371789 0.37057 0.369351 0.368135 0.366919
+0.365705 0.364492 0.363281 0.362072 0.360863 0.359657 0.358452 0.357249
+0.356047 0.354847 0.353649 0.352452 0.351258 0.350065 0.348875 0.347686
+0.346499 0.345314 0.344131 0.342951 0.341772 0.340595 0.339421 0.338249
+0.337079 0.335912 0.334747 0.333584 0.332423 0.331265 0.33011 0.328957
+0.327806 0.326658 0.325513 0.32437 0.32323 0.322092 0.320957 0.319825
+0.318696 0.31757 0.316446 0.315325 0.314208 0.313093 0.311981 0.310872
+0.309766 0.308663 0.307563 0.306466 0.305373 0.304282 0.303195 0.302111
+0.30103 0.299953 0.298879 0.297808 0.29674 0.295676 0.294616 0.293558
+0.292505 0.291454 0.290407 0.289364 0.288325 0.287288 0.286256 0.285227
+0.284202 0.28318 0.282163 0.281149 0.280138 0.279132 0.278129 0.27713
+0.276135 0.275144 0.274157 0.273173 0.272194 0.271218 0.270247 0.269279
+0.268316 0.267356 0.266401 0.26545 0.264502 0.263559 0.26262 0.261685
+0.260755 0.259828 0.258906 0.257988 0.257074 0.256164 0.255259 0.254358
+0.253461 0.252569 0.25168 0.250797 0.249917 0.249042 0.248171 0.247305
+0.246443 0.245586 0.244733 0.243884 0.24304 0.2422 0.241365 0.240535
+0.239709 0.238887 0.23807 0.237257 0.236449 0.235646 0.234847 0.234053
+0.233263 0.232478 0.231697 0.230921 0.23015 0.229383 0.228621 0.227864
+0.227111 0.226363 0.225619 0.22488 0.224146 0.223417 0.222692 0.221972
+0.221256 0.220546 0.219839 0.219138 0.218441 0.217749 0.217062 0.21638
+0.215702 0.215028 0.21436 0.213696 0.213037 0.212383 0.211733 0.211088
+0.210448 0.209812 0.209181 0.208555 0.207934 0.207317 0.206705 0.206098
+0.205495 0.204897 0.204304 0.203715 0.203131 0.202552 0.201977 0.201407
+0.200842 0.200281 0.199725 0.199174 0.198627 0.198085 0.197547 0.197014
+0.196486 0.195962 0.195443 0.194928 0.194418 0.193913 0.193412 0.192915
+0.192423 0.191936 0.191453 0.190975 0.190501 0.190032 0.189567 0.189106
+0.18865 0.188198 0.187751 0.187308 0.18687 0.186436 0.186006 0.185581
+0.18516 0.184743 0.18433 0.183922 0.183518 0.183119 0.182723 0.182332
+0.181945 0.181562 0.181184 0.180809 0.180439 0.180073 0.179711 0.179353
+0.178999 0.178649 0.178303 0.177961 0.177624 0.17729 0.17696 0.176634
+0.176312 0.175994 0.175679 0.175369 0.175062 0.17476 0.174461 0.174165
+0.173874 0.173586 0.173302 0.173022 0.172745 0.172472 0.172202 0.171936
+0.171674 0.171415 0.17116 0.170908 0.17066 0.170415 0.170174 0.169936
+0.169701 0.16947 0.169241 0.169017 0.168795 0.168577 0.168362 0.16815
+0.167942 0.167736 0.167534 0.167334 0.167138 0.166945 0.166755 0.166567
+0.166383 0.166202 0.166023 0.165848 0.165675 0.165505 0.165338 0.165173
+0.165011 0.164852 0.164696 0.164542 0.164391 0.164242 0.164096 0.163953
+0.163812 0.163673 0.163537 0.163403 0.163272 0.163143 0.163016 0.162891
+0.162769 0.162649 0.162531 0.162415 0.162302 0.16219 0.162081 0.161973
+0.161868 0.161764 0.161663 0.161563 0.161465 0.161369 0.161275 0.161183
+0.161092 0.161003 0.160916 0.16083 0.160746 0.160663 0.160582 0.160503
+0.160425 0.160348 0.160273 0.1602 0.160127 0.160056 0.159986 0.159918
+0.15985 0.159784 0.159719 0.159655 0.159592 0.15953 0.15947 0.15941
+0.159351 0.159293 0.159236 0.159179 0.159124 0.159069 0.159015 0.158962
+0.15891 0.158858 0.158807 0.158756 0.158706 0.158656 0.158607 0.158558
+0.15851 0.158462 0.158414 0.158367 0.15832 0.158273 0.158227 0.158181
+0.158134 0.158088 0.158042 0.157996 0.15795 0.157904 0.157858 0.157812
+0.157766 0.15772 0.157673 0.157626 0.157579 0.157532 0.157485 0.157437
+0.157388 0.15734 0.15729 0.157241 0.157191 0.15714 0.157089 0.157037
+0.156985 0.156931 0.156878 0.156823 0.156768 0.156712 0.156655 0.156597
+0.156538 0.156479 0.156418 0.156357 0.156294 0.156231 0.156166 0.156101
+0.156034 0.155966 0.155897 0.155827 0.155755 0.155682 0.155608 0.155533
+0.155456 0.155378 0.155298 0.155217 0.155135 0.155051 0.154965 0.154878
+0.15479 0.154699 0.154607 0.154514 0.154419 0.154322 0.154223 0.154122
+0.15402 0.153916 0.15381 0.153702 0.153592 0.153481 0.153367 0.153251
+0.153134 0.153014 0.152892 0.152769 0.152643 0.152515 0.152385 0.152252
+0.152118 0.151981 0.151842 0.151701 0.151557 0.151411 0.151263 0.151113
+0.15096 0.150804 0.150647 0.150486 0.150324 0.150159 0.149991 0.149821
+0.149648 0.149473 0.149295 0.149114 0.148931 0.148745 0.148557 0.148366
+0.148172 0.147975 0.147776 0.147574 0.147369 0.147161 0.146951 0.146737
+0.146521 0.146302 0.14608 0.145856 0.145628 0.145397 0.145164 0.144927
+0.144688 0.144445 0.1442 0.143951 0.143699 0.143445 0.143187 0.142926
+0.142663 0.142396 0.142126 0.141852 0.141576 0.141297 0.141014 0.140728
+0.140439 0.140147 0.139852 0.139553 0.139251 0.138946 0.138638 0.138327
+0.138012 0.137694 0.137372 0.137048 0.13672 0.136389 0.136054 0.135716
+0.135375 0.13503 0.134682 0.134331 0.133977 0.133619 0.133257 0.132893
+0.132525 0.132153 0.131778 0.1314 0.131019 0.130634 0.130245 0.129853
+0.129458 0.12906 0.128658 0.128252 0.127843 0.127431 0.127015 0.126596
+0.126174 0.125748 0.125318 0.124885 0.124449 0.124009 0.123566 0.12312
+0.12267 0.122217 0.12176 0.1213 0.120836 0.120369 0.119899 0.119425
+0.118948 0.118467 0.117983 0.117495 0.117005 0.116511 0.116013 0.115512
+0.115008 0.1145 0.113989 0.113475 0.112957 0.112436 0.111912 0.111384
+0.110853 0.110318 0.109781 0.10924 0.108696 0.108148 0.107597 0.107043
+0.106486 0.105926 0.105362 0.104795 0.104225 0.103651 0.103075 0.102495
+0.101912 0.101326 0.100737 0.100144 0.0995489 0.0989503 0.0983486 0.0977438
+0.097136 0.096525 0.0959111 0.0952941 0.0946741 0.094051 0.093425 0.092796
+0.0921641 0.0915292 0.0908914 0.0902506 0.089607 0.0889604 0.088311
+0.0876588 0.0870037 0.0863458 0.0856851 0.0850216 0.0843553 0.0836863
+0.0830145 0.0823401 0.0816629 0.080983 0.0803005 0.0796154 0.0789276
+0.0782372 0.0775442 0.0768487 0.0761506 0.07545 0.0747469 0.0740413
+0.0733332 0.0726227 0.0719097 0.0711944 0.0704767 0.0697566 0.0690341
+0.0683094 0.0675823 0.066853 0.0661214 0.0653875 0.0646515 0.0639133
+0.0631729 0.0624304 0.0616857 0.060939 0.0601902 0.0594393 0.0586864
+0.0579315 0.0571746 0.0564158 0.055655 0.0548924 0.0541278 0.0533614
+0.0525932 0.0518231 0.0510513 0.0502777 0.0495024 0.0487254 0.0479467
+0.0471663 0.0463844 0.0456008 0.0448156 0.0440289 0.0432406 0.0424509
+0.0416597 0.040867 0.0400729;
+#A 2000 0.0392774 0.0384806 0.0376824 0.0368829 0.0360821 0.0352801
+0.0344768 0.0336723 0.0328666 0.0320598 0.0312519 0.0304429 0.0296328
+0.0288217 0.0280096 0.0271965 0.0263824 0.0255674 0.0247515 0.0239348
+0.0231172 0.0222988 0.0214796 0.0206596 0.019839 0.0190176 0.0181956
+0.0173729 0.0165496 0.0157257 0.0149013 0.0140763 0.0132509 0.012425
+0.0115986 0.0107719 0.00994471 0.00911722 0.0082894 0.0074613 0.00663293
+0.00580432 0.00497551 0.00414653 0.0033174 0.00248815 0.00165882 0.000829423
+1.20209e-16 -0.000829423 -0.00165882 -0.00248815 -0.0033174 -0.00414653
+-0.00497551 -0.00580432 -0.00663293 -0.0074613 -0.0082894 -0.00911722
+-0.00994471 -0.0107719 -0.0115986 -0.012425 -0.0132509 -0.0140763 -0.0149013
+-0.0157257 -0.0165496 -0.0173729 -0.0181956 -0.0190176 -0.019839 -0.0206596
+-0.0214796 -0.0222988 -0.0231172 -0.0239348 -0.0247515 -0.0255674 -0.0263824
+-0.0271965 -0.0280096 -0.0288217 -0.0296328 -0.0304429 -0.0312519 -0.0320598
+-0.0328666 -0.0336723 -0.0344768 -0.0352801 -0.0360821 -0.0368829 -0.0376824
+-0.0384806 -0.0392774 -0.0400729 -0.040867 -0.0416597 -0.0424509 -0.0432406
+-0.0440289 -0.0448156 -0.0456008 -0.0463844 -0.0471663 -0.0479467 -0.0487254
+-0.0495024 -0.0502777 -0.0510513 -0.0518231 -0.0525932 -0.0533614 -0.0541278
+-0.0548924 -0.055655 -0.0564158 -0.0571746 -0.0579315 -0.0586864 -0.0594393
+-0.0601902 -0.060939 -0.0616857 -0.0624304 -0.0631729 -0.0639133 -0.0646515
+-0.0653875 -0.0661214 -0.066853 -0.0675823 -0.0683094 -0.0690341 -0.0697566
+-0.0704767 -0.0711944 -0.0719097 -0.0726227 -0.0733332 -0.0740413 -0.0747469
+-0.07545 -0.0761506 -0.0768487 -0.0775442 -0.0782372 -0.0789276 -0.0796154
+-0.0803005 -0.080983 -0.0816629 -0.0823401 -0.0830145 -0.0836863 -0.0843553
+-0.0850216 -0.0856851 -0.0863458 -0.0870037 -0.0876588 -0.088311 -0.0889604
+-0.089607 -0.0902506 -0.0908914 -0.0915292 -0.0921641 -0.092796 -0.093425
+-0.094051 -0.0946741 -0.0952941 -0.0959111 -0.096525 -0.097136 -0.0977438
+-0.0983486 -0.0989503 -0.0995489 -0.100144 -0.100737 -0.101326 -0.101912
+-0.102495 -0.103075 -0.103651 -0.104225 -0.104795 -0.105362 -0.105926
+-0.106486 -0.107043 -0.107597 -0.108148 -0.108696 -0.10924 -0.109781
+-0.110318 -0.110853 -0.111384 -0.111912 -0.112436 -0.112957 -0.113475
+-0.113989 -0.1145 -0.115008 -0.115512 -0.116013 -0.116511 -0.117005
+-0.117495 -0.117983 -0.118467 -0.118948 -0.119425 -0.119899 -0.120369
+-0.120836 -0.1213 -0.12176 -0.122217 -0.12267 -0.12312 -0.123566 -0.124009
+-0.124449 -0.124885 -0.125318 -0.125748 -0.126174 -0.126596 -0.127015
+-0.127431 -0.127843 -0.128252 -0.128658 -0.12906 -0.129458 -0.129853
+-0.130245 -0.130634 -0.131019 -0.1314 -0.131778 -0.132153 -0.132525
+-0.132893 -0.133257 -0.133619 -0.133977 -0.134331 -0.134682 -0.13503
+-0.135375 -0.135716 -0.136054 -0.136389 -0.13672 -0.137048 -0.137372
+-0.137694 -0.138012 -0.138327 -0.138638 -0.138946 -0.139251 -0.139553
+-0.139852 -0.140147 -0.140439 -0.140728 -0.141014 -0.141297 -0.141576
+-0.141852 -0.142126 -0.142396 -0.142663 -0.142926 -0.143187 -0.143445
+-0.143699 -0.143951 -0.1442 -0.144445 -0.144688 -0.144927 -0.145164
+-0.145397 -0.145628 -0.145856 -0.14608 -0.146302 -0.146521 -0.146737
+-0.146951 -0.147161 -0.147369 -0.147574 -0.147776 -0.147975 -0.148172
+-0.148366 -0.148557 -0.148745 -0.148931 -0.149114 -0.149295 -0.149473
+-0.149648 -0.149821 -0.149991 -0.150159 -0.150324 -0.150486 -0.150647
+-0.150804 -0.15096 -0.151113 -0.151263 -0.151411 -0.151557 -0.151701
+-0.151842 -0.151981 -0.152118 -0.152252 -0.152385 -0.152515 -0.152643
+-0.152769 -0.152892 -0.153014 -0.153134 -0.153251 -0.153367 -0.153481
+-0.153592 -0.153702 -0.15381 -0.153916 -0.15402 -0.154122 -0.154223
+-0.154322 -0.154419 -0.154514 -0.154607 -0.154699 -0.15479 -0.154878
+-0.154965 -0.155051 -0.155135 -0.155217 -0.155298 -0.155378 -0.155456
+-0.155533 -0.155608 -0.155682 -0.155755 -0.155827 -0.155897 -0.155966
+-0.156034 -0.156101 -0.156166 -0.156231 -0.156294 -0.156357 -0.156418
+-0.156479 -0.156538 -0.156597 -0.156655 -0.156712 -0.156768 -0.156823
+-0.156878 -0.156931 -0.156985 -0.157037 -0.157089 -0.15714 -0.157191
+-0.157241 -0.15729 -0.15734 -0.157388 -0.157437 -0.157485 -0.157532
+-0.157579 -0.157626 -0.157673 -0.15772 -0.157766 -0.157812 -0.157858
+-0.157904 -0.15795 -0.157996 -0.158042 -0.158088 -0.158134 -0.158181
+-0.158227 -0.158273 -0.15832 -0.158367 -0.158414 -0.158462 -0.15851
+-0.158558 -0.158607 -0.158656 -0.158706 -0.158756 -0.158807 -0.158858
+-0.15891 -0.158962 -0.159015 -0.159069 -0.159124 -0.159179 -0.159236
+-0.159293 -0.159351 -0.15941 -0.15947 -0.15953 -0.159592 -0.159655
+-0.159719 -0.159784 -0.15985 -0.159918 -0.159986 -0.160056 -0.160127
+-0.1602 -0.160273 -0.160348 -0.160425 -0.160503 -0.160582 -0.160663
+-0.160746 -0.16083 -0.160916 -0.161003 -0.161092 -0.161183 -0.161275
+-0.161369 -0.161465 -0.161563 -0.161663 -0.161764 -0.161868 -0.161973
+-0.162081 -0.16219 -0.162302 -0.162415 -0.162531 -0.162649 -0.162769
+-0.162891 -0.163016 -0.163143 -0.163272 -0.163403 -0.163537 -0.163673
+-0.163812 -0.163953 -0.164096 -0.164242 -0.164391 -0.164542 -0.164696
+-0.164852 -0.165011 -0.165173 -0.165338 -0.165505 -0.165675 -0.165848
+-0.166023 -0.166202 -0.166383 -0.166567 -0.166755 -0.166945 -0.167138
+-0.167334 -0.167534 -0.167736 -0.167942 -0.16815 -0.168362 -0.168577
+-0.168795 -0.169017 -0.169241 -0.16947 -0.169701 -0.169936 -0.170174
+-0.170415 -0.17066 -0.170908 -0.17116 -0.171415 -0.171674 -0.171936
+-0.172202 -0.172472 -0.172745 -0.173022 -0.173302 -0.173586 -0.173874
+-0.174165 -0.174461 -0.17476 -0.175062 -0.175369 -0.175679 -0.175994
+-0.176312 -0.176634 -0.17696 -0.17729 -0.177624 -0.177961 -0.178303
+-0.178649 -0.178999 -0.179353 -0.179711 -0.180073 -0.180439 -0.180809
+-0.181184 -0.181562 -0.181945 -0.182332 -0.182723 -0.183119 -0.183518
+-0.183922 -0.18433 -0.184743 -0.18516 -0.185581 -0.186006 -0.186436
+-0.18687 -0.187308 -0.187751 -0.188198 -0.18865 -0.189106 -0.189567
+-0.190032 -0.190501 -0.190975 -0.191453 -0.191936 -0.192423 -0.192915
+-0.193412 -0.193913 -0.194418 -0.194928 -0.195443 -0.195962 -0.196486
+-0.197014 -0.197547 -0.198085 -0.198627 -0.199174 -0.199725 -0.200281
+-0.200842 -0.201407 -0.201977 -0.202552 -0.203131 -0.203715 -0.204304
+-0.204897 -0.205495 -0.206098 -0.206705 -0.207317 -0.207934 -0.208555
+-0.209181 -0.209812 -0.210448 -0.211088 -0.211733 -0.212383 -0.213037
+-0.213696 -0.21436 -0.215028 -0.215702 -0.21638 -0.217062 -0.217749
+-0.218441 -0.219138 -0.219839 -0.220546 -0.221256 -0.221972 -0.222692
+-0.223417 -0.224146 -0.22488 -0.225619 -0.226363 -0.227111 -0.227864
+-0.228621 -0.229383 -0.23015 -0.230921 -0.231697 -0.232478 -0.233263
+-0.234053 -0.234847 -0.235646 -0.236449 -0.237257 -0.23807 -0.238887
+-0.239709 -0.240535 -0.241365 -0.2422 -0.24304 -0.243884 -0.244733
+-0.245586 -0.246443 -0.247305 -0.248171 -0.249042 -0.249917 -0.250797
+-0.25168 -0.252569 -0.253461 -0.254358 -0.255259 -0.256164 -0.257074
+-0.257988 -0.258906 -0.259828 -0.260755 -0.261685 -0.26262 -0.263559
+-0.264502 -0.26545 -0.266401 -0.267356 -0.268316 -0.269279 -0.270247
+-0.271218 -0.272194 -0.273173 -0.274157 -0.275144 -0.276135 -0.27713
+-0.278129 -0.279132 -0.280138 -0.281149 -0.282163 -0.28318 -0.284202
+-0.285227 -0.286256 -0.287288 -0.288325 -0.289364 -0.290407 -0.291454
+-0.292505 -0.293558 -0.294616 -0.295676 -0.29674 -0.297808 -0.298879
+-0.299953 -0.30103 -0.302111 -0.303195 -0.304282 -0.305373 -0.306466
+-0.307563 -0.308663 -0.309766 -0.310872 -0.311981 -0.313093 -0.314208
+-0.315325 -0.316446 -0.31757 -0.318696 -0.319825 -0.320957 -0.322092
+-0.32323 -0.32437 -0.325513 -0.326658 -0.327806 -0.328957 -0.33011
+-0.331265 -0.332423 -0.333584 -0.334747 -0.335912 -0.337079 -0.338249
+-0.339421 -0.340595 -0.341772 -0.342951 -0.344131 -0.345314 -0.346499
+-0.347686 -0.348875 -0.350065 -0.351258 -0.352452 -0.353649 -0.354847
+-0.356047 -0.357249 -0.358452 -0.359657 -0.360863 -0.362072 -0.363281
+-0.364492 -0.365705 -0.366919 -0.368135 -0.369351 -0.37057 -0.371789
+-0.37301 -0.374231 -0.375454 -0.376679 -0.377904 -0.37913 -0.380357
+-0.381586 -0.382815 -0.384045 -0.385276 -0.386507 -0.38774 -0.388973
+-0.390207 -0.391442 -0.392677 -0.393913 -0.395149 -0.396386 -0.397623
+-0.398861 -0.400099 -0.401337 -0.402576 -0.403815 -0.405054 -0.406293
+-0.407533 -0.408772 -0.410012 -0.411252 -0.412491 -0.413731 -0.414971
+-0.41621 -0.417449 -0.418688 -0.419927 -0.421165 -0.422403 -0.423641
+-0.424878 -0.426115 -0.427351 -0.428587 -0.429822 -0.431056 -0.43229
+-0.433523 -0.434756 -0.435987 -0.437218 -0.438448 -0.439677 -0.440905
+-0.442132 -0.443358 -0.444583 -0.445807 -0.447029 -0.448251 -0.449471
+-0.45069 -0.451908 -0.453124 -0.454339 -0.455553 -0.456765 -0.457975
+-0.459184 -0.460391 -0.461597 -0.462801 -0.464004 -0.465204 -0.466403
+-0.4676 -0.468795 -0.469989 -0.47118 -0.472369 -0.473557 -0.474742
+-0.475925 -0.477106 -0.478285 -0.479462 -0.480636 -0.481809 -0.482978
+-0.484146 -0.485311 -0.486474 -0.487634 -0.488791 -0.489947 -0.491099
+-0.492249 -0.493396 -0.494541 -0.495683 -0.496822 -0.497958 -0.499092
+-0.500222 -0.50135 -0.502475 -0.503596 -0.504715 -0.505831 -0.506943
+-0.508053 -0.509159 -0.510263 -0.511362 -0.512459 -0.513553 -0.514643
+-0.515729 -0.516813 -0.517893 -0.518969 -0.520042 -0.521112 -0.522178
+-0.52324 -0.524299 -0.525354 -0.526405 -0.527453 -0.528497 -0.529537
+-0.530574 -0.531606 -0.532635 -0.53366 -0.534681 -0.535698 -0.536711
+-0.53772 -0.538725 -0.539726 -0.540723 -0.541716 -0.542704 -0.543689
+-0.544669 -0.545645 -0.546616 -0.547584 -0.548547 -0.549506 -0.55046
+-0.55141 -0.552356 -0.553297 -0.554234 -0.555166 -0.556094 -0.557018
+-0.557936 -0.55885 -0.55976 -0.560665 -0.561565 -0.562461 -0.563352
+-0.564238 -0.565119 -0.565996 -0.566868 -0.567735 -0.568598 -0.569455
+-0.570308 -0.571156 -0.571999 -0.572837 -0.57367 -0.574498 -0.575321
+-0.576139 -0.576952 -0.57776 -0.578564 -0.579362 -0.580155 -0.580943
+-0.581726 -0.582503 -0.583276 -0.584043 -0.584806 -0.585563 -0.586315
+-0.587062 -0.587803 -0.58854 -0.589271 -0.589997 -0.590717 -0.591433
+-0.592143 -0.592848 -0.593547 -0.594241 -0.59493 -0.595614 -0.596292
+-0.596965 -0.597632 -0.598295 -0.598952 -0.599603 -0.600249 -0.60089
+-0.601525 -0.602155 -0.602779 -0.603399 -0.604012 -0.60462 -0.605223
+-0.605821;
+#A 3000 -0.606413 -0.606999 -0.60758 -0.608156 -0.608726 -0.609291
+-0.609851 -0.610404 -0.610953 -0.611496 -0.612034 -0.612566 -0.613092
+-0.613614 -0.61413 -0.61464 -0.615145 -0.615645 -0.616139 -0.616627
+-0.617111 -0.617588 -0.618061 -0.618528 -0.61899 -0.619446 -0.619897
+-0.620342 -0.620782 -0.621217 -0.621646 -0.62207 -0.622489 -0.622902
+-0.62331 -0.623713 -0.62411 -0.624502 -0.624889 -0.62527 -0.625646
+-0.626017 -0.626383 -0.626743 -0.627098 -0.627448 -0.627793 -0.628132
+-0.628467 -0.628796 -0.62912 -0.629439 -0.629753 -0.630062 -0.630365
+-0.630664 -0.630957 -0.631246 -0.631529 -0.631807 -0.632081 -0.632349
+-0.632613 -0.632871 -0.633125 -0.633374 -0.633618 -0.633857 -0.634091
+-0.63432 -0.634545 -0.634764 -0.63498 -0.63519 -0.635395 -0.635596
+-0.635793 -0.635984 -0.636171 -0.636354 -0.636531 -0.636705 -0.636874
+-0.637038 -0.637198 -0.637353 -0.637504 -0.63765 -0.637793 -0.637931
+-0.638064 -0.638193 -0.638318 -0.638439 -0.638556 -0.638668 -0.638776
+-0.638881 -0.638981 -0.639077 -0.639169 -0.639257 -0.639341 -0.639421
+-0.639497 -0.63957 -0.639638 -0.639703 -0.639764 -0.639821 -0.639874
+-0.639924 -0.639971 -0.640013 -0.640052 -0.640088 -0.64012 -0.640148
+-0.640173 -0.640195 -0.640213 -0.640228 -0.64024 -0.640248 -0.640254
+-0.640256 -0.640255 -0.640251 -0.640243 -0.640233 -0.64022 -0.640204
+-0.640184 -0.640162 -0.640138 -0.64011 -0.640079 -0.640046 -0.640011
+-0.639972 -0.639931 -0.639887 -0.639841 -0.639793 -0.639742 -0.639688
+-0.639632 -0.639574 -0.639514 -0.639451 -0.639386 -0.63932 -0.639251
+-0.639179 -0.639106 -0.639031 -0.638954 -0.638875 -0.638794 -0.638712
+-0.638627 -0.638541 -0.638454 -0.638364 -0.638273 -0.638181 -0.638087
+-0.637992 -0.637895 -0.637797 -0.637697 -0.637596 -0.637494 -0.637391
+-0.637287 -0.637182 -0.637075 -0.636968 -0.636859 -0.63675 -0.63664
+-0.636529 -0.636417 -0.636305 -0.636192 -0.636078 -0.635964 -0.635849
+-0.635734 -0.635618 -0.635502 -0.635386 -0.635269 -0.635152 -0.635035
+-0.634917 -0.6348 -0.634682 -0.634565 -0.634447 -0.63433 -0.634213
+-0.634096 -0.633979 -0.633862 -0.633746 -0.63363 -0.633515 -0.6334
+-0.633285 -0.633171 -0.633058 -0.632945 -0.632833 -0.632722 -0.632612
+-0.632502 -0.632394 -0.632286 -0.632179 -0.632074 -0.631969 -0.631866
+-0.631764 -0.631662 -0.631563 -0.631464 -0.631367 -0.631272 -0.631178
+-0.631085 -0.630994 -0.630905 -0.630817 -0.630731 -0.630646 -0.630564
+-0.630483 -0.630404 -0.630328 -0.630253 -0.63018 -0.630109 -0.630041
+-0.629974 -0.62991 -0.629848 -0.629788 -0.629731 -0.629676 -0.629624
+-0.629574 -0.629526 -0.629482 -0.629439 -0.6294 -0.629363 -0.629329
+-0.629298 -0.629269 -0.629244 -0.629221 -0.629202 -0.629185 -0.629172
+-0.629162 -0.629154 -0.62915 -0.62915 -0.629152 -0.629158 -0.629167
+-0.62918 -0.629196 -0.629216 -0.629239 -0.629265 -0.629296 -0.62933
+-0.629367 -0.629409 -0.629454 -0.629503 -0.629556 -0.629613 -0.629673
+-0.629738 -0.629807 -0.62988 -0.629957 -0.630038 -0.630123 -0.630212
+-0.630306 -0.630404 -0.630506 -0.630613 -0.630724 -0.630839 -0.630959
+-0.631084 -0.631213 -0.631346 -0.631484 -0.631627 -0.631774 -0.631927
+-0.632083 -0.632245 -0.632412 -0.632583 -0.632759 -0.63294 -0.633126
+-0.633317 -0.633513 -0.633714 -0.63392 -0.634132 -0.634348 -0.634569
+-0.634796 -0.635028 -0.635265 -0.635507 -0.635755 -0.636008 -0.636266
+-0.63653 -0.636799 -0.637074 -0.637354 -0.637639 -0.63793 -0.638226
+-0.638528 -0.638836 -0.639149 -0.639468 -0.639793 -0.640123 -0.640459
+-0.6408 -0.641147 -0.6415 -0.641859 -0.642224 -0.642594 -0.642971 -0.643353
+-0.643741 -0.644134 -0.644534 -0.64494 -0.645352 -0.645769 -0.646193
+-0.646622 -0.647058 -0.647499 -0.647947 -0.648401 -0.64886 -0.649326
+-0.649798 -0.650276 -0.65076 -0.65125 -0.651747 -0.652249 -0.652758
+-0.653272 -0.653793 -0.654321 -0.654854 -0.655393 -0.655939 -0.656491
+-0.657049 -0.657614 -0.658184 -0.658761 -0.659344 -0.659934 -0.660529
+-0.661131 -0.661739 -0.662354 -0.662974 -0.663601 -0.664235 -0.664874
+-0.66552 -0.666172 -0.66683 -0.667494 -0.668165 -0.668842 -0.669525
+-0.670215 -0.670911 -0.671613 -0.672321 -0.673035 -0.673756 -0.674483
+-0.675216 -0.675955 -0.676701 -0.677453 -0.678211 -0.678975 -0.679745
+-0.680522 -0.681304 -0.682093 -0.682888 -0.683689 -0.684496 -0.685309
+-0.686128 -0.686954 -0.687785 -0.688622 -0.689466 -0.690315 -0.691171
+-0.692032 -0.692899 -0.693773 -0.694652 -0.695537 -0.696428 -0.697325
+-0.698227 -0.699136 -0.70005 -0.70097 -0.701896 -0.702827 -0.703765
+-0.704708 -0.705656 -0.70661 -0.70757 -0.708536 -0.709507 -0.710483
+-0.711465 -0.712453 -0.713446 -0.714444 -0.715448 -0.716457 -0.717472
+-0.718491 -0.719517 -0.720547 -0.721582 -0.722623 -0.723669 -0.72472
+-0.725776 -0.726837 -0.727903 -0.728974 -0.73005 -0.731131 -0.732217
+-0.733308 -0.734403 -0.735503 -0.736608 -0.737718 -0.738832 -0.739951
+-0.741074 -0.742202 -0.743335 -0.744471 -0.745613 -0.746758 -0.747908
+-0.749062 -0.75022 -0.751383 -0.75255 -0.75372 -0.754895 -0.756074
+-0.757257 -0.758443 -0.759634 -0.760828 -0.762026 -0.763228 -0.764433
+-0.765642 -0.766854 -0.768071 -0.76929 -0.770513 -0.771739 -0.772969
+-0.774202 -0.775438 -0.776677 -0.777919 -0.779164 -0.780412 -0.781663
+-0.782917 -0.784174 -0.785434 -0.786696 -0.787961 -0.789228 -0.790498
+-0.791771 -0.793046 -0.794323 -0.795603 -0.796884 -0.798168 -0.799454
+-0.800742 -0.802032 -0.803324 -0.804618 -0.805913 -0.807211 -0.80851
+-0.80981 -0.811112 -0.812416 -0.813721 -0.815027 -0.816335 -0.817644
+-0.818954 -0.820265 -0.821577 -0.82289 -0.824204 -0.825518 -0.826834
+-0.82815 -0.829467 -0.830784 -0.832102 -0.83342 -0.834738 -0.836057
+-0.837376 -0.838695 -0.840014 -0.841333 -0.842652 -0.84397 -0.845289
+-0.846607 -0.847925 -0.849242 -0.850559 -0.851875 -0.85319 -0.854505
+-0.855819 -0.857132 -0.858444 -0.859754 -0.861064 -0.862373 -0.86368
+-0.864986 -0.86629 -0.867593 -0.868894 -0.870194 -0.871492 -0.872788
+-0.874082 -0.875374 -0.876664 -0.877952 -0.879238 -0.880521 -0.881802
+-0.88308 -0.884356 -0.88563 -0.886901 -0.888168 -0.889433 -0.890696
+-0.891955 -0.893211 -0.894463 -0.895713 -0.896959 -0.898202 -0.899441
+-0.900677 -0.901909 -0.903137 -0.904361 -0.905582 -0.906798 -0.90801
+-0.909219 -0.910423 -0.911622 -0.912817 -0.914008 -0.915194 -0.916376
+-0.917552 -0.918724 -0.919891 -0.921053 -0.92221 -0.923362 -0.924509
+-0.92565 -0.926786 -0.927916 -0.92904 -0.93016 -0.931273 -0.93238 -0.933482
+-0.934577 -0.935667 -0.93675 -0.937827 -0.938898 -0.939962 -0.94102
+-0.942071 -0.943116 -0.944154 -0.945185 -0.946209 -0.947226 -0.948236
+-0.949238 -0.950234 -0.951222 -0.952203 -0.953176 -0.954142 -0.9551
+-0.95605 -0.956993 -0.957927 -0.958854 -0.959772 -0.960682 -0.961584
+-0.962478 -0.963363 -0.96424 -0.965108 -0.965967 -0.966818 -0.96766
+-0.968493 -0.969317 -0.970132 -0.970938 -0.971735 -0.972522 -0.9733
+-0.974068 -0.974827 -0.975576 -0.976316 -0.977045 -0.977765 -0.978475
+-0.979175 -0.979864 -0.980544 -0.981213 -0.981872 -0.98252 -0.983158
+-0.983786 -0.984402 -0.985008 -0.985603 -0.986187 -0.986761 -0.987323
+-0.987874 -0.988414 -0.988942 -0.989459 -0.989965 -0.990459 -0.990942
+-0.991413 -0.991872 -0.99232 -0.992755 -0.993179 -0.993591 -0.99399
+-0.994377 -0.994753 -0.995115 -0.995466 -0.995804 -0.996129 -0.996442
+-0.996742 -0.997029 -0.997304 -0.997566 -0.997814 -0.99805 -0.998273
+-0.998482 -0.998678 -0.998861 -0.999031 -0.999187 -0.99933 -0.999459
+-0.999574 -0.999676 -0.999764 -0.999838 -0.999899 -0.999945 -0.999977
+-0.999996 -1 -0.99999 -0.999966 -0.999927 -0.999874 -0.999807 -0.999725
+-0.999629 -0.999517 -0.999392 -0.999251 -0.999096 -0.998926 -0.998741
+-0.998541 -0.998326 -0.998096 -0.997851 -0.99759 -0.997315 -0.997024
+-0.996718 -0.996396 -0.996059 -0.995706 -0.995338 -0.994955 -0.994555
+-0.99414 -0.993709 -0.993263 -0.9928 -0.992322 -0.991828 -0.991318
+-0.990791 -0.990249 -0.989691 -0.989116 -0.988525 -0.987918 -0.987295
+-0.986655 -0.985999 -0.985326 -0.984637 -0.983932 -0.98321 -0.982471
+-0.981716 -0.980944 -0.980156 -0.97935 -0.978528 -0.97769 -0.976834
+-0.975961 -0.975072 -0.974166 -0.973242 -0.972302 -0.971345 -0.97037
+-0.969379 -0.96837 -0.967344 -0.966301 -0.965241 -0.964164 -0.963069
+-0.961957 -0.960828 -0.959681 -0.958517 -0.957336 -0.956137 -0.954921
+-0.953687 -0.952436 -0.951168 -0.949881 -0.948578 -0.947257 -0.945918
+-0.944562 -0.943188 -0.941796 -0.940387 -0.93896 -0.937515 -0.936053
+-0.934573 -0.933076 -0.931561 -0.930028 -0.928477 -0.926908 -0.925322
+-0.923718 -0.922096 -0.920457 -0.9188 -0.917125 -0.915432 -0.913721
+-0.911992 -0.910246 -0.908482 -0.9067 -0.9049 -0.903083 -0.901248 -0.899395
+-0.897524 -0.895635 -0.893728 -0.891804 -0.889862 -0.887902 -0.885924
+-0.883929 -0.881916 -0.879885 -0.877836 -0.875769 -0.873685 -0.871583
+-0.869463 -0.867326 -0.865171 -0.862998 -0.860808 -0.8586 -0.856374
+-0.854131 -0.85187 -0.849592 -0.847296 -0.844982 -0.842651 -0.840302
+-0.837936 -0.835553 -0.833152 -0.830733 -0.828297 -0.825844 -0.823374
+-0.820886 -0.818381 -0.815858 -0.813318 -0.810762 -0.808187 -0.805596
+-0.802988 -0.800362 -0.79772 -0.79506 -0.792383 -0.78969 -0.786979
+-0.784252 -0.781508 -0.778747 -0.775969 -0.773174 -0.770363 -0.767534
+-0.76469 -0.761828 -0.758951 -0.756056 -0.753145 -0.750218 -0.747274
+-0.744314 -0.741338 -0.738345 -0.735336 -0.732311 -0.72927 -0.726213
+-0.72314 -0.72005 -0.716945 -0.713824 -0.710687 -0.707535 -0.704366
+-0.701182 -0.697983 -0.694767 -0.691537 -0.68829 -0.685029 -0.681752
+-0.67846 -0.675152 -0.67183 -0.668492 -0.665139 -0.661771 -0.658388
+-0.654991 -0.651578 -0.648151 -0.644709 -0.641253 -0.637782 -0.634296
+-0.630797 -0.627282 -0.623754 -0.620211 -0.616654 -0.613083 -0.609498
+-0.605899 -0.602286 -0.598659 -0.595019 -0.591364 -0.587697 -0.584015
+-0.580321 -0.576612 -0.572891 -0.569156 -0.565409 -0.561648 -0.557874
+-0.554087 -0.550287 -0.546475 -0.54265 -0.538812 -0.534962 -0.531099
+-0.527224 -0.523337 -0.519437 -0.515525 -0.511602 -0.507666 -0.503718
+-0.499759 -0.495788 -0.491805 -0.487811 -0.483805 -0.479788 -0.47576
+-0.47172 -0.467669 -0.463608 -0.459535 -0.455452 -0.451358 -0.447253
+-0.443137 -0.439011 -0.434875;
+#A 4000 -0.430729 -0.426572 -0.422405 -0.418228 -0.414041 -0.409845
+-0.405638 -0.401422 -0.397197 -0.392962 -0.388717 -0.384464 -0.380201
+-0.375929 -0.371648 -0.367358 -0.36306 -0.358753 -0.354437 -0.350113
+-0.34578 -0.34144 -0.337091 -0.332734 -0.328369 -0.323996 -0.319615
+-0.315227 -0.310831 -0.306427 -0.302017 -0.297599 -0.293173 -0.288741
+-0.284302 -0.279856 -0.275403 -0.270944 -0.266478 -0.262006 -0.257527
+-0.253042 -0.248551 -0.244054 -0.239552 -0.235043 -0.230529 -0.226009
+-0.221484 -0.216953 -0.212417 -0.207876 -0.20333 -0.198779 -0.194223
+-0.189662 -0.185097 -0.180528 -0.175954 -0.171375 -0.166793 -0.162207
+-0.157616 -0.153022 -0.148424 -0.143823 -0.139218 -0.134609 -0.129998
+-0.125383 -0.120765 -0.116144 -0.111521 -0.106894 -0.102265 -0.0976339
+-0.0930002 -0.0883641 -0.0837259 -0.0790857 -0.0744436 -0.0697996 -0.065154
+-0.0605068 -0.0558581 -0.051208 -0.0465567 -0.0419043 -0.0372508 -0.0325964
+-0.0279413 -0.0232854 -0.018629 -0.0139722 -0.00931496 -0.00465754
+;
+#X coords 0 1 4095 -1 200 140 1;
+#X restore 851 230 graph;
+#X text 454 94 comment;
+#X msg 584 328 tabset table1 1;
+#X msg 566 306 tabget table1 1;
+#X text 667 305 copies into array;
+#X text 685 327 copies from array;
 #X connect 1 0 39 0;
 #X connect 2 0 23 1;
 #X connect 3 0 39 0;
@@ -111,3 +674,5 @@ directory or should be given a full-path relative to the canvas directory
 #X connect 48 0 39 0;
 #X connect 50 0 39 0;
 #X connect 51 0 50 0;
+#X connect 59 0 39 0;
+#X connect 60 0 39 0;
diff --git a/examples/opcode_demos/lua_scoregen.csd b/examples/opcode_demos/lua_scoregen.csd
index b9afd92..8c2dbe7 100644
--- a/examples/opcode_demos/lua_scoregen.csd
+++ b/examples/opcode_demos/lua_scoregen.csd
@@ -12,7 +12,7 @@ lua_exec {{
 local ffi = require("ffi")
 local math = require("math")
 local string = require("string")
-local csoundApi = ffi.load('csound64.dll.5.2')
+local csoundApi = ffi.load('csound64')
 -- Declare the parts of the Csound API that we need.
 ffi.cdef[[
     int csoundGetKsmps(void *);
diff --git a/examples/opcode_demos/luamoog.csd b/examples/opcode_demos/luamoog.csd
index e20eb5e..080a9f6 100644
--- a/examples/opcode_demos/luamoog.csd
+++ b/examples/opcode_demos/luamoog.csd
@@ -10,7 +10,7 @@ nchnls =    1
 local ffi = require("ffi")
 local math = require("math")
 local string = require("string")
-local csoundApi = ffi.load('csound64.dll.5.2')
+local csoundApi = ffi.load('csound64')
 ffi.cdef[[
     int csoundGetKsmps(void *);
     double csoundGetSr(void *);
diff --git a/examples/opcode_demos/luaopcode.csd b/examples/opcode_demos/luaopcode.csd
index 2b9bb54..b90b5a9 100644
--- a/examples/opcode_demos/luaopcode.csd
+++ b/examples/opcode_demos/luaopcode.csd
@@ -4,7 +4,7 @@
 lua_opdef "luatest", {{
 local ffi = require("ffi")
 local string = require("string")
-local csoundLibrary = ffi.load('/Library/Frameworks/CsoundLib.framework/CsoundLib')
+local csoundLibrary = ffi.load('libcsound64.so')
 ffi.cdef[[
     int csoundGetKsmps(void *);
     double csoundGetSr(void *);
diff --git a/frontends/CMakeLists.txt b/frontends/CMakeLists.txt
index b03fbf8..94bd35b 100644
--- a/frontends/CMakeLists.txt
+++ b/frontends/CMakeLists.txt
@@ -1,13 +1,16 @@
+option(BUILD_PD_CLASS "Build the puredata csoundapi~ class" ON)
+
 find_package(FLEX)
 find_package(BISON)
 
+check_include_file(m_pd.h PD_HEADER)
+
 ## Csound Commandline Executable ##
 set(CS_MAIN_SRCS csound/csound_main.c)
 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
     list(APPEND CS_MAIN_SRCS csound/sched.c)
 endif()
 
-
 # We need a different name to avoid clashes with float libcsound
 make_executable(csound-bin "${CS_MAIN_SRCS}" "${CSOUNDLIB}" csound)
 
@@ -70,4 +73,25 @@ if(BUILD_CSBEATS)
     
 endif()
 
+check_deps(BUILD_PD_CLASS PD_HEADER)
+if(BUILD_PD_CLASS)
+    if(LINUX)
+        set(pdname "csoundapi~.pd_linux")
+    elseif(APPLE)
+        set(pdname "csoundapi~.pd_darwin")
+    elseif(WIN32)
+        set(pdname "csoundapi~.dll")
+    endif()
+
+    add_library(${pdname} MODULE csoundapi_tilde/csoundapi_tilde.c)
+    target_link_libraries (${pdname} ${CSOUNDLIB})
+    set_target_properties(${pdname} PROPERTIES
+        PREFIX ""
+        SUFFIX "")
+
+    install(TARGETS ${pdname}
+        LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR})
+
+endif()
+
 add_subdirectory(CsoundAC)
diff --git a/frontends/CsoundAC/CMakeLists.txt b/frontends/CsoundAC/CMakeLists.txt
index cb3dd8b..c7a350e 100644
--- a/frontends/CsoundAC/CMakeLists.txt
+++ b/frontends/CsoundAC/CMakeLists.txt
@@ -63,6 +63,10 @@ if(BUILD_CSOUND_AC)
         target_link_libraries(CsoundAC MUSICXML_LIBRARY)
     endif()
 
+    install(TARGETS libCsoundAC
+        LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
+        ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR})
+
     if(SWIG_FOUND)
         include(${SWIG_USE_FILE})
         set(CMAKE_SWIG_OUTDIR ${BUILD_LIB_DIR})
diff --git a/frontends/CsoundAC/Conversions.cpp b/frontends/CsoundAC/Conversions.cpp
index a5aa923..43d926c 100644
--- a/frontends/CsoundAC/Conversions.cpp
+++ b/frontends/CsoundAC/Conversions.cpp
@@ -314,7 +314,7 @@ namespace csound
     double theta = PI_ * (x / 4.0);
     return(sqrt(2.0) / 2.0) * (cos(theta) + sin(theta));
   }
-  const double Conversions::round(double value)
+  double Conversions::round(double value)
   {
     return floor(value + 0.5);
   }
diff --git a/frontends/CsoundAC/Conversions.hpp b/frontends/CsoundAC/Conversions.hpp
index 0bfe495..72c48a1 100644
--- a/frontends/CsoundAC/Conversions.hpp
+++ b/frontends/CsoundAC/Conversions.hpp
@@ -99,7 +99,7 @@ namespace csound
     static double amplitudeToMidi(double Amplitude);
     static double midiToGain(double Midi);
     static double leftPan(double x);
-    static const double round(double value);
+    static double round(double value);
     static double temper(double octave, double tonesPerOctave);
     static double phaseToTableLengths(double Phase, double TableSampleCount);
     static double hzToMidi(double Hz, bool rounded);
diff --git a/frontends/CsoundAC/MusicModel.cpp b/frontends/CsoundAC/MusicModel.cpp
index 29ae94b..d859f10 100644
--- a/frontends/CsoundAC/MusicModel.cpp
+++ b/frontends/CsoundAC/MusicModel.cpp
@@ -51,7 +51,6 @@ namespace csound
   void MusicModel::render()
   {
     generate();
-    createCsoundScore(csoundScoreHeader);
     perform();
   }
 
@@ -73,15 +72,14 @@ namespace csound
 
   void MusicModel::perform()
   {
+    createCsoundScore(csoundScoreHeader);
     cppSound->perform();
   }
 
-
-
   void MusicModel::clear()
   {
     Node::clear();
-    MusicModel::clear();
+    Composition::clear();
     cppSound->removeScore();
   }
 
diff --git a/frontends/CsoundAC/Platform.hpp b/frontends/CsoundAC/Platform.hpp
index fdecf1e..709e6f4 100644
--- a/frontends/CsoundAC/Platform.hpp
+++ b/frontends/CsoundAC/Platform.hpp
@@ -21,9 +21,11 @@
 #define SILENCE_PLATFORM_HPP
 
 #if (defined(WIN32) || defined(_WIN32)) && !defined(SWIG)
-#define SILENCE_PUBLIC __declspec(dllexport)
+#  define SILENCE_PUBLIC        __declspec(dllexport)
+#elif defined(__GNUC__) && !defined(__MACH__)
+#  define SILENCE_PUBLIC        __attribute__ ( (visibility("default")) )
 #else
-#define SILENCE_PUBLIC
+#  define SILENCE_PUBLIC
 #endif
 
 #endif
diff --git a/frontends/CsoundVST/Platform.hpp b/frontends/CsoundVST/Platform.hpp
index 6c308ce..f7d09e3 100644
--- a/frontends/CsoundVST/Platform.hpp
+++ b/frontends/CsoundVST/Platform.hpp
@@ -23,9 +23,11 @@
 #define SILENCE_PLATFORM_HPP
 
 #if (defined(WIN32) || defined(_WIN32)) && !defined(SWIG)
-#define SILENCE_PUBLIC __declspec( dllexport )
+#  define SILENCE_PUBLIC        __declspec(dllexport)
+#elif defined(__GNUC__) && !defined(__MACH__)
+#  define SILENCE_PUBLIC        __attribute__ ( (visibility("default")) )
 #else
-#define SILENCE_PUBLIC
+#  define SILENCE_PUBLIC
 #endif
 
 #endif
diff --git a/frontends/CsoundVST/csoundvst_main.cpp b/frontends/CsoundVST/csoundvst_main.cpp
index 7c45129..59e50e0 100644
--- a/frontends/CsoundVST/csoundvst_main.cpp
+++ b/frontends/CsoundVST/csoundvst_main.cpp
@@ -24,6 +24,8 @@
 #include <cstdio>
 #include <cstdlib>
 
+extern "C" void RunCsoundVST(const char *);
+
 int main(int argc, char **argv)
 {
   const char *filename = 0;
diff --git a/frontends/csoundapi_tilde/csoundapi_tilde.c b/frontends/csoundapi_tilde/csoundapi_tilde.c
index d23f484..6591c3d 100644
--- a/frontends/csoundapi_tilde/csoundapi_tilde.c
+++ b/frontends/csoundapi_tilde/csoundapi_tilde.c
@@ -114,6 +114,10 @@ static int open_midi_callback(CSOUND *cs, void **userData, const char *dev);
 static int read_midi_callback(CSOUND *cs, void *userData, unsigned char *mbuf, int nbytes);
 static int close_midi_callback(CSOUND *cs, void *userData);
 
+static void csoundapi_tabset(t_csoundapi *x, t_symbol *tab, t_float f);
+static void csoundapi_tabget(t_csoundapi *x, t_symbol *tab, t_float f);
+
+
 PUBLIC void csoundapi_tilde_setup(void)
 {
   csoundapi_class =
@@ -141,7 +145,8 @@ PUBLIC void csoundapi_tilde_setup(void)
   class_addmethod(csoundapi_class, (t_method) csoundapi_set_channel,
       gensym("chnset"), A_GIMME, 0);
   class_addmethod(csoundapi_class, (t_method) csoundapi_mess, gensym("messages"), A_DEFFLOAT, 0);
-
+  class_addmethod(csoundapi_class, (t_method) csoundapi_tabset, gensym("tabset"), A_DEFSYMBOL, A_DEFFLOAT, 0);
+  class_addmethod(csoundapi_class, (t_method) csoundapi_tabget, gensym("tabget"),  A_DEFSYMBOL, A_DEFFLOAT, 0);
   class_addmethod(csoundapi_class, (t_method) csoundapi_midi, gensym("midi"), A_GIMME, 0);
   class_addmethod(csoundapi_class, (t_method) csoundapi_noteon, gensym("noteon"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
   class_addmethod(csoundapi_class, (t_method) csoundapi_noteoff, gensym("noteoff"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
@@ -491,6 +496,55 @@ static void csoundapi_run(t_csoundapi *x, t_floatarg f)
   post("csoundapi~ run: %d", x->run);
 }
 
+static void csoundapi_tabset(t_csoundapi *x, t_symbol *tab, t_float f)
+{
+  t_garray *pdarray;
+  MYFLT    *cstable;
+  t_word *pdarray_vec;
+  int   cstabsize, i, size;
+  int   pdarraysize;
+  cstabsize = csoundGetTable(x->csound, &cstable, (int) f);
+  if(cstabsize != -1) {
+    pdarray =  (t_garray *) pd_findbyclass(tab, garray_class);
+    if( pdarray != NULL) {
+    garray_getfloatwords(pdarray, &pdarraysize, &pdarray_vec);  
+    size = cstabsize <= pdarraysize ? cstabsize : pdarraysize;
+    for(i = 0; i < size; i++) {
+      cstable[i] = (MYFLT) pdarray_vec[i].w_float;
+    }
+    }
+    else {
+      post ("csoundapi~: could not find array\n"); 
+      return;
+    }
+  } else post("csoundapi~: csound table %d not found \n", (int) f);
+}
+
+static void csoundapi_tabget(t_csoundapi *x,  t_symbol *tab, t_float f)
+{
+  t_garray *pdarray;
+  MYFLT    *cstable;
+  t_word *pdarray_vec;
+  int   cstabsize, i, size;
+  int   pdarraysize;
+  cstabsize = csoundGetTable(x->csound, &cstable, (int) f);
+  if(cstabsize != -1) {
+    pdarray =  (t_garray *) pd_findbyclass(tab, garray_class);
+    if( pdarray != NULL) {
+    garray_getfloatwords(pdarray, &pdarraysize, &pdarray_vec);
+    size = cstabsize <= pdarraysize ? cstabsize : pdarraysize;
+    for(i = 0; i < size; i++) 
+      pdarray_vec[i].w_float = (t_float) cstable[i];
+      garray_redraw(pdarray);
+    }
+    else {
+      post ("csoundapi~: could not find array\n"); 
+      return;
+    }
+  } else post("csoundapi~: csound table %d not found \n", (int) f);
+}
+
+
 static void csoundapi_offset(t_csoundapi *x, t_floatarg f)
 {
   csoundSetScoreOffsetSeconds(x->csound, (MYFLT) f);
diff --git a/head-mingw-env.sh b/head-mingw-env.sh
index 3586ea4..44b97b2 100755
--- a/head-mingw-env.sh
+++ b/head-mingw-env.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
-echo Setting up environment to run Csound head branch from build area...
+echo Setting up environment to build and run Csound head branch from build area...
 echo Order of paths can be vitally important!
 export PATH=/c/utah/opt/Mega-Nerd/libsndfile:${PATH}
 export PATH=/c/utah/opt/portaudio:${PATH}
@@ -22,15 +22,14 @@ export PATH=${PATH}:/c/utah/opt/fltk-1.1.10/src
 export PATH=${PATH}:/c/utah/opt/fltk-1.1.10/lib
 export PATH=${PATH}:/c/utah/opt/fltk-1.1.10/bin
 export PATH=${PATH}:/c/utah/opt/fltk-1.1.10/fluid
-export PATH=${PATH}:/c/utah/opt/qutecsound/bin
 export PATH=${PATH}:/c/utah/opt/musicxml-v2/win32/codeblocks
 export PATH=${PATH}:/c/utah/opt/gtk/bin
 export PATH=${PATH}:/c/utah/opt/MinGW/msys/1.0/bin
-export PATH=/c/utah/opt/Qt/mingw/bin:${PATH}
-export PATH=/c/utah/opt/Qt/Desktop/Qt/4.7.4/mingw/bin:${PATH}
+export PATH=${PATH}:/c/utah/opt/scite
+export PATH=${PATH}:/c/utah/opt/Qt/QtCreator/bin
+export PATH=${PATH}:/c/utah/opt/qcs-build-desktop/bin
 export PATH=/c/utah/opt/PythonQt-build-desktop/lib:${PATH}
 export PATH=${PATH}:/c/utah/opt/MiKTeX-2.9/miktex/bin
-export PATH=${PATH}:/c/utah/opt/MiKTeX-2.9/miktex/bin
 export RAWWAVE_PATH=D:/utah/home/mkg/csound/csound5/Opcodes/stk/rawwaves
 export OPCODEDIR64=D:/utah/home/mkg/csound/csound5
 export PYTHONPATH=D:/utah/home/mkg/csound/csound5
diff --git a/installer/linux/fedora/csound-5.10.1-64-bit-plugin-path.patch b/installer/linux/fedora/csound-5.10.1-64-bit-plugin-path.patch
new file mode 100644
index 0000000..2e05c9c
--- /dev/null
+++ b/installer/linux/fedora/csound-5.10.1-64-bit-plugin-path.patch
@@ -0,0 +1,66 @@
+--- Csound5.10.1/SConstruct.orig	2008-12-18 18:26:46.000000000 +0000
++++ Csound5.10.1/SConstruct	2009-03-30 20:08:10.000000000 +0100
+@@ -768,9 +768,7 @@
+ # library version is CS_VERSION.CS_APIVERSION
+ csoundLibraryVersion = '5.2'
+ csoundLibraryName = 'csound'
+-if commonEnvironment['useDouble'] != '0':
+-    csoundLibraryName += '64'
+-elif getPlatform() == 'win32':
++if getPlatform() == 'win32':
+     csoundLibraryName += '32'
+ # flags for linking with the Csound library
+ libCsoundLinkFlags = []
+@@ -814,8 +812,6 @@
+             tmp = '%s/lib/csound/plugins' % commonEnvironment['prefix']
+         else:
+             tmp = '%s/lib64/csound/plugins' % commonEnvironment['prefix']
+-        if commonEnvironment['useDouble'] != '0':
+-            tmp += '64'
+         s = '-DCS_DEFAULT_PLUGINDIR=\\"%s\\"' % tmp
+         csoundLibraryEnvironment.Append(CPPFLAGS = [s])
+     elif buildOSXFramework != 0:
+@@ -2588,10 +2584,7 @@
+     if i[:sys.prefix.__len__()] == sys.prefix and i[-13:] == 'site-packages':
+         PYTHON_DIR = i
+ 
+-if commonEnvironment['useDouble'] == '0':
+-    PLUGIN_DIR = LIB_DIR + "/csound/plugins"
+-else:
+-    PLUGIN_DIR = LIB_DIR + "/csound/plugins64"
++PLUGIN_DIR = LIB_DIR + "/csound/plugins"
+ 
+ if commonEnvironment['install'] == '1':
+     installExecutables = Alias('install-executables',
+--- Csound5.10.1/Top/csmodule.c.orig	2008-12-18 17:37:02.000000000 +0000
++++ Csound5.10.1/Top/csmodule.c	2009-03-30 20:08:10.000000000 +0100
+@@ -638,17 +638,12 @@
+       return CSOUND_ERROR;
+ 
+     /* open plugin directory */
+-    dname = csoundGetEnv(csound, (sizeof(MYFLT) == sizeof(float) ?
+-                                  plugindir_envvar : plugindir64_envvar));
++    dname = csoundGetEnv(csound, plugindir_envvar);
+     if (dname == NULL) {
+ #if ENABLE_OPCODEDIR_WARNINGS
+       csound->opcodedirWasOK = 0;
+-#  ifdef USE_DOUBLE
+-      dname = csoundGetEnv(csound, plugindir_envvar);
+-      if (dname == NULL)
+-#  endif
+ #endif
+-        dname = CS_DEFAULT_PLUGINDIR;
++      dname = CS_DEFAULT_PLUGINDIR;
+     }
+     dir = opendir(dname);
+     if (UNLIKELY(dir == (DIR*) NULL)) {
+--- Csound5.13.0/Top/csmodule.c.orig	2011-04-07 10:48:47.631735127 +0100
++++ Csound5.13.0/Top/csmodule.c	2011-04-07 10:49:19.170735598 +0100
+@@ -127,7 +127,6 @@
+ 
+ /* environment variable storing path to plugin libraries */
+ static  const   char    *plugindir_envvar =   "OPCODEDIR";
+-static  const   char    *plugindir64_envvar = "OPCODEDIR64";
+ 
+ /* default directory to load plugins from if environment variable is not set */
+ #if !(defined(_CSOUND_RELEASE_) && (defined(LINUX) || defined(__MACH__)))
diff --git a/installer/linux/fedora/csound-5.10.1-enable-oggplay.patch b/installer/linux/fedora/csound-5.10.1-enable-oggplay.patch
new file mode 100644
index 0000000..bf93bed
--- /dev/null
+++ b/installer/linux/fedora/csound-5.10.1-enable-oggplay.patch
@@ -0,0 +1,23 @@
+--- Csound5.10.1/SConstruct.orig	2009-03-31 12:17:17.000000000 +0100
++++ Csound5.10.1/SConstruct	2009-03-31 12:19:17.000000000 +0100
+@@ -132,6 +132,9 @@
+     commandOptions.Add('useUDP',
+         'Set to 1 if you want UDP support',
+         '0')
++commandOptions.Add('useOGG',
++    'Set to 1 to build ogg opcodes',
++    '1')
+ commandOptions.Add('buildPythonOpcodes',
+     'Set to 1 to build Python opcodes',
+     '0')
+@@ -1725,7 +1728,9 @@
+ # end udp opcodes
+ 
+ # OGG opcodes
+-if buildOLPC:
++if commonEnvironment['useOGG'] == '0':
++    print "CONFIGURATION DECISION: Not building OGG plugins."
++else:
+     print "CONFIGURATION DECISION: Building OGG plugins."
+     oggEnvironment = pluginEnvironment.Clone()
+     oggEnvironment.Append(LINKFLAGS = ['-lvorbisfile', '-lvorbis', '-logg'])
diff --git a/installer/linux/fedora/csound-5.10.1-rtalsa-fix.patch b/installer/linux/fedora/csound-5.10.1-rtalsa-fix.patch
new file mode 100644
index 0000000..e534d33
--- /dev/null
+++ b/installer/linux/fedora/csound-5.10.1-rtalsa-fix.patch
@@ -0,0 +1,10 @@
+--- Csound5.10.1/InOut/rtalsa.c.orig	2008-12-15 21:18:39.000000000 +0000
++++ Csound5.10.1/InOut/rtalsa.c	2009-03-31 00:28:48.000000000 +0100
+@@ -45,6 +45,7 @@
+ #include <sys/select.h>
+ #include <termios.h>
+ #include <errno.h>
++#define _POSIX_C_SOURCE 1
+ #include <alsa/asoundlib.h>
+ #include <sched.h>
+ #include <unistd.h>
diff --git a/installer/linux/fedora/csound-5.12.1-fixpython.patch b/installer/linux/fedora/csound-5.12.1-fixpython.patch
new file mode 100644
index 0000000..1e00f0d
--- /dev/null
+++ b/installer/linux/fedora/csound-5.12.1-fixpython.patch
@@ -0,0 +1,19 @@
+--- Csound5.12.1/install.py.orig	2010-12-26 23:57:36.556893990 +0000
++++ Csound5.12.1/install.py	2010-12-27 00:04:26.322205519 +0000
+@@ -288,7 +288,7 @@
+ #err = installFile('opcodes.dir', pluginDir)
+ installErrors = installErrors or err
+ pluginList = findFiles('.', 'lib[A-Za-z].*\\.so')
+-for i in ['libcsound.so', 'libcsound64.so']:
++for i in ['libcsound.so', 'libcsound64.so', 'libcsnd.so']:
+     if i in pluginList:
+         pluginList.remove(i)
+ for i in pluginList:
+@@ -305,6 +305,7 @@
+ 
+ print ' === Installing language interfaces ==='
+ wrapperList = [['csnd\\.py', '0', pythonDir],
++               ['_csnd\\.so', '1', pythonDir],
+                ['loris\\.py', '0', pythonDir],
+                ['CsoundVST\\.py', '0', pythonDir],
+                ['scoregen\\.py', '0', pythonDir],
diff --git a/installer/linux/fedora/csound-5.13.0-compile-flag.patch b/installer/linux/fedora/csound-5.13.0-compile-flag.patch
new file mode 100644
index 0000000..88e2751
--- /dev/null
+++ b/installer/linux/fedora/csound-5.13.0-compile-flag.patch
@@ -0,0 +1,63 @@
+--- Csound5.13.0/Top/csound.c.orig	2011-04-07 10:36:19.738489172 +0100
++++ Csound5.13.0/Top/csound.c	2011-04-07 10:41:09.834581223 +0100
+@@ -1382,6 +1382,10 @@
+     {
+         int done;
+         int returnValue;
++        /* WTB - Oct 15 2009: only perform if CS_STATE_COMP set. */
++        if (UNLIKELY((csound->engineState & CS_STATE_COMP) == 0)) {
++           return 1;
++        }
+         /* setup jmp for return after an exit() */
+         if ((returnValue = setjmp(csound->exitjmp))) {
+ #ifndef MACOSX
+@@ -1402,6 +1406,10 @@
+     {
+         int done = 0;
+         int returnValue;
++        /* WTB - Oct 15 2009: only perform if CS_STATE_COMP set. */
++        if (UNLIKELY((csound->engineState & CS_STATE_COMP) == 0)) {
++           return 1;
++        }
+         /* setup jmp for return after an exit() */
+         if ((returnValue = setjmp(csound->exitjmp))) {
+ #ifndef MACOSX
+@@ -1447,6 +1455,10 @@
+         int done;
+         int returnValue;
+         csound->performState = 0;
++        /* WTB - Oct 15 2009: only perform if CS_STATE_COMP set. */
++        if (UNLIKELY((csound->engineState & CS_STATE_COMP) == 0)) {
++           return 1;
++        }
+         /* setup jmp for return after an exit() */
+         if ((returnValue = setjmp(csound->exitjmp))) {
+ #ifndef MACOSX
+--- Csound5.13.0/Top/main.c.orig	2011-04-07 10:36:24.745611983 +0100
++++ Csound5.13.0/Top/main.c	2011-04-07 10:43:02.001313569 +0100
+@@ -89,7 +89,9 @@
+     dbfs_init(csound, DFLT_DBFS);
+     csound->csRtClock = (RTCLOCK*) csound->Calloc(csound, sizeof(RTCLOCK));
+     csoundInitTimerStruct(csound->csRtClock);
+-    csound->engineState |= CS_STATE_COMP | CS_STATE_CLN;
++    /* WTB - Oct 15 2009: only set CS_STATE_CLN; CS_STATE_COMP set when retval=0. */
++    csound->engineState |= /*CS_STATE_COMP |*/ CS_STATE_CLN;
++
+ 
+ #ifndef USE_DOUBLE
+ #ifdef BETA
+@@ -409,6 +411,13 @@
+     if (O->Midioutname != NULL || O->FMidioutname != NULL)
+       openMIDIout(csound);
+ 
+-    return musmon(csound);
++    n = musmon(csound);
++
++    /* WTB - Oct 15 2009: CS_STATE_COMP set when retval=0. */
++    if (n == 0) {
++               csound->engineState |= CS_STATE_COMP;
++    }
++
++    return n;
+ }
+ 
diff --git a/installer/linux/fedora/csound-5.13.0-default-opcodedir.patch b/installer/linux/fedora/csound-5.13.0-default-opcodedir.patch
new file mode 100644
index 0000000..b2ea679
--- /dev/null
+++ b/installer/linux/fedora/csound-5.13.0-default-opcodedir.patch
@@ -0,0 +1,37 @@
+--- Csound5.13.0/Top/csmodule.c.orig	2011-04-07 11:00:11.880733934 +0100
++++ Csound5.13.0/Top/csmodule.c	2011-04-07 11:01:31.557737121 +0100
+@@ -130,26 +130,25 @@
+ static  const   char    *plugindir64_envvar = "OPCODEDIR64";
+ 
+ /* default directory to load plugins from if environment variable is not set */
+-#ifdef OLPC
+-# define CS_DEFAULT_PLUGINDIR  "/usr/lib/csound/plugins"
+-#else
+ #if !(defined(_CSOUND_RELEASE_) && (defined(LINUX) || defined(__MACH__)))
+ #  define ENABLE_OPCODEDIR_WARNINGS 1
+-#  ifdef CS_DEFAULT_PLUGINDIR
+-#    undef CS_DEFAULT_PLUGINDIR
++#  ifndef CS_DEFAULT_PLUGINDIR
++#    ifndef USE_DOUBLE
++#      define CS_DEFAULT_PLUGINDIR  "/usr/lib/csound/plugins"
++#    else
++#      define CS_DEFAULT_PLUGINDIR  "/usr/lib64/csound/plugins"
++#    endif
+ #  endif
+-#  define CS_DEFAULT_PLUGINDIR      "."
+ #else
+ #  define ENABLE_OPCODEDIR_WARNINGS 0
+ #  ifndef CS_DEFAULT_PLUGINDIR
+ #    ifndef USE_DOUBLE
+-#      define CS_DEFAULT_PLUGINDIR  "/usr/local/lib/csound/plugins"
++#      define CS_DEFAULT_PLUGINDIR  "/usr/lib/csound/plugins"
+ #    else
+-#      define CS_DEFAULT_PLUGINDIR  "/usr/local/lib/csound/plugins64"
++#      define CS_DEFAULT_PLUGINDIR  "/usr/lib64/csound/plugins"
+ #    endif
+ #  endif
+ #endif
+-#endif
+ 
+ typedef struct opcodeLibFunc_s {
+     long    (*opcode_init)(CSOUND *, OENTRY **);  /* list of opcode entries  */
diff --git a/installer/linux/fedora/csound-5.13.0-default-pulse.patch b/installer/linux/fedora/csound-5.13.0-default-pulse.patch
new file mode 100644
index 0000000..b15758d
--- /dev/null
+++ b/installer/linux/fedora/csound-5.13.0-default-pulse.patch
@@ -0,0 +1,15 @@
+--- Csound5.13.0/Top/csound.c.orig	2010-12-27 17:56:15.000000000 +0000
++++ Csound5.13.0/Top/csound.c	2011-04-07 08:08:54.967713991 +0100
+@@ -1005,11 +1005,7 @@
+         max_len = 21;
+         csoundCreateGlobalVariable(p, "_RTAUDIO", (size_t) max_len);
+         s = csoundQueryGlobalVariable(p, "_RTAUDIO");
+-#ifdef OLPC
+-        strcpy(s, "alsa");
+-#else
+-        strcpy(s, "PortAudio");
+-#endif
++        strcpy(s, "pulse");
+         csoundCreateConfigurationVariable(p, "rtaudio", s, CSOUNDCFG_STRING,
+                 0, NULL, &max_len,
+                 "Real time audio module name", NULL);
diff --git a/installer/linux/fedora/csound-5.13.0-fix-conflicts.patch b/installer/linux/fedora/csound-5.13.0-fix-conflicts.patch
new file mode 100644
index 0000000..b47d03e
--- /dev/null
+++ b/installer/linux/fedora/csound-5.13.0-fix-conflicts.patch
@@ -0,0 +1,77 @@
+--- Csound5.13.0/SConstruct.orig	2011-04-07 07:56:09.439110711 +0100
++++ Csound5.13.0/SConstruct	2011-04-07 07:56:27.059538112 +0100
+@@ -2218,38 +2218,43 @@
+         ['atsa',        'util/atsa_main.c'    ],
+         ['cvanal',      'util/cvl_main.c'     ],
+         ['dnoise',      'util/dnoise_main.c'  ],
+-        ['envext',      'util/env_main.c'     ],
+-        ['extractor',   'util/xtrc_main.c'    ],
++        ['cs-envext',      'util/env_main.c'     ],
++        ['cs-extractor',   'util/xtrc_main.c'    ],
+         ['het_export',  'util/hetx_main.c'    ],
+         ['het_import',  'util/heti_main.c'    ],
+         ['hetro',       'util/het_main.c'     ],
+         ['lpanal',      'util/lpc_main.c'     ],
+         ['lpc_export',  'util/lpcx_main.c'    ],
+         ['lpc_import',  'util/lpci_main.c'    ],
+-        ['mixer',       'util/mixer_main.c'   ],
++        ['cs-mixer',       'util/mixer_main.c'   ],
+         ['pvanal',      'util/pvc_main.c'     ],
+         ['pvlook',      'util/pvl_main.c'     ],
+         ['pv_export',   'util/pvx_main.c'     ],
+         ['pv_import',   'util/pvi_main.c'     ],
+-        ['scale',       'util/scale_main.c'   ],
+-        ['sndinfo',     'util/sndinfo_main.c' ],
+-        ['srconv',      'util/srconv_main.c'  ]]
++        ['cs-scale',       'util/scale_main.c'   ],
++        ['cs-sndinfo',     'util/sndinfo_main.c' ],
++        ['cs-srconv',      'util/srconv_main.c'  ]]
+     for i in utils:
+-       executables.append(csoundProgramEnvironment.Program(i[0], i[1]))
++       a = csoundProgramEnvironment.Program(i[0], i[1])
++       executables.append(a)
++       if i[0].startswith("cs-"):
++           Depends(a, csoundLibrary)
+ 
+ if not buildOLPC:
+   executables.append(csoundProgramEnvironment.Program('scsort',
+     ['util1/sortex/smain.c']))
+-  executables.append(csoundProgramEnvironment.Program('extract',
+-    ['util1/sortex/xmain.c']))
++  a = csoundProgramEnvironment.Program('cs-extract', ['util1/sortex/xmain.c'])
++  executables.append(a)
++  Depends(a, csoundLibrary)
+   if compilerGNU():
+-    executables.append(commonEnvironment.Program('cs',
+-      ['util1/csd_util/cs.c']))
++    a = commonEnvironment.Program('cs-launcher', ['util1/csd_util/cs.c'])
++    executables.append(a)
++    Depends(a, csoundLibrary)
+     executables.append(commonEnvironment.Program('csb64enc',
+       ['util1/csd_util/base64.c', 'util1/csd_util/csb64enc.c']))
+     executables.append(commonEnvironment.Program('makecsd',
+       ['util1/csd_util/base64.c', 'util1/csd_util/makecsd.c']))
+-    executables.append(commonEnvironment.Program('scot',
++    executables.append(commonEnvironment.Program('cs-scot',
+       ['util1/scot/scot_main.c', 'util1/scot/scot.c']))
+ #executables.append(csoundProgramEnvironment.Program('cscore',
+ #    ['util1/cscore/cscore_main.c']))
+--- Csound5.13.0/install.py.orig	2011-04-07 07:56:43.608939511 +0100
++++ Csound5.13.0/install.py	2011-04-07 07:58:42.764835288 +0100
+@@ -20,12 +20,12 @@
+ 
+ exeFiles1 = ['csound', 'csound5gui', 'CsoundVST', 'winsound',
+              'cstclsh', 'cswish', 'cseditor',
+-             'cvanal', 'dnoise', 'envext', 'extractor',
++             'cvanal', 'dnoise', 'cs-envext', 'cs-extractor',
+              'het_export', 'het_import', 'hetro', 'lpanal',
+-             'lpc_export', 'lpc_import', 'mixer', 'pvanal',
++             'lpc_export', 'lpc_import', 'cs-mixer', 'pvanal',
+              'pv_export', 'pv_import', 'atsa',
+-             'pvlook', 'scale', 'sndinfo', 'srconv', 'beats',
+-             'scsort', 'extract', 'cs', 'csb64enc', 'makecsd', 'scot']
++             'pvlook', 'cs-scale', 'cs-sndinfo', 'cs-srconv', 'beats',
++             'scsort', 'cs-extract', 'cs-launcher', 'csb64enc', 'makecsd', 'cs-scot']
+ 
+ exeFiles2 = ['brkpt', 'linseg', 'tabdes']
+ 
diff --git a/installer/linux/fedora/csound-5.13.0-fix-locale-install.patch b/installer/linux/fedora/csound-5.13.0-fix-locale-install.patch
new file mode 100644
index 0000000..4573379
--- /dev/null
+++ b/installer/linux/fedora/csound-5.13.0-fix-locale-install.patch
@@ -0,0 +1,11 @@
+--- Csound5.13.0/install.py.orig	2011-04-07 08:02:28.460324321 +0100
++++ Csound5.13.0/install.py	2011-04-07 08:04:25.227162356 +0100
+@@ -154,7 +154,7 @@
+     fileList += [fileName]
+     fullName = concatPath([instDir, fileName])
+     err = runCmd(['install', '-p', '-m', perm, src, fullName])
+-    if err == 0 and stripMode != '':
++    if err == 0 and stripMode == 'packman':
+         err = runCmd(['strip', stripMode, fullName])
+     if err == 0:
+         addMD5(fullName, fileName)
diff --git a/installer/linux/fedora/csound-5.13.0-fixpythonint.patch b/installer/linux/fedora/csound-5.13.0-fixpythonint.patch
new file mode 100644
index 0000000..4bd6a6e
--- /dev/null
+++ b/installer/linux/fedora/csound-5.13.0-fixpythonint.patch
@@ -0,0 +1,38 @@
+From: Victor Lazzarini <Victor.Lazzarini at nuim.ie>
+Date: Wed, 27 Apr 2011 11:05:32 +0000 (+0100)
+Subject: fixed cstddef symbol definitions issue for linux in python interface
+X-Git-Url: http://csound.git.sourceforge.net/git/gitweb.cgi?p=csound%2Fcsound5.git;a=commitdiff_plain;h=7e5377da29e7524df8ea57e6614d21cdd4d18ee0
+
+fixed cstddef symbol definitions issue for linux in python interface
+---
+
+diff --git a/interfaces/python_interface.i b/interfaces/python_interface.i
+index cbaeff8..a2cbfaf 100644
+--- a/interfaces/python_interface.i
++++ b/interfaces/python_interface.i
+@@ -20,6 +20,8 @@
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+ 
++
++
+ #ifndef MACOSX
+ %module(directors="1") csnd
+ %feature("director") CsoundCallbackWrapper;
+@@ -43,6 +45,7 @@
+ 
+ %feature("autodoc", "1");
+ %{
++    #include <cstddef>
+     #include "csound.h"
+     #include "cfgvar.h"
+     #include "csound.hpp"
+@@ -51,7 +54,7 @@
+     #include "CsoundFile.hpp"
+     #include "CppSound.hpp"
+     #include "filebuilding.h"
+-    #include "Soundfile.hpp"
++    #include "Soundfile.hpp" 
+ %}
+ 
+ %apply int { size_t };
diff --git a/installer/linux/fedora/csound-5.13.0-fltk.patch b/installer/linux/fedora/csound-5.13.0-fltk.patch
new file mode 100644
index 0000000..7526613
--- /dev/null
+++ b/installer/linux/fedora/csound-5.13.0-fltk.patch
@@ -0,0 +1,14 @@
+diff -Naur Csound5.13.0.orig/InOut/virtual_keyboard/SliderBank.hpp Csound5.13.0/InOut/virtual_keyboard/SliderBank.hpp
+--- Csound5.13.0.orig/InOut/virtual_keyboard/SliderBank.hpp	2006-11-21 06:45:53.000000000 +0100
++++ Csound5.13.0/InOut/virtual_keyboard/SliderBank.hpp	2011-06-01 08:51:24.473373941 +0200
+@@ -26,8 +26,8 @@
+ 
+ #include <FL/Fl.H>
+ #include <FL/Fl_Group.H>
+-#include <Fl/Fl_Value_Slider.H>
+-#include <Fl/Fl_Spinner.H>
++#include <FL/Fl_Value_Slider.H>
++#include <FL/Fl_Spinner.H>
+ #include "csdl.h"
+ #include "SliderData.hpp"
+ 
diff --git a/installer/linux/fedora/csound-5.13.0-no-usr-local.patch b/installer/linux/fedora/csound-5.13.0-no-usr-local.patch
new file mode 100644
index 0000000..8828958
--- /dev/null
+++ b/installer/linux/fedora/csound-5.13.0-no-usr-local.patch
@@ -0,0 +1,71 @@
+--- Csound5.13.0/SConstruct.orig	2011-04-07 07:12:40.477602580 +0100
++++ Csound5.13.0/SConstruct	2011-04-07 07:15:29.884656314 +0100
+@@ -503,9 +503,9 @@
+     if getPlatform() == 'sunos':
+         commonEnvironment.Prepend(LIBPATH = ['.', '#.', '/lib/64', '/usr/lib/64'])
+     else:
+-        commonEnvironment.Prepend(LIBPATH = ['.', '#.', '/usr/local/lib64'])
++        commonEnvironment.Prepend(LIBPATH = ['.', '#.', '/usr/lib64'])
+ else:
+-    commonEnvironment.Prepend(LIBPATH = ['.', '#.', '/usr/local/lib'])
++    commonEnvironment.Prepend(LIBPATH = ['.', '#.', '/usr/lib'])
+ 
+ if commonEnvironment['Word64'] == '1':
+     if compilerSun():
+@@ -531,7 +531,7 @@
+     commonEnvironment.Append(LINKFLAGS = ['-Wl,-Bdynamic'])
+ elif getPlatform() == 'sunos':
+     commonEnvironment.Append(CCFLAGS = "-D_SOLARIS")
+-    commonEnvironment.Append(CPPPATH = '/usr/local/include')
++    commonEnvironment.Append(CPPPATH = '/usr/include')
+     commonEnvironment.Append(CPPPATH = '/usr/include')
+     commonEnvironment.Append(CPPPATH = '/usr/jdk/instances/jdk1.5.0/include')
+     if compilerGNU():
+@@ -539,7 +539,7 @@
+         commonEnvironment.Append(LINKFLAGS = ['-Wl,-Bdynamic'])
+ elif getPlatform() == 'darwin':
+     commonEnvironment.Append(CCFLAGS = "-DMACOSX")
+-    commonEnvironment.Append(CPPPATH = '/usr/local/include')
++    commonEnvironment.Append(CPPPATH = '/usr/include')
+     commonEnvironment.Append(CCFLAGS = "-DPIPES")
+     if commonEnvironment['useAltivec'] == '1':
+         print 'CONFIGURATION DECISION: Using Altivec optimisation'
+@@ -556,7 +556,7 @@
+     commonEnvironment.Append(CXXFLAGS = '-DFL_DLL')
+     if compilerGNU():
+         commonEnvironment.Prepend(CCFLAGS = "-Wall")
+-        commonEnvironment.Append(CPPPATH = '/usr/local/include')
++        commonEnvironment.Append(CPPPATH = '/usr/include')
+         commonEnvironment.Append(CPPPATH = '/usr/include')
+         commonEnvironment.Append(SHLINKFLAGS = Split(' -mno-cygwin -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc'))
+         commonEnvironment.Append(LINKFLAGS = Split(' -mno-cygwin -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc'))
+@@ -602,13 +602,13 @@
+     pythonLibs = ['python%s' % commonEnvironment['pythonVersion']]
+ elif getPlatform() == 'sunos':
+     path1 = '/usr/include/python%s' % commonEnvironment['pythonVersion']
+-    path2 = '/usr/local/include/python%s' % commonEnvironment['pythonVersion']
++    path2 = '/usr/include/python%s' % commonEnvironment['pythonVersion']
+     pythonIncludePath = [path1, path2]
+     pythonLinkFlags = []
+     if commonEnvironment['Lib64'] == '1':
+-        pythonLibraryPath = ['/usr/local/lib/64', '/usr/lib/64']
++        pythonLibraryPath = ['/usr/lib/64', '/usr/lib/64']
+     else:
+-        pythonLibraryPath = ['/usr/local/lib', '/usr/lib']
++        pythonLibraryPath = ['/usr/lib', '/usr/lib']
+     pythonLibs = ['python%s' % commonEnvironment['pythonVersion']]
+     tclIncludePath = []
+ elif getPlatform() == 'darwin':
+@@ -1340,10 +1340,10 @@
+     PYDLL = r'%s\%s' % (os.environ['SystemRoot'], pythonLibs[0])
+ if getPlatform() == 'win32' and pythonLibs[0] < 'python24' and compilerGNU():
+     pythonImportLibrary = csoundInterfacesEnvironment.Command(
+-        '/usr/local/lib/lib%s.a' % (pythonLibs[0]),
++        '/usr/lib/lib%s.a' % (pythonLibs[0]),
+         PYDLL,
+         ['pexports %s > %s.def' % (PYDLL, pythonLibs[0]),
+-         'dlltool --input-def %s.def --dllname %s.dll --output-lib /usr/local/lib/lib%s.a' % (pythonLibs[0], PYDLL, pythonLibs[0])])
++         'dlltool --input-def %s.def --dllname %s.dll --output-lib /usr/lib/lib%s.a' % (pythonLibs[0], PYDLL, pythonLibs[0])])
+ 
+ def fixCFlagsForSwig(env):
+     if '-pedantic' in env['CCFLAGS']:
diff --git a/installer/linux/fedora/csound-5.13.0-tclversion.patch b/installer/linux/fedora/csound-5.13.0-tclversion.patch
new file mode 100644
index 0000000..8289e72
--- /dev/null
+++ b/installer/linux/fedora/csound-5.13.0-tclversion.patch
@@ -0,0 +1,11 @@
+--- Csound5.13.0/SConstruct.orig	2011-04-07 07:29:45.323126316 +0100
++++ Csound5.13.0/SConstruct	2011-04-07 07:29:54.757352073 +0100
+@@ -262,7 +262,7 @@
+     '0')
+ commandOptions.Add('tclversion',
+     'Set to 8.4 or 8.5',
+-    '8.4')
++    '8.5')
+ commandOptions.Add('includeMP3',
+      'Set to 1 if using mpadec',
+      '0')
diff --git a/installer/linux/fedora/csound.spec b/installer/linux/fedora/csound.spec
new file mode 100644
index 0000000..57f7ac9
--- /dev/null
+++ b/installer/linux/fedora/csound.spec
@@ -0,0 +1,610 @@
+%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
+%{!?python_version: %global python_version %(%{__python} -c "import sys; print '%s.%s' % sys.version_info[:2]")}
+
+# Csound is really dumb about 64-bit
+%ifarch x86_64 ia64 ppc64 sparc64 s390x
+%define build64bit 1
+%define install64bit --word64
+%define useDouble 1
+%else
+%define build64bit 0
+%define install64bit %{nil}
+%define useDouble 0
+%endif
+
+Summary:       A sound synthesis language and library
+Name:          csound
+Version:       5.16.1
+Release:       5%{?dist}
+URL:           http://csound.sourceforge.net/
+License:       LGPLv2+
+Group:         Applications/Multimedia
+
+BuildRequires: swig scons libsndfile-devel libpng-devel libjpeg-devel
+BuildRequires: python python-devel
+BuildRequires: flex bison
+BuildRequires: alsa-lib-devel jack-audio-connection-kit-devel pulseaudio-libs-devel
+BuildRequires: fluidsynth-devel liblo-devel dssi-devel lua-devel
+BuildRequires: fltk-devel fltk-fluid
+BuildRequires: java-devel >= 1.4.0
+BuildRequires: jpackage-utils >= 1.5
+BuildRequires: java-gcj-compat-devel
+BuildRequires: tk-devel tcl-devel
+BuildRequires: tetex tetex-latex libxslt
+BuildRequires: libvorbis-devel libogg-devel
+BuildRequires: gettext
+BuildRequires: gcc-c++ boost-devel
+
+Source0: http://downloads.sourceforge.net/csound/Csound%{version}.tar.gz
+Source1: http://downloads.sourceforge.net/csound/Csound5.16-manual-src.tar.gz
+Source2: http://downloads.sourceforge.net/csound/Csound5.16_manual_html.zip
+
+Patch0: csound-5.12.1-fixpython.patch
+Patch1: csound-5.13.0-no-usr-local.patch
+Patch2: csound-5.13.0-default-opcodedir.patch
+Patch3: csound-5.10.1-rtalsa-fix.patch
+Patch4: csound-5.13.0-tclversion.patch
+Patch5: csound-5.10.1-64-bit-plugin-path.patch
+Patch6: csound-5.13.0-fix-conflicts.patch
+Patch7: csound-5.13.0-fix-locale-install.patch
+Patch8: csound-5.10.1-enable-oggplay.patch
+Patch9: csound-5.13.0-default-pulse.patch
+Patch10: csound-5.13.0-compile-flag.patch
+Patch11: csound-5.13.0-fixpythonint.patch
+Patch12: csound-5.13.0-fltk.patch
+
+%description
+Csound is a sound and music synthesis system, providing facilities for
+composition and performance over a wide range of platforms. It is not
+restricted to any style of music, having been used for many years in
+at least classical, pop, techno, ambient...
+
+%package devel
+Summary: Csound development files and libraries
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Contains headers and libraries for developing applications that use Csound.
+
+%package python
+Summary: Python Csound development files and libraries
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: python
+
+%description python
+Contains Python language bindings for developing Python applications that
+use Csound.
+
+%package python-devel
+Summary: Csound python development files and libraries
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description python-devel
+Contains libraries for developing against csound-python.
+
+%package java
+Summary: Java Csound support
+Group: System Environment/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires:         jpackage-utils >= 1.5
+Requires:         java-1.5.0-gcj
+Requires(post):   jpackage-utils >= 1.5
+Requires(postun): jpackage-utils >= 1.5
+Requires(post):   java-gcj-compat
+Requires(postun): java-gcj-compat
+Requires(post):   /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description java
+Contains Java language bindings for developing and running Java
+applications that use Csound.
+
+%package javadoc
+Summary: API documentation for Java Csound support
+Group: Documentation
+
+%description javadoc
+API documentation for the %{name}-java package.
+
+%package tk
+Summary: Tcl/Tk related Csound utilities
+Group: Applications/Multimedia
+Requires: %{name} = %{version}-%{release}
+Requires: tcl tk
+
+%description tk
+Contains Tcl/Tk related Csound utilities
+
+%package gui
+Summary: A FLTK-based GUI for Csound
+Group: Applications/Multimedia
+Requires: %{name} = %{version}-%{release}
+Requires: fltk xdg-utils
+
+%description gui
+Contains a FLTK-based GUI for Csound
+
+%package fltk
+Summary: FLTK plugins for Csound
+Group: Applications/Multimedia
+Requires: %{name} = %{version}-%{release}
+Requires: fltk
+
+%description fltk
+Contains FLTK plugins for csound
+
+%package jack
+Summary: Jack Audio plugins for Csound
+Group: Applications/Multimedia
+Requires: %{name} = %{version}-%{release}
+Requires: jack-audio-connection-kit
+
+%description jack
+Contains Jack Audio plugins for Csound
+
+%package fluidsynth
+Summary: Fluidsyth soundfont plugin for Csound
+Group: Applications/Multimedia
+Requires: %{name} = %{version}-%{release}
+
+%description fluidsynth
+Contains Fluidsynth soundfont plugin for Csound.
+
+%package dssi
+Summary: Disposable Soft Synth Interface (DSSI) plugin for Csound
+Group: Applications/Multimedia
+Requires: %{name} = %{version}-%{release}
+Requires: dssi
+
+%description dssi
+Disposable Soft Synth Interface (DSSI) plugin for Csound
+
+%package osc
+Summary: Open Sound Control (OSC) plugin for Csound
+Group: Applications/Multimedia
+Requires: %{name} = %{version}-%{release}
+
+%description osc
+Open Sound Control (OSC) plugin for Csound
+
+%package virtual-keyboard
+Summary: Virtual MIDI keyboard plugin for Csound
+Group: Applications/Multimedia
+Requires: %{name} = %{version}-%{release}
+Requires: fltk
+
+%description virtual-keyboard
+A virtual MIDI keyboard plugin for Csound
+
+%package manual
+Summary: Csound manual
+Group: Documentation
+Requires: %{name} = %{version}-%{release}
+BuildArch: noarch
+
+%description manual
+Canonical Reference Manual for Csound.
+
+
+%prep
+%setup -q -n Csound%{version}
+%patch0 -p1 -b .fixpython
+%patch1 -p1 -b .no-usr-local
+%patch2 -p1 -b .default-opcodedir
+%patch3 -p1 -b .rtalsa
+%patch4 -p1 -b .makebuild
+%patch5 -p1 -b .64-bit-plugin-path
+%patch6 -p1 -b .fix-conflicts
+%patch7 -p1 -b .fix-local-install
+%patch8 -p1 -b .enable-oggplay
+%patch9 -p1 -b .default-pulse
+%patch10 -p1 -b .compile-flag
+%patch11 -p1 -b .fixpythonint
+%patch12 -p1 -b .fltk
+
+tar xf %{SOURCE1}
+(cd manual; unzip -q %{SOURCE2})
+
+%build
+
+# Adjust location of the documentation for the GUI bits
+sed -ie 's#\"firefox /usr/local/share/doc/csound/manual/#\"xdg-open file://%{_docdir}/%{name}-manual-%{version}/#' \
+      frontends/fltk_gui/CsoundGlobalSettings.cpp
+
+scons dynamicCsoundLibrary=1 \
+      buildRelease=1 \
+      noDebug=0 \
+      disableGStabs=1 \
+      buildInterfaces=1 \
+      useGettext=1 \
+      useALSA=1 \
+      usePortAudio=0 \
+      usePortMIDI=0 \
+      useOGG=1 \
+      useOSC=1 \
+      useJack=1 \
+      useFLTK=1 \
+      buildVirtual=1 \
+      useFluidsynth=1 \
+      generatePdf=0 \
+      buildCsound5GUI=1 \
+      pythonVersion=%{python_version} \
+      buildPythonOpcodes=1 \
+      buildPythonWrapper=1 \
+      buildLuaWrapper=1 \
+      buildTclcsound=1 \
+      buildJavaWrapper=1 \
+      buildDSSI=1 \
+      buildUtilities=1 \
+      prefix=%{_prefix} \
+      customCCFLAGS="%{optflags}" \
+      customCXXFLAGS="%{optflags}" \
+      Word64=%{build64bit} \
+      useDouble=%{useDouble}
+
+# Generate javadoc
+(cd interfaces; javadoc *.java)
+
+%install
+%{__rm} -rf %{buildroot}
+%{__python} install.py --prefix=%{_prefix} --instdir=%{buildroot} %{install64bit}
+%{__rm} -f %{buildroot}%{_docdir}/%{name}/COPYING
+%{__rm} -f %{buildroot}%{_docdir}/%{name}/ChangeLog
+%{__rm} -f %{buildroot}%{_docdir}/%{name}/INSTALL
+%{__rm} -f %{buildroot}%{_docdir}/%{name}/readme-csound5.txt
+%{__rm} -f %{buildroot}%{_bindir}/uninstall-csound5
+%{__rm} -f %{buildroot}%{_prefix}/csound5-*.md5sums
+
+install -dm 755 %{buildroot}%{_javadir}
+(cd %{buildroot}%{_javadir}; ln -s %{_libdir}/%{name}/java/csnd.jar .)
+
+install -dm 644 %{buildroot}%{_javadocdir}/%{name}-java
+%{__chmod} -R 755 %{buildroot}%{_javadocdir}/%{name}-java
+(cd interfaces; tar cf - *.html csnd/*.html) | (cd %{buildroot}%{_javadocdir}/%{name}-java; tar xvf -)
+
+%{_bindir}/aot-compile-rpm
+
+%find_lang %{name}5
+
+%clean
+%{__rm} -rf %{buildroot}
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%post java
+if [ -x %{_bindir}/rebuild-gcj-db ]; then
+  %{_bindir}/rebuild-gcj-db
+fi
+
+%postun java
+if [ -x %{_bindir}/rebuild-gcj-db ]; then
+  %{_bindir}/rebuild-gcj-db
+fi
+
+%files -f %{name}5.lang
+%defattr(-,root,root,-)
+%doc COPYING ChangeLog readme-csound5.txt
+%{_bindir}/atsa
+%{_bindir}/cs-launcher
+%{_bindir}/csb64enc
+%{_bindir}/csound
+%{_bindir}/cvanal
+%{_bindir}/dnoise
+%{_bindir}/cs-envext
+%{_bindir}/cs-extract
+%{_bindir}/cs-extractor
+%{_bindir}/het_export
+%{_bindir}/het_import
+%{_bindir}/hetro
+%{_bindir}/lpanal
+%{_bindir}/lpc_export
+%{_bindir}/lpc_import
+%{_bindir}/makecsd
+%{_bindir}/cs-mixer
+%{_bindir}/pvanal
+%{_bindir}/pvlook
+%{_bindir}/cs-scale
+%{_bindir}/cs-scot
+%{_bindir}/scsort
+%{_bindir}/cs-sndinfo
+%{_bindir}/cs-srconv
+%{_bindir}/pv_export
+%{_bindir}/pv_import
+%{_libdir}/lib%{name}.so.5.2
+%dir %{_libdir}/%{name}/plugins
+%{_libdir}/%{name}/plugins/libambicode1.so
+%{_libdir}/%{name}/plugins/libampmidid.so
+%{_libdir}/%{name}/plugins/libbabo.so
+%{_libdir}/%{name}/plugins/libbarmodel.so
+%{_libdir}/%{name}/plugins/libcompress.so
+%{_libdir}/%{name}/plugins/libcontrol.so
+%{_libdir}/%{name}/plugins/libchua.so
+%{_libdir}/%{name}/plugins/libcrossfm.so
+%{_libdir}/%{name}/plugins/libcs_date.so
+%{_libdir}/%{name}/plugins/libcs_pan2.so
+%{_libdir}/%{name}/plugins/libcs_pvs_ops.so
+%{_libdir}/%{name}/plugins/libdoppler.so
+%{_libdir}/%{name}/plugins/libeqfil.so
+%{_libdir}/%{name}/plugins/libftest.so
+%{_libdir}/%{name}/plugins/libgabnew.so
+%{_libdir}/%{name}/plugins/libgrain4.so
+%{_libdir}/%{name}/plugins/libharmon.so
+%{_libdir}/%{name}/plugins/libhrtferX.so
+%{_libdir}/%{name}/plugins/libhrtfnew.so
+%{_libdir}/%{name}/plugins/libimage.so
+%{_libdir}/%{name}/plugins/libjacko.so
+%{_libdir}/%{name}/plugins/libloscilx.so
+%{_libdir}/%{name}/plugins/libminmax.so
+%{_libdir}/%{name}/plugins/libmixer.so
+%{_libdir}/%{name}/plugins/libmodal4.so
+%{_libdir}/%{name}/plugins/libmodmatrix.so
+%{_libdir}/%{name}/plugins/libmutexops.so
+%{_libdir}/%{name}/plugins/liboggplay.so
+%{_libdir}/%{name}/plugins/libpartikkel.so
+%{_libdir}/%{name}/plugins/libphisem.so
+%{_libdir}/%{name}/plugins/libphysmod.so
+%{_libdir}/%{name}/plugins/libpitch.so
+%{_libdir}/%{name}/plugins/libptrack.so
+%{_libdir}/%{name}/plugins/libpvlock.so
+%{_libdir}/%{name}/plugins/libpvoc.so
+%{_libdir}/%{name}/plugins/libpvsbuffer.so
+%{_libdir}/%{name}/plugins/libpy.so
+%{_libdir}/%{name}/plugins/librtalsa.so
+%{_libdir}/%{name}/plugins/librtpulse.so
+%{_libdir}/%{name}/plugins/libscansyn.so
+%{_libdir}/%{name}/plugins/libscoreline.so
+%{_libdir}/%{name}/plugins/libsfont.so
+%{_libdir}/%{name}/plugins/libshape.so
+%{_libdir}/%{name}/plugins/libsignalflowgraph.so
+%{_libdir}/%{name}/plugins/libstackops.so
+%{_libdir}/%{name}/plugins/libstdopcod.so
+%{_libdir}/%{name}/plugins/libstdutil.so
+%{_libdir}/%{name}/plugins/libsystem_call.so
+%{_libdir}/%{name}/plugins/libtabsum.so
+%{_libdir}/%{name}/plugins/libudprecv.so
+%{_libdir}/%{name}/plugins/libudpsend.so
+%{_libdir}/%{name}/plugins/libugakbari.so
+%{_libdir}/%{name}/plugins/liburandom.so
+%{_libdir}/%{name}/plugins/libvaops.so
+%{_libdir}/%{name}/plugins/libvbap.so
+%{_libdir}/%{name}/plugins/libvosim.so
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/%{name}/
+%{_libdir}/lib%{name}.so
+%{_libdir}/libcsnd.so
+
+%files python
+%defattr(-,root,root,-)
+%{_libdir}/libcsnd.so.5.2
+%{python_sitearch}/_csnd*
+%{python_sitearch}/csnd*
+
+%files python-devel
+%defattr(-,root,root,-)
+# %{_libdir}/libcsnd.so
+
+%files java
+%defattr(-,root,root,-)
+%{_libdir}/lib_jcsound.so
+%{_libdir}/%{name}/java/
+%{_javadir}/csnd.jar
+%attr(-,root,root) %{_libdir}/gcj/%{name}
+
+%files javadoc
+%defattr(-,root,root,-)
+%doc COPYING
+%doc %{_javadocdir}/%{name}-java
+
+%files tk
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/tcl/
+%{_bindir}/matrix.tk
+%{_bindir}/brkpt
+%{_bindir}/linseg
+%{_bindir}/tabdes
+%{_bindir}/cstclsh
+%{_bindir}/cswish
+
+%files gui
+%defattr(-,root,root,-)
+%{_bindir}/csound5gui
+
+%files fltk
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/plugins/libwidgets.so
+
+%files jack
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/plugins/librtjack.so
+%{_libdir}/%{name}/plugins/libjackTransport.so
+
+%files fluidsynth
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/plugins/libfluidOpcodes.so
+
+%files dssi
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/plugins/libdssi4cs.so
+
+%files osc
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/plugins/libosc.so
+
+%files virtual-keyboard
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/plugins/libvirtual.so
+
+%files manual
+%defattr(-,root,root,-)
+%doc manual/copying.txt manual/credits.txt manual/readme.txt manual/news.txt
+%doc manual/html/*
+%doc manual/examples/*
+
+%changelog
+* Tue Jun 14 2011 Peter Robinson <pbrobinson at gmail.com> - 5.13.0-5
+- Build the old Parser as the new Parser isn't stable even though it default!
+
+* Wed Jun 01 2011 Ralf Corsépius <corsepiu at fedoraproject.org> - 5.13.0-4
+- Reflect fltk include paths having changed.
+
+* Fri May 27 2011 Peter Robinson <pbrobinson at gmail.com> - 5.13.0-3
+- Bump build for new fltk
+
+* Fri Apr 29 2011 Dan Horák <dan[at]danny.cz> - 5.13.0-2
+- mark s390x as 64-bit arch
+
+* Wed Apr  6 2011 Peter Robinson <pbrobinson at gmail.com> - 5.13.0-1
+- Update to 5.13.0.
+
+* Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 5.12.1-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
+
+* Sun Dec 26 2010 Peter Robinson <pbrobinson at gmail.com> - 5.12.1-1
+- Update to 5.12.1.
+
+* Sat Jul 31 2010 Toshio Kuratomi <toshio at fedoraproject.org> - 5.10.1-21
+- Fix python location
+
+* Wed Jul 21 2010 David Malcolm <dmalcolm at redhat.com> - 5.10.1-20
+- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
+
+* Tue Jul 20 2010 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-19
+- bump build
+
+* Mon Jul 12 2010 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-18
+- Add license file to -javadocs
+
+* Sat Jan  9 2010 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-17
+- Some further cleanups
+
+* Sat Jan  9 2010 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-16
+- Some further cleanups
+
+* Sat Jan  9 2010 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-15
+- Updated to the new python sysarch spec file reqs
+
+* Thu Dec  3 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-14
+- Updated python patch thanks to dsd.
+
+* Tue Oct 20 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-13
+- Fix use of multiple midi devices, fix segfault (RHBZ 529293)
+
+* Sat Sep  5 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-12
+- Build fixes, set PulseAudio as default
+
+* Tue Aug 18 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-11
+- Further python build fixes
+
+* Fri Jul 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 5.10.1-10
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Thu Jul 16 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-9
+- Update included files
+
+* Thu Jul 16 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-8
+- Apply patch to fix libcsnd.so
+
+* Thu Jun 18 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-7
+- Obsolete olpcsound
+
+* Thu May 28 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-6
+- Obsolete csound-tutorial
+
+* Tue May 12 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-4
+- Once more with feeling :-)
+
+* Tue May 12 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-3
+- Some further spec fixes
+
+* Tue May 12 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-2
+- Some build fixes. Enable pulseaudio support
+
+* Mon May 11 2009 Peter Robinson <pbrobinson at gmail.com> - 5.10.1-1
+- Update to 5.10.1 based massively on dcbw's 5.07 spec from the OLPC-2 cvs branch
+  rebase what looks to be relevant pataches from both branches
+  add a number of other build fixes
+
+* Tue Feb 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 5.03.0-21
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
+
+* Sun Dec 28 2008 Dennis Gilmore <dennis at ausil.us> - 5.03.0-20
+- add sparc64 to list of 64 bit arches
+
+* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm at gmail.com> - 5.03.0-19
+- Fix locations for Python 2.6
+
+* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm at gmail.com> - 5.03.0-18
+- Rebuild for Python 2.6
+
+* Thu May 22 2008 Seth Vidal <skvidal at fedoraproject.org> - 5.03.0-17
+- license tag fix
+
+* Fri Feb  1 2008 Dan Williams <dcbw at redhat.com> - 5.03.0-16
+- Fix default plugin path on 64-bit platforms (rh #407911)
+- Fix file conflicts with other packages (rh #210215)
+- Fix unowned directories (rh #233830)
+
+* Thu Jan 10 2008 Caolan McNamara <caolanm at redhat.com> - 5.03.0-15
+- Resolves: rhbz#428176 make build
+
+* Thu Jan 03 2008 Alex Lancaster <alexlan at fedoraproject dot org> - 5.03.0-14
+- Rebuild for new tcl (8.5)
+
+* Mon Apr  2 2007 Thomas Fitzsimmons <fitzsim at redhat.com> - 5.03.0-13
+- Patch out FLTK widget initialization code made unnecessary by
+  fltk-fluid 1.1.8, snapshot r5555
+- Update python site-packages version to 2.5
+
+* Sat Mar 31 2007 Thomas Fitzsimmons <fitzsim at redhat.com> - 5.03.0-12
+- Require java-1.5.0-gcj
+
+* Tue Feb 20 2007 Dan Williams <dcbw at redhat.com> - 5.03.0-11
+- Rebuild for Python 2.5 (again)
+- Fix rtalsa compile error (RH #220856)
+
+* Tue Feb 20 2007 Dan Williams <dcbw at redhat.com> - 5.03.0-10
+- Rebuild for Python 2.5
+
+* Wed Nov  8 2006 Dan Williams <dcbw at redhat.com> 5.03.0-9
+- CVS snapshot for fixes to the virtual midi keyboard
+
+* Wed Nov  1 2006 Dan Williams <dcbw at redhat.com> 5.03.0-8
+- CVS snapshot to pick up virtual Midi keyboard
+- Make the default for OPCODEDIR be where the plugins are actually installed
+
+* Sat Oct 28 2006 Dan Williams <dcbw at redhat.com> 5.03.0-7
+- Rebuild to drop old source tarball
+
+* Fri Oct 27 2006 Dan Williams <dcbw at redhat.com> 5.03.0-6
+- Update to a cvs snapshot for the remote plugin and a few other fixes
+- Split csound FLTK plugin out from -gui package since it's unrelated to the GUI bits
+- Put the virtual MIDI keyboard into its own package
+
+* Wed Oct 25 2006 Dan Williams <dcbw at redhat.com> 5.03.0-5
+- Fix the remote plugin's local IP address read code, add more error checking
+
+* Mon Oct 23 2006 Dan Williams <dcbw at redhat.com> 5.03.0-4
+- Drop csound-5.03.0-uninitialized.patch, upstream
+- Drop csound-5.03.0-printf-redef.patch, upstream
+- CVS snapshot to grab some updated opcodes and fixes
+- Make disabling -gstabs an option for better upstream palatability
+- Disable atsa; it breaks the build for some unknown reason
+
+* Fri Sep  8 2006 Dan Williams <dcbw at redhat.com> 5.03.0-3
+- csound-5.03.0-no-gstabs.patch added; produce dwarf2 like everyone else
+
+* Fri Aug 24 2006 Dan Williams <dcbw at redhat.com> 5.03.0-2
+- Kill printf redefinition
+- Remove zero-length ifthen.csd
+- Remove explicit liblo dep in csound-osc
+- Add fluidsynth plugin
+
+* Fri Aug 24 2006 Dan Williams <dcbw at redhat.com> 5.03.0-1
+- Package for Fedora Extras
diff --git a/installer/macosx/release-build-10.7.sh b/installer/macosx/release-build-10.7.sh
index e0dc235..195d33c 100755
--- a/installer/macosx/release-build-10.7.sh
+++ b/installer/macosx/release-build-10.7.sh
@@ -1,9 +1,9 @@
 #!/bin/sh
 
 export MANUAL_DIR=`pwd`/../../../manual
-export PACKAGE_NAME=csound5.14-OSX10.7-universal.pkg
-export DMG_DIR="Csound 5.14"
-export DMG_NAME="csound5.14-OSX10.7-universal.dmg"
+export PACKAGE_NAME=csound5.16.1-OSX10.7-universal.pkg
+export DMG_DIR="Csound 5.16.1"
+export DMG_NAME="csound5.16.1-OSX10.7-universal.dmg"
 # If arg2 passed in, will cd into that dir and rebuild, otherwise
 # will clone from repo and do a fresh build
 
@@ -204,10 +204,12 @@ cp /usr/local/lib/libsndfile.1.dylib $SUPPORT_LIBS_DIR
 cp /usr/local/lib/libportaudio.2.dylib $SUPPORT_LIBS_DIR
 cp /usr/local/lib/libportmidi.dylib $SUPPORT_LIBS_DIR
 #cp /usr/local/lib/libpng12.0.dylib $SUPLIBS
-cp /usr/local/lib/libmpadec.so $SUPPORT_LIBS_DIR
 #cp /usr/local/lib/libmpadec.dylib $SUPPORT_LIBS_DIR
 #cp /usr/local/lib/libluajit.dylib $SUPLIBS
-
+cp /usr/local/lib/libFLAC.8.dylib $SUPPORT_LIBS_DIR
+cp /usr/local/lib/libvorbisenc.2.dylib $SUPPORT_LIBS_DIR
+cp /usr/local/lib/libvorbis.0.dylib $SUPPORT_LIBS_DIR
+cp /usr/local/lib/libogg.0.dylib $SUPPORT_LIBS_DIR
 
 echo "...setting permissions..."
 
diff --git a/installer/misc/csound.spec.in b/installer/misc/csound.spec.in
index 414d32e..a3af977 100644
--- a/installer/misc/csound.spec.in
+++ b/installer/misc/csound.spec.in
@@ -1,6 +1,6 @@
 Summary: Csound - sound synthesis language and library
 Name: csound
-Version: 5.14.0
+Version: 5.16.1
 Release: 1
 URL: http://csound.sourceforge.net/
 License: LGPL
diff --git a/installer/windows/csoundd.nsi b/installer/windows/csoundd.nsi
index 91d6a9a..07e24c5 100644
--- a/installer/windows/csoundd.nsi
+++ b/installer/windows/csoundd.nsi
@@ -18,7 +18,7 @@
 #######################################################################
 
 !define PRODUCT "Csound"
-!define PROGRAM "Csound5.14.2"
+!define PROGRAM "Csound5.16"
 !echo "Building installer for: ${PROGRAM}"
 !ifdef FLOAT
 !ifdef NONFREE
@@ -501,6 +501,7 @@ skipAssoc:
 	# link.lnk target.file [parameters [icon.file [icon_index_number [start_options [keyboard_shortcut [description]]]]]]
 	CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
 	CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Csound.lnk" "cmd" "/K $INSTDIR\bin\csound.exe" "" "" "" "" "Csound"
+	CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\pa_devs.lnk" "cmd" "/K $INSTDIR\bin\pa_devs.exe" "" "" "" "" "List PortAudio devices"
 !ifdef NONFREE
 	CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\README.lnk" "$INSTDIR\readme-csound5-complete.txt" "" "" "" "" "" "Csound README"
 !else
@@ -536,8 +537,7 @@ skipAssoc:
       # libsndfile
       File C:\utah\opt\Mega-Nerd\libsndfile\libsndfile-1.dll
       # Pthreads
-      File C:\utah\opt\pthreads\Pre-built.2\lib\pthreadGC2.dll
-      File C:\utah\opt\MinGW\bin\libpthread-2.dll
+      File C:\utah\opt\MinGW\bin\pthreadGC2.dll
       # FLTK
       File C:\utah\opt\fltk-1.1.10\src\mgwfltknox-1.1.dll
       File C:\utah\opt\fltk-1.1.10\src\mgwfltknox_forms-1.1.dll
@@ -545,6 +545,7 @@ skipAssoc:
       File C:\utah\opt\fltk-1.1.10\src\mgwfltknox_images-1.1.dll
       # PortAudio
       #File C:\utah\opt\portaudio\portaudio.dll
+      File C:\utah\opt\portaudio\pa_devs.exe
       # PortMIDI
       File C:\utah\opt\portmidi\libportmidi.dll
       #File C:\utah\opt\portmidi\porttime.dll
@@ -558,12 +559,10 @@ skipAssoc:
       # MusicXML
       File C:\utah\opt\musicxml-v2\win32\codeblocks\libmusicxml2.dll
       # pthreads
-      # Now static. File C:\utah\opt\pthreads\Pre-built.2\lib\pthreadGC2.dll
       File c:\utah\opt\MinGW\bin\libgomp-1.dll
       # C runtime library
       File C:\windows\system32\MSVCRT.DLL
       # GNU
-      File C:\utah\opt\MinGW\bin\libgettextsrc-0-17.dll
       File C:\utah\opt\MinGW\bin\libstdc++-6.dll
       File C:\utah\opt\MinGW\bin\mingwm10.dll
       File C:\utah\opt\MinGW\bin\libgcc_s_dw2-1.dll
@@ -571,67 +570,31 @@ skipAssoc:
       File C:\utah\msys\1.0\local\bin\intl.dll
       File C:\utah\msys\1.0\local\bin\libgthread-2.0-0.dll
     # Opcodes, drivers, and other modules:
-    SetOutPath $INSTDIR\${OPCODEDIR_VAL}
-      File ..\..\LuaCsound.dll
-      File ..\..\ambicode1.dll
+    SetOutPath $INSTDIR\${OPCODEDIR_VAL}    
       File ..\..\ampmidid.dll
-      File ..\..\babo.dll
-      File ..\..\barmodel.dll
       File ..\..\chua.dll
-      File ..\..\compress.dll
-      File ..\..\crossfm.dll
       File ..\..\cs_date.dll
-      File ..\..\cs_pan2.dll
-      File ..\..\cs_pvs_ops.dll
+      File ..\..\csladspa.dll
       File ..\..\doppler.dll
-      File ..\..\eqfil.dll
       File ..\..\fareygen.dll
-      File ..\..\fareyseq.dll
       File ..\..\fluidOpcodes.dll
-      File ..\..\ftest.dll
-      File ..\..\gabnew.dll
-      File ..\..\grain4.dll
-      File ..\..\harmon.dll
-      File ..\..\hrtferX.dll
-      File ..\..\hrtfnew.dll
+      File ..\..\fractalnoise.dll
       File ..\..\image.dll
 !ifndef FLOAT
       File ..\..\linear_algebra.dll
 !endif
-      File ..\..\loscilx.dll
-      File ..\..\minmax.dll
       File ..\..\mixer.dll
-      File ..\..\modal4.dll
-      File ..\..\modmatrix.dll
-      File ..\..\mutexops.dll
       File ..\..\osc.dll
-      File ..\..\partikkel.dll
-      File ..\..\phisem.dll
-      File ..\..\physmod.dll
-      File ..\..\pitch.dll
       File ..\..\pmidi.dll
-      File ..\..\ptrack.dll
-      File ..\..\pvlock.dll
-      File ..\..\pvoc.dll
-      File ..\..\pvsbuffer.dll
       File ..\..\rtpa.dll
       File ..\..\rtwinmm.dll
       File ..\..\scansyn.dll
-      File ..\..\scoreline.dll
-      File ..\..\sfont.dll
-      File ..\..\shape.dll
+      File ..\..\serial.dll
       File ..\..\signalflowgraph.dll
-      File ..\..\stackops.dll
-      File ..\..\stdopcod.dll
       File ..\..\stdutil.dll
       File ..\..\stk.dll
       File ..\..\system_call.dll
-      File ..\..\tabsum.dll
-      File ..\..\ugakbari.dll
-      File ..\..\vaops.dll
-      File ..\..\vbap.dll
       File ..\..\virtual.dll
-      File ..\..\vosim.dll
 !ifdef NONFREE
       File ..\..\vst4cs.dll
 !endif
@@ -715,28 +678,23 @@ skipAssoc:
   SectionGroupEnd
 SectionGroupEnd
 SectionGroup "Front ends"
-  #Section "CsoundQt (user-defined widgets)"
-  Section "QuteCsound(user-defined widgets)"
+  Section "CsoundQt (user-defined widgets)"
     SectionIn 2 3
 !ifdef FLOAT
-#    CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt.lnk" "$INSTDIR\bin\CsoundQt-f.exe" "" "" "" "" "" " CsoundQt"
-    CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt.lnk" "$INSTDIR\bin\qutecsound-f.exe" "" "" "" "" "" " QuteCsound"
+    CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt.lnk" "$INSTDIR\bin\CsoundQt-f.exe" "" "" "" "" "" " CsoundQt"
 !else
-#    CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt.lnk" "$INSTDIR\bin\CsoundQt-d.exe" "" "" "" "" "" " CsoundQt"
-    CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt.lnk" "$INSTDIR\bin\qutecsound-d.exe" "" "" "" "" "" " QuteCsound"
+    CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt.lnk" "$INSTDIR\bin\CsoundQt-d.exe" "" "" "" "" "" " CsoundQt"
 !endif
     SetOutPath $INSTDIR\bin
       File ..\..\csnd.dll
       # CsoundQt
-      File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\QtCore4.dll
-      File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\QtGui4.dll
-      File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\QtXml4.dll
+      File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\QtCore4.dll
+      File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\QtGui4.dll
+      File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\QtXml4.dll
 !ifdef FLOAT
-      #File C:\utah\opt\qcs-build-desktop\bin\CsoundQt-f.exe
-      File C:\utah\opt\qutecsound-0.6.1\qutecsound-0.6.1\bin\qutecsound-f.exe
+      File C:\utah\opt\qcs-build-desktop\bin\CsoundQt-f.exe
 !else
-      #File C:\utah\opt\qcs-build-desktop\bin\CsoundQt-d.exe
-      File C:\utah\opt\qutecsound-0.6.1\qutecsound-0.6.1\bin\qutecsound-d.exe
+      File C:\utah\opt\qcs-build-desktop\bin\CsoundQt-d.exe
 !endif
   SectionEnd
 !ifdef NONFREE
@@ -761,6 +719,8 @@ SectionGroup "Front ends"
 #   SectionEnd
   Section /o "tclcsound (requires TCL/Tk)"
     SectionIn 2
+    SetOutPath $INSTDIR\${OPCODEDIR_VAL}    
+      File ..\..\tclcsound.dll
     SetOutPath $INSTDIR\bin
       File ..\..\cswish.exe
       CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\cswish.lnk" "$INSTDIR\bin\cswish.exe" "" "" "" "" "" "Csound wish (tcl/tk)"
@@ -821,6 +781,8 @@ SectionGroup "Csound interfaces"
   SectionGroup "Lua (luajit included)"
     Section "luaCsnd: Lua interface to Csound"
       SectionIn 2 3
+    	SetOutPath $INSTDIR\${OPCODEDIR_VAL}    
+      	File ..\..\LuaCsound.dll
       SetOutPath $INSTDIR\bin
         File C:\utah\opt\luajit\src\lua51.dll
         File C:\utah\opt\luajit\src\luajit.exe
@@ -832,6 +794,8 @@ SectionGroup "Csound interfaces"
     Section "luaCsoundAC: Lua interface to CsoundAC"
       SectionIn 2 3
       CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\luajit.lnk" "$INSTDIR\bin\luajit.exe" "" "" "" "" "" "Lua JIT shell"
+    	SetOutPath $INSTDIR\${OPCODEDIR_VAL}    
+      	File ..\..\LuaCsound.dll
       SetOutPath $INSTDIR\bin
         File C:\utah\opt\luajit\src\lua51.dll
         File C:\utah\opt\luajit\src\luajit.exe
@@ -871,36 +835,31 @@ SectionGroup "Csound interfaces"
 	File ..\..\_CsoundAC.pyd  
         File ..\..\CsoundAC.py
     SectionEnd
-    #Section /o "CsoundQt-Py (user-defined widgets with PythonQt support)"
-    Section /o "QuteCsound-Py (user-defined widgets with PythonQt support)"
+    Section /o "CsoundQt-Py (user-defined widgets with PythonQt support)"
       SectionIn 2
     !ifdef FLOAT
-        #CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt-py.lnk" "$INSTDIR\bin\CsoundQt-f-py.exe" "" "" "" "" "" " CsoundQt-py"
-        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt-py.lnk" "$INSTDIR\bin\qutecsound-f-py.exe" "" "" "" "" "" " QuteCsound-py"
+        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt-py.lnk" "$INSTDIR\bin\CsoundQt-f-py.exe" "" "" "" "" "" " CsoundQt-py"
     !else
-        #CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt-py.lnk" "$INSTDIR\bin\CsoundQt-d-py.exe" "" "" "" "" "" " CsoundQt-py"
-        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt-py.lnk" "$INSTDIR\bin\qutecsound-d-py.exe" "" "" "" "" "" " QuteCsound-py"
+        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\csoundqt-py.lnk" "$INSTDIR\bin\CsoundQt-d-py.exe" "" "" "" "" "" " CsoundQt-py"
     !endif
         SetOutPath $INSTDIR\bin
           File ..\..\csnd.dll
           # CsoundQt
-          File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\QtCore4.dll
-          File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\QtGui4.dll
-          File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\QtXml4.dll
-          File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\QtNetwork4.dll
-          File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\QtOpenGL4.dll
-          File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\QtSql4.dll
-          File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\QtSvg4.dll
-          File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\QtWebKit4.dll
-          File C:\utah\opt\Qt\Desktop\Qt\4.7.4\mingw\bin\phonon4.dll
+          File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\QtCore4.dll
+          File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\QtGui4.dll
+          File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\QtXml4.dll
+          File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\QtNetwork4.dll
+          File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\QtOpenGL4.dll
+          File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\QtSql4.dll
+          File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\QtSvg4.dll
+          File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\QtWebKit4.dll
+          File C:\utah\opt\Qt\Desktop\Qt\4.8.0\mingw\bin\phonon4.dll
           File C:\utah\opt\PythonQt-build-desktop\lib\PythonQt_QtAll.dll
           File C:\utah\opt\PythonQt-build-desktop\lib\PythonQt.dll
     !ifdef FLOAT
-          #File C:\utah\opt\qcs-build-desktop\bin\CsoundQt-f-py.exe
-          File C:\utah\opt\qutecsound-0.6.1\qutecsound-0.6.1\bin\qutecsound-f-py.exe
+          File C:\utah\opt\qcs-build-desktop\bin\CsoundQt-f-py.exe
     !else
-          #File C:\utah\opt\qcs-build-desktop\bin\CsoundQt-d-py.exe
-          File C:\utah\opt\qutecsound-0.6.1\qutecsound-0.6.1\bin\qutecsound-d-py.exe
+          File C:\utah\opt\qcs-build-desktop\bin\CsoundQt-d-py.exe
     !endif
       SectionEnd
   SectionGroupEnd 
@@ -930,6 +889,7 @@ Section "Uninstall"
   	RMDir /r $INSTDIR
   	!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
   	Delete "$SMPROGRAMS\$MUI_TEMP\Csound.lnk"
+  	Delete "$SMPROGRAMS\$MUI_TEMP\pa_devs.lnk"
 	Delete "$SMPROGRAMS\$MUI_TEMP\License.lnk"
   	Delete "$SMPROGRAMS\$MUI_TEMP\Manual.lnk"
   	Delete "$SMPROGRAMS\$MUI_TEMP\Tutorial.lnk"
diff --git a/interfaces/CsoundFile.hpp b/interfaces/CsoundFile.hpp
index 4f8736f..58bfc59 100644
--- a/interfaces/CsoundFile.hpp
+++ b/interfaces/CsoundFile.hpp
@@ -54,7 +54,7 @@
 #if defined(WIN32)
 #define PUBLIC __declspec(dllexport)
 #include <io.h>
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) && !defined(__MACH__)
 #define PUBLIC __attribute__ ( (visibility("default")) )
 #else
 #define PUBLIC
diff --git a/interfaces/filebuilding.h b/interfaces/filebuilding.h
index eeedc1d..35c8707 100644
--- a/interfaces/filebuilding.h
+++ b/interfaces/filebuilding.h
@@ -44,7 +44,7 @@
 
 #if (defined(WIN32) || defined(_WIN32)) && !defined(SWIG)
 #  define PUBLIC        __declspec(dllexport)
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) && !defined(__MACH__)
 #  define PUBLIC        __attribute__ ( (visibility("default")) )
 #else
 #  define PUBLIC
diff --git a/interfaces/python_interface.i b/interfaces/python_interface.i
index f1be060..c1c1a55 100644
--- a/interfaces/python_interface.i
+++ b/interfaces/python_interface.i
@@ -115,7 +115,7 @@ static void PythonMessageCallback(CSOUND *in, int attr,
     Csound *p = (Csound *) csoundGetHostData(in);
     pycbdata *pydata = (pycbdata *)p->pydata;
     PyObject *pyfunc = pydata->mfunc, *arg;
-    char *mbuf = new char[sizeof(format)*10 + 256], *ch;
+    char *mbuf = new char[sizeof(format)*10 + 256];
     vsprintf(mbuf, format, valist);
     //if(ch = strrchr(mbuf, '\n')) *ch = '\0';
    if (strlen(mbuf) > 1){
@@ -312,8 +312,9 @@ static void pythonMessageCallback(CSOUND *csound,
       }
 
     pycbdata *pydata = (pycbdata *) self->pydata;
-    if(pydata->mfunc == NULL)
+    if(pydata->mfunc == NULL) {
         if(!PyEval_ThreadsInitialized())  PyEval_InitThreads();
+    }
     else Py_XDECREF(pydata->mfunc);
         pydata->mfunc = pyfunc;
         self->SetMessageCallback(PythonMessageCallback);
@@ -323,8 +324,9 @@ static void pythonMessageCallback(CSOUND *csound,
   void SetInputValueCallback(PyObject *pyfunc){
      // thread safety mechanism
     pycbdata *pydata = (pycbdata *) self->pydata;
-    if(pydata->invalfunc == NULL)
+    if(pydata->invalfunc == NULL) {
        if(!PyEval_ThreadsInitialized()) PyEval_InitThreads();
+    }
     else Py_XDECREF(pydata->invalfunc);
         pydata->invalfunc = pyfunc;
         self->SetInputValueCallback(PythonInValueCallback);
@@ -347,8 +349,9 @@ static void pythonMessageCallback(CSOUND *csound,
   void SetExternalMidiInOpenCallback(PyObject *pyfunc){
      // thread safety mechanism
     pycbdata *pydata = (pycbdata *) self->pydata;
-    if(pydata->midiinopenfunc == NULL)
+    if(pydata->midiinopenfunc == NULL) {
         if(!PyEval_ThreadsInitialized()) PyEval_InitThreads();
+    }
     else Py_XDECREF(pydata->midiinopenfunc);
         pydata->midiinopenfunc = pyfunc;
         self->SetExternalMidiInOpenCallback(PythonMidiInOpen);
@@ -358,8 +361,9 @@ static void pythonMessageCallback(CSOUND *csound,
 void SetExternalMidiInCloseCallback(PyObject *pyfunc){
      // thread safety mechanism
     pycbdata *pydata = (pycbdata *) self->pydata;
-    if(pydata->midiinclosefunc == NULL)
+    if(pydata->midiinclosefunc == NULL) {
         if(!PyEval_ThreadsInitialized()) PyEval_InitThreads();
+    }
     else Py_XDECREF(pydata->midiinclosefunc);
         pydata->midiinopenfunc = pyfunc;
         self->SetExternalMidiInCloseCallback(PythonMidiInClose);
@@ -370,8 +374,9 @@ void SetExternalMidiInCloseCallback(PyObject *pyfunc){
 void SetExternalMidiReadCallback(PyObject *pyfunc){
      // thread safety mechanism
     pycbdata *pydata = (pycbdata *) self->pydata;
-    if(pydata->midireadfunc == NULL)
+    if(pydata->midireadfunc == NULL) {
         if(!PyEval_ThreadsInitialized()) PyEval_InitThreads();
+    }
     else Py_XDECREF(pydata->midireadfunc);
         pydata->midiinopenfunc = pyfunc;
         self->SetExternalMidiReadCallback(PythonMidiRead);
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 0000000..6e5d476
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,30 @@
+# cmake 2.8.7 has a macro GETTEXT_PROCESS_PO_FILES
+# We don't use it because it may be too new.
+function(compile_po code _infile)
+    set(_mofile "${CMAKE_CURRENT_BINARY_DIR}/${code}.mo")
+    set(_pofile "${CMAKE_CURRENT_SOURCE_DIR}/${_infile}")
+    add_custom_command(
+        TARGET "translations"
+        SOURCE ${_pofile}
+        COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} ARGS -o ${_mofile} ${_pofile}
+        OUTPUTS ${_mofile}
+        )
+    INSTALL(FILES ${_mofile}
+        DESTINATION ${LOCALE_INSTALL_DIR}/${code}/LC_MESSAGES/
+        RENAME "csound5.mo"
+        )
+    add_custom_target(${code}.mo ALL DEPENDS ${_mofile})
+    add_dependencies(translations ${code}.mo)
+endfunction(compile_po)
+
+if(USE_GETTEXT)
+    ADD_CUSTOM_TARGET(translations ALL echo "Building translations")
+    compile_po(en_US american.po)
+    compile_po(es_CO es_CO.po)
+    compile_po(fr french.po)
+    compile_po(de german.po)
+    compile_po(it italian.po)
+    compile_po(ro romanian.po)
+    compile_po(ru russian.po)
+endif()
+
diff --git a/readme-csound5-complete.txt b/readme-csound5-complete.txt
index f48d39c..688fa78 100644
--- a/readme-csound5-complete.txt
+++ b/readme-csound5-complete.txt
@@ -1,5 +1,5 @@
 CSOUND AND CSOUND VST
-Version 5.14.2
+Version 5.16
 
 A user-programmable and user-extensible sound processing language
 and software synthesizer.
diff --git a/readme-csound5.txt b/readme-csound5.txt
index ecb459d..fcfda29 100644
--- a/readme-csound5.txt
+++ b/readme-csound5.txt
@@ -1,5 +1,5 @@
 CSOUND
-Version 5.14.2
+Version 5.16
 
 A user-programmable and user-extensible sound processing language
 and software synthesizer.
diff --git a/tests/testCsoundCatalog.py b/tests/testCsoundCatalog.py
new file mode 100644
index 0000000..5d2d2b1
--- /dev/null
+++ b/tests/testCsoundCatalog.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+import os, fnmatch
+
+SRC_DIR="/Users/stevenyi/Desktop/Csound Catalog/"
+print SRC_DIR
+
+matches = []
+for root, dirnames, filenames in os.walk(SRC_DIR):
+  for filename in fnmatch.filter(filenames, '*.orc'):
+      matches.append(os.path.join(root, filename))
+
+csoundCommand = "csound -+msg_color=0 --new-parser --syntax-check-only \"%s\" \"%s\" 2> %s"
+outputFile = "/tmp/catalog-tmp.txt"
+output = ''
+
+success = 0
+fail = 0
+total = len(matches)
+
+for orc in matches:
+  ex = csoundCommand % (orc, orc[:-3] + 'sco', outputFile)
+  retVal = os.system(ex)
+  print orc, '\t', retVal
+  if retVal != 0:
+    output += "=======================\n"
+    output += "%s\t%s\n"%(orc, retVal) 
+    output += "=======================\n"
+    f = open(outputFile,'r')
+    for line in f:
+      output += line 
+    f.close()
+    output += '\n\n'
+    fail += 1
+  else:
+    success += 1
+
+f = open('catalog_results.txt', 'w')
+f.write(output)
+f.flush()
+f.close()
+
+print "\nTESTS COMPLETE:\n\tSUCCESS\t%d\n\tFAIL\t%d\n\tTOTAL\t%d"%(success, fail, total)
diff --git a/tests/testCsoundManual.py b/tests/testCsoundManual.py
new file mode 100644
index 0000000..29a066f
--- /dev/null
+++ b/tests/testCsoundManual.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+import os, fnmatch
+
+SRC_DIR="../../manual/examples/"
+print SRC_DIR
+
+matches = []
+for root, dirnames, filenames in os.walk(SRC_DIR):
+  for filename in fnmatch.filter(filenames, '*.csd'):
+      matches.append(os.path.join(root, filename))
+
+csoundCommand = "csound -+msg_color=0 --new-parser --syntax-check-only \"%s\" 2> %s"
+outputFile = "/tmp/catalog-tmp.txt"
+output = ''
+
+success = 0
+fail = 0
+total = len(matches)
+
+for csd in matches:
+  ex = csoundCommand % (csd, outputFile)
+  retVal = os.system(ex)
+  print csd, '\t', retVal
+  if retVal != 0:
+    output += "=======================\n"
+    output += "%s\t%s\n"%(csd, retVal) 
+    output += "=======================\n"
+    f = open(outputFile,'r')
+    for line in f:
+      output += line 
+    f.close()
+    output += '\n\n'
+    fail += 1
+  else:
+    success += 1
+
+f = open('manual_results.txt', 'w')
+f.write(output)
+f.flush()
+f.close()
+
+print "\nTESTS COMPLETE:\n\tSUCCESS\t%d\n\tFAIL\t%d\n\tTOTAL\t%d"%(success, fail, total)
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index 6e70043..f113aa6 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -21,6 +21,7 @@ if(BUILD_UTILITIES)
     make_utility(hetro       het_main.c)
     make_utility(lpanal      lpc_main.c)
     make_utility(lpc_export  lpcx_main.c)
+    target_link_libraries(lpc_export m)
     make_utility(lpc_import  lpci_main.c)
     make_executable(mixer-bin   mixer_main.c   "${CSOUNDLIB}" mixer)
     make_utility(pvanal      pvc_main.c)
diff --git a/util/het_import.c b/util/het_import.c
index d48e25a..67fd695 100644
--- a/util/het_import.c
+++ b/util/het_import.c
@@ -50,7 +50,7 @@ int16 getnum(FILE* inf, char *term)
     char buff[100];
     int  cc;
     int p = 0;
-    while ((cc=getc(inf))!=',' && cc!='\n') {
+    while ((cc=getc(inf))!=',' && cc!='\n' && p<99) {
         if (cc == EOF) {
             *term = '\0';
             return 0;
diff --git a/util/heti_main.c b/util/heti_main.c
index 1ac250b..06eb561 100644
--- a/util/heti_main.c
+++ b/util/heti_main.c
@@ -50,7 +50,7 @@ int16 getnum(FILE* inf, char *term)
     char buff[100];
     int  cc;
     int p = 0;
-    while ((cc=getc(inf))!=',' && cc!='\n') {
+    while ((cc=getc(inf))!=',' && cc!='\n' && p<99) {
         if (cc == EOF) {
             *term = '\0';
             return 0;
diff --git a/util/lpci_main.c b/util/lpci_main.c
index e9f49a0..23be25a 100644
--- a/util/lpci_main.c
+++ b/util/lpci_main.c
@@ -79,6 +79,10 @@ int main(int argc, char **argv)
       putc(str[i],outf);
     putc('\n', outf);
     coef = (MYFLT *)malloc((hdr.npoles+hdr.nvals)*sizeof(MYFLT));
+    if (coef==NULL) {
+      printf("memory allocation failure\n");
+      exit(1);
+    }
     for (i = 0; i<hdr.nvals; i++) {
       fread(&coef[0], sizeof(MYFLT), hdr.npoles, inf);
       for (j=0; j<hdr.npoles; j++)
diff --git a/util/pv_import.c b/util/pv_import.c
index 811fccf..4766dbf 100644
--- a/util/pv_import.c
+++ b/util/pv_import.c
@@ -45,7 +45,7 @@ static float getnum(FILE* inf, char *term)
     char buff[100];
     int  cc;
     int p = 0;
-    while ((cc=getc(inf))!=',' && cc!='\n' && cc!=EOF) buff[p++] = cc;
+    while ((cc=getc(inf))!=',' && cc!='\n' && cc!=EOF && p<99) buff[p++] = cc;
     buff[p]='\0';
     *term = cc;
     return (float)atof(buff);

-- 
csound packaging



More information about the pkg-multimedia-commits mailing list