diff -Nur gregorio-4.0.0-beta-orig/src/characters.c gregorio-4.0.0-beta/src/characters.c
--- gregorio-4.0.0-beta-orig/src/characters.c	Mon Jul 06 04:16:32 2015
+++ gregorio-4.0.0-beta/src/characters.c	Thu Aug 13 13:52:09 2015
@@ -43,7 +43,7 @@
 #include "messages.h"
 #include "vowel/vowel.h"
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_WIN32)
 #ifndef PATH_MAX
 #define PATH_MAX _MAX_PATH
 #endif
@@ -61,6 +61,8 @@
 #endif
 
 static bool read_vowel_rules(const char *const lang) {
+    int tries;
+    char **p;
     const char *language = lang;
     rulefile_parse_status status = RFPS_NOT_FOUND;
     char **filenames, *filename, *description;
@@ -117,8 +119,8 @@
     gregorio_vowel_tables_init();
     // only need to try twice
     // if it's not resolved by then, there is an alias loop
-    for (int tries = 0; tries < 2; ++tries) {
-        for (char **p = filenames; status != RFPS_FOUND && (filename = *p);
+    for (tries = 0; tries < 2; ++tries) {
+        for (p = filenames; status != RFPS_FOUND && (filename = *p);
                 ++p) {
             // read and parse the file
             gregorio_messagef("read_rules", VERBOSITY_INFO, 0,
@@ -149,7 +151,7 @@
     }
 
     // free the allocated memory
-    for (char **p = filenames; *p; ++p) {
+    for (p = filenames; *p; ++p) {
         free(*p);
     }
     free(filenames);
@@ -174,8 +176,21 @@
         // Vietnamese, Slavic, Hungarian, and Norwegian vowels which don't
         // interfere with Latin itself.  For something more accurate, the user
         // should consider the use of custom centering rules.
+#if !defined(_MSC_VER) /* maybe a bug in Visual Studio 2010 */
         gregorio_vowel_table_add("aàáâăąåAÀÁÂĂĄÅeèéêëěęEÈÉÊËĚĘiìíîIÌÍÎ"
                 "oòóôơőøOÒÓÔƠŐØuùúûưůűUÙÚÛƯŮŰyỳýYỲÝæǽÆǼœŒ");
+#else
+        gregorio_vowel_table_add(
+            "a\303\240\303\241\303\242\304\203\304\205\303\245A\303\200"
+            "\303\201\303\202\304\202\304\204\303\205e\303\250\303\251"
+            "\303\252\303\253\304\233\304\231E\303\210\303\211\303\212"
+            "\303\213\304\232\304\230i\303\254\303\255\303\256I\303\214\303\215\303\216"
+            "o\303\262\303\263\303\264\306\241\305\221\303\270O\303\222"
+            "\303\223\303\224\306\240\305\220\303\230u\303\271\303\272\303"
+            "\273\306\260\305\257\305\261U\303\231\303\232\303\233\306\257"
+            "\305\256\305\260y\341\273\263\303\275Y\341\273\262\303\235\303"
+            "\246\307\275\303\206\307\274\305\223\305\222");
+#endif
         gregorio_prefix_table_add("i");
         gregorio_prefix_table_add("I");
         gregorio_prefix_table_add("u");
diff -Nur gregorio-4.0.0-beta-orig/src/dump/dump.c gregorio-4.0.0-beta/src/dump/dump.c
--- gregorio-4.0.0-beta-orig/src/dump/dump.c	Thu Jul 30 05:43:48 2015
+++ gregorio-4.0.0-beta/src/dump/dump.c	Thu Aug 13 13:08:09 2015
@@ -16,7 +16,9 @@
  * You should have received a copy of the GNU General Public License along with 
  * this program.  If not, see <http://www.gnu.org/licenses/>. 
  */
-
+#ifdef _MSC_VER
+#include <w32snprintf.h>
+#endif
 #include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
@@ -517,6 +519,7 @@
 
 void dump_write_score(FILE *f, gregorio_score *score)
 {
+    gregorio_syllable *syllable;
     gregorio_voice_info *voice_info = score->first_voice_info;
     int i;
     int annotation_num;
@@ -635,8 +638,9 @@
             "=====================================================================\n"
             " SCORE\n"
             "=====================================================================\n");
-    for (gregorio_syllable *syllable = score->first_syllable; syllable;
+    for (syllable = score->first_syllable; syllable;
             syllable = syllable->next_syllable) {
+        gregorio_element *element;
         if (syllable->type) {
             fprintf(f, "   type                      %d (%s)\n",
                     syllable->type, dump_type(syllable->type));
@@ -677,7 +681,7 @@
         if (syllable->abovelinestext) {
             fprintf(f, "\n  Abovelinestext\n    %s", syllable->abovelinestext);
         }
-        for (gregorio_element *element = *syllable->elements; element;
+        for (element = *syllable->elements; element;
                 element = element->next) {
             fprintf(f, "---------------------------------------------------------------------\n");
             if (element->type) {
@@ -685,6 +689,7 @@
                         element->type, dump_type(element->type));
             }
             switch (element->type) {
+                gregorio_glyph *glyph;
             case GRE_CUSTO:
                 if (element->u.misc.pitched.pitch) {
                     fprintf(f, "     pitch                   %s\n",
@@ -754,7 +759,7 @@
                 }
                 break;
             case GRE_ELEMENT:
-                for (gregorio_glyph *glyph = element->u.first_glyph;
+                for (glyph = element->u.first_glyph;
                         glyph; glyph = glyph->next) {
                     fprintf(f, "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n");
                     if (glyph->type) {
@@ -812,7 +817,8 @@
                         break;
                     }
                     if (glyph->type == GRE_GLYPH) {
-                        for (gregorio_note *note = glyph->u.notes.first_note;
+                        gregorio_note *note;
+                        for (note = glyph->u.notes.first_note;
                                 note; note = note->next) {
                             fprintf(f, "-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  \n");
                             if (note->type) {
diff -Nur gregorio-4.0.0-beta-orig/src/gabc/gabc-notes-determination-l.c gregorio-4.0.0-beta/src/gabc/gabc-notes-determination-l.c
--- gregorio-4.0.0-beta-orig/src/gabc/gabc-notes-determination-l.c	Sat Aug 01 22:53:42 2015
+++ gregorio-4.0.0-beta/src/gabc/gabc-notes-determination-l.c	Thu Aug 13 13:09:11 2015
@@ -1,3 +1,6 @@
+#ifdef _MSC_VER
+#include <w32snprintf.h>
+#endif
 #line 2 "gabc/gabc-notes-determination-l.c"
 
 #line 4 "gabc/gabc-notes-determination-l.c"
diff -Nur gregorio-4.0.0-beta-orig/src/gabc/gabc-score-determination-l.c gregorio-4.0.0-beta/src/gabc/gabc-score-determination-l.c
--- gregorio-4.0.0-beta-orig/src/gabc/gabc-score-determination-l.c	Sat Aug 01 22:53:41 2015
+++ gregorio-4.0.0-beta/src/gabc/gabc-score-determination-l.c	Thu Aug 13 13:10:03 2015
@@ -1,3 +1,6 @@
+#ifdef _MSC_VER
+#include <w32snprintf.h>
+#endif
 #line 2 "gabc/gabc-score-determination-l.c"
 
 #line 4 "gabc/gabc-score-determination-l.c"
diff -Nur gregorio-4.0.0-beta-orig/src/gabc/gabc-score-determination-y.c gregorio-4.0.0-beta/src/gabc/gabc-score-determination-y.c
--- gregorio-4.0.0-beta-orig/src/gabc/gabc-score-determination-y.c	Sat Aug 01 22:53:41 2015
+++ gregorio-4.0.0-beta/src/gabc/gabc-score-determination-y.c	Thu Aug 13 13:10:38 2015
@@ -39,7 +39,9 @@
    There are some unavoidable exceptions within include files to
    define necessary library symbols; they are noted "INFRINGES ON
    USER NAME SPACE" below.  */
-
+#ifdef _MSC_VER
+#include <w32snprintf.h>
+#endif
 /* Identify Bison output.  */
 #define YYBISON 1
 
diff -Nur gregorio-4.0.0-beta-orig/src/gabc/gabc.h gregorio-4.0.0-beta/src/gabc/gabc.h
--- gregorio-4.0.0-beta-orig/src/gabc/gabc.h	Mon Jul 06 06:27:56 2015
+++ gregorio-4.0.0-beta/src/gabc/gabc.h	Mon Aug 03 08:12:43 2015
@@ -53,12 +53,12 @@
     // Source_file::get_counts
 
     // possible future enhancement: make the tabstop size configurable
-
+    size_t i;
     loc->first_line = loc->last_line;
     loc->first_column = loc->last_column;
     loc->first_offset = loc->last_offset;
 
-    for (size_t i = 0; i < length; ++i) {
+    for (i = 0; i < length; ++i) {
         if (bytes[i] == '\n') {
             ++loc->last_line;
             loc->last_column = 0;
diff -Nur gregorio-4.0.0-beta-orig/src/gregorio-utils.c gregorio-4.0.0-beta/src/gregorio-utils.c
--- gregorio-4.0.0-beta-orig/src/gregorio-utils.c	Mon Jul 06 06:27:56 2015
+++ gregorio-4.0.0-beta/src/gregorio-utils.c	Thu Aug 13 13:58:32 2015
@@ -21,8 +21,10 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
+#if !defined(_MSC_VER)
 #include <getopt.h>
 #include <libgen.h>             /* for basename */
+#endif
 #include <string.h>             /* for strcmp */
 #include <locale.h>
 #include <limits.h>
@@ -55,7 +57,7 @@
 #define DEFAULT_OUTPUT_FORMAT   GTEX
 
 // realpath is not in mingw32
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_WIN32)
 #ifndef PATH_MAX
 #define PATH_MAX _MAX_PATH
 #endif
@@ -68,7 +70,7 @@
     char *file_name;
     char temp_name[PATH_MAX];
     char *base_name;
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_WIN32)
     char *last_backslash;
 #endif
 
@@ -76,7 +78,7 @@
 
     strcpy(temp_name, string);
     base_name = strrchr(temp_name, '/');
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_WIN32)
     last_backslash = strrchr(temp_name, '\\');
     if (last_backslash > base_name) {
         base_name = last_backslash;
@@ -222,6 +224,7 @@
 
 static char *encode_point_and_click_filename(char *input_file_name)
 {
+    char *p;
     // percent-encoding favors capital hex digits
     static const char *const hex = "0123456789ABCDEF";
     char filename[PATH_MAX], *result = NULL, *r = NULL;
@@ -234,12 +237,12 @@
     // 2 extra characters for a possible leading slash and final NUL
     r = result = malloc((strlen(filename) * 4 + 2) * sizeof(char));
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_WIN32)
     *(r++) = '/';
 #endif
 
-    for (char *p = filename; *p; ++p) {
-#ifdef __MINGW32__
+    for (p = filename; *p; ++p) {
+#if defined(__MINGW32__) || defined(_WIN32)
         if (*p == '\\') {
             *p = '/';
         }
@@ -249,7 +252,7 @@
         // because they cause trouble in TeX; we will percent-encode them
         if ((*p >= 'A' && *p <= 'Z') || (*p >= 'a' && *p < 'z')
                 || (*p >= '0' && *p <= '9') || *p == '.' || *p == '/'
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_WIN32)
                 || *p == ':'
 #endif
                 ) {
@@ -275,9 +278,6 @@
         "Copyright (C) 2006-2015 Gregorio project authors (see CONTRIBUTORS.md)";
     int c;
 
-    #ifdef USE_KPSE
-        kpse_set_program_name("gregorio", "gregorio");
-    #endif
     char *input_file_name = NULL;
     char *output_file_name = NULL;
     char *output_basename = NULL;
@@ -307,7 +307,9 @@
         {"point-and-click", 0, 0, 'p'},
     };
     gregorio_score *score = NULL;
-
+    #ifdef USE_KPSE
+        kpse_set_program_name(argv[0], "gregorio");
+    #endif
     if (argc == 1) {
         print_usage(argv[0]);
         exit(0);
@@ -535,7 +537,7 @@
                 exit(-1);
             }
         #endif
-        output_file = fopen(output_file_name, "w");
+        output_file = fopen(output_file_name, "wb");
         if (!output_file) {
             fprintf(stderr, "error: can't write in file %s",
                     output_file_name);
@@ -556,7 +558,11 @@
                     input_file_name);
             exit(-1);
         }
+#ifdef USE_KPSE
+        gregorio_set_file_name(xbasename(input_file_name));
+#else
         gregorio_set_file_name(basename(input_file_name));
+#endif
         if (point_and_click) {
             point_and_click_filename = encode_point_and_click_filename(
                     input_file_name);
@@ -567,7 +573,7 @@
         error_file = stderr;
         gregorio_set_error_out(error_file);
     } else {
-        error_file = fopen(error_file_name, "w");
+        error_file = fopen(error_file_name, "wb");
         if (!error_file) {
             fprintf(stderr, "error: can't open file %s for writing\n",
                     error_file_name);
diff -Nur gregorio-4.0.0-beta-orig/src/gregoriotex/gregoriotex-position.c gregorio-4.0.0-beta/src/gregoriotex/gregoriotex-position.c
--- gregorio-4.0.0-beta-orig/src/gregoriotex/gregoriotex-position.c	Thu Jul 30 05:43:48 2015
+++ gregorio-4.0.0-beta/src/gregoriotex/gregoriotex-position.c	Mon Aug 03 21:16:14 2015
@@ -1173,6 +1173,40 @@
 
 void gregoriotex_compute_positioning(const gregorio_element *element)
 {
+#if defined(_MSC_VER)
+    height_computation above = {
+        VPOS_ABOVE,
+        &is_h_episemus_above_applicable,
+        &gtex_is_h_episemus_above_shown,
+        &is_h_episemus_above_connected,
+        &get_h_episemus_above_size,
+        &is_h_episemus_above_better_height,
+        &gregorio_position_h_episemus_above,
+        false,
+        0,
+        false,
+        NULL,
+        NULL,
+        NULL,
+        NULL,
+    };
+    height_computation below = {
+        VPOS_BELOW,
+        &is_h_episemus_below_applicable,
+        &gtex_is_h_episemus_below_shown,
+        &is_h_episemus_below_connected,
+        &get_h_episemus_below_size,
+        &is_h_episemus_below_better_height,
+        &gregorio_position_h_episemus_below,
+        false,
+        0,
+        false,
+        NULL,
+        NULL,
+        NULL,
+        NULL,
+    };
+#else
     height_computation above = {
         .vpos = VPOS_ABOVE,
         .is_applicable = &is_h_episemus_above_applicable,
@@ -1207,19 +1241,22 @@
         .start_note = NULL,
         .last_connected_note = NULL,
     };
+#endif
     int i;
     gtex_alignment ignored;
     gtex_type type;
 
     for (; element; element = element->next) {
         if (element->type == GRE_ELEMENT) {
-            for (const gregorio_glyph *glyph = element->u.first_glyph; glyph;
+            const gregorio_glyph *glyph;
+            for (glyph = element->u.first_glyph; glyph;
                     glyph = glyph->next) {
                 if (glyph->type == GRE_GLYPH) {
+                    gregorio_note *note;
                     i = 0;
                     gregoriotex_determine_glyph_name(glyph, element, &ignored,
                             &type);
-                    for (gregorio_note *note = glyph->u.notes.first_note; note;
+                    for (note = glyph->u.notes.first_note; note;
                             note = note->next) {
                         if (note->type == GRE_NOTE) {
                             compute_note_positioning(&above, &below, element,
diff -Nur gregorio-4.0.0-beta-orig/src/gregoriotex/gregoriotex-write.c gregorio-4.0.0-beta/src/gregoriotex/gregoriotex-write.c
--- gregorio-4.0.0-beta-orig/src/gregoriotex/gregoriotex-write.c	Thu Jul 30 05:43:48 2015
+++ gregorio-4.0.0-beta/src/gregoriotex/gregoriotex-write.c	Thu Aug 13 14:10:16 2015
@@ -20,7 +20,9 @@
  * @file
  * @brief The plugin which writes a GregorioTeX score.
  */
-
+#ifdef _MSC_VER
+#include "w32snprintf.h"
+#endif
 #include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
@@ -916,7 +918,11 @@
         fprintf(f, "\\'\\ae{}");
         return;
     }
+#if defined(_MSC_VER) /* maybe a bug in Visual Studio 2010 */
+    if (!gregorio_wcsbufcmp(special_char, "'\305\223")) {
+#else
     if (!gregorio_wcsbufcmp(special_char, "'œ")) {
+#endif
         fprintf(f, "\\'\\oe{}");
         return;
     }
@@ -2106,6 +2112,7 @@
         gregoriotex_status *const status)
 {
     // i is the number of the note for which we are typesetting the sign.
+    bool found;
     int i;
     gregorio_note *current_note;
     // a dumb char
@@ -2135,7 +2142,7 @@
         }
     }
     fprintf(f, "}{");
-    bool found = false;
+    found = false;
     // now a first loop for the choral signs, because high signs must be taken
     // into account before any hepisemus
     for (current_note = note, i = 1; current_note;
@@ -2461,7 +2468,8 @@
         gregorio_element *element, gregoriotex_status *status)
 {
     if (element->type == GRE_ELEMENT) {
-        for (gregorio_glyph *glyph = element->u.first_glyph; glyph;
+        gregorio_glyph *glyph;
+        for (glyph = element->u.first_glyph; glyph;
                 glyph = glyph->next) {
             switch (glyph->type) {
             case GRE_SPACE:
@@ -2594,11 +2602,13 @@
 
 static void handle_final_bar(FILE *f, char *type, gregorio_syllable *syllable)
 {
+    gregorio_element *element;
     fprintf(f, "\\GreFinal%s{%%\n", type);
     // first element will be the bar, which we just handled, so skip it
-    for (gregorio_element *element = (*syllable->elements)->next; element;
+    for (element = (*syllable->elements)->next; element;
             element = element->next) {
         switch (element->type) {
+            gregorio_glyph *glyph;
         case GRE_TEXVERB_ELEMENT:
             if (element->texverb) {
                 fprintf(f, "%% verbatim text at element level:\n%s%%\n"
@@ -2607,7 +2617,7 @@
             break;
 
         case GRE_ELEMENT:
-            for (gregorio_glyph *glyph = element->u.first_glyph; glyph;
+            for (glyph = element->u.first_glyph; glyph;
                     glyph = glyph->next) {
                 if (glyph->type == GRE_MANUAL_CUSTOS) {
                     fprintf(f, "\\GreManualCusto{%d}%%\n",
@@ -2672,6 +2682,7 @@
     }
 
     assert(false); // should never reach here
+    return false;
 }
 
 static inline void write_syllable_point_and_click(FILE *const f,
@@ -2701,6 +2712,7 @@
         bool * first_syllable, unsigned char *line_number,
         unsigned char first_of_disc, gregoriotex_status *const status)
 {
+    gregorio_element *element;
     gregorio_element *clef_change_element = NULL;
     if (!syllable) {
         return;
@@ -2828,7 +2840,7 @@
     }
     fprintf(f, "}{%%\n");
 
-    for (gregorio_element *element = *syllable->elements; element;
+    for (element = *syllable->elements; element;
             element = element->next) {
         if (element->nabc_lines && element->nabc) {
             size_t i;
@@ -3021,13 +3033,14 @@
 
 static char *digest_to_hex(const unsigned char digest[SHA1_DIGEST_SIZE])
 {
+    int i;
     static const char *const hex = "0123456789abcdef";
     static char result[41];
 
     char *p = result;
     unsigned char byte;
 
-    for (int i = 0; i < SHA1_DIGEST_SIZE; ++i) {
+    for (i = 0; i < SHA1_DIGEST_SIZE; ++i) {
         byte = digest[i];
 
         *(p++) = hex[(byte >> 4) & 0x0FU];
@@ -3042,11 +3055,13 @@
 static void initialize_score(gregoriotex_status *const status,
         gregorio_score *score, const bool point_and_click)
 {
+    int voice;
+    gregorio_syllable *syllable;
     status->bottom_line = false;
     status->top_height = status->bottom_height = UNDETERMINED_HEIGHT;
     status->abovelinestext = status->translation = false;
 
-    for (gregorio_syllable *syllable = score->first_syllable; syllable;
+    for (syllable = score->first_syllable; syllable;
             syllable = syllable->next_syllable) {
         if (syllable->translation) {
             status->translation = true;
@@ -3056,17 +3071,19 @@
             status->abovelinestext = true;
         }
 
-        for (int voice = 0; voice < score->number_of_voices; ++voice) {
+        for (voice = 0; voice < score->number_of_voices; ++voice) {
+            gregorio_element *element;
             gregoriotex_compute_positioning(syllable->elements[voice]);
-            for (gregorio_element *element = syllable->elements[voice]; element;
+            for (element = syllable->elements[voice]; element;
                     element = element->next) {
                 switch (element->type) {
+                    gregorio_glyph *glyph;
                 case GRE_ALT:
                     status->abovelinestext = true;
                     break;
 
                 case GRE_ELEMENT:
-                    for (gregorio_glyph *glyph = element->u.first_glyph; glyph;
+                    for (glyph = element->u.first_glyph; glyph;
                             glyph = glyph->next) {
                         if (glyph->type == GRE_GLYPH) {
                             compute_height_extrema(glyph,
diff -Nur gregorio-4.0.0-beta-orig/src/mscinclude/stdbool.h gregorio-4.0.0-beta/src/mscinclude/stdbool.h
--- gregorio-4.0.0-beta-orig/src/mscinclude/stdbool.h	Thu Jan 01 09:00:00 1970
+++ gregorio-4.0.0-beta/src/mscinclude/stdbool.h	Mon Aug 03 06:59:25 2015
@@ -0,0 +1,6 @@
+#ifndef STDBOOL_H
+#define STDBOOL_H
+typedef int bool;
+#define true 1
+#define false 0
+#endif
diff -Nur gregorio-4.0.0-beta-orig/src/mscinclude/w32snprintf.h gregorio-4.0.0-beta/src/mscinclude/w32snprintf.h
--- gregorio-4.0.0-beta-orig/src/mscinclude/w32snprintf.h	Thu Jan 01 09:00:00 1970
+++ gregorio-4.0.0-beta/src/mscinclude/w32snprintf.h	Mon Aug 03 09:14:49 2015
@@ -0,0 +1,41 @@
+#ifndef W32SNPRINTF_H
+#define W32SNPRINTF_H
+
+#ifdef WIN32
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stdio.h>
+#include <stdarg.h>
+#undef snprintf
+#undef vsnprintf
+
+static __inline int
+kpse_vsnprintf (char *str, size_t size, const char *format, va_list ap)
+{
+  int ret = _vsnprintf (str, size, format, ap);
+  if (size > 0 && (unsigned)ret >= (unsigned)size)
+    str [size - 1] = '\0';
+  return ret;
+}
+
+static __inline int
+kpse_snprintf (char *str, size_t size, const char *format, ...)
+{
+  int ret;
+  va_list ap;
+
+  va_start (ap, format);
+  ret = kpse_vsnprintf (str, size, format, ap);
+  va_end (ap);
+  return ret;
+}
+
+#define snprintf kpse_snprintf
+#define vsnprintf kpse_vsnprintf
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif
diff -Nur gregorio-4.0.0-beta-orig/src/struct.c gregorio-4.0.0-beta/src/struct.c
--- gregorio-4.0.0-beta-orig/src/struct.c	Thu Jul 30 05:43:48 2015
+++ gregorio-4.0.0-beta/src/struct.c	Thu Aug 13 13:07:21 2015
@@ -36,7 +36,9 @@
  * All the delete functions are recursive and free all memory.
  *
  */
-
+#ifdef _MSC_VER
+#include <w32snprintf.h>
+#endif
 #include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
diff -Nur gregorio-4.0.0-beta-orig/src/vowel/vowel.c gregorio-4.0.0-beta/src/vowel/vowel.c
--- gregorio-4.0.0-beta-orig/src/vowel/vowel.c	Mon Jul 06 04:16:32 2015
+++ gregorio-4.0.0-beta/src/vowel/vowel.c	Mon Aug 03 21:09:29 2015
@@ -65,8 +65,9 @@
 
 static inline void character_set_next_elements_free(character_set *const set)
 {
+    unsigned int i;
     assert(set && set->next);
-    for (unsigned int i = 0; i < set->bins; ++i) {
+    for (i = 0; i < set->bins; ++i) {
         if (set->next[i]) {
             character_set_free(set->next[i]);
         }
@@ -88,12 +89,13 @@
 static bool character_set_contains(character_set *const set,
         const grewchar vowel, character_set **const next)
 {
+    unsigned int index;
     assert(set);
 
     if (next) {
         *next = NULL;
     }
-    for (unsigned int index = ((unsigned long)vowel) & set->mask;
+    for (index = ((unsigned long)vowel) & set->mask;
             set->table[index]; index = (index + 1) & set->mask) {
         if (set->table[index] == vowel) {
             if (next && set->next) {
@@ -124,6 +126,7 @@
 }
 
 static inline void character_set_grow(character_set *const set) {
+    unsigned int i;
     static grewchar *old_table;
     static character_set **old_next;
     unsigned int old_bins;
@@ -146,7 +149,7 @@
     if (old_next) {
         set->table = calloc(set->bins, sizeof(character_set *));
     }
-    for (unsigned int i = 0; i < old_bins; ++i) {
+    for (i = 0; i < old_bins; ++i) {
         if (old_table[i]) {
             character_set_put(set, old_table[i], old_next ? old_next[i] : NULL);
         } else {
@@ -288,8 +291,9 @@
 void gregorio_vowel_table_add(const char *vowels)
 {
     if (vowels) {
+        grewchar *p;
         grewchar *str = gregorio_build_grewchar_string_from_buf(vowels);
-        for (grewchar *p = str; *p; ++p) {
+        for (p = str; *p; ++p) {
             character_set_add(vowel_table, *p);
         }
         free(str);

