diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-12-09 22:20:21 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-12-09 22:20:21 +0000 |
commit | fbfb4e16cc7761a5aefcae7cacf662fec7092c92 (patch) | |
tree | 0a1f90f31434d7c8fc766c97df33cb3e2456ef75 /Build/source/texk/gregorio/gregorio-src/src | |
parent | b4c906f1397a603ffc06957cb835ddd687c8fe2b (diff) |
Import Gregorio-4.0.0.
git-svn-id: svn://tug.org/texlive/trunk@39063 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/gregorio/gregorio-src/src')
46 files changed, 37382 insertions, 0 deletions
diff --git a/Build/source/texk/gregorio/gregorio-src/src/Makefile.am b/Build/source/texk/gregorio/gregorio-src/src/Makefile.am new file mode 100644 index 00000000000..e2424dcbec7 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/Makefile.am @@ -0,0 +1,147 @@ +# Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) +# +# This file is part of Gregorio. +# +# Gregorio is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Gregorio 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + +AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/gabc -I$(top_srcdir)/src/dump -I$(top_srcdir)/src/gregoriotex +AM_CFLAGS = + +gregorio_CFLAGS = $(KPSE_CFLAGS) +gregorio_LDADD = $(KPSE_LIBS) + +bin_PROGRAMS = gregorio +gregorio_SOURCES = gregorio-utils.c characters.c characters.h \ + messages.c messages.h struct.c struct.h \ + unicode.c unicode.h sha1.c sha1.h support.c support.h \ + config.h bool.h plugins.h utf8strings.h dump/dump.c \ + gregoriotex/gregoriotex-write.c \ + gregoriotex/gregoriotex-position.c \ + gregoriotex/gregoriotex.h + +@MK@ifneq ($(wildcard ../.git),) +@MK@ _tag_ = $(shell git describe --exact-match HEAD 2>/dev/null) +@MK@ ifeq ($(_tag_),) +@MK@ DEFS += -DBRANCH_VERSION='"$(shell git rev-parse --abbrev-ref HEAD)-$(shell git rev-parse --short HEAD)-$(shell git rev-list HEAD --count)"' +@MK@ endif +@MK@else +@MK@ ifneq ($(wildcard ../.hg/git),) +@MK@ _gitnode_ = $(shell hg log --template='{gitnode}' -r .) +@MK@ _tag_ = $(shell git --git-dir=../.hg/git describe --exact-match $(_gitnode_) 2>/dev/null) +@MK@ ifeq ($(_tag_),) +@MK@ DEFS += -DBRANCH_VERSION='"$(shell cat ../.hg/bookmarks.current)-$(shell git --git-dir=../.hg/git rev-parse --short '$(_gitnode_)')-$(shell git --git-dir=../.hg/git rev-list '$(_gitnode_)' --count)"' +@MK@ endif +@MK@ endif +@MK@endif + +# gabc files +gregorio_SOURCES += gabc/gabc-elements-determination.c gabc/gabc-write.c \ + gabc/gabc-glyphs-determination.c gabc/gabc.h \ + gabc/gabc-score-determination.h \ + gabc/gabc-score-determination-y.h \ + gabc/gabc-score-determination-y.c \ + gabc/gabc-score-determination-l.h \ + gabc/gabc-score-determination-l.c \ + gabc/gabc-notes-determination-l.c \ + vowel/vowel.h vowel/vowel.c vowel/vowel-rules.h \ + vowel/vowel-rules-l.h vowel/vowel-rules-l.c \ + vowel/vowel-rules-y.h vowel/vowel-rules-y.c + +EXTRA_DIST = encode_utf8strings.c utf8strings.h.in utf8strings.h \ + gabc/gabc-notes-determination.l \ + gabc/gabc-notes-determination-l.c \ + gabc/gabc-score-determination.h \ + gabc/gabc-score-determination.y \ + gabc/gabc-score-determination-y.h \ + gabc/gabc-score-determination-y.c \ + gabc/gabc-score-determination.l \ + gabc/gabc-score-determination-l.h \ + gabc/gabc-score-determination-l.c \ + vowel/vowel-rules.l \ + vowel/vowel-rules-l.h vowel/vowel-rules-l.c \ + vowel/vowel-rules.y \ + vowel/vowel-rules-y.h vowel/vowel-rules-y.c + +if HAVE_RC +# Windows resources (see windows/README.md) +gregorio-resources.o: ../windows/gregorio-resources.rc ../windows/gregorio.ico + $(RC) $(RCFLAGS) $< -o $@ + +gregorio_SOURCES += ../windows/gregorio-resources.rc ../windows/gregorio.ico +gregorio_LDADD += gregorio-resources.o +endif + +gabc/gabc-score-determination-y.c: gabc/gabc-score-determination.y + $(YACC) -d -p "gabc_score_determination_" -o $@ $< +gabc/gabc-score-determination-y.h: gabc/gabc-score-determination-y.c + ## Recover from the removal of gabc/gabc-score-determination-y.h, see + ## https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html + @if test -f $@; then :; else \ + rm -f gabc/gabc-score-determination-y.c; \ + $(MAKE) $(AM_MAKEFLAGS) gabc/gabc-score-determination-y.c; \ + fi + +gabc/gabc-score-determination-l.c: gabc/gabc-score-determination.l + $(LEX) -o $@ --header-file=gabc/gabc-score-determination-l.h $< +gabc/gabc-score-determination-l.h: gabc/gabc-score-determination-l.c + ## Recover from the removal of gabc/gabc-score-determination-l.h, see + ## https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html + @if test -f $@; then :; else \ + rm -f gabc/gabc-score-determination-l.c; \ + $(MAKE) $(AM_MAKEFLAGS) gabc/gabc-score-determination-l.c; \ + fi + +gabc/gabc-notes-determination-l.c: gabc/gabc-notes-determination.l + $(LEX) -o $@ $< + +vowel/vowel-rules-y.c: vowel/vowel-rules.y + $(YACC) -d -o $@ $< +vowel/vowel-rules-y.h: vowel/vowel-rules-y.c + ## Recover from the removal of vowel/vowel-rules-y.h, see + ## https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html + @if test -f $@; then :; else \ + rm -f vowel/vowel-rules-y.c; \ + $(MAKE) $(AM_MAKEFLAGS) vowel/vowel-rules-y.c; \ + fi + +vowel/vowel-rules-l.c: vowel/vowel-rules.l + $(LEX) -o $@ --header-file=vowel/vowel-rules-l.h $< +vowel/vowel-rules-l.h: vowel/vowel-rules-l.c + ## Recover from the removal of vowel/vowel-rules-l.h, see + ## https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html + @if test -f $@; then :; else \ + rm -f vowel/vowel-rules-l.c; \ + $(MAKE) $(AM_MAKEFLAGS) vowel/vowel-rules-l.c; \ + fi + +utf8strings.h: utf8strings.h.in + $(MAKE) $(AM_MAKEFLAGS) encode_utf8strings${EXEEXT} + ./encode_utf8strings${EXEEXT} $< $@ + +encode_utf8strings${EXEEXT}: encode_utf8strings.c + $(CC) -o $@ $< + +BUILT_SOURCES = utf8strings.h \ + gabc/gabc-notes-determination-l.c \ + gabc/gabc-score-determination-l.c \ + gabc/gabc-score-determination-l.h \ + gabc/gabc-score-determination-y.c \ + gabc/gabc-score-determination-y.h \ + vowel/vowel-rules-l.c \ + vowel/vowel-rules-l.h \ + vowel/vowel-rules-y.c \ + vowel/vowel-rules-y.h + +CLEANFILES = encode_utf8strings${EXEEXT} +MAINTAINERCLEANFILES = $(BUILT_SOURCES) diff --git a/Build/source/texk/gregorio/gregorio-src/src/bool.h b/Build/source/texk/gregorio/gregorio-src/src/bool.h new file mode 100644 index 00000000000..d40d0b4412c --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/bool.h @@ -0,0 +1,30 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header provides a minimum of C11-like bool functionality. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef BOOL_H +#define BOOL_H + +typedef unsigned int bool; +#define true 1 +#define false 0 + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/characters.c b/Build/source/texk/gregorio/gregorio-src/src/characters.c new file mode 100644 index 00000000000..7cf856985b6 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/characters.c @@ -0,0 +1,1399 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX. + * This file contains functions that deal with lyrics and styles. + * + * Copyright (C) 2008-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +/** + * @file + * @brief This file contains almost all the gregorio_character manipulation things. + * + * @warning The code is very spaghetti, but I don't really think I can do it another way with the chosen representation of styles, and the fact that everything must be xml-compliant and tex-compliant... + * So this file is basically very hard to maintain. Moreover, it has not been very well coded, so it is even harder to maintain... + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> +#include <limits.h> +#include <sys/stat.h> +#include <assert.h> +#ifdef USE_KPSE + #include <kpathsea/kpathsea.h> +#endif +#include "bool.h" +#include "struct.h" +#include "unicode.h" +#include "characters.h" +#include "messages.h" +#include "support.h" +#include "utf8strings.h" +#include "vowel/vowel.h" + +#ifdef _WIN32 +#ifndef PATH_MAX +#define PATH_MAX _MAX_PATH +#endif +#endif + +#define VOWEL_FILE "gregorio-vowels.dat" + +#ifndef USE_KPSE +static __inline void rtrim(char *buf) +{ + char *p; + for (p = buf + strlen(buf) - 1; p >= buf && isspace(*p); --p) { + *p = '\0'; + } +} +#endif + +static bool read_vowel_rules(char *const lang) { + char *language = lang; + rulefile_parse_status status = RFPS_NOT_FOUND; + char **filenames, *filename, **p; + const char *description; + int tries; + +#ifdef USE_KPSE + filenames = kpse_find_file_generic(VOWEL_FILE, kpse_tex_format, true, true); + if (!filenames) { + if (strcmp(language, "Latin") != 0) { + gregorio_messagef("read_patterns", VERBOSITY_WARNING, 0, + _("kpse_find_file_generic cannot find %s"), VOWEL_FILE); + } + return false; + } +#else + FILE *file; + char buf[PATH_MAX]; + size_t capacity = 16, size = 0; + + filenames = gregorio_malloc(capacity * sizeof(char *)); + + file = popen("kpsewhich " VOWEL_FILE, "r"); + if (!file) { + gregorio_messagef("read_patterns", VERBOSITY_WARNING, 0, + _("unable to run kpsewhich %s: %s"), VOWEL_FILE, + strerror(errno)); + return false; + } + while (!feof(file) && !ferror(file) && fgets(buf, PATH_MAX, file)) { + rtrim(buf); + if (strlen(buf) > 0) { + filenames[size++] = gregorio_strdup(buf); + if (size >= capacity) { + capacity <<= 1; + filenames = gregorio_realloc(filenames, + capacity * sizeof(char *)); + } + } else { + gregorio_messagef("read_patterns", VERBOSITY_WARNING, 0, + _("kpsewhich returned bad value for %s"), VOWEL_FILE); + } + } + filenames[size] = NULL; + pclose(file); +#endif + + gregorio_vowel_tables_init(); + /* only need to try twice; if it's not resolved by then, there is an alias + * loop */ + 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, + _("Looking for %s in %s"), language, filename); + gregorio_vowel_tables_load(filename, &language, &status); + switch (status) { + case RFPS_FOUND: + description = "Found"; + break; + case RFPS_ALIASED: + description = "Aliased to"; + break; + default: + description = "Could not find"; + break; + } + gregorio_messagef("read_rules", VERBOSITY_INFO, 0, _("%s %s in %s"), + description, language, filename); + } + if (status != RFPS_ALIASED) { + /* if it's not aliased, there's no reason to scan again */ + break; + } + } + if (status == RFPS_ALIASED) { + gregorio_messagef("read_rules", VERBOSITY_WARNING, 0, + _("Unable to resolve alias for %s"), lang); + } + + /* free the allocated memory */ + for (p = filenames; *p; ++p) { + free(*p); + } + free(filenames); + if (language != lang) { + free(language); + } + + return status == RFPS_FOUND; +} + +void gregorio_set_centering_language(char *const language) +{ + if (!read_vowel_rules(language)) { + if (strcmp(language, "Latin") != 0) { + gregorio_messagef("gregorio_set_centering_language", + VERBOSITY_WARNING, 0, _("unable to read vowel files for " + "%s; defaulting to Latin rules"), language); + } + + gregorio_vowel_tables_init(); + gregorio_vowel_table_add(DEFAULT_VOWELS); + gregorio_prefix_table_add("i"); + gregorio_prefix_table_add("I"); + gregorio_prefix_table_add("u"); + gregorio_prefix_table_add("U"); + } +} + +static __inline gregorio_character *skip_verbatim_or_special( + gregorio_character *ch) +{ + /* skip past verbatim and special characters */ + if (ch->cos.s.type == ST_T_BEGIN && (ch->cos.s.style == ST_VERBATIM + || ch->cos.s.style == ST_SPECIAL_CHAR)) { + if (ch->next_character) { + ch = ch->next_character; + } + while (ch->next_character && ch->is_character) { + ch = ch->next_character; + } + } + return ch; +} + +static void determine_center(gregorio_character *character, int *start, + int *end) { + int count; + grewchar *subject; + gregorio_character *ch; + + *start = *end = -1; + + for (count = 0, ch = character; ch; ch = ch->next_character) { + if (ch->is_character) { + ++count; + } else { + ch = skip_verbatim_or_special(ch); + } + } + if (count == 0) { + return; + } + subject = (grewchar *)gregorio_malloc((count + 1) * sizeof(grewchar)); + for (count = 0, ch = character; ch; ch = ch->next_character) { + if (ch->is_character) { + subject[count ++] = ch->cos.character; + } else { + ch = skip_verbatim_or_special(ch); + } + } + subject[count] = (grewchar)0; + + gregorio_find_vowel_group(subject, start, end); + + free(subject); +} + +static bool go_to_end_initial(gregorio_character **param_character) +{ + bool has_initial = false; + gregorio_character *current_character = *param_character; + if (!current_character) { + return false; + } + gregorio_go_to_first_character(¤t_character); + /* skip past any initial */ + if (!current_character->is_character + && current_character->cos.s.type == ST_T_BEGIN + && current_character->cos.s.style == ST_INITIAL) { + has_initial = true; + while (current_character) { + if (!current_character->is_character + && current_character->cos.s.type == ST_T_END + && current_character->cos.s.style == ST_INITIAL) { + break; + } + current_character = current_character->next_character; + } + } + (*param_character) = current_character; + return has_initial; +} + +/* + * The push function pushes a style in the stack, and updates first_style to + * this element. + */ + +static void style_push(det_style **current_style, unsigned char style) +{ + det_style *element; + if (!current_style) { + return; + } + element = (det_style *) gregorio_malloc(sizeof(det_style)); + element->style = style; + element->previous_style = NULL; + element->next_style = (*current_style); + if (*current_style) { + (*current_style)->previous_style = element; + } + (*current_style) = element; +} + +/* + * Pop deletes an style in the stack (the style to delete is the parameter) + */ + +static void style_pop(det_style **first_style, det_style *element) +{ + if (!element || !first_style || !*first_style) { + return; + } + if (element->previous_style) { + element->previous_style->next_style = element->next_style; + if (element->next_style) { + element->next_style->previous_style = element->previous_style; + } + } else { + if (element->next_style) { + element->next_style->previous_style = NULL; + (*first_style) = element->next_style; + } else { + (*first_style) = NULL; + } + } + free(element); +} + +/* + * free_styles just free the stack. You may notice that it will never be used + * in a normal functionment. But we never know... + */ + +static void free_styles(det_style **first_style) +{ + det_style *current_style; + if (!first_style) { + return; + } + current_style = (*first_style); + while (current_style) { + current_style = current_style->next_style; + free((*first_style)); + (*first_style) = current_style; + } +} + + +/* + * inline function that will be used for verbatim and special-characters in the + * + * next function, it calls function with a grewchar * which is the verbatim or + * special-character. It places current_character to the character next to the + * end of the verbatim or special_char charachters. + */ +static __inline void verb_or_sp(gregorio_character **ptr_character, + const grestyle_style style, FILE *const f, + void (*const function) (FILE *, grewchar *)) +{ + int i, j; + grewchar *text; + gregorio_character *current_character; + gregorio_character *begin_character; + + i = 0; + j = 0; + + current_character = (*ptr_character)->next_character; + begin_character = current_character; + while (current_character) { + if (current_character->cos.s.type == ST_T_END + && current_character->cos.s.style == style) { + break; + } else { + if (current_character->is_character) { + i++; + } + current_character = current_character->next_character; + } + } + if (i == 0) { + ptr_character = ¤t_character; + return; + } + text = (grewchar *) gregorio_malloc((i + 1) * sizeof(grewchar)); + current_character = begin_character; + while (j < i) { + if (current_character->is_character) { + text[j] = current_character->cos.character; + current_character = current_character->next_character; + j++; + } else { + current_character = current_character->next_character; + } + } + text[i] = 0; + function(f, text); + free(text); + + *ptr_character = current_character; +} + +/** + * This function is made to simplify the output modules : they just have to + * declare some simple functions (what to do when meeting a beginning of style, + * a character, etc.) and to call this function with pointer to these + * functions, and that will automatically write the good ouput. This function + * does not test at all the gregorio_character list, if it is wrong, then the + * ouput will be wrong. It is very simple to understand, even if it is a bit + * long. + * + * @warning The difficulty comes when we have to write the first syllable text, + * without the first letter. + * The behaviour can have some bugs in this case if the first syllable has some + * complex styles. It would be a bit stupid to do such a thing, but users are + * usually very creative when it comes to inventing twisted things... + */ +void gregorio_write_text(const bool skip_initial, + gregorio_character *current_character, + FILE *const f, void (*const printverb) (FILE *, grewchar *), + void (*const printchar) (FILE *, grewchar), + void (*const begin) (FILE *, grestyle_style), + void (*const end) (FILE *, grestyle_style), + void (*const printspchar) (FILE *, grewchar *)) +{ + if (current_character == NULL) { + return; + } + while (current_character) { + if (current_character->is_character) { + printchar(f, current_character->cos.character); + } else { + if (current_character->cos.s.type == ST_T_BEGIN) { + switch (current_character->cos.s.style) { + case ST_VERBATIM: + verb_or_sp(¤t_character, ST_VERBATIM, f, printverb); + break; + case ST_SPECIAL_CHAR: + verb_or_sp(¤t_character, ST_SPECIAL_CHAR, f, + printspchar); + break; + case ST_INITIAL: + if (skip_initial) { + while (current_character) { + if (!current_character->is_character + && current_character->cos.s.type == ST_T_END + && current_character->cos.s.style == + ST_INITIAL) { + break; + } + current_character = + current_character->next_character; + } + } else { + begin(f, ST_INITIAL); + } + break; + default: + begin(f, current_character->cos.s.style); + break; + } + } else { /* ST_T_END */ + end(f, current_character->cos.s.style); + } + } + + current_character = current_character->next_character; + } +} + +void gregorio_write_first_letter_alignment_text(const bool skip_initial, + gregorio_character *current_character, + FILE *const f, void (*const printverb) (FILE *, grewchar *), + void (*const printchar) (FILE *, grewchar), + void (*const begin) (FILE *, grestyle_style), + void (*const end) (FILE *, grestyle_style), + void (*const printspchar) (FILE *, grewchar *)) +{ + /* stack of styles to close and reopen */ + det_style *first_style = NULL; + det_style *last_style = NULL; + bool first_letter_open = true; + + if (!current_character) { + return; + } + + /* go to the first character */ + gregorio_go_to_first_character(¤t_character); + + begin(f, ST_SYLLABLE_INITIAL); + + /* loop until there are no characters left */ + for (; current_character; + current_character = current_character->next_character) { + bool close_first_letter = false; + /* found a real character */ + if (current_character->is_character) { + printchar(f, current_character->cos.character); + close_first_letter = first_letter_open; + } else switch (current_character->cos.s.type) { + case ST_T_NOTHING: + assert(false); + break; + case ST_T_BEGIN: + /* handle styles */ + switch (current_character->cos.s.style) { + case ST_CENTER: + case ST_FORCED_CENTER: + /* ignore */ + break; + case ST_INITIAL: + if (skip_initial) { + while (current_character) { + if (!current_character->is_character + && current_character->cos.s.type == ST_T_END + && current_character->cos.s.style == + ST_INITIAL) { + break; + } + current_character = current_character->next_character; + } + } /* else ignore */ + break; + case ST_VERBATIM: + verb_or_sp(¤t_character, ST_VERBATIM, f, printverb); + close_first_letter = first_letter_open; + break; + case ST_SPECIAL_CHAR: + verb_or_sp(¤t_character, ST_SPECIAL_CHAR, f, printspchar); + close_first_letter = first_letter_open; + break; + default: + /* push the style onto the stack */ + style_push(&first_style, current_character->cos.s.style); + begin(f, current_character->cos.s.style); + } + break; + case ST_T_END: + switch (current_character->cos.s.style) { + case ST_CENTER: + case ST_FORCED_CENTER: + case ST_INITIAL: + /* ignore */ + break; + case ST_VERBATIM: + case ST_SPECIAL_CHAR: + assert(false); + break; + default: + /* pop the style from the stack */ + assert(first_style->style == current_character->cos.s.style); + style_pop(&first_style, first_style); + end(f, current_character->cos.s.style); + } + break; + } + + if (!current_character->next_character && first_letter_open) { + close_first_letter = first_letter_open; + } + + if (close_first_letter) { + first_letter_open = false; + + /* close all the styles in the stack */ + if (first_style) { + det_style *current_style; + /* these are immediately closed, so go past them */ + while (first_style && current_character + && current_character->next_character + && !current_character->next_character->is_character + && current_character->next_character->cos.s.type + == ST_T_END + && current_character->next_character->cos.s.style + == first_style->style) { + current_character = current_character->next_character; + style_pop(&first_style, first_style); + end(f, current_character->cos.s.style); + } + for (current_style = first_style; current_style; + current_style = current_style->next_style) { + end(f, current_style->style); + last_style = current_style; + } + } + + end(f, ST_SYLLABLE_INITIAL); + + /* reopen all styles */ + for (; last_style; last_style = last_style->previous_style) { + begin(f, last_style->style); + } + } + } + + free_styles(&first_style); +} + +/* the default behaviour is to write only the initial, that is to say things + * between the styles ST_INITIAL */ +void gregorio_write_initial(gregorio_character *current_character, + FILE *const f, void (*const printverb) (FILE *, grewchar *), + void (*const printchar) (FILE *, grewchar), + void (*const begin) (FILE *, grestyle_style), + void (*const end) (FILE *, grestyle_style), + void (*const printspchar) (FILE *, grewchar *)) +{ + /* we loop until we see the beginning of the initial style */ + gregorio_go_to_first_character(¤t_character); + while (current_character) { + if (!current_character->is_character + && current_character->cos.s.type == ST_T_BEGIN + && current_character->cos.s.style == ST_INITIAL) { + current_character = current_character->next_character; + break; + } + + current_character = current_character->next_character; + } + /* then we loop until we see the end of the initial style, but we print */ + while (current_character) { + if (current_character->is_character) { + printchar(f, current_character->cos.character); + } else { + if (current_character->cos.s.type == ST_T_BEGIN) { + switch (current_character->cos.s.style) { + case ST_VERBATIM: + verb_or_sp(¤t_character, ST_VERBATIM, f, printverb); + break; + case ST_SPECIAL_CHAR: + verb_or_sp(¤t_character, ST_SPECIAL_CHAR, f, + printspchar); + break; + default: + begin(f, current_character->cos.s.style); + break; + } + } else { /* ST_T_END */ + if (current_character->cos.s.style == ST_INITIAL) { + return; + } else { + end(f, current_character->cos.s.style); + } + } + } + current_character = current_character->next_character; + } +} + +/* + * + * A very simple function that returns the first text of a score, or the null + * character if there is no such thing. + * + */ + +gregorio_character *gregorio_first_text(gregorio_score *score) +{ + gregorio_syllable *current_syllable; + if (!score || !score->first_syllable) { + gregorio_message(_("unable to find the first letter of the score"), + "gregorio_first_text", VERBOSITY_ERROR, 0); + return NULL; + } + current_syllable = score->first_syllable; + while (current_syllable) { + if (current_syllable->text) { + return current_syllable->text; + } + current_syllable = current_syllable->next_syllable; + } + + gregorio_message(_("unable to find the first letter of the score"), + "gregorio_first_text", VERBOSITY_ERROR, 0); + return NULL; +} + +/* + * Here starts the code of the handling of text and styles. + * + * This part is not the easiest, in fact is is the most complicated. The reason + * is that I want to make something coherent in memory (easy to interprete), + * and to let the user type whatever he wants. This part was originally written + * for gabc, that's why it's always talking about it. But it could as well be + * used by other read plugins, to put things in order. + * + * Basically all the following lines of code are made for the last function, + * that will take a "user-written" gregorio_character list into a xml-compliant + * and tex-compliant list. It's more complicated than it seems... + * + * Functionalities: For example if the user types tt<i>ttt<b>ttt</i>tt I want + * it to be represented as tt<i>ttt<b>ttt</b></i><b>tt</b>. The fabulous thing + * is that it is xml-compliant. This part also determines the middle, for + * example pot will be interpreted as p{o}t. When I did that I also thought + * about TeX styles that needed things like {p}{o}{t}, so when the user types + * <i>pot</i>, it is interpreted as <i>p</i>{<i>o</i>}<i>t</i>. + * + * Internal structure: To do so we have a structure, det_style, that will help + * us : it is a stack (double chained list) of the styles that we have seen + * until now. When we encounter a <i>, we push the i style on the stack. If we + * encounter a </i> we suppress the i style from the stack. Let's take a more + * complex example: if we encounter <i><b></i>, the stack will be first null, + * then i then bi, and there we want to end i, but it is not the first style of + * the stack, so we close all the styles that we encounter before we encounter + * i (remember, this is for xml-compliance), so we insert a </b> before the + * </i>. But that's not all, we also write a <b> after the </i>, so that the b + * style continues. There our stack is just b. For center, we just close all + * the styles in the stack, insert a { and reopen all the styles in the stack. + * + * The structure used for character, styles, etc. is described in + * include/struct.h + * + * The functionment in this file is quite simple : we add all the characters + * that we see, even if they are incoherent, in the gregorio_character list, + * and then we call a very complex function that will build a stack of the + * style, determine the middle, make all xml-compliant, mow the lawn, etc. + * + * This code is *really* spaghetti, but I think it's a necessary pain. + * + */ + +/* + * + * This function inserts a style before current_character, updating the double + * chained list. + * + */ + +static void insert_style_before(unsigned char type, + unsigned char style, gregorio_character *current_character) +{ + gregorio_character *element = + (gregorio_character *) gregorio_malloc(sizeof(gregorio_character)); + element->is_character = 0; + element->cos.s.type = type; + element->cos.s.style = style; + element->next_character = current_character; + if (current_character->previous_character) { + current_character->previous_character->next_character = element; + } + element->previous_character = current_character->previous_character; + current_character->previous_character = element; +} + +/* + * + * This function puts a style after current_character, and updates + * current_character to the gregorio_character it created. It updates the + * double chained list. It does not touche to the det_styles list. + * + */ + +static void insert_style_after(unsigned char type, unsigned char style, + gregorio_character **current_character) +{ + gregorio_character *element = + (gregorio_character *) gregorio_malloc(sizeof(gregorio_character)); + element->is_character = 0; + element->cos.s.type = type; + element->cos.s.style = style; + element->next_character = (*current_character)->next_character; + if ((*current_character)->next_character) { + (*current_character)->next_character->previous_character = element; + } + element->previous_character = (*current_character); + (*current_character)->next_character = element; + (*current_character) = element; +} + +#if 0 +static void insert_char_after(grewchar c, + gregorio_character **current_character) +{ + gregorio_character *element = + (gregorio_character *) gregorio_malloc(sizeof(gregorio_character)); + element->is_character = 1; + element->cos.character = c; + element->next_character = (*current_character)->next_character; + if ((*current_character)->next_character) { + (*current_character)->next_character->previous_character = element; + } + element->previous_character = (*current_character); + (*current_character)->next_character = element; + (*current_character) = element; +} +#endif + +/* + * + * This function suppresses the current character, updates the double chained + * list, and updates current_character to the character after, if there is one. + * + */ + +static void suppress_current_character( + gregorio_character **current_character) +{ + gregorio_character *thischaracter; + if (!current_character || !*current_character) { + return; + } + thischaracter = *current_character; + if ((*current_character)->previous_character) { + (*current_character)->previous_character->next_character = + (*current_character)->next_character; + } + if ((*current_character)->next_character) { + (*current_character)->next_character->previous_character = + (*current_character)->previous_character; + } + (*current_character) = (*current_character)->next_character; + free(thischaracter); +} + +/* + * + * This function suppresses the corresponding character, updates the double + * chained list, but does not touch to current_character. + * + */ + +static void suppress_this_character(gregorio_character *to_suppress) +{ + if (!to_suppress) { + return; + } + if (to_suppress->previous_character) { + to_suppress->previous_character->next_character = + to_suppress->next_character; + } + if (to_suppress->next_character) { + to_suppress->next_character->previous_character = + to_suppress->previous_character; + } + free(to_suppress); +} + +/* + * + * Then start the inline functions for the big function. the first one is the + * function we call when we close a style. The magic thing is that is will + * prevent things like a<i></i>{<i>b</b>: when the user types a<i>b</i>, if the + * middle is between a and b (...), it will interpret it as a{<i>b</i>. + * + */ + +static __inline void close_style(gregorio_character *current_character, + det_style *current_style) +{ + if (!current_character->previous_character->is_character + && current_character->previous_character->cos.s.style == + current_style->style) { + /* + * we suppose that there is a previous_character, because there is a + * current_style + */ + suppress_this_character(current_character->previous_character); + } else { + insert_style_before(ST_T_END, current_style->style, current_character); + } +} + +/* + * + * next the function called when we have determined that we must end the center + * here : it closes all styles, adds a } and then reopens all styles. + * + */ + +/* type is ST_CENTER or ST_FORCED_CENTER */ +static __inline void end_center(grestyle_style type, + gregorio_character *current_character, det_style **ptr_style) +{ + det_style *current_style; + current_style = *ptr_style; + + while (current_style) { + close_style(current_character, current_style); + if (current_style->next_style) { + current_style = current_style->next_style; + } else { + break; + } + } + insert_style_before(ST_T_END, type, current_character); + while (current_style) { + insert_style_before(ST_T_BEGIN, current_style->style, + current_character); + if (current_style->previous_style) { + current_style = current_style->previous_style; + } else { + break; + } + } + + *ptr_style = current_style; +} + +/* + * about the same, but adding a { + */ + +static __inline void begin_center(grestyle_style type, + gregorio_character *current_character, det_style **ptr_style) +{ + det_style *current_style; + current_style = *ptr_style; + + while (current_style) { + close_style(current_character, current_style); + if (current_style->next_style) { + current_style = current_style->next_style; + } else { + break; + } + } + insert_style_before(ST_T_BEGIN, type, current_character); + while (current_style) { + insert_style_before(ST_T_BEGIN, current_style->style, + current_character); + if (current_style->previous_style) { + current_style = current_style->previous_style; + } else { + break; + } + } + + *ptr_style = current_style; +} + +/* + * + * the macro called when we have ended the determination of the current + * character. It makes current_character point to the last character, not to + * null at the end of the determination. + * + */ + +#define end_c() if (_end_c(¤t_character)) continue; else break; +static __inline bool _end_c(gregorio_character **ptr_character) +{ + if ((*ptr_character)->next_character) { + *ptr_character = (*ptr_character)->next_character; + /* continue */ + return true; + } else { + /* break */ + return false; + } +} + +/* + * + * basically the same except that we suppress the current_character + * + */ + +#define suppress_char_and_end_c() if (_suppress_char_and_end_c(¤t_character)) continue; else break; +static __inline bool _suppress_char_and_end_c( + gregorio_character **ptr_character) +{ + if ((*ptr_character)->next_character) { + *ptr_character = (*ptr_character)->next_character; + suppress_this_character((*ptr_character)->previous_character); + /* continue */ + return true; + } else { + if ((*ptr_character)->previous_character) { + (*ptr_character) = (*ptr_character)->previous_character; + suppress_this_character((*ptr_character)->next_character); + } else { + suppress_this_character(*ptr_character); + *ptr_character = NULL; + } + /* break */ + return false; + } +} + +/* + * THE big function. Very long, using a lot of long macros, etc. I hope you + * really want to understand it, 'cause it won't be easy. + * + * current character is a pointer to a gregorio_character. The + * gregorio_character double-chained list it is in will be totally reorganized + * so that it is xml compliant, and the function will update it to the first + * character of this brand new list. + * + * center_is_determined has the values present in characters.h. + * + * Another difficulty is the fact that we must consider characters in verbatim + * and special character styles like only one block, we can't say the center is + * in the middle of a verbatim block. + */ + +void gregorio_rebuild_characters(gregorio_character **param_character, + gregorio_center_determination center_is_determined, bool skip_initial) +{ + /* the current_character */ + gregorio_character *current_character = *param_character; + /* a char that we will use in a very particular case */ + grestyle_style this_style; + det_style *first_style = NULL; + /* determining the type of centering (forced or not) */ + grestyle_style center_type = ST_NO_STYLE; + int start = -1, end = -1, index = -1; + /* so, here we start: we go to the first_character */ + if (go_to_end_initial(¤t_character)) { + if (!current_character->next_character) { + /* nothing else to rebuild, but the initial needs to be ST_CENTER */ + insert_style_after(ST_T_END, ST_CENTER, ¤t_character); + gregorio_go_to_first_character(¤t_character); + insert_style_before(ST_T_BEGIN, ST_CENTER, current_character); + gregorio_go_to_first_character(¤t_character); + (*param_character) = current_character; + return; + } + if (skip_initial) { + /* move to the character after the initial */ + current_character = current_character->next_character; + } else { + gregorio_go_to_first_character(¤t_character); + } + } + /* first we see if there is already a center determined */ + if (center_is_determined == 0) { + center_type = ST_CENTER; + determine_center(current_character, &start, &end); + } else { + center_type = ST_FORCED_CENTER; + } + /* we loop until there isn't any character */ + while (current_character) { + /* the first part of the function deals with real characters (not + * styles) */ + if (current_character->is_character) { + ++index; + /* the firstcase is if the user hasn't determined the middle, and + * we have only seen vowels so far (else center_is_determined + * would be DETERMINING_MIDDLE). The current_character is the + * first vowel, so we start the center here. */ + if (!center_is_determined && index == start) { + begin_center(center_type, current_character, &first_style); + center_is_determined = CENTER_DETERMINING_MIDDLE; + end_c(); + } + /* the case where the user has not determined the middle and we + * are in the middle section of the syllable, but there we + * encounter something that is not a vowel, so the center ends + * there. */ + if (center_is_determined == CENTER_DETERMINING_MIDDLE + && index == end) { + end_center(center_type, current_character, &first_style); + center_is_determined = CENTER_FULLY_DETERMINED; + } + /* in the case where it is just a normal character... we simply + * pass. */ + end_c(); + } + /* there starts the second part of the function that deals with the + * styles characters */ + if (current_character->cos.s.type == ST_T_BEGIN + && current_character->cos.s.style != ST_CENTER + && current_character->cos.s.style != ST_FORCED_CENTER) { + /* first, if it it the beginning of a style, which is not center. + * We check if the style is not already in the stack. If it is the + * case, we suppress the character and pass (with the good macro) */ + det_style *current_style = NULL; + for (current_style = first_style; current_style + && current_style->style != current_character->cos.s.style; + current_style = current_style->next_style) { + /* just loop */ + } + if (current_style) { + suppress_char_and_end_c(); + } + /* if we are determining the end of the middle and we have a + * VERBATIM or SPECIAL_CHAR style, we end the center + * determination */ + if ((current_character->cos.s.style == ST_VERBATIM + || current_character->cos.s.style == + ST_SPECIAL_CHAR) + && center_is_determined == CENTER_DETERMINING_MIDDLE) { + end_center(center_type, current_character, &first_style); + center_is_determined = CENTER_FULLY_DETERMINED; + } + /* if it is something to add then we just push the style in the + * stack and continue. */ + style_push(&first_style, current_character->cos.s.style); + /* Here we pass all the characters after a verbatim (or special + * char) beginning, until we find a style (begin or end) */ + if (current_character->cos.s.style == ST_VERBATIM + || current_character->cos.s.style == ST_SPECIAL_CHAR) { + if (current_character->next_character) { + current_character = current_character->next_character; + } + while (current_character->next_character + && current_character->is_character) { + current_character = current_character->next_character; + } + } else { + end_c(); + } + } + /* if it is a beginning of a center, we call the good macro and end. */ + if (current_character->cos.s.type == ST_T_BEGIN + && (current_character->cos.s.style == ST_CENTER + || current_character->cos.s.style == + ST_FORCED_CENTER)) { + if (current_character->cos.s.style == ST_CENTER) { + center_type = ST_CENTER; + } else { + center_type = ST_FORCED_CENTER; + } + if (center_is_determined) { + end_c(); + } + /* center_is_determined = DETERMINING_MIDDLE; */ + /* TODO: not really sure, but shouldn't be there */ + begin_center(center_type, current_character, &first_style); + end_c(); + } + if (current_character->cos.s.type == ST_T_END + && current_character->cos.s.style != ST_CENTER + && current_character->cos.s.style != ST_FORCED_CENTER) { + /* the case of the end of a style (the most complex). First, we + * have to see if the style is in the stack. If there is no stack, + * we just suppress and continue. */ + if (!first_style) { + suppress_char_and_end_c(); + } + /* so, we look if it is in the stack. If it is we put + * current_style to the style just before the style corresponding + * to the character that we are treating (still there ?) */ + if (first_style->style != current_character->cos.s.style) { + det_style *current_style = NULL; + for (current_style = first_style; current_style->next_style + && current_style->next_style->style != + current_character->cos.s.style; + current_style = current_style->next_style) { + /* just loop */ + } + if (current_style->next_style) { + for (current_style = first_style; current_style; + current_style = current_style->previous_style) { + /* if there are styles before in the stack, we close + * them */ + insert_style_before(ST_T_END, current_style->style, + current_character); + } + this_style = current_character->cos.s.style; + /* and then we reopen them */ + for (current_style = first_style; current_style && + current_style->style != this_style; + current_style = current_style->next_style) { + insert_style_after(ST_T_BEGIN, current_style->style, + ¤t_character); + } + /* we delete the style in the stack */ + style_pop(&first_style, current_style); + } else { + suppress_char_and_end_c(); + } + } else { + style_pop(&first_style, first_style); + end_c(); + } + } else { /* ST_T_END && ST_CENTER */ + /* a quite simple case, we just call the good macro. */ + if (!center_is_determined) { + suppress_char_and_end_c(); + } + } + end_c(); + } + if (!current_character) { + return; + } + /* we terminate all the styles that are still in the stack */ + { + /* introduce a scope so current_style is local, since we can't + * initialize in the loop (as in C99) */ + det_style *current_style = NULL; + for (current_style = first_style; current_style; + current_style = current_style->next_style) { + insert_style_after(ST_T_END, current_style->style, + ¤t_character); + } + } + /* current_character is at the end of the list now, so if we havn't closed + * the center, we do it at the end. */ + if (center_is_determined != CENTER_FULLY_DETERMINED) { + insert_style_after(ST_T_END, center_type, ¤t_character); + } + /* these three lines are for the case where the user didn't tell anything + * about the middle and there aren't any vowel in the syllable, so we + * begin the center before the first character (you can notice that there + * is no problem of style). */ + if (!center_is_determined) { + if (skip_initial && go_to_end_initial(¤t_character)) { + current_character = current_character->next_character; + } else { + gregorio_go_to_first_character(¤t_character); + } + insert_style_before(ST_T_BEGIN, ST_CENTER, current_character); + } + /* well.. you're quite brave if you reach this comment. */ + gregorio_go_to_first_character(¤t_character); + (*param_character) = current_character; + free_styles(&first_style); +} + +/** + * @brief This function will determine the behaviour of gregorio when it comes to the recognition of the initial. + * + * Basically it will take a gregorio_character list and return the same list, but with a style added : ST_INITIAL. This style will incidate the initial. The center will be placed at the second letter, unless there is a FORCED_CENTER somewhere. + * Finally all will be xml-compliant and tex-compliant when we call gregorio_rebuild_characters. + * + * If we note <> for the initial and {} for the center, here is what we want: + * + * @li \verbatim Po -> <P>{o} \endverbatim + * @li \verbatim {A}b -> <>{A}b \endverbatim + * @li \verbatim {}a -> <>{}a \endverbatim + * @li \verbatim Glo -> <G>{l}o \endverbatim + * @li \verbatim Gl{o} -> <G>l{o} \endverbatim + * + * @param param_character is a pointer to the (pointer to the) first character, it will be modified so that it points to the new first character. + */ +void gregorio_rebuild_first_syllable(gregorio_character **param_character, + bool separate_initial) +{ + /* the current_character */ + gregorio_character *current_character = *param_character; + gregorio_character *first_character; + gregorio_character *start_of_special; + /* so, here we start: we go to the first_character */ + gregorio_go_to_first_character(¤t_character); + /* first we look at the styles, to see if there is a FORCED_CENTER + * somewhere and we also remove the CENTER styles if the syllable starts at + * CENTER */ + if (!param_character) { + return; + } + while (current_character) { + if (!current_character->is_character) { + if (current_character->cos.s.style == ST_FORCED_CENTER) { + /* we can break here, as there won't be forced center plus + * center */ + break; + } + if (current_character->cos.s.style == ST_CENTER) { + /* we have to do it in case param_character (the first + * character) is a ST_CENTER beginning */ + if (!current_character->previous_character + && current_character == *param_character) { + *param_character = (*param_character)->next_character; + } + suppress_current_character(¤t_character); + continue; + } + } + current_character = current_character->next_character; + } + current_character = *param_character; + gregorio_go_to_first_character(¤t_character); + first_character = current_character; + /* now we are going to place the two INITIAL styles (begin and end) */ + while (current_character) { + if (!current_character->is_character + && current_character->cos.s.style == ST_FORCED_CENTER) { + /* we don't touch anything after a FORCED_CENTER, so we put an + * empty INITIAL style just before */ + current_character = first_character; + insert_style_before(ST_T_BEGIN, ST_INITIAL, current_character); + current_character = current_character->previous_character; + insert_style_after(ST_T_END, ST_INITIAL, ¤t_character); + break; + } + /* this if is a hack to make gregorio consider verbatim blocks and + * special chars like one block, not a sequence of letters */ + if (!current_character->is_character + && current_character->cos.s.type == ST_T_BEGIN + && (current_character->cos.s.style == ST_VERBATIM + || current_character->cos.s.style == ST_SPECIAL_CHAR)) { + insert_style_before(ST_T_BEGIN, ST_INITIAL, current_character); + start_of_special = current_character->previous_character; + /* ... which is now the begin-initial style */ + + if (current_character->next_character) { + current_character = current_character->next_character; + } + while (current_character->next_character + && current_character->is_character) { + current_character = current_character->next_character; + } + insert_style_after(ST_T_END, ST_INITIAL, ¤t_character); + if (separate_initial && start_of_special->previous_character) { + /* we need to move the initial to the front */ + start_of_special->previous_character->next_character = + current_character->next_character; + current_character->next_character->previous_character = + start_of_special->previous_character; + start_of_special->previous_character = NULL; + current_character->next_character = first_character; + first_character->previous_character = current_character; + + gregorio_message(_ + ("Any style applied to the initial will be ignored."), + NULL, VERBOSITY_WARNING, 0); + } + break; + } + if (current_character->is_character) { + if (separate_initial && current_character->previous_character) { + /* we need to move the initial to the front */ + current_character->previous_character->next_character = + current_character->next_character; + current_character->next_character->previous_character = + current_character->previous_character; + current_character->previous_character = NULL; + current_character->next_character = first_character; + first_character->previous_character = current_character; + + gregorio_message(_ + ("Any style applied to the initial will be ignored."), + NULL, VERBOSITY_WARNING, 0); + } + insert_style_before(ST_T_BEGIN, ST_INITIAL, current_character); + insert_style_after(ST_T_END, ST_INITIAL, ¤t_character); + break; + } + current_character = current_character->next_character; + } + /* now apply the first syllable style */ + current_character = *param_character; + if (separate_initial) { + if (go_to_end_initial(¤t_character)) { + current_character = current_character->next_character; + } + } else { + gregorio_go_to_first_character(¤t_character); + } + if (current_character) { + bool marked_syllable_initial = false; + insert_style_before(ST_T_BEGIN, ST_FIRST_SYLLABLE, current_character); + do { + if (!marked_syllable_initial && (current_character->is_character + || (current_character->cos.s.type == ST_T_BEGIN + && (current_character->cos.s.style == ST_VERBATIM + || current_character->cos.s.style + == ST_SPECIAL_CHAR + ) + ) + )) { + marked_syllable_initial = true; + insert_style_before(ST_T_BEGIN, ST_FIRST_SYLLABLE_INITIAL, + current_character); + if (!current_character->is_character) { + /* skip past the verbatim or special character */ + if (current_character->next_character) { + current_character = current_character->next_character; + } + while (current_character->next_character + && current_character->is_character) { + current_character = current_character->next_character; + } + } + insert_style_after(ST_T_END, ST_FIRST_SYLLABLE_INITIAL, + ¤t_character); + } + if (!current_character->is_character + && (current_character->cos.s.style == ST_CENTER + || current_character->cos.s.style == ST_FORCED_CENTER)) { + insert_style_before(ST_T_END, ST_FIRST_SYLLABLE, + current_character); + insert_style_after(ST_T_BEGIN, ST_FIRST_SYLLABLE, + ¤t_character); + } + if (!current_character->next_character) { + insert_style_after(ST_T_END, ST_FIRST_SYLLABLE, + ¤t_character); + } + current_character = current_character->next_character; + } while (current_character); + } + + current_character = *param_character; + gregorio_go_to_first_character(¤t_character); + (*param_character) = current_character; +} + +void gregorio_set_first_word(gregorio_character **const character) +{ + gregorio_character *ch = *character; + if (go_to_end_initial(&ch)) { + ch = ch->next_character; + } + if (ch) { + bool started_style = false; + while (ch) { + if (!ch->is_character + && (ch->cos.s.style == ST_CENTER + || ch->cos.s.style == ST_FORCED_CENTER)) { + if (started_style) { + started_style = false; + insert_style_before(ST_T_END, ST_FIRST_WORD, ch); + } + } else if (!started_style) { + started_style = true; + insert_style_before(ST_T_BEGIN, ST_FIRST_WORD, ch); + } + + if (!ch->next_character && started_style) { + insert_style_after(ST_T_END, ST_FIRST_WORD, &ch); + } + + ch = ch->next_character; + } + } + /* else there are no more characters here */ + + if (*character) { + gregorio_go_to_first_character(character); + } +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/characters.h b/Build/source/texk/gregorio/gregorio-src/src/characters.h new file mode 100644 index 00000000000..1575fc0d1c9 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/characters.h @@ -0,0 +1,95 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header prototypes the lyric handling data structures and entry points. + * + * Copyright (C) 2008-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef CHARACTERS_H +#define CHARACTERS_H + +#include "bool.h" +#include "struct.h" + +/* + * + * The three next defines are the possible values of center_is_determined. + * + * CENTER_NOT_DETERMINED means that the plugin has encountered no { nor } (in + * the gabc syntax). CENTER_HALF_DETERMINED means that the plugin has + * encountered a { but no }, and we will try to determine a middle starting + * after the {. CENTER_FULLY_DETERMINED means that lex has encountered a { and + * a }, so we won't determine the middle, it is considered done. + * CENTER_DETERMINING_MIDDLE is used internally in the big function to know + * where we are in the middle determination. + * + */ + +typedef enum gregorio_center_determination { + CENTER_NOT_DETERMINED = 0, + CENTER_HALF_DETERMINED, + CENTER_FULLY_DETERMINED, + CENTER_DETERMINING_MIDDLE +} gregorio_center_determination; + +/* this is a temporary structure that will be used for style determination */ + +typedef struct det_style { + grestyle_style style; + struct det_style *previous_style; + struct det_style *next_style; +} det_style; + +gregorio_character *gregorio_first_text(gregorio_score *score); + +void gregorio_write_text(bool skip_initial, + gregorio_character *current_character, + FILE *f, void (*printverb) (FILE *, grewchar *), + void (*printchar) (FILE *, grewchar), + void (*begin) (FILE *, grestyle_style), + void (*end) (FILE *, grestyle_style), + void (*printspchar) (FILE *, grewchar *)); + +void gregorio_write_first_letter_alignment_text(bool skip_initial, + gregorio_character *current_character, + FILE *f, void (*printverb) (FILE *, grewchar *), + void (*printchar) (FILE *, grewchar), + void (*begin) (FILE *, grestyle_style), + void (*end) (FILE *, grestyle_style), + void (*printspchar) (FILE *, grewchar *)); + +void gregorio_write_initial(gregorio_character *current_character, + FILE *f, void (*printverb) (FILE *, grewchar *), + void (*printchar) (FILE *, grewchar), + void (*begin) (FILE *, grestyle_style), + void (*end) (FILE *, grestyle_style), + void (*printspchar) (FILE *, grewchar *)); + +void gregorio_set_centering_language(char *language); + +gregorio_character *gregorio_first_text(gregorio_score *score); + +void gregorio_rebuild_characters(gregorio_character **param_character, + gregorio_center_determination center_is_determined, bool skip_initial); + +void gregorio_rebuild_first_syllable(gregorio_character **param_character, + bool separate_initial); + +void gregorio_set_first_word(gregorio_character **character); + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/config.h b/Build/source/texk/gregorio/gregorio-src/src/config.h new file mode 100644 index 00000000000..9519115cbb8 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/config.h @@ -0,0 +1,36 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header wraps the generated config_.h to provide version macros. + * + * Gregorio configuration headers. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_.h" + +#ifdef BRANCH_VERSION +#define GREGORIO_VERSION VERSION "-" BRANCH_VERSION +#else +#define GREGORIO_VERSION VERSION +#endif + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/dump/dump.c b/Build/source/texk/gregorio/gregorio-src/src/dump/dump.c new file mode 100644 index 00000000000..f1c8fc6b8c9 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/dump/dump.c @@ -0,0 +1,937 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX. + * This file provides functions to dump out Gregorio structures. + * + * Copyright (C) 2007-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include "bool.h" +#include "struct.h" +#include "unicode.h" +#include "messages.h" +#include "plugins.h" +#include "support.h" + +static const char *unknown(int value) { + static char buf[20]; + gregorio_snprintf(buf, 20, "?%d", value); + return buf; +} + +static const char *dump_translation_type_to_string(gregorio_tr_centering + translation_type) +{ + switch (translation_type) { + case TR_NORMAL: + return "TR_NORMAL"; + case TR_WITH_CENTER_BEGINNING: + return "TR_WITH_CENTER_BEGINNING"; + case TR_WITH_CENTER_END: + return "TR_WITH_CENTER_END"; + } + return unknown(translation_type); +} + +static const char *dump_nlba_to_string(gregorio_nlba no_linebreak_area) +{ + switch (no_linebreak_area) { + case NLBA_NORMAL: + return "NLBA_NORMAL"; + case NLBA_BEGINNING: + return "NLBA_BEGINNING"; + case NLBA_END: + return "NLBA_END"; + } + return unknown(no_linebreak_area); +} + +static const char *dump_style_to_string(grestyle_style style) +{ + switch (style) { + case ST_NO_STYLE: + return " ST_NO_STYLE"; + case ST_ITALIC: + return " ST_ITALIC"; + case ST_CENTER: + return " ST_CENTER"; + case ST_FORCED_CENTER: + return " ST_FORCED_CENTER"; + case ST_INITIAL: + return " ST_INITIAL"; + case ST_BOLD: + return " ST_BOLD"; + case ST_TT: + return " ST_TT"; + case ST_UNDERLINED: + return " ST_UNDERLINED"; + case ST_COLORED: + return " ST_COLORED"; + case ST_SMALL_CAPS: + return " ST_SMALL_CAPS"; + case ST_SPECIAL_CHAR: + return " ST_SPECIAL_CHAR"; + case ST_VERBATIM: + return " ST_VERBATIM"; + case ST_FIRST_WORD: + return " ST_FIRST_WORD"; + case ST_FIRST_SYLLABLE: + return "ST_FIRST_SYLLABLE"; + case ST_FIRST_SYLLABLE_INITIAL: + return "ST_FIRST_SYLLABLE_INITIAL"; + default: + return unknown(style); + } +} + +static void dump_write_characters(FILE *const f, + const gregorio_character * current_character) +{ + while (current_character) { + fprintf(f, + "---------------------------------------------------------------------\n"); + if (current_character->is_character) { + fprintf(f, " character "); + gregorio_print_unichar(f, current_character->cos.character); + fprintf(f, "\n"); + } else { + if (current_character->cos.s.type == ST_T_BEGIN) { + fprintf(f, " beginning of style %s\n", + dump_style_to_string(current_character->cos.s.style)); + } else { + fprintf(f, " end of style %s\n", + dump_style_to_string(current_character->cos.s.style)); + } + } + current_character = current_character->next_character; + } +} + +static const char *dump_key_to_char(const int key) +{ + switch (key) { + case -2: + return "f1"; + case 0: + return "f2"; + case 2: + return "f3"; + case 4: + return "f4"; + case 1: + return "c1"; + case 3: + return "c2"; + case 5: + return "c3"; + case 7: + return "c4"; + } + return "no key defined"; +} + +static const char *dump_syllable_position(gregorio_word_position pos) +{ + switch (pos) { + case WORD_BEGINNING: + return "WORD_BEGINNING"; + case WORD_MIDDLE: + return "WORD_MIDDLE"; + case WORD_END: + return "WORD_END"; + case WORD_ONE_SYLLABLE: + return "WORD_ONE_SYLLABLE"; + } + return "unknown"; +} + +static const char *dump_type(gregorio_type type) +{ + switch (type) { + case GRE_NOTE: + return "GRE_NOTE"; + case GRE_GLYPH: + return "GRE_GLYPH"; + case GRE_ELEMENT: + return "GRE_ELEMENT"; + case GRE_FLAT: + return "GRE_FLAT"; + case GRE_SHARP: + return "GRE_SHARP"; + case GRE_NATURAL: + return "GRE_NATURAL"; + case GRE_C_KEY_CHANGE: + return "GRE_C_KEY_CHANGE"; + case GRE_F_KEY_CHANGE: + return "GRE_F_KEY_CHANGE"; + case GRE_END_OF_LINE: + return "GRE_END_OF_LINE"; + case GRE_END_OF_PAR: + return "GRE_END_OF_PAR"; + case GRE_CUSTOS: + return "GRE_CUSTOS"; + case GRE_SPACE: + return "GRE_SPACE"; + case GRE_BAR: + return "GRE_BAR"; + case GRE_SYLLABLE: + return "GRE_SYLLABLE"; + case GRE_TEXVERB_GLYPH: + return "GRE_TEXVERB_GLYPH"; + case GRE_TEXVERB_ELEMENT: + return "GRE_TEXVERB_ELEMENT"; + case GRE_NLBA: + return "GRE_NLBA"; + case GRE_ALT: + return "GRE_ALT"; + case GRE_MANUAL_CUSTOS: + return "GRE_MANUAL_CUSTOS"; + default: + return "unknown"; + } +} + +static const char *dump_bar_type(gregorio_bar element_type) +{ + switch (element_type) { + case B_NO_BAR: + return "B_NO_BAR"; + case B_VIRGULA: + return "B_VIRGULA"; + case B_DIVISIO_MINIMA: + return "B_DIVISIO_MINIMA"; + case B_DIVISIO_MINOR: + return "B_DIVISIO_MINOR"; + case B_DIVISIO_MAIOR: + return "B_DIVISIO_MAIOR"; + case B_DIVISIO_FINALIS: + return "B_DIVISIO_FINALIS"; + case B_DIVISIO_MINOR_D1: + return "B_DIVISIO_MINOR_D1"; + case B_DIVISIO_MINOR_D2: + return "B_DIVISIO_MINOR_D2"; + case B_DIVISIO_MINOR_D3: + return "B_DIVISIO_MINOR_D3"; + case B_DIVISIO_MINOR_D4: + return "B_DIVISIO_MINOR_D4"; + case B_DIVISIO_MINOR_D5: + return "B_DIVISIO_MINOR_D5"; + case B_DIVISIO_MINOR_D6: + return "B_DIVISIO_MINOR_D6"; + } + return "unknown"; +} + +static const char *dump_space_type(gregorio_space element_type) +{ + switch (element_type) { + case SP_DEFAULT: + return "SP_DEFAULT"; + case SP_NO_SPACE: + return "SP_NO_SPACE"; + case SP_ZERO_WIDTH: + return "SP_ZERO_WIDTH"; + case SP_NEUMATIC_CUT: + return "SP_NEUMATIC_CUT"; + case SP_LARGER_SPACE: + return "SP_LARGER_SPACE"; + case SP_GLYPH_SPACE: + return "SP_GLYPH_SPACE"; + case SP_GLYPH_SPACE_NB: + return "SP_GLYPH_SPACE_NB"; + case SP_LARGER_SPACE_NB: + return "SP_LARGER_SPACE_NB"; + case SP_NEUMATIC_CUT_NB: + return "SP_NEUMATIC_CUT_NB"; + } + return "unknown"; +} + +static const char *dump_liquescentia(gregorio_liquescentia liquescentia) +{ + switch (liquescentia) { + case L_NO_LIQUESCENTIA: + return "L_NO_LIQUESCENTIA"; + case L_DEMINUTUS: + return "L_DEMINUTUS"; + case L_AUCTUS_ASCENDENS: + return "L_AUCTUS_ASCENDENS"; + case L_AUCTUS_DESCENDENS: + return "L_AUCTUS_DESCENDENS"; + case L_AUCTA: + return "L_AUCTA"; + case L_INITIO_DEBILIS: + return "L_INITIO_DEBILIS"; + case L_DEMINUTUS_INITIO_DEBILIS: + return "L_DEMINUTUS_INITIO_DEBILIS"; + case L_AUCTUS_ASCENDENS_INITIO_DEBILIS: + return "L_AUCTUS_ASCENDENS_INITIO_DEBILIS"; + case L_AUCTUS_DESCENDENS_INITIO_DEBILIS: + return "L_AUCTUS_DESCENDENS_INITIO_DEBILIS"; + case L_AUCTA_INITIO_DEBILIS: + return "L_AUCTA_INITIO_DEBILIS"; + } + return "unknown"; +} + +static const char *dump_glyph_type(gregorio_glyph_type glyph_type) +{ + switch (glyph_type) { + case G_PUNCTUM_INCLINATUM: + return "G_PUNCTUM_INCLINATUM"; + case G_2_PUNCTA_INCLINATA_DESCENDENS: + return "G_2_PUNCTA_INCLINATA_DESCENDENS"; + case G_3_PUNCTA_INCLINATA_DESCENDENS: + return "G_3_PUNCTA_INCLINATA_DESCENDENS"; + case G_4_PUNCTA_INCLINATA_DESCENDENS: + return "G_4_PUNCTA_INCLINATA_DESCENDENS"; + case G_5_PUNCTA_INCLINATA_DESCENDENS: + return "G_5_PUNCTA_INCLINATA_DESCENDENS"; + case G_2_PUNCTA_INCLINATA_ASCENDENS: + return "G_2_PUNCTA_INCLINATA_ASCENDENS"; + case G_3_PUNCTA_INCLINATA_ASCENDENS: + return "G_3_PUNCTA_INCLINATA_ASCENDENS"; + case G_4_PUNCTA_INCLINATA_ASCENDENS: + return "G_4_PUNCTA_INCLINATA_ASCENDENS"; + case G_5_PUNCTA_INCLINATA_ASCENDENS: + return "G_5_PUNCTA_INCLINATA_ASCENDENS"; + case G_TRIGONUS: + return "G_TRIGONUS"; + case G_PUNCTA_INCLINATA: + return "G_PUNCTA_INCLINATA"; + case G_UNDETERMINED: + return "G_UNDETERMINED"; + case G_VIRGA: + return "G_VIRGA"; + case G_VIRGA_REVERSA: + return "G_VIRGA_REVERSA"; + case G_STROPHA: + return "G_STROPHA"; + case G_STROPHA_AUCTA: + return "G_STROPHA_AUCTA"; + case G_PUNCTUM: + return "G_PUNCTUM"; + case G_PODATUS: + return "G_PODATUS"; + case G_PES_QUADRATUM: + return "G_PES_QUADRATUM"; + case G_FLEXA: + return "G_FLEXA"; + case G_TORCULUS: + return "G_TORCULUS"; + case G_TORCULUS_RESUPINUS: + return "G_TORCULUS_RESUPINUS"; + case G_TORCULUS_RESUPINUS_FLEXUS: + return "G_TORCULUS_RESUPINUS_FLEXUS"; + case G_PORRECTUS: + return "G_PORRECTUS"; + case G_PORRECTUS_FLEXUS: + return "G_PORRECTUS_FLEXUS"; + case G_BIVIRGA: + return "G_BIVIRGA"; + case G_TRIVIRGA: + return "G_TRIVIRGA"; + case G_DISTROPHA: + return "G_DISTROPHA"; + case G_DISTROPHA_AUCTA: + return "G_DISTROPHA_AUCTA"; + case G_TRISTROPHA: + return "G_TRISTROPHA"; + case G_ANCUS: + return "G_ANCUS"; + case G_TRISTROPHA_AUCTA: + return "G_TRISTROPHA_AUCTA"; + case G_PES_QUADRATUM_FIRST_PART: + return "G_PES_QUADRATUM_FIRST_PART"; + case G_SCANDICUS: + return "G_SCANDICUS"; + case G_SALICUS: + return "G_SALICUS"; + case G_VIRGA_STRATA: + return "G_VIRGA_STRATA"; + case G_TORCULUS_LIQUESCENS: + return "G_TORCULUS_LIQUESCENS"; + default: + return "unknown"; + } +} + +static const char *dump_shape(gregorio_shape shape) +{ + switch (shape) { + case S_UNDETERMINED: + return "S_UNDETERMINED"; + case S_PUNCTUM: + return "S_PUNCTUM"; + case S_PUNCTUM_END_OF_GLYPH: + return "S_PUNCTUM_END_OF_GLYPH"; + case S_PUNCTUM_INCLINATUM: + return "S_PUNCTUM_INCLINATUM"; + case S_PUNCTUM_INCLINATUM_DEMINUTUS: + return "S_PUNCTUM_INCLINATUM_DEMINUTUS"; + case S_PUNCTUM_INCLINATUM_AUCTUS: + return "S_PUNCTUM_INCLINATUM_AUCTUS"; + case S_VIRGA: + return "S_VIRGA"; + case S_VIRGA_REVERSA: + return "S_VIRGA_REVERSA"; + case S_BIVIRGA: + return "S_BIVIRGA"; + case S_TRIVIRGA: + return "S_TRIVIRGA"; + case S_ORISCUS: + return "S_ORISCUS"; + case S_ORISCUS_AUCTUS: + return "S_ORISCUS_AUCTUS"; + case S_ORISCUS_DEMINUTUS: + return "S_ORISCUS_DEMINUTUS"; + case S_ORISCUS_SCAPUS: + return "S_ORISCUS_SCAPUS"; + case S_QUILISMA: + return "S_QUILISMA"; + case S_STROPHA: + return "S_STROPHA"; + case S_STROPHA_AUCTA: + return "S_STROPHA_AUCTA"; + case S_DISTROPHA: + return "S_DISTROPHA"; + case S_DISTROPHA_AUCTA: + return "S_DISTROPHA_AUCTA"; + case S_TRISTROPHA: + return "S_TRISTROPHA"; + case S_TRISTROPHA_AUCTA: + return "S_TRISTROPHA_AUCTA"; + case S_QUADRATUM: + return "S_QUADRATUM"; + case S_PUNCTUM_CAVUM: + return "S_PUNCTUM_CAVUM"; + case S_LINEA_PUNCTUM: + return "S_LINEA_PUNCTUM"; + case S_LINEA_PUNCTUM_CAVUM: + return "S_LINEA_PUNCTUM_CAVUM"; + case S_LINEA: + return "S_LINEA"; + case S_PUNCTUM_CAVUM_INCLINATUM: + return "S_PUNCTUM_CAVUM_INCLINATUM"; + case S_PUNCTUM_CAVUM_INCLINATUM_AUCTUS: + return "S_PUNCTUM_CAVUM_INCLINATUM_AUCTUS"; + default: + return "unknown"; + } +} + +static const char *dump_signs(gregorio_sign signs) +{ + switch (signs) { + case _NO_SIGN: + return "_NO_SIGN"; + case _PUNCTUM_MORA: + return "_PUNCTUM_MORA"; + case _AUCTUM_DUPLEX: + return "_AUCTUM_DUPLEX"; + case _V_EPISEMA: + return "_V_EPISEMA"; + case _V_EPISEMA_PUNCTUM_MORA: + return "_V_EPISEMA_PUNCTUM_MORA"; + case _V_EPISEMA_AUCTUM_DUPLEX: + return "_V_EPISEMA_AUCTUM_DUPLEX"; + default: + return "unknown"; + } +} + +/* a function dumping special signs */ +static const char *dump_special_sign(gregorio_sign special_sign) +{ + switch (special_sign) { + case _ACCENTUS: + return "_ACCENTUS"; + case _ACCENTUS_REVERSUS: + return "_ACCENTUS_REVERSUS"; + case _CIRCULUS: + return "_CIRCULUS"; + case _SEMI_CIRCULUS: + return "_SEMI_CIRCULUS"; + case _SEMI_CIRCULUS_REVERSUS: + return "_SEMI_CIRCULUS_REVERSUS"; + case _V_EPISEMA: + return "_V_EPISEMA"; + case _V_EPISEMA_BAR_H_EPISEMA: + return "_V_EPISEMA_BAR_H_EPISEMA"; + case _BAR_H_EPISEMA: + return "_BAR_H_EPISEMA"; + default: + return "unknown"; + } +} + +static const char *dump_h_episema_size(grehepisema_size size) +{ + switch (size) { + case H_NORMAL: + return "H_NORMAL"; + case H_SMALL_LEFT: + return "H_SMALL_LEFT"; + case H_SMALL_CENTRE: + return "H_SMALL_CENTRE"; + case H_SMALL_RIGHT: + return "H_SMALL_RIGHT"; + } + return "unknown"; +} + +static const char *dump_bool(bool value) { + return value? "true" : "false"; +} + +static const char *dump_vposition(gregorio_vposition vpos) { + switch (vpos) { + case VPOS_AUTO: + return "VPOS_AUTO"; + case VPOS_ABOVE: + return "VPOS_ABOVE"; + case VPOS_BELOW: + return "VPOS_BELOW"; + } + return "unknown"; +} + +static const char *dump_pitch(const char height) { + static char buf[20]; + if (height >= LOWEST_PITCH && height <= HIGHEST_PITCH) { + gregorio_snprintf(buf, 20, "%c", height + 'a' - LOWEST_PITCH); + } else { + gregorio_snprintf(buf, 20, "?%d", height); + } + return buf; +} + +void dump_write_score(FILE *f, gregorio_score *score) +{ + gregorio_voice_info *voice_info = score->first_voice_info; + int i; + int annotation_num; + gregorio_syllable *syllable; + + if (!f) { + gregorio_message(_("call with NULL file"), "gregoriotex_write_score", + VERBOSITY_ERROR, 0); + return; + } + fprintf(f, + "=====================================================================\n" + " SCORE INFOS\n" + "=====================================================================\n"); + if (score->number_of_voices) { + fprintf(f, " number_of_voices %d\n", + score->number_of_voices); + } + if (score->name) { + fprintf(f, " name %s\n", score->name); + } + if (score->gabc_copyright) { + fprintf(f, " gabc_copyright %s\n", score->gabc_copyright); + } + if (score->score_copyright) { + fprintf(f, " score_copyright %s\n", score->score_copyright); + } + if (score->office_part) { + fprintf(f, " office_part %s\n", score->office_part); + } + if (score->occasion) { + fprintf(f, " occasion %s\n", score->occasion); + } + if (score->meter) { + fprintf(f, " meter %s\n", score->meter); + } + if (score->commentary) { + fprintf(f, " commentary %s\n", score->commentary); + } + if (score->arranger) { + fprintf(f, " arranger %s\n", score->arranger); + } + if (score->si.author) { + fprintf(f, " author %s\n", score->si.author); + } + if (score->si.date) { + fprintf(f, " date %s\n", score->si.date); + } + if (score->si.manuscript) { + fprintf(f, " manuscript %s\n", score->si.manuscript); + } + if (score->si.manuscript_reference) { + fprintf(f, " manuscript_reference %s\n", + score->si.manuscript_reference); + } + if (score->si.manuscript_storage_place) { + fprintf(f, " manuscript_storage_place %s\n", + score->si.manuscript_storage_place); + } + if (score->si.book) { + fprintf(f, " book %s\n", score->si.book); + } + if (score->si.transcriber) { + fprintf(f, " transcriber %s\n", score->si.transcriber); + } + if (score->si.transcription_date) { + fprintf(f, " transcription_date %s\n", + score->si.transcription_date); + } + if (score->gregoriotex_font) { + fprintf(f, " gregoriotex_font %s\n", + score->gregoriotex_font); + } + if (score->mode) { + fprintf(f, " mode %d\n", score->mode); + } + if (score->initial_style) { + fprintf(f, " initial_style %d\n", score->initial_style); + } + if (score->nabc_lines) { + fprintf (f, " nabc_lines %d\n", (int)score->nabc_lines); + } + if (score->user_notes) { + fprintf(f, " user_notes %s\n", score->user_notes); + } + fprintf(f, "\n\n" + "=====================================================================\n" + " VOICES INFOS\n" + "=====================================================================\n"); + for (i = 0; i < score->number_of_voices; i++) { + fprintf(f, " Voice %d\n", i + 1); + if (voice_info->initial_key) { + fprintf(f, " initial_key %d (%s)\n", + voice_info->initial_key, + dump_key_to_char(voice_info->initial_key)); + if (voice_info->flatted_key) { + fprintf(f, " flatted_key true\n"); + } + } + for (annotation_num = 0; annotation_num < MAX_ANNOTATIONS; + ++annotation_num) { + if (score->annotation[annotation_num]) { + fprintf(f, " annotation %s\n", + score->annotation[annotation_num]); + } + } + if (voice_info->style) { + fprintf(f, " style %s\n", voice_info->style); + } + if (voice_info->virgula_position) { + fprintf(f, " virgula_position %s\n", + voice_info->virgula_position); + } + voice_info = voice_info->next_voice_info; + } + fprintf(f, "\n\n" + "=====================================================================\n" + " SCORE\n" + "=====================================================================\n"); + 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)); + } + if (syllable->position) { + fprintf(f, " position %d (%s)\n", + syllable->position, + dump_syllable_position(syllable->position)); + } + if (syllable->special_sign) { + fprintf(f, " special sign %s\n", + dump_special_sign(syllable->special_sign)); + } + if (syllable->no_linebreak_area != NLBA_NORMAL) { + fprintf(f, " no line break area %s\n", + dump_nlba_to_string(syllable->no_linebreak_area)); + } + if (syllable->text) { + if (syllable->translation) { + fprintf(f, "\n Text\n"); + } + dump_write_characters(f, syllable->text); + } + if ((syllable->translation + && syllable->translation_type != TR_WITH_CENTER_END) + || syllable->translation_type == TR_WITH_CENTER_END) { + fprintf(f, "\n Translation type %s", + dump_translation_type_to_string + (syllable->translation_type)); + if (syllable->translation_type == TR_WITH_CENTER_END) { + fprintf(f, "\n"); + } + } + if (syllable->translation) { + fprintf(f, "\n Translation\n"); + dump_write_characters(f, syllable->translation); + } + if (syllable->abovelinestext) { + fprintf(f, "\n Abovelinestext\n %s", syllable->abovelinestext); + } + for (element = *syllable->elements; element; element = element->next) { + gregorio_glyph *glyph; + fprintf(f, "---------------------------------------------------------------------\n"); + if (element->type) { + fprintf(f, " type %d (%s)\n", + element->type, dump_type(element->type)); + } + switch (element->type) { + case GRE_CUSTOS: + if (element->u.misc.pitched.pitch) { + fprintf(f, " pitch %s\n", + dump_pitch(element->u.misc.pitched.pitch)); + } + if (element->u.misc.pitched.force_pitch) { + fprintf(f, " force_pitch true\n"); + } + break; + case GRE_SPACE: + if (element->u.misc.unpitched.info.space) { + fprintf(f, " space %d (%s)\n", + element->u.misc.unpitched.info.space, + dump_space_type(element->u.misc.unpitched.info. + space)); + } + break; + case GRE_TEXVERB_ELEMENT: + fprintf(f, " TeX string \"%s\"\n", + element->texverb); + break; + case GRE_NLBA: + fprintf(f, " nlba %d (%s)\n", + element->u.misc.unpitched.info.nlba, + dump_nlba_to_string(element->u.misc.unpitched.info. + nlba)); + break; + case GRE_ALT: + fprintf(f, " Above lines text \"%s\"\n", + element->texverb); + break; + case GRE_BAR: + if (element->u.misc.unpitched.info.bar) { + fprintf(f, " bar %d (%s)\n", + element->u.misc.unpitched.info.bar, + dump_bar_type(element->u.misc.unpitched.info.bar)); + if (element->u.misc.unpitched.special_sign) { + fprintf(f, " special sign %d (%s)\n", + element->u.misc.unpitched.special_sign, + dump_special_sign(element->u.misc.unpitched. + special_sign)); + } + } + break; + case GRE_C_KEY_CHANGE: + if (element->u.misc.pitched.pitch) { + fprintf(f, " clef %d (c%d)\n", + element->u.misc.pitched.pitch, + element->u.misc.pitched.pitch - '0'); + if (element->u.misc.pitched.flatted_key) { + fprintf(f, " flatted_key true\n"); + } + } + break; + case GRE_F_KEY_CHANGE: + if (element->u.misc.pitched.pitch) { + fprintf(f, " clef %d (f%d)\n", + element->u.misc.pitched.pitch, + element->u.misc.pitched.pitch - '0'); + if (element->u.misc.pitched.flatted_key) { + fprintf(f, " flatted_key true\n"); + } + } + break; + case GRE_END_OF_LINE: + if (element->u.misc.unpitched.info.sub_type) { + fprintf(f, " sub_type %d (%s)\n", + element->u.misc.unpitched.info.sub_type, + dump_type(element->u.misc.unpitched.info.sub_type)); + } + break; + case GRE_ELEMENT: + for (glyph = element->u.first_glyph; glyph; + glyph = glyph->next) { + gregorio_note *note; + fprintf(f, "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"); + if (glyph->type) { + fprintf(f, " type %d (%s)\n", + glyph->type, dump_type(glyph->type)); + } + switch (glyph->type) { + case GRE_TEXVERB_GLYPH: + fprintf(f, " TeX string \"%s\"\n", + glyph->texverb); + break; + + case GRE_SPACE: + fprintf(f, " space %d (%s)\n", + glyph->u.misc.unpitched.info.space, + dump_space_type(glyph->u.misc.unpitched.info. + space)); + break; + + case GRE_BAR: + fprintf(f, " glyph_type %d (%s)\n", + glyph->u.misc.unpitched.info.bar, + dump_bar_type(glyph->u.misc.unpitched.info. + bar)); + if (glyph->u.misc.unpitched.special_sign) { + fprintf(f, " special sign %d (%s)\n", + glyph->u.misc.unpitched.special_sign, + dump_special_sign(glyph->u.misc.unpitched. + special_sign)); + } + break; + + case GRE_FLAT: + case GRE_NATURAL: + case GRE_SHARP: + fprintf(f, " pitch %s\n", + dump_pitch(glyph->u.misc.pitched.pitch)); + break; + + case GRE_GLYPH: + fprintf(f, " glyph_type %d (%s)\n", + glyph->u.notes.glyph_type, + dump_glyph_type(glyph->u.notes.glyph_type)); + if (glyph->u.notes.liquescentia) { + fprintf(f, " liquescentia %d (%s)\n", + glyph->u.notes.liquescentia, + dump_liquescentia(glyph->u.notes. + liquescentia)); + } + break; + + default: + fprintf(f, " !!! UNKNOWN !!! !!!\n"); + break; + } + if (glyph->type == GRE_GLYPH) { + for (note = glyph->u.notes.first_note; note; + note = note->next) { + fprintf(f, "- - - - - - - - - - - - - - - - - - - - - - - \n"); + if (note->type) { + fprintf(f, " type %d (%s)\n", + note->type, dump_type(note->type)); + } + switch (note->type) { + case GRE_NOTE: + if (note->u.note.pitch) { + fprintf(f, " pitch %s\n", + dump_pitch(note->u.note.pitch)); + } + if (note->u.note.shape) { + fprintf(f, " shape %d (%s)\n", + note->u.note.shape, + dump_shape(note->u.note.shape)); + } + if (note->u.note.liquescentia) { + fprintf(f, " liquescentia %d (%s)\n", + note->u.note.liquescentia, + dump_liquescentia(note->u.note. + liquescentia)); + } + break; + + default: + fprintf(f, " !!! NOT ALLOWED !!! !!!\n"); + break; + } + if (note->texverb) { + fprintf(f, " TeX string \"%s\"\n", + note->texverb); + } + if (note->choral_sign) { + fprintf(f, " Choral Sign \"%s\"\n", + note->choral_sign); + } + if (note->signs) { + fprintf(f, " signs %d (%s)\n", + note->signs, dump_signs(note->signs)); + } + if (note->signs & _V_EPISEMA && note->v_episema_height) { + if (note->v_episema_height < note->u.note.pitch) { + fprintf(f, " v episema forced BELOW\n"); + } + else { + fprintf(f, " v episema forced ABOVE\n"); + } + } + if ((note->signs == _PUNCTUM_MORA + || note->signs == _V_EPISEMA_PUNCTUM_MORA) + && note->mora_vposition) { + fprintf(f, " mora vposition %s\n", + dump_vposition(note->mora_vposition)); + } + if (note->special_sign) { + fprintf(f, " special sign %d (%s)\n", + note->special_sign, + dump_special_sign(note->special_sign)); + } + if (note->h_episema_above == HEPISEMA_AUTO + && note->h_episema_below == HEPISEMA_AUTO) { + fprintf(f, " auto hepisema size %d (%s)\n", + note->h_episema_above_size, + dump_h_episema_size(note->h_episema_above_size)); + fprintf(f, " auto hepisema bridge %s\n", + dump_bool(note->h_episema_above_connect)); + } + else { + if (note->h_episema_above == HEPISEMA_FORCED) { + fprintf(f, " above hepisema size %d (%s)\n", + note->h_episema_above_size, + dump_h_episema_size(note->h_episema_above_size)); + fprintf(f, " above hepisema bridge %s\n", + dump_bool(note->h_episema_above_connect)); + } + if (note->h_episema_below == HEPISEMA_FORCED) { + fprintf(f, " below hepisema size %d (%s)\n", + note->h_episema_below_size, + dump_h_episema_size(note->h_episema_below_size)); + fprintf(f, " below hepisema bridge %s\n", + dump_bool(note->h_episema_below_connect)); + } + } + } + } + } + break; + + default: + /* do nothing */ + break; + } + if (element->nabc_lines) { + fprintf(f, " nabc_lines %d\n", + (int)element->nabc_lines); + } + if (element->nabc_lines && element->nabc) { + for (i = 0; i < (int)element->nabc_lines; i++) { + if (element->nabc[i]) { + fprintf(f, " nabc_line %d \"%s\"\n", + (int)(i+1), element->nabc[i]); + } + } + } + } + fprintf(f, "=====================================================================\n"); + } +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/encode_utf8strings.c b/Build/source/texk/gregorio/gregorio-src/src/encode_utf8strings.c new file mode 100644 index 00000000000..d932a9aeb4a --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/encode_utf8strings.c @@ -0,0 +1,75 @@ +/* + * Utility program to convert utf8strings.h.in into utf8strings.h + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdio.h> +#include <string.h> +#include <errno.h> + +int main(int argc, char **argv) +{ + char buf[5]; + FILE *input, *output; + int c; + + if (argc != 3) { + fprintf(stderr, "Incorrect arguments\n"); + return -1; + } + + input = fopen(argv[1], "rb"); + if (input == NULL) { + fprintf(stderr, "Error opening %s: %s\n", argv[1], strerror(errno)); + return -1; + } + + output = fopen(argv[2], "wb"); + if (output == NULL) { + fprintf(stderr, "Error creating %s: %s\n", argv[2], strerror(errno)); + return -1; + } + + while ((c = fgetc(input)) != EOF) { + if (c & 0x80) { + snprintf(buf, sizeof(buf), "\\%03o", c); + if (fwrite(buf, sizeof(buf) - sizeof(char), 1, output) != 1) { + fprintf(stderr, "Error writing %s: %s\n", argv[2], + strerror(errno)); + return -1; + } + } else { + if (fputc(c, output) != c) { + fprintf(stderr, "Error writing %s: %s\n", argv[2], + strerror(errno)); + return -1; + } + } + } + + if (fclose(output) != 0) { + fprintf(stderr, "Error closing %s: %s\n", argv[2], strerror(errno)); + return -1; + } + if (fclose(input) != 0) { + fprintf(stderr, "Error closing %s: %s\n", argv[1], strerror(errno)); + return -1; + } + return 0; +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-elements-determination.c b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-elements-determination.c new file mode 100644 index 00000000000..3991760f8ee --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-elements-determination.c @@ -0,0 +1,284 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX. + * This file provides functions for determining elements from notes. + * + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include "bool.h" +#include "struct.h" +#include "messages.h" + +#include "gabc.h" + +/* + * + * two inline functions that will be useful in the future: they are the tests + * to put in a if statement to determine if a glyph type is puncta incliata + * ascendens or descendens + * + */ + +static __inline bool is_puncta_ascendens(char glyph) +{ + return glyph == G_2_PUNCTA_INCLINATA_ASCENDENS + || glyph == G_3_PUNCTA_INCLINATA_ASCENDENS + || glyph == G_4_PUNCTA_INCLINATA_ASCENDENS + || glyph == G_5_PUNCTA_INCLINATA_ASCENDENS + || glyph == G_PUNCTUM_INCLINATUM; +} + +static __inline bool is_puncta_descendens(char glyph) +{ + return glyph == G_2_PUNCTA_INCLINATA_DESCENDENS + || glyph == G_3_PUNCTA_INCLINATA_DESCENDENS + || glyph == G_4_PUNCTA_INCLINATA_DESCENDENS + || glyph == G_5_PUNCTA_INCLINATA_DESCENDENS + || glyph == G_PUNCTUM_INCLINATUM; +} + +/* + * + * A function that will be called several times: it adds an element to the + * current element current_element: the current_element in the determination, + * it will be updated to the element that we will add first_glyph: the + * first_glyph of the element that we will add current_glyph: the last glyph + * that will be in the element + * + */ + +static void close_element(gregorio_element **current_element, + gregorio_glyph **const first_glyph, + const gregorio_glyph *const current_glyph) +{ + gregorio_add_element(current_element, *first_glyph); + if (*first_glyph && (*first_glyph)->previous) { + (*first_glyph)->previous->next = NULL; + (*first_glyph)->previous = NULL; + } + *first_glyph = current_glyph->next; +} + +/* + * + * inline function to automatically do two or three things + * + */ +static __inline void cut_before(gregorio_glyph *current_glyph, + gregorio_glyph **first_glyph, + gregorio_glyph **previous_glyph, + gregorio_element **current_element) +{ + if (*first_glyph != current_glyph) { + close_element(current_element, first_glyph, current_glyph); + /* yes, this is changing value close_element sets for first_glyph */ + *first_glyph = current_glyph; + *previous_glyph = current_glyph; + } +} + +/* + * + * The big function of the file, but rather simple I think. + * + */ + +static gregorio_element *gabc_det_elements_from_glyphs( + gregorio_glyph *current_glyph) +{ + /* the last element we have successfully added to the list of elements */ + gregorio_element *current_element = NULL; + /* the first element, that we will return at the end. We have to consider + * it because the gregorio_element struct does not have previous_element + * element. */ + gregorio_element *first_element = NULL; + /* the first_glyph of the element that we are currently determining */ + gregorio_glyph *first_glyph = current_glyph; + /* the last real (GRE_GLYPH) that we have processed, often the same as + * first_glyph */ + gregorio_glyph *previous_glyph = current_glyph; + /* a char that is necessary to determine some cases */ + bool do_not_cut = false; + /* a char that is necesarry to determine the type of the current_glyph */ + char current_glyph_type; + + if (!current_glyph) { + return NULL; + } + /* first we go to the first glyph in the chained list of glyphs (maybe to + * suppress ?) */ + gregorio_go_to_first_glyph(¤t_glyph); + + while (current_glyph) { + if (current_glyph->type != GRE_GLYPH) { + /* we ignore flats and naturals, except if they are alone */ + if (current_glyph->type == GRE_NATURAL + || current_glyph->type == GRE_FLAT + || current_glyph->type == GRE_SHARP) { + if (!current_glyph->next) { + first_element = current_element; + close_element(¤t_element, &first_glyph, current_glyph); + } + current_glyph = current_glyph->next; + continue; + } + /* we must not cut after a zero_width_space */ + if (current_glyph->type == GRE_SPACE + && current_glyph->u.misc.unpitched.info.space == SP_ZERO_WIDTH) { + if (!current_glyph->next) { + close_element(¤t_element, &first_glyph, current_glyph); + } + current_glyph = current_glyph->next; + do_not_cut = true; + continue; + } + /* we must not cut after a zero_width_space */ + if (current_glyph->type == GRE_TEXVERB_GLYPH) { + if (!current_glyph->next) { + close_element(¤t_element, &first_glyph, current_glyph); + } + current_glyph = current_glyph->next; + continue; + } + /* clef change or space or end of line */ + cut_before(current_glyph, &first_glyph, &previous_glyph, + ¤t_element); + /* if statement to make neumatic cuts not appear in elements, as + * there is always one between elements */ + if (current_glyph->type != GRE_SPACE + || current_glyph->u.misc.unpitched.info.space != SP_NEUMATIC_CUT) + /* clef change or space other thant neumatic cut */ + { + if (!first_element) { + first_element = current_element; + } + gregorio_add_misc_element(¤t_element, current_glyph->type, + current_glyph->u.misc, + current_glyph->texverb); + } + first_glyph = current_glyph->next; + previous_glyph = current_glyph->next; + current_glyph->texverb = NULL; + gregorio_free_one_glyph(¤t_glyph); + continue; + } + + if (is_puncta_ascendens(current_glyph->type)) { + current_glyph_type = G_PUNCTA_ASCENDENS; + } else { + if (is_puncta_descendens(current_glyph->type)) { + current_glyph_type = G_PUNCTA_DESCENDENS; + } else { + current_glyph_type = current_glyph->type; + } + } + switch (current_glyph_type) { + case G_PUNCTA_ASCENDENS: + if (!do_not_cut) { + cut_before(current_glyph, &first_glyph, &previous_glyph, + ¤t_element); + do_not_cut = true; + } else { + previous_glyph = current_glyph; + } + break; + case G_PUNCTA_DESCENDENS: + /* we don't cut before, so we don't do anything */ + if (do_not_cut) { + do_not_cut = false; + } + break; + case G_ONE_NOTE: + if (current_glyph->u.notes.first_note + && (current_glyph->u.notes.first_note->u.note.shape == S_STROPHA + || current_glyph->u.notes.first_note->u.note.shape == S_VIRGA + || current_glyph->u.notes.first_note->u.note.shape == S_VIRGA_REVERSA)) { + /* we determine the last pitch */ + char last_pitch; + gregorio_note *tmp_note; + tmp_note = previous_glyph->u.notes.first_note; + while (tmp_note->next) { + tmp_note = tmp_note->next; + } + last_pitch = tmp_note->u.note.pitch; + if (current_glyph->u.notes.first_note->u.note.pitch == last_pitch) { + previous_glyph = current_glyph; + break; + } + } + /* else we fall in the default case */ + default: + if (do_not_cut) { + do_not_cut = false; + } else { + cut_before(current_glyph, &first_glyph, &previous_glyph, + ¤t_element); + } + } + /* + * we must determine the first element, that we will return + */ + if (!first_element && current_element) { + first_element = current_element; + } + if (!current_glyph->next) { + close_element(¤t_element, &first_glyph, current_glyph); + } + current_glyph = current_glyph->next; + } /* end of while */ + + /* + * we must determine the first element, that we will return + */ + if (!first_element && current_element) { + first_element = current_element; + } + return first_element; +} + +/* + * + * Two "hat" functions, they permit to have a good API. They amost don't do + * anything except calling the det_elements_from_glyphs. + * + * All those functions change the current_key, according to the possible new + * values (with key changes) + * + */ + +static gregorio_element *gabc_det_elements_from_notes( + gregorio_note *current_note, int *current_key) +{ + gregorio_element *final = NULL; + gregorio_glyph *tmp = gabc_det_glyphs_from_notes(current_note, current_key); + final = gabc_det_elements_from_glyphs(tmp); + return final; +} + +gregorio_element *gabc_det_elements_from_string(char *const str, int *const current_key, + char *macros[10], gregorio_scanner_location *const loc) +{ + gregorio_element *final; + gregorio_note *tmp; + tmp = gabc_det_notes_from_string(str, macros, loc); + final = gabc_det_elements_from_notes(tmp, current_key); + return final; +} + diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-glyphs-determination.c b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-glyphs-determination.c new file mode 100644 index 00000000000..37328ee1d95 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-glyphs-determination.c @@ -0,0 +1,1006 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file provides functions for determining glyphs from notes. + * + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <assert.h> +#include "bool.h" +#include "struct.h" +#include "messages.h" + +#include "gabc.h" + +static __inline gregorio_scanner_location *copy_note_location( + const gregorio_note *const note, gregorio_scanner_location *const loc) +{ + loc->first_line = note->src_line; + loc->first_column = note->src_column; + loc->first_offset = note->src_offset; + loc->last_line = note->src_line; + loc->last_column = note->src_column; + loc->last_offset = note->src_offset; + return loc; +} + +/**************************** + * + * First see the comments of + * gabc_det_glyphs_from_notes. This function is used when + * we have finished to determine a glyph. We have the last glyph that + * have been added: last_glyph. The glyph we want to add is given by + * glyph_type and liquescentia. + * + * The glyph we want to add goes from first_note to current_note, we + * isolate these notes from the notes that won't be in the glyph, and + * we add the glyph to the list_of_glyphs. + * +****************************/ + +static gregorio_note *close_glyph(gregorio_glyph **last_glyph, + gregorio_glyph_type glyph_type, gregorio_note **first_note, + gregorio_liquescentia liquescentia, gregorio_note *current_note) +{ + gregorio_note *new_current_note = current_note; + gregorio_scanner_location loc; + /* a variable necessary for the patch for G_BIVIRGA & co. */ + gregorio_note *added_notes = NULL; + gregorio_note *next_note = NULL; + + /* patch to have good glyph type in the case where a glyph ends by a note + * with shape S_QUADRATUM */ + if (glyph_type == G_PES_QUADRATUM_FIRST_PART + || glyph_type == G_PES_QUILISMA_QUADRATUM_FIRST_PART) { + glyph_type = G_PUNCTUM; + } + + gregorio_add_glyph(last_glyph, glyph_type, *first_note, liquescentia); + if (current_note->next) { + current_note->next->previous = NULL; + *first_note = current_note->next; + current_note->next = NULL; + } + /* here we "patch" the structure for bivirga, tristropha, etc. */ + /* the idea is not to have a S_BIVIRGA in the shape of the note (which is + * dirty) but rather a G_BIVIRGA in the glyph (which is the case now) and + * two virgas */ + + if (glyph_type == G_BIVIRGA || glyph_type == G_DISTROPHA + || glyph_type == G_TRIVIRGA || glyph_type == G_TRISTROPHA + || glyph_type == G_DISTROPHA_AUCTA + || glyph_type == G_TRISTROPHA_AUCTA) { + gregorio_go_to_first_note(¤t_note); + while (current_note) { + if (current_note->type == GRE_NOTE) { + switch (current_note->u.note.shape) { + case S_TRIVIRGA: + gregorio_add_note(&added_notes, current_note->u.note.pitch, + S_VIRGA, _NO_SIGN, L_NO_LIQUESCENTIA, current_note, + copy_note_location(current_note, &loc)); + case S_BIVIRGA: + gregorio_add_note(&added_notes, current_note->u.note.pitch, + S_VIRGA, _NO_SIGN, L_NO_LIQUESCENTIA, current_note, + copy_note_location(current_note, &loc)); + gregorio_add_note(&added_notes, current_note->u.note.pitch, + S_VIRGA, current_note->signs, + current_note->u.note.liquescentia, current_note, + copy_note_location(current_note, &loc)); + break; + case S_TRISTROPHA: + gregorio_add_note(&added_notes, current_note->u.note.pitch, + S_STROPHA, _NO_SIGN, L_NO_LIQUESCENTIA, + current_note, + copy_note_location(current_note, &loc)); + case S_DISTROPHA: + gregorio_add_note(&added_notes, current_note->u.note.pitch, + S_STROPHA, _NO_SIGN, L_NO_LIQUESCENTIA, + current_note, + copy_note_location(current_note, &loc)); + gregorio_add_note(&added_notes, current_note->u.note.pitch, + S_STROPHA, current_note->signs, + current_note->u.note.liquescentia, current_note, + copy_note_location(current_note, &loc)); + break; + case S_TRISTROPHA_AUCTA: + gregorio_add_note(&added_notes, current_note->u.note.pitch, + S_STROPHA, _NO_SIGN, L_NO_LIQUESCENTIA, + current_note, + copy_note_location(current_note, &loc)); + case S_DISTROPHA_AUCTA: + gregorio_add_note(&added_notes, current_note->u.note.pitch, + S_STROPHA, _NO_SIGN, L_NO_LIQUESCENTIA, + current_note, + copy_note_location(current_note, &loc)); + gregorio_add_note(&added_notes, current_note->u.note.pitch, + S_STROPHA_AUCTA, current_note->signs, + current_note->u.note.liquescentia, current_note, + copy_note_location(current_note, &loc)); + break; + default: + break; + } + } + /* this is the case of two separate virga that have been spotted + * as a bivirga */ + if (!added_notes) { + break; + } + next_note = current_note->next; + /* now we have what we want, we set up the links and free the old + * note */ + if (next_note) { + current_note->next->previous = added_notes; + added_notes->next = next_note; + } + gregorio_go_to_first_note(&added_notes); + if (current_note->previous) { + current_note->previous->next = added_notes; + added_notes->previous = current_note->previous; + } else { + new_current_note = added_notes; + } + /* Detaching current_note is not strictly necessary here because we + * are effectively plucking out added_notes into its own glyph; + * however, detaching the note is safer if this behavior changes in + * the future because gregorio_free_one_note nullifies surrounding + * pointers */ + current_note->next = NULL; + current_note->previous = NULL; + gregorio_free_one_note(¤t_note); + if (!next_note) { + current_note = added_notes; + break; + } + current_note = next_note; + } + gregorio_go_to_first_note(¤t_note); + /* finally we set the just added glyph first_note to current_note */ + (*last_glyph)->u.notes.first_note = current_note; + } + return new_current_note; +} + +/* a small function to automatically determine the pitch of a custo : it is + * the pitch of the next note, but we must take care of the clef changes, as + * custo are (normally and for now) only present before clef changes. */ +/* TODO: there may be a side effect with the flated keys... */ + +static char gabc_determine_custo_pitch(gregorio_note *current_note, + int current_key) +{ + int pitch_difference = 0; + int newkey; + while (current_note) { + if (current_note->type == GRE_C_KEY_CHANGE + || current_note->type == GRE_C_KEY_CHANGE_FLATED) { + newkey = gregorio_calculate_new_key(C_KEY, + current_note->u.note.pitch - '0'); + pitch_difference = newkey - current_key; + } + if (current_note->type == GRE_F_KEY_CHANGE + || current_note->type == GRE_F_KEY_CHANGE_FLATED) { + newkey = gregorio_calculate_new_key(F_KEY, + current_note->u.note.pitch - '0'); + pitch_difference = newkey - current_key; + } + if (current_note->type == GRE_NOTE) { + pitch_difference = + (int) current_note->u.note.pitch - pitch_difference; + while (pitch_difference < LOWEST_PITCH) { + pitch_difference += 7; + } + while (pitch_difference > HIGHEST_PITCH) { + pitch_difference -= 7; + } + assert(pitch_difference >= LOWEST_PITCH + && pitch_difference <= HIGHEST_PITCH); + return (char) pitch_difference; + } + current_note = current_note->next; + } + return DUMMY_PITCH; +} + +/**************************** + * + * This function is the basis of all the determination of glyphs. The + * phylosophy of the function is to say : We have a glyph that we have + * determined, and we have the following note, can we "add" it to the + * glyph, or will it be the first note of another glyph ? + * + * current_glyph_type is the type of the current_glyph (current_glyph + * as meant in gabc_det_glyphs_from_notes). curent_pitch + * is the height of the note that we want to "add" to the glyph. + * last_pitch is the height of the last note of current_glyph. shape + * is the shape of the note we want to "add" to the glyph. + * + * The function returns a char, which meaning is explained below. + * + * end_of_glyph is a pointer to the result of the determination, here + * are the meanings : + * + * DET_NO_END: we have successfully added the note to the glyph, and + * we return the new type of the glyph. We may again add notes to the + * glyph. + * + * DET_END_OF_PREVIOUS: we have not been able to add the note to the + * glyph, so we will have to close the glyph. + * + * DET_END_OF_CURRENT: we have been able to add the note to the glyph, + * but we won't be able to add more notes to the glyph, we can close + * it. The new type is returned. + + * DET_END_OF_BOTH: we have'nt been able to add the note to the glyph, + * and we won't be able to add notes to the new glyph. This special + * case is quite rare, we use it for trivirga, tristropha, etc. + + * When we encouter a S_QUADRATUM (or S_QUILISMA_QUADRATUM), we build + * a new glyph with the (temporary) shape G_PES_QUADRATUM_FIRST_PART + * (or G_PES_QUILISMA_QUADRATUM_FIRST_PART), and we wait for the next + * note. + * +****************************/ + +static char gregorio_add_note_to_a_glyph(gregorio_glyph_type current_glyph_type, + char current_pitch, char last_pitch, gregorio_shape shape, + gregorio_liquescentia liquescentia, + gregorio_note *current_glyph_first_note, + gabc_determination * end_of_glyph) +{ + + /* next glyph type is the type of the glyph that will be returned (the + * new type of the glyph with the note added to it, or the type of the + * new glyph with the note alone. */ + gregorio_glyph_type next_glyph_type = G_UNDETERMINED; + + *end_of_glyph = DET_NO_END; + + /* here we separate notes that would be logically in the same glyph + * but that are too far to be so */ + if (last_pitch) { + if (current_pitch - last_pitch > MAX_INTERVAL + || current_pitch - last_pitch < -MAX_INTERVAL) { + current_glyph_type = G_UNDETERMINED; + } + } + + switch (shape) { + case S_PUNCTUM_CAVUM: + case S_LINEA_PUNCTUM: + case S_LINEA_PUNCTUM_CAVUM: + case S_LINEA: + next_glyph_type = G_PUNCTUM; + *end_of_glyph = DET_END_OF_BOTH; + break; + case S_PUNCTUM: + /* + * we determine here the shape of the thing if it is made of puncta + */ + if (current_pitch == last_pitch) { + next_glyph_type = G_PUNCTUM; + *end_of_glyph = DET_END_OF_PREVIOUS; + break; + } + switch (current_glyph_type) { + case G_PUNCTUM: + if (current_pitch > last_pitch) { + next_glyph_type = G_PODATUS; + } else { + next_glyph_type = G_FLEXA; + } + break; + case G_PODATUS: + if (current_pitch > last_pitch) { + if (current_glyph_first_note->u.note.shape == S_PUNCTUM && + current_glyph_first_note->u.note.liquescentia != + L_INITIO_DEBILIS) { + next_glyph_type = G_SCANDICUS; + *end_of_glyph = DET_END_OF_CURRENT; + } else { + next_glyph_type = G_PUNCTUM; + *end_of_glyph = DET_END_OF_PREVIOUS; + } + } else { + next_glyph_type = G_TORCULUS; + } + break; + case G_PES_QUADRATUM_FIRST_PART: + if (current_pitch > last_pitch) { + next_glyph_type = G_PES_QUADRATUM; + *end_of_glyph = DET_END_OF_CURRENT; + } else { + next_glyph_type = G_FLEXA; + } + break; + case G_PES_QUILISMA_QUADRATUM_FIRST_PART: + if (current_pitch > last_pitch) { + next_glyph_type = G_PES_QUADRATUM; + *end_of_glyph = DET_END_OF_CURRENT; + } else { + next_glyph_type = G_PUNCTUM; + *end_of_glyph = DET_END_OF_PREVIOUS; + } + break; + case G_VIRGA_STRATA: + if (current_pitch > last_pitch) { + next_glyph_type = G_SALICUS; + *end_of_glyph = DET_END_OF_CURRENT; + } else { + next_glyph_type = G_PUNCTUM; + *end_of_glyph = DET_END_OF_PREVIOUS; + } + break; + case G_FLEXA: + if (current_pitch > last_pitch) { + next_glyph_type = G_PORRECTUS; + } else { + *end_of_glyph = DET_END_OF_CURRENT; + next_glyph_type = G_ANCUS; + } + break; + case G_TORCULUS: + if (current_pitch > last_pitch) { + next_glyph_type = G_TORCULUS_RESUPINUS; + } else if (liquescentia == L_DEMINUTUS) { + *end_of_glyph = DET_END_OF_CURRENT; + next_glyph_type = G_TORCULUS_LIQUESCENS; + } else { + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PUNCTUM; + } + break; + case G_TORCULUS_RESUPINUS: + if (current_pitch > last_pitch) { + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PUNCTUM; + } else { + *end_of_glyph = DET_END_OF_CURRENT; + next_glyph_type = G_TORCULUS_RESUPINUS_FLEXUS; + } + break; + case G_PORRECTUS: + if (current_pitch > last_pitch) { + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PUNCTUM; + } else { + *end_of_glyph = DET_END_OF_CURRENT; + next_glyph_type = G_PORRECTUS_FLEXUS; + } + break; + default: + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PUNCTUM; + break; + } + break; + case S_ORISCUS: + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PUNCTUM; + break; + case S_ORISCUS_AUCTUS: + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PUNCTUM; + break; + case S_ORISCUS_DEMINUTUS: + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PUNCTUM; + break; + case S_QUILISMA: + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PUNCTUM; + break; + case S_VIRGA: + if (current_glyph_type == G_VIRGA && last_pitch == current_pitch) { + next_glyph_type = G_BIVIRGA; + } else { + if (current_glyph_type == G_BIVIRGA && last_pitch == current_pitch) { + next_glyph_type = G_TRIVIRGA; + } else { + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_VIRGA; + } + } + break; + case S_VIRGA_REVERSA: + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_VIRGA_REVERSA; + break; + case S_BIVIRGA: + if (current_glyph_type == G_VIRGA && last_pitch == current_pitch) { + next_glyph_type = G_TRIVIRGA; + } else { + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_BIVIRGA; + } + break; + case S_TRIVIRGA: + *end_of_glyph = DET_END_OF_BOTH; + next_glyph_type = G_TRIVIRGA; + break; + case S_QUADRATUM: + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PES_QUADRATUM_FIRST_PART; + break; + case S_QUILISMA_QUADRATUM: + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PES_QUILISMA_QUADRATUM_FIRST_PART; + break; + case S_ORISCUS_SCAPUS: + if (current_glyph_type == G_PUNCTUM && last_pitch < current_pitch) { + next_glyph_type = G_VIRGA_STRATA; + } else { + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PUNCTUM; + } + break; + case S_PUNCTUM_INCLINATUM: + case S_PUNCTUM_CAVUM_INCLINATUM: + /* + * Warning : this part of the code is specific to the + * declarations of the header file + */ + if (current_glyph_type > G_PUNCTA_INCLINATA) { + /* + * meaning that the previous glyph is not a combination of puncta + * inclinata, see header file for details + */ + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PUNCTUM_INCLINATUM; + break; + } + if (current_pitch == last_pitch) { + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_PUNCTUM_INCLINATUM; + break; + } + switch (current_glyph_type) { + case G_PUNCTUM_INCLINATUM: + if (last_pitch < current_pitch) { + next_glyph_type = G_2_PUNCTA_INCLINATA_ASCENDENS; + } else { + next_glyph_type = G_2_PUNCTA_INCLINATA_DESCENDENS; + } + break; + case G_2_PUNCTA_INCLINATA_ASCENDENS: + if (last_pitch < current_pitch) { + next_glyph_type = G_3_PUNCTA_INCLINATA_ASCENDENS; + } else { + next_glyph_type = G_TRIGONUS; + } + break; + case G_3_PUNCTA_INCLINATA_ASCENDENS: + if (last_pitch < current_pitch) { + next_glyph_type = G_4_PUNCTA_INCLINATA_ASCENDENS; + } else { + next_glyph_type = G_PUNCTA_INCLINATA; + } + break; + case G_4_PUNCTA_INCLINATA_ASCENDENS: + if (last_pitch < current_pitch) { + next_glyph_type = G_5_PUNCTA_INCLINATA_ASCENDENS; + } else { + next_glyph_type = G_PUNCTA_INCLINATA; + } + break; + case G_2_PUNCTA_INCLINATA_DESCENDENS: + if (last_pitch < current_pitch) { + next_glyph_type = G_TRIGONUS; + } else { + next_glyph_type = G_3_PUNCTA_INCLINATA_DESCENDENS; + } + break; + case G_3_PUNCTA_INCLINATA_DESCENDENS: + if (last_pitch < current_pitch) { + next_glyph_type = G_PUNCTA_INCLINATA; + } else { + next_glyph_type = G_4_PUNCTA_INCLINATA_DESCENDENS; + } + break; + case G_4_PUNCTA_INCLINATA_DESCENDENS: + if (last_pitch < current_pitch) { + next_glyph_type = G_PUNCTA_INCLINATA; + } else { + next_glyph_type = G_5_PUNCTA_INCLINATA_DESCENDENS; + } + break; + default: + next_glyph_type = G_PUNCTA_INCLINATA; + break; + } + break; + case S_STROPHA: + if (last_pitch != current_pitch) { + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_STROPHA; + break; + } + switch (current_glyph_type) { + case G_STROPHA: + next_glyph_type = G_DISTROPHA; + break; + case G_DISTROPHA: + *end_of_glyph = DET_END_OF_CURRENT; + next_glyph_type = G_TRISTROPHA; + break; + default: + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_STROPHA; + break; + } + break; + case S_DISTROPHA: + if (last_pitch == current_pitch && current_glyph_type == G_STROPHA) { + *end_of_glyph = DET_END_OF_CURRENT; + next_glyph_type = G_TRISTROPHA; + } else { + *end_of_glyph = DET_END_OF_PREVIOUS; + next_glyph_type = G_DISTROPHA; + } + break; + case S_TRISTROPHA: + *end_of_glyph = DET_END_OF_BOTH; + next_glyph_type = G_TRISTROPHA; + break; + default: + break; + } + /* end of the main switch */ + + if (current_glyph_type == G_UNDETERMINED) { + /* + * means that this is the first glyph or that the previous glyph has + * already been added + */ + if (*end_of_glyph == DET_END_OF_PREVIOUS) { + *end_of_glyph = DET_NO_END; + } else { + if (*end_of_glyph == DET_END_OF_BOTH) { + *end_of_glyph = DET_END_OF_CURRENT; + } + } + } + + /* + * WARNING : Ugly section of the code, just some kind of patch for it to work + * with fonts that can't handle large intervals. + */ + /* here we separate notes that would be logically in the same glyph + * but that are too far to be so, we already said to the function that + * it was not the same glyph, there we must say that the previous + * glyph has ended. */ + if (last_pitch) { + if (current_pitch - last_pitch > MAX_INTERVAL + || current_pitch - last_pitch < -MAX_INTERVAL) { + if (*end_of_glyph == DET_END_OF_CURRENT + || *end_of_glyph == DET_END_OF_BOTH) { + *end_of_glyph = DET_END_OF_BOTH; + } else { + *end_of_glyph = DET_END_OF_PREVIOUS; + } + } + } + + return next_glyph_type; +} + +/**************************** + * + * Function called with a list of gregorio_notes as argument, this + * list is determined from gabc notation by the function + * gabc_det_notes_from_string. + * + * In this function we create a list of glyphs, by determining their + * type according to the sequence of notes (we look at their height, + * shape, etc.). Each glyph has a pointer gregorio_note *first_note + * that will be filled with the good note (and notes will be cut as + * explained in the comments on close_glyph function). + * + * Here is how it works : + * current_glyph is the glyph we are currently determining, that is to + * say a glyph whose type may change according to the note we will add + * to it. + * current_note is the note we are currently dealing with. + * Let's take an example, if the list of notes is ab, the first step + * (current_glyph: undetermined, current_note: a) will be to add a to + * nothing, that will give a glyph "punctum" containing only one note: + * a. In the second step (current_glyph: punctum, current_note: b) we + * transform the glyph in "pes". + * For special notes like a key change or something, we stop the + * determination of the current glyph, we delete the note and we add + * it as a glyph. + * + * When we determine the glyphs we can encounter the shapes + * S_QUADRATUM and S_QUILISMA_QUADRATUM, which means that the + * corresponding note is the first note of a pes quadratum (it can + * have the shape quilisma for very rare forms). But these shapes must + * not appear in the final form of the score, and we transform them + * respectively in punctum and quilisma (and the glyph type must be + * pes_quadratum, but it is done in gregorio_add_note_to_a_glyph). + * +****************************/ + +/* this function updates current_key with the new values (with clef changes) */ + +gregorio_glyph *gabc_det_glyphs_from_notes(gregorio_note *current_note, + int *current_key) +{ + /* the first note of the current glyph, to be able to close it well: + * later we will cut the link (next_notes and previous_note) between + * this note and the previous one */ + gregorio_note *current_glyph_first_note = current_note; + + /* the last glyph we have totally determined. It is automatically + * updated by close_glyph(). */ + gregorio_glyph *last_glyph = NULL; + + /* type of the glyph we are currently determining */ + gregorio_glyph_type current_glyph_type = G_UNDETERMINED; + gregorio_glyph_type next_glyph_type = G_UNDETERMINED; + char last_pitch = USELESS_VALUE; + /* a variable for the signs of bars and to tell if a key is flatted or + * not */ + gregorio_note *next_note = NULL; + + /* determination of end of glyphs, see comments on + * gregorio_add_note_to_a_glyph */ + gabc_determination end_of_glyph = DET_NO_END; + + /* a char representing the liquescentia of the current glyph */ + gregorio_liquescentia liquescentia = L_NO_LIQUESCENTIA; + + if (current_note == NULL) { + return NULL; + } + + gregorio_go_to_first_note(¤t_note); + + while (current_note) { + next_note = current_note->next; + if (current_note->type != GRE_NOTE) { + gregorio_type type = current_note->type; + char pitch = USELESS_VALUE; + bool flat = false; + bool force = false; + gregorio_sign sign = _NO_SIGN; + + if (current_glyph_type != G_UNDETERMINED) { + close_glyph(&last_glyph, next_glyph_type, + ¤t_glyph_first_note, liquescentia, + current_note->previous); + current_glyph_type = G_UNDETERMINED; + liquescentia = L_NO_LIQUESCENTIA; + } + + switch (type) { + case GRE_C_KEY_CHANGE: + pitch = current_note->u.note.pitch; + *current_key = gregorio_calculate_new_key(C_KEY, pitch - '0'); + break; + + case GRE_F_KEY_CHANGE: + pitch = current_note->u.note.pitch; + *current_key = gregorio_calculate_new_key(F_KEY, pitch - '0'); + break; + + case GRE_C_KEY_CHANGE_FLATED: + pitch = current_note->u.note.pitch; + *current_key = gregorio_calculate_new_key(C_KEY, pitch - '0'); + type = GRE_C_KEY_CHANGE; + flat = true; + break; + + case GRE_F_KEY_CHANGE_FLATED: + pitch = current_note->u.note.pitch; + *current_key = gregorio_calculate_new_key(F_KEY, pitch - '0'); + type = GRE_F_KEY_CHANGE; + flat = true; + break; + + case GRE_CUSTOS: + pitch = gabc_determine_custo_pitch(current_note->next, + *current_key); + break; + + case GRE_MANUAL_CUSTOS: + pitch = current_note->u.note.pitch; + type = GRE_CUSTOS; + force = true; + break; + + case GRE_BAR: + /* we calculate the signs of the bars */ + if (current_note->signs == _V_EPISEMA) { + sign = _V_EPISEMA; + } else { + sign = current_note->special_sign; + } + if (current_note->h_episema_above) { + if (sign == _V_EPISEMA) { + sign = _V_EPISEMA_BAR_H_EPISEMA; + } else { + sign = _BAR_H_EPISEMA; + } + } + break; + + case GRE_FLAT: + case GRE_SHARP: + case GRE_NATURAL: + pitch = current_note->u.note.pitch; + break; + + default: + /* do nothing */ + break; + } + + if (pitch == USELESS_VALUE) { + gregorio_add_unpitched_element_as_glyph(&last_glyph, type, + current_note->u.other, sign, current_note->texverb); + } else { + gregorio_add_pitched_element_as_glyph(&last_glyph, type, pitch, + flat, force, current_note->texverb); + } + current_glyph_first_note = current_note->next; + current_note->texverb = NULL; + gregorio_free_one_note(¤t_note); + last_pitch = USELESS_VALUE; + continue; + } + + /* + * first we do what must be done with liquescentia + */ + if (is_initio_debilis(current_note->u.note.liquescentia)) { + /* + * meaning that the note is an initio debilis, maybe more + */ + if (current_glyph_type != G_UNDETERMINED) { + /* + * if it is not the first glyph + */ + close_glyph(&last_glyph, current_glyph_type, + ¤t_glyph_first_note, + liquescentia, current_note->previous); + current_glyph_type = G_UNDETERMINED; + } + liquescentia = L_INITIO_DEBILIS; + } + + next_glyph_type = + gregorio_add_note_to_a_glyph(current_glyph_type, + current_note->u.note.pitch, last_pitch, + current_note->u.note.shape, + current_note->u.note.liquescentia, + current_glyph_first_note, &end_of_glyph); + + /* patch to have good shapes in the special cases of pes quadratum and + * pes quilisma quadratum. */ + switch (current_note->u.note.shape) { + case S_QUADRATUM: + current_note->u.note.shape = S_PUNCTUM; + break; + + case S_QUILISMA_QUADRATUM: + current_note->u.note.shape = S_QUILISMA; + break; + + default: + /* do nothing */ + break; + } + + /* see comments on gregorio_add_note_to_a_glyph for the meaning of + * end_of_glyph */ + switch (end_of_glyph) { + case DET_NO_END: + current_glyph_type = next_glyph_type; + /* + * we deal with liquescentia + */ + if (is_liquescentia(current_note->u.note.liquescentia)) { + /* special cases of oriscus auctus, treated like normal oriscus + * in some cases. */ + if (current_note->u.note.shape == S_ORISCUS_AUCTUS + && current_note->next + && current_note->next->type == GRE_NOTE + && current_note->next->u.note.pitch < + current_note->u.note.pitch) { + last_pitch = current_note->u.note.pitch; + current_note->u.note.shape = S_ORISCUS; + current_note->u.note.liquescentia = L_NO_LIQUESCENTIA; + current_note = next_note; + continue; + } + /* special cases of the punctum inclinatum deminutus and + * auctus */ + if (current_note->u.note.shape == S_PUNCTUM_INCLINATUM) { + if (current_note->u.note.liquescentia == L_DEMINUTUS) { + current_note->u.note.shape = + S_PUNCTUM_INCLINATUM_DEMINUTUS; + } + if (current_note->u.note.liquescentia == L_AUCTA + || current_note->u.note.liquescentia == + L_AUCTUS_DESCENDENS + || current_note->u.note.liquescentia == + L_AUCTUS_ASCENDENS) { + current_note->u.note.shape = + S_PUNCTUM_INCLINATUM_AUCTUS; + } + + if (current_note->next + && current_note->next->type == GRE_NOTE + && current_note->next->u.note.shape == + S_PUNCTUM_INCLINATUM + && current_note->next->u.note.liquescentia == + L_DEMINUTUS) { + last_pitch = current_note->u.note.pitch; + current_note = next_note; + continue; + } + } + if (current_note->u.note.shape == S_PUNCTUM_CAVUM_INCLINATUM) { + switch (current_note->u.note.liquescentia) { + case L_AUCTA: + case L_AUCTUS_DESCENDENS: + case L_AUCTUS_ASCENDENS: + case L_AUCTUS_DESCENDENS_INITIO_DEBILIS: + case L_AUCTUS_ASCENDENS_INITIO_DEBILIS: + current_note->u.note.shape = + S_PUNCTUM_CAVUM_INCLINATUM_AUCTUS; + break; + + default: + /* do nothing */ + break; + } + + if (current_note->next + && current_note->next->type == GRE_NOTE + && current_note->next->u.note.shape == + S_PUNCTUM_INCLINATUM + && current_note->next->u.note.liquescentia == + L_DEMINUTUS) { + last_pitch = current_note->u.note.pitch; + current_note = next_note; + continue; + } + } + liquescentia += current_note->u.note.liquescentia; + /* once again, only works with the good values in the header + * file */ + current_note = close_glyph(&last_glyph, current_glyph_type, + ¤t_glyph_first_note, liquescentia, current_note); + current_glyph_type = G_UNDETERMINED; + liquescentia = L_NO_LIQUESCENTIA; + } + break; + case DET_END_OF_PREVIOUS: + if (current_note->previous) + { + /* we don't want to close previous glyph twice */ + close_glyph(&last_glyph, current_glyph_type, + ¤t_glyph_first_note, liquescentia, + current_note->previous); + } + current_glyph_type = next_glyph_type; + liquescentia = L_NO_LIQUESCENTIA; + last_pitch = USELESS_VALUE; + /* we deal with liquescentia */ + if (is_liquescentia(current_note->u.note.liquescentia)) + /* not an initio debilis, because we considered it in the first + * part... */ + { + /* special cases of the punctum inclinatum deminutus and + * auctus */ + if (current_note->u.note.shape == S_PUNCTUM_INCLINATUM) { + if (current_note->u.note.liquescentia == L_DEMINUTUS) { + current_note->u.note.shape = + S_PUNCTUM_INCLINATUM_DEMINUTUS; + } + if (current_note->u.note.liquescentia == L_AUCTA + || current_note->u.note.liquescentia == + L_AUCTUS_DESCENDENS + || current_note->u.note.liquescentia == + L_AUCTUS_ASCENDENS) { + current_note->u.note.shape = + S_PUNCTUM_INCLINATUM_AUCTUS; + } + if (current_note->next + && current_note->next->type == GRE_NOTE + && current_note->next->u.note.shape == + S_PUNCTUM_INCLINATUM + && current_note->next->u.note.liquescentia == + L_DEMINUTUS) { + current_note = next_note; + continue; + } + } + if (current_note->u.note.shape == S_PUNCTUM_CAVUM_INCLINATUM) { + switch (current_note->u.note.liquescentia) { + case L_AUCTA: + case L_AUCTUS_DESCENDENS: + case L_AUCTUS_ASCENDENS: + case L_AUCTUS_DESCENDENS_INITIO_DEBILIS: + case L_AUCTUS_ASCENDENS_INITIO_DEBILIS: + current_note->u.note.shape = + S_PUNCTUM_CAVUM_INCLINATUM_AUCTUS; + break; + + default: + /* do nothing */ + break; + } + + if (current_note->next + && current_note->next->type == GRE_NOTE + && current_note->next->u.note.shape == + S_PUNCTUM_INCLINATUM + && current_note->next->u.note.liquescentia == + L_DEMINUTUS) { + current_note = next_note; + continue; + } + } + current_note = close_glyph(&last_glyph, current_glyph_type, + ¤t_glyph_first_note, + current_note->u.note.liquescentia, current_note); + current_glyph_type = G_UNDETERMINED; + } + break; + case DET_END_OF_CURRENT: + liquescentia += current_note->u.note.liquescentia; + /* once again, only works with the good values in the header file */ + current_note = close_glyph(&last_glyph, next_glyph_type, + ¤t_glyph_first_note, liquescentia, current_note); + current_glyph_type = G_UNDETERMINED; + liquescentia = L_NO_LIQUESCENTIA; + break; + default: /* case DET_END_OF_BOTH: */ + if (current_note->previous) + { + /* we don't want to close previous glyph twice */ + close_glyph(&last_glyph, current_glyph_type, + ¤t_glyph_first_note, liquescentia, + current_note->previous); + } + current_glyph_type = G_UNDETERMINED; + liquescentia = L_NO_LIQUESCENTIA; + current_note = close_glyph(&last_glyph, next_glyph_type, + ¤t_glyph_first_note, + current_note->u.note.liquescentia, current_note); + break; + } + + if (!next_note && current_glyph_type != G_UNDETERMINED) { + /* we must end the determination here */ + current_note = close_glyph(&last_glyph, current_glyph_type, + ¤t_glyph_first_note, liquescentia, current_note); + } + + last_pitch = current_note->u.note.pitch; + current_note = next_note; + } + /* end of while */ + + gregorio_go_to_first_glyph(&last_glyph); + return last_glyph; +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-notes-determination-l.c b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-notes-determination-l.c new file mode 100644 index 00000000000..cf07911a96c --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-notes-determination-l.c @@ -0,0 +1,9582 @@ +#line 2 "gabc/gabc-notes-determination-l.c" + +#line 4 "gabc/gabc-notes-determination-l.c" + +#define YY_INT_ALIGNED long int + +/* A lexical scanner generated by flex */ + +#define yy_create_buffer gabc_notes_determination__create_buffer +#define yy_delete_buffer gabc_notes_determination__delete_buffer +#define yy_flex_debug gabc_notes_determination__flex_debug +#define yy_init_buffer gabc_notes_determination__init_buffer +#define yy_flush_buffer gabc_notes_determination__flush_buffer +#define yy_load_buffer_state gabc_notes_determination__load_buffer_state +#define yy_switch_to_buffer gabc_notes_determination__switch_to_buffer +#define yyin gabc_notes_determination_in +#define yyleng gabc_notes_determination_leng +#define yylex gabc_notes_determination_lex +#define yylineno gabc_notes_determination_lineno +#define yyout gabc_notes_determination_out +#define yyrestart gabc_notes_determination_restart +#define yytext gabc_notes_determination_text +#define yywrap gabc_notes_determination_wrap +#define yyalloc gabc_notes_determination_alloc +#define yyrealloc gabc_notes_determination_realloc +#define yyfree gabc_notes_determination_free + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 39 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE gabc_notes_determination_restart(gabc_notes_determination_in ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t gabc_notes_determination_leng; + +extern FILE *gabc_notes_determination_in, *gabc_notes_determination_out; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up gabc_notes_determination_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up gabc_notes_determination_text again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via gabc_notes_determination_restart()), so that the user can continue scanning by + * just pointing gabc_notes_determination_in at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when gabc_notes_determination_text is formed. */ +static char yy_hold_char; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t gabc_notes_determination_leng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow gabc_notes_determination_wrap()'s to do buffer switches + * instead of setting up a fresh gabc_notes_determination_in. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void gabc_notes_determination_restart (FILE *input_file ); +void gabc_notes_determination__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE gabc_notes_determination__create_buffer (FILE *file,int size ); +void gabc_notes_determination__delete_buffer (YY_BUFFER_STATE b ); +void gabc_notes_determination__flush_buffer (YY_BUFFER_STATE b ); +void gabc_notes_determination_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void gabc_notes_determination_pop_buffer_state (void ); + +static void gabc_notes_determination_ensure_buffer_stack (void ); +static void gabc_notes_determination__load_buffer_state (void ); +static void gabc_notes_determination__init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER gabc_notes_determination__flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE gabc_notes_determination__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE gabc_notes_determination__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE gabc_notes_determination__scan_bytes (yyconst char *bytes,yy_size_t len ); + +void *gabc_notes_determination_alloc (yy_size_t ); +void *gabc_notes_determination_realloc (void *,yy_size_t ); +void gabc_notes_determination_free (void * ); + +#define yy_new_buffer gabc_notes_determination__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + gabc_notes_determination_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + gabc_notes_determination__create_buffer(gabc_notes_determination_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + gabc_notes_determination_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + gabc_notes_determination__create_buffer(gabc_notes_determination_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define gabc_notes_determination_wrap() 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +FILE *gabc_notes_determination_in = (FILE *) 0, *gabc_notes_determination_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int gabc_notes_determination_lineno; + +int gabc_notes_determination_lineno = 1; + +extern char *gabc_notes_determination_text; +#define yytext_ptr gabc_notes_determination_text + +static yyconst flex_int32_t yy_nxt[][256] = + { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 + }, + + { + 25, 26, 26, 26, 26, 26, 26, 26, 26, 27, + 28, 26, 26, 27, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 29, 30, 26, 26, 26, 31, 26, 32, + + 26, 26, 26, 26, 33, 34, 35, 36, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 37, 38, + 39, 40, 41, 26, 26, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 26, 43, + 26, 26, 44, 26, 26, 26, 45, 46, 26, 26, + 47, 48, 26, 26, 26, 49, 50, 51, 51, 52, + 51, 51, 53, 51, 51, 51, 51, 51, 51, 51, + 26, 54, 26, 55, 56, 57, 26, 26, 58, 59, + 26, 26, 60, 61, 26, 62, 63, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26 + }, + + { + 25, 26, 26, 26, 26, 26, 26, 26, 26, 27, + 28, 26, 26, 27, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 29, 30, 26, 26, 26, 31, 26, 32, + 26, 26, 26, 26, 33, 34, 35, 36, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 37, 38, + 39, 40, 41, 26, 26, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 26, 43, + + 26, 26, 44, 26, 26, 26, 45, 46, 26, 26, + 47, 48, 26, 26, 26, 49, 50, 51, 51, 52, + 51, 51, 53, 51, 51, 51, 51, 51, 51, 51, + 26, 54, 26, 55, 56, 57, 26, 26, 58, 59, + 26, 26, 60, 61, 26, 62, 63, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26 + }, + + { + 25, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 65, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64 + }, + + { + 25, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 65, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64 + + }, + + { + 25, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 65, 66, 66, 66, 66, 66, 66, + + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66 + }, + + { + 25, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 65, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66 + }, + + { + 25, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 65, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67 + }, + + { + 25, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 65, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67 + }, + + { + 25, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 65, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68 + + }, + + { + 25, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 65, 68, 68, 68, 68, 68, 68, + + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68 + }, + + { + 25, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 65, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69 + }, + + { + 25, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 65, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69 + }, + + { + 25, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 65, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70 + }, + + { + 25, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 65, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70 + + }, + + { + 25, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 72, 71, 71, 72, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71 + }, + + { + 25, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 72, 71, 71, 72, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71 + }, + + { + 25, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 65, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73 + }, + + { + 25, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 65, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73 + }, + + { + 25, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 65, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74 + + }, + + { + 25, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 65, 74, 74, 74, 74, 74, 74, + + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74 + }, + + { + 25, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 65, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75 + }, + + { + 25, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 65, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75 + }, + + { + 25, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 65, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76 + }, + + { + 25, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 65, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76 + + }, + + { + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25 + }, + + { + 25, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26 + }, + + { + 25, -27, -27, -27, -27, -27, -27, -27, -27, 77, + 77, -27, -27, 77, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27 + }, + + { + 25, -28, -28, -28, -28, -28, -28, -28, -28, 77, + 77, -28, -28, 77, -28, -28, -28, -28, -28, -28, + + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, -28, -28 + }, + + { + 25, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29 + + }, + + { + 25, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 79, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 80, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78 + }, + + { + 25, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + + -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, + -31, -31, -31, -31, -31, -31 + }, + + { + 25, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, 81, 81, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32 + }, + + { + 25, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, 82, + 83, 84, 85, 86, 87, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33 + }, + + { + 25, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + + -34, -34, -34, -34, -34, 88, 88, 88, 88, 88, + 88, 88, 88, 88, 88, 88, 88, 88, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, 88, 88, 88, + 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, -34, -34, -34, -34, -34 + + }, + + { + 25, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, 89, 89, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, -35, -35, -35, -35, -35 + }, + + { + 25, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + + -36, -36, -36, -36, -36, -36, -36, 90, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + + -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36 + }, + + { + 25, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, 91, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37 + }, + + { + 25, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, 92, + 93, 94, 95, 96, 97, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38 + }, + + { + 25, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, 98, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + 99, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, + -39, -39, -39, -39, -39, -39 + + }, + + { + 25, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40 + }, + + { + 25, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + + -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, + -41, -41, -41, -41, -41, -41 + }, + + { + 25, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, 100, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + + -42, -42, -42, -42, -42, -42, 101, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, 102, -42, -42, 103, -42, + 104, 105, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42 + }, + + { + 25, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43 + }, + + { + 25, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, -44, -44 + + }, + + { + 25, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45 + }, + + { + 25, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46 + }, + + { + 25, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47 + }, + + { + 25, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, 106, -48, 107, + -48, 108, -48, 109, -48, -48, -48, -48, -48, -48, + 110, 111, -48, -48, -48, -48, -48, 112, -48, -48, + + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48 + }, + + { + 25, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, 113, 113, + 113, 113, 113, 113, -49, -49, -49, -49, -49, -49, + + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49 + + }, + + { + 25, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50 + }, + + { + 25, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, 100, -51, -51, -51, -51, + + -51, -51, -51, 114, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, 101, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, 102, -51, -51, 103, -51, + 104, 105, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + + -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51 + }, + + { + 25, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, 100, -52, -52, -52, -52, + -52, -52, -52, 114, -52, -52, -52, -52, -52, 115, + 115, 115, 115, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + + -52, -52, -52, -52, -52, -52, 101, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, 116, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, 102, -52, -52, 103, -52, + 104, 105, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52 + }, + + { + 25, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, 100, -53, -53, -53, -53, + -53, -53, -53, 114, -53, -53, -53, -53, -53, 115, + 115, 115, 115, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, 101, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, 116, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, 102, -53, -53, 103, -53, + + 104, 105, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53 + }, + + { + 25, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, + -54, -54, -54, -54, -54, -54 + + }, + + { + 25, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55 + }, + + { + 25, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + + -56, -56, -56, -56, -56, -56, -56, -56, 117, 118, + 119, 120, 121, 122, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56 + }, + + { + 25, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57 + }, + + { + 25, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58 + }, + + { + 25, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59 + + }, + + { + 25, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, 123, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60 + }, + + { + 25, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61 + }, + + { + 25, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62 + }, + + { + 25, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, + -63, -63, -63, -63, -63, -63 + }, + + { + 25, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, -64, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124 + + }, + + { + 25, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, + -65, -65, -65, -65, -65, -65 + }, + + { + 25, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, -66, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125 + }, + + { + 25, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, -67, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126 + }, + + { + 25, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, -68, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127 + }, + + { + 25, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, -69, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128 + + }, + + { + 25, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, -70, 129, 129, 129, 129, 129, 129, + + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129 + }, + + { + 25, 130, 130, 130, 130, 130, 130, 130, 130, 130, + -71, 130, 130, -71, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130 + }, + + { + 25, -72, -72, -72, -72, -72, -72, -72, -72, -72, + 131, -72, -72, 131, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, + -72, -72, -72, -72, -72, -72 + }, + + { + 25, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, -73, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132 + }, + + { + 25, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, -74, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133 + + }, + + { + 25, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, -75, 134, 134, 134, 134, 134, 134, + + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134 + }, + + { + 25, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, -76, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135 + }, + + { + 25, -77, -77, -77, -77, -77, -77, -77, -77, 77, + 77, -77, -77, 77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, + -77, -77, -77, -77, -77, -77 + }, + + { + 25, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78 + }, + + { + 25, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79 + + }, + + { + 25, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, 136, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, + -80, -80, -80, -80, -80, -80 + }, + + { + 25, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + + -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, + -81, -81, -81, -81, -81, -81 + }, + + { + 25, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, + -82, -82, -82, -82, -82, -82 + }, + + { + 25, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83 + }, + + { + 25, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84 + + }, + + { + 25, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, + -85, -85, -85, -85, -85, -85 + }, + + { + 25, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + + -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, + -86, -86, -86, -86, -86, -86 + }, + + { + 25, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, + -87, -87, -87, -87, -87, -87 + }, + + { + 25, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88 + }, + + { + 25, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, + -89, -89, -89, -89, -89, -89 + + }, + + { + 25, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90 + }, + + { + 25, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + + -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91 + }, + + { + 25, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, -92 + }, + + { + 25, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93 + }, + + { + 25, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94 + + }, + + { + 25, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95 + }, + + { + 25, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + + -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, + -96, -96, -96, -96, -96, -96 + }, + + { + 25, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, + -97, -97, -97, -97, -97, -97 + }, + + { + 25, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + 137, -98, -98, -98, -98, -98, -98, -98, -98, -98, + + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98 + }, + + { + 25, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, 138, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, + -99, -99, -99, -99, -99, -99 + + }, + + { + 25, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100 + }, + + { + 25, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, 139, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101 + }, + + { + 25, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, 140, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102 + }, + + { + 25, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, 141, -103, + + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103 + }, + + { + 25, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104 + + }, + + { + 25, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105 + }, + + { + 25, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, 142, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106 + }, + + { + 25, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + 143, -107, -107, -107, -107, 144, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, + -107, -107, -107, -107, -107, -107 + }, + + { + 25, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, 145, + -108, -108, -108, -108, -108, -108, -108, -108, 146, -108, + + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, + -108, -108, -108, -108, -108, -108 + }, + + { + 25, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, 147, + -109, -109, -109, -109, -109, -109, -109, -109, 148, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, + -109, -109, -109, -109, -109, -109 + + }, + + { + 25, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + + -110, -110, -110, -110, -110, -110, -110, -110, -110, 149, + -110, -110, -110, -110, -110, -110, -110, -110, 150, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, + -110, -110, -110, -110, -110, -110 + }, + + { + 25, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, 151, 152, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111 + }, + + { + 25, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, 153, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112 + }, + + { + 25, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, 113, 113, + 113, 113, 113, 113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113 + }, + + { + 25, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114 + + }, + + { + 25, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, + -115, -115, -115, -115, -115, -115 + }, + + { + 25, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + + -116, -116, -116, -116, -116, -116, -116, -116, -116, 154, + 154, 154, 154, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + + -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, + -116, -116, -116, -116, -116, -116 + }, + + { + 25, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, + -117, -117, -117, -117, -117, -117 + }, + + { + 25, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, + -118, -118, -118, -118, -118, -118 + }, + + { + 25, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, + -119, -119, -119, -119, -119, -119 + + }, + + { + 25, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120 + }, + + { + 25, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + + -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, + -121, -121, -121, -121, -121, -121 + }, + + { + 25, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, + -122, -122, -122, -122, -122, -122 + }, + + { + 25, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, + -123, -123, -123, -123, -123, -123 + }, + + { + 25, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, -124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124 + + }, + + { + 25, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, -125, 125, 125, 125, 125, 125, 125, + + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125 + }, + + { + 25, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, -126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126 + }, + + { + 25, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, -127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127 + }, + + { + 25, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, -128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128 + }, + + { + 25, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, -129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129 + + }, + + { + 25, 130, 130, 130, 130, 130, 130, 130, 130, 130, + -130, 130, 130, -130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130 + }, + + { + 25, -131, -131, -131, -131, -131, -131, -131, -131, -131, + 131, -131, -131, 131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131 + }, + + { + 25, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, -132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132 + }, + + { + 25, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, -133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133 + }, + + { + 25, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, -134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134 + + }, + + { + 25, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, -135, 135, 135, 135, 135, 135, 135, + + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 135, 135 + }, + + { + 25, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + + -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, -136, -136 + }, + + { + 25, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, 155, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, + -137, -137, -137, -137, -137, -137 + }, + + { + 25, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, 156, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, + -138, -138, -138, -138, -138, -138 + }, + + { + 25, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, 157, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, + -139, -139, -139, -139, -139, -139 + + }, + + { + 25, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + 158, -140, 158, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, 159, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -140, -140 + }, + + { + 25, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, 160, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + + -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, + -141, -141, -141, -141, -141, -141 + }, + + { + 25, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, 161, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, + -142, -142, -142, -142, -142, -142 + }, + + { + 25, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, 162, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, + -143, -143, -143, -143, -143, -143 + }, + + { + 25, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, 163, -144, + + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, + -144, -144, -144, -144, -144, -144 + + }, + + { + 25, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, 164, + 164, 164, 164, 164, 164, 164, 164, 164, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, + -145, -145, -145, -145, -145, -145 + }, + + { + 25, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, 165, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146 + }, + + { + 25, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, 166, + 166, 166, 166, 166, 166, 166, 166, 166, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147 + }, + + { + 25, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, 167, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, + -148, -148, -148, -148, -148, -148 + }, + + { + 25, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, 168, + 168, 168, 168, 168, 168, 168, 168, 168, -149, -149, + + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, + -149, -149, -149, -149, -149, -149 + + }, + + { + 25, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, 169, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150 + }, + + { + 25, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, 170, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + + -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, + -151, -151, -151, -151, -151, -151 + }, + + { + 25, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, 171, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, + -152, -152, -152, -152, -152, -152 + }, + + { + 25, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, 172, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, + -153, -153, -153, -153, -153, -153 + }, + + { + 25, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, + -154, -154, -154, -154, -154, -154 + + }, + + { + 25, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, 173, -155, + + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, + -155, -155, -155, -155, -155, -155 + }, + + { + 25, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, 174, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + + -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, + -156, -156, -156, -156, -156, -156 + }, + + { + 25, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, + -157, -157, -157, -157, -157, -157 + }, + + { + 25, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, + -158, -158, -158, -158, -158, -158 + }, + + { + 25, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + + 175, -159, 175, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, + -159, -159, -159, -159, -159, -159 + + }, + + { + 25, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, + -160, -160, -160, -160, -160, -160 + }, + + { + 25, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, 176, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, 177, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + + -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, + -161, -161, -161, -161, -161, -161 + }, + + { + 25, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, + -162, -162, -162, -162, -162, -162 + }, + + { + 25, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, + -163, -163, -163, -163, -163, -163 + }, + + { + 25, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, 178, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, + -164, -164, -164, -164, -164, -164 + + }, + + { + 25, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, + -165, -165, -165, -165, -165, -165 + }, + + { + 25, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, 179, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + + -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, + -166, -166, -166, -166, -166, -166 + }, + + { + 25, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, + -167, -167, -167, -167, -167, -167 + }, + + { + 25, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, 180, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168 + }, + + { + 25, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, + -169, -169, -169, -169, -169, -169 + + }, + + { + 25, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, 181, 181, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, + -170, -170, -170, -170, -170, -170 + }, + + { + 25, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, 182, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, 183, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + + -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, + -171, -171, -171, -171, -171, -171 + }, + + { + 25, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, 184, 184, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, + -172, -172, -172, -172, -172, -172 + }, + + { + 25, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, 185, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, + -173, -173, -173, -173, -173, -173 + }, + + { + 25, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + + -174, -174, 186, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, + -174, -174, -174, -174, -174, -174 + + }, + + { + 25, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, + -175, -175, -175, -175, -175, -175 + }, + + { + 25, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + + -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, + -176, -176, -176, -176, -176, -176 + }, + + { + 25, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, 187, + 187, 187, 187, 187, 187, 187, 187, 187, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, + -177, -177, -177, -177, -177, -177 + }, + + { + 25, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, + -178, -178, -178, -178, -178, -178 + }, + + { + 25, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, + -179, -179, -179, -179, -179, -179 + + }, + + { + 25, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, + -180, -180, -180, -180, -180, -180 + }, + + { + 25, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, 188, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, 189, -181, 190, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181 + }, + + { + 25, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, 191, 191, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, + -182, -182, -182, -182, -182, -182 + }, + + { + 25, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, 192, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, + -183, -183, -183, -183, -183, -183 + }, + + { + 25, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, 193, + + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, 194, -184, 195, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, + -184, -184, -184, -184, -184, -184 + + }, + + { + 25, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, 196, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -185, -185, -185, -185 + }, + + { + 25, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + + -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, + -186, -186, -186, -186, -186, -186 + }, + + { + 25, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, 197, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187 + }, + + { + 25, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, + -188, -188, -188, -188, -188, -188 + }, + + { + 25, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, 198, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189 + + }, + + { + 25, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, 199, -190, -190, -190, -190, -190, -190, + + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, + -190, -190, -190, -190, -190, -190 + }, + + { + 25, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, 200, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, 201, -191, 202, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + + -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, + -191, -191, -191, -191, -191, -191 + }, + + { + 25, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, 203, 203, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, + -192, -192, -192, -192, -192, -192 + }, + + { + 25, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, + -193, -193, -193, -193, -193, -193 + }, + + { + 25, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, 204, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, + -194, -194, -194, -194, -194, -194 + + }, + + { + 25, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, 205, -195, -195, -195, -195, -195, -195, + + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, + -195, -195, -195, -195, -195, -195 + }, + + { + 25, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + + -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, + -196, -196, -196, -196, -196, -196 + }, + + { + 25, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, + -197, -197, -197, -197, -197, -197 + }, + + { + 25, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, + -198, -198, -198, -198, -198, -198 + }, + + { + 25, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, + -199, -199, -199, -199, -199, -199 + + }, + + { + 25, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, + -200, -200, -200, -200, -200, -200 + }, + + { + 25, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, 206, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + + -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, + -201, -201, -201, -201, -201, -201 + }, + + { + 25, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, 207, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, + -202, -202, -202, -202, -202, -202 + }, + + { + 25, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, 208, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + + -203, -203, -203, 209, -203, 210, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, + -203, -203, -203, -203, -203, -203 + }, + + { + 25, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, + -204, -204, -204, -204, -204, -204 + + }, + + { + 25, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, + -205, -205, -205, -205, -205, -205 + }, + + { + 25, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + + -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, + -206, -206, -206, -206, -206, -206 + }, + + { + 25, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, + -207, -207, -207, -207, -207, -207 + }, + + { + 25, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, + -208, -208, -208, -208, -208, -208 + }, + + { + 25, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, 211, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, + -209, -209, -209, -209, -209, -209 + + }, + + { + 25, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, 212, -210, -210, -210, -210, -210, -210, + + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, + -210, -210, -210, -210, -210, -210 + }, + + { + 25, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + + -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, + -211, -211, -211, -211, -211, -211 + }, + + { + 25, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, + -212, -212, -212, -212, -212, -212 + }, + + } ; + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up gabc_notes_determination_text. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + gabc_notes_determination_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 109 +#define YY_END_OF_BUFFER 110 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int32_t yy_accept[213] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 110, 108, 42, 42, 78, 108, + 1, 94, 49, 108, 96, 76, 63, 56, 99, 83, + 98, 92, 102, 66, 106, 104, 45, 108, 95, 48, + 92, 92, 92, 101, 100, 65, 107, 105, 103, 43, + 39, 40, 97, 34, 38, 35, 36, 32, 33, 37, + 3, 2, 28, 29, 30, 31, 42, 82, 81, 79, + 94, 50, 51, 52, 53, 54, 55, 93, 96, 77, + 64, 57, 58, 59, 60, 61, 62, 0, 0, 74, + + 0, 0, 0, 73, 75, 0, 0, 0, 0, 0, + 0, 0, 95, 41, 46, 0, 67, 68, 69, 70, + 71, 72, 44, 34, 35, 36, 32, 33, 37, 3, + 2, 28, 29, 30, 31, 80, 0, 0, 86, 88, + 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 47, 0, 0, 87, 89, 90, 85, + 0, 5, 4, 0, 24, 0, 23, 0, 22, 0, + 0, 0, 0, 0, 91, 25, 0, 20, 19, 18, + 0, 0, 0, 0, 0, 26, 0, 6, 0, 0, + 0, 0, 7, 0, 0, 27, 21, 10, 14, 8, + + 0, 0, 0, 11, 15, 12, 16, 9, 0, 0, + 13, 17 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +static yyconst yy_state_type yy_NUL_trans[213] = + { 0, + 26, 26, 64, 64, 66, 66, 67, 67, 68, 68, + 69, 69, 70, 70, 71, 71, 73, 73, 74, 74, + 75, 75, 76, 76, 0, 0, 0, 0, 0, 78, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 124, 0, 125, 126, 127, 128, 129, + 130, 0, 132, 133, 134, 135, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 124, 125, 126, 127, 128, 129, 130, + 0, 132, 133, 134, 135, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0 + } ; + +extern int gabc_notes_determination__flex_debug; +int gabc_notes_determination__flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *gabc_notes_determination_text; +#line 1 "gabc/gabc-notes-determination.l" +#line 2 "gabc/gabc-notes-determination.l" +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the note parser. + * + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <ctype.h> /* for tolower */ +#include "bool.h" +#include "struct.h" +#include "messages.h" +#include "support.h" + +#include "gabc.h" + +#define YY_NO_INPUT + +#define YY_USER_ACTION gabc_update_location(¬es_lloc, \ + gabc_notes_determination_text, gabc_notes_determination_leng); + +static gregorio_scanner_location notes_lloc; +static gregorio_note *current_note; +static char char_for_brace; +static unsigned int nbof_isolated_episema; +static char *notesmacros[10]; +static char tempstr[256]; +static int brace_var_counter; +static int overbrace_var, underbrace_var; +static const char *overbrace_var_kind; + +static __inline char pitch_letter_to_height(const char pitch) { + return pitch - 'a' + LOWEST_PITCH; +} + +static gregorio_shape punctum(const char pitch) +{ + if (pitch < 'a') { + return S_PUNCTUM_INCLINATUM; + } else { + return S_PUNCTUM; + } +} + +static __inline void lex_add_note(int i, gregorio_shape shape, char signs, + char liquescentia) +{ + nbof_isolated_episema = 0; + gregorio_add_note(¤t_note, + pitch_letter_to_height(tolower((unsigned char)gabc_notes_determination_text[i])), + shape, signs, liquescentia, NULL, ¬es_lloc); +} + +static __inline void add_bar_as_note(gregorio_bar bar) +{ + nbof_isolated_episema = 0; + gregorio_add_bar_as_note(¤t_note, bar, ¬es_lloc); +} + +static __inline void error(void) +{ + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("undefined macro used: m%d"), + gabc_notes_determination_text[3] - '0'); +} + +static void add_h_episema(void) { + grehepisema_size size = H_NORMAL; + gregorio_vposition vposition = VPOS_AUTO; + bool disable_bridge = false; + + char *ptr = gabc_notes_determination_text; + char current; + /* first character is the underscore */ + while ((current = *(++ptr))) { + switch(current) { + case '0': + vposition = VPOS_BELOW; + break; + case '1': + vposition = VPOS_ABOVE; + break; + case '2': + disable_bridge = true; + break; + case '3': + size = H_SMALL_LEFT; + break; + case '4': + size = H_SMALL_CENTRE; + break; + case '5': + size = H_SMALL_RIGHT; + break; + default: + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("unrecognized horizontal episema modifier: %c"), + current); + break; + }; + } + + gregorio_add_h_episema(current_note, size, vposition, disable_bridge, + &nbof_isolated_episema); +} + +static void add_sign(gregorio_sign sign) { + gregorio_vposition vposition = VPOS_AUTO; + switch(gabc_notes_determination_text[1]) { + case '0': + vposition = VPOS_BELOW; + break; + case '1': + vposition = VPOS_ABOVE; + break; + } + gregorio_add_sign(current_note, sign, vposition); +} + +static __inline void add_alteration(const gregorio_type type) { + gregorio_add_alteration_as_note(¤t_note, type, + pitch_letter_to_height(gabc_notes_determination_text[0]), + ¬es_lloc); +} + + + + + + + + + + + + +#line 7355 "gabc/gabc-notes-determination-l.c" + +#define INITIAL 0 +#define texverbnote 1 +#define texverbglyph 2 +#define texverbelement 3 +#define choralsign 4 +#define choralnabc 5 +#define alt 6 +#define comments 7 +#define overbrace 8 +#define underbrace 9 +#define overcurlybrace 10 +#define overcurlyaccentusbrace 11 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int gabc_notes_determination_lex_destroy (void ); + +int gabc_notes_determination_get_debug (void ); + +void gabc_notes_determination_set_debug (int debug_flag ); + +YY_EXTRA_TYPE gabc_notes_determination_get_extra (void ); + +void gabc_notes_determination_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *gabc_notes_determination_get_in (void ); + +void gabc_notes_determination_set_in (FILE * in_str ); + +FILE *gabc_notes_determination_get_out (void ); + +void gabc_notes_determination_set_out (FILE * out_str ); + +yy_size_t gabc_notes_determination_get_leng (void ); + +char *gabc_notes_determination_get_text (void ); + +int gabc_notes_determination_get_lineno (void ); + +void gabc_notes_determination_set_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int gabc_notes_determination_wrap (void ); +#else +extern int gabc_notes_determination_wrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + + static int yy_start_stack_ptr = 0; + static int yy_start_stack_depth = 0; + static int *yy_start_stack = NULL; + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( gabc_notes_determination_text, gabc_notes_determination_leng, 1, gabc_notes_determination_out )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( gabc_notes_determination_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( gabc_notes_determination_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, gabc_notes_determination_in))==0 && ferror(gabc_notes_determination_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(gabc_notes_determination_in); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int gabc_notes_determination_lex (void); + +#define YY_DECL int gabc_notes_determination_lex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after gabc_notes_determination_text and gabc_notes_determination_leng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! gabc_notes_determination_in ) + gabc_notes_determination_in = stdin; + + if ( ! gabc_notes_determination_out ) + gabc_notes_determination_out = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + gabc_notes_determination_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gabc_notes_determination__create_buffer(gabc_notes_determination_in,YY_BUF_SIZE ); + } + + gabc_notes_determination__load_buffer_state( ); + } + + { +#line 172 "gabc/gabc-notes-determination.l" + +#line 7579 "gabc/gabc-notes-determination-l.c" + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of gabc_notes_determination_text. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + while ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 ) + { + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + + ++yy_cp; + } + + yy_current_state = -yy_current_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos) + 1; + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 173 "gabc/gabc-notes-determination.l" +{ + BEGIN(comments); + } + YY_BREAK +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 176 "gabc/gabc-notes-determination.l" +{ + BEGIN(INITIAL); + } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 179 "gabc/gabc-notes-determination.l" +{ + /* ignored */ + } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 182 "gabc/gabc-notes-determination.l" +{ + BEGIN(choralsign); + } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 185 "gabc/gabc-notes-determination.l" +{ + BEGIN(choralnabc); + } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 188 "gabc/gabc-notes-determination.l" +{ + char_for_brace = gabc_notes_determination_text[4]-'0'; + BEGIN(overbrace); + } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 192 "gabc/gabc-notes-determination.l" +{ + char_for_brace = gabc_notes_determination_text[4]-'0'; + BEGIN(underbrace); + } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 196 "gabc/gabc-notes-determination.l" +{ + char_for_brace = gabc_notes_determination_text[5]-'0'; + BEGIN(overcurlybrace); + } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 200 "gabc/gabc-notes-determination.l" +{ + char_for_brace = gabc_notes_determination_text[6]-'0'; + BEGIN(overcurlyaccentusbrace); + } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 204 "gabc/gabc-notes-determination.l" +{ + if (overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace without termination of " + "previous overbrace")); + } else { + char_for_brace = gabc_notes_determination_text[4]-'0'; + overbrace_var = ++brace_var_counter; + overbrace_var_kind = "ob"; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{1}" + "\\GreOverBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}", + overbrace_var, char_for_brace, overbrace_var, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 220 "gabc/gabc-notes-determination.l" +{ + if (underbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable underbrace without termination of " + "previous underbrace")); + } else { + char_for_brace = gabc_notes_determination_text[4]-'0'; + underbrace_var = ++brace_var_counter; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{1}" + "\\GreUnderBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}", + underbrace_var, char_for_brace, underbrace_var, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 235 "gabc/gabc-notes-determination.l" +{ + if (overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace without termination of " + "previous overbrace")); + } else { + char_for_brace = gabc_notes_determination_text[5]-'0'; + overbrace_var = ++brace_var_counter; + overbrace_var_kind = "ocb"; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{1}" + "\\GreOverCurlyBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}{0}", + overbrace_var, char_for_brace, overbrace_var, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 251 "gabc/gabc-notes-determination.l" +{ + if (overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace without termination of " + "previous overbrace")); + } else { + char_for_brace = gabc_notes_determination_text[6]-'0'; + overbrace_var = ++brace_var_counter; + overbrace_var_kind = "ocba"; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{1}" + "\\GreOverCurlyBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}{1}", + overbrace_var, char_for_brace, overbrace_var, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 267 "gabc/gabc-notes-determination.l" +{ + if (!overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace termination without " + "variable overbrace start")); + } else if (strcmp (overbrace_var_kind, "ob")) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace started with %s " + "and terminated with ob"), + overbrace_var_kind); + } else { + char_for_brace = gabc_notes_determination_text[4]-'0'; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{2}", overbrace_var, + char_for_brace); + overbrace_var = 0; + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 286 "gabc/gabc-notes-determination.l" +{ + if (!underbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable underbrace termination without " + "variable underbrace start")); + } else { + char_for_brace = gabc_notes_determination_text[4]-'0'; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{2}", underbrace_var, + char_for_brace); + underbrace_var = 0; + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 300 "gabc/gabc-notes-determination.l" +{ + if (!overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace termination without " + "variable overbrace start")); + } else if (strcmp (overbrace_var_kind, "ocb")) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace started with %s " + "and terminated with ocb"), + overbrace_var_kind); + } else { + char_for_brace = gabc_notes_determination_text[5]-'0'; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{2}", overbrace_var, + char_for_brace); + overbrace_var = 0; + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 319 "gabc/gabc-notes-determination.l" +{ + if (!overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace termination without " + "variable overbrace start")); + } else if (strcmp (overbrace_var_kind, "ocba")) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace started with %s " + "and terminated with ocba"), + overbrace_var_kind); + } else { + char_for_brace = gabc_notes_determination_text[6]-'0'; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{2}", overbrace_var, + char_for_brace); + overbrace_var = 0; + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 338 "gabc/gabc-notes-determination.l" +{ + if (notesmacros[gabc_notes_determination_text[3]-'0']) { + gregorio_add_texverb_to_note(¤t_note, + gregorio_strdup(notesmacros[gabc_notes_determination_text[3]-'0'])); + } else error(); + } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 344 "gabc/gabc-notes-determination.l" +{ + if (notesmacros[gabc_notes_determination_text[3]-'0']) { + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(notesmacros[gabc_notes_determination_text[3]-'0']), + GRE_TEXVERB_GLYPH, ¬es_lloc); + } else error(); + } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 351 "gabc/gabc-notes-determination.l" +{ + if (notesmacros[gabc_notes_determination_text[3]-'0']) { + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(notesmacros[gabc_notes_determination_text[3]-'0']), + GRE_TEXVERB_ELEMENT, ¬es_lloc); + } else error(); + } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 358 "gabc/gabc-notes-determination.l" +{ + if (notesmacros[gabc_notes_determination_text[5]-'0']) { + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(notesmacros[gabc_notes_determination_text[5]-'0']), + GRE_TEXVERB_ELEMENT, ¬es_lloc); + } else error(); + } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 365 "gabc/gabc-notes-determination.l" +{ + BEGIN(texverbnote); + } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 368 "gabc/gabc-notes-determination.l" +{ + BEGIN(texverbglyph); + } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 371 "gabc/gabc-notes-determination.l" +{ + BEGIN(texverbelement); + } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 374 "gabc/gabc-notes-determination.l" +{ + BEGIN(alt); + } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 377 "gabc/gabc-notes-determination.l" +{ + gregorio_add_nlba_as_note(¤t_note, NLBA_BEGINNING, ¬es_lloc); + } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 380 "gabc/gabc-notes-determination.l" +{ + gregorio_add_nlba_as_note(¤t_note, NLBA_END, ¬es_lloc); + } + YY_BREAK +case 28: +/* rule 28 can match eol */ +YY_RULE_SETUP +#line 383 "gabc/gabc-notes-determination.l" +{ + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreOverBrace{%s}{0pt}{0pt}{%d}", + gabc_notes_determination_text, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + YY_BREAK +case 29: +/* rule 29 can match eol */ +YY_RULE_SETUP +#line 389 "gabc/gabc-notes-determination.l" +{ + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreUnderBrace{%s}{0pt}{0pt}{%d}", + gabc_notes_determination_text, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + YY_BREAK +case 30: +/* rule 30 can match eol */ +YY_RULE_SETUP +#line 395 "gabc/gabc-notes-determination.l" +{ + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreOverCurlyBrace{%s}{0pt}{0pt}{%d}{0}", + gabc_notes_determination_text, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + YY_BREAK +case 31: +/* rule 31 can match eol */ +YY_RULE_SETUP +#line 401 "gabc/gabc-notes-determination.l" +{ + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreOverCurlyBrace{%s}{0pt}{0pt}{%d}{1}", + gabc_notes_determination_text, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + YY_BREAK +case 32: +/* rule 32 can match eol */ +YY_RULE_SETUP +#line 407 "gabc/gabc-notes-determination.l" +{ + gregorio_add_cs_to_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text), false); + } + YY_BREAK +case 33: +/* rule 33 can match eol */ +YY_RULE_SETUP +#line 411 "gabc/gabc-notes-determination.l" +{ + gregorio_add_cs_to_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text), true); + } + YY_BREAK +case 34: +/* rule 34 can match eol */ +YY_RULE_SETUP +#line 415 "gabc/gabc-notes-determination.l" +{ + gregorio_add_texverb_to_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text)); + } + YY_BREAK +case 35: +/* rule 35 can match eol */ +YY_RULE_SETUP +#line 419 "gabc/gabc-notes-determination.l" +{ + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text), + GRE_TEXVERB_GLYPH, ¬es_lloc); + } + YY_BREAK +case 36: +/* rule 36 can match eol */ +YY_RULE_SETUP +#line 424 "gabc/gabc-notes-determination.l" +{ + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text), + GRE_TEXVERB_ELEMENT, ¬es_lloc); + } + YY_BREAK +case 37: +/* rule 37 can match eol */ +YY_RULE_SETUP +#line 429 "gabc/gabc-notes-determination.l" +{ + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text), GRE_ALT, + ¬es_lloc); + } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 434 "gabc/gabc-notes-determination.l" +{ + BEGIN(INITIAL); + } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 437 "gabc/gabc-notes-determination.l" +{ + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup("\\hbox to 0pt{"), GRE_TEXVERB_ELEMENT, + ¬es_lloc); + } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 442 "gabc/gabc-notes-determination.l" +{ + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup("\\hss%\n}%\n\\GreNoBreak\\relax "), + GRE_TEXVERB_ELEMENT, ¬es_lloc); + } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 447 "gabc/gabc-notes-determination.l" +{ + gregorio_add_manual_custos_as_note(¤t_note, + pitch_letter_to_height(gabc_notes_determination_text[0]), + ¬es_lloc); + } + YY_BREAK +case 42: +/* rule 42 can match eol */ +YY_RULE_SETUP +#line 452 "gabc/gabc-notes-determination.l" +/* ignore ends of line and tabs */; + YY_BREAK +case 43: +YY_RULE_SETUP +#line 453 "gabc/gabc-notes-determination.l" +{ + gregorio_add_end_of_line_as_note(¤t_note, GRE_END_OF_LINE, + ¬es_lloc); + } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 457 "gabc/gabc-notes-determination.l" +{ + gregorio_add_custo_as_note(¤t_note, ¬es_lloc); + } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 460 "gabc/gabc-notes-determination.l" +{ + gregorio_add_end_of_line_as_note(¤t_note, GRE_END_OF_PAR, + ¬es_lloc); + } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 464 "gabc/gabc-notes-determination.l" +{ + if (gabc_notes_determination_text[0]=='c') { + gregorio_add_clef_change_as_note(¤t_note, GRE_C_KEY_CHANGE, + gabc_notes_determination_text[1], ¬es_lloc); + } else { + gregorio_add_clef_change_as_note(¤t_note, GRE_F_KEY_CHANGE, + gabc_notes_determination_text[1], ¬es_lloc); + } + } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 473 "gabc/gabc-notes-determination.l" +{ + if (gabc_notes_determination_text[0]=='c') { + gregorio_add_clef_change_as_note(¤t_note, + GRE_C_KEY_CHANGE_FLATED, gabc_notes_determination_text[2], + ¬es_lloc); + } else { + gregorio_add_clef_change_as_note(¤t_note, + GRE_F_KEY_CHANGE_FLATED, gabc_notes_determination_text[2], + ¬es_lloc); + } + } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 484 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_VIRGULA); + } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 487 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINIMA); + } + YY_BREAK +case 50: +YY_RULE_SETUP +#line 490 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D1); + } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 493 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D2); + } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 496 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D3); + } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 499 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D4); + } + YY_BREAK +case 54: +YY_RULE_SETUP +#line 502 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D5); + } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 505 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D6); + } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 508 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR); + } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 511 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D1); + } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 514 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D2); + } + YY_BREAK +case 59: +YY_RULE_SETUP +#line 517 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D3); + } + YY_BREAK +case 60: +YY_RULE_SETUP +#line 520 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D4); + } + YY_BREAK +case 61: +YY_RULE_SETUP +#line 523 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D5); + } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 526 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MINOR_D6); + } + YY_BREAK +case 63: +YY_RULE_SETUP +#line 529 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_MAIOR); + } + YY_BREAK +case 64: +YY_RULE_SETUP +#line 532 "gabc/gabc-notes-determination.l" +{ + add_bar_as_note(B_DIVISIO_FINALIS); + } + YY_BREAK +case 65: +YY_RULE_SETUP +#line 535 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_PUNCTUM_CAVUM); + } + YY_BREAK +case 66: +YY_RULE_SETUP +#line 538 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_LINEA_PUNCTUM); + } + YY_BREAK +case 67: +YY_RULE_SETUP +#line 541 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_LINEA_PUNCTUM_CAVUM); + } + YY_BREAK +case 68: +YY_RULE_SETUP +#line 544 "gabc/gabc-notes-determination.l" +{ + gregorio_add_special_sign(current_note, _ACCENTUS); + } + YY_BREAK +case 69: +YY_RULE_SETUP +#line 547 "gabc/gabc-notes-determination.l" +{ + gregorio_add_special_sign(current_note, _ACCENTUS_REVERSUS); + } + YY_BREAK +case 70: +YY_RULE_SETUP +#line 550 "gabc/gabc-notes-determination.l" +{ + gregorio_add_special_sign(current_note, _CIRCULUS); + } + YY_BREAK +case 71: +YY_RULE_SETUP +#line 553 "gabc/gabc-notes-determination.l" +{ + gregorio_add_special_sign(current_note, _SEMI_CIRCULUS); + } + YY_BREAK +case 72: +YY_RULE_SETUP +#line 556 "gabc/gabc-notes-determination.l" +{ + gregorio_add_special_sign(current_note, _SEMI_CIRCULUS_REVERSUS); + } + YY_BREAK +case 73: +YY_RULE_SETUP +#line 559 "gabc/gabc-notes-determination.l" +{ + add_alteration(GRE_FLAT); + } + YY_BREAK +case 74: +YY_RULE_SETUP +#line 562 "gabc/gabc-notes-determination.l" +{ + add_alteration(GRE_SHARP); + } + YY_BREAK +case 75: +YY_RULE_SETUP +#line 565 "gabc/gabc-notes-determination.l" +{ + add_alteration(GRE_NATURAL); + } + YY_BREAK +case 76: +YY_RULE_SETUP +#line 568 "gabc/gabc-notes-determination.l" +{ + gregorio_add_space_as_note(¤t_note, SP_NEUMATIC_CUT, ¬es_lloc); + } + YY_BREAK +case 77: +YY_RULE_SETUP +#line 571 "gabc/gabc-notes-determination.l" +{ + gregorio_add_space_as_note(¤t_note, SP_LARGER_SPACE, ¬es_lloc); + } + YY_BREAK +case 78: +YY_RULE_SETUP +#line 574 "gabc/gabc-notes-determination.l" +{ + gregorio_add_space_as_note(¤t_note, SP_GLYPH_SPACE, ¬es_lloc); + } + YY_BREAK +case 79: +YY_RULE_SETUP +#line 577 "gabc/gabc-notes-determination.l" +{ + gregorio_add_space_as_note(¤t_note, SP_NEUMATIC_CUT_NB, + ¬es_lloc); + } + YY_BREAK +case 80: +YY_RULE_SETUP +#line 581 "gabc/gabc-notes-determination.l" +{ + gregorio_add_space_as_note(¤t_note, SP_LARGER_SPACE_NB, + ¬es_lloc); + } + YY_BREAK +case 81: +YY_RULE_SETUP +#line 585 "gabc/gabc-notes-determination.l" +{ + gregorio_add_space_as_note(¤t_note, SP_GLYPH_SPACE_NB, + ¬es_lloc); + } + YY_BREAK +case 82: +/* rule 82 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up gabc_notes_determination_text */ +YY_LINENO_REWIND_TO(yy_bp + 1); +(yy_c_buf_p) = yy_cp = yy_bp + 1; +YY_DO_BEFORE_ACTION; /* set up gabc_notes_determination_text again */ +YY_RULE_SETUP +#line 589 "gabc/gabc-notes-determination.l" +{ + gregorio_add_space_as_note(¤t_note, SP_ZERO_WIDTH, ¬es_lloc); + } + YY_BREAK +case 83: +YY_RULE_SETUP +#line 592 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_LINEA); + } + YY_BREAK +case 84: +YY_RULE_SETUP +#line 595 "gabc/gabc-notes-determination.l" +{ + lex_add_note(0, S_BIVIRGA, _NO_SIGN, L_NO_LIQUESCENTIA); + } + YY_BREAK +case 85: +YY_RULE_SETUP +#line 598 "gabc/gabc-notes-determination.l" +{ + lex_add_note(0, S_TRIVIRGA, _NO_SIGN, L_NO_LIQUESCENTIA); + } + YY_BREAK +case 86: +YY_RULE_SETUP +#line 601 "gabc/gabc-notes-determination.l" +{ + lex_add_note(0, S_BIVIRGA, _NO_SIGN, L_NO_LIQUESCENTIA); + } + YY_BREAK +case 87: +YY_RULE_SETUP +#line 604 "gabc/gabc-notes-determination.l" +{ + lex_add_note(0, S_TRIVIRGA, _NO_SIGN, L_NO_LIQUESCENTIA); + } + YY_BREAK +case 88: +YY_RULE_SETUP +#line 607 "gabc/gabc-notes-determination.l" +{ + lex_add_note(0, S_DISTROPHA, _NO_SIGN, L_NO_LIQUESCENTIA); + } + YY_BREAK +case 89: +YY_RULE_SETUP +#line 610 "gabc/gabc-notes-determination.l" +{ + lex_add_note(0, S_DISTROPHA, _NO_SIGN, L_AUCTA); + } + YY_BREAK +case 90: +YY_RULE_SETUP +#line 613 "gabc/gabc-notes-determination.l" +{ + lex_add_note(0, S_TRISTROPHA, _NO_SIGN, L_NO_LIQUESCENTIA); + } + YY_BREAK +case 91: +YY_RULE_SETUP +#line 616 "gabc/gabc-notes-determination.l" +{ + lex_add_note(0, S_TRISTROPHA, _NO_SIGN, L_AUCTA); + } + YY_BREAK +case 92: +YY_RULE_SETUP +#line 619 "gabc/gabc-notes-determination.l" +{ + lex_add_note(0, punctum(gabc_notes_determination_text[0]), _NO_SIGN, + L_NO_LIQUESCENTIA); + } + YY_BREAK +case 93: +YY_RULE_SETUP +#line 623 "gabc/gabc-notes-determination.l" +{ + lex_add_note(1, punctum(gabc_notes_determination_text[1]), _NO_SIGN, + L_INITIO_DEBILIS); + } + YY_BREAK +case 94: +YY_RULE_SETUP +#line 627 "gabc/gabc-notes-determination.l" +{ + add_sign(_V_EPISEMA); + } + YY_BREAK +case 95: +YY_RULE_SETUP +#line 630 "gabc/gabc-notes-determination.l" +{ + add_h_episema(); + } + YY_BREAK +case 96: +YY_RULE_SETUP +#line 633 "gabc/gabc-notes-determination.l" +{ + add_sign(_PUNCTUM_MORA); + } + YY_BREAK +case 97: +YY_RULE_SETUP +#line 636 "gabc/gabc-notes-determination.l" +{ + gregorio_add_liquescentia(current_note, L_DEMINUTUS); + } + YY_BREAK +case 98: +YY_RULE_SETUP +#line 639 "gabc/gabc-notes-determination.l" +{ + gregorio_add_liquescentia(current_note, L_AUCTUS_DESCENDENS); + } + YY_BREAK +case 99: +YY_RULE_SETUP +#line 642 "gabc/gabc-notes-determination.l" +{ + gregorio_add_liquescentia(current_note, L_AUCTUS_ASCENDENS); + } + YY_BREAK +case 100: +YY_RULE_SETUP +#line 645 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_QUADRATUM); + } + YY_BREAK +case 101: +YY_RULE_SETUP +#line 648 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_ORISCUS); + } + YY_BREAK +case 102: +YY_RULE_SETUP +#line 651 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_ORISCUS_SCAPUS); + } + YY_BREAK +case 103: +YY_RULE_SETUP +#line 654 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_QUILISMA); + } + YY_BREAK +case 104: +YY_RULE_SETUP +#line 657 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_QUILISMA_QUADRATUM); + } + YY_BREAK +case 105: +YY_RULE_SETUP +#line 660 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_VIRGA); + } + YY_BREAK +case 106: +YY_RULE_SETUP +#line 663 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_VIRGA_REVERSA); + } + YY_BREAK +case 107: +YY_RULE_SETUP +#line 666 "gabc/gabc-notes-determination.l" +{ + gregorio_change_shape(current_note, S_STROPHA); + } + YY_BREAK +case 108: +YY_RULE_SETUP +#line 669 "gabc/gabc-notes-determination.l" +{ + gregorio_messagef("det_notes_from_string", VERBOSITY_ERROR, 0, + _("unrecognized character: \"%c\""), + gabc_notes_determination_text[0]); + } + YY_BREAK +case 109: +YY_RULE_SETUP +#line 675 "gabc/gabc-notes-determination.l" +ECHO; + YY_BREAK +#line 8579 "gabc/gabc-notes-determination-l.c" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(texverbnote): +case YY_STATE_EOF(texverbglyph): +case YY_STATE_EOF(texverbelement): +case YY_STATE_EOF(choralsign): +case YY_STATE_EOF(choralnabc): +case YY_STATE_EOF(alt): +case YY_STATE_EOF(comments): +case YY_STATE_EOF(overbrace): +case YY_STATE_EOF(underbrace): +case YY_STATE_EOF(overcurlybrace): +case YY_STATE_EOF(overcurlyaccentusbrace): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed gabc_notes_determination_in at a new source and called + * gabc_notes_determination_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = gabc_notes_determination_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( gabc_notes_determination_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * gabc_notes_determination_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of gabc_notes_determination_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + gabc_notes_determination_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + gabc_notes_determination_restart(gabc_notes_determination_in ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gabc_notes_determination_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + if ( *yy_cp ) + { + yy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)]; + } + else + yy_current_state = yy_NUL_trans[yy_current_state]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + yy_current_state = yy_NUL_trans[yy_current_state]; + yy_is_jam = (yy_current_state == 0); + + if ( ! yy_is_jam ) + { + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + } + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + gabc_notes_determination_restart(gabc_notes_determination_in ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( gabc_notes_determination_wrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve gabc_notes_determination_text */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void gabc_notes_determination_restart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + gabc_notes_determination_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gabc_notes_determination__create_buffer(gabc_notes_determination_in,YY_BUF_SIZE ); + } + + gabc_notes_determination__init_buffer(YY_CURRENT_BUFFER,input_file ); + gabc_notes_determination__load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void gabc_notes_determination__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * gabc_notes_determination_pop_buffer_state(); + * gabc_notes_determination_push_buffer_state(new_buffer); + */ + gabc_notes_determination_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + gabc_notes_determination__load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (gabc_notes_determination_wrap()) processing, but the only time this flag + * is looked at is after gabc_notes_determination_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void gabc_notes_determination__load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + gabc_notes_determination_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE gabc_notes_determination__create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) gabc_notes_determination_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_notes_determination__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) gabc_notes_determination_alloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_notes_determination__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + gabc_notes_determination__init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with gabc_notes_determination__create_buffer() + * + */ + void gabc_notes_determination__delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + gabc_notes_determination_free((void *) b->yy_ch_buf ); + + gabc_notes_determination_free((void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a gabc_notes_determination_restart() or at EOF. + */ + static void gabc_notes_determination__init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + gabc_notes_determination__flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then gabc_notes_determination__init_buffer was _probably_ + * called from gabc_notes_determination_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void gabc_notes_determination__flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + gabc_notes_determination__load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void gabc_notes_determination_push_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + gabc_notes_determination_ensure_buffer_stack(); + + /* This block is copied from gabc_notes_determination__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from gabc_notes_determination__switch_to_buffer. */ + gabc_notes_determination__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void gabc_notes_determination_pop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + gabc_notes_determination__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + gabc_notes_determination__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void gabc_notes_determination_ensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)gabc_notes_determination_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_notes_determination_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)gabc_notes_determination_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_notes_determination_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE gabc_notes_determination__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) gabc_notes_determination_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_notes_determination__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + gabc_notes_determination__switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to gabc_notes_determination_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * gabc_notes_determination__scan_bytes() instead. + */ +YY_BUFFER_STATE gabc_notes_determination__scan_string (yyconst char * yystr ) +{ + + return gabc_notes_determination__scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to gabc_notes_determination_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE gabc_notes_determination__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + yy_size_t i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) gabc_notes_determination_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_notes_determination__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = gabc_notes_determination__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in gabc_notes_determination__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up gabc_notes_determination_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + gabc_notes_determination_text[gabc_notes_determination_leng] = (yy_hold_char); \ + (yy_c_buf_p) = gabc_notes_determination_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + gabc_notes_determination_leng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int gabc_notes_determination_get_lineno (void) +{ + + return gabc_notes_determination_lineno; +} + +/** Get the input stream. + * + */ +FILE *gabc_notes_determination_get_in (void) +{ + return gabc_notes_determination_in; +} + +/** Get the output stream. + * + */ +FILE *gabc_notes_determination_get_out (void) +{ + return gabc_notes_determination_out; +} + +/** Get the length of the current token. + * + */ +yy_size_t gabc_notes_determination_get_leng (void) +{ + return gabc_notes_determination_leng; +} + +/** Get the current token. + * + */ + +char *gabc_notes_determination_get_text (void) +{ + return gabc_notes_determination_text; +} + +/** Set the current line number. + * @param line_number + * + */ +void gabc_notes_determination_set_lineno (int line_number ) +{ + + gabc_notes_determination_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see gabc_notes_determination__switch_to_buffer + */ +void gabc_notes_determination_set_in (FILE * in_str ) +{ + gabc_notes_determination_in = in_str ; +} + +void gabc_notes_determination_set_out (FILE * out_str ) +{ + gabc_notes_determination_out = out_str ; +} + +int gabc_notes_determination_get_debug (void) +{ + return gabc_notes_determination__flex_debug; +} + +void gabc_notes_determination_set_debug (int bdebug ) +{ + gabc_notes_determination__flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from gabc_notes_determination_lex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + + (yy_start_stack_ptr) = 0; + (yy_start_stack_depth) = 0; + (yy_start_stack) = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + gabc_notes_determination_in = stdin; + gabc_notes_determination_out = stdout; +#else + gabc_notes_determination_in = (FILE *) 0; + gabc_notes_determination_out = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * gabc_notes_determination_lex_init() + */ + return 0; +} + +/* gabc_notes_determination_lex_destroy is for both reentrant and non-reentrant scanners. */ +int gabc_notes_determination_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + gabc_notes_determination__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + gabc_notes_determination_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + gabc_notes_determination_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Destroy the start condition stack. */ + gabc_notes_determination_free((yy_start_stack) ); + (yy_start_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * gabc_notes_determination_lex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *gabc_notes_determination_alloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *gabc_notes_determination_realloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void gabc_notes_determination_free (void * ptr ) +{ + free( (char *) ptr ); /* see gabc_notes_determination_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 675 "gabc/gabc-notes-determination.l" + + + +gregorio_note *gabc_det_notes_from_string(char *str, char *newmacros[10], + gregorio_scanner_location *loc) +{ + int i; + YY_BUFFER_STATE buf; + + notes_lloc.first_line = loc->first_line; + notes_lloc.first_column = loc->first_column; + notes_lloc.first_offset = loc->first_offset; + /* yes... I do mean to set values from loc->first_* */ + notes_lloc.last_line = loc->first_line; + notes_lloc.last_column = loc->first_column; + notes_lloc.last_offset = loc->first_offset; + + /* a small optimization could uccur here: we could do it only once at the + * beginning of the score, not at each syllable */ + for (i = 0; i < 10; i++) { + notesmacros[i] = newmacros[i]; + } + nbof_isolated_episema = 0; + current_note = NULL; + buf = gabc_notes_determination__scan_string(str); + gabc_notes_determination_lex(); + gabc_notes_determination__flush_buffer(buf); + gabc_notes_determination__delete_buffer(buf); + gregorio_go_to_first_note(¤t_note); + return current_note; +} + diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-notes-determination.l b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-notes-determination.l new file mode 100644 index 00000000000..f48875aea4a --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-notes-determination.l @@ -0,0 +1,704 @@ +%{ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the note parser. + * + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <ctype.h> /* for tolower */ +#include "bool.h" +#include "struct.h" +#include "messages.h" +#include "support.h" + +#include "gabc.h" + +#define YY_NO_INPUT + +#define YY_USER_ACTION gabc_update_location(¬es_lloc, \ + gabc_notes_determination_text, gabc_notes_determination_leng); + +static gregorio_scanner_location notes_lloc; +static gregorio_note *current_note; +static char char_for_brace; +static unsigned int nbof_isolated_episema; +static char *notesmacros[10]; +static char tempstr[256]; +static int brace_var_counter; +static int overbrace_var, underbrace_var; +static const char *overbrace_var_kind; + +static __inline char pitch_letter_to_height(const char pitch) { + return pitch - 'a' + LOWEST_PITCH; +} + +static gregorio_shape punctum(const char pitch) +{ + if (pitch < 'a') { + return S_PUNCTUM_INCLINATUM; + } else { + return S_PUNCTUM; + } +} + +static __inline void lex_add_note(int i, gregorio_shape shape, char signs, + char liquescentia) +{ + nbof_isolated_episema = 0; + gregorio_add_note(¤t_note, + pitch_letter_to_height(tolower((unsigned char)gabc_notes_determination_text[i])), + shape, signs, liquescentia, NULL, ¬es_lloc); +} + +static __inline void add_bar_as_note(gregorio_bar bar) +{ + nbof_isolated_episema = 0; + gregorio_add_bar_as_note(¤t_note, bar, ¬es_lloc); +} + +static __inline void error(void) +{ + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("undefined macro used: m%d"), + gabc_notes_determination_text[3] - '0'); +} + +static void add_h_episema(void) { + grehepisema_size size = H_NORMAL; + gregorio_vposition vposition = VPOS_AUTO; + bool disable_bridge = false; + + char *ptr = gabc_notes_determination_text; + char current; + /* first character is the underscore */ + while ((current = *(++ptr))) { + switch(current) { + case '0': + vposition = VPOS_BELOW; + break; + case '1': + vposition = VPOS_ABOVE; + break; + case '2': + disable_bridge = true; + break; + case '3': + size = H_SMALL_LEFT; + break; + case '4': + size = H_SMALL_CENTRE; + break; + case '5': + size = H_SMALL_RIGHT; + break; + default: + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("unrecognized horizontal episema modifier: %c"), + current); + break; + }; + } + + gregorio_add_h_episema(current_note, size, vposition, disable_bridge, + &nbof_isolated_episema); +} + +static void add_sign(gregorio_sign sign) { + gregorio_vposition vposition = VPOS_AUTO; + switch(gabc_notes_determination_text[1]) { + case '0': + vposition = VPOS_BELOW; + break; + case '1': + vposition = VPOS_ABOVE; + break; + } + gregorio_add_sign(current_note, sign, vposition); +} + +static __inline void add_alteration(const gregorio_type type) { + gregorio_add_alteration_as_note(¤t_note, type, + pitch_letter_to_height(gabc_notes_determination_text[0]), + ¬es_lloc); +} + +%} + +%option stack +%option 8bit +%option pointer +%option nounput +%option noyy_push_state +%option noyy_pop_state +%option noyy_top_state +%option full +%option noread +%option nomain +%option align +%option noyylineno +%option prefix="gabc_notes_determination_" +%option noyywrap + +%x texverbnote +%x texverbglyph +%x texverbelement +%x choralsign +%x choralnabc +%x alt +%x comments +%x overbrace +%x underbrace +%x overcurlybrace +%x overcurlyaccentusbrace + +%% +<INITIAL>\% { + BEGIN(comments); + } +<comments>(\n|\r)+ { + BEGIN(INITIAL); + } +<comments>[^\n\r]* { + /* ignored */ + } +<INITIAL>\[cs: { + BEGIN(choralsign); + } +<INITIAL>\[cn: { + BEGIN(choralnabc); + } +<INITIAL>\[ob:[01]; { + char_for_brace = gabc_notes_determination_text[4]-'0'; + BEGIN(overbrace); + } +<INITIAL>\[ub:[01]; { + char_for_brace = gabc_notes_determination_text[4]-'0'; + BEGIN(underbrace); + } +<INITIAL>\[ocb:[01]; { + char_for_brace = gabc_notes_determination_text[5]-'0'; + BEGIN(overcurlybrace); + } +<INITIAL>\[ocba:[01]; { + char_for_brace = gabc_notes_determination_text[6]-'0'; + BEGIN(overcurlyaccentusbrace); + } +<INITIAL>\[ob:[01]\{\] { + if (overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace without termination of " + "previous overbrace")); + } else { + char_for_brace = gabc_notes_determination_text[4]-'0'; + overbrace_var = ++brace_var_counter; + overbrace_var_kind = "ob"; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{1}" + "\\GreOverBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}", + overbrace_var, char_for_brace, overbrace_var, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } +<INITIAL>\[ub:[01]\{\] { + if (underbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable underbrace without termination of " + "previous underbrace")); + } else { + char_for_brace = gabc_notes_determination_text[4]-'0'; + underbrace_var = ++brace_var_counter; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{1}" + "\\GreUnderBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}", + underbrace_var, char_for_brace, underbrace_var, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } +<INITIAL>\[ocb:[01]\{\] { + if (overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace without termination of " + "previous overbrace")); + } else { + char_for_brace = gabc_notes_determination_text[5]-'0'; + overbrace_var = ++brace_var_counter; + overbrace_var_kind = "ocb"; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{1}" + "\\GreOverCurlyBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}{0}", + overbrace_var, char_for_brace, overbrace_var, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } +<INITIAL>\[ocba:[01]\{\] { + if (overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace without termination of " + "previous overbrace")); + } else { + char_for_brace = gabc_notes_determination_text[6]-'0'; + overbrace_var = ++brace_var_counter; + overbrace_var_kind = "ocba"; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{1}" + "\\GreOverCurlyBrace{\\GreVarBraceLength{%d}}{0pt}{0pt}{%d}{1}", + overbrace_var, char_for_brace, overbrace_var, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } +<INITIAL>\[ob:[01]\}\] { + if (!overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace termination without " + "variable overbrace start")); + } else if (strcmp (overbrace_var_kind, "ob")) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace started with %s " + "and terminated with ob"), + overbrace_var_kind); + } else { + char_for_brace = gabc_notes_determination_text[4]-'0'; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{2}", overbrace_var, + char_for_brace); + overbrace_var = 0; + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } +<INITIAL>\[ub:[01]\}\] { + if (!underbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable underbrace termination without " + "variable underbrace start")); + } else { + char_for_brace = gabc_notes_determination_text[4]-'0'; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{2}", underbrace_var, + char_for_brace); + underbrace_var = 0; + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } +<INITIAL>\[ocb:[01]\}\] { + if (!overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace termination without " + "variable overbrace start")); + } else if (strcmp (overbrace_var_kind, "ocb")) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace started with %s " + "and terminated with ocb"), + overbrace_var_kind); + } else { + char_for_brace = gabc_notes_determination_text[5]-'0'; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{2}", overbrace_var, + char_for_brace); + overbrace_var = 0; + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } +<INITIAL>\[ocba:[01]\}\] { + if (!overbrace_var) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace termination without " + "variable overbrace start")); + } else if (strcmp (overbrace_var_kind, "ocba")) { + gregorio_messagef("gabc_notes_determination", VERBOSITY_ERROR, 0, + _("variable overbrace started with %s " + "and terminated with ocba"), + overbrace_var_kind); + } else { + char_for_brace = gabc_notes_determination_text[6]-'0'; + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreVarBraceSavePos{%d}{%d}{2}", overbrace_var, + char_for_brace); + overbrace_var = 0; + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } + } +<INITIAL>\[nm[1-9]\] { + if (notesmacros[gabc_notes_determination_text[3]-'0']) { + gregorio_add_texverb_to_note(¤t_note, + gregorio_strdup(notesmacros[gabc_notes_determination_text[3]-'0'])); + } else error(); + } +<INITIAL>\[gm[1-9]\] { + if (notesmacros[gabc_notes_determination_text[3]-'0']) { + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(notesmacros[gabc_notes_determination_text[3]-'0']), + GRE_TEXVERB_GLYPH, ¬es_lloc); + } else error(); + } +<INITIAL>\[em[1-9]\] { + if (notesmacros[gabc_notes_determination_text[3]-'0']) { + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(notesmacros[gabc_notes_determination_text[3]-'0']), + GRE_TEXVERB_ELEMENT, ¬es_lloc); + } else error(); + } +<INITIAL>\[altm[1-9]\] { + if (notesmacros[gabc_notes_determination_text[5]-'0']) { + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(notesmacros[gabc_notes_determination_text[5]-'0']), + GRE_TEXVERB_ELEMENT, ¬es_lloc); + } else error(); + } +<INITIAL>\[nv: { + BEGIN(texverbnote); + } +<INITIAL>\[gv: { + BEGIN(texverbglyph); + } +<INITIAL>\[ev: { + BEGIN(texverbelement); + } +<INITIAL>\[alt: { + BEGIN(alt); + } +<INITIAL><nlba> { + gregorio_add_nlba_as_note(¤t_note, NLBA_BEGINNING, ¬es_lloc); + } +<INITIAL><\/nlba> { + gregorio_add_nlba_as_note(¤t_note, NLBA_END, ¬es_lloc); + } +<overbrace>[^\]]+ { + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreOverBrace{%s}{0pt}{0pt}{%d}", + gabc_notes_determination_text, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } +<underbrace>[^\]]+ { + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreUnderBrace{%s}{0pt}{0pt}{%d}", + gabc_notes_determination_text, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } +<overcurlybrace>[^\]]+ { + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreOverCurlyBrace{%s}{0pt}{0pt}{%d}{0}", + gabc_notes_determination_text, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } +<overcurlyaccentusbrace>[^\]]+ { + gregorio_snprintf(tempstr, sizeof tempstr, + "\\GreOverCurlyBrace{%s}{0pt}{0pt}{%d}{1}", + gabc_notes_determination_text, char_for_brace); + gregorio_add_texverb_to_note(¤t_note, gregorio_strdup(tempstr)); + } +<choralsign>[^\]]+ { + gregorio_add_cs_to_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text), false); + } +<choralnabc>[^\]]+ { + gregorio_add_cs_to_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text), true); + } +<texverbnote>[^\]]+ { + gregorio_add_texverb_to_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text)); + } +<texverbglyph>[^\]]+ { + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text), + GRE_TEXVERB_GLYPH, ¬es_lloc); + } +<texverbelement>[^\]]+ { + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text), + GRE_TEXVERB_ELEMENT, ¬es_lloc); + } +<alt>[^\]]+ { + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup(gabc_notes_determination_text), GRE_ALT, + ¬es_lloc); + } +<texverbnote,texverbglyph,texverbelement,choralsign,choralnabc,alt,overcurlyaccentusbrace,overcurlybrace,overbrace,underbrace>\] { + BEGIN(INITIAL); + } +\{ { + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup("\\hbox to 0pt{"), GRE_TEXVERB_ELEMENT, + ¬es_lloc); + } +\} { + gregorio_add_texverb_as_note(¤t_note, + gregorio_strdup("\\hss%\n}%\n\\GreNoBreak\\relax "), + GRE_TEXVERB_ELEMENT, ¬es_lloc); + } +[a-m]\+ { + gregorio_add_manual_custos_as_note(¤t_note, + pitch_letter_to_height(gabc_notes_determination_text[0]), + ¬es_lloc); + } +[\t\r\n]+ /* ignore ends of line and tabs */; +z { + gregorio_add_end_of_line_as_note(¤t_note, GRE_END_OF_LINE, + ¬es_lloc); + } +z0 { + gregorio_add_custo_as_note(¤t_note, ¬es_lloc); + } +Z { + gregorio_add_end_of_line_as_note(¤t_note, GRE_END_OF_PAR, + ¬es_lloc); + } +(c|f)[1-4] { + if (gabc_notes_determination_text[0]=='c') { + gregorio_add_clef_change_as_note(¤t_note, GRE_C_KEY_CHANGE, + gabc_notes_determination_text[1], ¬es_lloc); + } else { + gregorio_add_clef_change_as_note(¤t_note, GRE_F_KEY_CHANGE, + gabc_notes_determination_text[1], ¬es_lloc); + } + } +(cb|fb)[1-4] { + if (gabc_notes_determination_text[0]=='c') { + gregorio_add_clef_change_as_note(¤t_note, + GRE_C_KEY_CHANGE_FLATED, gabc_notes_determination_text[2], + ¬es_lloc); + } else { + gregorio_add_clef_change_as_note(¤t_note, + GRE_F_KEY_CHANGE_FLATED, gabc_notes_determination_text[2], + ¬es_lloc); + } + } +` { + add_bar_as_note(B_VIRGULA); + } +, { + add_bar_as_note(B_DIVISIO_MINIMA); + } +,1 { + add_bar_as_note(B_DIVISIO_MINOR_D1); + } +,2 { + add_bar_as_note(B_DIVISIO_MINOR_D2); + } +,3 { + add_bar_as_note(B_DIVISIO_MINOR_D3); + } +,4 { + add_bar_as_note(B_DIVISIO_MINOR_D4); + } +,5 { + add_bar_as_note(B_DIVISIO_MINOR_D5); + } +,6 { + add_bar_as_note(B_DIVISIO_MINOR_D6); + } +; { + add_bar_as_note(B_DIVISIO_MINOR); + } +;1 { + add_bar_as_note(B_DIVISIO_MINOR_D1); + } +;2 { + add_bar_as_note(B_DIVISIO_MINOR_D2); + } +;3 { + add_bar_as_note(B_DIVISIO_MINOR_D3); + } +;4 { + add_bar_as_note(B_DIVISIO_MINOR_D4); + } +;5 { + add_bar_as_note(B_DIVISIO_MINOR_D5); + } +;6 { + add_bar_as_note(B_DIVISIO_MINOR_D6); + } +: { + add_bar_as_note(B_DIVISIO_MAIOR); + } +:: { + add_bar_as_note(B_DIVISIO_FINALIS); + } +r { + gregorio_change_shape(current_note, S_PUNCTUM_CAVUM); + } +R { + gregorio_change_shape(current_note, S_LINEA_PUNCTUM); + } +r0 { + gregorio_change_shape(current_note, S_LINEA_PUNCTUM_CAVUM); + } +r1 { + gregorio_add_special_sign(current_note, _ACCENTUS); + } +r2 { + gregorio_add_special_sign(current_note, _ACCENTUS_REVERSUS); + } +r3 { + gregorio_add_special_sign(current_note, _CIRCULUS); + } +r4 { + gregorio_add_special_sign(current_note, _SEMI_CIRCULUS); + } +r5 { + gregorio_add_special_sign(current_note, _SEMI_CIRCULUS_REVERSUS); + } +[a-mA-M]x { + add_alteration(GRE_FLAT); + } +[a-mA-M]# { + add_alteration(GRE_SHARP); + } +[a-mA-M]y { + add_alteration(GRE_NATURAL); + } +\/ { + gregorio_add_space_as_note(¤t_note, SP_NEUMATIC_CUT, ¬es_lloc); + } +\/\/ { + gregorio_add_space_as_note(¤t_note, SP_LARGER_SPACE, ¬es_lloc); + } +\ { + gregorio_add_space_as_note(¤t_note, SP_GLYPH_SPACE, ¬es_lloc); + } +!\/ { + gregorio_add_space_as_note(¤t_note, SP_NEUMATIC_CUT_NB, + ¬es_lloc); + } +!\/\/ { + gregorio_add_space_as_note(¤t_note, SP_LARGER_SPACE_NB, + ¬es_lloc); + } +!\ { + gregorio_add_space_as_note(¤t_note, SP_GLYPH_SPACE_NB, + ¬es_lloc); + } +!/[^\/ ] { + gregorio_add_space_as_note(¤t_note, SP_ZERO_WIDTH, ¬es_lloc); + } += { + gregorio_change_shape(current_note, S_LINEA); + } +[a-mA-M]vv { + lex_add_note(0, S_BIVIRGA, _NO_SIGN, L_NO_LIQUESCENTIA); + } +[a-mA-M]vvv { + lex_add_note(0, S_TRIVIRGA, _NO_SIGN, L_NO_LIQUESCENTIA); + } +[a-mA-M]VV { + lex_add_note(0, S_BIVIRGA, _NO_SIGN, L_NO_LIQUESCENTIA); + } +[a-mA-M]VVV { + lex_add_note(0, S_TRIVIRGA, _NO_SIGN, L_NO_LIQUESCENTIA); + } +[a-mA-M]ss { + lex_add_note(0, S_DISTROPHA, _NO_SIGN, L_NO_LIQUESCENTIA); + } +[a-mA-M]ss(\<|\>) { + lex_add_note(0, S_DISTROPHA, _NO_SIGN, L_AUCTA); + } +[a-mA-M]sss { + lex_add_note(0, S_TRISTROPHA, _NO_SIGN, L_NO_LIQUESCENTIA); + } +[a-mA-M]sss(\<|\>) { + lex_add_note(0, S_TRISTROPHA, _NO_SIGN, L_AUCTA); + } +[a-mA-M] { + lex_add_note(0, punctum(gabc_notes_determination_text[0]), _NO_SIGN, + L_NO_LIQUESCENTIA); + } +-[a-mA-M] { + lex_add_note(1, punctum(gabc_notes_determination_text[1]), _NO_SIGN, + L_INITIO_DEBILIS); + } +\'[01]? { + add_sign(_V_EPISEMA); + } +_[0-5]* { + add_h_episema(); + } +\.[01]? { + add_sign(_PUNCTUM_MORA); + } +~ { + gregorio_add_liquescentia(current_note, L_DEMINUTUS); + } +> { + gregorio_add_liquescentia(current_note, L_AUCTUS_DESCENDENS); + } +\< { + gregorio_add_liquescentia(current_note, L_AUCTUS_ASCENDENS); + } +q { + gregorio_change_shape(current_note, S_QUADRATUM); + } +o { + gregorio_change_shape(current_note, S_ORISCUS); + } +O { + gregorio_change_shape(current_note, S_ORISCUS_SCAPUS); + } +w { + gregorio_change_shape(current_note, S_QUILISMA); + } +W { + gregorio_change_shape(current_note, S_QUILISMA_QUADRATUM); + } +v { + gregorio_change_shape(current_note, S_VIRGA); + } +V { + gregorio_change_shape(current_note, S_VIRGA_REVERSA); + } +s { + gregorio_change_shape(current_note, S_STROPHA); + } +. { + gregorio_messagef("det_notes_from_string", VERBOSITY_ERROR, 0, + _("unrecognized character: \"%c\""), + gabc_notes_determination_text[0]); + } + +%% + +gregorio_note *gabc_det_notes_from_string(char *str, char *newmacros[10], + gregorio_scanner_location *loc) +{ + int i; + YY_BUFFER_STATE buf; + + notes_lloc.first_line = loc->first_line; + notes_lloc.first_column = loc->first_column; + notes_lloc.first_offset = loc->first_offset; + /* yes... I do mean to set values from loc->first_* */ + notes_lloc.last_line = loc->first_line; + notes_lloc.last_column = loc->first_column; + notes_lloc.last_offset = loc->first_offset; + + /* a small optimization could uccur here: we could do it only once at the + * beginning of the score, not at each syllable */ + for (i = 0; i < 10; i++) { + notesmacros[i] = newmacros[i]; + } + nbof_isolated_episema = 0; + current_note = NULL; + buf = yy_scan_string(str); + yylex(); + yy_flush_buffer(buf); + yy_delete_buffer(buf); + gregorio_go_to_first_note(¤t_note); + return current_note; +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-l.c b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-l.c new file mode 100644 index 00000000000..fe52c82613f --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-l.c @@ -0,0 +1,2783 @@ +#line 2 "gabc/gabc-score-determination-l.c" + +#line 4 "gabc/gabc-score-determination-l.c" + +#define YY_INT_ALIGNED long int + +/* A lexical scanner generated by flex */ + +#define yy_create_buffer gabc_score_determination__create_buffer +#define yy_delete_buffer gabc_score_determination__delete_buffer +#define yy_flex_debug gabc_score_determination__flex_debug +#define yy_init_buffer gabc_score_determination__init_buffer +#define yy_flush_buffer gabc_score_determination__flush_buffer +#define yy_load_buffer_state gabc_score_determination__load_buffer_state +#define yy_switch_to_buffer gabc_score_determination__switch_to_buffer +#define yyin gabc_score_determination_in +#define yyleng gabc_score_determination_leng +#define yylex gabc_score_determination_lex +#define yylineno gabc_score_determination_lineno +#define yyout gabc_score_determination_out +#define yyrestart gabc_score_determination_restart +#define yytext gabc_score_determination_text +#define yywrap gabc_score_determination_wrap +#define yyalloc gabc_score_determination_alloc +#define yyrealloc gabc_score_determination_realloc +#define yyfree gabc_score_determination_free + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 39 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE gabc_score_determination_restart(gabc_score_determination_in ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t gabc_score_determination_leng; + +extern FILE *gabc_score_determination_in, *gabc_score_determination_out; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up gabc_score_determination_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up gabc_score_determination_text again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via gabc_score_determination_restart()), so that the user can continue scanning by + * just pointing gabc_score_determination_in at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when gabc_score_determination_text is formed. */ +static char yy_hold_char; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t gabc_score_determination_leng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow gabc_score_determination_wrap()'s to do buffer switches + * instead of setting up a fresh gabc_score_determination_in. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void gabc_score_determination_restart (FILE *input_file ); +void gabc_score_determination__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE gabc_score_determination__create_buffer (FILE *file,int size ); +void gabc_score_determination__delete_buffer (YY_BUFFER_STATE b ); +void gabc_score_determination__flush_buffer (YY_BUFFER_STATE b ); +void gabc_score_determination_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void gabc_score_determination_pop_buffer_state (void ); + +static void gabc_score_determination_ensure_buffer_stack (void ); +static void gabc_score_determination__load_buffer_state (void ); +static void gabc_score_determination__init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER gabc_score_determination__flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE gabc_score_determination__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE gabc_score_determination__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE gabc_score_determination__scan_bytes (yyconst char *bytes,yy_size_t len ); + +void *gabc_score_determination_alloc (yy_size_t ); +void *gabc_score_determination_realloc (void *,yy_size_t ); +void gabc_score_determination_free (void * ); + +#define yy_new_buffer gabc_score_determination__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + gabc_score_determination_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + gabc_score_determination__create_buffer(gabc_score_determination_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + gabc_score_determination_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + gabc_score_determination__create_buffer(gabc_score_determination_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define gabc_score_determination_wrap() 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +FILE *gabc_score_determination_in = (FILE *) 0, *gabc_score_determination_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int gabc_score_determination_lineno; + +int gabc_score_determination_lineno = 1; + +extern char *gabc_score_determination_text; +#define yytext_ptr gabc_score_determination_text + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up gabc_score_determination_text. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + gabc_score_determination_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 83 +#define YY_END_OF_BUFFER 84 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int32_t yy_accept[430] = + { 0, + 0, 1, 7, 7, 0, 0, 78, 78, 59, 59, + 65, 65, 62, 62, 5, 5, 70, 70, 84, 41, + 83, 41, 41, 6, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 2, 2, + 3, 3, 1, 7, 7, 83, 42, 60, 77, 66, + 75, 76, 67, 68, 78, 79, 81, 80, 59, 66, + 65, 66, 62, 61, 5, 4, 70, 66, 40, 0, + 39, 6, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 2, 1, 7, + + 7, 0, 7, 7, 0, 7, 8, 8, 42, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 78, 82, 59, 0, 65, 0, 62, 61, 5, + 4, 70, 0, 39, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 53, 51, 0, 43, 0, 0, + 0, 0, 0, 63, 74, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 28, 0, 0, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, + + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 72, 0, 55, 57, 47, 49, 54, 52, + 46, 0, 0, 0, 0, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 34, 0, 0, 0, 73, + 0, 69, 0, 56, 58, 48, 50, 0, 0, 0, + 23, 0, 0, 9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 44, 71, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 45, 0, 18, 0, 0, 0, 0, 0, 0, + 0, 32, 0, 0, 0, 15, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, + 17, 0, 0, 0, 0, 0, 25, 37, 0, 0, + 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 14, 0, 29, 0, 0, 0, 0, + 19, 30, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, + 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 12, 0, 0, 31, 36, 0, + 0, 10, 0, 35, 0, 0, 0, 0, 0, 33, + 0, 0, 26, 0, 0, 0, 0, 27, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 5, 1, 1, 6, 1, 7, 8, 1, 9, + 10, 1, 1, 1, 11, 1, 12, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 14, 15, 16, + 1, 17, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 18, 1, 19, 1, 1, 1, 20, 21, 22, 23, + + 24, 25, 26, 27, 28, 1, 29, 30, 31, 32, + 33, 34, 1, 35, 36, 37, 38, 39, 1, 40, + 41, 1, 42, 43, 44, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 45, 1, 1, 1, + 46, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 47, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[48] = + { 0, + 1, 1, 2, 3, 1, 1, 4, 5, 4, 5, + 1, 1, 1, 1, 6, 7, 1, 4, 4, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 8, 5, 8, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_base[451] = + { 0, + 0, 37, 1, 9, 70, 78, 7, 19, 3, 36, + 634, 633, 5, 31, 50, 52, 632, 631, 646, 651, + 651, 88, 634, 639, 66, 610, 48, 22, 82, 610, + 621, 83, 70, 39, 78, 605, 603, 610, 106, 115, + 651, 120, 83, 122, 128, 130, 0, 651, 651, 134, + 625, 651, 651, 651, 0, 651, 136, 651, 0, 124, + 0, 624, 0, 146, 0, 148, 0, 623, 156, 160, + 0, 651, 602, 598, 595, 598, 598, 598, 591, 602, + 605, 593, 600, 595, 590, 589, 583, 596, 90, 587, + 595, 591, 582, 573, 593, 588, 576, 165, 129, 174, + + 176, 178, 595, 180, 0, 182, 184, 651, 0, 81, + 579, 591, 590, 568, 588, 574, 113, 566, 572, 584, + 581, 0, 196, 0, 181, 0, 560, 0, 201, 0, + 203, 0, 578, 0, 564, 576, 568, 565, 556, 561, + 567, 579, 567, 564, 561, 549, 559, 546, 559, 558, + 559, 556, 558, 558, 549, 541, 545, 542, 538, 546, + 556, 532, 539, 531, 651, 651, 550, 651, 545, 548, + 547, 546, 545, 651, 651, 544, 543, 542, 131, 521, + 527, 539, 525, 517, 521, 519, 651, 527, 526, 651, + 518, 537, 512, 513, 517, 506, 507, 507, 651, 530, + + 651, 516, 503, 516, 513, 512, 499, 523, 495, 515, + 510, 513, 651, 509, 651, 651, 651, 651, 651, 651, + 651, 511, 510, 509, 508, 651, 487, 503, 496, 486, + 485, 487, 505, 27, 497, 481, 495, 494, 491, 651, + 482, 476, 482, 485, 497, 651, 485, 474, 475, 651, + 484, 651, 486, 651, 651, 651, 651, 485, 464, 476, + 651, 471, 461, 651, 464, 472, 458, 466, 463, 466, + 456, 462, 478, 455, 476, 464, 450, 451, 463, 465, + 651, 651, 453, 445, 447, 458, 443, 441, 451, 441, + 462, 448, 443, 438, 436, 436, 433, 433, 437, 427, + + 452, 651, 429, 651, 435, 425, 418, 422, 434, 419, + 419, 651, 420, 429, 427, 651, 431, 416, 187, 425, + 414, 415, 435, 404, 409, 415, 431, 417, 403, 402, + 402, 426, 401, 394, 410, 396, 396, 398, 651, 394, + 651, 401, 395, 406, 386, 384, 413, 651, 384, 385, + 386, 385, 391, 651, 382, 395, 390, 383, 373, 402, + 382, 175, 378, 651, 382, 651, 376, 380, 380, 379, + 651, 651, 380, 380, 379, 365, 373, 374, 367, 361, + 373, 359, 362, 651, 369, 360, 370, 364, 379, 361, + 357, 651, 355, 362, 348, 347, 331, 333, 322, 324, + + 310, 309, 308, 285, 651, 200, 184, 651, 651, 191, + 188, 651, 175, 651, 164, 170, 168, 168, 150, 651, + 133, 108, 651, 69, 73, 49, 1, 651, 651, 221, + 229, 237, 245, 253, 261, 269, 277, 285, 293, 301, + 309, 317, 323, 331, 337, 345, 353, 361, 369, 377 + } ; + +static yyconst flex_int32_t yy_def[451] = + { 0, + 430, 430, 431, 431, 432, 432, 433, 433, 434, 434, + 435, 435, 436, 436, 437, 437, 438, 438, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 439, 440, 441, 442, 429, 429, 429, + 429, 429, 429, 429, 443, 429, 429, 429, 444, 50, + 445, 429, 446, 429, 447, 429, 448, 429, 429, 429, + 449, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 439, + + 440, 441, 440, 440, 450, 441, 429, 429, 442, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 443, 429, 444, 429, 445, 429, 446, 429, 447, + 429, 448, 429, 449, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 450, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 0, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429 + } ; + +static yyconst flex_int32_t yy_nxt[699] = + { 0, + 429, 429, 21, 45, 45, 429, 22, 64, 64, 429, + 23, 45, 45, 24, 56, 46, 57, 429, 60, 25, + 26, 27, 28, 46, 428, 29, 56, 30, 57, 31, + 32, 33, 34, 64, 64, 35, 36, 37, 38, 39, + 40, 79, 41, 42, 53, 80, 54, 23, 265, 58, + 24, 60, 66, 66, 66, 66, 25, 26, 27, 28, + 91, 58, 29, 92, 30, 266, 31, 32, 33, 34, + 427, 77, 35, 36, 37, 38, 48, 53, 49, 54, + 78, 43, 43, 43, 48, 50, 49, 51, 52, 89, + 69, 69, 426, 50, 70, 51, 52, 73, 425, 93, + + 74, 81, 86, 75, 162, 82, 87, 90, 98, 98, + 151, 53, 163, 54, 94, 88, 83, 98, 98, 53, + 152, 54, 69, 69, 101, 101, 70, 99, 99, 99, + 104, 104, 107, 107, 170, 125, 102, 123, 123, 123, + 123, 424, 105, 429, 108, 110, 171, 429, 129, 129, + 131, 131, 222, 111, 112, 113, 423, 114, 69, 69, + 422, 115, 69, 69, 223, 116, 70, 98, 98, 117, + 118, 119, 120, 99, 99, 99, 101, 101, 104, 104, + 429, 429, 104, 104, 101, 101, 107, 107, 102, 421, + 105, 420, 429, 419, 105, 418, 102, 123, 123, 123, + + 123, 176, 177, 129, 129, 131, 131, 335, 178, 375, + 376, 417, 163, 416, 415, 414, 179, 180, 181, 413, + 336, 20, 20, 20, 20, 20, 20, 20, 20, 44, + 44, 44, 44, 44, 44, 44, 44, 47, 47, 47, + 47, 47, 47, 47, 47, 55, 55, 55, 55, 55, + 55, 55, 55, 59, 59, 59, 59, 59, 59, 59, + 59, 61, 61, 61, 61, 61, 61, 61, 61, 63, + 63, 63, 63, 63, 63, 63, 63, 65, 65, 65, + 65, 65, 65, 65, 65, 67, 67, 67, 67, 67, + 67, 67, 67, 100, 100, 100, 100, 100, 100, 100, + + 100, 103, 103, 103, 103, 103, 103, 103, 103, 106, + 106, 106, 106, 106, 106, 106, 106, 109, 109, 109, + 412, 109, 109, 122, 122, 122, 122, 411, 122, 122, + 122, 124, 124, 124, 124, 124, 124, 126, 126, 126, + 126, 126, 126, 410, 126, 128, 409, 408, 128, 128, + 128, 128, 128, 130, 407, 406, 130, 130, 130, 130, + 130, 132, 132, 132, 132, 132, 132, 405, 132, 134, + 404, 134, 134, 134, 134, 134, 134, 161, 161, 161, + 161, 161, 403, 161, 161, 402, 401, 400, 399, 398, + 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, + + 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, + 377, 374, 373, 372, 371, 370, 369, 368, 367, 366, + 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, + 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, + 345, 344, 343, 342, 341, 340, 339, 338, 337, 334, + 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, + 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, + 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, + 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, + 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, + + 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, + 273, 272, 271, 270, 269, 268, 267, 264, 263, 262, + 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, + 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, + 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, + 231, 230, 229, 228, 227, 226, 225, 224, 221, 220, + 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, + 105, 209, 208, 207, 206, 205, 204, 203, 202, 201, + 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, + 190, 189, 188, 187, 186, 185, 184, 183, 182, 175, + + 174, 173, 172, 169, 168, 167, 166, 165, 164, 105, + 160, 159, 158, 157, 156, 155, 154, 153, 150, 149, + 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, + 138, 137, 136, 135, 133, 127, 121, 97, 96, 95, + 85, 84, 76, 72, 71, 429, 68, 68, 62, 62, + 19, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429 + + } ; + +static yyconst flex_int32_t yy_chk[699] = + { 0, + 0, 0, 1, 3, 3, 0, 1, 13, 13, 0, + 1, 4, 4, 1, 7, 3, 7, 0, 9, 1, + 1, 1, 1, 4, 427, 1, 8, 1, 8, 1, + 1, 1, 1, 14, 14, 1, 1, 1, 1, 2, + 2, 28, 2, 2, 9, 28, 9, 2, 234, 7, + 2, 10, 15, 15, 16, 16, 2, 2, 2, 2, + 34, 8, 2, 34, 2, 234, 2, 2, 2, 2, + 426, 27, 2, 2, 2, 2, 5, 10, 5, 10, + 27, 2, 2, 2, 6, 5, 6, 5, 5, 33, + 22, 22, 425, 6, 22, 6, 6, 25, 424, 35, + + 25, 29, 32, 25, 110, 29, 32, 33, 39, 39, + 89, 5, 110, 5, 35, 32, 29, 40, 40, 6, + 89, 6, 42, 42, 44, 44, 42, 43, 43, 43, + 45, 45, 46, 46, 117, 60, 44, 57, 57, 57, + 57, 422, 45, 60, 46, 50, 117, 60, 64, 64, + 66, 66, 179, 50, 50, 50, 421, 50, 69, 69, + 419, 50, 70, 70, 179, 50, 70, 98, 98, 50, + 50, 50, 50, 99, 99, 99, 100, 100, 101, 101, + 102, 102, 104, 104, 106, 106, 107, 107, 100, 418, + 101, 417, 102, 416, 104, 415, 106, 123, 123, 123, + + 123, 125, 125, 129, 129, 131, 131, 319, 125, 362, + 362, 413, 125, 411, 410, 407, 125, 125, 125, 406, + 319, 430, 430, 430, 430, 430, 430, 430, 430, 431, + 431, 431, 431, 431, 431, 431, 431, 432, 432, 432, + 432, 432, 432, 432, 432, 433, 433, 433, 433, 433, + 433, 433, 433, 434, 434, 434, 434, 434, 434, 434, + 434, 435, 435, 435, 435, 435, 435, 435, 435, 436, + 436, 436, 436, 436, 436, 436, 436, 437, 437, 437, + 437, 437, 437, 437, 437, 438, 438, 438, 438, 438, + 438, 438, 438, 439, 439, 439, 439, 439, 439, 439, + + 439, 440, 440, 440, 440, 440, 440, 440, 440, 441, + 441, 441, 441, 441, 441, 441, 441, 442, 442, 442, + 404, 442, 442, 443, 443, 443, 443, 403, 443, 443, + 443, 444, 444, 444, 444, 444, 444, 445, 445, 445, + 445, 445, 445, 402, 445, 446, 401, 400, 446, 446, + 446, 446, 446, 447, 399, 398, 447, 447, 447, 447, + 447, 448, 448, 448, 448, 448, 448, 397, 448, 449, + 396, 449, 449, 449, 449, 449, 449, 450, 450, 450, + 450, 450, 395, 450, 450, 394, 393, 391, 390, 389, + 388, 387, 386, 385, 383, 382, 381, 380, 379, 378, + + 377, 376, 375, 374, 373, 370, 369, 368, 367, 365, + 363, 361, 360, 359, 358, 357, 356, 355, 353, 352, + 351, 350, 349, 347, 346, 345, 344, 343, 342, 340, + 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, + 328, 327, 326, 325, 324, 323, 322, 321, 320, 318, + 317, 315, 314, 313, 311, 310, 309, 308, 307, 306, + 305, 303, 301, 300, 299, 298, 297, 296, 295, 294, + 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, + 283, 280, 279, 278, 277, 276, 275, 274, 273, 272, + 271, 270, 269, 268, 267, 266, 265, 263, 262, 260, + + 259, 258, 253, 251, 249, 248, 247, 245, 244, 243, + 242, 241, 239, 238, 237, 236, 235, 233, 232, 231, + 230, 229, 228, 227, 225, 224, 223, 222, 214, 212, + 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, + 200, 198, 197, 196, 195, 194, 193, 192, 191, 189, + 188, 186, 185, 184, 183, 182, 181, 180, 178, 177, + 176, 173, 172, 171, 170, 169, 167, 164, 163, 162, + 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, + 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, + 141, 140, 139, 138, 137, 136, 135, 133, 127, 121, + + 120, 119, 118, 116, 115, 114, 113, 112, 111, 103, + 97, 96, 95, 94, 93, 92, 91, 90, 88, 87, + 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, + 76, 75, 74, 73, 68, 62, 51, 38, 37, 36, + 31, 30, 26, 24, 23, 19, 18, 17, 12, 11, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429 + + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int gabc_score_determination__flex_debug; +int gabc_score_determination__flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *gabc_score_determination_text; +#line 1 "gabc/gabc-score-determination.l" +#line 2 "gabc/gabc-score-determination.l" +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the score lexer. + * + * Gregorio score determination in gabc input. + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "struct.h" +#include "messages.h" +#include "support.h" + +#include "gabc.h" +#include "gabc-score-determination.h" +#include "gabc-score-determination-y.h" + +static unsigned char style_stack = 0; + +#define YY_NO_INPUT + +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) { \ + int c = '*'; \ + size_t n; \ + for (n = 0; n < max_size \ + && (c = getc(gabc_score_determination_in)) != EOF \ + && c != '\n'; ++n ) { \ + buf[n] = (char) c; \ + } \ + if (c == '\n') { \ + buf[n++] = (char) c; \ + } \ + if (c == EOF && ferror(gabc_score_determination_in)) { \ + YY_FATAL_ERROR("input in flex scanner failed"); \ + } \ + result = n; \ + } else { \ + errno=0; \ + while ((result = fread(buf, 1, max_size, gabc_score_determination_in)) \ + == 0 && ferror(gabc_score_determination_in)) { \ + if (errno != EINTR) { \ + YY_FATAL_ERROR("input in flex scanner failed"); \ + break; \ + } \ + errno = 0; \ + clearerr(gabc_score_determination_in); \ + } \ + } \ + gabc_digest(buf, result) + +#define YY_USER_ACTION gabc_update_location(&gabc_score_determination_lloc, \ + gabc_score_determination_text, gabc_score_determination_leng); + + + + + + + + + +/* The expression for attribute below is rather messy because we allow +for (a) single-line values, ending with a semicolon at end of line or a +double semicolon, (b) multi-line values, which end at a double +semicolon. */ +#line 857 "gabc/gabc-score-determination-l.c" + +#define INITIAL 0 +#define attribute 1 +#define score 2 +#define notes 3 +#define style 4 +#define verb 5 +#define comments 6 +#define inicomments 7 +#define alt 8 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int gabc_score_determination_lex_destroy (void ); + +int gabc_score_determination_get_debug (void ); + +void gabc_score_determination_set_debug (int debug_flag ); + +YY_EXTRA_TYPE gabc_score_determination_get_extra (void ); + +void gabc_score_determination_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *gabc_score_determination_get_in (void ); + +void gabc_score_determination_set_in (FILE * in_str ); + +FILE *gabc_score_determination_get_out (void ); + +void gabc_score_determination_set_out (FILE * out_str ); + +yy_size_t gabc_score_determination_get_leng (void ); + +char *gabc_score_determination_get_text (void ); + +int gabc_score_determination_get_lineno (void ); + +void gabc_score_determination_set_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int gabc_score_determination_wrap (void ); +#else +extern int gabc_score_determination_wrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + + static int yy_start_stack_ptr = 0; + static int yy_start_stack_depth = 0; + static int *yy_start_stack = NULL; + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( gabc_score_determination_text, gabc_score_determination_leng, 1, gabc_score_determination_out )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( gabc_score_determination_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( gabc_score_determination_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, gabc_score_determination_in))==0 && ferror(gabc_score_determination_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(gabc_score_determination_in); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int gabc_score_determination_lex (void); + +#define YY_DECL int gabc_score_determination_lex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after gabc_score_determination_text and gabc_score_determination_leng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + if ( gabc_score_determination_leng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (gabc_score_determination_text[gabc_score_determination_leng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! gabc_score_determination_in ) + gabc_score_determination_in = stdin; + + if ( ! gabc_score_determination_out ) + gabc_score_determination_out = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + gabc_score_determination_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gabc_score_determination__create_buffer(gabc_score_determination_in,YY_BUF_SIZE ); + } + + gabc_score_determination__load_buffer_state( ); + } + + { +#line 106 "gabc/gabc-score-determination.l" + +#line 1081 "gabc/gabc-score-determination-l.c" + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of gabc_score_determination_text. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 430 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 651 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 107 "gabc/gabc-score-determination.l" +{ + /* BOM written by a lot of windows softwares when they write UTF-8 */ + } + YY_BREAK +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 110 "gabc/gabc-score-determination.l" +{ + /* ignoring empty lines */ + } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 113 "gabc/gabc-score-determination.l" +{ + BEGIN(inicomments); + } + YY_BREAK +case 4: +/* rule 4 can match eol */ +YY_RULE_SETUP +#line 116 "gabc/gabc-score-determination.l" +{ + BEGIN(INITIAL); + } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 119 "gabc/gabc-score-determination.l" +{ + /* ignored */ + } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 122 "gabc/gabc-score-determination.l" +{ + BEGIN(attribute); + return COLON; + } + YY_BREAK +case 7: +/* rule 7 can match eol */ +YY_RULE_SETUP +#line 126 "gabc/gabc-score-determination.l" +{ + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return ATTRIBUTE; + } + YY_BREAK +case 8: +/* rule 8 can match eol */ +YY_RULE_SETUP +#line 131 "gabc/gabc-score-determination.l" +{ + BEGIN(INITIAL); + return SEMICOLON; + } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 135 "gabc/gabc-score-determination.l" +{ + gabc_score_determination_lval.character = gabc_score_determination_text[5]; + return DEF_MACRO; + } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 139 "gabc/gabc-score-determination.l" +{ + return NUMBER_OF_VOICES; + } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 142 "gabc/gabc-score-determination.l" +{ + return NAME; + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 145 "gabc/gabc-score-determination.l" +{ + return SCORE_COPYRIGHT; + } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 148 "gabc/gabc-score-determination.l" +{ + return GABC_COPYRIGHT; + } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 151 "gabc/gabc-score-determination.l" +{ + return OFFICE_PART; + } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 154 "gabc/gabc-score-determination.l" +{ + return OCCASION; + } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 157 "gabc/gabc-score-determination.l" +{ + return METER; + } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 160 "gabc/gabc-score-determination.l" +{ + return COMMENTARY; + } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 163 "gabc/gabc-score-determination.l" +{ + return ARRANGER; + } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 166 "gabc/gabc-score-determination.l" +{ + return GABC_VERSION; + } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 169 "gabc/gabc-score-determination.l" +{ + return INITIAL_STYLE; + } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 172 "gabc/gabc-score-determination.l" +{ + return MODE; + } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 175 "gabc/gabc-score-determination.l" +{ + return ANNOTATION; + } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 178 "gabc/gabc-score-determination.l" +{ + return AUTHOR; + } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 181 "gabc/gabc-score-determination.l" +{ + return DATE; + } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 184 "gabc/gabc-score-determination.l" +{ + return MANUSCRIPT; + } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 187 "gabc/gabc-score-determination.l" +{ + return MANUSCRIPT_REFERENCE; + } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 190 "gabc/gabc-score-determination.l" +{ + return MANUSCRIPT_STORAGE_PLACE; + } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 193 "gabc/gabc-score-determination.l" +{ + return BOOK; + } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 196 "gabc/gabc-score-determination.l" +{ + return TRANSCRIBER; + } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 199 "gabc/gabc-score-determination.l" +{ + return GENERATED_BY; + } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 202 "gabc/gabc-score-determination.l" +{ + return CENTERING_SCHEME; + } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 205 "gabc/gabc-score-determination.l" +{ + return LANGUAGE; + } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 208 "gabc/gabc-score-determination.l" +{ + return TRANSCRIPTION_DATE; + } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 211 "gabc/gabc-score-determination.l" +{ + return STYLE; + } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 214 "gabc/gabc-score-determination.l" +{ + return VIRGULA_POSITION; + } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 217 "gabc/gabc-score-determination.l" +{ + return GREGORIOTEX_FONT; + } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 220 "gabc/gabc-score-determination.l" +{ + return NABC_LINES; + } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 223 "gabc/gabc-score-determination.l" +{ + return USER_NOTES; + } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 226 "gabc/gabc-score-determination.l" +{ + return VOICE_CHANGE; + } + YY_BREAK +case 40: +/* rule 40 can match eol */ +YY_RULE_SETUP +#line 229 "gabc/gabc-score-determination.l" +{ + BEGIN(score); + return END_OF_DEFINITIONS; + } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 233 "gabc/gabc-score-determination.l" +{ + gregorio_messagef("det_score", VERBOSITY_ERROR, 0, + _("unrecognized character: \"%c\" in definition part"), + gabc_score_determination_text[0]); + } + YY_BREAK +case 42: +/* rule 42 can match eol */ +YY_RULE_SETUP +#line 238 "gabc/gabc-score-determination.l" +{ + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return CHARACTERS; + } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 243 "gabc/gabc-score-determination.l" +{ + BEGIN(style); + style_stack ++; + return I_BEGINNING; + } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 248 "gabc/gabc-score-determination.l" +{ + return BNLBA; + } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 251 "gabc/gabc-score-determination.l" +{ + return ENLBA; + } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 254 "gabc/gabc-score-determination.l" +{ + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return I_END; + } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 261 "gabc/gabc-score-determination.l" +{ + BEGIN(style); + style_stack ++; + return TT_BEGINNING; + } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 266 "gabc/gabc-score-determination.l" +{ + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return TT_END; + } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 273 "gabc/gabc-score-determination.l" +{ + BEGIN(style); + style_stack ++; + return UL_BEGINNING; + } + YY_BREAK +case 50: +YY_RULE_SETUP +#line 278 "gabc/gabc-score-determination.l" +{ + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return UL_END; + } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 285 "gabc/gabc-score-determination.l" +{ + BEGIN(style); + style_stack ++; + return C_BEGINNING; + } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 290 "gabc/gabc-score-determination.l" +{ + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return C_END; + } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 297 "gabc/gabc-score-determination.l" +{ + BEGIN(style); + style_stack ++; + return B_BEGINNING; + } + YY_BREAK +case 54: +YY_RULE_SETUP +#line 302 "gabc/gabc-score-determination.l" +{ + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return B_END; + } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 309 "gabc/gabc-score-determination.l" +{ + BEGIN(style); + style_stack ++; + return SC_BEGINNING; + } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 314 "gabc/gabc-score-determination.l" +{ + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return SC_END; + } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 321 "gabc/gabc-score-determination.l" +{ + BEGIN(style); + style_stack ++; + return SP_BEGINNING; + } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 326 "gabc/gabc-score-determination.l" +{ + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return SP_END; + } + YY_BREAK +case 59: +/* rule 59 can match eol */ +YY_RULE_SETUP +#line 333 "gabc/gabc-score-determination.l" +{ + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return CHARACTERS; + } + YY_BREAK +case 60: +YY_RULE_SETUP +#line 338 "gabc/gabc-score-determination.l" +{ + BEGIN(comments); + } + YY_BREAK +case 61: +/* rule 61 can match eol */ +YY_RULE_SETUP +#line 341 "gabc/gabc-score-determination.l" +{ + BEGIN(score); + } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 344 "gabc/gabc-score-determination.l" +{ + /* ignored */ + } + YY_BREAK +case 63: +YY_RULE_SETUP +#line 347 "gabc/gabc-score-determination.l" +{ + BEGIN(verb); + return VERB_BEGINNING; + } + YY_BREAK +case 64: +YY_RULE_SETUP +#line 351 "gabc/gabc-score-determination.l" +{ + if (style_stack == 0) { + BEGIN(score); + } else { + BEGIN(style); + } + return VERB_END; + } + YY_BREAK +case 65: +/* rule 65 can match eol */ +YY_RULE_SETUP +#line 359 "gabc/gabc-score-determination.l" +{ + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return CHARACTERS; + } + YY_BREAK +case 66: +YY_RULE_SETUP +#line 364 "gabc/gabc-score-determination.l" +{ + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return CHARACTERS; + } + YY_BREAK +case 67: +YY_RULE_SETUP +#line 369 "gabc/gabc-score-determination.l" +{ + return CENTER_BEGINNING; + } + YY_BREAK +case 68: +YY_RULE_SETUP +#line 372 "gabc/gabc-score-determination.l" +{ + return CENTER_END; + } + YY_BREAK +case 69: +YY_RULE_SETUP +#line 375 "gabc/gabc-score-determination.l" +{ + BEGIN(alt); + return ALT_BEGIN; + } + YY_BREAK +case 70: +/* rule 70 can match eol */ +YY_RULE_SETUP +#line 379 "gabc/gabc-score-determination.l" +{ + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return CHARACTERS; + } + YY_BREAK +case 71: +YY_RULE_SETUP +#line 384 "gabc/gabc-score-determination.l" +{ + BEGIN(score); + return ALT_END; + } + YY_BREAK +case 72: +YY_RULE_SETUP +#line 388 "gabc/gabc-score-determination.l" +{ + return EUOUAE_B; + } + YY_BREAK +case 73: +YY_RULE_SETUP +#line 391 "gabc/gabc-score-determination.l" +{ + return EUOUAE_E; + } + YY_BREAK +case 74: +YY_RULE_SETUP +#line 394 "gabc/gabc-score-determination.l" +{ + return TRANSLATION_CENTER_END; + } + YY_BREAK +case 75: +YY_RULE_SETUP +#line 397 "gabc/gabc-score-determination.l" +{ + return TRANSLATION_BEGINNING; + } + YY_BREAK +case 76: +YY_RULE_SETUP +#line 400 "gabc/gabc-score-determination.l" +{ + return TRANSLATION_END; + } + YY_BREAK +case 77: +YY_RULE_SETUP +#line 403 "gabc/gabc-score-determination.l" +{ + BEGIN(notes); + return OPENING_BRACKET; + } + YY_BREAK +case 78: +/* rule 78 can match eol */ +YY_RULE_SETUP +#line 407 "gabc/gabc-score-determination.l" +{ + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return NOTES; + } + YY_BREAK +case 79: +YY_RULE_SETUP +#line 412 "gabc/gabc-score-determination.l" +{ + return VOICE_CUT; + } + YY_BREAK +case 80: +YY_RULE_SETUP +#line 415 "gabc/gabc-score-determination.l" +{ + return NABC_CUT; + } + YY_BREAK +case 81: +YY_RULE_SETUP +#line 418 "gabc/gabc-score-determination.l" +{ + BEGIN(score); + return CLOSING_BRACKET; + } + YY_BREAK +case 82: +/* rule 82 can match eol */ +YY_RULE_SETUP +#line 422 "gabc/gabc-score-determination.l" +{ + BEGIN(score); + return CLOSING_BRACKET_WITH_SPACE; + } + YY_BREAK +case 83: +YY_RULE_SETUP +#line 426 "gabc/gabc-score-determination.l" +ECHO; + YY_BREAK +#line 1803 "gabc/gabc-score-determination-l.c" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(attribute): +case YY_STATE_EOF(score): +case YY_STATE_EOF(notes): +case YY_STATE_EOF(style): +case YY_STATE_EOF(verb): +case YY_STATE_EOF(comments): +case YY_STATE_EOF(inicomments): +case YY_STATE_EOF(alt): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed gabc_score_determination_in at a new source and called + * gabc_score_determination_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = gabc_score_determination_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( gabc_score_determination_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * gabc_score_determination_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of gabc_score_determination_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + gabc_score_determination_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + gabc_score_determination_restart(gabc_score_determination_in ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gabc_score_determination_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 430 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 430 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 429); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + gabc_score_determination_restart(gabc_score_determination_in ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( gabc_score_determination_wrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve gabc_score_determination_text */ + (yy_hold_char) = *++(yy_c_buf_p); + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void gabc_score_determination_restart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + gabc_score_determination_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gabc_score_determination__create_buffer(gabc_score_determination_in,YY_BUF_SIZE ); + } + + gabc_score_determination__init_buffer(YY_CURRENT_BUFFER,input_file ); + gabc_score_determination__load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void gabc_score_determination__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * gabc_score_determination_pop_buffer_state(); + * gabc_score_determination_push_buffer_state(new_buffer); + */ + gabc_score_determination_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + gabc_score_determination__load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (gabc_score_determination_wrap()) processing, but the only time this flag + * is looked at is after gabc_score_determination_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void gabc_score_determination__load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + gabc_score_determination_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE gabc_score_determination__create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) gabc_score_determination_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_score_determination__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) gabc_score_determination_alloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_score_determination__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + gabc_score_determination__init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with gabc_score_determination__create_buffer() + * + */ + void gabc_score_determination__delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + gabc_score_determination_free((void *) b->yy_ch_buf ); + + gabc_score_determination_free((void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a gabc_score_determination_restart() or at EOF. + */ + static void gabc_score_determination__init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + gabc_score_determination__flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then gabc_score_determination__init_buffer was _probably_ + * called from gabc_score_determination_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void gabc_score_determination__flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + gabc_score_determination__load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void gabc_score_determination_push_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + gabc_score_determination_ensure_buffer_stack(); + + /* This block is copied from gabc_score_determination__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from gabc_score_determination__switch_to_buffer. */ + gabc_score_determination__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void gabc_score_determination_pop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + gabc_score_determination__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + gabc_score_determination__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void gabc_score_determination_ensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)gabc_score_determination_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_score_determination_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)gabc_score_determination_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_score_determination_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE gabc_score_determination__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) gabc_score_determination_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_score_determination__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + gabc_score_determination__switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to gabc_score_determination_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * gabc_score_determination__scan_bytes() instead. + */ +YY_BUFFER_STATE gabc_score_determination__scan_string (yyconst char * yystr ) +{ + + return gabc_score_determination__scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to gabc_score_determination_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE gabc_score_determination__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + yy_size_t i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) gabc_score_determination_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in gabc_score_determination__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = gabc_score_determination__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in gabc_score_determination__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up gabc_score_determination_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + gabc_score_determination_text[gabc_score_determination_leng] = (yy_hold_char); \ + (yy_c_buf_p) = gabc_score_determination_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + gabc_score_determination_leng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int gabc_score_determination_get_lineno (void) +{ + + return gabc_score_determination_lineno; +} + +/** Get the input stream. + * + */ +FILE *gabc_score_determination_get_in (void) +{ + return gabc_score_determination_in; +} + +/** Get the output stream. + * + */ +FILE *gabc_score_determination_get_out (void) +{ + return gabc_score_determination_out; +} + +/** Get the length of the current token. + * + */ +yy_size_t gabc_score_determination_get_leng (void) +{ + return gabc_score_determination_leng; +} + +/** Get the current token. + * + */ + +char *gabc_score_determination_get_text (void) +{ + return gabc_score_determination_text; +} + +/** Set the current line number. + * @param line_number + * + */ +void gabc_score_determination_set_lineno (int line_number ) +{ + + gabc_score_determination_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see gabc_score_determination__switch_to_buffer + */ +void gabc_score_determination_set_in (FILE * in_str ) +{ + gabc_score_determination_in = in_str ; +} + +void gabc_score_determination_set_out (FILE * out_str ) +{ + gabc_score_determination_out = out_str ; +} + +int gabc_score_determination_get_debug (void) +{ + return gabc_score_determination__flex_debug; +} + +void gabc_score_determination_set_debug (int bdebug ) +{ + gabc_score_determination__flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from gabc_score_determination_lex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + + (yy_start_stack_ptr) = 0; + (yy_start_stack_depth) = 0; + (yy_start_stack) = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + gabc_score_determination_in = stdin; + gabc_score_determination_out = stdout; +#else + gabc_score_determination_in = (FILE *) 0; + gabc_score_determination_out = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * gabc_score_determination_lex_init() + */ + return 0; +} + +/* gabc_score_determination_lex_destroy is for both reentrant and non-reentrant scanners. */ +int gabc_score_determination_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + gabc_score_determination__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + gabc_score_determination_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + gabc_score_determination_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Destroy the start condition stack. */ + gabc_score_determination_free((yy_start_stack) ); + (yy_start_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * gabc_score_determination_lex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *gabc_score_determination_alloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *gabc_score_determination_realloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void gabc_score_determination_free (void * ptr ) +{ + free( (char *) ptr ); /* see gabc_score_determination_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 426 "gabc/gabc-score-determination.l" + + + + diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-l.h b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-l.h new file mode 100644 index 00000000000..39fa2afbb0c --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-l.h @@ -0,0 +1,330 @@ +#ifndef gabc_score_determination_HEADER_H +#define gabc_score_determination_HEADER_H 1 +#define gabc_score_determination_IN_HEADER 1 + +#line 6 "gabc/gabc-score-determination-l.h" + +#line 8 "gabc/gabc-score-determination-l.h" + +#define YY_INT_ALIGNED long int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 39 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t gabc_score_determination_leng; + +extern FILE *gabc_score_determination_in, *gabc_score_determination_out; + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +void gabc_score_determination_restart (FILE *input_file ); +void gabc_score_determination__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE gabc_score_determination__create_buffer (FILE *file,int size ); +void gabc_score_determination__delete_buffer (YY_BUFFER_STATE b ); +void gabc_score_determination__flush_buffer (YY_BUFFER_STATE b ); +void gabc_score_determination_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void gabc_score_determination_pop_buffer_state (void ); + +YY_BUFFER_STATE gabc_score_determination__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE gabc_score_determination__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE gabc_score_determination__scan_bytes (yyconst char *bytes,yy_size_t len ); + +void *gabc_score_determination_alloc (yy_size_t ); +void *gabc_score_determination_realloc (void *,yy_size_t ); +void gabc_score_determination_free (void * ); + +/* Begin user sect3 */ + +#define gabc_score_determination_wrap() 1 +#define YY_SKIP_YYWRAP + +extern int gabc_score_determination_lineno; + +extern char *gabc_score_determination_text; +#define yytext_ptr gabc_score_determination_text + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 +#define attribute 1 +#define score 2 +#define notes 3 +#define style 4 +#define verb 5 +#define comments 6 +#define inicomments 7 +#define alt 8 + +#endif + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int gabc_score_determination_lex_destroy (void ); + +int gabc_score_determination_get_debug (void ); + +void gabc_score_determination_set_debug (int debug_flag ); + +YY_EXTRA_TYPE gabc_score_determination_get_extra (void ); + +void gabc_score_determination_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *gabc_score_determination_get_in (void ); + +void gabc_score_determination_set_in (FILE * in_str ); + +FILE *gabc_score_determination_get_out (void ); + +void gabc_score_determination_set_out (FILE * out_str ); + +yy_size_t gabc_score_determination_get_leng (void ); + +char *gabc_score_determination_get_text (void ); + +int gabc_score_determination_get_lineno (void ); + +void gabc_score_determination_set_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int gabc_score_determination_wrap (void ); +#else +extern int gabc_score_determination_wrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int gabc_score_determination_lex (void); + +#define YY_DECL int gabc_score_determination_lex (void) +#endif /* !YY_DECL */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#line 426 "gabc/gabc-score-determination.l" + + +#line 329 "gabc/gabc-score-determination-l.h" +#undef gabc_score_determination_IN_HEADER +#endif /* gabc_score_determination_HEADER_H */ diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-y.c b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-y.c new file mode 100644 index 00000000000..f3ecdfb6f08 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-y.c @@ -0,0 +1,3222 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + +/* Substitute the variable and function names. */ +#define yyparse gabc_score_determination_parse +#define yylex gabc_score_determination_lex +#define yyerror gabc_score_determination_error +#define yydebug gabc_score_determination_debug +#define yynerrs gabc_score_determination_nerrs + +#define yylval gabc_score_determination_lval +#define yychar gabc_score_determination_char +#define yylloc gabc_score_determination_lloc + +/* Copy the first part of user declarations. */ +#line 1 "gabc/gabc-score-determination.y" /* yacc.c:339 */ + +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the score parser. + * + * Gregorio score determination in gabc input. + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* + * + * This file is certainly not the most easy to understand, it is a bison file. + * See the bison manual on gnu.org for further details. + * + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> +#include "bool.h" +#include "struct.h" +#include "unicode.h" +#include "messages.h" +#include "characters.h" +#include "support.h" +#include "sha1.h" +#include "plugins.h" +#include "gabc.h" + +#define YYLLOC_DEFAULT(Current, Rhs, N) \ + if (N) { \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).first_offset = YYRHSLOC (Rhs, 1).first_offset; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + (Current).last_offset = YYRHSLOC (Rhs, N).last_offset; \ + } else { \ + (Current).first_line = (Current).last_line = YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = YYRHSLOC (Rhs, 0).last_column; \ + (Current).first_offset = (Current).last_offset = YYRHSLOC (Rhs, 0).last_offset; \ + } + +#include "gabc-score-determination.h" +#include "gabc-score-determination-l.h" + +/* uncomment it if you want to have an interactive shell to understand the + * details on how bison works for a certain input */ +/* int gabc_score_determination_debug=1; */ + +/* + * + * We will need some variables and functions through the entire file, we + * declare them there: + * + */ + +/* the score that we will determine and return */ +static gregorio_score *score; +/* an array of elements that we will use for each syllable */ +static gregorio_element **elements; +gregorio_element *current_element; +/* a table containing the macros to use in gabc file */ +static char *macros[10]; +/* forward declaration of the flex/bison process function */ +static int gabc_score_determination_parse(void); +/* other variables that we will have to use */ +static gregorio_character *current_character; +static gregorio_character *first_text_character; +static gregorio_character *first_translation_character; +static gregorio_tr_centering translation_type; +static gregorio_nlba no_linebreak_area; +static gregorio_euouae euouae; +static gregorio_voice_info *current_voice_info; +static int number_of_voices; +static int voice; +/* see comments on text to understand this */ +static gregorio_center_determination center_is_determined; +/* current_key is... the current key... updated by each notes determination + * (for key changes) */ +static int current_key = DEFAULT_KEY; +static bool got_language = false; +static bool started_first_word = false; +static struct sha1_ctx digester; + +static __inline void check_multiple(const char *name, bool exists) { + if (exists) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + _("several %s definitions found, only the last will be taken " + "into consideration"), name); + } +} + +static void gabc_score_determination_error(const char *error_str) +{ + gregorio_message(error_str, (const char *) "gabc_score_determination_parse", + VERBOSITY_ERROR, 0); +} + +static void gabc_fix_custos(gregorio_score *score_to_check) +{ + gregorio_syllable *current_syllable; + gregorio_element *current_element; + gregorio_element *custo_element; + char pitch = 0; + char pitch_difference = 0; + int newkey; + int current_key; + if (!score_to_check || !score_to_check->first_syllable + || !score_to_check->first_voice_info) { + return; + } + current_key = score_to_check->first_voice_info->initial_key; + current_syllable = score_to_check->first_syllable; + while (current_syllable) { + current_element = (current_syllable->elements)[0]; + while (current_element) { + if (current_element->type == GRE_CUSTOS) { + custo_element = current_element; + pitch = custo_element->u.misc.pitched.pitch; + /* we look for the key */ + while (current_element) { + switch (current_element->type) { + case GRE_C_KEY_CHANGE: + case GRE_C_KEY_CHANGE_FLATED: + pitch = gregorio_determine_next_pitch(current_syllable, + current_element, NULL); + newkey = gregorio_calculate_new_key(C_KEY, + current_element->u.misc.pitched.pitch - '0'); + pitch_difference = (char) newkey - (char) current_key; + pitch -= pitch_difference; + current_key = newkey; + break; + case GRE_F_KEY_CHANGE: + case GRE_F_KEY_CHANGE_FLATED: + pitch = gregorio_determine_next_pitch(current_syllable, + current_element, NULL); + newkey = gregorio_calculate_new_key(F_KEY, + current_element->u.misc.pitched.pitch - '0'); + pitch_difference = (char) newkey - (char) current_key; + pitch -= pitch_difference; + current_key = newkey; + break; + default: + break; + } + if (!custo_element->u.misc.pitched.force_pitch) { + while (pitch < LOWEST_PITCH) { + pitch += 7; + } + while (pitch > HIGHEST_PITCH) { + pitch -= 7; + } + custo_element->u.misc.pitched.pitch = pitch; + } + assert(custo_element->u.misc.pitched.pitch >= LOWEST_PITCH + && custo_element->u.misc.pitched.pitch + <= HIGHEST_PITCH); + current_element = current_element->next; + } + } + if (current_element) { + if (current_element->type == GRE_C_KEY_CHANGE + || current_element->type == GRE_C_KEY_CHANGE_FLATED) { + current_key = gregorio_calculate_new_key(C_KEY, + current_element->u.misc.pitched.pitch - '0'); + } + if (current_element->type == GRE_F_KEY_CHANGE + || current_element->type == GRE_F_KEY_CHANGE_FLATED) { + current_key = gregorio_calculate_new_key(F_KEY, + current_element->u.misc.pitched.pitch - '0'); + } + current_element = current_element->next; + } + } + current_syllable = current_syllable->next_syllable; + } +} + +/* + * A function that checks to score integrity. For now it is... quite + * ridiculous... but it might be improved in the future. + */ + +static int check_score_integrity(gregorio_score *score_to_check) +{ + if (!score_to_check) { + return 0; + } + return 1; +} + +/* + * Another function to be improved: this one checks the validity of the voice_infos. + */ + +static int check_infos_integrity(gregorio_score *score_to_check) +{ + if (!score_to_check->name) { + gregorio_message(_("no name specified, put `name:...;' at the " + "beginning of the file, can be dangerous with some output " + "formats"), "det_score", VERBOSITY_WARNING, 0); + } + return 1; +} + +/* + * The function that will initialize the variables. + */ + +static void initialize_variables(void) +{ + int i; + /* build a brand new empty score */ + score = gregorio_new_score(); + /* initialization of the first voice info to an empty voice info */ + current_voice_info = NULL; + gregorio_add_voice_info(¤t_voice_info); + score->first_voice_info = current_voice_info; + /* other initializations */ + number_of_voices = 0; + voice = 1; + current_character = NULL; + first_translation_character = NULL; + first_text_character = NULL; + translation_type = TR_NORMAL; + no_linebreak_area = NLBA_NORMAL; + euouae = EUOUAE_NORMAL; + center_is_determined = CENTER_NOT_DETERMINED; + for (i = 0; i < 10; i++) { + macros[i] = NULL; + } + started_first_word = false; +} + +/* + * function that frees the variables that need it, for when we have finished to + * determine the score + */ + +static void free_variables(void) +{ + int i; + free(elements); + for (i = 0; i < 10; i++) { + free(macros[i]); + } +} + +/* see whether a voice_info is empty */ +static int voice_info_is_not_empty(const gregorio_voice_info *voice_info) +{ + return (voice_info->initial_key != 5 || voice_info->style + || voice_info->virgula_position); +} + +/* + * a function called when we see "--\n" that end the infos for a certain voice + */ +static void next_voice_info(void) +{ + /* we must do this test in the case where there would be a "--" before + * first_declarations */ + if (voice_info_is_not_empty(current_voice_info)) { + gregorio_add_voice_info(¤t_voice_info); + voice++; + } +} + +/* + * Function that frees the voice_infos for voices > final_count. Useful if + * there are too many voice_infos + */ + +static void reajust_voice_infos(gregorio_voice_info *voice_info, + int final_count) +{ + int i = 1; + while (voice_info && i <= final_count) { + voice_info = voice_info->next_voice_info; + } + gregorio_free_voice_infos(voice_info); +} + +/* + * Function called when we have reached the end of the definitions, it tries to + * make the voice_infos coherent. + */ +static void end_definitions(void) +{ + int i; + + if (!check_infos_integrity(score)) { + gregorio_message(_("can't determine valid infos on the score"), + "det_score", VERBOSITY_ERROR, 0); + } + if (!number_of_voices) { + if (voice > MAX_NUMBER_OF_VOICES) { + voice = MAX_NUMBER_OF_VOICES; + reajust_voice_infos(score->first_voice_info, number_of_voices); + } + number_of_voices = voice; + score->number_of_voices = voice; + } else { + if (number_of_voices > voice) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + ngt_("not enough voice infos found: %d found, %d waited, " + "%d assumed", "not enough voice infos found: %d found, %d " + "waited, %d assumed", voice), voice, + number_of_voices, voice); + score->number_of_voices = voice; + number_of_voices = voice; + } else { + if (number_of_voices < voice) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + ngt_("too many voice infos found: %d found, %d " + "waited, %d assumed", "not enough voice infos found: " + "%d found, %d waited, %d assumed", + number_of_voices), voice, number_of_voices, + number_of_voices); + } + } + } + /* voice is now voice-1, so that it can be the index of elements */ + voice = 0; + elements = (gregorio_element **) gregorio_malloc(number_of_voices * + sizeof(gregorio_element *)); + for (i = 0; i < number_of_voices; i++) { + elements[i] = NULL; + } + + if (!got_language) { + static char latin[] = "Latin"; + gregorio_set_centering_language(latin); + } +} + +/* + * Here starts the code for the determinations of the notes. The notes are not + * precisely determined here, we separate the text describing the notes of each + * voice, and we call determine_elements_from_string to really determine them. + */ +static char position = WORD_BEGINNING; +static gregorio_syllable *current_syllable = NULL; +static char *abovelinestext = NULL; + +/* + * Function called when we see a ")", it completes the gregorio_element array + * of the syllable with NULL pointers. Usefull in the cases where for example + * you have two voices, but a voice that is silent on a certain syllable. + */ +static void complete_with_nulls(int last_voice) +{ + int i; + for (i = last_voice + 1; i < number_of_voices; i++) { + elements[i] = NULL; + } +} + +/* + * Function called each time we find a space, it updates the current position. + */ +static void update_position_with_space(void) +{ + if (position == WORD_MIDDLE) { + position = WORD_END; + } + if (position == WORD_BEGINNING) { + position = WORD_ONE_SYLLABLE; + } +} + +/* + * When we encounter a translation center ending, we call this function that + * sets translation_type = TR_WITH_CENTER_BEGINNING on previous syllable with + * translation + */ +static void gregorio_set_translation_center_beginning( + gregorio_syllable *current_syllable) +{ + gregorio_syllable *syllable = current_syllable->previous_syllable; + while (syllable) { + if (syllable->translation_type == TR_WITH_CENTER_END) { + gregorio_message("encountering translation centering end but " + "cannot find translation centering beginning...", + "set_translation_center_beginning", VERBOSITY_ERROR, 0); + current_syllable->translation_type = TR_NORMAL; + return; + } + if (syllable->translation) { + syllable->translation_type = TR_WITH_CENTER_BEGINNING; + return; + } + syllable = syllable->previous_syllable; + } + /* we didn't find any beginning... */ + gregorio_message("encountering translation centering end but cannot find " + "translation centering beginning...", + "set_translation_center_beginning", VERBOSITY_ERROR, 0); + current_syllable->translation_type = TR_NORMAL; +} + +static void rebuild_characters(void) +{ + bool has_initial = score->initial_style != NO_INITIAL; + + /* we rebuild the first syllable text if it is the first syllable, or if + * it is the second when the first has no text. + * it is a patch for cases like (c4) Al(ab)le(ab) */ + if ((!score->first_syllable && has_initial && current_character) + || (current_syllable && !current_syllable->previous_syllable + && !current_syllable->text && current_character)) { + gregorio_rebuild_first_syllable(¤t_character, has_initial); + + started_first_word = true; + } + + gregorio_rebuild_characters(¤t_character, center_is_determined, + has_initial); + + if (started_first_word) { + gregorio_set_first_word(¤t_character); + } +} + +/* + * Function to close a syllable and update the position. + */ + +static void close_syllable(YYLTYPE *loc) +{ + int i; + gregorio_add_syllable(¤t_syllable, number_of_voices, elements, + first_text_character, first_translation_character, position, + abovelinestext, translation_type, no_linebreak_area, euouae, loc, + started_first_word); + if (!score->first_syllable) { + /* we rebuild the first syllable if we have to */ + score->first_syllable = current_syllable; + } + if (translation_type == TR_WITH_CENTER_END) { + gregorio_set_translation_center_beginning(current_syllable); + } + /* we update the position */ + if (position == WORD_BEGINNING) { + position = WORD_MIDDLE; + } + if (position == WORD_ONE_SYLLABLE || position == WORD_END) { + position = WORD_BEGINNING; + + if (started_first_word) { + started_first_word = false; + } + } + center_is_determined = CENTER_NOT_DETERMINED; + current_character = NULL; + first_text_character = NULL; + first_translation_character = NULL; + translation_type = TR_NORMAL; + no_linebreak_area = NLBA_NORMAL; + euouae = EUOUAE_NORMAL; + abovelinestext = NULL; + for (i = 0; i < number_of_voices; i++) { + elements[i] = NULL; + } + current_element = NULL; +} + +/* a function called when we see a [, basically, all characters are added to + * the translation pointer instead of the text pointer */ +static void start_translation(unsigned char asked_translation_type) +{ + rebuild_characters(); + first_text_character = current_character; + /* the middle letters of the translation have no sense */ + center_is_determined = CENTER_FULLY_DETERMINED; + current_character = NULL; + translation_type = asked_translation_type; +} + +static void end_translation(void) +{ + rebuild_characters(); + first_translation_character = current_character; +} + +/* + * gregorio_gabc_add_text is the function called when lex returns a char *. In + * this function we convert it into grewchar, and then we add the corresponding + * gregorio_characters in the list of gregorio_characters. + */ + +static void gregorio_gabc_add_text(char *mbcharacters) +{ + if (current_character) { + current_character->next_character = gregorio_build_char_list_from_buf( + mbcharacters); + current_character->next_character->previous_character = + current_character; + } else { + current_character = gregorio_build_char_list_from_buf(mbcharacters); + } + while (current_character && current_character->next_character) { + current_character = current_character->next_character; + } + free(mbcharacters); +} + +/* + * the function called when centering_scheme is seen in gabc + */ +static void set_centering_scheme(char *sc) +{ + gregorio_message("\"centering-scheme\" header is deprecated. Please use " + "\\gresetlyriccentering in TeX instead.", "set_centering_scheme", + VERBOSITY_DEPRECATION, 0); + if (strncmp((const char *) sc, "latine", 6) == 0) { + score->centering = SCHEME_VOWEL; + return; + } + if (strncmp((const char *) sc, "english", 6) == 0) { + score->centering = SCHEME_SYLLABLE; + return; + } + gregorio_message("centering-scheme unknown value: must be \"latine\" " + "or \"english\"", "set_centering_scheme", VERBOSITY_WARNING, 0); +} + +/* + * + * The two functions called when lex returns a style, we simply add it. All the + * complex things will be done by the function after... + * + */ + +static void gregorio_gabc_add_style(unsigned char style) +{ + gregorio_begin_style(¤t_character, style); +} + +static void gregorio_gabc_end_style(unsigned char style) +{ + gregorio_end_style(¤t_character, style); +} + +void gabc_digest(const void *const buf, const size_t size) +{ + sha1_process_bytes(buf, size, &digester); +} + +/* + * The "main" function. It is the function that is called when we have to read + * a gabc file. It takes a file descriptor, that is to say a file that is + * aleady open. It returns a valid gregorio_score + */ + +gregorio_score *gabc_read_score(FILE *f_in) +{ + /* compute the SHA-1 digest while parsing, for I/O efficiency */ + sha1_init_ctx(&digester); + /* digest GREGORIO_VERSION to get a different value when the version + changes */ + sha1_process_bytes(GREGORIO_VERSION, strlen(GREGORIO_VERSION), &digester); + /* the input file that flex will parse */ + gabc_score_determination_in = f_in; + if (!f_in) { + gregorio_message(_("can't read stream from argument, returning NULL " + "pointer"), "det_score", VERBOSITY_ERROR, 0); + return NULL; + } + initialize_variables(); + /* the flex/bison main call, it will build the score (that we have + * initialized) */ + gabc_score_determination_parse(); + gregorio_fix_initial_keys(score, DEFAULT_KEY); + gabc_fix_custos(score); + free_variables(); + /* the we check the validity and integrity of the score we have built. */ + if (!check_score_integrity(score)) { + gregorio_free_score(score); + score = NULL; + gregorio_message(_("unable to determine a valid score from file"), + "det_score", VERBOSITY_FATAL, 0); + } + sha1_finish_ctx(&digester, score->digest); + return score; +} + +unsigned char nabc_state = 0; +size_t nabc_lines = 0; + +static void gabc_y_add_notes(char *notes, YYLTYPE loc) { + gregorio_element *new_elements; + gregorio_element *last_element; + if (nabc_state == 0) { + if (!elements[voice]) { + elements[voice] = gabc_det_elements_from_string(notes, + ¤t_key, macros, &loc); + current_element = elements[voice]; + } else { + new_elements = gabc_det_elements_from_string(notes, + ¤t_key, macros, &loc); + last_element = elements[voice]; + while(last_element->next) { + last_element = last_element->next; + } + last_element->next = new_elements; + new_elements->previous = last_element; + current_element = new_elements; + } + } else { + if (!elements[voice]) { + gregorio_add_element(&elements[voice], NULL); + current_element = elements[voice]; + } + if (!current_element) { + gregorio_message(_("current_element is null, this shouldn't " + "happen!"), "gabc_y_add_notes", VERBOSITY_FATAL, 0); + } + if (!current_element->nabc) { + current_element->nabc = (char **) gregorio_calloc (nabc_lines, + sizeof (char *)); + } + current_element->nabc[nabc_state-1] = gregorio_strdup(notes); + current_element->nabc_lines = nabc_state; + } +} + +#line 720 "gabc/gabc-score-determination-y.c" /* yacc.c:339 */ + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* In a future release of Bison, this section will be replaced + by #include "gabc-score-determination-y.h". */ +#ifndef YY_GABC_SCORE_DETERMINATION_GABC_GABC_SCORE_DETERMINATION_Y_H_INCLUDED +# define YY_GABC_SCORE_DETERMINATION_GABC_GABC_SCORE_DETERMINATION_Y_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int gabc_score_determination_debug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + ATTRIBUTE = 258, + COLON = 259, + SEMICOLON = 260, + OFFICE_PART = 261, + ANNOTATION = 262, + AUTHOR = 263, + DATE = 264, + MANUSCRIPT = 265, + MANUSCRIPT_REFERENCE = 266, + MANUSCRIPT_STORAGE_PLACE = 267, + TRANSCRIBER = 268, + TRANSCRIPTION_DATE = 269, + BOOK = 270, + STYLE = 271, + VIRGULA_POSITION = 272, + INITIAL_STYLE = 273, + MODE = 274, + GREGORIOTEX_FONT = 275, + GENERATED_BY = 276, + NAME = 277, + OPENING_BRACKET = 278, + NOTES = 279, + VOICE_CUT = 280, + CLOSING_BRACKET = 281, + NUMBER_OF_VOICES = 282, + VOICE_CHANGE = 283, + END_OF_DEFINITIONS = 284, + SPACE = 285, + CHARACTERS = 286, + I_BEGINNING = 287, + I_END = 288, + TT_BEGINNING = 289, + TT_END = 290, + UL_BEGINNING = 291, + UL_END = 292, + C_BEGINNING = 293, + C_END = 294, + B_BEGINNING = 295, + B_END = 296, + SC_BEGINNING = 297, + SC_END = 298, + SP_BEGINNING = 299, + SP_END = 300, + VERB_BEGINNING = 301, + VERB = 302, + VERB_END = 303, + CENTER_BEGINNING = 304, + CENTER_END = 305, + CLOSING_BRACKET_WITH_SPACE = 306, + TRANSLATION_BEGINNING = 307, + TRANSLATION_END = 308, + GABC_COPYRIGHT = 309, + SCORE_COPYRIGHT = 310, + OCCASION = 311, + METER = 312, + COMMENTARY = 313, + ARRANGER = 314, + GABC_VERSION = 315, + USER_NOTES = 316, + DEF_MACRO = 317, + ALT_BEGIN = 318, + ALT_END = 319, + CENTERING_SCHEME = 320, + TRANSLATION_CENTER_END = 321, + BNLBA = 322, + ENLBA = 323, + EUOUAE_B = 324, + EUOUAE_E = 325, + NABC_CUT = 326, + NABC_LINES = 327, + LANGUAGE = 328 + }; +#endif +/* Tokens. */ +#define ATTRIBUTE 258 +#define COLON 259 +#define SEMICOLON 260 +#define OFFICE_PART 261 +#define ANNOTATION 262 +#define AUTHOR 263 +#define DATE 264 +#define MANUSCRIPT 265 +#define MANUSCRIPT_REFERENCE 266 +#define MANUSCRIPT_STORAGE_PLACE 267 +#define TRANSCRIBER 268 +#define TRANSCRIPTION_DATE 269 +#define BOOK 270 +#define STYLE 271 +#define VIRGULA_POSITION 272 +#define INITIAL_STYLE 273 +#define MODE 274 +#define GREGORIOTEX_FONT 275 +#define GENERATED_BY 276 +#define NAME 277 +#define OPENING_BRACKET 278 +#define NOTES 279 +#define VOICE_CUT 280 +#define CLOSING_BRACKET 281 +#define NUMBER_OF_VOICES 282 +#define VOICE_CHANGE 283 +#define END_OF_DEFINITIONS 284 +#define SPACE 285 +#define CHARACTERS 286 +#define I_BEGINNING 287 +#define I_END 288 +#define TT_BEGINNING 289 +#define TT_END 290 +#define UL_BEGINNING 291 +#define UL_END 292 +#define C_BEGINNING 293 +#define C_END 294 +#define B_BEGINNING 295 +#define B_END 296 +#define SC_BEGINNING 297 +#define SC_END 298 +#define SP_BEGINNING 299 +#define SP_END 300 +#define VERB_BEGINNING 301 +#define VERB 302 +#define VERB_END 303 +#define CENTER_BEGINNING 304 +#define CENTER_END 305 +#define CLOSING_BRACKET_WITH_SPACE 306 +#define TRANSLATION_BEGINNING 307 +#define TRANSLATION_END 308 +#define GABC_COPYRIGHT 309 +#define SCORE_COPYRIGHT 310 +#define OCCASION 311 +#define METER 312 +#define COMMENTARY 313 +#define ARRANGER 314 +#define GABC_VERSION 315 +#define USER_NOTES 316 +#define DEF_MACRO 317 +#define ALT_BEGIN 318 +#define ALT_END 319 +#define CENTERING_SCHEME 320 +#define TRANSLATION_CENTER_END 321 +#define BNLBA 322 +#define ENLBA 323 +#define EUOUAE_B 324 +#define EUOUAE_E 325 +#define NABC_CUT 326 +#define NABC_LINES 327 +#define LANGUAGE 328 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + +/* Location type. */ +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE YYLTYPE; +struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +}; +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + +extern YYSTYPE gabc_score_determination_lval; +extern YYLTYPE gabc_score_determination_lloc; +int gabc_score_determination_parse (void); + +#endif /* !YY_GABC_SCORE_DETERMINATION_GABC_GABC_SCORE_DETERMINATION_Y_H_INCLUDED */ + +/* Copy the second part of user declarations. */ + +#line 931 "gabc/gabc-score-determination-y.c" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 4 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 194 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 74 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 51 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 118 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 162 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 328 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 672, 672, 676, 681, 682, 686, 699, 706, 717, + 724, 733, 740, 747, 757, 764, 771, 778, 785, 792, + 802, 812, 823, 832, 843, 850, 857, 864, 872, 880, + 887, 894, 902, 913, 926, 933, 939, 943, 949, 950, + 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, + 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, + 971, 972, 973, 974, 975, 976, 977, 978, 979, 984, + 985, 989, 1011, 1034, 1047, 1060, 1065, 1074, 1077, 1080, + 1083, 1086, 1089, 1092, 1095, 1098, 1107, 1110, 1113, 1116, + 1119, 1122, 1125, 1128, 1131, 1140, 1143, 1149, 1152, 1158, + 1159, 1162, 1163, 1164, 1165, 1168, 1169, 1173, 1179, 1182, + 1188, 1194, 1199, 1205, 1208, 1214, 1215, 1218, 1219 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "ATTRIBUTE", "COLON", "SEMICOLON", + "OFFICE_PART", "ANNOTATION", "AUTHOR", "DATE", "MANUSCRIPT", + "MANUSCRIPT_REFERENCE", "MANUSCRIPT_STORAGE_PLACE", "TRANSCRIBER", + "TRANSCRIPTION_DATE", "BOOK", "STYLE", "VIRGULA_POSITION", + "INITIAL_STYLE", "MODE", "GREGORIOTEX_FONT", "GENERATED_BY", "NAME", + "OPENING_BRACKET", "NOTES", "VOICE_CUT", "CLOSING_BRACKET", + "NUMBER_OF_VOICES", "VOICE_CHANGE", "END_OF_DEFINITIONS", "SPACE", + "CHARACTERS", "I_BEGINNING", "I_END", "TT_BEGINNING", "TT_END", + "UL_BEGINNING", "UL_END", "C_BEGINNING", "C_END", "B_BEGINNING", "B_END", + "SC_BEGINNING", "SC_END", "SP_BEGINNING", "SP_END", "VERB_BEGINNING", + "VERB", "VERB_END", "CENTER_BEGINNING", "CENTER_END", + "CLOSING_BRACKET_WITH_SPACE", "TRANSLATION_BEGINNING", "TRANSLATION_END", + "GABC_COPYRIGHT", "SCORE_COPYRIGHT", "OCCASION", "METER", "COMMENTARY", + "ARRANGER", "GABC_VERSION", "USER_NOTES", "DEF_MACRO", "ALT_BEGIN", + "ALT_END", "CENTERING_SCHEME", "TRANSLATION_CENTER_END", "BNLBA", + "ENLBA", "EUOUAE_B", "EUOUAE_E", "NABC_CUT", "NABC_LINES", "LANGUAGE", + "$accept", "score", "all_definitions", "definitions", + "number_of_voices_definition", "macro_definition", "name_definition", + "centering_scheme_definition", "language_definition", + "gabc_copyright_definition", "score_copyright_definition", + "gregoriotex_font_definition", "office_part_definition", + "occasion_definition", "meter_definition", "commentary_definition", + "arranger_definition", "gabc_version_definition", "mode_definition", + "nabc_lines_definition", "initial_style_definition", + "annotation_definition", "author_definition", "date_definition", + "manuscript_definition", "manuscript_reference_definition", + "manuscript_storage_place_definition", "book_definition", + "transcriber_definition", "transcription_date_definition", + "style_definition", "virgula_position_definition", + "generated_by_definition", "user_notes_definition", "attribute", + "definition", "notes", "note", "style_beginning", "style_end", "euouae", + "linebreak_area", "character", "text", "translation_beginning", + "translation", "above_line_text", "syllable_with_notes", + "notes_without_word", "syllable", "syllables", YY_NULLPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328 +}; +# endif + +#define YYPACT_NINF -83 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-83))) + +#define YYTABLE_NINF -3 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int8 yypact[] = +{ + -83, 20, -83, -6, -83, 17, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, -83, -83, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, 53, -83, 2, -83, -83, -83, 21, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, 6, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -2, -83, -83, -83, -83, -83, -83, -83, -83, -83, + 8, -83, 93, -83, 28, -83, -7, -83, -83, -83, + 6, -30, -83, -83, 6, -83, -83, -83, -83, -83, + -83, 6 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 4, 0, 117, 0, 1, 105, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 68, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 38, 40, + 39, 66, 67, 41, 42, 64, 56, 57, 58, 59, + 60, 61, 63, 52, 62, 55, 54, 53, 50, 49, + 48, 51, 47, 46, 45, 44, 43, 65, 5, 69, + 107, 109, 0, 105, 0, 115, 116, 118, 0, 14, + 23, 24, 25, 26, 27, 28, 30, 31, 29, 32, + 33, 22, 20, 13, 34, 8, 6, 11, 12, 15, + 16, 17, 18, 19, 35, 7, 9, 21, 10, 113, + 69, 100, 77, 86, 78, 87, 79, 88, 80, 89, + 81, 90, 82, 91, 84, 93, 83, 92, 85, 94, + 0, 97, 98, 95, 96, 101, 102, 104, 103, 106, + 0, 99, 0, 69, 0, 37, 0, 75, 76, 70, + 111, 0, 69, 108, 114, 36, 73, 71, 72, 74, + 110, 112 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, + -83, -83, -83, -83, 157, -83, -82, -83, -83, -83, + -83, -83, -83, -38, -83, -36, -83, -83, -83, -83, + -83 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 1, 2, 3, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 79, 68, 109, 149, 135, 136, + 137, 138, 139, 72, 73, 74, 141, 75, 76, 77, + 5 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int16 yytable[] = +{ + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, -2, 156, 157, + 4, 23, 24, 25, 144, 143, 145, 78, 150, 151, + 146, 152, 147, 155, 160, 142, 140, 0, 0, 0, + 69, 0, 0, 0, 158, 0, 0, 0, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 148, 0, 35, + 0, 154, 0, 0, 159, 0, 36, 37, 0, 70, + 161, 0, 0, 0, 0, 0, 110, 0, 0, 0, + 0, 0, 0, 71, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 0, 127, 128, 129, 0, 70, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 130, 0, 0, 71, + 131, 132, 133, 134, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 0, 127, 128, 129, 0, 0, 153, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 130, 0, 0, 0, + 131, 132, 133, 134, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 0, 0, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108 +}; + +static const yytype_int16 yycheck[] = +{ + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 0, 25, 26, + 0, 27, 28, 29, 3, 23, 5, 4, 110, 31, + 24, 23, 26, 5, 64, 73, 72, -1, -1, -1, + 23, -1, -1, -1, 51, -1, -1, -1, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 51, -1, 65, + -1, 143, -1, -1, 71, -1, 72, 73, -1, 52, + 152, -1, -1, -1, -1, -1, 23, -1, -1, -1, + -1, -1, -1, 66, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + -1, 48, 49, 50, -1, 52, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 63, -1, -1, 66, + 67, 68, 69, 70, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + -1, 48, 49, 50, -1, -1, 53, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, + 67, 68, 69, 70, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, -1, -1, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 75, 76, 77, 0, 124, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 27, 28, 29, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 65, 72, 73, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 109, 23, + 52, 66, 117, 118, 119, 121, 122, 123, 4, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 110, + 23, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, + 63, 67, 68, 69, 70, 112, 113, 114, 115, 116, + 119, 120, 117, 23, 3, 5, 24, 26, 51, 111, + 110, 31, 23, 53, 110, 5, 25, 26, 51, 71, + 64, 110 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 74, 75, 76, 77, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 108, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, 109, 110, + 110, 111, 111, 111, 111, 111, 111, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 114, 114, 115, 115, 116, + 116, 116, 116, 116, 116, 117, 117, 118, 119, 119, + 120, 121, 121, 122, 122, 123, 123, 124, 124 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 3, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 2, 1, 3, 1, + 3, 3, 4, 2, 3, 1, 1, 0, 2 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) +#endif + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL + +/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ + +YY_ATTRIBUTE_UNUSED +static unsigned +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) +{ + unsigned res = 0; + int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; + if (0 <= yylocp->first_line) + { + res += YYFPRINTF (yyo, "%d", yylocp->first_line); + if (0 <= yylocp->first_column) + res += YYFPRINTF (yyo, ".%d", yylocp->first_column); + } + if (0 <= yylocp->last_line) + { + if (yylocp->first_line < yylocp->last_line) + { + res += YYFPRINTF (yyo, "-%d", yylocp->last_line); + if (0 <= end_col) + res += YYFPRINTF (yyo, ".%d", end_col); + } + else if (0 <= end_col && yylocp->first_column < end_col) + res += YYFPRINTF (yyo, "-%d", end_col); + } + return res; + } + +# define YY_LOCATION_PRINT(File, Loc) \ + yy_location_print_ (File, &(Loc)) + +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (yylocationp); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Location data for the lookahead symbol. */ +YYLTYPE yylloc +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL + = { 1, 1, 1, 1 } +# endif +; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + 'yyls': related to locations. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[3]; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yylsp = yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + +/* User initialization code. */ +#line 646 "gabc/gabc-score-determination.y" /* yacc.c:1429 */ +{ + yylloc.first_line = 1; + yylloc.first_column = 0; + yylloc.first_offset = 0; + yylloc.last_line = 1; + yylloc.last_column = 0; + yylloc.last_offset = 0; +} + +#line 2090 "gabc/gabc-score-determination-y.c" /* yacc.c:1429 */ + yylsp[0] = yylloc; + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + *++yylsp = yylloc; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 3: +#line 676 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + end_definitions(); + } +#line 2281 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 6: +#line 686 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + number_of_voices=atoi((yyvsp[0]).text); + free((yyvsp[0]).text); + if (number_of_voices > MAX_NUMBER_OF_VOICES) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + _("can't define %d voices, maximum is %d"), + number_of_voices, MAX_NUMBER_OF_VOICES); + } + gregorio_set_score_number_of_voices (score, number_of_voices); + } +#line 2296 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 7: +#line 699 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + free(macros[(yyvsp[-1]).character - '0']); + macros[(yyvsp[-1]).character - '0'] = (yyvsp[0]).text; + } +#line 2305 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 8: +#line 706 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + if ((yyvsp[0]).text==NULL) { + gregorio_message("name can't be empty","det_score", + VERBOSITY_WARNING, 0); + } + check_multiple("name", score->name != NULL); + gregorio_set_score_name (score, (yyvsp[0]).text); + } +#line 2318 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 9: +#line 717 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + set_centering_scheme((yyvsp[0]).text); + free((yyvsp[0]).text); + } +#line 2327 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 10: +#line 724 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("language", got_language); + gregorio_set_centering_language((yyvsp[0]).text); + free((yyvsp[0]).text); + got_language = true; + } +#line 2338 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 11: +#line 733 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("gabc-copyright", score->gabc_copyright != NULL); + gregorio_set_score_gabc_copyright (score, (yyvsp[0]).text); + } +#line 2347 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 12: +#line 740 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("score_copyright", score->score_copyright != NULL); + gregorio_set_score_score_copyright (score, (yyvsp[0]).text); + } +#line 2356 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 13: +#line 747 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_message("\"gregoriotex-font\" header is deprecated. " + "Please use \\gresetgregoriofont in TeX instead.", + "set_gregoriotex_font", VERBOSITY_DEPRECATION, 0); + check_multiple("GregorioTeX font", score->gregoriotex_font != NULL); + score->gregoriotex_font=(yyvsp[0]).text; + } +#line 2368 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 14: +#line 757 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("office part", score->office_part != NULL); + gregorio_set_score_office_part (score, (yyvsp[0]).text); + } +#line 2377 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 15: +#line 764 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("occasion", score->occasion != NULL); + gregorio_set_score_occasion (score, (yyvsp[0]).text); + } +#line 2386 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 16: +#line 771 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("meter", score->meter != NULL); + gregorio_set_score_meter (score, (yyvsp[0]).text); + } +#line 2395 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 17: +#line 778 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("commentary", score->commentary != NULL); + gregorio_set_score_commentary (score, (yyvsp[0]).text); + } +#line 2404 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 18: +#line 785 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("arranger", score->arranger != NULL); + gregorio_set_score_arranger (score, (yyvsp[0]).text); + } +#line 2413 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 19: +#line 792 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + /* Deprecated */ + gregorio_message("\"gabc-version\" header is deprecated and will be " + "ignored.", "gabc_score_determination_parse", + VERBOSITY_DEPRECATION, 0); + free((yyvsp[0]).text); + } +#line 2425 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 20: +#line 802 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("mode", score->mode != 0); + if ((yyvsp[0]).text) { + score->mode=atoi((yyvsp[0]).text); + free((yyvsp[0]).text); + } + } +#line 2437 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 21: +#line 812 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("nabc lines", score->nabc_lines != 0); + if ((yyvsp[0]).text) { + nabc_lines=atoi((yyvsp[0]).text); + score->nabc_lines=nabc_lines; + free((yyvsp[0]).text); + } + } +#line 2450 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 22: +#line 823 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + if ((yyvsp[0]).text) { + score->initial_style=atoi((yyvsp[0]).text); + free((yyvsp[0]).text); + } + } +#line 2461 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 23: +#line 832 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + if (score->annotation [MAX_ANNOTATIONS - 1]) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + _("too many definitions of annotation found, only the " + "first %d will be taken"), MAX_ANNOTATIONS); + } + gregorio_set_score_annotation (score, (yyvsp[0]).text); + } +#line 2474 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 24: +#line 843 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("author", score->si.author != NULL); + gregorio_set_score_author (score, (yyvsp[0]).text); + } +#line 2483 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 25: +#line 850 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("date", score->si.date != NULL); + gregorio_set_score_date (score, (yyvsp[0]).text); + } +#line 2492 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 26: +#line 857 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("manuscript", score->si.manuscript != NULL); + gregorio_set_score_manuscript (score, (yyvsp[0]).text); + } +#line 2501 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 27: +#line 864 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("manuscript-reference", + score->si.manuscript_reference != NULL); + gregorio_set_score_manuscript_reference (score, (yyvsp[0]).text); + } +#line 2511 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 28: +#line 872 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("manuscript-storage-place", + score->si.manuscript_storage_place != NULL); + gregorio_set_score_manuscript_storage_place (score, (yyvsp[0]).text); + } +#line 2521 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 29: +#line 880 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("book", score->si.book != NULL); + gregorio_set_score_book (score, (yyvsp[0]).text); + } +#line 2530 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 30: +#line 887 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("transcriber", score->si.transcriber != NULL); + gregorio_set_score_transcriber (score, (yyvsp[0]).text); + } +#line 2539 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 31: +#line 894 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + check_multiple("transcription date", + score->si.transcription_date != NULL); + gregorio_set_score_transcription_date (score, (yyvsp[0]).text); + } +#line 2549 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 32: +#line 902 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + if (current_voice_info->style) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + _("several definitions of style found for voice %d, only " + "the last will be taken into consideration"), voice); + } + gregorio_set_voice_style (current_voice_info, (yyvsp[0]).text); + } +#line 2562 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 33: +#line 913 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + if (current_voice_info->virgula_position) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + _("several definitions of virgula position found for " + "voice %d, only the last will be taken into consideration"), + voice); + } + gregorio_set_voice_virgula_position (current_voice_info, (yyvsp[0]).text); + } +#line 2576 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 34: +#line 926 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + /* set_voice_generated_by (current_voice_info, $2.text); */ + free((yyvsp[0]).text); + } +#line 2585 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 35: +#line 933 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_set_score_user_notes (score, (yyvsp[0]).text); + } +#line 2593 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 36: +#line 939 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + (yyval).text = (yyvsp[-1]).text; + } +#line 2601 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 37: +#line 943 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + (yyval).text = NULL; + } +#line 2609 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 68: +#line 979 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + next_voice_info(); + } +#line 2617 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 71: +#line 989 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + if (voice<number_of_voices) { + gabc_y_add_notes((yyvsp[-1]).text, (yylsp[-1])); + free((yyvsp[-1]).text); + } + else { + gregorio_messagef("det_score", VERBOSITY_ERROR, 0, + ngt_("too many voices in note : %d found, %d expected", + "too many voices in note : %d found, %d expected", + number_of_voices), voice+1, number_of_voices); + } + if (voice<number_of_voices-1) { + gregorio_messagef("det_score", VERBOSITY_INFO, 0, + ngt_("not enough voices in note : %d found, %d expected, " + "completing with empty neume", "not enough voices in note " + ": %d found, %d expected, completing with empty neume", + voice+1), voice+1, number_of_voices); + complete_with_nulls(voice); + } + voice=0; + nabc_state=0; + } +#line 2644 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 72: +#line 1011 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + if (voice<number_of_voices) { + gabc_y_add_notes((yyvsp[-1]).text, (yylsp[-1])); + free((yyvsp[-1]).text); + } + else { + gregorio_messagef("det_score", VERBOSITY_ERROR, 0, + ngt_("too many voices in note : %d found, %d expected", + "too many voices in note : %d found, %d expected", + number_of_voices), voice+1, number_of_voices); + } + if (voice<number_of_voices-1) { + gregorio_messagef("det_score", VERBOSITY_INFO, 0, + ngt_("not enough voices in note : %d found, %d expected, " + "completing with empty neume", "not enough voices in note " + ": %d found, %d expected, completing with empty neume", + voice+1), voice+1, number_of_voices); + complete_with_nulls(voice); + } + voice=0; + nabc_state=0; + update_position_with_space(); + } +#line 2672 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 73: +#line 1034 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + if (voice<number_of_voices) { + gabc_y_add_notes((yyvsp[-1]).text, (yylsp[-1])); + free((yyvsp[-1]).text); + voice++; + } + else { + gregorio_messagef("det_score", VERBOSITY_ERROR, 0, + ngt_("too many voices in note : %d found, %d expected", + "too many voices in note : %d found, %d expected", + number_of_voices), voice+1, number_of_voices); + } + } +#line 2690 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 74: +#line 1047 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + if (!nabc_lines) { + gregorio_message(_("You used character \"|\" in gabc without " + "setting \"nabc-lines\" parameter. Please " + "set it in your gabc header."), + "det_score", VERBOSITY_FATAL, 0); + } + if (voice<number_of_voices) { + gabc_y_add_notes((yyvsp[-1]).text, (yylsp[-1])); + free((yyvsp[-1]).text); + nabc_state = (nabc_state + 1) % (nabc_lines+1); + } + } +#line 2708 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 75: +#line 1060 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + elements[voice]=NULL; + voice=0; + nabc_state=0; + } +#line 2718 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 76: +#line 1065 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + elements[voice]=NULL; + voice=0; + nabc_state=0; + update_position_with_space(); + } +#line 2729 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 77: +#line 1074 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_add_style(ST_ITALIC); + } +#line 2737 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 78: +#line 1077 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_add_style(ST_TT); + } +#line 2745 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 79: +#line 1080 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_add_style(ST_UNDERLINED); + } +#line 2753 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 80: +#line 1083 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_add_style(ST_COLORED); + } +#line 2761 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 81: +#line 1086 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_add_style(ST_BOLD); + } +#line 2769 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 82: +#line 1089 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_add_style(ST_SMALL_CAPS); + } +#line 2777 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 83: +#line 1092 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_add_style(ST_VERBATIM); + } +#line 2785 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 84: +#line 1095 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_add_style(ST_SPECIAL_CHAR); + } +#line 2793 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 85: +#line 1098 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + if (!center_is_determined) { + gregorio_gabc_add_style(ST_FORCED_CENTER); + center_is_determined=CENTER_HALF_DETERMINED; + } + } +#line 2804 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 86: +#line 1107 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_end_style(ST_ITALIC); + } +#line 2812 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 87: +#line 1110 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_end_style(ST_TT); + } +#line 2820 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 88: +#line 1113 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_end_style(ST_UNDERLINED); + } +#line 2828 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 89: +#line 1116 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_end_style(ST_COLORED); + } +#line 2836 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 90: +#line 1119 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_end_style(ST_BOLD); + } +#line 2844 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 91: +#line 1122 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_end_style(ST_SMALL_CAPS); + } +#line 2852 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 92: +#line 1125 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_end_style(ST_VERBATIM); + } +#line 2860 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 93: +#line 1128 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_end_style(ST_SPECIAL_CHAR); + } +#line 2868 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 94: +#line 1131 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + if (center_is_determined==CENTER_HALF_DETERMINED) { + gregorio_gabc_end_style(ST_FORCED_CENTER); + center_is_determined=CENTER_FULLY_DETERMINED; + } + } +#line 2879 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 95: +#line 1140 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + euouae = EUOUAE_BEGINNING; + } +#line 2887 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 96: +#line 1143 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + euouae = EUOUAE_END; + } +#line 2895 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 97: +#line 1149 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + no_linebreak_area = NLBA_BEGINNING; + } +#line 2903 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 98: +#line 1152 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + no_linebreak_area = NLBA_END; + } +#line 2911 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 100: +#line 1159 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + gregorio_gabc_add_text((yyvsp[0]).text); + } +#line 2919 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 107: +#line 1173 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + start_translation(TR_NORMAL); + } +#line 2927 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 108: +#line 1179 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + end_translation(); + } +#line 2935 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 109: +#line 1182 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + start_translation(TR_WITH_CENTER_END); + } +#line 2943 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 110: +#line 1188 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + abovelinestext = (yyvsp[-1]).text; + } +#line 2951 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 111: +#line 1194 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + rebuild_characters(); + first_text_character = current_character; + close_syllable(&(yylsp[-2])); + } +#line 2961 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 112: +#line 1199 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + close_syllable(&(yylsp[-3])); + } +#line 2969 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 113: +#line 1205 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + close_syllable(NULL); + } +#line 2977 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + case 114: +#line 1208 "gabc/gabc-score-determination.y" /* yacc.c:1646 */ + { + close_syllable(NULL); + } +#line 2985 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + break; + + +#line 2989 "gabc/gabc-score-determination-y.c" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + *++yylsp = yyloc; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + yyerror_range[1] = yylloc; + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + yyerror_range[1] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + yyerror_range[1] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + yyerror_range[2] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-y.h b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-y.h new file mode 100644 index 00000000000..d68c9b6f591 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-y.h @@ -0,0 +1,220 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef YY_GABC_SCORE_DETERMINATION_GABC_GABC_SCORE_DETERMINATION_Y_H_INCLUDED +# define YY_GABC_SCORE_DETERMINATION_GABC_GABC_SCORE_DETERMINATION_Y_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int gabc_score_determination_debug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + ATTRIBUTE = 258, + COLON = 259, + SEMICOLON = 260, + OFFICE_PART = 261, + ANNOTATION = 262, + AUTHOR = 263, + DATE = 264, + MANUSCRIPT = 265, + MANUSCRIPT_REFERENCE = 266, + MANUSCRIPT_STORAGE_PLACE = 267, + TRANSCRIBER = 268, + TRANSCRIPTION_DATE = 269, + BOOK = 270, + STYLE = 271, + VIRGULA_POSITION = 272, + INITIAL_STYLE = 273, + MODE = 274, + GREGORIOTEX_FONT = 275, + GENERATED_BY = 276, + NAME = 277, + OPENING_BRACKET = 278, + NOTES = 279, + VOICE_CUT = 280, + CLOSING_BRACKET = 281, + NUMBER_OF_VOICES = 282, + VOICE_CHANGE = 283, + END_OF_DEFINITIONS = 284, + SPACE = 285, + CHARACTERS = 286, + I_BEGINNING = 287, + I_END = 288, + TT_BEGINNING = 289, + TT_END = 290, + UL_BEGINNING = 291, + UL_END = 292, + C_BEGINNING = 293, + C_END = 294, + B_BEGINNING = 295, + B_END = 296, + SC_BEGINNING = 297, + SC_END = 298, + SP_BEGINNING = 299, + SP_END = 300, + VERB_BEGINNING = 301, + VERB = 302, + VERB_END = 303, + CENTER_BEGINNING = 304, + CENTER_END = 305, + CLOSING_BRACKET_WITH_SPACE = 306, + TRANSLATION_BEGINNING = 307, + TRANSLATION_END = 308, + GABC_COPYRIGHT = 309, + SCORE_COPYRIGHT = 310, + OCCASION = 311, + METER = 312, + COMMENTARY = 313, + ARRANGER = 314, + GABC_VERSION = 315, + USER_NOTES = 316, + DEF_MACRO = 317, + ALT_BEGIN = 318, + ALT_END = 319, + CENTERING_SCHEME = 320, + TRANSLATION_CENTER_END = 321, + BNLBA = 322, + ENLBA = 323, + EUOUAE_B = 324, + EUOUAE_E = 325, + NABC_CUT = 326, + NABC_LINES = 327, + LANGUAGE = 328 + }; +#endif +/* Tokens. */ +#define ATTRIBUTE 258 +#define COLON 259 +#define SEMICOLON 260 +#define OFFICE_PART 261 +#define ANNOTATION 262 +#define AUTHOR 263 +#define DATE 264 +#define MANUSCRIPT 265 +#define MANUSCRIPT_REFERENCE 266 +#define MANUSCRIPT_STORAGE_PLACE 267 +#define TRANSCRIBER 268 +#define TRANSCRIPTION_DATE 269 +#define BOOK 270 +#define STYLE 271 +#define VIRGULA_POSITION 272 +#define INITIAL_STYLE 273 +#define MODE 274 +#define GREGORIOTEX_FONT 275 +#define GENERATED_BY 276 +#define NAME 277 +#define OPENING_BRACKET 278 +#define NOTES 279 +#define VOICE_CUT 280 +#define CLOSING_BRACKET 281 +#define NUMBER_OF_VOICES 282 +#define VOICE_CHANGE 283 +#define END_OF_DEFINITIONS 284 +#define SPACE 285 +#define CHARACTERS 286 +#define I_BEGINNING 287 +#define I_END 288 +#define TT_BEGINNING 289 +#define TT_END 290 +#define UL_BEGINNING 291 +#define UL_END 292 +#define C_BEGINNING 293 +#define C_END 294 +#define B_BEGINNING 295 +#define B_END 296 +#define SC_BEGINNING 297 +#define SC_END 298 +#define SP_BEGINNING 299 +#define SP_END 300 +#define VERB_BEGINNING 301 +#define VERB 302 +#define VERB_END 303 +#define CENTER_BEGINNING 304 +#define CENTER_END 305 +#define CLOSING_BRACKET_WITH_SPACE 306 +#define TRANSLATION_BEGINNING 307 +#define TRANSLATION_END 308 +#define GABC_COPYRIGHT 309 +#define SCORE_COPYRIGHT 310 +#define OCCASION 311 +#define METER 312 +#define COMMENTARY 313 +#define ARRANGER 314 +#define GABC_VERSION 315 +#define USER_NOTES 316 +#define DEF_MACRO 317 +#define ALT_BEGIN 318 +#define ALT_END 319 +#define CENTERING_SCHEME 320 +#define TRANSLATION_CENTER_END 321 +#define BNLBA 322 +#define ENLBA 323 +#define EUOUAE_B 324 +#define EUOUAE_E 325 +#define NABC_CUT 326 +#define NABC_LINES 327 +#define LANGUAGE 328 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + +/* Location type. */ +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE YYLTYPE; +struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +}; +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + +extern YYSTYPE gabc_score_determination_lval; +extern YYLTYPE gabc_score_determination_lloc; +int gabc_score_determination_parse (void); + +#endif /* !YY_GABC_SCORE_DETERMINATION_GABC_GABC_SCORE_DETERMINATION_Y_H_INCLUDED */ diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination.h b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination.h new file mode 100644 index 00000000000..3098ec17766 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination.h @@ -0,0 +1,37 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header shares definitions between the score parser and lexer. + * + * Gregorio score determination in gabc input. + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "gabc.h" + +typedef union gabc_score_determination_lval_t { + char *text; + char character; +} gabc_score_determination_lval_t; + +#define YYSTYPE gabc_score_determination_lval_t +#define YYSTYPE_IS_DECLARED 1 + +int gabc_score_determination_lex(void); +#define YY_DECL int gabc_score_determination_lex(void) + +#define YYLTYPE gregorio_scanner_location diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination.l b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination.l new file mode 100644 index 00000000000..1001a2f72a6 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination.l @@ -0,0 +1,427 @@ +%{ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the score lexer. + * + * Gregorio score determination in gabc input. + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "struct.h" +#include "messages.h" +#include "support.h" + +#include "gabc.h" +#include "gabc-score-determination.h" +#include "gabc-score-determination-y.h" + +static unsigned char style_stack = 0; + +#define YY_NO_INPUT + +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) { \ + int c = '*'; \ + size_t n; \ + for (n = 0; n < max_size \ + && (c = getc(gabc_score_determination_in)) != EOF \ + && c != '\n'; ++n ) { \ + buf[n] = (char) c; \ + } \ + if (c == '\n') { \ + buf[n++] = (char) c; \ + } \ + if (c == EOF && ferror(gabc_score_determination_in)) { \ + YY_FATAL_ERROR("input in flex scanner failed"); \ + } \ + result = n; \ + } else { \ + errno=0; \ + while ((result = fread(buf, 1, max_size, gabc_score_determination_in)) \ + == 0 && ferror(gabc_score_determination_in)) { \ + if (errno != EINTR) { \ + YY_FATAL_ERROR("input in flex scanner failed"); \ + break; \ + } \ + errno = 0; \ + clearerr(gabc_score_determination_in); \ + } \ + } \ + gabc_digest(buf, result) + +#define YY_USER_ACTION gabc_update_location(&gabc_score_determination_lloc, \ + gabc_score_determination_text, gabc_score_determination_leng); + +%} + +%x attribute +%x score +%x notes +%x style +%x verb +%x comments +%x inicomments +%x alt + +%option stack +%option pointer +%option nounput +%option noyy_push_state +%option noyy_pop_state +%option noyy_top_state +%option align +%option noread +%option nomain +%option noalways-interactive +%option nonever-interactive +%option prefix="gabc_score_determination_" +%option noyywrap +%option 8bit + + +/* The expression for attribute below is rather messy because we allow +for (a) single-line values, ending with a semicolon at end of line or a +double semicolon, (b) multi-line values, which end at a double +semicolon. */ + +%% +<INITIAL>^(\xBB|\xEF|\xBF)* { + /* BOM written by a lot of windows softwares when they write UTF-8 */ + } +<INITIAL>^[\n\r]+ { + /* ignoring empty lines */ + } +<INITIAL>^[\%#] { + BEGIN(inicomments); + } +<inicomments>(\n|\r)+ { + BEGIN(INITIAL); + } +<inicomments>[^\n\r]* { + /* ignored */ + } +<INITIAL>:(\ )? { + BEGIN(attribute); + return COLON; + } +<attribute>[^;\n\r]*(;[^;\n\r]+)*([\n\r]+[^;]*(;[^;]+)*)? { + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return ATTRIBUTE; + } +<attribute>;(;|[\n\r]+) { + BEGIN(INITIAL); + return SEMICOLON; + } +<INITIAL>def-m[0-9] { + gabc_score_determination_lval.character = gabc_score_determination_text[5]; + return DEF_MACRO; + } +<INITIAL>number-of-voices { + return NUMBER_OF_VOICES; + } +<INITIAL>name { + return NAME; + } +<INITIAL>score-copyright { + return SCORE_COPYRIGHT; + } +<INITIAL>gabc-copyright { + return GABC_COPYRIGHT; + } +<INITIAL>office-part { + return OFFICE_PART; + } +<INITIAL>occasion { + return OCCASION; + } +<INITIAL>meter { + return METER; + } +<INITIAL>commentary { + return COMMENTARY; + } +<INITIAL>arranger { + return ARRANGER; + } +<INITIAL>gabc-version { + return GABC_VERSION; + } +<INITIAL>initial-style { + return INITIAL_STYLE; + } +<INITIAL>mode { + return MODE; + } +<INITIAL>annotation { + return ANNOTATION; + } +<INITIAL>author { + return AUTHOR; + } +<INITIAL>date { + return DATE; + } +<INITIAL>manuscript { + return MANUSCRIPT; + } +<INITIAL>manuscript-reference { + return MANUSCRIPT_REFERENCE; + } +<INITIAL>manuscript-storage-place { + return MANUSCRIPT_STORAGE_PLACE; + } +<INITIAL>book { + return BOOK; + } +<INITIAL>transcriber { + return TRANSCRIBER; + } +<INITIAL>generated-by { + return GENERATED_BY; + } +<INITIAL>centering-scheme { + return CENTERING_SCHEME; + } +<INITIAL>language { + return LANGUAGE; + } +<INITIAL>transcription-date { + return TRANSCRIPTION_DATE; + } +<INITIAL>style { + return STYLE; + } +<INITIAL>virgula-position { + return VIRGULA_POSITION; + } +<INITIAL>gregoriotex-font { + return GREGORIOTEX_FONT; + } +<INITIAL>nabc-lines { + return NABC_LINES; + } +<INITIAL>user-notes { + return USER_NOTES; + } +<INITIAL>--(.*) { + return VOICE_CHANGE; + } +<INITIAL>%(%)*(\n|\r)+ { + BEGIN(score); + return END_OF_DEFINITIONS; + } +<INITIAL>. { + gregorio_messagef("det_score", VERBOSITY_ERROR, 0, + _("unrecognized character: \"%c\" in definition part"), + gabc_score_determination_text[0]); + } +<score>[^\{\}\(\[\]<%]+ { + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return CHARACTERS; + } +<score,style><i> { + BEGIN(style); + style_stack ++; + return I_BEGINNING; + } +<score,style><nlba> { + return BNLBA; + } +<score,style><\/nlba> { + return ENLBA; + } +<style><\/i> { + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return I_END; + } +<score,style><tt> { + BEGIN(style); + style_stack ++; + return TT_BEGINNING; + } +<style><\/tt> { + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return TT_END; + } +<score,style><ul> { + BEGIN(style); + style_stack ++; + return UL_BEGINNING; + } +<style><\/ul> { + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return UL_END; + } +<score,style><c> { + BEGIN(style); + style_stack ++; + return C_BEGINNING; + } +<style><\/c> { + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return C_END; + } +<score,style><b> { + BEGIN(style); + style_stack ++; + return B_BEGINNING; + } +<style><\/b> { + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return B_END; + } +<score,style><sc> { + BEGIN(style); + style_stack ++; + return SC_BEGINNING; + } +<style><\/sc> { + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return SC_END; + } +<score,style><sp> { + BEGIN(style); + style_stack ++; + return SP_BEGINNING; + } +<style><\/sp> { + style_stack --; + if (style_stack == 0) { + BEGIN(score); + } + return SP_END; + } +<style>[^<\{\}]* { + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return CHARACTERS; + } +<score>\% { + BEGIN(comments); + } +<comments>(\n|\r)+ { + BEGIN(score); + } +<comments>[^\n\r]* { + /* ignored */ + } +<style,score><v> { + BEGIN(verb); + return VERB_BEGINNING; + } +<verb><\/v> { + if (style_stack == 0) { + BEGIN(score); + } else { + BEGIN(style); + } + return VERB_END; + } +<verb>[^<]* { + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return CHARACTERS; + } +<verb,style,score,alt>< { + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return CHARACTERS; + } +<score,style>\{ { + return CENTER_BEGINNING; + } +<score,style>\} { + return CENTER_END; + } +<score><alt> { + BEGIN(alt); + return ALT_BEGIN; + } +<alt>[^<]* { + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return CHARACTERS; + } +<alt><\/alt> { + BEGIN(score); + return ALT_END; + } +<score><eu> { + return EUOUAE_B; + } +<score><\/eu> { + return EUOUAE_E; + } +<score>\[\/] { + return TRANSLATION_CENTER_END; + } +<score>\[ { + return TRANSLATION_BEGINNING; + } +<score>\] { + return TRANSLATION_END; + } +<score>\( { + BEGIN(notes); + return OPENING_BRACKET; + } +<notes>[^&|\)]* { + gabc_score_determination_lval.text = + gregorio_strdup(gabc_score_determination_text); + return NOTES; + } +<notes>& { + return VOICE_CUT; + } +<notes>\| { + return NABC_CUT; + } +<notes>\) { + BEGIN(score); + return CLOSING_BRACKET; + } +<notes>\)(\ |\t|\n|\r)+ { + BEGIN(score); + return CLOSING_BRACKET_WITH_SPACE; + } +%% + diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination.y b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination.y new file mode 100644 index 00000000000..fde1ecf2708 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-score-determination.y @@ -0,0 +1,1220 @@ +%{ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the score parser. + * + * Gregorio score determination in gabc input. + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* + * + * This file is certainly not the most easy to understand, it is a bison file. + * See the bison manual on gnu.org for further details. + * + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> +#include "bool.h" +#include "struct.h" +#include "unicode.h" +#include "messages.h" +#include "characters.h" +#include "support.h" +#include "sha1.h" +#include "plugins.h" +#include "gabc.h" + +#define YYLLOC_DEFAULT(Current, Rhs, N) \ + if (N) { \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).first_offset = YYRHSLOC (Rhs, 1).first_offset; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + (Current).last_offset = YYRHSLOC (Rhs, N).last_offset; \ + } else { \ + (Current).first_line = (Current).last_line = YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = YYRHSLOC (Rhs, 0).last_column; \ + (Current).first_offset = (Current).last_offset = YYRHSLOC (Rhs, 0).last_offset; \ + } + +#include "gabc-score-determination.h" +#include "gabc-score-determination-l.h" + +/* uncomment it if you want to have an interactive shell to understand the + * details on how bison works for a certain input */ +/* int gabc_score_determination_debug=1; */ + +/* + * + * We will need some variables and functions through the entire file, we + * declare them there: + * + */ + +/* the score that we will determine and return */ +static gregorio_score *score; +/* an array of elements that we will use for each syllable */ +static gregorio_element **elements; +gregorio_element *current_element; +/* a table containing the macros to use in gabc file */ +static char *macros[10]; +/* forward declaration of the flex/bison process function */ +static int gabc_score_determination_parse(void); +/* other variables that we will have to use */ +static gregorio_character *current_character; +static gregorio_character *first_text_character; +static gregorio_character *first_translation_character; +static gregorio_tr_centering translation_type; +static gregorio_nlba no_linebreak_area; +static gregorio_euouae euouae; +static gregorio_voice_info *current_voice_info; +static int number_of_voices; +static int voice; +/* see comments on text to understand this */ +static gregorio_center_determination center_is_determined; +/* current_key is... the current key... updated by each notes determination + * (for key changes) */ +static int current_key = DEFAULT_KEY; +static bool got_language = false; +static bool started_first_word = false; +static struct sha1_ctx digester; + +static __inline void check_multiple(const char *name, bool exists) { + if (exists) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + _("several %s definitions found, only the last will be taken " + "into consideration"), name); + } +} + +static void gabc_score_determination_error(const char *error_str) +{ + gregorio_message(error_str, (const char *) "gabc_score_determination_parse", + VERBOSITY_ERROR, 0); +} + +static void gabc_fix_custos(gregorio_score *score_to_check) +{ + gregorio_syllable *current_syllable; + gregorio_element *current_element; + gregorio_element *custo_element; + char pitch = 0; + char pitch_difference = 0; + int newkey; + int current_key; + if (!score_to_check || !score_to_check->first_syllable + || !score_to_check->first_voice_info) { + return; + } + current_key = score_to_check->first_voice_info->initial_key; + current_syllable = score_to_check->first_syllable; + while (current_syllable) { + current_element = (current_syllable->elements)[0]; + while (current_element) { + if (current_element->type == GRE_CUSTOS) { + custo_element = current_element; + pitch = custo_element->u.misc.pitched.pitch; + /* we look for the key */ + while (current_element) { + switch (current_element->type) { + case GRE_C_KEY_CHANGE: + case GRE_C_KEY_CHANGE_FLATED: + pitch = gregorio_determine_next_pitch(current_syllable, + current_element, NULL); + newkey = gregorio_calculate_new_key(C_KEY, + current_element->u.misc.pitched.pitch - '0'); + pitch_difference = (char) newkey - (char) current_key; + pitch -= pitch_difference; + current_key = newkey; + break; + case GRE_F_KEY_CHANGE: + case GRE_F_KEY_CHANGE_FLATED: + pitch = gregorio_determine_next_pitch(current_syllable, + current_element, NULL); + newkey = gregorio_calculate_new_key(F_KEY, + current_element->u.misc.pitched.pitch - '0'); + pitch_difference = (char) newkey - (char) current_key; + pitch -= pitch_difference; + current_key = newkey; + break; + default: + break; + } + if (!custo_element->u.misc.pitched.force_pitch) { + while (pitch < LOWEST_PITCH) { + pitch += 7; + } + while (pitch > HIGHEST_PITCH) { + pitch -= 7; + } + custo_element->u.misc.pitched.pitch = pitch; + } + assert(custo_element->u.misc.pitched.pitch >= LOWEST_PITCH + && custo_element->u.misc.pitched.pitch + <= HIGHEST_PITCH); + current_element = current_element->next; + } + } + if (current_element) { + if (current_element->type == GRE_C_KEY_CHANGE + || current_element->type == GRE_C_KEY_CHANGE_FLATED) { + current_key = gregorio_calculate_new_key(C_KEY, + current_element->u.misc.pitched.pitch - '0'); + } + if (current_element->type == GRE_F_KEY_CHANGE + || current_element->type == GRE_F_KEY_CHANGE_FLATED) { + current_key = gregorio_calculate_new_key(F_KEY, + current_element->u.misc.pitched.pitch - '0'); + } + current_element = current_element->next; + } + } + current_syllable = current_syllable->next_syllable; + } +} + +/* + * A function that checks to score integrity. For now it is... quite + * ridiculous... but it might be improved in the future. + */ + +static int check_score_integrity(gregorio_score *score_to_check) +{ + if (!score_to_check) { + return 0; + } + return 1; +} + +/* + * Another function to be improved: this one checks the validity of the voice_infos. + */ + +static int check_infos_integrity(gregorio_score *score_to_check) +{ + if (!score_to_check->name) { + gregorio_message(_("no name specified, put `name:...;' at the " + "beginning of the file, can be dangerous with some output " + "formats"), "det_score", VERBOSITY_WARNING, 0); + } + return 1; +} + +/* + * The function that will initialize the variables. + */ + +static void initialize_variables(void) +{ + int i; + /* build a brand new empty score */ + score = gregorio_new_score(); + /* initialization of the first voice info to an empty voice info */ + current_voice_info = NULL; + gregorio_add_voice_info(¤t_voice_info); + score->first_voice_info = current_voice_info; + /* other initializations */ + number_of_voices = 0; + voice = 1; + current_character = NULL; + first_translation_character = NULL; + first_text_character = NULL; + translation_type = TR_NORMAL; + no_linebreak_area = NLBA_NORMAL; + euouae = EUOUAE_NORMAL; + center_is_determined = CENTER_NOT_DETERMINED; + for (i = 0; i < 10; i++) { + macros[i] = NULL; + } + started_first_word = false; +} + +/* + * function that frees the variables that need it, for when we have finished to + * determine the score + */ + +static void free_variables(void) +{ + int i; + free(elements); + for (i = 0; i < 10; i++) { + free(macros[i]); + } +} + +/* see whether a voice_info is empty */ +static int voice_info_is_not_empty(const gregorio_voice_info *voice_info) +{ + return (voice_info->initial_key != 5 || voice_info->style + || voice_info->virgula_position); +} + +/* + * a function called when we see "--\n" that end the infos for a certain voice + */ +static void next_voice_info(void) +{ + /* we must do this test in the case where there would be a "--" before + * first_declarations */ + if (voice_info_is_not_empty(current_voice_info)) { + gregorio_add_voice_info(¤t_voice_info); + voice++; + } +} + +/* + * Function that frees the voice_infos for voices > final_count. Useful if + * there are too many voice_infos + */ + +static void reajust_voice_infos(gregorio_voice_info *voice_info, + int final_count) +{ + int i = 1; + while (voice_info && i <= final_count) { + voice_info = voice_info->next_voice_info; + } + gregorio_free_voice_infos(voice_info); +} + +/* + * Function called when we have reached the end of the definitions, it tries to + * make the voice_infos coherent. + */ +static void end_definitions(void) +{ + int i; + + if (!check_infos_integrity(score)) { + gregorio_message(_("can't determine valid infos on the score"), + "det_score", VERBOSITY_ERROR, 0); + } + if (!number_of_voices) { + if (voice > MAX_NUMBER_OF_VOICES) { + voice = MAX_NUMBER_OF_VOICES; + reajust_voice_infos(score->first_voice_info, number_of_voices); + } + number_of_voices = voice; + score->number_of_voices = voice; + } else { + if (number_of_voices > voice) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + ngt_("not enough voice infos found: %d found, %d waited, " + "%d assumed", "not enough voice infos found: %d found, %d " + "waited, %d assumed", voice), voice, + number_of_voices, voice); + score->number_of_voices = voice; + number_of_voices = voice; + } else { + if (number_of_voices < voice) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + ngt_("too many voice infos found: %d found, %d " + "waited, %d assumed", "not enough voice infos found: " + "%d found, %d waited, %d assumed", + number_of_voices), voice, number_of_voices, + number_of_voices); + } + } + } + /* voice is now voice-1, so that it can be the index of elements */ + voice = 0; + elements = (gregorio_element **) gregorio_malloc(number_of_voices * + sizeof(gregorio_element *)); + for (i = 0; i < number_of_voices; i++) { + elements[i] = NULL; + } + + if (!got_language) { + static char latin[] = "Latin"; + gregorio_set_centering_language(latin); + } +} + +/* + * Here starts the code for the determinations of the notes. The notes are not + * precisely determined here, we separate the text describing the notes of each + * voice, and we call determine_elements_from_string to really determine them. + */ +static char position = WORD_BEGINNING; +static gregorio_syllable *current_syllable = NULL; +static char *abovelinestext = NULL; + +/* + * Function called when we see a ")", it completes the gregorio_element array + * of the syllable with NULL pointers. Usefull in the cases where for example + * you have two voices, but a voice that is silent on a certain syllable. + */ +static void complete_with_nulls(int last_voice) +{ + int i; + for (i = last_voice + 1; i < number_of_voices; i++) { + elements[i] = NULL; + } +} + +/* + * Function called each time we find a space, it updates the current position. + */ +static void update_position_with_space(void) +{ + if (position == WORD_MIDDLE) { + position = WORD_END; + } + if (position == WORD_BEGINNING) { + position = WORD_ONE_SYLLABLE; + } +} + +/* + * When we encounter a translation center ending, we call this function that + * sets translation_type = TR_WITH_CENTER_BEGINNING on previous syllable with + * translation + */ +static void gregorio_set_translation_center_beginning( + gregorio_syllable *current_syllable) +{ + gregorio_syllable *syllable = current_syllable->previous_syllable; + while (syllable) { + if (syllable->translation_type == TR_WITH_CENTER_END) { + gregorio_message("encountering translation centering end but " + "cannot find translation centering beginning...", + "set_translation_center_beginning", VERBOSITY_ERROR, 0); + current_syllable->translation_type = TR_NORMAL; + return; + } + if (syllable->translation) { + syllable->translation_type = TR_WITH_CENTER_BEGINNING; + return; + } + syllable = syllable->previous_syllable; + } + /* we didn't find any beginning... */ + gregorio_message("encountering translation centering end but cannot find " + "translation centering beginning...", + "set_translation_center_beginning", VERBOSITY_ERROR, 0); + current_syllable->translation_type = TR_NORMAL; +} + +static void rebuild_characters(void) +{ + bool has_initial = score->initial_style != NO_INITIAL; + + /* we rebuild the first syllable text if it is the first syllable, or if + * it is the second when the first has no text. + * it is a patch for cases like (c4) Al(ab)le(ab) */ + if ((!score->first_syllable && has_initial && current_character) + || (current_syllable && !current_syllable->previous_syllable + && !current_syllable->text && current_character)) { + gregorio_rebuild_first_syllable(¤t_character, has_initial); + + started_first_word = true; + } + + gregorio_rebuild_characters(¤t_character, center_is_determined, + has_initial); + + if (started_first_word) { + gregorio_set_first_word(¤t_character); + } +} + +/* + * Function to close a syllable and update the position. + */ + +static void close_syllable(YYLTYPE *loc) +{ + int i; + gregorio_add_syllable(¤t_syllable, number_of_voices, elements, + first_text_character, first_translation_character, position, + abovelinestext, translation_type, no_linebreak_area, euouae, loc, + started_first_word); + if (!score->first_syllable) { + /* we rebuild the first syllable if we have to */ + score->first_syllable = current_syllable; + } + if (translation_type == TR_WITH_CENTER_END) { + gregorio_set_translation_center_beginning(current_syllable); + } + /* we update the position */ + if (position == WORD_BEGINNING) { + position = WORD_MIDDLE; + } + if (position == WORD_ONE_SYLLABLE || position == WORD_END) { + position = WORD_BEGINNING; + + if (started_first_word) { + started_first_word = false; + } + } + center_is_determined = CENTER_NOT_DETERMINED; + current_character = NULL; + first_text_character = NULL; + first_translation_character = NULL; + translation_type = TR_NORMAL; + no_linebreak_area = NLBA_NORMAL; + euouae = EUOUAE_NORMAL; + abovelinestext = NULL; + for (i = 0; i < number_of_voices; i++) { + elements[i] = NULL; + } + current_element = NULL; +} + +/* a function called when we see a [, basically, all characters are added to + * the translation pointer instead of the text pointer */ +static void start_translation(unsigned char asked_translation_type) +{ + rebuild_characters(); + first_text_character = current_character; + /* the middle letters of the translation have no sense */ + center_is_determined = CENTER_FULLY_DETERMINED; + current_character = NULL; + translation_type = asked_translation_type; +} + +static void end_translation(void) +{ + rebuild_characters(); + first_translation_character = current_character; +} + +/* + * gregorio_gabc_add_text is the function called when lex returns a char *. In + * this function we convert it into grewchar, and then we add the corresponding + * gregorio_characters in the list of gregorio_characters. + */ + +static void gregorio_gabc_add_text(char *mbcharacters) +{ + if (current_character) { + current_character->next_character = gregorio_build_char_list_from_buf( + mbcharacters); + current_character->next_character->previous_character = + current_character; + } else { + current_character = gregorio_build_char_list_from_buf(mbcharacters); + } + while (current_character && current_character->next_character) { + current_character = current_character->next_character; + } + free(mbcharacters); +} + +/* + * the function called when centering_scheme is seen in gabc + */ +static void set_centering_scheme(char *sc) +{ + gregorio_message("\"centering-scheme\" header is deprecated. Please use " + "\\gresetlyriccentering in TeX instead.", "set_centering_scheme", + VERBOSITY_DEPRECATION, 0); + if (strncmp((const char *) sc, "latine", 6) == 0) { + score->centering = SCHEME_VOWEL; + return; + } + if (strncmp((const char *) sc, "english", 6) == 0) { + score->centering = SCHEME_SYLLABLE; + return; + } + gregorio_message("centering-scheme unknown value: must be \"latine\" " + "or \"english\"", "set_centering_scheme", VERBOSITY_WARNING, 0); +} + +/* + * + * The two functions called when lex returns a style, we simply add it. All the + * complex things will be done by the function after... + * + */ + +static void gregorio_gabc_add_style(unsigned char style) +{ + gregorio_begin_style(¤t_character, style); +} + +static void gregorio_gabc_end_style(unsigned char style) +{ + gregorio_end_style(¤t_character, style); +} + +void gabc_digest(const void *const buf, const size_t size) +{ + sha1_process_bytes(buf, size, &digester); +} + +/* + * The "main" function. It is the function that is called when we have to read + * a gabc file. It takes a file descriptor, that is to say a file that is + * aleady open. It returns a valid gregorio_score + */ + +gregorio_score *gabc_read_score(FILE *f_in) +{ + /* compute the SHA-1 digest while parsing, for I/O efficiency */ + sha1_init_ctx(&digester); + /* digest GREGORIO_VERSION to get a different value when the version + changes */ + sha1_process_bytes(GREGORIO_VERSION, strlen(GREGORIO_VERSION), &digester); + /* the input file that flex will parse */ + gabc_score_determination_in = f_in; + if (!f_in) { + gregorio_message(_("can't read stream from argument, returning NULL " + "pointer"), "det_score", VERBOSITY_ERROR, 0); + return NULL; + } + initialize_variables(); + /* the flex/bison main call, it will build the score (that we have + * initialized) */ + gabc_score_determination_parse(); + gregorio_fix_initial_keys(score, DEFAULT_KEY); + gabc_fix_custos(score); + free_variables(); + /* the we check the validity and integrity of the score we have built. */ + if (!check_score_integrity(score)) { + gregorio_free_score(score); + score = NULL; + gregorio_message(_("unable to determine a valid score from file"), + "det_score", VERBOSITY_FATAL, 0); + } + sha1_finish_ctx(&digester, score->digest); + return score; +} + +unsigned char nabc_state = 0; +size_t nabc_lines = 0; + +static void gabc_y_add_notes(char *notes, YYLTYPE loc) { + gregorio_element *new_elements; + gregorio_element *last_element; + if (nabc_state == 0) { + if (!elements[voice]) { + elements[voice] = gabc_det_elements_from_string(notes, + ¤t_key, macros, &loc); + current_element = elements[voice]; + } else { + new_elements = gabc_det_elements_from_string(notes, + ¤t_key, macros, &loc); + last_element = elements[voice]; + while(last_element->next) { + last_element = last_element->next; + } + last_element->next = new_elements; + new_elements->previous = last_element; + current_element = new_elements; + } + } else { + if (!elements[voice]) { + gregorio_add_element(&elements[voice], NULL); + current_element = elements[voice]; + } + if (!current_element) { + gregorio_message(_("current_element is null, this shouldn't " + "happen!"), "gabc_y_add_notes", VERBOSITY_FATAL, 0); + } + if (!current_element->nabc) { + current_element->nabc = (char **) gregorio_calloc (nabc_lines, + sizeof (char *)); + } + current_element->nabc[nabc_state-1] = gregorio_strdup(notes); + current_element->nabc_lines = nabc_state; + } +} +%} + +%initial-action { + @$.first_line = 1; + @$.first_column = 0; + @$.first_offset = 0; + @$.last_line = 1; + @$.last_column = 0; + @$.last_offset = 0; +} + +%token ATTRIBUTE COLON SEMICOLON OFFICE_PART ANNOTATION AUTHOR DATE +%token MANUSCRIPT MANUSCRIPT_REFERENCE MANUSCRIPT_STORAGE_PLACE TRANSCRIBER +%token TRANSCRIPTION_DATE BOOK STYLE VIRGULA_POSITION INITIAL_STYLE MODE +%token GREGORIOTEX_FONT GENERATED_BY NAME OPENING_BRACKET NOTES VOICE_CUT +%token CLOSING_BRACKET NUMBER_OF_VOICES VOICE_CHANGE END_OF_DEFINITIONS SPACE +%token CHARACTERS I_BEGINNING I_END TT_BEGINNING TT_END UL_BEGINNING UL_END +%token C_BEGINNING C_END B_BEGINNING B_END SC_BEGINNING SC_END SP_BEGINNING +%token SP_END VERB_BEGINNING VERB VERB_END CENTER_BEGINNING CENTER_END +%token CLOSING_BRACKET_WITH_SPACE TRANSLATION_BEGINNING TRANSLATION_END +%token GABC_COPYRIGHT SCORE_COPYRIGHT OCCASION METER COMMENTARY ARRANGER +%token GABC_VERSION USER_NOTES DEF_MACRO ALT_BEGIN ALT_END CENTERING_SCHEME +%token TRANSLATION_CENTER_END BNLBA ENLBA EUOUAE_B EUOUAE_E NABC_CUT NABC_LINES +%token LANGUAGE + +%% + +score: + all_definitions syllables + ; + +all_definitions: + definitions END_OF_DEFINITIONS { + end_definitions(); + } + ; + +definitions: + | definitions definition + ; + +number_of_voices_definition: + NUMBER_OF_VOICES attribute { + number_of_voices=atoi($2.text); + free($2.text); + if (number_of_voices > MAX_NUMBER_OF_VOICES) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + _("can't define %d voices, maximum is %d"), + number_of_voices, MAX_NUMBER_OF_VOICES); + } + gregorio_set_score_number_of_voices (score, number_of_voices); + } + ; + +macro_definition: + DEF_MACRO attribute { + free(macros[$1.character - '0']); + macros[$1.character - '0'] = $2.text; + } + ; + +name_definition: + NAME attribute { + if ($2.text==NULL) { + gregorio_message("name can't be empty","det_score", + VERBOSITY_WARNING, 0); + } + check_multiple("name", score->name != NULL); + gregorio_set_score_name (score, $2.text); + } + ; + +centering_scheme_definition: + CENTERING_SCHEME attribute { + set_centering_scheme($2.text); + free($2.text); + } + ; + +language_definition: + LANGUAGE attribute { + check_multiple("language", got_language); + gregorio_set_centering_language($2.text); + free($2.text); + got_language = true; + } + ; + +gabc_copyright_definition: + GABC_COPYRIGHT attribute { + check_multiple("gabc-copyright", score->gabc_copyright != NULL); + gregorio_set_score_gabc_copyright (score, $2.text); + } + ; + +score_copyright_definition: + SCORE_COPYRIGHT attribute { + check_multiple("score_copyright", score->score_copyright != NULL); + gregorio_set_score_score_copyright (score, $2.text); + } + ; + +gregoriotex_font_definition: + GREGORIOTEX_FONT attribute { + gregorio_message("\"gregoriotex-font\" header is deprecated. " + "Please use \\gresetgregoriofont in TeX instead.", + "set_gregoriotex_font", VERBOSITY_DEPRECATION, 0); + check_multiple("GregorioTeX font", score->gregoriotex_font != NULL); + score->gregoriotex_font=$2.text; + } + ; + +office_part_definition: + OFFICE_PART attribute { + check_multiple("office part", score->office_part != NULL); + gregorio_set_score_office_part (score, $2.text); + } + ; + +occasion_definition: + OCCASION attribute { + check_multiple("occasion", score->occasion != NULL); + gregorio_set_score_occasion (score, $2.text); + } + ; + +meter_definition: + METER attribute { + check_multiple("meter", score->meter != NULL); + gregorio_set_score_meter (score, $2.text); + } + ; + +commentary_definition: + COMMENTARY attribute { + check_multiple("commentary", score->commentary != NULL); + gregorio_set_score_commentary (score, $2.text); + } + ; + +arranger_definition: + ARRANGER attribute { + check_multiple("arranger", score->arranger != NULL); + gregorio_set_score_arranger (score, $2.text); + } + ; + +gabc_version_definition: + GABC_VERSION attribute { + /* Deprecated */ + gregorio_message("\"gabc-version\" header is deprecated and will be " + "ignored.", "gabc_score_determination_parse", + VERBOSITY_DEPRECATION, 0); + free($2.text); + } + ; + +mode_definition: + MODE attribute { + check_multiple("mode", score->mode != 0); + if ($2.text) { + score->mode=atoi($2.text); + free($2.text); + } + } + ; + +nabc_lines_definition: + NABC_LINES attribute { + check_multiple("nabc lines", score->nabc_lines != 0); + if ($2.text) { + nabc_lines=atoi($2.text); + score->nabc_lines=nabc_lines; + free($2.text); + } + } + ; + +initial_style_definition: + INITIAL_STYLE attribute { + if ($2.text) { + score->initial_style=atoi($2.text); + free($2.text); + } + } + ; + +annotation_definition: + ANNOTATION attribute { + if (score->annotation [MAX_ANNOTATIONS - 1]) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + _("too many definitions of annotation found, only the " + "first %d will be taken"), MAX_ANNOTATIONS); + } + gregorio_set_score_annotation (score, $2.text); + } + ; + +author_definition: + AUTHOR attribute { + check_multiple("author", score->si.author != NULL); + gregorio_set_score_author (score, $2.text); + } + ; + +date_definition: + DATE attribute { + check_multiple("date", score->si.date != NULL); + gregorio_set_score_date (score, $2.text); + } + ; + +manuscript_definition: + MANUSCRIPT attribute { + check_multiple("manuscript", score->si.manuscript != NULL); + gregorio_set_score_manuscript (score, $2.text); + } + ; + +manuscript_reference_definition: + MANUSCRIPT_REFERENCE attribute { + check_multiple("manuscript-reference", + score->si.manuscript_reference != NULL); + gregorio_set_score_manuscript_reference (score, $2.text); + } + ; + +manuscript_storage_place_definition: + MANUSCRIPT_STORAGE_PLACE attribute { + check_multiple("manuscript-storage-place", + score->si.manuscript_storage_place != NULL); + gregorio_set_score_manuscript_storage_place (score, $2.text); + } + ; + +book_definition: + BOOK attribute { + check_multiple("book", score->si.book != NULL); + gregorio_set_score_book (score, $2.text); + } + ; + +transcriber_definition: + TRANSCRIBER attribute { + check_multiple("transcriber", score->si.transcriber != NULL); + gregorio_set_score_transcriber (score, $2.text); + } + ; + +transcription_date_definition: + TRANSCRIPTION_DATE attribute { + check_multiple("transcription date", + score->si.transcription_date != NULL); + gregorio_set_score_transcription_date (score, $2.text); + } + ; + +style_definition: + STYLE attribute { + if (current_voice_info->style) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + _("several definitions of style found for voice %d, only " + "the last will be taken into consideration"), voice); + } + gregorio_set_voice_style (current_voice_info, $2.text); + } + ; + +virgula_position_definition: + VIRGULA_POSITION attribute { + if (current_voice_info->virgula_position) { + gregorio_messagef("det_score", VERBOSITY_WARNING, 0, + _("several definitions of virgula position found for " + "voice %d, only the last will be taken into consideration"), + voice); + } + gregorio_set_voice_virgula_position (current_voice_info, $2.text); + } + ; + + +generated_by_definition: + GENERATED_BY attribute { + /* set_voice_generated_by (current_voice_info, $2.text); */ + free($2.text); + } + ; + +user_notes_definition: + USER_NOTES attribute { + gregorio_set_score_user_notes (score, $2.text); + } + ; + +attribute: + COLON ATTRIBUTE SEMICOLON { + $$.text = $2.text; + } + | + COLON SEMICOLON { + $$.text = NULL; + } + ; + +definition: + number_of_voices_definition + | name_definition + | macro_definition + | gabc_copyright_definition + | score_copyright_definition + | generated_by_definition + | virgula_position_definition + | style_definition + | transcription_date_definition + | transcriber_definition + | manuscript_storage_place_definition + | manuscript_reference_definition + | manuscript_definition + | book_definition + | nabc_lines_definition + | date_definition + | author_definition + | annotation_definition + | office_part_definition + | occasion_definition + | meter_definition + | commentary_definition + | arranger_definition + | gabc_version_definition + | initial_style_definition + | mode_definition + | gregoriotex_font_definition + | user_notes_definition + | centering_scheme_definition + | language_definition + | VOICE_CHANGE { + next_voice_info(); + } + ; + +notes: + | notes note + ; + +note: + NOTES CLOSING_BRACKET { + if (voice<number_of_voices) { + gabc_y_add_notes($1.text, @1); + free($1.text); + } + else { + gregorio_messagef("det_score", VERBOSITY_ERROR, 0, + ngt_("too many voices in note : %d found, %d expected", + "too many voices in note : %d found, %d expected", + number_of_voices), voice+1, number_of_voices); + } + if (voice<number_of_voices-1) { + gregorio_messagef("det_score", VERBOSITY_INFO, 0, + ngt_("not enough voices in note : %d found, %d expected, " + "completing with empty neume", "not enough voices in note " + ": %d found, %d expected, completing with empty neume", + voice+1), voice+1, number_of_voices); + complete_with_nulls(voice); + } + voice=0; + nabc_state=0; + } + | NOTES CLOSING_BRACKET_WITH_SPACE { + if (voice<number_of_voices) { + gabc_y_add_notes($1.text, @1); + free($1.text); + } + else { + gregorio_messagef("det_score", VERBOSITY_ERROR, 0, + ngt_("too many voices in note : %d found, %d expected", + "too many voices in note : %d found, %d expected", + number_of_voices), voice+1, number_of_voices); + } + if (voice<number_of_voices-1) { + gregorio_messagef("det_score", VERBOSITY_INFO, 0, + ngt_("not enough voices in note : %d found, %d expected, " + "completing with empty neume", "not enough voices in note " + ": %d found, %d expected, completing with empty neume", + voice+1), voice+1, number_of_voices); + complete_with_nulls(voice); + } + voice=0; + nabc_state=0; + update_position_with_space(); + } + | NOTES VOICE_CUT { + if (voice<number_of_voices) { + gabc_y_add_notes($1.text, @1); + free($1.text); + voice++; + } + else { + gregorio_messagef("det_score", VERBOSITY_ERROR, 0, + ngt_("too many voices in note : %d found, %d expected", + "too many voices in note : %d found, %d expected", + number_of_voices), voice+1, number_of_voices); + } + } + | NOTES NABC_CUT { + if (!nabc_lines) { + gregorio_message(_("You used character \"|\" in gabc without " + "setting \"nabc-lines\" parameter. Please " + "set it in your gabc header."), + "det_score", VERBOSITY_FATAL, 0); + } + if (voice<number_of_voices) { + gabc_y_add_notes($1.text, @1); + free($1.text); + nabc_state = (nabc_state + 1) % (nabc_lines+1); + } + } + | CLOSING_BRACKET { + elements[voice]=NULL; + voice=0; + nabc_state=0; + } + | CLOSING_BRACKET_WITH_SPACE { + elements[voice]=NULL; + voice=0; + nabc_state=0; + update_position_with_space(); + } + ; + +style_beginning: + I_BEGINNING { + gregorio_gabc_add_style(ST_ITALIC); + } + | TT_BEGINNING { + gregorio_gabc_add_style(ST_TT); + } + | UL_BEGINNING { + gregorio_gabc_add_style(ST_UNDERLINED); + } + | C_BEGINNING { + gregorio_gabc_add_style(ST_COLORED); + } + | B_BEGINNING { + gregorio_gabc_add_style(ST_BOLD); + } + | SC_BEGINNING { + gregorio_gabc_add_style(ST_SMALL_CAPS); + } + | VERB_BEGINNING { + gregorio_gabc_add_style(ST_VERBATIM); + } + | SP_BEGINNING { + gregorio_gabc_add_style(ST_SPECIAL_CHAR); + } + | CENTER_BEGINNING { + if (!center_is_determined) { + gregorio_gabc_add_style(ST_FORCED_CENTER); + center_is_determined=CENTER_HALF_DETERMINED; + } + } + ; + +style_end: + I_END { + gregorio_gabc_end_style(ST_ITALIC); + } + | TT_END { + gregorio_gabc_end_style(ST_TT); + } + | UL_END { + gregorio_gabc_end_style(ST_UNDERLINED); + } + | C_END { + gregorio_gabc_end_style(ST_COLORED); + } + | B_END { + gregorio_gabc_end_style(ST_BOLD); + } + | SC_END { + gregorio_gabc_end_style(ST_SMALL_CAPS); + } + | VERB_END { + gregorio_gabc_end_style(ST_VERBATIM); + } + | SP_END { + gregorio_gabc_end_style(ST_SPECIAL_CHAR); + } + | CENTER_END { + if (center_is_determined==CENTER_HALF_DETERMINED) { + gregorio_gabc_end_style(ST_FORCED_CENTER); + center_is_determined=CENTER_FULLY_DETERMINED; + } + } + ; + +euouae: + EUOUAE_B { + euouae = EUOUAE_BEGINNING; + } + | EUOUAE_E { + euouae = EUOUAE_END; + } + ; + +linebreak_area: + BNLBA { + no_linebreak_area = NLBA_BEGINNING; + } + | ENLBA { + no_linebreak_area = NLBA_END; + } + ; + +character: + above_line_text + | CHARACTERS { + gregorio_gabc_add_text($1.text); + } + | style_beginning + | style_end + | linebreak_area + | euouae + ; + +text: + | text character + ; + +translation_beginning: + TRANSLATION_BEGINNING { + start_translation(TR_NORMAL); + } + ; + +translation: + translation_beginning text TRANSLATION_END { + end_translation(); + } + | TRANSLATION_CENTER_END { + start_translation(TR_WITH_CENTER_END); + } + ; + +above_line_text: + ALT_BEGIN CHARACTERS ALT_END { + abovelinestext = $2.text; + } + ; + +syllable_with_notes: + text OPENING_BRACKET notes { + rebuild_characters(); + first_text_character = current_character; + close_syllable(&@1); + } + | text translation OPENING_BRACKET notes { + close_syllable(&@1); + } + ; + +notes_without_word: + OPENING_BRACKET notes { + close_syllable(NULL); + } + | translation OPENING_BRACKET notes { + close_syllable(NULL); + } + ; + +syllable: + syllable_with_notes + | notes_without_word + ; + +syllables: + | syllables syllable + ; diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-write.c b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-write.c new file mode 100644 index 00000000000..bd733a2af8d --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc-write.c @@ -0,0 +1,878 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file provides functions for writing gabc from Gregorio structures. + * + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + * + * This is a simple and easyly understandable output module. If you want to + * write a module, you can consider it as a model. + */ + +#include "config.h" +#include <ctype.h> +#include <stdio.h> +#include <string.h> /* for strchr */ +#include "bool.h" +#include "characters.h" +#include "struct.h" +#include "unicode.h" +#include "messages.h" +#include "plugins.h" + +#include "gabc.h" + +static __inline char pitch_letter(const char height) { + return height + 'a' - LOWEST_PITCH; +} + +/* + * Output one attribute, allowing for multi-line values + */ +static void gabc_write_str_attribute(FILE *f, const char *name, + const char *attr) +{ + if (attr) { + fprintf(f, "%s: %s%s;\n", name, attr, strchr(attr, '\n') ? ";" : ""); + } +} + +/* + * + * This function write a gregorio_voice_info. Still very simple. + * + */ + +static void gabc_write_voice_info(FILE *f, gregorio_voice_info *voice_info) +{ + if (!voice_info) { + gregorio_message(_("no voice info"), "gabc_write_voice_info", + VERBOSITY_WARNING, 0); + return; + } + if (voice_info->style) { + fprintf(f, "style: %s;\n", voice_info->style); + } + if (voice_info->virgula_position) { + fprintf(f, "virgula-position: %s;\n", voice_info->virgula_position); + } + /* The clef, voice_info->initial_key, is now output in the gabc proper. */ +} + +/* + * + * Then we start the functions made to write the text of the syllable. See + * comments on struct.h and struct-utils.c to understand more deeply. + * + * This first function will be called each time we will encounter a + * gregorio_character which is the beginning of a style. + * + */ + +static void gabc_write_begin(FILE *f, grestyle_style style) +{ + switch (style) { + case ST_ITALIC: + fprintf(f, "<i>"); + break; + case ST_COLORED: + fprintf(f, "<c>"); + break; + case ST_SMALL_CAPS: + fprintf(f, "<sc>"); + break; + case ST_BOLD: + fprintf(f, "<b>"); + break; + case ST_FORCED_CENTER: + fprintf(f, "{"); + break; + case ST_TT: + fprintf(f, "<tt>"); + break; + case ST_UNDERLINED: + fprintf(f, "<ul>"); + break; + default: + break; + } +} + +/* + * + * This function is about the same but for ends of styles. + * + */ + +static void gabc_write_end(FILE *f, grestyle_style style) +{ + switch (style) { + case ST_ITALIC: + fprintf(f, "</i>"); + break; + case ST_COLORED: + fprintf(f, "</c>"); + break; + case ST_SMALL_CAPS: + fprintf(f, "</sc>"); + break; + case ST_BOLD: + fprintf(f, "</b>"); + break; + case ST_FORCED_CENTER: + fprintf(f, "}"); + break; + case ST_TT: + fprintf(f, "</tt>"); + break; + case ST_UNDERLINED: + fprintf(f, "</ul>"); + break; + default: + break; + } +} + +/* + * + * This function writes the special chars. As the specials chars are + * represented simply in gabc, this function is very simple, but for TeX output + * modules, this may be.. a little more difficult. + * + */ +static void gabc_write_special_char(FILE *f, grewchar *first_char) +{ + fprintf(f, "<sp>"); + gregorio_print_unistring(f, first_char); + fprintf(f, "</sp>"); +} + +/* + * + * This functions writes verbatim output... but as the previous one it is very + * simple. + * + */ +static void gabc_write_verb(FILE *f, grewchar *first_char) +{ + fprintf(f, "<v>"); + gregorio_print_unistring(f, first_char); + fprintf(f, "</v>"); +} + +/* + * + * The function called when we will encounter a character. There may be other + * representations of the character (for example for Omega), so it is necessary + * to have such a function defined in each module. + * + */ + +static void gabc_print_char(FILE *f, grewchar to_print) +{ + gregorio_print_unichar(f, to_print); +} + +/* + * + * Quite important: the function that writes the liquescentia. It is called at + * the end of the function that writes one glyph. + * + */ + +static void gabc_write_end_liquescentia(FILE *f, char liquescentia) +{ + if (liquescentia == L_NO_LIQUESCENTIA) { + return; + } + if (liquescentia == L_DEMINUTUS + || liquescentia == L_DEMINUTUS_INITIO_DEBILIS) { + fprintf(f, "~"); + } + if (liquescentia == L_AUCTUS_ASCENDENS + || liquescentia == L_AUCTUS_ASCENDENS_INITIO_DEBILIS) { + fprintf(f, "<"); + } + if (liquescentia == L_AUCTUS_DESCENDENS + || liquescentia == L_AUCTUS_DESCENDENS_INITIO_DEBILIS) { + fprintf(f, ">"); + } + if (liquescentia == L_AUCTA || liquescentia == L_AUCTA_INITIO_DEBILIS) { + fprintf(f, "<"); + } +} + +/* + * + * The function that writes a key change... quite simple. + * + */ + +static void gabc_write_key_change(FILE *f, char step, int line, + bool flatted_key) +{ + if (flatted_key) { + fprintf(f, "%cb%d", step, line); + } else { + fprintf(f, "%c%d", step, line); + } +} + +/* + * + * The function that writes spaces, called when we encounter one. + * + */ + +static void gabc_write_space(FILE *f, char type) +{ + switch (type) { + case SP_LARGER_SPACE: + fprintf(f, "//"); + break; + case SP_GLYPH_SPACE: + fprintf(f, " "); + break; + case SP_LARGER_SPACE_NB: + fprintf(f, "!//"); + break; + case SP_GLYPH_SPACE_NB: + fprintf(f, "! "); + break; + case SP_NEUMATIC_CUT_NB: + fprintf(f, "!/"); + break; + case SP_NEUMATIC_CUT: + /* do not uncomment it, the code is strangely done but it works */ + /* fprintf (f, "/"); */ + break; + default: + gregorio_message(_("space type is unknown"), "gabc_write_space", + VERBOSITY_ERROR, 0); + break; + } +} + +/* + * + * A function to write a bar. + * + */ + +static void gabc_write_bar(FILE *f, char type) +{ + switch (type) { + case B_VIRGULA: + fprintf(f, "`"); + break; + case B_DIVISIO_MINIMA: + fprintf(f, ","); + break; + case B_DIVISIO_MINOR: + fprintf(f, ";"); + break; + case B_DIVISIO_MAIOR: + fprintf(f, ":"); + break; + case B_DIVISIO_FINALIS: + fprintf(f, "::"); + break; + case B_DIVISIO_MINOR_D1: + fprintf(f, ";1"); + break; + case B_DIVISIO_MINOR_D2: + fprintf(f, ";2"); + break; + case B_DIVISIO_MINOR_D3: + fprintf(f, ";3"); + break; + case B_DIVISIO_MINOR_D4: + fprintf(f, ";4"); + break; + case B_DIVISIO_MINOR_D5: + fprintf(f, ";5"); + break; + case B_DIVISIO_MINOR_D6: + fprintf(f, ";6"); + break; + default: + gregorio_message(_("unknown bar type, nothing will be done"), + "gabc_bar_to_str", VERBOSITY_ERROR, 0); + break; + } +} + +/* writing the signs of a bar */ + +static void gabc_write_bar_signs(FILE *f, char type) +{ + switch (type) { + case _V_EPISEMA: + fprintf(f, "'"); + break; + case _V_EPISEMA_BAR_H_EPISEMA: + fprintf(f, "'_"); + break; + case _BAR_H_EPISEMA: + fprintf(f, "_"); + break; + default: + break; + } +} + +static void gabc_hepisema(FILE *f, const char *prefix, bool connect, + grehepisema_size size) +{ + fprintf(f, "_%s", prefix); + if (!connect) { + fprintf(f, "2"); + } + switch (size) { + case H_SMALL_LEFT: + fprintf(f, "3"); + break; + case H_SMALL_CENTRE: + fprintf(f, "4"); + break; + case H_SMALL_RIGHT: + fprintf(f, "5"); + break; + case H_NORMAL: + /* nothing to print */ + break; + } +} + +static const char *vepisema_position(gregorio_note *note) +{ + if (!note->v_episema_height) { + return ""; + } + if (note->v_episema_height < note->u.note.pitch) { + return "0"; + } + return "1"; +} + +static const char *mora_vposition(gregorio_note *note) +{ + switch (note->mora_vposition) { + case VPOS_AUTO: + return ""; + case VPOS_ABOVE: + return "1"; + case VPOS_BELOW: + return "0"; + default: + return ""; + } +} + +/* + * + * The function that writes one gregorio_note. + * + */ + +static void gabc_write_gregorio_note(FILE *f, gregorio_note *note, + char glyph_type) +{ + char shape; + if (!note) { + gregorio_message(_("call with NULL argument"), + "gabc_write_gregorio_note", VERBOSITY_ERROR, 0); + return; + } + if (note->type != GRE_NOTE) { + gregorio_message(_("call with argument which type is not GRE_NOTE, " + "wrote nothing"), "gabc_write_gregorio_note", + VERBOSITY_ERROR, 0); + return; + } + if (glyph_type == G_PES_QUADRATUM) { + shape = S_QUADRATUM; + } else { + shape = note->u.note.shape; + } + switch (shape) { + /* first we write the letters that determine the shapes */ + case S_PUNCTUM: + fprintf(f, "%c", pitch_letter(note->u.note.pitch)); + break; + case S_PUNCTUM_INCLINATUM: + fprintf(f, "%c", toupper((unsigned char)pitch_letter(note->u.note.pitch))); + break; + case S_PUNCTUM_INCLINATUM_DEMINUTUS: + if (note->next) { + fprintf(f, "%c~", toupper((unsigned char)pitch_letter(note->u.note.pitch))); + } else { + fprintf(f, "%c", toupper((unsigned char)pitch_letter(note->u.note.pitch))); + } + break; + case S_PUNCTUM_INCLINATUM_AUCTUS: + if (note->next) { + fprintf(f, "%c<", toupper((unsigned char)pitch_letter(note->u.note.pitch))); + } else { + fprintf(f, "%c", toupper((unsigned char)pitch_letter(note->u.note.pitch))); + } + break; + case S_PUNCTUM_CAVUM_INCLINATUM: + fprintf(f, "%cr", toupper((unsigned char)pitch_letter(note->u.note.pitch))); + break; + case S_PUNCTUM_CAVUM_INCLINATUM_AUCTUS: + fprintf(f, "%cr<", toupper((unsigned char)pitch_letter(note->u.note.pitch))); + break; + case S_VIRGA: + fprintf(f, "%cv", pitch_letter(note->u.note.pitch)); + break; + case S_VIRGA_REVERSA: + fprintf(f, "%cV", pitch_letter(note->u.note.pitch)); + break; + case S_BIVIRGA: + fprintf(f, "%cvv", pitch_letter(note->u.note.pitch)); + break; + case S_TRIVIRGA: + fprintf(f, "%cvvv", pitch_letter(note->u.note.pitch)); + break; + case S_ORISCUS: + fprintf(f, "%co", pitch_letter(note->u.note.pitch)); + break; + case S_ORISCUS_AUCTUS: + fprintf(f, "%co", pitch_letter(note->u.note.pitch)); + /* we consider that the AUCTUS is also in the liquescentia */ + break; + case S_ORISCUS_DEMINUTUS: + fprintf(f, "%co", pitch_letter(note->u.note.pitch)); + /* we consider that the AUCTUS is also in the liquescentia */ + break; + case S_QUILISMA: + fprintf(f, "%cw", pitch_letter(note->u.note.pitch)); + break; + case S_LINEA: + fprintf(f, "%c=", pitch_letter(note->u.note.pitch)); + break; + case S_PUNCTUM_CAVUM: + fprintf(f, "%cr", pitch_letter(note->u.note.pitch)); + break; + case S_LINEA_PUNCTUM: + fprintf(f, "%cR", pitch_letter(note->u.note.pitch)); + break; + case S_LINEA_PUNCTUM_CAVUM: + fprintf(f, "%cr0", pitch_letter(note->u.note.pitch)); + break; + case S_QUILISMA_QUADRATUM: + fprintf(f, "%cW", pitch_letter(note->u.note.pitch)); + break; + case S_ORISCUS_SCAPUS: + fprintf(f, "%cO", pitch_letter(note->u.note.pitch)); + break; + case S_STROPHA: + fprintf(f, "%cs", pitch_letter(note->u.note.pitch)); + break; + case S_STROPHA_AUCTA: + fprintf(f, "%cs", pitch_letter(note->u.note.pitch)); + break; + case S_DISTROPHA: + fprintf(f, "%css", pitch_letter(note->u.note.pitch)); + break; + case S_DISTROPHA_AUCTA: + fprintf(f, "%css", pitch_letter(note->u.note.pitch)); + break; + case S_TRISTROPHA: + fprintf(f, "%csss", pitch_letter(note->u.note.pitch)); + break; + case S_TRISTROPHA_AUCTA: + fprintf(f, "%csss", pitch_letter(note->u.note.pitch)); + break; + case S_QUADRATUM: + fprintf(f, "%cq", pitch_letter(note->u.note.pitch)); + break; + default: + fprintf(f, "%c", pitch_letter(note->u.note.pitch)); + break; + } + switch (note->signs) { + case _PUNCTUM_MORA: + fprintf(f, ".%s", mora_vposition(note)); + break; + case _AUCTUM_DUPLEX: + fprintf(f, ".."); + break; + case _V_EPISEMA: + fprintf(f, "'%s", vepisema_position(note)); + break; + case _V_EPISEMA_PUNCTUM_MORA: + fprintf(f, "'%s.%s", vepisema_position(note), mora_vposition(note)); + break; + case _V_EPISEMA_AUCTUM_DUPLEX: + fprintf(f, "'%s..", vepisema_position(note)); + break; + default: + break; + } + switch (note->special_sign) { + case _ACCENTUS: + fprintf(f, "r1"); + break; + case _ACCENTUS_REVERSUS: + fprintf(f, "r2"); + break; + case _CIRCULUS: + fprintf(f, "r3"); + break; + case _SEMI_CIRCULUS: + fprintf(f, "r4"); + break; + case _SEMI_CIRCULUS_REVERSUS: + fprintf(f, "r5"); + break; + default: + break; + } + if (note->h_episema_above == HEPISEMA_AUTO + && note->h_episema_below == HEPISEMA_AUTO) { + gabc_hepisema(f, "", note->h_episema_above_connect, + note->h_episema_above_size); + } else { + if (note->h_episema_below == HEPISEMA_FORCED) { + gabc_hepisema(f, "0", note->h_episema_below_connect, + note->h_episema_below_size); + } + if (note->h_episema_above == HEPISEMA_FORCED) { + gabc_hepisema(f, "1", note->h_episema_above_connect, + note->h_episema_above_size); + } + } + if (note->texverb) { + fprintf(f, "[nv:%s]", note->texverb); + } +} + +/* + * + * The function that writes one glyph. If it is really a glyph (meaning not a + * space or an alteration), we just do like always, a loop on the notes and a + * call to the function that writes one note on each of them. + * + */ + +static void gabc_write_gregorio_glyph(FILE *f, gregorio_glyph *glyph) +{ + + gregorio_note *current_note; + + if (!glyph) { + gregorio_message(_("call with NULL argument"), + "gabc_write_gregorio_glyph", VERBOSITY_ERROR, 0); + return; + } + switch (glyph->type) { + case GRE_FLAT: + fprintf(f, "%cx", pitch_letter(glyph->u.misc.pitched.pitch)); + break; + case GRE_TEXVERB_GLYPH: + if (glyph->texverb) { + fprintf(f, "[gv:%s]", glyph->texverb); + } + break; + case GRE_NATURAL: + fprintf(f, "%cy", pitch_letter(glyph->u.misc.pitched.pitch)); + break; + case GRE_SHARP: + fprintf(f, "%c#", pitch_letter(glyph->u.misc.pitched.pitch)); + break; + case GRE_SPACE: + if (glyph->u.misc.unpitched.info.space == SP_ZERO_WIDTH && glyph->next) { + fprintf(f, "!"); + } else { + gregorio_message(_("bad space"), "gabc_write_gregorio_glyph", + VERBOSITY_ERROR, 0); + } + break; + case GRE_MANUAL_CUSTOS: + fprintf(f, "%c+", pitch_letter(glyph->u.misc.pitched.pitch)); + break; + case GRE_GLYPH: + if (is_initio_debilis(glyph->u.notes.liquescentia)) { + fprintf(f, "-"); + } + + current_note = glyph->u.notes.first_note; + while (current_note) { + gabc_write_gregorio_note(f, current_note, glyph->u.notes.glyph_type); + /* third argument necessary for the special shape pes quadratum */ + current_note = current_note->next; + } + gabc_write_end_liquescentia(f, glyph->u.notes.liquescentia); + break; + default: + + gregorio_message(_("call with an argument which type is unknown"), + "gabc_write_gregorio_glyph", VERBOSITY_ERROR, 0); + break; + } +} + +/* + * + * To write an element, first we check the type of the element (if it is a bar, + * etc.), and if it is really an element, we make a loop on the list of glyphs + * inside the neume, and for each of them we call the function that will write + * one glyph. + * + */ + +static void gabc_write_gregorio_element(FILE *f, gregorio_element *element) +{ + gregorio_glyph *current_glyph; + if (!element) { + gregorio_message(_("call with NULL argument"), + "gabc_write_gregorio_element", VERBOSITY_ERROR, 0); + return; + } + current_glyph = element->u.first_glyph; + switch (element->type) { + case GRE_ELEMENT: + while (current_glyph) { + gabc_write_gregorio_glyph(f, current_glyph); + current_glyph = current_glyph->next; + } + break; + case GRE_TEXVERB_ELEMENT: + if (element->texverb) { + fprintf(f, "[ev:%s]", element->texverb); + } + break; + case GRE_ALT: + if (element->texverb) { + fprintf(f, "[alt:%s]", element->texverb); + } + break; + case GRE_SPACE: + gabc_write_space(f, element->u.misc.unpitched.info.space); + break; + case GRE_BAR: + gabc_write_bar(f, element->u.misc.unpitched.info.bar); + gabc_write_bar_signs(f, element->u.misc.unpitched.special_sign); + break; + case GRE_C_KEY_CHANGE: + gabc_write_key_change(f, C_KEY, + element->u.misc.pitched.pitch - '0', + element->u.misc.pitched.flatted_key); + break; + case GRE_F_KEY_CHANGE: + gabc_write_key_change(f, F_KEY, + element->u.misc.pitched.pitch - '0', + element->u.misc.pitched.flatted_key); + break; + case GRE_END_OF_LINE: + fprintf(f, "z"); + break; + case GRE_CUSTOS: + if (element->u.misc.pitched.force_pitch) { + fprintf(f, "%c+", pitch_letter(element->u.misc.pitched.pitch)); + } else { + fprintf(f, "z0"); + } + break; + default: + gregorio_message(_("call with an argument which type is unknown"), + "gabc_write_gregorio_element", VERBOSITY_ERROR, 0); + break; + } +} + +/* + * + * Here is defined the function that will write the list of gregorio_elements. + * It is very simple: it makes a loop in which it calls a function that writes + * one element. + * + */ + +static void gabc_write_gregorio_elements(FILE *f, gregorio_element *element) +{ + while (element) { + gabc_write_gregorio_element(f, element); + /* we don't want a bar after an end of line */ + if (element->type != GRE_END_OF_LINE + && (element->type != GRE_SPACE + || (element->type == GRE_SPACE + && element->u.misc.unpitched.info.space == SP_NEUMATIC_CUT)) + && element->next && element->next->type == GRE_ELEMENT) { + fprintf(f, "/"); + } + element = element->next; + } +} + +/* + * + * Here it goes, we are writing a gregorio_syllable. + * + */ + +static void gabc_write_gregorio_syllable(FILE *f, gregorio_syllable *syllable, + int number_of_voices) +{ + int voice = 0; + if (!syllable) { + gregorio_message(_("call with NULL argument"), "gabc_write_syllable", + VERBOSITY_ERROR, 0); + return; + } + if (syllable->text) { + /* we call the magic function (defined in struct_utils.c), that will + * write our text. */ + gregorio_write_text(false, syllable->text, f, + (&gabc_write_verb), + (&gabc_print_char), + (&gabc_write_begin), + (&gabc_write_end), (&gabc_write_special_char)); + } + if (syllable->translation) { + fprintf(f, "["); + gregorio_write_text(false, syllable->translation, f, + (&gabc_write_verb), + (&gabc_print_char), + (&gabc_write_begin), + (&gabc_write_end), (&gabc_write_special_char)); + fprintf(f, "]"); + } + fprintf(f, "("); + while (voice < number_of_voices - 1) { + /* we enter this loop only in polyphony */ + gabc_write_gregorio_elements(f, syllable->elements[voice]); + fprintf(f, "&"); + voice++; + } + /* we write all the elements of the syllable. */ + gabc_write_gregorio_elements(f, syllable->elements[voice]); + if (syllable->position == WORD_END + || syllable->position == WORD_ONE_SYLLABLE + || gregorio_is_only_special(syllable->elements[0])) + /* we assume here that if the first voice is only special, all will be + * only specials too */ + { + fprintf(f, ") "); + } else { + fprintf(f, ")"); + } +} + +/* + * + * This is the top function, the one called when we want to write a + * gregorio_score in gabc. + * + */ + +void gabc_write_score(FILE *f, gregorio_score *score) +{ + char step; + int line; + gregorio_syllable *syllable; + int annotation_num; + + if (!f) { + gregorio_message(_("call with NULL file"), "gregoriotex_write_score", + VERBOSITY_ERROR, 0); + return; + } + + if (score->name) { + gabc_write_str_attribute(f, "name", score->name); + } else { + fprintf(f, "name: unknown;\n"); + gregorio_message(_("name is mandatory"), "gabc_write_score", + VERBOSITY_ERROR, 0); + } + gabc_write_str_attribute(f, "gabc-copyright", score->gabc_copyright); + gabc_write_str_attribute(f, "score-copyright", score->score_copyright); + gabc_write_str_attribute(f, "office-part", score->office_part); + gabc_write_str_attribute(f, "occasion", score->occasion); + gabc_write_str_attribute(f, "meter", score->meter); + gabc_write_str_attribute(f, "commentary", score->commentary); + gabc_write_str_attribute(f, "arranger", score->arranger); + /* We always create gabc of the current version; this is not derived + * from the input. */ + fprintf(f, "gabc-version: %s;\n", GABC_CURRENT_VERSION); + /* And since the gabc is generated by this program, note this. */ + fprintf(f, "generated-by: %s %s;\n", "gregorio", GREGORIO_VERSION); + gabc_write_str_attribute(f, "author", score->si.author); + gabc_write_str_attribute(f, "date", score->si.date); + gabc_write_str_attribute(f, "manuscript", score->si.manuscript); + gabc_write_str_attribute(f, "manuscript-reference", + score->si.manuscript_reference); + gabc_write_str_attribute(f, "manuscript-storage-place", + score->si.manuscript_storage_place); + gabc_write_str_attribute(f, "book", score->si.book); + gabc_write_str_attribute(f, "transcriber", score->si.transcriber); + gabc_write_str_attribute(f, "transcription-date", + score->si.transcription_date); + gabc_write_str_attribute(f, "gregoriotex-font", score->gregoriotex_font); + if (score->mode) { + fprintf(f, "mode: %d;\n", score->mode); + } + for (annotation_num = 0; annotation_num < MAX_ANNOTATIONS; ++annotation_num) { + if (score->annotation[annotation_num]) { + fprintf(f, "annotation: %s;\n", + score->annotation[annotation_num]); + } + } + if (score->initial_style != NORMAL_INITIAL) { + fprintf(f, "initial-style: %d;\n", score->initial_style); + } + gabc_write_str_attribute(f, "user-notes", score->user_notes); + if (score->number_of_voices == 0) { + gregorio_message(_("gregorio_score seems to be empty"), + "gabc_write_score", VERBOSITY_ERROR, 0); + return; + } + if (score->number_of_voices == 1) { + gabc_write_voice_info(f, score->first_voice_info); + fprintf(f, "%%%%\n"); + } else { + gregorio_voice_info *voice_info = score->first_voice_info; + while (voice_info) { + gabc_write_voice_info(f, voice_info); + if (voice_info->next_voice_info) { + fprintf(f, "--\n"); + } else { + fprintf(f, "%%%%\n"); + } + } + } + /* at present we only allow for one clef at the start of the gabc */ + gregorio_det_step_and_line_from_key(score->first_voice_info->initial_key, + &step, &line); + if (score->first_voice_info->flatted_key) { + fprintf(f, "(%cb%d)", step, line); + } else { + fprintf(f, "(%c%d)", step, line); + } + syllable = score->first_syllable; + /* the we write every syllable */ + while (syllable) { + gabc_write_gregorio_syllable(f, syllable, score->number_of_voices); + syllable = syllable->next_syllable; + } + fprintf(f, "\n"); +} + +/* And that's it... not really hard isn't it? */ diff --git a/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc.h b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc.h new file mode 100644 index 00000000000..73c7f64f60a --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gabc/gabc.h @@ -0,0 +1,87 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header prototypes gabc-format handling data structures and entry points. + * + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef GABC_H +#define GABC_H + +#define GABC_CURRENT_VERSION "0.9.3" + +#include "struct.h" + +/* functions to read gabc */ +gregorio_note *gabc_det_notes_from_string(char *str, char *macros[10], + gregorio_scanner_location *loc); +gregorio_element *gabc_det_elements_from_string(char *str, int *current_key, + char *macros[10], gregorio_scanner_location *loc); +gregorio_glyph *gabc_det_glyphs_from_notes(gregorio_note *current_note, + int *current_key); +void gabc_digest(const void *buf, size_t size); +int gabc_score_determination_lex_destroy(void); +int gabc_notes_determination_lex_destroy(void); + +/* see comments on gregorio_add_note_to_a_glyph for meaning of these + * variables */ +typedef enum gabc_determination { + DET_NO_END, + DET_END_OF_CURRENT, + DET_END_OF_PREVIOUS, + DET_END_OF_BOTH +} gabc_determination; + +/* defines the maximal interval between two notes of the same glyph */ +#define MAX_INTERVAL 5 + +static __inline void gabc_update_location(gregorio_scanner_location *const loc, + const char *const bytes, const size_t length) +{ + size_t i; + + /* to be compatible with LilyPond, this algorithm is based on Lilypond's + * Source_file::get_counts */ + + /* possible future enhancement: make the tabstop size configurable */ + + loc->first_line = loc->last_line; + loc->first_column = loc->last_column; + loc->first_offset = loc->last_offset; + + for (i = 0; i < length; ++i) { + if (bytes[i] == '\n') { + ++loc->last_line; + loc->last_column = 0; + loc->last_offset = 0; + } else if (((unsigned char)bytes[i] & 0xc0u) != 0x80u) { + /* if two highest bits are 1 and 0, it's a continuation byte, + * so count everything else, which is either a single-byte + * character or the first byte of a multi-byte sequence */ + + if (bytes[i] == '\t') { + loc->last_column = (loc->last_column / 8 + 1) * 8; + } else { + ++loc->last_column; + } + ++loc->last_offset; + } + } +} + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/gregorio-utils.c b/Build/source/texk/gregorio/gregorio-src/src/gregorio-utils.c new file mode 100644 index 00000000000..486dfd22e52 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gregorio-utils.c @@ -0,0 +1,644 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the command line interface of Gregorio. + * + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#ifdef USE_KPSE +#include <kpathsea/kpathsea.h> +#define gregorio_basename xbasename +#else +#include <getopt.h> +#include <libgen.h> /* for basename */ +#define gregorio_basename basename +#endif +#include <string.h> /* for strcmp */ +#include <locale.h> +#include <limits.h> +#include "struct.h" +#include "plugins.h" +#include "messages.h" +#include "characters.h" +#include "support.h" +#include "gabc/gabc.h" +#include "vowel/vowel.h" + +#ifndef MODULE_PATH_ENV +#define MODULE_PATH_ENV "MODULE_PATH" +#endif + +typedef enum gregorio_file_format { + FORMAT_UNSET = 0, + GABC, + GTEX, + DUMP +} gregorio_file_format; + +#define GABC_STR "gabc" +#define GTEX_STR "gtex" +#define DUMP_STR "dump" + +#define DEFAULT_INPUT_FORMAT GABC +#define DEFAULT_OUTPUT_FORMAT GTEX + +/* realpath is not in mingw32 */ +#ifdef _WIN32 +#ifndef PATH_MAX +#define PATH_MAX _MAX_PATH +#endif +#define realpath(path,resolved_path) _fullpath(resolved_path, path, PATH_MAX) +#endif + +/* define_path attempts to canonicalize the pathname of a given string */ +static char *define_path(char *current_directory, char *string) +{ + int length; + char *file_name; + char *temp_name; + char *base_name; +#ifdef _WIN32 + char *last_backslash; +#endif + + temp_name = gregorio_strdup(string); + base_name = strrchr(temp_name, '/'); +#ifdef _WIN32 + last_backslash = strrchr(temp_name, '\\'); + if (last_backslash > base_name) { + base_name = last_backslash; + } +#endif + if (base_name) { + /* some path was supplied */ + + *base_name = '\0'; + base_name++; + + /* try to resolve it */ + file_name = realpath(temp_name, NULL); + if (!file_name) { + fprintf(stderr, "the directory %s for %s does not exist\n", + temp_name, base_name); + exit(1); + } + } else { + /* no path was supplied */ + base_name = string; + file_name = gregorio_malloc( + strlen(current_directory) + strlen(base_name) + 2); + strcpy(file_name, current_directory); + } + + /* build the file name */ + length = strlen(file_name); + file_name = gregorio_realloc(file_name, length + strlen(base_name) + 2); + file_name[length] = '/'; + strcpy(file_name + length + 1, base_name); + + free(temp_name); + return file_name; +} + +/* function that returns the filename without the extension */ +static char *get_base_filename(char *fbasename) +{ + char *p; + int l; + char *ret; + p = strrchr(fbasename, '.'); + if (!p) { + return NULL; + } + l = strlen(fbasename) - strlen(p); + ret = (char *) gregorio_malloc((l + 1) * sizeof(char)); + gregorio_snprintf(ret, l + 1, "%s", fbasename); + ret[l] = '\0'; + return ret; +} + +/* function that adds the good extension to a basename (without extension) */ +static char *get_output_filename(char *fbasename, const char *extension) +{ + char *output_filename = NULL; + output_filename = + (char *) gregorio_malloc(sizeof(char) * + (strlen(extension) + strlen(fbasename) + 2)); + output_filename = strcpy(output_filename, fbasename); + output_filename = strcat(output_filename, "."); + output_filename = strcat(output_filename, extension); + return output_filename; +} + +/* + * the type definitions of the function to read a score from a file, and to + * write a score to a file. Necessary for the libtool stuff... + */ + +static void print_licence(void) +{ + printf("\n\ +Tools for manipulation of gregorian chant files\n\ +Copyright (C) 2006-2015 Gregorio project authors (see CONTRIBUTORS.md)\n\ +\n\ +This program is free software: you can redistribute it and/or modify\n\ +it under the terms of the GNU General Public License as published by\n\ +the Free Software Foundation, either version 3 of the License, or\n\ +(at your option) any later version.\n\ +\n"); + printf("This program is distributed in the hope that it will be useful,\n\ +but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ +GNU General Public License for more details.\n\ +\n\ +You should have received a copy of the GNU General Public License\n\ +along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n"); +} + +static void print_usage(char *name) +{ + printf(_("\nUsage :\n%s [OPTION] {file}\n where OPTION is :\n\ +\t-o file writes output to specified file\n\ +\t-S writes output to stdout\n\ +\t-F format specifies output file format (default: gtex)\n\ +\t-l file writes messages output to specified file (default: stderr)\n\ +\t-f format specifies input file format (default: gabc)\n\ +\t-s reads input from stdin\n\ +\t-p generate point-and-click information\n\ +\t-h displays this message\n\ +\t-V displays %s version\n"), name, name); + printf(_("\t-L displays licence\n\ +\t-v verbose mode\n\ +\t-W displays all warnings\n\ +\n\ +available formats are:\n\ +\t gabc gabc\n\ +\t gtex GregorioTeX\n\ +\t dump simple text dump (for debugging purpose)\n\ +\n")); +} + +static void check_input_clobber(char *input_file_name, char *output_file_name) +{ + char *absolute_input_file_name; + char *absolute_output_file_name; + char *current_directory; + int file_cmp; + if (input_file_name && output_file_name) { + current_directory = gregorio_malloc(PATH_MAX * sizeof(char)); + current_directory = getcwd(current_directory, PATH_MAX); + if (current_directory == NULL) { + fprintf(stderr, _("can't determine current directory")); + free(current_directory); + exit(1); + } + absolute_input_file_name = define_path(current_directory, input_file_name); + absolute_output_file_name = define_path(current_directory, output_file_name); + file_cmp = strcmp(absolute_input_file_name, absolute_output_file_name); + if (file_cmp == 0) { + fprintf(stderr, "error: refusing to overwrite the input file\n"); + } + free(current_directory); + free(absolute_input_file_name); + free(absolute_output_file_name); + if (file_cmp == 0) { + exit(1); + } + } +} + +static char *encode_point_and_click_filename(char *input_file_name) +{ + /* percent-encoding favors capital hex digits */ + static const char *const hex = "0123456789ABCDEF"; + char *filename, *result = NULL, *r = NULL, *p; + + filename = realpath(input_file_name, NULL); + if (!filename) { + fprintf(stderr, "error: unable to resolve %s\n", input_file_name); + exit(1); + } + + /* 2 extra characters for a possible leading slash and final NUL */ + r = result = gregorio_malloc((strlen(filename) * 4 + 2) * sizeof(char)); + +#ifdef _WIN32 + *(r++) = '/'; +#endif + + for (p = filename; *p; ++p) { +#ifdef _WIN32 + if (*p == '\\') { + *p = '/'; + } +#endif + + /* note that -, _ and ~ are conspicuously missing from this list + * 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 _WIN32 + || *p == ':' +#endif + ) { + *(r++) = *p; + } + else { + /* percent-encode anything else */ + *(r++) = '\\'; /* must escape it because it's TeX */ + *(r++) = '%'; + *(r++) = hex[(*p >> 4) & 0x0FU]; + *(r++) = hex[*p & 0x0FU]; + } + } + + *r = '\0'; + + return result; +} + +int main(int argc, char **argv) +{ + const char *copyright = + "Copyright (C) 2006-2015 Gregorio project authors (see CONTRIBUTORS.md)"; + int c; + + char *input_file_name = NULL; + char *output_file_name = NULL; + char *output_basename = NULL; + char *error_file_name = NULL; + FILE *input_file = NULL; + FILE *output_file = NULL; + FILE *error_file = NULL; + gregorio_file_format input_format = FORMAT_UNSET; + gregorio_file_format output_format = FORMAT_UNSET; + gregorio_verbosity verb_mode = 0; + bool point_and_click = false; + char *point_and_click_filename = NULL; + int number_of_options = 0; + int option_index = 0; + static struct option long_options[] = { + {"output-file", 1, 0, 'o'}, + {"stdout", 0, 0, 'S'}, + {"output-format", 1, 0, 'F'}, + {"messages-file", 1, 0, 'l'}, + {"input-format", 1, 0, 'f'}, + {"stdin", 0, 0, 's'}, + {"help", 0, 0, 'h'}, + {"version", 0, 0, 'V'}, + {"licence", 0, 0, 'L'}, + {"verbose", 0, 0, 'v'}, + {"all-warnings", 0, 0, 'W'}, + {"point-and-click", 0, 0, 'p'}, + }; + gregorio_score *score = NULL; + + #ifdef USE_KPSE + kpse_set_program_name("gregorio", "gregorio"); + #endif + if (argc == 1) { + print_usage(argv[0]); + exit(0); + } + setlocale(LC_CTYPE, "C"); + + while (1) { + c = getopt_long(argc, argv, "o:SF:l:f:shOLVvWp", + long_options, &option_index); + if (c == -1) + break; + switch (c) { + case 'o': + if (output_file_name) { + fprintf(stderr, + "warning: several output files declared, %s taken\n", + output_file_name); + break; + } + if (output_file) { /* means that stdout is defined */ + fprintf(stderr, + "warning: can't write to file and stdout, writing on stdout\n"); + break; + } + output_file_name = optarg; + break; + case 'S': + if (output_file_name) { + fprintf(stderr, + "warning: can't write to file and stdout, writing on %s\n", + output_file_name); + break; + } + if (output_file) { /* means that stdout is defined */ + fprintf(stderr, "warning: option used two times: %c\n", c); + break; + } + output_file = stdout; + break; + case 'F': + if (output_format) { + fprintf(stderr, + "warning: several output formats declared, first taken\n"); + break; + } + if (!strcmp(optarg, GABC_STR)) { + output_format = GABC; + break; + } + if (!strcmp(optarg, GTEX_STR)) { + output_format = GTEX; + break; + } + if (!strcmp(optarg, DUMP_STR)) { + output_format = DUMP; + break; + } else { + fprintf(stderr, "error: unknown output format: %s\n", optarg); + exit(0); + } + break; + case 'l': + if (error_file_name) { + fprintf(stderr, + "warning: several error files declared, %s taken\n", + error_file_name); + break; + } + error_file_name = optarg; + break; + case 'f': + if (input_format) { + gregorio_set_error_out(error_file); + fprintf(stderr, + "warning: several output formats declared, first taken\n"); + break; + } + if (!strcmp(optarg, GABC_STR)) { + input_format = GABC; + break; + } else { + fprintf(stderr, "error: unknown input format: %s\n", optarg); + exit(0); + } + break; + case 's': + if (input_file_name) { + fprintf(stderr, + "warning: can't read from file and stdin, writing on %s\n", + input_file_name); + break; + } + if (input_file) { /* means that stdin is defined */ + fprintf(stderr, "warning: option used two times: %c\n", c); + break; + } + input_file = stdin; + break; + case 'h': + print_usage(argv[0]); + exit(0); + break; + case 'V': + printf("Gregorio version %s.\n%s\n", GREGORIO_VERSION, copyright); + exit(0); + break; + case 'v': + if (verb_mode && verb_mode != VERBOSITY_WARNING) { + fprintf(stderr, "warning: verbose option passed two times\n"); + break; + } + verb_mode = VERBOSITY_INFO; + break; + case 'W': + if (verb_mode == VERBOSITY_WARNING) { + fprintf(stderr, + "warning: all-warnings option passed two times\n"); + break; + } + if (verb_mode != VERBOSITY_INFO) { + verb_mode = VERBOSITY_WARNING; + } + break; + case 'L': + print_licence(); + exit(0); + break; + case 'p': + if (point_and_click) { + fprintf(stderr, + "warning: point-and-click option passed two times\n"); + break; + } + point_and_click = true; + break; + case '?': + break; + default: + fprintf(stderr, "unknown option: %c\n", c); + print_usage(argv[0]); + exit(0); + break; + } + number_of_options++; + } /* end of while */ + if (optind == argc) { + if (!input_file) { /* input not undefined (could be stdin) */ + fprintf(stderr, "error: no input file specified\n"); + print_usage(argv[0]); + exit(1); + } + } else { + input_file_name = argv[optind]; + output_basename = get_base_filename(input_file_name); + if (input_file) { + fprintf(stderr, + "warning: can't read from stdin and a file, reading from file %s\n", + input_file_name); + input_file = NULL; + } + } + optind++; + if (optind < argc) { + printf("ignored arguments: "); + while (number_of_options < argc) + printf("%s ", argv[number_of_options++]); + printf("\n"); + } + + if (!input_format) { + input_format = DEFAULT_INPUT_FORMAT; + } + + if (!output_format) { + output_format = DEFAULT_OUTPUT_FORMAT; + } + + #ifdef USE_KPSE + if (!kpse_in_name_ok(input_file_name)) { + fprintf(stderr, "Error: kpse doesn't allow to read from file %s\n", + input_file_name); + exit(1); + } + #endif + + /* then we act... */ + + if (!output_file_name && !output_file) { + if (!output_basename) { + output_file = stdout; + } else { + if (input_format != output_format) { + switch (output_format) { + case GABC: + output_file_name = + get_output_filename(output_basename, "gabc"); + break; + case GTEX: + output_file_name = + get_output_filename(output_basename, "gtex"); + break; + case DUMP: + output_file_name = + get_output_filename(output_basename, "dump"); + break; + default: + fprintf(stderr, "error: unsupported format"); + exit(1); + } + } + } + } + if (output_basename) { + free(output_basename); + } + + if (!output_file) { + if (!input_file) { + check_input_clobber(input_file_name, output_file_name); + } + #ifdef USE_KPSE + if (!kpse_out_name_ok(output_file_name)) { + fprintf(stderr, "Error: kpse doesn't allow to write in file %s\n", + output_file_name); + exit(1); + } + #endif + output_file = fopen(output_file_name, "wb"); + if (!output_file) { + fprintf(stderr, "error: can't write in file %s", + output_file_name); + } + } + + /* we always have input_file or input_file_name */ + if (input_file) { + if (point_and_click) { + fprintf(stderr, + "warning: disabling point-and-click since reading from stdin\n"); + point_and_click = false; + } + } else { + input_file = fopen(input_file_name, "r"); + if (!input_file) { + fprintf(stderr, "error: can't open file %s for reading\n", + input_file_name); + exit(1); + } + gregorio_set_file_name(gregorio_basename(input_file_name)); + if (point_and_click) { + point_and_click_filename = encode_point_and_click_filename( + input_file_name); + } + } + + if (!error_file_name) { + error_file = stderr; + gregorio_set_error_out(error_file); + } else { + error_file = fopen(error_file_name, "wb"); + if (!error_file) { + fprintf(stderr, "error: can't open file %s for writing\n", + error_file_name); + exit(1); + } + gregorio_set_error_out(error_file); + } + + if (!verb_mode) { + verb_mode = VERBOSITY_DEPRECATION; + } + + gregorio_set_verbosity_mode(verb_mode); + + switch (input_format) { + case GABC: + score = gabc_read_score(input_file); + break; + default: + fprintf(stderr, "error : invalid input format\n"); + fclose(input_file); + fclose(output_file); + exit(1); + break; + } + + fclose(input_file); + if (score == NULL) { + fclose(output_file); + fprintf(stderr, "error in file parsing\n"); + exit(1); + } + + gregorio_fix_initial_keys(score, DEFAULT_KEY); + + switch (output_format) { + case GABC: + gabc_write_score(output_file, score); + break; + case GTEX: + gregoriotex_write_score(output_file, score, point_and_click_filename); + break; + case DUMP: + dump_write_score(output_file, score); + break; + default: + fprintf(stderr, "error : invalid output format\n"); + gregorio_free_score(score); + fclose(output_file); + exit(1); + break; + } + fclose(output_file); + if (point_and_click_filename) { + free(point_and_click_filename); + } + gregorio_free_score(score); + gregorio_vowel_tables_free(); + gabc_score_determination_lex_destroy(); + gabc_notes_determination_lex_destroy(); + gregorio_vowel_rulefile_lex_destroy(); + if (error_file_name) { + fclose(error_file); + } + + exit(gregorio_get_return_value()); +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/gregoriotex/gregoriotex-position.c b/Build/source/texk/gregorio/gregorio-src/src/gregoriotex/gregoriotex-position.c new file mode 100644 index 00000000000..987cddd7372 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gregoriotex/gregoriotex-position.c @@ -0,0 +1,1304 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file contains the logic for positioning signs on neumes. + * + * Copyright (C) 2008-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include <stdlib.h> +#include <assert.h> +#include "bool.h" +#include "struct.h" + +#include "gregoriotex.h" + +/* (loose) naming convention, employing camel case to be TeX-csname-compliant: + * {specific-glyph-shape}{note-position}{note-shape}{first-ambitus}{second-ambitus} + */ +OFFSET_CASE(FinalPunctum); +OFFSET_CASE(FinalDeminutus); +OFFSET_CASE(PenultBeforePunctumWide); +OFFSET_CASE(PenultBeforeDeminutus); +OFFSET_CASE(AntepenultBeforePunctum); +OFFSET_CASE(AntepenultBeforeDeminutus); +OFFSET_CASE(InitialPunctum); +OFFSET_CASE(InitioDebilis); +OFFSET_CASE(PorrNonAuctusInitialWide); +OFFSET_CASE(PorrNonAuctusInitialOne); +OFFSET_CASE(PorrAuctusInitialAny); +OFFSET_CASE(FinalInclinatum); +OFFSET_CASE(FinalInclinatumDeminutus); +OFFSET_CASE(FinalStropha); +OFFSET_CASE(FinalQuilisma); +OFFSET_CASE(FinalOriscus); +OFFSET_CASE(PenultBeforePunctumOne); +OFFSET_CASE(FinalUpperPunctum); +OFFSET_CASE(InitialOriscus); +OFFSET_CASE(InitialQuilisma); +OFFSET_CASE(TorcResNonAuctusSecondWideWide); +OFFSET_CASE(TorcResNonAuctusSecondOneWide); +OFFSET_CASE(TorcResDebilisNonAuctusSecondAnyWide); +OFFSET_CASE(FinalLineaPunctum); +OFFSET_CASE(TorcResQuilismaNonAuctusSecondWideWide); +OFFSET_CASE(TorcResOriscusNonAuctusSecondWideWide); +OFFSET_CASE(TorcResQuilismaNonAuctusSecondOneWide); +OFFSET_CASE(TorcResOriscusNonAuctusSecondOneWide); +OFFSET_CASE(TorcResNonAuctusSecondWideOne); +OFFSET_CASE(TorcResDebilisNonAuctusSecondAnyOne); +OFFSET_CASE(TorcResQuilismaNonAuctusSecondWideOne); +OFFSET_CASE(TorcResOriscusNonAuctusSecondWideOne); +OFFSET_CASE(TorcResNonAuctusSecondOneOne); +OFFSET_CASE(TorcResQuilismaNonAuctusSecondOneOne); +OFFSET_CASE(TorcResOriscusNonAuctusSecondOneOne); +OFFSET_CASE(TorcResAuctusSecondWideAny); +OFFSET_CASE(TorcResDebilisAuctusSecondAnyAny); +OFFSET_CASE(TorcResQuilismaAuctusSecondWideAny); +OFFSET_CASE(TorcResOriscusAuctusSecondWideAny); +OFFSET_CASE(TorcResAuctusSecondOneAny); +OFFSET_CASE(TorcResQuilismaAuctusSecondOneAny); +OFFSET_CASE(TorcResOriscusAuctusSecondOneAny); +OFFSET_CASE(ConnectedPenultBeforePunctumWide); +OFFSET_CASE(ConnectedPenultBeforePunctumOne); +OFFSET_CASE(InitialConnectedPunctum); +OFFSET_CASE(InitialConnectedVirga); +OFFSET_CASE(InitialConnectedQuilisma); +OFFSET_CASE(InitialConnectedOriscus); +OFFSET_CASE(FinalConnectedPunctum); +OFFSET_CASE(FinalConnectedAuctus); +OFFSET_CASE(FinalVirgaAuctus); +OFFSET_CASE(FinalConnectedVirga); +OFFSET_CASE(InitialVirga); +OFFSET_CASE(SalicusOriscusWide); +OFFSET_CASE(SalicusOriscusOne); + +static __inline const char *note_before_last_note_case_ignoring_deminutus( + const gregorio_note *const current_note) +{ + if ((current_note->u.note.pitch - current_note->next->u.note.pitch) == 1 + || (current_note->u.note.pitch - + current_note->next->u.note.pitch) == -1) { + if (!current_note->previous || current_note->u.note.pitch - + current_note->previous->u.note.pitch > 1) { + return ConnectedPenultBeforePunctumOne; + } else { + return PenultBeforePunctumOne; + } + } else { + if (!current_note->previous || current_note->u.note.pitch - + current_note->previous->u.note.pitch > 1) { + return ConnectedPenultBeforePunctumWide; + } else { + return PenultBeforePunctumWide; + } + } +} + +static __inline const char *note_before_last_note_case( + const gregorio_glyph *const current_glyph, + const gregorio_note *const current_note) +{ + if ((current_glyph->u.notes.liquescentia == L_DEMINUTUS_INITIO_DEBILIS + || current_glyph->u.notes.liquescentia == L_DEMINUTUS) + && current_note->next) { + return PenultBeforeDeminutus; + } else { + return note_before_last_note_case_ignoring_deminutus(current_note); + } +} + +/* num can be FinalPunctum or FinalUpperPunctum according if the last note is a + * standard punctum or a smaller punctum (for pes, porrectus and torculus + * resupinus */ +static __inline const char *last_note_case( + const gregorio_glyph *const current_glyph, const char* offset_pos, + gregorio_note *current_note, bool no_ambitus_one) +{ + if (current_glyph->u.notes.liquescentia & L_DEMINUTUS) { + /* + * may seem strange, but it is unlogical to typeset a small horizontal + * episema at the end of a flexus deminutus + */ + return FinalDeminutus; + } + if (!current_note->previous + || (!no_ambitus_one && (offset_pos == FinalUpperPunctum + || current_note->previous->u.note.pitch - + current_note->u.note.pitch == 1 || + current_note->u.note.pitch - current_note->previous->u.note.pitch + == 1))) { + return offset_pos; + } + if (current_note->previous->u.note.pitch < current_note->u.note.pitch) { + if (current_glyph->u.notes.liquescentia & + (L_AUCTUS_ASCENDENS | L_AUCTUS_DESCENDENS | L_AUCTA)) { + return FinalConnectedAuctus; + } else { + return FinalConnectedVirga; + } + } else { + return FinalConnectedPunctum; + } +} + +static __inline const char *first_note_case( + const gregorio_note *const current_note, + const gregorio_glyph *const current_glyph) +{ + bool ambitus_one = true; + if (current_glyph->u.notes.liquescentia >= L_INITIO_DEBILIS) { + return InitioDebilis; + } else { + if (current_note->next && current_note->next->u.note.pitch - + current_note->u.note.pitch != 1 && + current_note->u.note.pitch - current_note->next->u.note.pitch + != 1) { + ambitus_one = false; + } + if (current_note->u.note.shape == S_ORISCUS) { + return ambitus_one ? InitialOriscus : InitialConnectedOriscus; + } + if (current_note->u.note.shape == S_QUILISMA) { + return ambitus_one ? InitialQuilisma : InitialConnectedQuilisma; + } + if (ambitus_one) { + return InitialPunctum; + } + if (current_note->u.note.shape > current_note->next->u.note.shape) { + return InitialConnectedVirga; + } else { + return InitialConnectedPunctum; + } + } +} + +static __inline gregorio_vposition above_if_auctus( + const gregorio_glyph *const glyph) +{ + if (glyph->u.notes.liquescentia & + (L_AUCTUS_ASCENDENS | L_AUCTUS_DESCENDENS | L_AUCTA)) { + return VPOS_ABOVE; + } + return VPOS_BELOW; +} + +static __inline gregorio_vposition below_if_auctus( + const gregorio_glyph *const glyph) +{ + if (glyph->u.notes.liquescentia & + (L_AUCTUS_ASCENDENS | L_AUCTUS_DESCENDENS | L_AUCTA)) { + return VPOS_BELOW; + } + return VPOS_ABOVE; +} + +static __inline gregorio_vposition above_if_h_episema( + const gregorio_note *const note) +{ + if (note && note->h_episema_above) { + return VPOS_ABOVE; + } + return VPOS_BELOW; +} + +static __inline gregorio_vposition above_if_either_h_episema( + const gregorio_note *const note) +{ + if ((note->previous && note->previous->h_episema_above) + || (note->next && note->next->h_episema_above)) { + return VPOS_ABOVE; + } + return VPOS_BELOW; +} + +static __inline gregorio_vposition below_if_next_ambitus_allows( + const gregorio_note *const note) +{ + assert(note->next); + + if (!note->next || note->u.note.pitch - note->next->u.note.pitch > 2) { + return VPOS_BELOW; + } + return VPOS_ABOVE; +} + +static __inline void low_high_set_lower(const gregorio_glyph *const glyph, + gregorio_note *const note) +{ + if ((glyph->u.notes.liquescentia & L_DEMINUTUS) || + !(glyph->u.notes.liquescentia + & (L_AUCTUS_ASCENDENS|L_AUCTUS_DESCENDENS|L_AUCTA))) { + note->is_lower_note = true; + } +} + +static __inline void low_high_set_upper(const gregorio_glyph *const glyph, + gregorio_note *const note) +{ + if ((glyph->u.notes.liquescentia & L_DEMINUTUS) || + !(glyph->u.notes.liquescentia + & (L_AUCTUS_ASCENDENS|L_AUCTUS_DESCENDENS|L_AUCTA))) { + note->is_upper_note = true; + } +} + +static __inline void high_low_set_upper(const gregorio_glyph *const glyph, + gregorio_note *const note) +{ + if (glyph->u.notes.liquescentia & L_DEMINUTUS) { + note->is_upper_note = true; + } +} + +static __inline void high_low_set_lower(const gregorio_glyph *const glyph, + gregorio_note *const note) +{ + if (glyph->u.notes.liquescentia & L_DEMINUTUS) { + note->is_lower_note = true; + } +} + +/* a function that finds the good sign (additional line, vepisema or + * hepisema) number, according to the gregoriotex convention (described in + * gregoriotex.tex) + * this function is REALLY a pain in the ass, but it is sadly necessary */ +/* + * + * For the first note of a porrectus (flexus), this table summarizes the sign + * number (amb2 is the ambitus after the diagonal stroke): + * + * Porrectus | Porrectus | Porrectus | Porrectus + * non-auctus | non-auctus | auctus | Flexus + * amb2=1 | amb2>1 | | + * =================|=================|==============|============== + * PorrNonAuctus | PorrNonAuctus | PorrAuctus | PorrAuctus + * ~InitialOne | ~InitialWide | ~InitialAny | ~InitialAny + * + * For the second note of a torculus resupinus (flexus), this table summarizes + * the number (amb1 is the ambitus before the diagonal stroke and amb2 is the + * ambitus after the diagonal stroke): + * + * | | Torculus | Torculus | Torculus | Torculus + * | | Resupinus | Resupinus | Resupinus | Resupinus + * | Initial | non-auctus | non-auctus | auctus | Flexus + * amb1 | Note | amb2=1 | amb2>1 | | + * ======|============|=============|=============|============|============ + * 1 | Punctum | TorcRes | TorcRes | TorcRes | TorcRes + * | | ~NonAuctus | ~NonAuctus | ~Auctus | ~Auctus + * | | ~Second | ~Second | ~Second | ~Second + * | | ~OneOne | ~OneWide | ~OneAny | ~OneAny + * ------+------------+-------------+-------------+------------+------------ + * 1 | I. Debilis | TorcRes | TorcRes | TorcRes | TorcRes + * | | ~Debilis | ~Debilis | ~Debilis | ~Debilis + * | | ~NonAuctus | ~NonAuctus | ~Auctus | ~Auctus + * | | ~Second | ~Second | ~Second | ~Second + * | | ~AnyOne | ~AnyWide | ~AnyAny | ~AnyAny + * ------+------------+-------------+-------------+------------+------------ + * 1 | Quilisma | TorcRes | TorcRes | TorcRes | TorcRes + * | | ~Quilisma | ~Quilisma | ~Quilisma | ~Quilisma + * | | ~NonAuctus | ~NonAuctus | ~Auctus | ~Auctus + * | | ~Second | ~Second | ~Second | ~Second + * | | ~OneOne | ~OneWide | ~OneAny | ~OneAny + * ------+------------+-------------+-------------+------------+------------ + * 1 | Oriscus | TorcRes | TorcRes | TorcRes | TorcRes + * | | ~Oriscus | ~Oriscus | ~Oriscus | ~Oriscus + * | | ~NonAuctus | ~NonAuctus | ~Auctus | ~Auctus + * | | ~Second | ~Second | ~Second | ~Second + * | | ~OneOne | ~OneWide | ~OneAny | ~OneAny + * ======|============|=============|=============|============|============ + * >1 | Punctum | TorcRes | TorcRes | TorcRes | TorcRes + * | | ~NonAuctus | ~NonAuctus | ~Auctus | ~Auctus + * | | ~Second | ~Second | ~Second | ~Second + * | | ~WideOne | ~WideWide | ~WideAny | ~WideAny + * ------+------------+-------------+-------------+------------+------------ + * >1 | I. Debilis | TorcRes | TorcRes | TorcRes | TorcRes + * | | ~Debilis | ~Debilis | ~Debilis | ~Debilis + * | | ~NonAuctus | ~NonAuctus | ~Auctus | ~Auctus + * | | ~Second | ~Second | ~Second | ~Second + * | | ~AnyOne | ~AnyWide | ~AnyAny | ~AnyAny + * ------+------------+-------------+-------------+------------+------------ + * >1 | Quilisma | TorcRes | TorcRes | TorcRes | TorcRes + * | | ~Quilisma | ~Quilisma | ~Quilisma | ~Quilisma + * | | ~NonAuctus | ~NonAuctus | ~Auctus | ~Auctus + * | | ~Second | ~Second | ~Second | ~Second + * | | ~WideOne | ~WideWide | ~WideAny | ~WideAny + * ------+------------+-------------+-------------+------------+------------ + * >1 | Oriscus | TorcRes | TorcRes | TorcRes | TorcRes + * | | ~Oriscus | ~Oriscus | ~Oriscus | ~Oriscus + * | | ~NonAuctus | ~NonAuctus | ~Auctus | ~Auctus + * | | ~Second | ~Second | ~Second | ~Second + * | | ~WideOne | ~WideWide | ~WideAny | ~WideAny + * + */ +static gregorio_vposition advise_positioning(const gregorio_glyph *const glyph, + gregorio_note *const note, int i, const gtex_type type) +{ + gregorio_vposition h_episema = VPOS_AUTO, v_episema = VPOS_AUTO; + bool v_episema_below_is_lower = false, done; + + /* no need to clear is_lower_note/is_upper_note because we used calloc */ + + switch (type) { + case T_PES: + case T_PESQUILISMA: + /* + * in the case of a pes, we put the episema just under the bottom note + */ + if (i == 1) { + if (glyph->u.notes.liquescentia & L_INITIO_DEBILIS) { + note->gtex_offset_case = InitioDebilis; + h_episema = above_if_h_episema(note->next); + } else { + note->is_lower_note = true; + if (note->u.note.shape == S_QUILISMA) { + note->gtex_offset_case = FinalQuilisma; + } else { + note->gtex_offset_case = FinalPunctum; + } + h_episema = above_if_auctus(glyph); + } + v_episema = VPOS_BELOW; + } else { /* i=2 */ + if (!(glyph->u.notes.liquescentia & L_INITIO_DEBILIS)) { + note->is_upper_note = true; + } + if (glyph->u.notes.liquescentia & L_DEMINUTUS) { + note->gtex_offset_case = FinalDeminutus; + } else { + note->gtex_offset_case = FinalUpperPunctum; + } + h_episema = VPOS_ABOVE; + v_episema = below_if_auctus(glyph); + } + break; + case T_PESQUADRATUM: + case T_PESQUASSUS: + case T_PESQUILISMAQUADRATUM: + if (i == 1) { + note->gtex_offset_case = first_note_case(note, glyph); + h_episema = above_if_h_episema(note->next); + v_episema = VPOS_BELOW; + } else { /* i=2 */ + if (glyph->u.notes.liquescentia & L_DEMINUTUS) { + note->gtex_offset_case = InitioDebilis; + } else { + note->gtex_offset_case = last_note_case(glyph, FinalPunctum, + note, true); + } + h_episema = VPOS_ABOVE; + v_episema = VPOS_BELOW; + } + break; + case T_FLEXUS: + case T_FLEXUS_LONGQUEUE: + case T_FLEXUS_ORISCUS: + if (i == 1) { + high_low_set_upper(glyph, note); + if (type == T_FLEXUS_ORISCUS) { + note->gtex_offset_case = InitialConnectedOriscus; + } else { + if (note->next && note->u.note.pitch - + note->next->u.note.pitch == 1) { + note->gtex_offset_case = InitialVirga; + } else { + note->gtex_offset_case = InitialConnectedVirga; + } + } + h_episema = VPOS_ABOVE; + if (glyph->u.notes.liquescentia & L_DEMINUTUS) { + v_episema = below_if_next_ambitus_allows(note); + } else { + v_episema = VPOS_BELOW; + } + } else { /* i=2 */ + high_low_set_lower(glyph, note); + note->gtex_offset_case = last_note_case(glyph, FinalPunctum, note, + false); + if (glyph->u.notes.liquescentia & L_DEMINUTUS) { + h_episema = VPOS_BELOW; + } else { + h_episema = above_if_h_episema(note->previous); + } + v_episema = VPOS_BELOW; + } + break; + case T_TORCULUS_RESUPINUS_FLEXUS: + done = true; + switch (i) { + case 1: + note->gtex_offset_case = first_note_case(note, glyph); + h_episema = above_if_h_episema(note->next); + v_episema = VPOS_BELOW; + break; + case HEPISEMA_FIRST_TWO: + case 2: + if (glyph->u.notes.liquescentia & L_INITIO_DEBILIS) { + note->gtex_offset_case = TorcResDebilisAuctusSecondAnyAny; + } else { + if (note->u.note.pitch - note->previous->u.note.pitch == 1) { + switch (note->previous->u.note.shape) { + case S_QUILISMA: + note->gtex_offset_case = + TorcResQuilismaAuctusSecondOneAny; + break; + case S_ORISCUS: + note->gtex_offset_case = + TorcResOriscusAuctusSecondOneAny; + break; + default: + note->gtex_offset_case = TorcResAuctusSecondOneAny; + break; + } + } else { + switch (note->previous->u.note.shape) { + case S_QUILISMA: + note->gtex_offset_case = + TorcResQuilismaAuctusSecondWideAny; + break; + case S_ORISCUS: + note->gtex_offset_case = + TorcResOriscusAuctusSecondWideAny; + break; + default: + note->gtex_offset_case = TorcResAuctusSecondWideAny; + break; + } + } + } + h_episema = VPOS_ABOVE; + v_episema = VPOS_BELOW; + v_episema_below_is_lower = true; + break; + default: + --i; + done = false; + break; + } + + if (done) { + break; + } + /* else fallthrough to the next case! */ + case T_PORRECTUS_FLEXUS: + switch (i) { + case HEPISEMA_FIRST_TWO: + case 1: + note->gtex_offset_case = PorrAuctusInitialAny; + h_episema = VPOS_ABOVE; + v_episema = VPOS_BELOW; + v_episema_below_is_lower = true; + break; + case 2: + if (glyph->u.notes.liquescentia & L_DEMINUTUS) { + note->gtex_offset_case = AntepenultBeforeDeminutus; + } else { + note->gtex_offset_case = AntepenultBeforePunctum; + } + h_episema = above_if_either_h_episema(note); + v_episema = VPOS_BELOW; + break; + case 3: + high_low_set_upper(glyph, note); + h_episema = VPOS_ABOVE; + if ((glyph->u.notes.liquescentia & L_DEMINUTUS) && note->next) { + v_episema = below_if_next_ambitus_allows(note); + note->gtex_offset_case = PenultBeforeDeminutus; + } else { + v_episema = VPOS_BELOW; + note->gtex_offset_case = note_before_last_note_case(glyph, + note); + } + break; + default: + high_low_set_lower(glyph, note); + note->gtex_offset_case = last_note_case(glyph, FinalPunctum, note, + false); + h_episema = above_if_h_episema(note->previous); + v_episema = VPOS_BELOW; + break; + } + break; + case T_TORCULUS_RESUPINUS: + done = true; + switch (i) { + case 1: + note->gtex_offset_case = first_note_case(note, glyph); + h_episema = above_if_h_episema(note->next); + v_episema = VPOS_BELOW; + break; + case HEPISEMA_FIRST_TWO: + case 2: + if (glyph->u.notes.liquescentia & + (L_AUCTUS_ASCENDENS | L_AUCTUS_DESCENDENS | L_AUCTA)) { + /* auctus */ + if (glyph->u.notes.liquescentia & L_INITIO_DEBILIS) { + note->gtex_offset_case = TorcResDebilisAuctusSecondAnyAny; + } else { + if (note->u.note.pitch - + note->previous->u.note.pitch == 1) { + switch (note->previous->u.note.shape) { + case S_QUILISMA: + note->gtex_offset_case = + TorcResQuilismaAuctusSecondOneAny; + break; + case S_ORISCUS: + note->gtex_offset_case = + TorcResOriscusAuctusSecondOneAny; + break; + default: + note->gtex_offset_case = TorcResAuctusSecondOneAny; + break; + } + } else { + switch (note->previous->u.note.shape) { + case S_QUILISMA: + note->gtex_offset_case = + TorcResQuilismaAuctusSecondWideAny; + break; + case S_ORISCUS: + note->gtex_offset_case = + TorcResOriscusAuctusSecondWideAny; + break; + default: + note->gtex_offset_case = TorcResAuctusSecondWideAny; + break; + } + } + } + } else if (note->next->next->u.note.pitch - + note->next->u.note.pitch == 1) { + /* non-auctus with a second ambitus of 1 */ + if (glyph->u.notes.liquescentia & L_INITIO_DEBILIS) { + note->gtex_offset_case = + TorcResDebilisNonAuctusSecondAnyOne; + } else { + if (note->u.note.pitch - + note->previous->u.note.pitch == 1) { + switch (note->previous->u.note.shape) { + case S_QUILISMA: + note->gtex_offset_case = + TorcResQuilismaNonAuctusSecondOneOne; + break; + case S_ORISCUS: + note->gtex_offset_case = + TorcResOriscusNonAuctusSecondOneOne; + break; + default: + note->gtex_offset_case = + TorcResNonAuctusSecondOneOne; + break; + } + } else { + switch (note->previous->u.note.shape) { + case S_QUILISMA: + note->gtex_offset_case = + TorcResQuilismaNonAuctusSecondWideOne; + break; + case S_ORISCUS: + note->gtex_offset_case = + TorcResOriscusNonAuctusSecondWideOne; + break; + default: + note->gtex_offset_case = + TorcResNonAuctusSecondWideOne; + break; + } + } + } + } else { + /* non-auctus with a second ambitus of at least 2 */ + if (glyph->u.notes.liquescentia & L_INITIO_DEBILIS) { + note->gtex_offset_case = + TorcResDebilisNonAuctusSecondAnyWide; + } else { + if (note->u.note.pitch - + note->previous->u.note.pitch == 1) { + switch (note->previous->u.note.shape) { + case S_QUILISMA: + note->gtex_offset_case = + TorcResQuilismaNonAuctusSecondOneWide; + break; + case S_ORISCUS: + note->gtex_offset_case = + TorcResOriscusNonAuctusSecondOneWide; + break; + default: + note->gtex_offset_case = + TorcResNonAuctusSecondOneWide; + break; + } + } else { + switch (note->previous->u.note.shape) { + case S_QUILISMA: + note->gtex_offset_case = + TorcResQuilismaNonAuctusSecondWideWide; + break; + case S_ORISCUS: + note->gtex_offset_case = + TorcResOriscusNonAuctusSecondWideWide; + break; + default: + note->gtex_offset_case = + TorcResNonAuctusSecondWideWide; + break; + } + } + } + } + h_episema = VPOS_ABOVE; + v_episema = VPOS_BELOW; + v_episema_below_is_lower = true; + break; + default: + --i; + done = false; + break; + } + + if (done) { + break; + } + /* else fallthrough to the next case! */ + case T_PORRECTUS: + switch (i) { + case HEPISEMA_FIRST_TWO: + case 1: + if (glyph->u.notes.liquescentia & + (L_AUCTUS_ASCENDENS | L_AUCTUS_DESCENDENS | L_AUCTA)) { + /* auctus */ + note->gtex_offset_case = PorrAuctusInitialAny; + } else if (note->next->next->u.note.pitch - + note->next->u.note.pitch == 1) { + /* non-auctus with a second ambitus of 1 */ + note->gtex_offset_case = PorrNonAuctusInitialOne; + } else { + /* non-auctus with a second ambitus of at least 2 */ + note->gtex_offset_case = PorrNonAuctusInitialWide; + } + h_episema = VPOS_ABOVE; + v_episema = VPOS_BELOW; + v_episema_below_is_lower = true; + break; + case 2: + low_high_set_lower(glyph, note); + if (glyph->u.notes.liquescentia & L_DEMINUTUS) { + note->gtex_offset_case = PenultBeforeDeminutus; + } else if (glyph->u.notes.liquescentia + & (L_AUCTUS_ASCENDENS|L_AUCTUS_DESCENDENS|L_AUCTA)) { + note->gtex_offset_case = PenultBeforePunctumWide; + } else { + note->gtex_offset_case = FinalPunctum; + } + h_episema = above_if_h_episema(note->previous); + v_episema = VPOS_BELOW; + break; + default: /* case 3 */ + low_high_set_upper(glyph, note); + note->gtex_offset_case = last_note_case(glyph, FinalUpperPunctum, + note, true); + h_episema = VPOS_ABOVE; + v_episema = below_if_auctus(glyph); + break; + } + break; + case T_SCANDICUS: + switch (i) { + case 1: + note->gtex_offset_case = first_note_case(note, glyph); + h_episema = VPOS_BELOW; + v_episema = VPOS_BELOW; + break; + case 2: + low_high_set_lower(glyph, note); + if (note->u.note.pitch - note->previous->u.note.pitch == 1) { + note->gtex_offset_case = FinalPunctum; + } else { + note->gtex_offset_case = FinalConnectedPunctum; + } + h_episema = VPOS_BELOW; + v_episema = VPOS_BELOW; + break; + default: + low_high_set_upper(glyph, note); + note->gtex_offset_case = last_note_case(glyph, FinalPunctum, note, + true); + h_episema = VPOS_ABOVE; + v_episema = VPOS_BELOW; + break; + } + break; + case T_SALICUS: + case T_SALICUS_LONGQUEUE: + v_episema = VPOS_BELOW; + switch (i) { + case 1: + note->gtex_offset_case = InitialConnectedPunctum; + h_episema = above_if_h_episema(note->next); + break; + case 2: + if (note->next->u.note.pitch - note->u.note.pitch == 1) { + note->gtex_offset_case = SalicusOriscusOne; + } else { + note->gtex_offset_case = SalicusOriscusWide; + } + h_episema = VPOS_ABOVE; + break; + default: + note->gtex_offset_case = last_note_case(glyph, FinalPunctum, note, + false); + if (glyph->u.notes.liquescentia & L_DEMINUTUS) { + v_episema = VPOS_ABOVE; + } + h_episema = VPOS_ABOVE; + break; + } + break; + case T_TORCULUS_LIQUESCENS: + done = true; + switch (i) { + case 1: + note->gtex_offset_case = first_note_case(note, glyph); + h_episema = above_if_h_episema(note->next); + v_episema = VPOS_BELOW; + break; + case 2: + note->gtex_offset_case = + note_before_last_note_case_ignoring_deminutus(note); + h_episema = VPOS_ABOVE; + v_episema = VPOS_BELOW; + break; + default: + --i; + done = false; + break; + } + + if (done) { + break; + } + /* else fallthrough to the next case! */ + case T_ANCUS: + case T_ANCUS_LONGQUEUE: + switch (i) { + case 1: + note->gtex_offset_case = first_note_case(note, glyph); + h_episema = above_if_h_episema(note->next); + v_episema = VPOS_BELOW; + break; + case 2: + note->is_upper_note = true; + note->gtex_offset_case = note_before_last_note_case(glyph, note); + h_episema = VPOS_ABOVE; + v_episema = below_if_next_ambitus_allows(note); + break; + default: + note->is_lower_note = true; + note->gtex_offset_case = last_note_case(glyph, FinalPunctum, note, + false); + h_episema = VPOS_BELOW; + v_episema = VPOS_BELOW; + break; + } + break; + case T_TORCULUS: + switch (i) { + case 1: + note->gtex_offset_case = first_note_case(note, glyph); + h_episema = above_if_h_episema(note->next); + v_episema = VPOS_BELOW; + break; + case 2: + high_low_set_upper(glyph, note); + note->gtex_offset_case = note_before_last_note_case(glyph, note); + h_episema = VPOS_ABOVE; + if (glyph->u.notes.liquescentia & L_DEMINUTUS) { + v_episema = below_if_next_ambitus_allows(note); + } else { + v_episema = VPOS_BELOW; + } + break; + default: + high_low_set_lower(glyph, note); + note->gtex_offset_case = last_note_case(glyph, FinalPunctum, note, + false); + h_episema = above_if_h_episema(note->previous); + v_episema = VPOS_BELOW; + break; + } + break; + default: /* case T_ONE_NOTE */ + h_episema = VPOS_ABOVE; + v_episema = VPOS_BELOW; + switch (note->u.note.shape) { + case S_PUNCTUM_INCLINATUM_DEMINUTUS: + note->gtex_offset_case = FinalInclinatumDeminutus; + break; + case S_PUNCTUM_INCLINATUM_AUCTUS: + case S_PUNCTUM_INCLINATUM: + case S_PUNCTUM_CAVUM_INCLINATUM_AUCTUS: + case S_PUNCTUM_CAVUM_INCLINATUM: + note->gtex_offset_case = FinalInclinatum; + break; + case S_STROPHA: + note->gtex_offset_case = FinalStropha; + break; + case S_QUILISMA: + note->gtex_offset_case = FinalQuilisma; + break; + case S_ORISCUS: + case S_ORISCUS_AUCTUS: + case S_ORISCUS_DEMINUTUS: + note->gtex_offset_case = FinalOriscus; + break; + case S_VIRGA: + note->gtex_offset_case = InitialVirga; + break; + case S_VIRGA_REVERSA: + if (glyph->u.notes.liquescentia == L_AUCTUS_DESCENDENS) { + note->gtex_offset_case = FinalVirgaAuctus; + } else { + note->gtex_offset_case = InitialVirga; + } + break; + case S_LINEA_PUNCTUM: + case S_LINEA_PUNCTUM_CAVUM: + note->gtex_offset_case = FinalLineaPunctum; + break; + case S_LINEA: + note->gtex_offset_case = FinalPunctum; + break; + default: + note->gtex_offset_case = last_note_case(glyph, FinalPunctum, note, + true); + break; + } + break; + } + + if (note->signs & _V_EPISEMA) { + if (note->v_episema_height) { + if (note->v_episema_height > note->u.note.pitch) { + /* above is always higher because of GregorioTeX's design */ + note->v_episema_height += (int)VPOS_ABOVE; + } + } + else { + note->v_episema_height = note->u.note.pitch + (int)v_episema; + if ((v_episema == VPOS_BELOW && v_episema_below_is_lower) + || v_episema == VPOS_ABOVE) { + /* above is always higher because of GregorioTeX's design */ + note->v_episema_height += (int)v_episema; + } + } + } + + return h_episema; +} + +static __inline char compute_h_episema_height( + const gregorio_glyph *const glyph, const gregorio_note *const note, + const gregorio_vposition vpos) +{ + char height = note->u.note.pitch; + + if (note->signs & _V_EPISEMA) { + if ((vpos == VPOS_ABOVE && note->v_episema_height >= height) + || (vpos == VPOS_BELOW && note->v_episema_height <= height)) { + height = note->v_episema_height; + } + } + + if (vpos == VPOS_ABOVE && note->choral_sign + && !choral_sign_here_is_low(glyph, note, NULL)) { + ++height; + if (!is_on_a_line(note->u.note.pitch)) { + ++height; + } + } + + return height + (int)vpos; +} + +static bool is_bridgeable_space(const gregorio_element *const element) +{ + if (element->type == GRE_SPACE) { + switch (element->u.misc.unpitched.info.space) { + case SP_NEUMATIC_CUT: + case SP_LARGER_SPACE: + case SP_NEUMATIC_CUT_NB: + case SP_LARGER_SPACE_NB: + return true; + default: + /* do nothing */ + break; + } + } + + return false; +} + +typedef struct height_computation { + const gregorio_vposition vpos; + bool (*const is_applicable)(const gregorio_note *); + bool (*const is_shown)(const gregorio_note *); + bool (*const is_connected)(const gregorio_note *); + grehepisema_size (*const get_size)(const gregorio_note *); + bool (*const is_better_height)(signed char, signed char); + void (*const position)(gregorio_note *, signed char, bool); + + bool active; + char height; + bool connected; + const gregorio_element *start_element; + const gregorio_glyph *start_glyph; + gregorio_note *start_note; + gregorio_note *last_connected_note; +} height_computation; + +static bool is_h_episema_above_applicable(const gregorio_note *const note) +{ + return note->h_episema_above || !note->is_lower_note; +} + +static bool is_h_episema_below_applicable(const gregorio_note *const note) +{ + return note->h_episema_below || !note->is_upper_note; +} + +bool gtex_is_h_episema_above_shown(const gregorio_note *const note) +{ + return note->h_episema_above; +} + +bool gtex_is_h_episema_below_shown(const gregorio_note *const note) +{ + return note->h_episema_below; +} + +static bool is_h_episema_above_connected(const gregorio_note *const note) +{ + return note->h_episema_above_connect; +} + +static bool is_h_episema_below_connected(const gregorio_note *const note) +{ + return note->h_episema_below_connect; +} + +static grehepisema_size get_h_episema_above_size( + const gregorio_note *const note) +{ + return note->h_episema_above_size; +} + +static grehepisema_size get_h_episema_below_size( + const gregorio_note *const note) +{ + return note->h_episema_below_size; +} + +static bool is_h_episema_above_better_height(const signed char new_height, + const signed char old_height) +{ + return new_height > old_height; +} + +static bool is_h_episema_below_better_height(const signed char new_height, + const signed char old_height) +{ + return new_height < old_height; +} + +static __inline void start_h_episema(height_computation *const h, + const gregorio_element *const element, + const gregorio_glyph *const glyph, gregorio_note *const note) +{ + h->start_element = element; + h->start_glyph = glyph; + h->start_note = note; + h->active = true; + h->height = compute_h_episema_height(glyph, note, h->vpos); +} + +static __inline void set_h_episema_height(const height_computation *const h, + gregorio_note *const end) +{ + gregorio_note *last_note = NULL; + + const gregorio_element *element = h->start_element; + const gregorio_glyph *glyph = h->start_glyph; + gregorio_note *note = h->start_note; + + for ( ; element; element = element->next) { + if (element->type == GRE_ELEMENT) { + for (glyph = glyph? glyph : element->u.first_glyph; glyph; + glyph = glyph->next) { + if (glyph && glyph->type == GRE_GLYPH) { + for (note = note? note : glyph->u.notes.first_note; note; + note = note->next) { + if (end && note == end) { + if (last_note) { + h->position(last_note, h->height, false); + } + return; + } + if (h->is_applicable(note)) { + h->position(note, h->height, true); + last_note = note; + } + } + } + } + } else if (!is_bridgeable_space(element)) { + break; + } + } + + if (last_note) { + h->position(last_note, h->height, false); + } +} + +static __inline bool is_connected_left(const grehepisema_size size) { + return size == H_NORMAL || size == H_SMALL_LEFT; +} + +static __inline bool is_connected_right(const grehepisema_size size) { + return size == H_NORMAL || size == H_SMALL_RIGHT; +} + +static __inline bool is_connectable_interglyph_ambitus( + const gregorio_note *const first, const gregorio_note *const second) +{ + return first && second + && abs(first->u.note.pitch - second->u.note.pitch) < 3; +} + +static __inline bool has_space_to_left(const gregorio_note *const note) { + switch (note->u.note.shape) { + case S_PUNCTUM_INCLINATUM: + case S_PUNCTUM_INCLINATUM_DEMINUTUS: + case S_PUNCTUM_INCLINATUM_AUCTUS: + return !is_connectable_interglyph_ambitus(note->previous, note); + + default: + return !note->previous; + } +} + +static __inline void end_h_episema(height_computation *const h, + gregorio_note *const end) +{ + signed char proposed_height; + + if (h->active) { + /* don't let the episema clash with the note before or after */ + if (is_connected_left(h->get_size(h->start_note)) + && h->start_note->previous + && h->start_note->previous->type == GRE_NOTE + && is_connected_right(h->get_size(h->start_note->previous)) + && !has_space_to_left(h->start_note)) { + proposed_height = h->start_note->previous->u.note.pitch + h->vpos; + if (h->is_better_height(proposed_height, h->height)) { + h->height = proposed_height; + } + } + if (end && end->type == GRE_NOTE) { + gregorio_note *note; + /* this loop checks that it's within the same glyph */ + for (note = end->previous; note; note = note->previous) { + if (note == h->start_note) { + if (is_connected_left(h->get_size(end)) + && h->last_connected_note + && h->last_connected_note->next + && h->last_connected_note->next->type == GRE_NOTE + && !has_space_to_left(h->last_connected_note->next) + && is_connected_right(h->get_size( + h->last_connected_note))) { + proposed_height = end->u.note.pitch + h->vpos; + if (h->is_better_height(proposed_height, h->height)) { + h->height = proposed_height; + } + } + break; + } + } + } + + set_h_episema_height(h, end); + + h->active = false; + h->height = 0; + h->connected = false; + h->start_element = NULL; + h->start_glyph = NULL; + h->start_note = NULL; + h->last_connected_note = NULL; + } +} + +static __inline void compute_h_episema(height_computation *const h, + const gregorio_element *const element, + const gregorio_glyph *const glyph, gregorio_note *const note, + const int i, const gtex_type type) +{ + signed char next_height; + grehepisema_size size; + + if (h->is_applicable(note)) { + if (h->is_shown(note)) { + size = h->get_size(note); + + if (h->active) { + if (h->connected && is_connected_left(size) + && (i != 1 || is_connectable_interglyph_ambitus( + note, h->last_connected_note))) { + next_height = compute_h_episema_height(glyph, note, + h->vpos); + if (h->is_better_height(next_height, h->height)) { + h->height = next_height; + } + } + else { + end_h_episema(h, note); + start_h_episema(h, element, glyph, note); + } + } else { + start_h_episema(h, element, glyph, note); + } + + h->connected = h->is_connected(note) && is_connected_right(size); + h->last_connected_note = note; + } else { + end_h_episema(h, note); + } + } else if (!h->is_shown(note)) { + /* special handling for porrectus shapes because of their shape: + * the lower note of the porrectus stroke is normally not applicable, + * but we have to end the episema on the upper note if the episema + * on the lower note is not shown. */ + switch(type) { + case T_PORRECTUS: + case T_PORRECTUS_FLEXUS: + if (i == 2) { + end_h_episema(h, note); + } + break; + + case T_TORCULUS_RESUPINUS: + case T_TORCULUS_RESUPINUS_FLEXUS: + if (i == 3) { + end_h_episema(h, note); + } + break; + + default: + /* do nothing */ + break; + } + } +} + +static __inline void compute_note_positioning(height_computation *const above, + height_computation *const below, const gregorio_element *const element, + const gregorio_glyph *const glyph, gregorio_note *const note, + const int i, const gtex_type type) +{ + gregorio_vposition default_vpos = advise_positioning(glyph, note, i, type); + + if (note->h_episema_above == HEPISEMA_AUTO + && note->h_episema_below == HEPISEMA_AUTO) { + if (default_vpos == VPOS_BELOW) { + note->h_episema_above = HEPISEMA_NONE; + } + else { /* default_vpos == VPOS_ABOVE */ + note->h_episema_below = HEPISEMA_NONE; + } + } + + compute_h_episema(above, element, glyph, note, i, type); + compute_h_episema(below, element, glyph, note, i, type); +} + +void gregoriotex_compute_positioning(const gregorio_element *element) +{ + height_computation above = { + /*.vpos =*/ VPOS_ABOVE, + /*.is_applicable =*/ &is_h_episema_above_applicable, + /*.is_shown =*/ >ex_is_h_episema_above_shown, + /*.is_connected =*/ &is_h_episema_above_connected, + /*.get_size =*/ &get_h_episema_above_size, + /*.is_better_height =*/ &is_h_episema_above_better_height, + /*.position =*/ &gregorio_position_h_episema_above, + + /*.active =*/ false, + /*.height =*/ 0, + /*.connected =*/ false, + /*.start_element =*/ NULL, + /*.start_glyph =*/ NULL, + /*.start_note =*/ NULL, + /*.last_connected_note =*/ NULL, + }; + height_computation below = { + /*.vpos =*/ VPOS_BELOW, + /*.is_applicable =*/ &is_h_episema_below_applicable, + /*.is_shown =*/ >ex_is_h_episema_below_shown, + /*.is_connected =*/ &is_h_episema_below_connected, + /*.get_size =*/ &get_h_episema_below_size, + /*.is_better_height =*/ &is_h_episema_below_better_height, + /*.position =*/ &gregorio_position_h_episema_below, + + /*.active =*/ false, + /*.height =*/ 0, + /*.connected =*/ false, + /*.start_element =*/ NULL, + /*.start_glyph =*/ NULL, + /*.start_note =*/ NULL, + /*.last_connected_note =*/ NULL, + }; + int i; + gtex_alignment ignored; + gtex_type type; + + for (; element; element = element->next) { + if (element->type == GRE_ELEMENT) { + 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 (note = glyph->u.notes.first_note; note; + note = note->next) { + if (note->type == GRE_NOTE) { + compute_note_positioning(&above, &below, element, + glyph, note, ++i, type); + } + } + } + } + } else if (!is_bridgeable_space(element)) { + end_h_episema(&above, NULL); + end_h_episema(&below, NULL); + } + } + end_h_episema(&above, NULL); + end_h_episema(&below, NULL); +} + diff --git a/Build/source/texk/gregorio/gregorio-src/src/gregoriotex/gregoriotex-write.c b/Build/source/texk/gregorio/gregorio-src/src/gregoriotex/gregoriotex-write.c new file mode 100644 index 00000000000..8105faaecb7 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gregoriotex/gregoriotex-write.c @@ -0,0 +1,3319 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file contains functions for writing GregorioTeX from Gregorio structures. + * + * Copyright (C) 2008-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. */ + +/** + * @file + * @brief The plugin which writes a GregorioTeX score. + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <time.h> +#include "bool.h" +#include "struct.h" +#include "unicode.h" +#include "messages.h" +#include "characters.h" +#include "plugins.h" +#include "support.h" +#include "utf8strings.h" + +#include "gregoriotex.h" + +#define BUFSIZE 128 + +/* a structure containing the status */ +typedef struct gregoriotex_status { + bool point_and_click; + + /* true if the current_glyph will have an additional line under or not + * (useful to determine the length of the bar in case of a flexa starting + * at d */ + bool bottom_line; + + signed char top_height; + signed char bottom_height; + + /* indicates if there is a translation on the line */ + bool translation; + + /* indicates if there is "above lines text" on the line */ + bool abovelinestext; +} gregoriotex_status; + +#define UNDETERMINED_HEIGHT -127 + +#define MAX_AMBITUS 5 +static const char *tex_ambitus[] = { + NULL, "One", "Two", "Three", "Four", "Five" +}; + +/* the value indicating to GregorioTeX that there is no flat */ +#define NO_KEY_FLAT LOWEST_PITCH +#define PITCH_BELOW_STAFF (LOWEST_PITCH + 2) +#define PITCH_ABOVE_STAFF (LOWEST_PITCH + 10) + +/* a helper macro for the following function */ +#define WHILEGLYPH(prevornext) \ + while(glyph) {\ + if (glyph->type == GRE_GLYPH) {\ + note = glyph->u.notes.first_note;\ + while (note) {\ + if (note->u.note.pitch < PITCH_BELOW_STAFF) {\ + return true;\ + }\ + note = note->next;\ + }\ + }\ + glyph = glyph->prevornext;\ + } + +static __inline signed char pitch_value(const signed char height) { + /* right now height == pitch, but this function allows us to change + * the offset easily */ + return height; +} + +static __inline int bool_to_int(bool value) { + return value? 1 : 0; +} + +/* a function that determines if we must use a long queue or not (less easy + * that it might seem) */ + +static bool is_longqueue(const signed char pitch, + const gregorio_glyph *const current_glyph, + const gregorio_element *const current_element) +{ + gregorio_note *note; + gregorio_glyph *glyph = current_glyph->next; + gregorio_element *element = current_element->next; + switch (pitch - LOWEST_PITCH) { + case 1: + case 5: + case 7: + case 9: + case 11: + return true; + case 3: + /* we first look forward to see if there is a note underneath c */ + WHILEGLYPH(next); + if (element && element->type == GRE_SPACE + && (element->u.misc.unpitched.info.space == SP_NEUMATIC_CUT + || element->u.misc.unpitched.info.space == + SP_LARGER_SPACE + || element->u.misc.unpitched.info.space == + SP_NEUMATIC_CUT_NB + || element->u.misc.unpitched.info.space == + SP_LARGER_SPACE_NB)) { + element = element->next; + } + if (element && element->type == GRE_ELEMENT) { + glyph = element->u.first_glyph; + WHILEGLYPH(next); + } + /* and now something completely different */ + glyph = current_glyph->previous; + element = current_element->previous; + WHILEGLYPH(previous); + if (element && element->type == GRE_SPACE + && (element->u.misc.unpitched.info.space == SP_NEUMATIC_CUT + || element->u.misc.unpitched.info.space == + SP_LARGER_SPACE + || element->u.misc.unpitched.info.space == + SP_NEUMATIC_CUT_NB + || element->u.misc.unpitched.info.space == + SP_LARGER_SPACE_NB)) { + element = element->previous; + } + if (element && element->type == GRE_ELEMENT) { + glyph = element->u.first_glyph; + WHILEGLYPH(next); + } + return false; + default: + return false; + } +} + +/* inline functions that we will use to determine if we need a short bar or + * not */ + +/* we define d to be short instead of long... may induce errors, but fixes + * some too */ +static __inline bool is_shortqueue(const signed char pitch, + const gregorio_glyph *const glyph, + const gregorio_element *const element) +{ + return !is_longqueue(pitch, glyph, element); +} + +static grestyle_style gregoriotex_ignore_style = ST_NO_STYLE; +static grestyle_style gregoriotex_next_ignore_style = ST_NO_STYLE; + +static const char *gregoriotex_determine_note_glyph_name(gregorio_note *note, + gregorio_glyph *glyph, gregorio_element *element, gtex_alignment *type) +{ + static char buf[128]; + const char *name; + + if (!note) { + gregorio_message(_("called with NULL pointer"), + "gregoriotex_determine_note_glyph_name", VERBOSITY_ERROR, 0); + return ""; + } + + *type = AT_ONE_NOTE; + switch (note->u.note.shape) { + case S_PUNCTUM_INCLINATUM: + *type = AT_PUNCTUM_INCLINATUM; + return "PunctumInclinatum"; + case S_PUNCTUM_INCLINATUM_DEMINUTUS: + return "PunctumInclinatumDeminutus"; + case S_PUNCTUM_INCLINATUM_AUCTUS: + return "PunctumInclinatumAuctus"; + case S_PUNCTUM: + return "Punctum"; + case S_PUNCTUM_AUCTUS_ASCENDENS: + return "PunctumAscendens"; + case S_PUNCTUM_AUCTUS_DESCENDENS: + return "PunctumDescendens"; + case S_PUNCTUM_DEMINUTUS: + return "PunctumDeminutus"; + case S_PUNCTUM_CAVUM: + return "PunctumCavum"; + case S_LINEA: + return "Linea"; + case S_LINEA_PUNCTUM: + return "LineaPunctum"; + case S_LINEA_PUNCTUM_CAVUM: + return "LineaPunctumCavum"; + case S_VIRGA: + if (is_shortqueue(note->u.note.pitch, glyph, element)) { + return "Virga"; + } + return "VirgaLongqueue"; + case S_VIRGA_REVERSA: + switch (note->u.note.liquescentia) { + case L_AUCTUS_ASCENDENS: + if (is_shortqueue(note->u.note.pitch, glyph, element)) { + name = "VirgaReversaAscendens"; + } else { + name = "VirgaReversaLongqueueAscendens"; + } + if (note->u.note.pitch - LOWEST_PITCH == 3) { + /* if we're on the 'd' line, the queue could be long or short */ + gregorio_snprintf(buf, sizeof buf, + "VirgaReversaAscendensOnDLine{\\GreCP%s}", name); + return buf; + } + return name; + case L_AUCTUS_DESCENDENS: + if (is_shortqueue(note->u.note.pitch, glyph, element)) { + return "VirgaReversaDescendens"; + } + return "VirgaReversaLongqueueDescendens"; + default: + if (is_shortqueue(note->u.note.pitch, glyph, element)) { + return "VirgaReversa"; + } + return "VirgaReversaLongqueue"; + } + case S_ORISCUS: + *type = AT_ORISCUS; + return "Oriscus"; + case S_ORISCUS_AUCTUS: + *type = AT_ORISCUS; + return "OriscusReversus"; + case S_ORISCUS_DEMINUTUS: + *type = AT_ORISCUS; + return "OriscusDeminutus"; + case S_QUILISMA: + *type = AT_QUILISMA; + return "Quilisma"; + case S_ORISCUS_SCAPUS: + if (is_shortqueue(note->u.note.pitch, glyph, element)) { + return "OriscusScapus"; + } + return "OriscusScapusLongqueue"; + case S_STROPHA: + *type = AT_STROPHA; + if (note->u.note.liquescentia == L_AUCTA) { + return "StrophaAucta"; + } + return "Stropha"; + case S_STROPHA_AUCTA: + *type = AT_STROPHA; + return "StrophaAucta"; + case S_PUNCTUM_CAVUM_INCLINATUM: + *type = AT_PUNCTUM_INCLINATUM; + return "PunctumCavumInclinatum"; + case S_PUNCTUM_CAVUM_INCLINATUM_AUCTUS: + return "PunctumCavumInclinatumAuctus"; + default: + gregorio_messagef("gregoriotex_determine_note_glyph_name", + VERBOSITY_ERROR, 0, _("called with unknown shape: %d"), + note->u.note.shape); + return ""; + } +} + +/* + * The different liquescentiae are: + * 'Nothing' + * 'InitioDebilis' + * 'Deminutus + * 'Ascendens' + * 'Descendens' + * 'InitioDebilisDeminutus' + * 'InitioDebilisAscendens' + * 'InitioDebilisDescendens' + * + * If it is an auctus, which may be ascendens or descendens, by default we + * consider it as an ascendens + * + * They also are and must be the same as in squarize.py. + */ + +static const char *gregoriotex_determine_liquescentia(gtex_glyph_liquescentia type, + gregorio_liquescentia liquescentia) +{ + switch (liquescentia) { + case L_AUCTA: + liquescentia = L_AUCTUS_ASCENDENS; + break; + case L_AUCTA_INITIO_DEBILIS: + liquescentia = L_AUCTUS_ASCENDENS_INITIO_DEBILIS; + break; + default: + /* do nothing */ + break; + } + + switch (type) { + case LG_ALL: + break; + case LG_NO_INITIO: + if (liquescentia >= L_INITIO_DEBILIS) { + liquescentia = liquescentia - L_INITIO_DEBILIS; + } + break; + case LG_ONLY_DEMINUTUS: + if (liquescentia != L_DEMINUTUS + && liquescentia != L_DEMINUTUS_INITIO_DEBILIS) { + liquescentia = L_NO_LIQUESCENTIA; + } + break; + case LG_ONLY_AUCTUS: + if (liquescentia != L_AUCTUS_ASCENDENS + && liquescentia != L_AUCTUS_DESCENDENS) { + liquescentia = L_NO_LIQUESCENTIA; + } + case LG_UNDET_AUCTUS: + if (liquescentia == L_AUCTUS_DESCENDENS) { + liquescentia = L_AUCTUS_ASCENDENS; + } + if (liquescentia == L_AUCTUS_DESCENDENS_INITIO_DEBILIS) { + liquescentia = L_AUCTUS_ASCENDENS_INITIO_DEBILIS; + } + break; + default: + liquescentia = L_NO_LIQUESCENTIA; + break; + } + + /* now we convert liquescentia into the good GregorioTeX liquescentia + * numbers */ + + switch (liquescentia) { + case L_DEMINUTUS: + return "Deminutus"; + case L_AUCTUS_ASCENDENS: + return "Ascendens"; + case L_AUCTA: + case L_AUCTUS_DESCENDENS: + return "Descendens"; + case L_INITIO_DEBILIS: + return "InitioDebilis"; + case L_DEMINUTUS_INITIO_DEBILIS: + return "InitioDebilisDeminutus"; + case L_AUCTUS_ASCENDENS_INITIO_DEBILIS: + return "InitioDebilisAscendens"; + case L_AUCTA_INITIO_DEBILIS: + case L_AUCTUS_DESCENDENS_INITIO_DEBILIS: + return "InitioDebilisDescendens"; + case L_NO_LIQUESCENTIA: + /* break out and return "Nothing" */ + break; + } + + return "Nothing"; +} + +static __inline int compute_ambitus(const gregorio_note *const current_note) +{ + int first = current_note->u.note.pitch; + int second = current_note->next->u.note.pitch; + int ambitus; + if (first < second) { + ambitus = second - first; + } else { + ambitus = first - second; + } + if (ambitus < 1 || ambitus > MAX_AMBITUS) { + gregorio_messagef("compute_ambitus", VERBOSITY_ERROR, 0, + _("unsupported ambitus: %d"), ambitus); + return 0; + } + return ambitus; +} + +static const char *compute_glyph_name(const gregorio_glyph *const glyph, + const char *shape, const gtex_glyph_liquescentia ltype) +{ + static char buf[BUFSIZE]; + + const char *liquescentia = gregoriotex_determine_liquescentia(ltype, + glyph->u.notes.liquescentia); + gregorio_note *current_note; + /* then we start making our formula */ + int ambitus1, ambitus2, ambitus3; + if (!glyph) { + gregorio_message(_("called with NULL pointer"), + "compute_glyph_name", VERBOSITY_ERROR, 0); + return ""; + } + if (!glyph->u.notes.first_note) { + gregorio_message(_("called with a glyph that have no note"), + "compute_glyph_name", VERBOSITY_ERROR, 0); + return ""; + } + current_note = glyph->u.notes.first_note; + if (!current_note->next) { + gregorio_message(_("called with a multi-note glyph that has only " + "one note"), "compute_glyph_name", VERBOSITY_ERROR, 0); + return ""; + } + if (!(ambitus1 = compute_ambitus(current_note))) { + return ""; + } + /* the salicus queue is at the end of the glyph, and it doesn't exist for + * the liquescent forms */ + if (strcmp(shape, "SalicusLongqueue") == 0 + && strcmp(liquescentia, "Nothing") != 0) { + shape = "Salicus"; + } + current_note = current_note->next; + if (!current_note->next) { + gregorio_snprintf(buf, BUFSIZE, "%s%s%s", shape, tex_ambitus[ambitus1], + liquescentia); + return buf; + } + if (!(ambitus2 = compute_ambitus(current_note))) { + return ""; + } + current_note = current_note->next; + if (!current_note->next) { + gregorio_snprintf(buf, BUFSIZE, "%s%s%s%s", shape, + tex_ambitus[ambitus1], tex_ambitus[ambitus2], liquescentia); + return buf; + } + if (!(ambitus3 = compute_ambitus(current_note))) { + return ""; + } + gregorio_snprintf(buf, BUFSIZE, "%s%s%s%s%s", shape, tex_ambitus[ambitus1], + tex_ambitus[ambitus2], tex_ambitus[ambitus3], liquescentia); + return buf; +} + +/* the function that calculates the number of the glyph. It also + * calculates the type, used for determining the position of signs. Type is + * very basic, it is only the global dimensions : torculus, one_note, etc. */ + +const char *gregoriotex_determine_glyph_name(const gregorio_glyph *const glyph, + const gregorio_element *const element, gtex_alignment *const type, + gtex_type *const gtype) +{ + const char *shape = NULL; + gtex_glyph_liquescentia ltype; + char pitch = 0; + if (!glyph) { + gregorio_message(_("called with NULL pointer"), + "gregoriotex_determine_glyph_name", VERBOSITY_ERROR, 0); + return ""; + } + if (!glyph->u.notes.first_note) { + gregorio_message(_("called with a glyph that has no note"), + "gregorio_tex_determine_glyph_name", VERBOSITY_ERROR, 0); + return ""; + } + *gtype = T_ONE_NOTE; + switch (glyph->u.notes.glyph_type) { + case G_PODATUS: + pitch = glyph->u.notes.first_note->next->u.note.pitch; + switch (glyph->u.notes.first_note->u.note.shape) { + case S_QUILISMA: + *type = AT_QUILISMA; + /* the next if is because we made the choice that AUCTUS shapes + * look like pes quadratum. */ + if (glyph->u.notes.liquescentia == L_AUCTUS_ASCENDENS + || glyph->u.notes.liquescentia == L_AUCTUS_DESCENDENS + || glyph->u.notes.liquescentia == + L_AUCTUS_DESCENDENS_INITIO_DEBILIS + || glyph->u.notes.liquescentia == + L_AUCTUS_ASCENDENS_INITIO_DEBILIS) { + *gtype = T_PESQUILISMAQUADRATUM; + shape = "PesQuilismaQuadratum"; + } else { + *gtype = T_PESQUILISMA; + shape = "PesQuilisma"; + } + ltype = LG_NO_INITIO; + break; + case S_ORISCUS: + case S_ORISCUS_SCAPUS: + *type = AT_ORISCUS; + /* TODO: we could factorize this code */ + if (glyph->u.notes.liquescentia == L_NO_LIQUESCENTIA + && is_longqueue(pitch, glyph, element)) { + *gtype = T_PESQUASSUS_LONGQUEUE; + shape = "PesQuassusLongqueue"; + } else { + *gtype = T_PESQUASSUS; + shape = "PesQuassus"; + } + ltype = LG_NO_INITIO; + break; + default: + *type = AT_ONE_NOTE; + if (glyph->u.notes.liquescentia == L_AUCTUS_ASCENDENS + || glyph->u.notes.liquescentia == L_AUCTUS_DESCENDENS + || glyph->u.notes.liquescentia == + L_AUCTUS_DESCENDENS_INITIO_DEBILIS + || glyph->u.notes.liquescentia == + L_AUCTUS_ASCENDENS_INITIO_DEBILIS) { + *gtype = T_PESQUADRATUM; + shape = "PesQuadratum"; + } else { + *gtype = T_PES; + shape = "Pes"; + } + ltype = LG_ALL; + break; + } + break; + case G_PES_QUADRATUM: + pitch = glyph->u.notes.first_note->next->u.note.pitch; + switch (glyph->u.notes.first_note->u.note.shape) { + case S_QUILISMA: + *type = AT_QUILISMA; + if (glyph->u.notes.liquescentia == L_NO_LIQUESCENTIA + && is_longqueue(pitch, glyph, element)) { + *gtype = T_PESQUILISMAQUADRATUM_LONGQUEUE; + shape = "PesQuilismaQuadratumLongqueue"; + } else { + *gtype = T_PESQUILISMAQUADRATUM; + shape = "PesQuilismaQuadratum"; + } + ltype = LG_NO_INITIO; + break; + case S_ORISCUS: + *type = AT_ORISCUS; + if (glyph->u.notes.liquescentia == L_NO_LIQUESCENTIA + && is_longqueue(pitch, glyph, element)) { + *gtype = T_PESQUASSUS_LONGQUEUE; + shape = "PesQuadratumLongqueue"; + } else { + *gtype = T_PESQUASSUS; + shape = "PesQuassus"; + } + ltype = LG_NO_INITIO; + break; + default: + *type = AT_ONE_NOTE; + if (glyph->u.notes.liquescentia == L_NO_LIQUESCENTIA + && is_longqueue(pitch, glyph, element)) { + *gtype = T_PESQUADRATUM_LONGQUEUE; + shape = "PesQuadratumLongqueue"; + } else { + *gtype = T_PESQUADRATUM; + shape = "PesQuadratum"; + } + ltype = LG_ALL; + break; + } + break; + case G_VIRGA_STRATA: + pitch = glyph->u.notes.first_note->next->u.note.pitch; + *type = AT_ONE_NOTE; + *gtype = T_VIRGA_STRATA; + shape = "VirgaStrata"; + ltype = LG_ALL; + break; + case G_FLEXA: + pitch = glyph->u.notes.first_note->u.note.pitch; + if (glyph->u.notes.liquescentia == L_DEMINUTUS) { + *type = AT_FLEXUS_DEMINUTUS; + } else { + if (pitch - glyph->u.notes.first_note->next->u.note.pitch == 1) { + *type = AT_FLEXUS_1; + } else { + *type = AT_FLEXUS; + } + } + if (glyph->u.notes.first_note->u.note.shape == S_ORISCUS) { + *gtype = T_FLEXUS_ORISCUS; + shape = "FlexusOriscus"; + ltype = LG_NO_INITIO; + } else if (glyph->u.notes.first_note->u.note.shape == S_ORISCUS_SCAPUS) { + if (is_shortqueue(pitch, glyph, element)) { + *gtype = T_FLEXUS_ORISCUS_SCAPUS; + shape = "FlexusOriscusScapus"; + } else { + *gtype = T_FLEXUS_ORISCUS_SCAPUS_LONGQUEUE; + shape = "FlexusOriscusScapusLongqueue"; + } + ltype = LG_NO_INITIO; + } else { + if (is_shortqueue(pitch, glyph, element)) { + *gtype = T_FLEXUS; + shape = "Flexus"; + } else { + *gtype = T_FLEXUS_LONGQUEUE; + shape = "FlexusLongqueue"; + } + ltype = LG_NO_INITIO; + } + break; + case G_TORCULUS: + *gtype = T_TORCULUS; + if (glyph->u.notes.first_note->u.note.shape == S_QUILISMA) { + *type = AT_QUILISMA; + shape = "TorculusQuilisma"; + ltype = LG_NO_INITIO; + } else { + *type = AT_ONE_NOTE; + shape = "Torculus"; + ltype = LG_ALL; + } + break; + case G_TORCULUS_LIQUESCENS: + *gtype = T_TORCULUS_LIQUESCENS; + if (glyph->u.notes.first_note->u.note.shape == S_QUILISMA) { + *type = AT_QUILISMA; + shape = "TorculusLiquescensQuilisma"; + } else { + *type = AT_ONE_NOTE; + shape = "TorculusLiquescens"; + } + ltype = LG_ONLY_DEMINUTUS; + break; + case G_TORCULUS_RESUPINUS_FLEXUS: + *type = AT_ONE_NOTE; + *gtype = T_TORCULUS_RESUPINUS_FLEXUS; + break; + case G_PORRECTUS: + *type = AT_PORRECTUS; + *gtype = T_PORRECTUS; + shape = "Porrectus"; + ltype = LG_NO_INITIO; + break; + case G_TORCULUS_RESUPINUS: + *gtype = T_TORCULUS_RESUPINUS; + if (glyph->u.notes.first_note->u.note.shape == S_QUILISMA) { + *type = AT_QUILISMA; + shape = "TorculusResupinusQuilisma"; + } else { + *type = AT_ONE_NOTE; + shape = "TorculusResupinus"; + } + ltype = LG_ALL; + break; + case G_PORRECTUS_FLEXUS: + *type = AT_PORRECTUS; + *gtype = T_PORRECTUS_FLEXUS; + shape = "PorrectusFlexus"; + ltype = LG_NO_INITIO; + break; + case G_PORRECTUS_NO_BAR: + *type = AT_PORRECTUS; + *gtype = T_TORCULUS_RESUPINUS; + shape = "PorrectusNobar"; + ltype = LG_NO_INITIO; + break; + case G_PORRECTUS_FLEXUS_NO_BAR: + *type = AT_PORRECTUS; + *gtype = T_TORCULUS_RESUPINUS_FLEXUS; + shape = "PorrectusFlexusNobar"; + ltype = LG_NO_INITIO; + break; + case G_ANCUS: + if (glyph->u.notes.liquescentia == L_DEMINUTUS + || glyph->u.notes.liquescentia == L_DEMINUTUS_INITIO_DEBILIS) { + if (pitch - glyph->u.notes.first_note->next->u.note.pitch == 1) { + *type = AT_FLEXUS_1; + } else { + *type = AT_FLEXUS; + } + if (is_shortqueue(pitch, glyph, element)) { + *gtype = T_ANCUS; + shape = "Ancus"; + } else { + *gtype = T_ANCUS_LONGQUEUE; + shape = "AncusLongqueue"; + } + ltype = LG_ONLY_DEMINUTUS; + } else { + /* TODO... */ + *type = AT_ONE_NOTE; + } + break; + case G_SCANDICUS: + *type = AT_ONE_NOTE; + *gtype = T_SCANDICUS; + shape = "Scandicus"; + ltype = LG_NO_INITIO; + break; + case G_SALICUS: + *type = AT_ONE_NOTE; + pitch = glyph->u.notes.first_note->next->next->u.note.pitch; + if (is_longqueue(pitch, glyph, element)) { + *gtype = T_SALICUS_LONGQUEUE; + shape = "SalicusLongqueue"; + } else { + *gtype = T_SALICUS; + shape = "Salicus"; + } + ltype = LG_NO_INITIO; + break; + case G_ONE_NOTE: + case G_PUNCTUM_INCLINATUM: + case G_TRIGONUS: + case G_PUNCTA_INCLINATA: + case G_2_PUNCTA_INCLINATA_DESCENDENS: + case G_3_PUNCTA_INCLINATA_DESCENDENS: + case G_4_PUNCTA_INCLINATA_DESCENDENS: + case G_5_PUNCTA_INCLINATA_DESCENDENS: + case G_2_PUNCTA_INCLINATA_ASCENDENS: + case G_3_PUNCTA_INCLINATA_ASCENDENS: + case G_4_PUNCTA_INCLINATA_ASCENDENS: + case G_5_PUNCTA_INCLINATA_ASCENDENS: + case G_PUNCTUM: + case G_STROPHA: + case G_VIRGA: + case G_VIRGA_REVERSA: + case G_STROPHA_AUCTA: + case G_DISTROPHA: + case G_DISTROPHA_AUCTA: + case G_TRISTROPHA: + case G_TRISTROPHA_AUCTA: + case G_BIVIRGA: + case G_TRIVIRGA: + *type = AT_ONE_NOTE; + break; + default: + gregorio_messagef("gregoriotex_determine_glyph_name", VERBOSITY_ERROR, + 0, _("called with unknown glyph: %d"), + glyph->u.notes.glyph_type); + break; + } + if (shape) { + shape = compute_glyph_name(glyph, shape, ltype); + } + /* we fix *type with initio_debilis */ + if (*type == AT_ONE_NOTE) { + if (is_initio_debilis(glyph->u.notes.liquescentia)) { + *type = AT_INITIO_DEBILIS; + } + } + + return shape; +} + +/** + * This now does nothing useful, since the manuscript_reference is + * now part of the score info. But we keep it here in case it may + * be needed in future. + */ +static void gregoriotex_write_voice_info(FILE *f, gregorio_voice_info *voice_info) +{ + if (!f || !voice_info) { + return; + } +} + +/* this function indicates if the syllable is the last of the line. If it's the + * last of the score it returns false, as it's handled another way */ +static bool gregoriotex_is_last_of_line(gregorio_syllable *syllable) +{ + gregorio_element *current_element = NULL; + if (!(syllable->next_syllable)) { + return false; + } + if ((syllable->next_syllable->elements)[0] + && (syllable->next_syllable->elements)[0]->type == GRE_END_OF_LINE) { + /* the next syllable start by an end of line */ + return true; + } + current_element = (syllable->elements)[0]; + while (current_element) { + if (current_element->type == GRE_END_OF_LINE) { + /* we return true only if the end of line is the last element */ + if (!(current_element->next)) { + return true; + } else { + return false; + } + } else { + current_element = current_element->next; + } + } + return false; +} + +/* + * A small helper for the following function + */ + +static __inline bool is_clef(gregorio_type x) +{ + return x == GRE_C_KEY_CHANGE || x == GRE_F_KEY_CHANGE || + x == GRE_C_KEY_CHANGE_FLATED || x == GRE_F_KEY_CHANGE_FLATED; +} + +/* + * This function is used in write_syllable, it detects if the syllable is like + * (c4), (::c4), (z0c4) or (z0::c4). It returns the gregorio_element of the + * clef change. + */ +static gregorio_element *gregoriotex_syllable_is_clef_change(gregorio_syllable + *syllable) +{ + gregorio_element *element; + if (!syllable || !syllable->elements || !syllable->elements[0]) { + return NULL; + } + element = syllable->elements[0]; + /* we just detect the foud cases */ + if (element->type == GRE_CUSTOS && element->next + && (is_clef(element->next->type)) && !element->next->next) { + return element->next; + } + if (element->type == GRE_BAR && element->next + && (is_clef(element->next->type)) && !element->next->next) { + return element->next; + } + if ((is_clef(element->type)) && !element->next) { + return element; + } + if (element->type == GRE_CUSTOS && element->next + && element->next->type == GRE_BAR && element->next->next + && (is_clef(element->next->next->type)) + && !element->next->next->next) { + return element->next->next; + } + return NULL; +} + +/* + * ! @brief Prints the beginning of each text style + */ +static void gtex_write_begin(FILE *f, grestyle_style style) +{ + if (style == gregoriotex_ignore_style) { + return; + } + switch (style) { + case ST_ITALIC: + fprintf(f, "\\GreItalic{"); + break; + case ST_SMALL_CAPS: + fprintf(f, "\\GreSmallCaps{"); + break; + case ST_BOLD: + fprintf(f, "\\GreBold{"); + break; + case ST_FORCED_CENTER: + case ST_CENTER: + fprintf(f, "}{"); + break; + case ST_TT: + fprintf(f, "\\GreTypewriter{"); + break; + case ST_UNDERLINED: + fprintf(f, "\\GreUnderline{"); + break; + case ST_COLORED: + fprintf(f, "\\GreColored{"); + break; + case ST_FIRST_WORD: + fprintf(f, "\\GreFirstWord{"); + break; + case ST_FIRST_SYLLABLE: + fprintf(f, "\\GreFirstSyllable{"); + break; + case ST_FIRST_SYLLABLE_INITIAL: + fprintf(f, "\\GreFirstSyllableInitial{"); + break; + default: + break; + } +} + +/** + * @brief Ends each text style + */ +static void gtex_write_end(FILE *f, grestyle_style style) +{ + if (style == gregoriotex_ignore_style) { + return; + } + switch (style) { + case ST_FORCED_CENTER: + case ST_CENTER: + case ST_SYLLABLE_INITIAL: + fprintf(f, "}{"); + break; + case ST_INITIAL: + break; + default: + fprintf(f, "}"); + break; + } +} + +/* + * ! @brief Writes GregorioTeX special characters. This function takes the + * special characters as input (i.e. from gabc representation), and writes them + * * in GregorioTeX form. + */ +static void gtex_write_special_char(FILE *f, grewchar *special_char) +{ + if (!gregorio_wcsbufcmp(special_char, "A/")) { + fprintf(f, "\\Abar{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "%")) { + fprintf(f, "\\%%{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "R/")) { + fprintf(f, "\\Rbar{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "V/")) { + fprintf(f, "\\Vbar{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, ACCENTED_AE)) { + fprintf(f, "\\'\\ae{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "'ae")) { + fprintf(f, "\\'\\ae{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, ACCENTED_OE)) { + fprintf(f, "\\'\\oe{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "'oe")) { + fprintf(f, "\\'\\oe{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "ae")) { + fprintf(f, "\\ae{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "oe")) { + fprintf(f, "\\oe{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "*")) { + fprintf(f, "\\GreStar{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "+")) { + fprintf(f, "\\GreDagger{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "-")) { + fprintf(f, "\\GreZeroHyph{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "\\")) { + fprintf(f, "\\textbackslash{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "&")) { + fprintf(f, "\\&{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "#")) { + fprintf(f, "\\#{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "_")) { + fprintf(f, "\\_{}"); + return; + } + if (!gregorio_wcsbufcmp(special_char, "~")) { + fprintf(f, "\\GreTilde{}"); + return; + } +} + +static void gtex_write_verb(FILE *f, grewchar *first_char) +{ + gregorio_print_unistring(f, first_char); +} + +static void gtex_print_char(FILE *f, grewchar to_print) +{ + switch (to_print) { + case L'*': + fprintf(f, "\\GreStar{}"); + break; + case L'%': + fprintf(f, "\\%%{}"); + break; + case L'\\': + fprintf(f, "\\textbackslash{}"); + break; + case L'&': + fprintf(f, "\\&{}"); + break; + case L'#': + fprintf(f, "\\#{}"); + break; + case L'+': + fprintf(f, "\\GreDagger{}"); + break; + case L'_': + fprintf(f, "\\_{}"); + break; + case L'-': + fprintf(f, "\\GreHyph{}"); + break; + default: + gregorio_print_unichar(f, to_print); + break; + } + return; +} + +/* a function to map the internal ST_* styles to gregoriotex styles as defined + * in gregoriotex-syllables.tex */ +static unsigned char gregoriotex_internal_style_to_gregoriotex(grestyle_style + style) +{ + switch (style) { + case ST_ITALIC: + return 1; + break; + case ST_BOLD: + return 2; + break; + case ST_SMALL_CAPS: + return 3; + break; + case ST_TT: + return 4; + break; + case ST_UNDERLINED: + return 5; + break; + case ST_COLORED: + return 6; + break; + default: + return 0; + break; + } +} + +/* + * A quite hacky function: when we have only one style (typically italic) and + * when this style is on all the parts, then we return this style. + * + */ +static grestyle_style gregoriotex_fix_style(gregorio_character *first_character) +{ + grestyle_style possible_fixed_style = ST_NO_STYLE; + unsigned char state = 0; + /* + * states are: - 0: we didn't meet any style yet, which means that if we + * encounter: * a character -> we can return, nothing to do * a style -> we + * go in state 1 * center or initial: stay in state 0 - 1: we encountered a + * style, if we encounter * another style : we can return * something that + * makes us change syllable part (like center or initial) -> go in state 2 * + * a character : stay in state 1 - 2: if we encounter: * another style, then + * return * a character, then return * the same style: go in state 1 + */ + gregorio_character *current_char = first_character; + while (current_char) { + switch (state) { + case 0: + if (current_char->is_character) + return 0; + if (current_char->cos.s.style != ST_CENTER + && current_char->cos.s.style != ST_FORCED_CENTER + && current_char->cos.s.style != ST_FIRST_WORD + && current_char->cos.s.style != ST_FIRST_SYLLABLE + && current_char->cos.s.style != ST_FIRST_SYLLABLE_INITIAL + && current_char->cos.s.style != ST_SPECIAL_CHAR + && current_char->cos.s.style != ST_VERBATIM + && current_char->cos.s.style != ST_INITIAL) { + possible_fixed_style = current_char->cos.s.style; + state = 1; + } + break; + case 1: + if (!current_char->is_character) { + if (!current_char->is_character + && current_char->cos.s.style != ST_CENTER + && current_char->cos.s.style != ST_FORCED_CENTER + && current_char->cos.s.style != ST_FIRST_WORD + && current_char->cos.s.style != ST_FIRST_SYLLABLE + && current_char->cos.s.style != ST_FIRST_SYLLABLE_INITIAL + && current_char->cos.s.style != ST_INITIAL) { + state = 2; + } else if (current_char->cos.s.style != possible_fixed_style + && current_char->cos.s.style != ST_SPECIAL_CHAR + && current_char->cos.s.style != ST_VERBATIM) + return 0; + } + break; + case 2: + if (current_char->is_character) + return 0; + if (current_char->cos.s.style != ST_CENTER + && current_char->cos.s.style != ST_FORCED_CENTER + && current_char->cos.s.style != ST_FIRST_WORD + && current_char->cos.s.style != ST_FIRST_SYLLABLE + && current_char->cos.s.style != ST_FIRST_SYLLABLE_INITIAL + && current_char->cos.s.style != ST_SPECIAL_CHAR + && current_char->cos.s.style != ST_VERBATIM + && current_char->cos.s.style != ST_INITIAL) { + if (current_char->cos.s.style != possible_fixed_style) { + return 0; + } else { + state = 1; + } + } + break; + default: + break; + } + current_char = current_char->next_character; + } + /* if we reached here, this means that we there is only one style applied + * to all the syllables */ + return possible_fixed_style; +} + +/* + * @brief Writes the translation. + * + * There is no special handling of translation text; that is, we just print the + * entire string of text under the normal text line, without considering any + * special centering or linebreaks. + */ +static void gregoriotex_write_translation(FILE *f, + gregorio_character *translation) +{ + if (translation == NULL) { + return; + } + gregorio_write_text(false, translation, f, + (>ex_write_verb), + (>ex_print_char), + (>ex_write_begin), (>ex_write_end), (>ex_write_special_char)); +} + +/* a function to compute the height of the flat of a key + * the flat is always on the line of the */ + +static char gregoriotex_clef_flat_height(char step, int line) +{ + char offset = 6; + switch (step) { + case C_KEY: + switch (line) { + case 1: + offset = 2; + break; + case 2: + offset = 4; + break; + case 3: + offset = 6; + break; + case 4: + offset = 8; + break; + default: + gregorio_messagef("gregoriotex_clef_flat_height", VERBOSITY_ERROR, + 0, _("unknown line number: %d"), line); + break; + } + break; + case F_KEY: + switch (line) { + case 1: + offset = 6; + break; + case 2: + offset = 8; + break; + case 3: + offset = 3; + break; + case 4: + offset = 5; + break; + default: + gregorio_messagef("gregoriotex_clef_flat_height", VERBOSITY_ERROR, + 0, _("unknown line number: %d"), line); + break; + } + break; + default: + gregorio_messagef("gregoriotex_clef_flat_height", VERBOSITY_ERROR, 0, + _("unknown clef type: %d"), step); + break; + } + + return pitch_value(LOWEST_PITCH + offset); +} + +OFFSET_CASE(BarStandard); +OFFSET_CASE(BarVirgula); +OFFSET_CASE(BarDivisioFinalis); + +static void gregoriotex_write_bar(FILE *f, gregorio_bar type, + gregorio_sign signs, bool is_inside_bar) +{ + /* the type number of function vepisemaorrare */ + const char *offset_case = BarStandard; + if (is_inside_bar) { + fprintf(f, "\\GreIn"); + } else { + fprintf(f, "\\Gre"); + } + switch (type) { + case B_VIRGULA: + fprintf(f, "Virgula"); + offset_case = BarVirgula; + break; + case B_DIVISIO_MINIMA: + fprintf(f, "DivisioMinima"); + break; + case B_DIVISIO_MINOR: + fprintf(f, "DivisioMinor"); + break; + case B_DIVISIO_MAIOR: + fprintf(f, "DivisioMaior"); + break; + case B_DIVISIO_FINALIS: + fprintf(f, "DivisioFinalis"); + offset_case = BarDivisioFinalis; + break; + case B_DIVISIO_MINOR_D1: + fprintf(f, "Dominica{1}"); + break; + case B_DIVISIO_MINOR_D2: + fprintf(f, "Dominica{2}"); + break; + case B_DIVISIO_MINOR_D3: + fprintf(f, "Dominica{3}"); + break; + case B_DIVISIO_MINOR_D4: + fprintf(f, "Dominica{4}"); + break; + case B_DIVISIO_MINOR_D5: + fprintf(f, "Dominica{5}"); + break; + case B_DIVISIO_MINOR_D6: + fprintf(f, "Dominica{6}"); + break; + default: + gregorio_messagef("gregoriotex_write_bar", VERBOSITY_ERROR, 0, + _("unknown bar type: %d"), type); + break; + } + switch (signs) { + case _V_EPISEMA: + fprintf(f, "{\\GreBarVEpisema{\\GreOCase%s}}%%\n", offset_case); + break; + case _BAR_H_EPISEMA: + fprintf(f, "{\\GreBarBrace{\\GreOCase%s}}%%\n", offset_case); + break; + case _V_EPISEMA_BAR_H_EPISEMA: + fprintf(f, "{\\GreBarBrace{\\GreOCase%s}" + "\\GreBarVEpisema{\\GreOCase%s}}%%\n", + offset_case, offset_case); + break; + default: + fprintf(f, "{}%%\n"); + break; + } +} + +/* + * ! @brief Writes augmentum duplexes (double dots) We suppose we are on the + * last note. \n The algorithm is the following: if there is a previous note, + * we consider that the two puncta of the augumentum duplex must correspond to + * the last note and the previous note. If we are adding to a single note + * glyph, which would be weird but sure why not, we just typeset two puncta + * spaced of 2. + */ +static void gregoriotex_write_auctum_duplex(FILE *f, + gregorio_note *current_note) +{ + char pitch = current_note->u.note.pitch; + char previous_pitch = 0; + /* second_pitch is the second argument of the \augmentumduplex macro, + * that's what this function is all about. */ + char second_pitch = 0; + /* this variable will be set to 1 if we are on the note before the last + * note of a podatus or a porrectus or a torculus resupinus */ + unsigned char special_punctum = 0; + if (current_note->previous) { + if (current_note->previous->u.note.pitch - current_note->u.note.pitch == + -1 + || current_note->previous->u.note.pitch - + current_note->u.note.pitch == 1) { + special_punctum = 1; + } + second_pitch = current_note->previous->u.note.pitch; + previous_pitch = second_pitch; + } + + if (!previous_pitch || previous_pitch == pitch) { + if (is_on_a_line(pitch)) { + second_pitch = pitch; + special_punctum = 1; + } else { + second_pitch = pitch + 1; + } + } + /* the first argument should always be the lowest one, that's what we do + * here: */ + if (pitch > second_pitch) { + previous_pitch = pitch; + pitch = second_pitch; + second_pitch = previous_pitch; + } + /* maybe the third argument should be changed */ + fprintf(f, "\\GreAugmentumDuplex{%d}{%d}{%d}%%\n", pitch_value(pitch), + pitch_value(second_pitch), special_punctum); +} + +/** + * @brief Adds a dot. + * + * Writes \c \\GrePunctumMora in the gtex file, with the appropriate arguments. You might think this function + * more straightforward than it actually is... + */ +static void gregoriotex_write_punctum_mora(FILE *f, gregorio_glyph *glyph, + gregorio_note *current_note) +{ + /* in this if we consider that the puncta are only on the last two notes + * (maybe it would be useful to consider it more entirely, but it would be + * really weird...) */ + /* the variable that will be set to true if we have to shift the punctum + * inclinatum before the last note */ + bool shift_before = false; + /* this variable will be set to 1 if we are on the note before the last + * note of a podatus or a porrectus or a torculus resupinus */ + unsigned char special_punctum = 0; + /* 0 if space is normal, 1 if there should be no space after a punctum */ + unsigned char no_space = 0; + /* the pitch where to set the punctum */ + char pitch = current_note->u.note.pitch; + /* a variable to know if we are on a punctum inclinatum or not */ + unsigned char punctum_inclinatum = 0; + /* a temp variable */ + gregorio_note *tmpnote; + /* we go into this switch only if it is the note before the last note */ + if (current_note->next) { + switch (glyph->u.notes.glyph_type) { + case G_FLEXA: + case G_TORCULUS: + case G_TORCULUS_RESUPINUS_FLEXUS: + case G_PORRECTUS_FLEXUS: + if (glyph->u.notes.liquescentia != L_DEMINUTUS + && glyph->u.notes.liquescentia != + L_DEMINUTUS_INITIO_DEBILIS) { + shift_before = true; + } + if (is_between_lines(pitch) + && pitch - current_note->next->u.note.pitch == 1) { + special_punctum = 2; + } + break; + case G_PODATUS: + if ((current_note->u.note.shape != S_PUNCTUM + && current_note->u.note.shape != S_QUILISMA) + || glyph->u.notes.liquescentia == L_AUCTUS_DESCENDENS + || glyph->u.notes.liquescentia == L_AUCTUS_ASCENDENS + || glyph->u.notes.liquescentia == + L_AUCTUS_ASCENDENS_INITIO_DEBILIS + || glyph->u.notes.liquescentia == + L_AUCTUS_DESCENDENS_INITIO_DEBILIS) { + shift_before = true; + /* fine tuning */ + if (current_note->next->u.note.pitch - + current_note->u.note.pitch == 1) { + if (is_on_a_line(current_note->u.note.pitch)) { + special_punctum = 1; + } else { + pitch = current_note->u.note.pitch - 1; + } + } + } else { + /* case for f.g */ + if (current_note->next->u.note.pitch - + current_note->u.note.pitch == 1) { + special_punctum = 1; + } + } + break; + case G_PES_QUADRATUM: + shift_before = true; + if (current_note->next->u.note.pitch - current_note->u.note.pitch == + 1) { + if (is_on_a_line(current_note->u.note.pitch)) { + special_punctum = 1; + } else { + pitch = current_note->u.note.pitch - 1; + } + } + break; + case G_PORRECTUS: + case G_TORCULUS_RESUPINUS: + /* this case is only for the note before the previous note */ + if ((current_note->next->u.note.pitch - + current_note->u.note.pitch == -1 + || current_note->next->u.note.pitch - + current_note->u.note.pitch == 1) + && !(current_note->next->next)) + special_punctum = 1; + break; + default: + break; + } + } + /* we enter here in any case */ + switch (glyph->u.notes.glyph_type) { + case G_TRIGONUS: + case G_PUNCTA_INCLINATA: + case G_2_PUNCTA_INCLINATA_DESCENDENS: + case G_3_PUNCTA_INCLINATA_DESCENDENS: + case G_4_PUNCTA_INCLINATA_DESCENDENS: + case G_5_PUNCTA_INCLINATA_DESCENDENS: + case G_TORCULUS: + if (!current_note->next) { + special_punctum = 1; + } + break; + default: + break; + } + if (current_note->u.note.shape == S_PUNCTUM_INCLINATUM) { + punctum_inclinatum = 1; + } + if (current_note->u.note.shape == S_PUNCTUM_INCLINATUM_DEMINUTUS) { + punctum_inclinatum = 1; + } + /* when the punctum mora is on a note on a line, and the prior note is on + * the space immediately above, the dot is placed on the space below the + * line instead */ + if (current_note->previous + && (current_note->previous->u.note.pitch - + current_note->u.note.pitch == 1) + && is_on_a_line(current_note->u.note.pitch) + && (current_note->previous->signs == _PUNCTUM_MORA + || current_note->previous->signs == _V_EPISEMA_PUNCTUM_MORA + || current_note->previous->choral_sign)) { + special_punctum = 1; + } + + if (current_note->mora_vposition) { + special_punctum = current_note->mora_vposition == VPOS_BELOW? 1 : 0; + } + + if (shift_before) { + if (current_note->next->u.note.pitch - current_note->u.note.pitch == -1 + || current_note->next->u.note.pitch - + current_note->u.note.pitch == 1) { + fprintf(f, "\\GrePunctumMora{%d}{3}{%d}{%d}%%\n", + pitch_value(pitch), special_punctum, punctum_inclinatum); + } else { + fprintf(f, "\\GrePunctumMora{%d}{2}{%d}{%d}%%\n", + pitch_value(pitch), special_punctum, punctum_inclinatum); + } + return; + } + /* There are two special cases. The first: if the next glyph is a + * ZERO_WIDTH_SPACE, and the current glyph is a PES, and the punctum mora + * is on the first note, and the first note of the next glyph is at least + * two (or three depending on something) pitches higher than the current + * note. + * You'll all have understood, this case is quite rare... but when it + * appears, we pass 1 as a second argument of \punctummora so that it + * removes the space introduced by the punctummora. */ + if (glyph->u.notes.glyph_type == G_PODATUS && glyph->next + && glyph->next->type == GRE_SPACE + && current_note->next && glyph->next->next + && glyph->next->next->type == GRE_GLYPH + && glyph->next->next->u.notes.first_note + && (glyph->next->next->u.notes.first_note->u.note.pitch - + current_note->u.note.pitch > 1)) { + fprintf(f, "\\GrePunctumMora{%d}{1}{%d}{%d}%%\n", pitch_value(pitch), + special_punctum, punctum_inclinatum); + return; + } + /* if there is a punctum or a auctum dumplex on a note after, we put a + * zero-width punctum */ + tmpnote = current_note->next; + while (tmpnote) { + if (tmpnote->signs == _PUNCTUM_MORA || tmpnote->signs == _AUCTUM_DUPLEX + || tmpnote->signs == _V_EPISEMA_PUNCTUM_MORA + || tmpnote->signs == _V_EPISEMA_AUCTUM_DUPLEX + || tmpnote->choral_sign) { + no_space = 1; + break; + } + tmpnote = tmpnote->next; + } + + /* the normal operation */ + fprintf(f, "\\GrePunctumMora{%d}{%d}{%d}{%d}%%\n", pitch_value(pitch), + no_space, special_punctum, punctum_inclinatum); +} + +static __inline int get_punctum_inclinatum_space_case( + const gregorio_note *const note) +{ + char temp; + + switch (note->u.note.shape) { + case S_PUNCTUM_INCLINATUM: + case S_PUNCTUM_CAVUM_INCLINATUM: + if (note->previous) { + /* means that it is the first note of the puncta inclinata + * sequence */ + temp = note->previous->u.note.pitch - note->u.note.pitch; + /* if (temp < -1 || temp > 1) */ + switch (temp) { + /* we switch on the range of the inclinata this will look + * somewhat strange if temp is negative... to be aligned + * then, */ + case -2: + case 2: + return 10; + case -3: + case 3: + return 11; + case -4: + case 4: + /* not sure we ever need to consider a larger ambitus here */ + return 11; + default: + return 3; + break; + } + } + break; + case S_PUNCTUM_INCLINATUM_DEMINUTUS: + if (note->previous) { + /* means that it is the first note of the puncta inclinata + * sequence */ + temp = note->previous->u.note.pitch - note->u.note.pitch; + if (temp < -2 || temp > 2) { + return 11; + } else { + if (note->previous + && note->previous->u.note.shape == + S_PUNCTUM_INCLINATUM_DEMINUTUS) { + if (temp < -1 || temp > 1) { + /* really if the ambitus = 3rd at this point */ + return 10; + } else { + return 8; + } + } else { + /* puncta inclinatum followed by puncta inclinatum + * debilis */ + return 7; + } + } + } + break; + case S_PUNCTUM_INCLINATUM_AUCTUS: + case S_PUNCTUM_CAVUM_INCLINATUM_AUCTUS: + if (note->previous) { + /* means that it is the first note of the puncta inclinata + * sequence */ + temp = note->previous->u.note.pitch - note->u.note.pitch; + if (temp < -1 || temp > 1) { + return 1; + } else { + /* we approximate that it is the same space */ + return 3; + } + } + break; + default: + break; + } + + return -1; +} + +static __inline void write_single_hepisema(FILE *const f, int hepisema_case, + const gregorio_note *const note, bool connect, char height, + const grehepisema_size size, const int i, + const gregorio_glyph *const glyph, + const int porrectus_long_episema_index, + bool (*const is_episema_shown)(const gregorio_note *)) +{ + char ambitus = 0; + char size_arg; + + if (height) { + switch (size) { + case H_SMALL_LEFT: + size_arg = 'l'; + connect = false; + break; + case H_SMALL_CENTRE: + size_arg = 'c'; + connect = false; + break; + case H_SMALL_RIGHT: + size_arg = 'r'; + break; + default: + size_arg = 'f'; + break; + } + + if (i == porrectus_long_episema_index && note->next + && is_episema_shown(note->next)) { + ambitus = compute_ambitus(note); + } + + if (i - 1 != porrectus_long_episema_index || !note->previous + || !is_episema_shown(note->previous)) { + if (connect) { + if (!note->next && (!glyph->next + || glyph->next->type != GRE_SPACE + || glyph->next->u.misc.unpitched.info.space + != SP_ZERO_WIDTH)) { + /* not followed by a zero-width space */ + fprintf(f, "\\GreHEpisemaBridge{%d}{%d}{-1}%%\n", + pitch_value(height), hepisema_case); + } else if (note->next + && (note->next->u.note.shape == S_PUNCTUM_INCLINATUM + || note->next->u.note.shape + == S_PUNCTUM_INCLINATUM_DEMINUTUS + || note->next->u.note.shape + == S_PUNCTUM_INCLINATUM_AUCTUS)) { + /* is a punctum inclinatum of some sort */ + fprintf(f, "\\GreHEpisemaBridge{%d}{%d}{%d}%%\n", + pitch_value(height), hepisema_case, + get_punctum_inclinatum_space_case(note->next)); + } + } + fprintf(f, "\\GreHEpisema{%d}{\\GreOCase%s}{%d}{%d}{%c}{%d}%%\n", + pitch_value(height), note->gtex_offset_case, ambitus, + hepisema_case, size_arg, pitch_value(height)); + } + } +} + +/** + * @brief A function that writes the good \c \\hepisema in GregorioTeX. + * @param i The position of the note in the glyph. + */ +static void gregoriotex_write_hepisema(FILE *const f, + const gregorio_note *const note, const int i, const gtex_type type, + const gregorio_glyph *const glyph) +{ + int porrectus_long_episema_index = -1; + + if (!note) { + return; + } + + switch (type) { + case T_PORRECTUS: + case T_PORRECTUS_FLEXUS: + porrectus_long_episema_index = 1; + break; + case T_TORCULUS_RESUPINUS: + case T_TORCULUS_RESUPINUS_FLEXUS: + porrectus_long_episema_index = 2; + break; + default: + /* do nothing */ + break; + } + + write_single_hepisema(f, 1, note, note->h_episema_below_connect, + note->h_episema_below, note->h_episema_below_size, i, glyph, + porrectus_long_episema_index, >ex_is_h_episema_below_shown); + write_single_hepisema(f, 0, note, note->h_episema_above_connect, + note->h_episema_above, note->h_episema_above_size, i, glyph, + porrectus_long_episema_index, >ex_is_h_episema_above_shown); +} + +/* a macro to write an additional line */ + +static void gregoriotex_write_additional_line(FILE *f, + int i, gtex_type type, bool bottom, + gregorio_note *current_note) +{ + char ambitus = 0; + if (!current_note) { + gregorio_message(_("called with no note"), + "gregoriotex_write_additional_line", VERBOSITY_ERROR, 0); + return; + } + /* patch to get a line under the full glyph in the case of dbc (for + * example) */ + switch (type) { + case T_PORRECTUS: + case T_PORRECTUS_FLEXUS: + if (i == 1) { + i = HEPISEMA_FIRST_TWO; + } + if (i == 2) { + if (current_note->previous->u.note.pitch >= PITCH_BELOW_STAFF + && current_note->previous->u.note.pitch + <= PITCH_ABOVE_STAFF) { + i = HEPISEMA_FIRST_TWO; + /* HEPISEMA_FIRST_TWO works only for first note */ + current_note = current_note->previous; + } else { + return; + } + } + if (i == 3) { + if (bottom || current_note->previous->u.note.pitch + > PITCH_ABOVE_STAFF) { + /* we don't need to add twice the same line */ + return; + } + } + break; + case T_TORCULUS_RESUPINUS: + case T_TORCULUS_RESUPINUS_FLEXUS: + if (i == 2) { + i = HEPISEMA_FIRST_TWO; + } + if (i == 3) { + if (current_note->previous->u.note.pitch >= PITCH_BELOW_STAFF + && current_note->previous->u.note.pitch + <= PITCH_ABOVE_STAFF) { + i = HEPISEMA_FIRST_TWO; + /* HEPISEMA_FIRST_TWO works only for first note */ + current_note = current_note->previous; + } else { + return; + } + } + if (i == 4) { + if (bottom || current_note->previous->u.note.pitch + > PITCH_ABOVE_STAFF) { + /* we don't need to add twice the same line */ + return; + } + } + break; + default: + break; + } + + if (i == HEPISEMA_FIRST_TWO) { + /* here we must compare the first note of the big bar with the second + * one, but it may be tricky sometimes, because of the previous patch */ + if (current_note->previous && + current_note->previous->u.note.pitch > + current_note->u.note.pitch) { + ambitus = current_note->previous->u.note.pitch - + current_note->u.note.pitch; + } else { + ambitus = current_note->u.note.pitch - + current_note->next->u.note.pitch; + } + } + fprintf(f, "\\GreAdditionalLine{\\GreOCase%s}{%d}{%d}%%\n", + current_note->gtex_offset_case, ambitus, bottom ? 3 : 2); +} + +/* + * + * a function that writes the good value of \vepisema in GregorioTeX. i is the + * position of the note in the glyph + * + */ + +static void gregoriotex_write_vepisema(FILE *f, gregorio_note *note) +{ + fprintf(f, "\\GreVEpisema{%d}{\\GreOCase%s}%%\n", + pitch_value(note->v_episema_height), note->gtex_offset_case); +} + +/* + * a function that writes the rare signs in GregorioTeX. i is the position of + * the note in the glyph */ + +static void gregoriotex_write_rare(FILE *f, gregorio_note *current_note, + gregorio_sign rare) +{ + switch (rare) { + case _ACCENTUS: + fprintf(f, "\\GreAccentus{%d}{\\GreOCase%s}%%\n", + pitch_value(current_note->u.note.pitch), + current_note->gtex_offset_case); + break; + case _ACCENTUS_REVERSUS: + fprintf(f, "\\GreReversedAccentus{%d}{\\GreOCase%s}%%\n", + pitch_value(current_note->u.note.pitch), + current_note->gtex_offset_case); + break; + case _CIRCULUS: + fprintf(f, "\\GreCirculus{%d}{\\GreOCase%s}%%\n", + pitch_value(current_note->u.note.pitch), + current_note->gtex_offset_case); + break; + case _SEMI_CIRCULUS: + fprintf(f, "\\GreSemicirculus{%d}{\\GreOCase%s}%%\n", + pitch_value(current_note->u.note.pitch), + current_note->gtex_offset_case); + break; + case _SEMI_CIRCULUS_REVERSUS: + fprintf(f, "\\GreReversedSemicirculus{%d}{\\GreOCase%s}%%\n", + pitch_value(current_note->u.note.pitch), + current_note->gtex_offset_case); + break; + /* the cases of the bar signs are dealt in another function + * (write_bar) */ + default: + break; + } +} + +/* + * function used when the glyph is only one note long + */ + +static void gregoriotex_write_note(FILE *f, gregorio_note *note, + gregorio_glyph *glyph, gregorio_element *element, char next_note_pitch) +{ + unsigned int initial_shape = note->u.note.shape; + const char *shape; + int space_case; + /* type in the sense of GregorioTeX alignment type */ + gtex_alignment type = AT_ONE_NOTE; + if (!note) { + gregorio_message(_ + ("called with NULL pointer"), + "gregoriotex_write_note", VERBOSITY_ERROR, 0); + return; + } + if (note->u.note.shape == S_PUNCTUM + && note->u.note.liquescentia != L_NO_LIQUESCENTIA) { + switch (note->u.note.liquescentia) { + case L_AUCTUS_ASCENDENS: + note->u.note.shape = S_PUNCTUM_AUCTUS_ASCENDENS; + break; + case L_AUCTUS_DESCENDENS: + case L_AUCTA: + note->u.note.shape = S_PUNCTUM_AUCTUS_DESCENDENS; + break; + case L_DEMINUTUS: + case L_INITIO_DEBILIS: + note->u.note.shape = S_PUNCTUM_DEMINUTUS; + default: + break; + } + } + shape = gregoriotex_determine_note_glyph_name(note, glyph, element, &type); + note->u.note.shape = initial_shape; + /* special things for puncta inclinata */ + space_case = get_punctum_inclinatum_space_case(note); + if (space_case >= 0) { + fprintf(f, "\\GreEndOfGlyph{%d}%%\n", space_case); + } + + switch (note->u.note.shape) { + case S_PUNCTUM_CAVUM: + fprintf(f, "\\GrePunctumCavum{%d}{%d}{%d}", + pitch_value(note->u.note.pitch), pitch_value(next_note_pitch), + type); + break; + case S_PUNCTUM_CAVUM_INCLINATUM: + fprintf(f, "\\GrePunctumCavumInclinatum{%d}{%d}{%d}", + pitch_value(note->u.note.pitch), pitch_value(next_note_pitch), + type); + break; + case S_PUNCTUM_CAVUM_INCLINATUM_AUCTUS: + fprintf(f, "\\GrePunctumCavumInclinatumAuctus{%d}{%d}{%d}", + pitch_value(note->u.note.pitch), pitch_value(next_note_pitch), + type); + break; + case S_LINEA_PUNCTUM_CAVUM: + fprintf(f, "\\GreLineaPunctumCavum{%d}{%d}{%d}", + pitch_value(note->u.note.pitch), pitch_value(next_note_pitch), + type); + break; + case S_LINEA: + fprintf(f, "\\GreLinea{%d}{%d}{%d}", pitch_value(note->u.note.pitch), + pitch_value(next_note_pitch), type); + break; + default: + fprintf(f, "\\GreGlyph{\\GreCP%s}{%d}{%d}{%d}", shape, + pitch_value(note->u.note.pitch), pitch_value(next_note_pitch), + type); + break; + } +} + +static int gregoriotex_syllable_first_type(gregorio_syllable *syllable) +{ + int result = 0; + gtex_alignment type = AT_ONE_NOTE; + gtex_type gtype = T_ONE_NOTE; + /* alteration says if there is a flat or a natural first in the next + * syllable, see gregoriotex.tex for more details */ + int alteration = 0; + gregorio_glyph *glyph; + gregorio_element *element; + if (!syllable) { + gregorio_message(_("called with a NULL argument"), + "gregoriotex_syllable_first_type", VERBOSITY_ERROR, 0); + } + element = syllable->elements[0]; + while (element) { + if (element->type == GRE_BAR) { + switch (element->u.misc.unpitched.info.bar) { + case B_NO_BAR: + case B_VIRGULA: + result = 10; + break; + case B_DIVISIO_MINIMA: + case B_DIVISIO_MINOR: + case B_DIVISIO_MAIOR: + case B_DIVISIO_MINOR_D1: + case B_DIVISIO_MINOR_D2: + case B_DIVISIO_MINOR_D3: + case B_DIVISIO_MINOR_D4: + case B_DIVISIO_MINOR_D5: + case B_DIVISIO_MINOR_D6: + result = 11; + break; + case B_DIVISIO_FINALIS: + result = 12; + break; + default: + result = 0; + break; + } + return result; + } + if (element->type == GRE_ELEMENT && element->u.first_glyph) { + glyph = element->u.first_glyph; + while (glyph) { + if (alteration == 0) { + switch (glyph->type) { + case GRE_FLAT: + alteration = 20; + break; + case GRE_NATURAL: + alteration = 40; + break; + case GRE_SHARP: + alteration = 60; + break; + default: + /* do nothing */ + break; + } + } + if (glyph->type == GRE_GLYPH && glyph->u.notes.first_note) { + switch (glyph->u.notes.glyph_type) { + case G_TRIGONUS: + case G_PUNCTA_INCLINATA: + case G_2_PUNCTA_INCLINATA_DESCENDENS: + case G_3_PUNCTA_INCLINATA_DESCENDENS: + case G_4_PUNCTA_INCLINATA_DESCENDENS: + case G_5_PUNCTA_INCLINATA_DESCENDENS: + case G_2_PUNCTA_INCLINATA_ASCENDENS: + case G_3_PUNCTA_INCLINATA_ASCENDENS: + case G_4_PUNCTA_INCLINATA_ASCENDENS: + case G_5_PUNCTA_INCLINATA_ASCENDENS: + case G_PUNCTUM: + case G_STROPHA: + case G_VIRGA: + case G_VIRGA_REVERSA: + case G_STROPHA_AUCTA: + case G_DISTROPHA: + case G_DISTROPHA_AUCTA: + case G_TRISTROPHA: + case G_TRISTROPHA_AUCTA: + case G_BIVIRGA: + case G_TRIVIRGA: + gregoriotex_determine_note_glyph_name + (glyph->u.notes.first_note, glyph, element, + &type); + break; + default: + gregoriotex_determine_glyph_name(glyph, element, &type, + >ype); + break; + } + return type + alteration; + } + glyph = glyph->next; + } + } + element = element->next; + } + return 0; +} + +static __inline void write_low_choral_sign(FILE *const f, + const gregorio_note *const note, int special) +{ + fprintf(f, "\\GreLowChoralSign{%d}{%s%s%s}{%d}%%\n", + pitch_value(note->u.note.pitch), + note->choral_sign_is_nabc? "\\GreNABCChar{" : "", + note->choral_sign, note->choral_sign_is_nabc? "}" : "", special); +} + +static __inline void write_high_choral_sign(FILE *const f, + const gregorio_note *const note, int pitch_offset) +{ + fprintf(f, "\\GreHighChoralSign{%d}{%s%s%s}{\\GreOCase%s}%%\n", + pitch_value(note->u.note.pitch + pitch_offset), + note->choral_sign_is_nabc? "\\GreNABCChar{" : "", + note->choral_sign, note->choral_sign_is_nabc? "}" : "", + note->gtex_offset_case); +} + +static void gregoriotex_write_choral_sign(FILE *f, gregorio_glyph *glyph, + gregorio_note *current_note, bool low) +{ + bool kind_of_pes; + /* false in the normal case (sign above the note), true in the case of it's + * next to the note (same height as a punctum) */ + bool low_sign = choral_sign_here_is_low(glyph, current_note, &kind_of_pes); + + /* the low choral signs must be typeset after the punctum, whereas the high + * must be typeset before the h episema */ + if ((low_sign && !low) || (!low_sign && low)) { + return; + } + + if (low_sign) { + /* very approximative heuristic, some things may have to be adapted + * here... */ + if (is_on_a_line(current_note->u.note.pitch)) { + if (kind_of_pes && current_note->u.note.pitch - + current_note->next->u.note.pitch == -1) { + write_low_choral_sign(f, current_note, 1); + return; + } + if (current_note->previous + && (current_note->previous->signs == _PUNCTUM_MORA + || current_note->previous->signs == + _V_EPISEMA_PUNCTUM_MORA)) { + write_low_choral_sign(f, current_note, 1); + return; + } + } + + write_low_choral_sign(f, current_note, 0); + } else { + /* let's cheat a little */ + if (is_on_a_line(current_note->u.note.pitch)) { + write_high_choral_sign(f, current_note, 0); + } else { + write_high_choral_sign(f, current_note, 2); + } + } +} + +/* + * + * A function that write the signs of a glyph, which has the type type (T_*, + * not G_*, which is in the glyph->glyph_type), and (important), we start only + * at the note current_note. It is due to the way we call it : if type is + * T_ONE_NOTE, we just do the signs on current_note, not all. This is the case + * for example for the first note of the torculus resupinus, or the + * G_*_PUNCTA_INCLINATA. + * + */ + +/* small helper */ +static __inline bool _found(FILE *const f, const bool found) +{ + if (!found) { + fprintf (f, "%%\n");\ + return true; + } + return found; +} + +static void compute_height_extrema(const gregorio_glyph *const glyph, + const gregorio_note *note, signed char *const top_height, + signed char *const bottom_height) +{ + char height; + /* get the minima/maxima pitches */ + for (; note; note = note->next) { + if (note->h_episema_above) { + height = note->h_episema_above; + } else { + if (note->v_episema_height && note->v_episema_height + > note->u.note.pitch) { + height = note->v_episema_height; + } else { + height = note->u.note.pitch; + } + + if (note->choral_sign + && !choral_sign_here_is_low(glyph, note, NULL)) { + ++height; + } + } + if (*top_height == UNDETERMINED_HEIGHT || height > *top_height) { + *top_height = height; + } + + if (note->h_episema_below) { + height = note->h_episema_below; + } else if (note->v_episema_height && note->v_episema_height + < note->u.note.pitch) { + height = note->v_episema_height; + } else { + height = note->u.note.pitch; + } + if (*bottom_height == UNDETERMINED_HEIGHT || height < *bottom_height) { + *bottom_height = height; + } + } +} + +static __inline void fixup_height_extrema(signed char *const top_height, + signed char *const bottom_height) +{ + if (*top_height == UNDETERMINED_HEIGHT) { + *top_height = 9; /* 'g' */ + } + if (*bottom_height == UNDETERMINED_HEIGHT) { + *bottom_height = 9; /* 'g' */ + } +} + +static void gregoriotex_write_signs(FILE *f, gtex_type type, + gregorio_glyph *glyph, gregorio_note *note, + gregoriotex_status *const status) +{ + /* i is the number of the note for which we are typesetting the sign. */ + int i; + gregorio_note *current_note; + /* a dumb char */ + char block_hepisema = 0; + signed char high_pitch = UNDETERMINED_HEIGHT; + signed char low_pitch = UNDETERMINED_HEIGHT; + bool found = false; + compute_height_extrema(glyph, note, &high_pitch, &low_pitch); + fixup_height_extrema(&high_pitch, &low_pitch); + fprintf(f, "%%\n{%%\n\\GreGlyphHeights{%d}{%d}%%\n", + pitch_value(high_pitch), pitch_value(low_pitch)); + for (current_note = note, i = 1; current_note; + current_note = current_note->next, ++i) { + /* we start by the additional lines */ + if (current_note->u.note.pitch < PITCH_BELOW_STAFF) { + gregoriotex_write_additional_line(f, i, type, true, current_note); + status->bottom_line = 1; + } + if (current_note->u.note.pitch > PITCH_ABOVE_STAFF) { + gregoriotex_write_additional_line(f, i, type, false, current_note); + } + if (current_note->texverb) { + fprintf(f, "%% verbatim text at note level:\n%s%%\n" + "%% end of verbatim text\n", current_note->texverb); + } + if (type == T_ONE_NOTE) { + break; + } + } + fprintf(f, "}{"); + /* now a first loop for the choral signs, because high signs must be taken + * into account before any hepisema */ + for (current_note = note, i = 1; current_note; + current_note = current_note->next, ++i) { + if (current_note->choral_sign) { + found = _found(f, found); + gregoriotex_write_choral_sign(f, glyph, current_note, false); + } + if (type == T_ONE_NOTE) { + break; + } + } + /* a loop for rare signs, vertical episema, and horizontal episema */ + for (current_note = note, i = 1; current_note; + current_note = current_note->next, ++i) { + /* we continue with the hepisema */ + if (current_note->h_episema_above || current_note->h_episema_below) { + found = _found(f, found); + gregoriotex_write_hepisema(f, current_note, i, type, glyph); + } + /* write_rare also writes the vepisema */ + if (current_note->special_sign) { + found = _found(f, found); + gregoriotex_write_rare(f, current_note, current_note->special_sign); + } + if (current_note->signs != _NO_SIGN) { + found = _found(f, found); + } + switch (current_note->signs) { + case _V_EPISEMA: + case _V_EPISEMA_PUNCTUM_MORA: + case _V_EPISEMA_AUCTUM_DUPLEX: + gregoriotex_write_vepisema(f, current_note); + break; + default: + /* do nothing */ + break; + } + /* why is this if there?... */ + if (!current_note->special_sign) { + if (block_hepisema == 2) { + block_hepisema = 0; + } + if (block_hepisema == 1) { + block_hepisema = 2; + } + } + if (type == T_ONE_NOTE) { + break; + } + } + /* final loop for choral signs and punctum mora */ + for (current_note = note, i = 1; current_note; + current_note = current_note->next, ++i) { + switch (current_note->signs) { + case _PUNCTUM_MORA: + case _V_EPISEMA_PUNCTUM_MORA: + gregoriotex_write_punctum_mora(f, glyph, current_note); + break; + case _AUCTUM_DUPLEX: + case _V_EPISEMA_AUCTUM_DUPLEX: + gregoriotex_write_auctum_duplex(f, current_note); + break; + default: + break; + } + if (current_note->choral_sign) { + found = _found(f, found); + gregoriotex_write_choral_sign(f, glyph, current_note, true); + } + if (type == T_ONE_NOTE) { + break; + } + } + fprintf(f, "}{"); + if (status->point_and_click) { + fprintf(f, "%u:%u:%u", note->src_line, note->src_offset, + note->src_column + 1); + } + fprintf(f, "}%%\n"); +} + +static char *determine_leading_shape(gregorio_glyph *glyph) +{ + static char buf[BUFSIZE]; + int ambitus = compute_ambitus(glyph->u.notes.first_note); + const char *head, *head_liquescence; + + switch (glyph->u.notes.first_note->u.note.shape) { + case S_QUILISMA: + head = "Quilisma"; + break; + case S_ORISCUS: + case S_ORISCUS_SCAPUS: + head = "Oriscus"; + break; + default: + head = "Punctum"; + break; + } + + switch (glyph->u.notes.liquescentia) { + case L_INITIO_DEBILIS: + case L_DEMINUTUS_INITIO_DEBILIS: + case L_AUCTUS_ASCENDENS_INITIO_DEBILIS: + case L_AUCTUS_DESCENDENS_INITIO_DEBILIS: + case L_AUCTA_INITIO_DEBILIS: + head_liquescence = "InitioDebilis"; + break; + default: + head_liquescence = ""; + break; + } + + gregorio_snprintf(buf, BUFSIZE, "Leading%s%s%s", head, tex_ambitus[ambitus], + head_liquescence); + return buf; +} + +static void gregoriotex_write_glyph(FILE *f, gregorio_syllable *syllable, + gregorio_element *element, gregorio_glyph *glyph, + gregoriotex_status *const status) +{ + /* glyph number is the number of the glyph in the fonte, it is discussed in + * later comments + * type is the type of the glyph. Understand the type of the glyph for + * gregoriotex, for the alignement between text and notes. (AT_ONE_NOTE, + * etc.) */ + gtex_alignment type = 0; + /* the type of the glyph, in the sense of the shape (T_PES, etc.) */ + gtex_type gtype = 0; + char next_note_pitch = 0; + gregorio_note *current_note; + const char *leading_shape, *shape; + if (!glyph) { + gregorio_message(_("called with NULL pointer"), + "gregoriotex_write_glyph", VERBOSITY_ERROR, 0); + return; + } + if (glyph->type != GRE_GLYPH || !glyph->u.notes.first_note) { + gregorio_message(_("called with glyph without note"), + "gregoriotex_write_glyph", VERBOSITY_ERROR, 0); + return; + } + next_note_pitch = gregorio_determine_next_pitch(syllable, element, glyph); + current_note = glyph->u.notes.first_note; + /* first we check if it is really a unique glyph in gregoriotex... the + * glyphs that are not a unique glyph are : trigonus and pucta inclinata + * in general, and torculus resupinus and torculus resupinus flexus, so + * we first divide the glyph into real gregoriotex glyphs */ + switch (glyph->u.notes.glyph_type) { + case G_TRIGONUS: + case G_PUNCTA_INCLINATA: + case G_2_PUNCTA_INCLINATA_DESCENDENS: + case G_3_PUNCTA_INCLINATA_DESCENDENS: + case G_4_PUNCTA_INCLINATA_DESCENDENS: + case G_5_PUNCTA_INCLINATA_DESCENDENS: + case G_2_PUNCTA_INCLINATA_ASCENDENS: + case G_3_PUNCTA_INCLINATA_ASCENDENS: + case G_4_PUNCTA_INCLINATA_ASCENDENS: + case G_5_PUNCTA_INCLINATA_ASCENDENS: + while (current_note) { + gregoriotex_write_note(f, current_note, glyph, element, + next_note_pitch); + gregoriotex_write_signs(f, T_ONE_NOTE, glyph, current_note, status); + current_note = current_note->next; + } + break; + case G_SCANDICUS: + if (glyph->u.notes.liquescentia == L_DEMINUTUS + || glyph->u.notes.liquescentia == L_DEMINUTUS_INITIO_DEBILIS + || glyph->u.notes.liquescentia == L_NO_LIQUESCENTIA) { + shape = gregoriotex_determine_glyph_name(glyph, element, &type, + >ype); + fprintf(f, "\\GreGlyph{\\GreCP%s}{%d}{%d}{%d}", shape, + pitch_value(glyph->u.notes.first_note->u.note.pitch), + pitch_value(next_note_pitch), type); + gregoriotex_write_signs(f, gtype, glyph, glyph->u.notes.first_note, + status); + } else { + while (current_note) { + gregoriotex_write_note(f, current_note, glyph, element, + next_note_pitch); + gregoriotex_write_signs(f, T_ONE_NOTE, glyph, current_note, + status); + current_note = current_note->next; + } + } + break; + case G_ANCUS: + if (glyph->u.notes.liquescentia == L_DEMINUTUS + || glyph->u.notes.liquescentia == L_DEMINUTUS_INITIO_DEBILIS) { + shape = gregoriotex_determine_glyph_name(glyph, element, &type, + >ype); + fprintf(f, "\\GreGlyph{\\GreCP%s}{%d}{%d}{%d}", shape, + pitch_value(glyph->u.notes.first_note->u.note.pitch), + pitch_value(next_note_pitch), type); + gregoriotex_write_signs(f, gtype, glyph, glyph->u.notes.first_note, + status); + } else { + while (current_note) { + gregoriotex_write_note(f, current_note, glyph, element, + next_note_pitch); + gregoriotex_write_signs(f, T_ONE_NOTE, glyph, current_note, + status); + current_note = current_note->next; + } + } + break; + case G_TORCULUS_RESUPINUS_FLEXUS: + leading_shape = determine_leading_shape(glyph); + /* trick to have the good position for these glyphs */ + glyph->u.notes.glyph_type = G_PORRECTUS_FLEXUS_NO_BAR; + glyph->u.notes.first_note = current_note->next; + shape = gregoriotex_determine_glyph_name(glyph, element, &type, >ype); + fprintf(f, "\\GreGlyph{\\GreFuseTwo{\\GreCP%s}{\\GreCP%s}}{%d}{%d}{%d}", + leading_shape, shape, + pitch_value(glyph->u.notes.first_note->u.note.pitch), + pitch_value(next_note_pitch), type); + glyph->u.notes.first_note = current_note; + glyph->u.notes.glyph_type = G_TORCULUS_RESUPINUS_FLEXUS; + gregoriotex_write_signs(f, gtype, glyph, glyph->u.notes.first_note, + status); + break; + case G_BIVIRGA: + case G_TRIVIRGA: + while (current_note) { + gregoriotex_write_note(f, current_note, glyph, element, + next_note_pitch); + gregoriotex_write_signs(f, T_ONE_NOTE, glyph, current_note, status); + current_note = current_note->next; + if (current_note) { + fprintf(f, "\\GreEndOfGlyph{4}%%\n"); + } + } + break; + case G_TRISTROPHA: + case G_TRISTROPHA_AUCTA: + case G_DISTROPHA: + case G_DISTROPHA_AUCTA: + while (current_note) { + gregoriotex_write_note(f, current_note, glyph, element, + next_note_pitch); + gregoriotex_write_signs(f, T_ONE_NOTE, glyph, current_note, status); + current_note = current_note->next; + if (current_note) { + fprintf(f, "\\GreEndOfGlyph{5}%%\n"); + } + } + break; + case G_PUNCTUM: + if (glyph->u.notes.first_note->u.note.shape != S_ORISCUS + && glyph->u.notes.first_note->u.note.shape != S_ORISCUS_AUCTUS + && glyph->u.notes.first_note->u.note.shape != + S_ORISCUS_DEMINUTUS + && glyph->u.notes.first_note->u.note.shape != + S_ORISCUS_SCAPUS) { + switch (glyph->u.notes.liquescentia) { + case L_AUCTUS_ASCENDENS: + glyph->u.notes.first_note->u.note.shape = + S_PUNCTUM_AUCTUS_ASCENDENS; + break; + case L_AUCTUS_DESCENDENS: + case L_AUCTA: + glyph->u.notes.first_note->u.note.shape = + S_PUNCTUM_AUCTUS_DESCENDENS; + break; + case L_DEMINUTUS: + case L_INITIO_DEBILIS: + glyph->u.notes.first_note->u.note.shape = S_PUNCTUM_DEMINUTUS; + default: + break; + } + } + /* else fall into the next case */ + case G_PUNCTUM_INCLINATUM: + case G_VIRGA: + case G_VIRGA_REVERSA: + case G_STROPHA: + case G_STROPHA_AUCTA: + gregoriotex_write_note(f, glyph->u.notes.first_note, glyph, element, + next_note_pitch); + gregoriotex_write_signs(f, T_ONE_NOTE, glyph, current_note, status); + break; + default: + /* special case of the torculus resupinus which first note is not a + * punctum */ + if (glyph->u.notes.glyph_type == G_TORCULUS_RESUPINUS + && current_note->u.note.shape != S_PUNCTUM + && current_note->u.note.shape != S_QUILISMA) { + leading_shape = determine_leading_shape(glyph); + /* trick to have the good position for these glyphs */ + glyph->u.notes.glyph_type = G_PORRECTUS_NO_BAR; + glyph->u.notes.first_note = current_note->next; + shape = gregoriotex_determine_glyph_name(glyph, element, &type, + >ype); + fprintf(f, "\\GreGlyph{\\GreFuseTwo{\\GreCP%s}{\\GreCP%s}}" + "{%d}{%d}{%d}", leading_shape, shape, + pitch_value(glyph->u.notes.first_note->u.note.pitch), + pitch_value(next_note_pitch), type); + glyph->u.notes.first_note = current_note; + glyph->u.notes.glyph_type = G_TORCULUS_RESUPINUS; + gregoriotex_write_signs(f, gtype, glyph, glyph->u.notes.first_note, + status); + break; + } else { + shape = gregoriotex_determine_glyph_name(glyph, element, &type, + >ype); + fprintf(f, "\\GreGlyph{\\GreCP%s}{%d}{%d}{%d}", shape, + pitch_value(glyph->u.notes.first_note->u.note.pitch), + pitch_value(next_note_pitch), type); + gregoriotex_write_signs(f, gtype, glyph, glyph->u.notes.first_note, + status); + break; + } + } +} + +/* here we absolutely need to pass the syllable as an argument, because we + * will need the next note, that may be contained in the next syllable */ + +static void gregoriotex_write_element(FILE *f, gregorio_syllable *syllable, + gregorio_element *element, gregoriotex_status *status) +{ + if (element->type == GRE_ELEMENT) { + gregorio_glyph *glyph; + for (glyph = element->u.first_glyph; glyph; glyph = glyph->next) { + switch (glyph->type) { + case GRE_SPACE: + /* we assume here that it is a SP_ZERO_WIDTH, the only one a + * glyph can be */ + fprintf(f, "\\GreEndOfGlyph{1}%%\n"); + break; + + case GRE_TEXVERB_GLYPH: + if (glyph->texverb) { + fprintf(f, "%% verbatim text at glyph level:\n%s%%\n" + "%% end of verbatim text\n", glyph->texverb); + } + break; + + case GRE_FLAT: + fprintf(f, "\\GreFlat{%d}{0}%%\n", + pitch_value(glyph->u.misc.pitched.pitch)); + break; + + case GRE_NATURAL: + fprintf(f, "\\GreNatural{%d}{0}%%\n", + pitch_value(glyph->u.misc.pitched.pitch)); + break; + + case GRE_SHARP: + fprintf(f, "\\GreSharp{%d}{0}%%\n", + pitch_value(glyph->u.misc.pitched.pitch)); + break; + + default: + /* at this point glyph->type is GRE_GLYPH */ + assert(glyph->type == GRE_GLYPH); + gregoriotex_write_glyph(f, syllable, element, glyph, status); + if (glyph->next && glyph->next->type == GRE_GLYPH) { + if (is_puncta_inclinata(glyph->next->u.notes.glyph_type) + || glyph->next->u.notes.glyph_type == + G_PUNCTA_INCLINATA) { + fprintf(f, "\\GreEndOfGlyph{9}%%\n"); + } else { + fprintf(f, "\\GreEndOfGlyph{0}%%\n"); + } + } + break; + } + } + } +} + +static void write_fixed_text_styles(FILE *f, gregorio_character *syllable_text, + gregorio_character *next_syllable_text) +{ + if (syllable_text) { + gregoriotex_ignore_style = gregoriotex_fix_style(syllable_text); + if (gregoriotex_ignore_style) { + fprintf(f, "\\GreSetFixedTextFormat{%d}", + gregoriotex_internal_style_to_gregoriotex + (gregoriotex_ignore_style)); + } + } + if (next_syllable_text) { + gregoriotex_next_ignore_style = gregoriotex_fix_style( + next_syllable_text); + if (gregoriotex_next_ignore_style) { + fprintf(f, "\\GreSetFixedNextTextFormat{%d}", + gregoriotex_internal_style_to_gregoriotex + (gregoriotex_next_ignore_style)); + } + } +} + +static void gregoriotex_write_text(FILE *f, gregorio_character *text, + bool *first_syllable) +{ + bool skip_initial = first_syllable && *first_syllable; + if (text == NULL) { + fprintf(f, "{}{}{}{}{}"); + if (skip_initial) { + fprintf(f, "\\GreForceHyphen{}"); + } + return; + } + fprintf(f, "{"); + gregorio_write_text(skip_initial, text, f, + (>ex_write_verb), (>ex_print_char), (>ex_write_begin), + (>ex_write_end), (>ex_write_special_char)); + fprintf(f, "}{"); + gregorio_write_first_letter_alignment_text(skip_initial, text, f, + (>ex_write_verb), (>ex_print_char), (>ex_write_begin), + (>ex_write_end), (>ex_write_special_char)); + if (first_syllable) { + *first_syllable = false; + } + gregoriotex_ignore_style = gregoriotex_next_ignore_style; + gregoriotex_next_ignore_style = ST_NO_STYLE; + fprintf(f, "}"); + if (skip_initial) { + /* Check to see if we need to force a hyphen (empty first syllable) */ + for (; text; text = text->next_character) { + if (text->is_character) { + break; + } else if (text->cos.s.type == ST_T_BEGIN) { + if (text->cos.s.style == ST_VERBATIM || + text->cos.s.style == ST_SPECIAL_CHAR) { + break; + } else if (text->cos.s.style == ST_INITIAL) { + for (; text; text = text->next_character) { + if (!text->is_character && text->cos.s.type == ST_T_END + && text->cos.s.style == ST_INITIAL) { + break; + } + } + } + } + } + if (!text) { + fprintf(f, "\\GreForceHyphen{}"); + } + } +} + +/* + * Function printing the line clef change (only updating \localleftbox, not + * printing the key). Useful for \GreDiscretionary. + * TODO: I'm not sure about the third argument, but that's how it's called in + * \GreChangeClef. + */ +static void gregoriotex_print_change_line_clef(FILE *f, + gregorio_element *current_element) +{ + if (current_element->type == GRE_C_KEY_CHANGE) { + if (current_element->u.misc.pitched.flatted_key) { + fprintf(f, "\\GreSetLinesClef{c}{%d}{1}{%d}%%\n", + current_element->u.misc.pitched.pitch - '0', + gregoriotex_clef_flat_height('c', + current_element->u.misc.pitched.pitch - '0')); + } else { + fprintf(f, "\\GreSetLinesClef{c}{%d}{1}{%d}%%\n", + current_element->u.misc.pitched.pitch - '0', NO_KEY_FLAT); + } + } + if (current_element->type == GRE_F_KEY_CHANGE) { + if (current_element->u.misc.pitched.flatted_key) { + /* the third argument is 0 or 1 according to the need for a + * space before the clef */ + fprintf(f, "\\GreSetLinesClef{f}{%d}{1}{%d}%%\n", + current_element->u.misc.pitched.pitch - '0', + gregoriotex_clef_flat_height('f', + current_element->u.misc.pitched.pitch - '0')); + } else { + fprintf(f, "\\GreSetLinesClef{f}{%d}{1}{%d}%%\n", + current_element->u.misc.pitched.pitch - '0', NO_KEY_FLAT); + } + } +} + +static void handle_final_bar(FILE *f, const 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 (element = (*syllable->elements)->next; element; + element = element->next) { + switch (element->type) { + case GRE_TEXVERB_ELEMENT: + if (element->texverb) { + fprintf(f, "%% verbatim text at element level:\n%s%%\n" + "%% end of verbatim text\n", element->texverb); + } + break; + + case GRE_CUSTOS: + assert(element->u.misc.pitched.force_pitch); + fprintf(f, "\\GreFinalCustos{%d}%%\n", + pitch_value(element->u.misc.pitched.pitch)); + break; + + default: + /* do nothing */ + break; + } + } + fprintf(f, "}%%\n"); +} + +static __inline bool is_manual_custos(const gregorio_element *element) +{ + return element->type == GRE_ELEMENT + && element->u.first_glyph + && element->u.first_glyph->type == GRE_MANUAL_CUSTOS; +} + +static __inline bool next_is_bar(const gregorio_syllable *syllable, + const gregorio_element *element) +{ + bool got_custos = false; + if (element) { + element = element->next; + } + + while (syllable) { + if (element) { + if (element->type == GRE_BAR) { + return true; + } + /* allow no more than one manual custos before a bar */ + if (got_custos || !is_manual_custos(element)) { + return false; + } + got_custos = true; + if (element->next) { + /* look at the next element */ + element = element->next; + continue; + } + } + + syllable = syllable->next_syllable; + if (!syllable) { + return false; + } + if (syllable->type == GRE_BAR) { + return true; + } + if (syllable->type != GRE_SYLLABLE) { + return false; + } + + /* the next syllable is a GRE_SYLLABLE; so look at the element */ + element = syllable->elements[0]; + } + + assert(false); /* should never reach here */ + return false; /* avoid gcc 5.1 warning */ +} + +static __inline void write_syllable_point_and_click(FILE *const f, + const gregorio_syllable *const syllable, + const gregoriotex_status *const status) +{ + if (status->point_and_click && syllable->src_line) { + fprintf(f, "%u:%u:%u", syllable->src_line, syllable->src_offset, + syllable->src_column + 1); + } +} + +/* + * Arguments are relatively obvious. The most obscure is certainly first_of_disc + * which is 0 all the time, except in the case of a "clef change syllable". In + * this case we make a \GreDiscretionary with two arguments: + * 1.what should be printed if the syllable is the last of its line (which + * basically means everything but clefs and custos), and + * 2. what should be printed if it's in a middle of a line (which means + * everything) + * So the first_of_disc argument is: + * 0 if we don't know (general case) + * 1 in case of the first argument of a \GreDiscretionary + * 2 if we are in the second argument (necessary in order to avoid infinite loops) + */ +static void gregoriotex_write_syllable(FILE *f, gregorio_syllable *syllable, + bool * first_syllable, unsigned char *line_number, + unsigned char first_of_disc, gregoriotex_status *const status) +{ + gregorio_element *clef_change_element = NULL, *element; + if (!syllable) { + return; + } + /* Very first: before anything, if the syllable is the beginning of a + * no-linebreak area: */ + if (syllable->no_linebreak_area == NLBA_BEGINNING) { + fprintf(f, "\\GreBeginNLBArea{1}{0}%%\n"); + } + if (syllable->euouae == EUOUAE_BEGINNING) { + fprintf(f, "\\GreBeginEUOUAE{}%%\n"); + } + /* + * first we check if the syllable is only a end of line. If it is the case, + * we don't print anything but a comment (to be able to read it if we read + * GregorioTeX). The end of lines are treated separately in GregorioTeX, it + * is buit inside the TeX structure. + */ + if (syllable->elements && *(syllable->elements)) { + if ((syllable->elements)[0]->type == GRE_END_OF_LINE) { + if ((syllable->elements)[0]->u.misc.unpitched.info.sub_type != + GRE_END_OF_PAR) { + fprintf(f, "%%\n%%\n\\GreNewLine %%\n%%\n%%\n"); + } else { + fprintf(f, "%%\n%%\n\\GreNewParLine %%\n%%\n%%\n"); + } + if (*line_number == 1) { + fprintf(f, "\\GreAdjustThirdLine %%\n"); + *line_number = 0; + } + return; + } + /* + * This case is not simple: if the syllable contains a clef change, + * whether it is (c4) or (::c4) or (z0::c4), we put it in a + * discretionary. Warning: only these three cases will have the expected + * effect. So first we detect it: + */ + if (first_of_disc == 0) { /* to avoid infinite loops */ + clef_change_element = gregoriotex_syllable_is_clef_change(syllable); + if (clef_change_element) { + /* + * In this case, the first thing to do is to change the line clef + */ + gregoriotex_print_change_line_clef(f, clef_change_element); + fprintf(f, "\\GreDiscretionary{0}{%%\n"); + gregoriotex_write_syllable(f, syllable, first_syllable, + line_number, 1, status); + fprintf(f, "}{%%\n"); + gregoriotex_write_syllable(f, syllable, first_syllable, + line_number, 2, status); + fprintf(f, "}%%\n"); + return; + } + } + write_fixed_text_styles(f, syllable->text, + syllable->next_syllable? syllable->next_syllable->text : NULL); + if ((syllable->elements)[0]->type == GRE_BAR) { + if (!syllable->next_syllable && !syllable->text + && (syllable->elements)[0]->u.misc.unpitched.info.bar == + B_DIVISIO_FINALIS) { + handle_final_bar(f, "DivisioFinalis", syllable); + return; + } + if (!syllable->next_syllable && !syllable->text + && (syllable->elements)[0]->u.misc.unpitched.info.bar == + B_DIVISIO_MAIOR) { + handle_final_bar(f, "DivisioMaior", syllable); + return; + } else { + fprintf(f, "\\GreBarSyllable"); + } + } else { + fprintf(f, "\\GreSyllable"); + } + } else { + write_fixed_text_styles(f, syllable->text, + syllable->next_syllable? syllable->next_syllable->text : NULL); + fprintf(f, "\\GreSyllable"); + } + fprintf(f, "{\\GreSetThisSyllable"); + gregoriotex_write_text(f, syllable->text, first_syllable); + fprintf(f, "}{}{\\Gre%s}", syllable->first_word ? "FirstWord" : "Unstyled"); + if (syllable->position == WORD_END + || syllable->position == WORD_ONE_SYLLABLE || !syllable->text + || !syllable->next_syllable + || syllable->next_syllable->type == GRE_END_OF_LINE + || syllable->next_syllable->type == GRE_END_OF_PAR) { + fprintf(f, "{1}"); + } else { + fprintf(f, "{0}"); + } + if (syllable->next_syllable) { + fprintf(f, "{\\GreSetNextSyllable"); + gregoriotex_write_text(f, syllable->next_syllable->text, NULL); + fprintf(f, "}{"); + write_syllable_point_and_click(f, syllable, status); + fprintf(f, "}{%d}{", + gregoriotex_syllable_first_type(syllable->next_syllable)); + } else { + fprintf(f, "{\\GreSetNextSyllable{}{}{}{}{}}{"); + write_syllable_point_and_click(f, syllable, status); + fprintf(f, "}{0}{"); + } + if (syllable->translation) { + if (syllable->translation_type == TR_WITH_CENTER_BEGINNING) { + fprintf(f, "%%\n\\GreWriteTranslationWithCenterBeginning{"); + } else { + fprintf(f, "%%\n\\GreWriteTranslation{"); + } + gregoriotex_write_translation(f, syllable->translation); + fprintf(f, "}%%\n"); + } + if (syllable->translation_type) { + if (syllable->translation_type == TR_WITH_CENTER_END) + fprintf(f, "%%\n\\GreTranslationCenterEnd %%\n"); + } + if (syllable->abovelinestext) { + fprintf(f, "%%\n\\GreSetTextAboveLines{%s}%%\n", + syllable->abovelinestext); + } + if (gregoriotex_is_last_of_line(syllable)) { + fprintf(f, "%%\n\\GreLastOfLine %%\n"); + } + if (!syllable->next_syllable) { + fprintf(f, "%%\n\\GreLastOfScore %%\n"); + } + fprintf(f, "}{%%\n"); + + for (element = *syllable->elements; element; + element = element->next) { + if (element->nabc_lines && element->nabc) { + size_t i; + for (i = 0; i < element->nabc_lines; i++) { + if (element->nabc[i]) { + fprintf(f, "\\GreNABCNeumes{%d}{%s}%%\n", (int)(i+1), + element->nabc[i]); + } + } + } + switch (element->type) { + case GRE_SPACE: + switch (element->u.misc.unpitched.info.space) { + case SP_ZERO_WIDTH: + fprintf(f, "\\GreEndOfElement{3}{1}%%\n"); + break; + case SP_LARGER_SPACE: + fprintf(f, "\\GreEndOfElement{1}{0}%%\n"); + break; + case SP_GLYPH_SPACE: + fprintf(f, "\\GreEndOfElement{2}{0}%%\n"); + break; + case SP_GLYPH_SPACE_NB: + fprintf(f, "\\GreEndOfElement{2}{1}%%\n"); + break; + case SP_LARGER_SPACE_NB: + fprintf(f, "\\GreEndOfElement{1}{1}%%\n"); + break; + case SP_NEUMATIC_CUT_NB: + fprintf(f, "\\GreEndOfElement{0}{1}%%\n"); + break; + default: + break; + } + break; + + case GRE_TEXVERB_ELEMENT: + if (element->texverb) { + fprintf(f, "%% verbatim text at element level:\n%s%%\n" + "%% end of verbatim text\n", element->texverb); + } + break; + + case GRE_NLBA: + if (element->u.misc.unpitched.info.nlba == NLBA_BEGINNING) { + fprintf(f, "\\GreBeginNLBArea{0}{0}%%\n"); + } else { + fprintf(f, "\\GreEndNLBArea{%d}{0}%%\n", + next_is_bar(syllable, element)? 3 : 0); + } + break; + + case GRE_ALT: + if (element->texverb) { + fprintf(f, "\\GreSetTextAboveLines{%s}%%\n", element->texverb); + } + break; + + case GRE_C_KEY_CHANGE: + if (first_of_disc != 1) { + /* + * We don't print clef changes at the end of a line + */ + if (element->previous && element->previous->type == GRE_BAR) { + if (element->u.misc.pitched.flatted_key) { + /* the third argument is 0 or 1 according to the need + * for a space before the clef */ + fprintf(f, "\\GreChangeClef{c}{%d}{0}{%d}%%\n", + element->u.misc.pitched.pitch - '0', + gregoriotex_clef_flat_height('c', + element->u.misc.pitched.pitch - '0')); + } else { + fprintf(f, "\\GreChangeClef{c}{%d}{0}{%d}%%\n", + element->u.misc.pitched.pitch - '0', + NO_KEY_FLAT); + } + } else { + if (element->u.misc.pitched.flatted_key) { + /* the third argument is 0 or 1 according to the need + * for a space before the clef */ + fprintf(f, "\\GreChangeClef{c}{%d}{1}{%d}%%\n", + element->u.misc.pitched.pitch - '0', + gregoriotex_clef_flat_height('c', + element->u.misc.pitched.pitch - '0')); + } else { + fprintf(f, "\\GreChangeClef{c}{%d}{1}{%d}%%\n", + element->u.misc.pitched.pitch - '0', + NO_KEY_FLAT); + } + } + } + break; + + case GRE_F_KEY_CHANGE: + if (first_of_disc != 1) { + /* + * We don't print clef changes at the end of a line + */ + if (element->previous && element->previous->type == GRE_BAR) { + if (element->u.misc.pitched.flatted_key) { + /* the third argument is 0 or 1 according to the need + * for a space before the clef */ + fprintf(f, "\\GreChangeClef{f}{%d}{0}{%d}%%\n", + element->u.misc.pitched.pitch - '0', + gregoriotex_clef_flat_height('f', + element->u.misc.pitched.pitch - '0')); + } else { + fprintf(f, "\\GreChangeClef{f}{%d}{0}{%d}%%\n", + element->u.misc.pitched.pitch - '0', + NO_KEY_FLAT); + } + } else { + if (element->u.misc.pitched.flatted_key) { + /* the third argument is 0 or 1 according to the need + * for a space before the clef */ + fprintf(f, "\\GreChangeClef{f}{%d}{1}{%d}%%\n", + element->u.misc.pitched.pitch - '0', + gregoriotex_clef_flat_height('f', + element->u.misc.pitched.pitch - '0')); + } else { + fprintf(f, "\\GreChangeClef{f}{%d}{1}{%d}%%\n", + element->u.misc.pitched.pitch - '0', + NO_KEY_FLAT); + } + } + } + break; + + case GRE_CUSTOS: + if (first_of_disc != 1) { + /* + * We don't print custos before a bar at the end of a line + */ + /* we also print an unbreakable larger space before the custo */ + fprintf(f, "\\GreEndOfElement{1}{1}%%\n\\GreCustos{%d}" + "\\GreNextCustos{%d}%%\n", + pitch_value(element->u.misc.pitched.pitch), + pitch_value(gregorio_determine_next_pitch(syllable, + element, NULL))); + } + break; + + case GRE_BAR: + gregoriotex_write_bar(f, + element->u.misc.unpitched.info.bar, + element->u.misc.unpitched.special_sign, + element->next && !is_manual_custos(element->next)); + break; + + case GRE_END_OF_LINE: + /* here we suppose we don't have two linebreaks in the same + * syllable */ + if (element->u.misc.unpitched.info.sub_type != GRE_END_OF_PAR) { + fprintf(f, "%%\n%%\n\\GreNewLine %%\n%%\n%%\n"); + } else { + fprintf(f, "%%\n%%\n\\GreNewParLine %%\n%%\n%%\n"); + } + if (*line_number == 1) { + fprintf(f, "\\GreAdjustThirdLine %%\n"); + *line_number = 0; + } + break; + + default: + /* there current_element->type is GRE_ELEMENT */ + assert(element->type == GRE_ELEMENT); + gregoriotex_write_element(f, syllable, element, status); + if (element->next && (element->next->type == GRE_ELEMENT + || (element->next->next + && element->next->type == GRE_ALT + && element->next->next->type == + GRE_ELEMENT))) { + fprintf(f, "\\GreEndOfElement{0}{0}%%\n"); + } + break; + } + } + fprintf(f, "}%%\n"); + if (syllable->position == WORD_END + || syllable->position == WORD_ONE_SYLLABLE || !syllable->text) { + fprintf(f, "%%\n"); + } + /* Very last, if the syllable is the end of a no-linebreak area: */ + if (syllable->no_linebreak_area == NLBA_END) { + fprintf(f, "\\GreEndNLBArea{%d}{0}%%\n", + next_is_bar(syllable, NULL)? 3 : 1); + } + if (syllable->euouae == EUOUAE_END) { + fprintf(f, "\\GreEndEUOUAE{%d}%%\n", + next_is_bar(syllable, NULL)? 3 : 1); + } +} + +static char *digest_to_hex(const unsigned char digest[SHA1_DIGEST_SIZE]) +{ + static const char *const hex = "0123456789abcdef"; + static char result[41]; + + char *p = result; + unsigned char byte; + + int i; + for (i = 0; i < SHA1_DIGEST_SIZE; ++i) { + byte = digest[i]; + + *(p++) = hex[(byte >> 4) & 0x0FU]; + *(p++) = hex[byte & 0x0FU]; + } + + *p = '\0'; + + return result; +} + +static void initialize_score(gregoriotex_status *const status, + gregorio_score *score, const bool point_and_click) +{ + gregorio_syllable *syllable; + + status->bottom_line = false; + status->top_height = status->bottom_height = UNDETERMINED_HEIGHT; + status->abovelinestext = status->translation = false; + + for (syllable = score->first_syllable; syllable; + syllable = syllable->next_syllable) { + int voice; + + if (syllable->translation) { + status->translation = true; + } + + if (syllable->abovelinestext) { + status->abovelinestext = true; + } + + for (voice = 0; voice < score->number_of_voices; ++voice) { + gregorio_element *element; + + gregoriotex_compute_positioning(syllable->elements[voice]); + for (element = syllable->elements[voice]; element; + element = element->next) { + gregorio_glyph *glyph; + + switch (element->type) { + case GRE_ALT: + status->abovelinestext = true; + break; + + case GRE_ELEMENT: + for (glyph = element->u.first_glyph; glyph; + glyph = glyph->next) { + if (glyph->type == GRE_GLYPH) { + compute_height_extrema(glyph, + glyph->u.notes.first_note, + &(status->top_height), + &(status->bottom_height)); + } + } + break; + + default: + /* to eliminate the warning */ + break; + } + } + } + } + + fixup_height_extrema(&(status->top_height), &(status->bottom_height)); + + status->point_and_click = point_and_click; +} + +void gregoriotex_write_score(FILE *const f, gregorio_score *const score, + const char *const point_and_click_filename) +{ + gregorio_character *first_text; + /* true if it is the first syllable and false if not. + * It is for the initial. */ + bool first_syllable = false; + char clef_letter; + int clef_line; + char clef_flat = NO_KEY_FLAT; + gregorio_syllable *current_syllable; + /* the current line (as far as we know), it is always 0, it can be 1 in the + * case of the first line of a score with a two lines initial */ + unsigned char line = 0; + int annotation_num; + gregoriotex_status status; + + initialize_score(&status, score, point_and_click_filename != NULL); + + if (!f) { + gregorio_message(_("call with NULL file"), "gregoriotex_write_score", + VERBOSITY_ERROR, 0); + return; + } + + if (score->number_of_voices != 1) { + gregorio_message(_("gregoriotex only works in monophony (for the " + "moment)"), "gregoriotex_write_score", VERBOSITY_ERROR, 0); + } + + fprintf(f, "%% File generated by gregorio %s\n", GREGORIO_VERSION); + fprintf(f, "\\GregorioTeXAPIVersion{%s}%%\n", VERSION); + + if (score->name) { + fprintf(f, "%% Name: %s\n", score->name); + } + if (score->si.author) { + fprintf(f, "%% Author: %s\n", score->si.author); + } + if (score->gabc_copyright) { + fprintf(f, "%% The copyright of this gabc is: %s\n", + score->gabc_copyright); + } + if (score->score_copyright) { + fprintf(f, "%% The copyright of the score is: %s\n", + score->score_copyright); + } + + fprintf(f, "\\GreBeginScore{%s}{%d}{%d}{%d}{%d}{%s}%%\n", + digest_to_hex(score->digest), status.top_height, + status.bottom_height, bool_to_int(status.translation), + bool_to_int(status.abovelinestext), + point_and_click_filename? point_and_click_filename : ""); + switch (score->centering) { + case SCHEME_SYLLABLE: + fprintf(f, "\\englishcentering%%\n"); + break; + case SCHEME_VOWEL: + fprintf(f, "\\defaultcentering%%\n"); + break; + default: + /* don't set any centering */ + break; + } + if (score->nabc_lines) { + fprintf(f, "\\GreScoreNABCLines{%d}", (int)score->nabc_lines); + } + /* we select the good font -- Deprecated (remove in next release) */ + if (score->gregoriotex_font) { + if (!strcmp(score->gregoriotex_font, "gregorio")) { + fprintf(f, "\\gresetgregoriofont{gregorio}%%\n"); + } + if (!strcmp(score->gregoriotex_font, "parmesan")) { + fprintf(f, "\\gresetgregoriofont{parmesan}%%\n"); + } + if (!strcmp(score->gregoriotex_font, "greciliae")) { + fprintf(f, "\\gresetgregoriofont{greciliae}%%\n"); + } + } + /* end Deprecated section */ + if (score->annotation[0]) { + fprintf(f, "\\GreAnnotationLines"); + for (annotation_num = 0; annotation_num < MAX_ANNOTATIONS; + ++annotation_num) { + if (score->annotation[annotation_num]) { + fprintf(f, "{%s}", + score->annotation[annotation_num]); + } + else { + fprintf(f, "{}"); + } + } + fprintf(f, "%%\n"); + } + if (score->mode != 0) { + fprintf(f, "\\GreMode{%d}%%\n", score->mode); + } + /* first we draw the initial (first letter) and the initial key */ + if (score->initial_style == NO_INITIAL) { + fprintf(f, "\\GreNoInitial %%\n"); + } else { + if (score->initial_style == BIG_INITIAL) { + fprintf(f, "\\GreSetBigInitial %%\n"); + line = 1; + } + first_text = gregorio_first_text(score); + if (first_text) { + fprintf(f, "\\GreSetInitial{"); + gregorio_write_initial(first_text, f, + (>ex_write_verb), + (>ex_print_char), + (>ex_write_begin), + (>ex_write_end), (>ex_write_special_char)); + fprintf(f, "}%%\n"); + first_syllable = true; + } + } + if (score->si.manuscript_reference) { + fprintf(f, "\\GreScoreReference{%s}%%\n", + score->si.manuscript_reference); + } + if (score->first_voice_info) { + gregoriotex_write_voice_info(f, score->first_voice_info); + } + fprintf(f, "\\GreBeginNotes %%\n"); + if (score->first_voice_info) { + gregorio_det_step_and_line_from_key(score-> + first_voice_info->initial_key, &clef_letter, &clef_line); + if (score->first_voice_info->flatted_key) { + clef_flat = gregoriotex_clef_flat_height(clef_letter, clef_line); + } else { + clef_flat = NO_KEY_FLAT; + } + } else { + clef_letter = 'c'; + clef_line = 3; + clef_flat = NO_KEY_FLAT; + } + fprintf(f, "\\GreSetInitialClef{%c}{%d}{%d}%%\n", clef_letter, clef_line, + clef_flat); + current_syllable = score->first_syllable; + while (current_syllable) { + gregoriotex_write_syllable(f, current_syllable, &first_syllable, &line, + 0, &status); + current_syllable = current_syllable->next_syllable; + } + fprintf(f, "\\GreEndScore %%\n\\endinput %%\n"); +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/gregoriotex/gregoriotex.h b/Build/source/texk/gregorio/gregorio-src/src/gregoriotex/gregoriotex.h new file mode 100644 index 00000000000..16cf41e8610 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/gregoriotex/gregoriotex.h @@ -0,0 +1,165 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header prototypes GregorioTeX writing data structures and entry points. + * + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef GREGORIOTEX_H +#define GREGORIOTEX_H + +#include "bool.h" + +#define OFFSET_CASE(name) static const char *const name = #name + +/* + * Here are the different types, they must be the same as in squarize.py + */ + +typedef enum gtex_type { + T_ONE_NOTE = 1, + /* two note neumes */ + T_PES, + T_PESQUADRATUM, + T_PESQUADRATUM_LONGQUEUE, + T_PESQUILISMA, + T_PESQUASSUS, + T_PESQUASSUS_LONGQUEUE, + T_PESQUILISMAQUADRATUM, + T_PESQUILISMAQUADRATUM_LONGQUEUE, + T_FLEXUS, + T_FLEXUS_LONGQUEUE, + T_FLEXUS_ORISCUS, + T_FLEXUS_ORISCUS_SCAPUS, + T_FLEXUS_ORISCUS_SCAPUS_LONGQUEUE, + T_VIRGA_STRATA, + /* three note neumes */ + T_PORRECTUS, + T_TORCULUS, + T_TORCULUS_QUILISMA, + T_SCANDICUS, /* only deminutus */ + T_ANCUS, /* only deminutus */ + T_ANCUS_LONGQUEUE, /* only deminutus */ + T_SALICUS, + T_SALICUS_LONGQUEUE, + /* four note neumes */ + T_PORRECTUS_FLEXUS, + T_TORCULUS_RESUPINUS, + T_TORCULUS_LIQUESCENS, + T_TORCULUS_RESUPINUS_FLEXUS +} gtex_type; + +/* the different types for the alignment of the notes in GregorioTeX + * these values are numbers coded into GregorioTeX */ +typedef enum gtex_alignment { + AT_ONE_NOTE = 0, + AT_FLEXUS = 1, + AT_PORRECTUS = 2, + AT_INITIO_DEBILIS = 3, + AT_QUILISMA = 4, + AT_ORISCUS = 5, + AT_PUNCTUM_INCLINATUM = 6, + AT_STROPHA = 7, + AT_FLEXUS_1 = 8, + AT_FLEXUS_DEMINUTUS = 9 +} gtex_alignment; + +/* Here we define a function that will determine the number of the + * liquescentia that we will add to the glyph number. There are several types + * as all glyphs can't have all liquescentiae. Let's first define the + * different types: */ + +typedef enum gtex_glyph_liquescentia { + /* for glyphs that accept all liquecentiae */ + LG_ALL = 0, + /* for glyphs that don't accept initio debilis */ + LG_NO_INITIO, + /* for glyphs for which we don't know if the auctus is ascendens or + * descendens */ + LG_UNDET_AUCTUS, + /* for glyphs that don't accept liquescentia */ + LG_NONE, + LG_ONLY_DEMINUTUS, + LG_NO_DEMINUTUS, + LG_ONLY_AUCTUS +} gtex_glyph_liquescentia; + +typedef enum gtex_sign_type { + ST_H_EPISEMA = 0, + ST_V_EPISEMA = 1 +} gtex_sign_type; + +#define HEPISEMA_FIRST_TWO 12 + +static __inline bool choral_sign_here_is_low(const gregorio_glyph *const glyph, + const gregorio_note *const note, bool *const kind_of_pes) +{ + if (kind_of_pes) { + *kind_of_pes = false; + } + + switch (glyph->u.notes.glyph_type) { + case G_FLEXA: + case G_TORCULUS: + case G_TORCULUS_LIQUESCENS: + case G_TORCULUS_RESUPINUS_FLEXUS: + case G_PORRECTUS_FLEXUS: + if (!note->next) { + return true; + } + break; + + case G_PODATUS: + case G_PORRECTUS: + case G_TORCULUS_RESUPINUS: + if (!note->next || note->next->next) { + break; + } + if (kind_of_pes) { + *kind_of_pes = true; + } + if (note->u.note.shape != S_QUILISMA) { + return true; + } + break; + + default: + break; + } + + return false; +} + +static __inline bool is_on_a_line(const char pitch) +{ + return pitch % 2 == 0; +} + +static __inline bool is_between_lines(const char pitch) +{ + return pitch % 2 == 1; +} + +bool gtex_is_h_episema_above_shown(const gregorio_note *const note); +bool gtex_is_h_episema_below_shown(const gregorio_note *const note); +const char *gregoriotex_determine_glyph_name(const gregorio_glyph *const glyph, + const gregorio_element *const element, gtex_alignment *const type, + gtex_type *const gtype); +void gregoriotex_compute_positioning(const gregorio_element *element); + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/messages.c b/Build/source/texk/gregorio/gregorio-src/src/messages.c new file mode 100644 index 00000000000..b67b5e0578f --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/messages.c @@ -0,0 +1,176 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file contains functions for logging messages, warnings, and errors. + * + * Copyright (C) 2009-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> /* for exit() */ +#include <stdarg.h> /* for exit() */ +#include "bool.h" +#include "messages.h" + +static FILE *error_out; +static const char *file_name = NULL; +static gregorio_verbosity verbosity_mode = 0; +static bool debug_messages = false; +static int return_value = 0; + +int gregorio_get_return_value(void) +{ + return return_value; +} + +void gregorio_set_error_out(FILE *const f) +{ + error_out = f; +} + +void gregorio_set_file_name(const char *const new_name) +{ + file_name = new_name; +} + +void gregorio_set_verbosity_mode(const gregorio_verbosity verbosity) +{ + verbosity_mode = verbosity; +} + +#if 0 /* unused */ +static void gregorio_set_debug_messages(bool debug) +{ + debug_messages = debug; +} +#endif + +static const char *verbosity_to_str(const gregorio_verbosity verbosity) +{ + const char *str; + switch (verbosity) { + case VERBOSITY_WARNING: + str = _("warning:"); + break; + case VERBOSITY_DEPRECATION: + str = _("deprecation:"); + break; + case VERBOSITY_ERROR: + str = _("error:"); + break; + case VERBOSITY_FATAL: + str = _("fatal error:"); + break; + default: + /* INFO, for example */ + str = " "; + break; + } + return str; +} + +void gregorio_messagef(const char *function_name, + gregorio_verbosity verbosity, int line_number, + const char *format, ...) +{ + va_list args; + const char *verbosity_str; + + if (!debug_messages) { + line_number = 0; + function_name = NULL; + } + + if (!error_out) { + fprintf(stderr, _("warning: error_out not set in gregorio_messages, " + "assumed stderr\n")); + error_out = stderr; + } + if (!verbosity_mode) { + fprintf(stderr, _("warning: verbosity mode not set in " + "gregorio_messages, assumed warnings\n")); + verbosity_mode = VERBOSITY_WARNING; + } + if (verbosity < verbosity_mode) { + return; + } + verbosity_str = verbosity_to_str(verbosity); + if (line_number) { + if (function_name) { + if (!file_name) { + fprintf(error_out, "line %d: in function `%s': %s", + line_number, function_name, verbosity_str); + } else { + fprintf(error_out, "%d: in function `%s': %s", line_number, + function_name, verbosity_str); + } + } else { + /* no function_name specified */ + if (!file_name) { + fprintf(error_out, "line %d: %s", line_number, verbosity_str); + } else { + fprintf(error_out, "%d: %s", line_number, verbosity_str); + } + } + } else { + if (function_name) { + /* + * if (!file_name) { + * fprintf (error_out, "in function `%s': %s", + * function_name, verbosity_str); + * return; + * } else { + */ + fprintf(error_out, "in function `%s': %s", function_name, + verbosity_str); + /* } */ + } else { + /* no function_name specified */ + /* + * if (!file_name) { + * fprintf (error_out, "%s", verbosity_str); + * return; + * } else { + */ + fprintf(error_out, "%s", verbosity_str); + /* } */ + } + } + va_start(args, format); + vfprintf(error_out, format, args); + va_end(args); + fprintf(error_out, "\n"); + + switch (verbosity) { + case VERBOSITY_ERROR: + return_value = 1; + break; + case VERBOSITY_FATAL: + exit(1); + break; + default: + break; + } +} + +void gregorio_message(const char *string, const char *function_name, + gregorio_verbosity verbosity, int line_number) +{ + gregorio_messagef(function_name, verbosity, line_number, "%s", string); +} + diff --git a/Build/source/texk/gregorio/gregorio-src/src/messages.h b/Build/source/texk/gregorio/gregorio-src/src/messages.h new file mode 100644 index 00000000000..19ad015847e --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/messages.h @@ -0,0 +1,59 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header prototypes the message logging functions. + * + * Copyright (C) 2009-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef MESSAGES_H +#define MESSAGES_H + +#ifndef ENABLE_NLS +#define ENABLE_NLS 0 +#endif +#if ENABLE_NLS == 1 +#include "gettext.h" +#define _(str) gettext(str) +#define N_(str) str +#define ngt_(str, strtwo, count) ngettext(str, strtwo, count) +#else +#define _(str) str +#define N_(str) str +#define ngt_(str, strtwo, count) str +#endif + +typedef enum gregorio_verbosity { + VERBOSITY_INFO = 1, + VERBOSITY_WARNING, + VERBOSITY_DEPRECATION, + VERBOSITY_ERROR, + VERBOSITY_FATAL +} gregorio_verbosity; + +void gregorio_message(const char *string, const char *function_name, + gregorio_verbosity verbosity, int line_number); +void gregorio_messagef(const char *function_name, + gregorio_verbosity verbosity, + int line_number, const char *format, ...) + __attribute__ ((__format__ (__printf__, 4, 5))); +void gregorio_set_verbosity_mode(gregorio_verbosity verbosity); +void gregorio_set_file_name(const char *new_name); +void gregorio_set_error_out(FILE *f); +int gregorio_get_return_value(void); + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/plugins.h b/Build/source/texk/gregorio/gregorio-src/src/plugins.h new file mode 100644 index 00000000000..e206269cc75 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/plugins.h @@ -0,0 +1,35 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header prototypes the "main" entry points for reading and writing data. + * + * Copyright (C) 2008-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef PLUGINS_H +#define PLUGINS_H + +void dump_write_score(FILE *f, gregorio_score *score); + +gregorio_score *gabc_read_score(FILE *f_in); + +void gabc_write_score(FILE *f, gregorio_score *score); + +void gregoriotex_write_score(FILE *f, gregorio_score *score, + const char *point_and_click_filename); + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/sha1.c b/Build/source/texk/gregorio/gregorio-src/src/sha1.c new file mode 100644 index 00000000000..64ab6bad55f --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/sha1.c @@ -0,0 +1,373 @@ +/* + * sha1.c - Functions to compute SHA1 message digest of files or + * memory blocks according to the NIST specification FIPS-180-1. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * Copyright (C) 2000-2001, 2003-2006, 2008-2014 Free Software Foundation, Inc. + * + * This file is part of Gregorio. + * This file has been adapted from GNU coreutils to fit Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +/* Written by Scott G. Miller + Credits: + Robert Klep <robert@ilse.nl> -- Expansion function fix +*/ + +#include "config.h" +#include "sha1.h" +#ifdef HAVE_STDINT_H +#include <stdint.h> +#else +#include <inttypes.h> +#endif +#include <stdlib.h> +#include <string.h> + +#ifdef HAVE_STDALIGN_H +#include <stdalign.h> +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wc11-extensions" +#endif +#else +#define alignof(x) sizeof(x) +#endif + +#ifdef WORDS_BIGENDIAN +#define SWAP(n) (n) +#else +#define SWAP(n) \ + (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) +#endif + +#define BLOCKSIZE 32768 +#if BLOCKSIZE % 64 != 0 +#error "invalid BLOCKSIZE" +#endif + +/* This array contains the bytes used to pad the buffer to the next + 64-byte boundary. (RFC 1321, 3.1: Step 1) */ +static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; + +/* Take a pointer to a 160 bit block of data (five 32 bit ints) and + initialize it to the start constants of the SHA1 algorithm. This + must be called before using hash in the call to sha1_hash. */ +void sha1_init_ctx(struct sha1_ctx *ctx) +{ + ctx->A = 0x67452301; + ctx->B = 0xefcdab89; + ctx->C = 0x98badcfe; + ctx->D = 0x10325476; + ctx->E = 0xc3d2e1f0; + + ctx->total[0] = ctx->total[1] = 0; + ctx->buflen = 0; +} + +/* Copy the 4 byte value from v into the memory location pointed to by *cp, + If your architecture allows unaligned access this is equivalent to + * (uint32_t *) cp = v */ +static void set_uint32(char *cp, uint32_t v) +{ + memcpy(cp, &v, sizeof v); +} + +/* Put result from CTX in first 20 bytes following RESBUF. The result + must be in little endian byte order. */ +void *sha1_read_ctx(const struct sha1_ctx *ctx, void *resbuf) +{ + char *r = resbuf; + set_uint32(r + 0 * sizeof ctx->A, SWAP(ctx->A)); + set_uint32(r + 1 * sizeof ctx->B, SWAP(ctx->B)); + set_uint32(r + 2 * sizeof ctx->C, SWAP(ctx->C)); + set_uint32(r + 3 * sizeof ctx->D, SWAP(ctx->D)); + set_uint32(r + 4 * sizeof ctx->E, SWAP(ctx->E)); + + return resbuf; +} + +/* Process the remaining bytes in the internal buffer and the usual + prolog according to the standard and write the result to RESBUF. */ +void *sha1_finish_ctx(struct sha1_ctx *ctx, void *resbuf) +{ + /* + * Take yet unprocessed bytes into account. + */ + uint32_t bytes = ctx->buflen; + size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4; + + /* + * Now count remaining bytes. + */ + ctx->total[0] += bytes; + if (ctx->total[0] < bytes) + ++ctx->total[1]; + + /* + * Put the 64-bit file length in *bits* at the end of the buffer. + */ + ctx->buffer[size - 2] = SWAP((ctx->total[1] << 3) | (ctx->total[0] >> 29)); + ctx->buffer[size - 1] = SWAP(ctx->total[0] << 3); + + memcpy(&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes); + + /* + * Process last bytes. + */ + sha1_process_block(ctx->buffer, size * 4, ctx); + + return sha1_read_ctx(ctx, resbuf); +} + +/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The + result is always in little endian byte order, so that a byte-wise + output yields to the wanted ASCII representation of the message + digest. */ +void *sha1_buffer(const char *buffer, size_t len, void *resblock) +{ + struct sha1_ctx ctx; + + /* + * Initialize the computation context. + */ + sha1_init_ctx(&ctx); + + /* + * Process whole buffer but last len % 64 bytes. + */ + sha1_process_bytes(buffer, len, &ctx); + + /* + * Put result in desired memory area. + */ + return sha1_finish_ctx(&ctx, resblock); +} + +void sha1_process_bytes(const void *buffer, size_t len, struct sha1_ctx *ctx) +{ + /* + * When we already have some bits in our internal buffer concatenate + * both inputs first. + */ + if (ctx->buflen != 0) { + size_t left_over = ctx->buflen; + size_t add = 128 - left_over > len ? len : 128 - left_over; + + memcpy(&((char *) ctx->buffer)[left_over], buffer, add); + ctx->buflen += add; + + if (ctx->buflen > 64) { + sha1_process_block(ctx->buffer, ctx->buflen & ~63, ctx); + + ctx->buflen &= 63; + /* + * The regions in the following copy operation cannot overlap. + */ + memcpy(ctx->buffer, + &((char *) ctx->buffer)[(left_over + add) & ~63], + ctx->buflen); + } + + buffer = (const char *) buffer + add; + len -= add; + } + + /* + * Process available complete blocks. + */ + if (len >= 64) { +#if !_STRING_ARCH_unaligned +#define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0) + if (UNALIGNED_P(buffer)) { + while (len > 64) { + sha1_process_block(memcpy(ctx->buffer, buffer, 64), 64, ctx); + buffer = (const char *) buffer + 64; + len -= 64; + } + } else +#endif + { + sha1_process_block(buffer, len & ~63, ctx); + buffer = (const char *) buffer + (len & ~63); + len &= 63; + } + } + + /* + * Move remaining bytes in internal buffer. + */ + if (len > 0) { + size_t left_over = ctx->buflen; + + memcpy(&((char *) ctx->buffer)[left_over], buffer, len); + left_over += len; + if (left_over >= 64) { + sha1_process_block(ctx->buffer, 64, ctx); + left_over -= 64; + memcpy(ctx->buffer, &ctx->buffer[16], left_over); + } + ctx->buflen = left_over; + } +} + +/* --- Code below is the primary difference between md5.c and sha1.c --- */ + +/* SHA1 round constants */ +#define K1 0x5a827999 +#define K2 0x6ed9eba1 +#define K3 0x8f1bbcdc +#define K4 0xca62c1d6 + +/* Round functions. Note that F2 is the same as F4. */ +#define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) ) +#define F2(B,C,D) (B ^ C ^ D) +#define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) ) +#define F4(B,C,D) (B ^ C ^ D) + +/* Process LEN bytes of BUFFER, accumulating context into CTX. + It is assumed that LEN % 64 == 0. + Most of this code comes from GnuPG's cipher/sha1.c. */ + +void sha1_process_block(const void *buffer, size_t len, struct sha1_ctx *ctx) +{ + const uint32_t *words = buffer; + size_t nwords = len / sizeof(uint32_t); + const uint32_t *endp = words + nwords; + uint32_t x[16]; + uint32_t a = ctx->A; + uint32_t b = ctx->B; + uint32_t c = ctx->C; + uint32_t d = ctx->D; + uint32_t e = ctx->E; + uint32_t lolen = len; + + /* + * First increment the byte count. RFC 1321 specifies the possible + * length of the file up to 2^64 bits. Here we only compute the + * number of bytes. Do a double word increment. + */ + ctx->total[0] += lolen; + ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen); + +#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n)))) + +#define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \ + ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \ + , (x[I&0x0f] = rol(tm, 1)) ) + +#define R(A,B,C,D,E,F,K,M) do { E += rol( A, 5 ) \ + + F( B, C, D ) \ + + K \ + + M; \ + B = rol( B, 30 ); \ + } while(0) + + while (words < endp) { + uint32_t tm; + int t; + for (t = 0; t < 16; t++) { + x[t] = SWAP(*words); + words++; + } + + R(a, b, c, d, e, F1, K1, x[0]); + R(e, a, b, c, d, F1, K1, x[1]); + R(d, e, a, b, c, F1, K1, x[2]); + R(c, d, e, a, b, F1, K1, x[3]); + R(b, c, d, e, a, F1, K1, x[4]); + R(a, b, c, d, e, F1, K1, x[5]); + R(e, a, b, c, d, F1, K1, x[6]); + R(d, e, a, b, c, F1, K1, x[7]); + R(c, d, e, a, b, F1, K1, x[8]); + R(b, c, d, e, a, F1, K1, x[9]); + R(a, b, c, d, e, F1, K1, x[10]); + R(e, a, b, c, d, F1, K1, x[11]); + R(d, e, a, b, c, F1, K1, x[12]); + R(c, d, e, a, b, F1, K1, x[13]); + R(b, c, d, e, a, F1, K1, x[14]); + R(a, b, c, d, e, F1, K1, x[15]); + R(e, a, b, c, d, F1, K1, M(16)); + R(d, e, a, b, c, F1, K1, M(17)); + R(c, d, e, a, b, F1, K1, M(18)); + R(b, c, d, e, a, F1, K1, M(19)); + R(a, b, c, d, e, F2, K2, M(20)); + R(e, a, b, c, d, F2, K2, M(21)); + R(d, e, a, b, c, F2, K2, M(22)); + R(c, d, e, a, b, F2, K2, M(23)); + R(b, c, d, e, a, F2, K2, M(24)); + R(a, b, c, d, e, F2, K2, M(25)); + R(e, a, b, c, d, F2, K2, M(26)); + R(d, e, a, b, c, F2, K2, M(27)); + R(c, d, e, a, b, F2, K2, M(28)); + R(b, c, d, e, a, F2, K2, M(29)); + R(a, b, c, d, e, F2, K2, M(30)); + R(e, a, b, c, d, F2, K2, M(31)); + R(d, e, a, b, c, F2, K2, M(32)); + R(c, d, e, a, b, F2, K2, M(33)); + R(b, c, d, e, a, F2, K2, M(34)); + R(a, b, c, d, e, F2, K2, M(35)); + R(e, a, b, c, d, F2, K2, M(36)); + R(d, e, a, b, c, F2, K2, M(37)); + R(c, d, e, a, b, F2, K2, M(38)); + R(b, c, d, e, a, F2, K2, M(39)); + R(a, b, c, d, e, F3, K3, M(40)); + R(e, a, b, c, d, F3, K3, M(41)); + R(d, e, a, b, c, F3, K3, M(42)); + R(c, d, e, a, b, F3, K3, M(43)); + R(b, c, d, e, a, F3, K3, M(44)); + R(a, b, c, d, e, F3, K3, M(45)); + R(e, a, b, c, d, F3, K3, M(46)); + R(d, e, a, b, c, F3, K3, M(47)); + R(c, d, e, a, b, F3, K3, M(48)); + R(b, c, d, e, a, F3, K3, M(49)); + R(a, b, c, d, e, F3, K3, M(50)); + R(e, a, b, c, d, F3, K3, M(51)); + R(d, e, a, b, c, F3, K3, M(52)); + R(c, d, e, a, b, F3, K3, M(53)); + R(b, c, d, e, a, F3, K3, M(54)); + R(a, b, c, d, e, F3, K3, M(55)); + R(e, a, b, c, d, F3, K3, M(56)); + R(d, e, a, b, c, F3, K3, M(57)); + R(c, d, e, a, b, F3, K3, M(58)); + R(b, c, d, e, a, F3, K3, M(59)); + R(a, b, c, d, e, F4, K4, M(60)); + R(e, a, b, c, d, F4, K4, M(61)); + R(d, e, a, b, c, F4, K4, M(62)); + R(c, d, e, a, b, F4, K4, M(63)); + R(b, c, d, e, a, F4, K4, M(64)); + R(a, b, c, d, e, F4, K4, M(65)); + R(e, a, b, c, d, F4, K4, M(66)); + R(d, e, a, b, c, F4, K4, M(67)); + R(c, d, e, a, b, F4, K4, M(68)); + R(b, c, d, e, a, F4, K4, M(69)); + R(a, b, c, d, e, F4, K4, M(70)); + R(e, a, b, c, d, F4, K4, M(71)); + R(d, e, a, b, c, F4, K4, M(72)); + R(c, d, e, a, b, F4, K4, M(73)); + R(b, c, d, e, a, F4, K4, M(74)); + R(a, b, c, d, e, F4, K4, M(75)); + R(e, a, b, c, d, F4, K4, M(76)); + R(d, e, a, b, c, F4, K4, M(77)); + R(c, d, e, a, b, F4, K4, M(78)); + R(b, c, d, e, a, F4, K4, M(79)); + + a = ctx->A += a; + b = ctx->B += b; + c = ctx->C += c; + d = ctx->D += d; + e = ctx->E += e; + } +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/sha1.h b/Build/source/texk/gregorio/gregorio-src/src/sha1.h new file mode 100644 index 00000000000..aa8ec20ed85 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/sha1.h @@ -0,0 +1,85 @@ +/* + * Declarations of functions and data types used for SHA1 sum + * library functions. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2014 Free Software + * Foundation, Inc. + * + * This file is part of Gregorio. + * This file has been adapted from GNU coreutils to fit Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SHA1_H +#define SHA1_H 1 + +#include <stddef.h> +#ifdef HAVE_STDINT_H +#include <stdint.h> +#else +#include <inttypes.h> +#endif + +#define SHA1_DIGEST_SIZE 20 + +/* Structure to save state of computation between the single steps. */ +struct sha1_ctx { + uint32_t A; + uint32_t B; + uint32_t C; + uint32_t D; + uint32_t E; + + uint32_t total[2]; + uint32_t buflen; + uint32_t buffer[32]; +}; + +/* Initialize structure containing state of computation. */ +extern void sha1_init_ctx(struct sha1_ctx *ctx); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is necessary that LEN is a multiple of 64!!! */ +extern void sha1_process_block(const void *buffer, size_t len, + struct sha1_ctx *ctx); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is NOT required that LEN is a multiple of 64. */ +extern void sha1_process_bytes(const void *buffer, size_t len, + struct sha1_ctx *ctx); + +/* Process the remaining bytes in the buffer and put result from CTX + in first 20 bytes following RESBUF. The result is always in little + endian byte order, so that a byte-wise output yields to the wanted + ASCII representation of the message digest. */ +extern void *sha1_finish_ctx(struct sha1_ctx *ctx, void *resbuf); + +/* Put result from CTX in first 20 bytes following RESBUF. The result is + always in little endian byte order, so that a byte-wise output yields + to the wanted ASCII representation of the message digest. */ +extern void *sha1_read_ctx(const struct sha1_ctx *ctx, void *resbuf); + +/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The + result is always in little endian byte order, so that a byte-wise + output yields to the wanted ASCII representation of the message + digest. */ +extern void *sha1_buffer(const char *buffer, size_t len, void *resblock); + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/struct.c b/Build/source/texk/gregorio/gregorio-src/src/struct.c new file mode 100644 index 00000000000..2130da6d45b --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/struct.c @@ -0,0 +1,1670 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the Gregorio data structures. + * + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +/** + * @file + * @brief This file contains a set of function to manipulate the gregorio + * structure. + * + * It starts by simple add/delete functions for almost all + * structs, and ends with more complex functions for manipulating + * horizontal episema, keys, etc. + * + * The first functions are not commented, but they always act like + * this : we give them a pointer to the pointer to the current element + * (by element I mean a struct which can be gregorio_note, + * gregorio_element, etc.), they add an element and the update the + * pointer to the element so that it points to the new element (may + * seem a bit strange). + * + * All the delete functions are recursive and free all memory. + * + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include "struct.h" +#include "unicode.h" +#include "messages.h" +#include "support.h" +#include "characters.h" + +static gregorio_note *create_and_link_note(gregorio_note **current_note, + const gregorio_scanner_location *const loc) +{ + gregorio_note *note = gregorio_calloc(1, sizeof(gregorio_note)); + note->previous = *current_note; + note->next = NULL; + if (*current_note) { + (*current_note)->next = note; + } + *current_note = note; + note->src_line = loc->first_line; + note->src_column = loc->first_column; + note->src_offset = loc->first_offset; + + return note; +} + +void gregorio_position_h_episema_above(gregorio_note *note, signed char height, + bool connect) +{ + assert(note && (note->type == GRE_NOTE || note->type == GRE_BAR)); + note->h_episema_above = height; + note->h_episema_above_connect = connect; +} + +static void set_h_episema_above(gregorio_note *note, signed char height, + grehepisema_size size, bool connect) +{ + gregorio_position_h_episema_above(note, height, connect); + note->h_episema_above_size = size; +} + +void gregorio_position_h_episema_below(gregorio_note *note, signed char height, + bool connect) +{ + assert(note && (note->type == GRE_NOTE || note->type == GRE_BAR)); + note->h_episema_below = height; + note->h_episema_below_connect = connect; +} + +static void set_h_episema_below(gregorio_note *note, signed char height, + grehepisema_size size, bool connect) +{ + gregorio_position_h_episema_below(note, height, connect); + note->h_episema_below_size = size; +} + +void gregorio_add_note(gregorio_note **current_note, signed char pitch, + gregorio_shape shape, gregorio_sign signs, + gregorio_liquescentia liquescentia, gregorio_note *prototype, + const gregorio_scanner_location *const loc) +{ + gregorio_note *element = create_and_link_note(current_note, loc); + if (element) { + element->type = GRE_NOTE; + element->u.note.pitch = pitch; + element->u.note.shape = shape; + element->signs = signs; + element->special_sign = _NO_SIGN; + element->u.note.liquescentia = liquescentia; + if (prototype) { + set_h_episema_above(element, prototype->h_episema_above, + prototype->h_episema_above_size, + prototype->h_episema_above_connect); + set_h_episema_below(element, prototype->h_episema_below, + prototype->h_episema_below_size, + prototype->h_episema_below_connect); + } + element->texverb = NULL; + element->choral_sign = NULL; + } +} + +static void add_pitched_item_as_note(gregorio_note **current_note, + gregorio_type type, signed char pitch, + const gregorio_scanner_location *const loc) +{ + gregorio_note *element = create_and_link_note(current_note, loc); + if (element) { + element->type = type; + element->u.note.pitch = pitch; + } +} + +void gregorio_add_end_of_line_as_note(gregorio_note **current_note, + gregorio_type sub_type, const gregorio_scanner_location *const loc) +{ + gregorio_note *element = create_and_link_note(current_note, loc); + if (element) { + element->type = GRE_END_OF_LINE; + element->u.other.sub_type = sub_type; + } +} + +void gregorio_add_custo_as_note(gregorio_note **current_note, + const gregorio_scanner_location *const loc) +{ + gregorio_note *element = create_and_link_note(current_note, loc); + if (element) { + element->type = GRE_CUSTOS; + } +} + +void gregorio_add_manual_custos_as_note(gregorio_note **current_note, + signed char pitch, const gregorio_scanner_location *const loc) +{ + add_pitched_item_as_note(current_note, GRE_MANUAL_CUSTOS, pitch, loc); +} + +void gregorio_add_clef_change_as_note(gregorio_note **current_note, + gregorio_type type, signed char clef_line, + const gregorio_scanner_location *const loc) +{ + assert(type == GRE_C_KEY_CHANGE || type == GRE_F_KEY_CHANGE + || type == GRE_C_KEY_CHANGE_FLATED + || type == GRE_F_KEY_CHANGE_FLATED); + add_pitched_item_as_note(current_note, type, clef_line, loc); +} + +void gregorio_add_bar_as_note(gregorio_note **current_note, gregorio_bar bar, + const gregorio_scanner_location *const loc) +{ + gregorio_note *element = create_and_link_note(current_note, loc); + if (element) { + element->type = GRE_BAR; + element->u.other.bar = bar; + } +} + +void gregorio_add_alteration_as_note(gregorio_note **current_note, + gregorio_type type, signed char pitch, + const gregorio_scanner_location *const loc) +{ + assert(type == GRE_FLAT || type == GRE_SHARP || type == GRE_NATURAL); + add_pitched_item_as_note(current_note, type, pitch, loc); +} + +void gregorio_add_space_as_note(gregorio_note **current_note, + gregorio_space space, const gregorio_scanner_location *const loc) +{ + gregorio_note *element = create_and_link_note(current_note, loc); + if (element) { + element->type = GRE_SPACE; + element->u.other.space = space; + } +} + +void gregorio_add_texverb_as_note(gregorio_note **current_note, char *str, + gregorio_type type, const gregorio_scanner_location *const loc) +{ + gregorio_note *element; + if (str == NULL) { + return; + } + element = create_and_link_note(current_note, loc); + assert(type == GRE_TEXVERB_GLYPH || type == GRE_TEXVERB_ELEMENT + || type == GRE_ALT); + if (element) { + element->type = type; + element->texverb = str; + } +} + +void gregorio_add_nlba_as_note(gregorio_note **current_note, gregorio_nlba type, + const gregorio_scanner_location *const loc) +{ + gregorio_note *element = create_and_link_note(current_note, loc); + if (element) { + element->type = GRE_NLBA; + element->u.other.nlba = type; + } +} + +void gregorio_add_texverb_to_note(gregorio_note **current_note, char *str) +{ + size_t len; + char *res; + if (str == NULL) { + return; + } + if (*current_note) { + if ((*current_note)->texverb) { + len = strlen((*current_note)->texverb) + strlen(str) + 1; + res = gregorio_malloc(len * sizeof(char)); + strcpy(res, (*current_note)->texverb); + strcat(res, str); + free((*current_note)->texverb); + free(str); + (*current_note)->texverb = res; + } else { + (*current_note)->texverb = str; + } + } +} + +void gregorio_add_cs_to_note(gregorio_note *const*const current_note, + char *const str, const bool nabc) +{ + if (*current_note) { + (*current_note)->choral_sign = str; + (*current_note)->choral_sign_is_nabc = nabc; + } +} + +void gregorio_add_special_sign(gregorio_note *note, gregorio_sign sign) +{ + if (!note) { + /* error */ + return; + } + note->special_sign = sign; +} + +static void fix_punctum_cavum_inclinatum_liquescentia(gregorio_note *const note) +{ + switch (note->u.note.liquescentia) { + case L_AUCTUS_ASCENDENS: + case L_AUCTUS_DESCENDENS: + case L_AUCTA: + case L_AUCTUS_ASCENDENS_INITIO_DEBILIS: + case L_AUCTUS_DESCENDENS_INITIO_DEBILIS: + note->u.note.liquescentia = L_AUCTA; + break; + default: + note->u.note.liquescentia = L_NO_LIQUESCENTIA; + break; + } +} + +void gregorio_change_shape(gregorio_note *note, gregorio_shape shape) +{ + if (!note || note->type != GRE_NOTE) { + gregorio_message(_("trying to change the shape of something that is " + "not a note"), "change_shape", VERBOSITY_ERROR, 0); + return; + } + switch (note->u.note.shape) { + case S_PUNCTUM_INCLINATUM: + if (shape == S_PUNCTUM_CAVUM) { + note->u.note.shape = S_PUNCTUM_CAVUM_INCLINATUM; + fix_punctum_cavum_inclinatum_liquescentia(note); + break; + } + /* else fall through */ + + default: + note->u.note.shape = shape; + switch (shape) { + case S_STROPHA: + case S_DISTROPHA: + case S_TRISTROPHA: + switch (note->u.note.liquescentia) { + case L_AUCTUS_ASCENDENS: + case L_AUCTUS_DESCENDENS: + note->u.note.liquescentia = L_AUCTA; + break; + case L_AUCTUS_ASCENDENS_INITIO_DEBILIS: + case L_AUCTUS_DESCENDENS_INITIO_DEBILIS: + note->u.note.liquescentia = L_AUCTA_INITIO_DEBILIS; + break; + default: + break; + } + break; + + case S_ORISCUS: + switch (note->u.note.liquescentia) { + case L_AUCTUS_ASCENDENS: + case L_AUCTUS_DESCENDENS: + case L_AUCTUS_ASCENDENS_INITIO_DEBILIS: + case L_AUCTUS_DESCENDENS_INITIO_DEBILIS: + note->u.note.shape = S_ORISCUS_AUCTUS; + break; + case L_DEMINUTUS: + case L_DEMINUTUS_INITIO_DEBILIS: + note->u.note.shape = S_ORISCUS_DEMINUTUS; + break; + default: + break; + } + break; + + default: + break; + } + break; + } +} + +void gregorio_add_liquescentia(gregorio_note *note, gregorio_liquescentia liq) +{ + if (!note || note->type != GRE_NOTE) { + gregorio_message(_("trying to make a liquescence on something that " + "is not a note"), "add_liquescentia", VERBOSITY_ERROR, 0); + return; + } + if (is_initio_debilis(liq)) { + switch (liq) { + case L_DEMINUTUS: + note->u.note.liquescentia = L_DEMINUTUS_INITIO_DEBILIS; + break; + case L_AUCTUS_ASCENDENS: + note->u.note.liquescentia = L_AUCTUS_ASCENDENS_INITIO_DEBILIS; + break; + case L_AUCTUS_DESCENDENS: + note->u.note.liquescentia = L_AUCTUS_DESCENDENS_INITIO_DEBILIS; + break; + case L_AUCTA: + note->u.note.liquescentia = L_AUCTA_INITIO_DEBILIS; + break; + default: + /* do nothing */ + break; + } + } else { + note->u.note.liquescentia = liq; + } + switch (note->u.note.shape) { + case S_STROPHA: + case S_DISTROPHA: + case S_TRISTROPHA: + switch (note->u.note.liquescentia) { + case L_AUCTUS_ASCENDENS: + case L_AUCTUS_DESCENDENS: + note->u.note.liquescentia = L_AUCTA; + break; + case L_AUCTUS_ASCENDENS_INITIO_DEBILIS: + case L_AUCTUS_DESCENDENS_INITIO_DEBILIS: + note->u.note.liquescentia = L_AUCTA_INITIO_DEBILIS; + break; + default: + break; + } + break; + + case S_ORISCUS: + switch (note->u.note.liquescentia) { + case L_AUCTUS_ASCENDENS: + case L_AUCTUS_DESCENDENS: + case L_AUCTUS_ASCENDENS_INITIO_DEBILIS: + case L_AUCTUS_DESCENDENS_INITIO_DEBILIS: + note->u.note.shape = S_ORISCUS_AUCTUS; + break; + case L_DEMINUTUS: + case L_DEMINUTUS_INITIO_DEBILIS: + note->u.note.shape = S_ORISCUS_DEMINUTUS; + break; + default: + break; + } + break; + + case S_PUNCTUM_CAVUM_INCLINATUM: + fix_punctum_cavum_inclinatum_liquescentia(note); + break; + + default: + break; + } +} + +static void apply_auto_h_episema(gregorio_note *const note, + const grehepisema_size size, const bool disable_bridge) +{ + if (note->h_episema_above == HEPISEMA_NONE + && note->h_episema_below == HEPISEMA_NONE) { + /* if both are unset, set both to auto */ + set_h_episema_above(note, HEPISEMA_AUTO, size, !disable_bridge); + set_h_episema_below(note, HEPISEMA_AUTO, size, !disable_bridge); + } else if (note->h_episema_above == HEPISEMA_AUTO + && note->h_episema_below == HEPISEMA_AUTO) { + /* if both are auto, then force both */ + /* the upper episema keeps its settings */ + note->h_episema_above = HEPISEMA_FORCED; + + set_h_episema_below(note, HEPISEMA_FORCED, size, !disable_bridge); + } else { + /* force whichever is not already forced */ + if (note->h_episema_above != HEPISEMA_FORCED) { + set_h_episema_above(note, HEPISEMA_FORCED, size, !disable_bridge); + } + if (note->h_episema_below != HEPISEMA_FORCED) { + set_h_episema_below(note, HEPISEMA_FORCED, size, !disable_bridge); + } + } +} + +/********************************** + * + * Activate_isolated_h_episema is used when we see an "isolated" + * horizontal episema: when we type ab__ lex see a then b then _ then _, so + * we must put the _ on the a (kind of backward process), and say the + * the episema on the b is a multi episema. Here n is the length of + * the isolated episema we found (can be up to 4). + * + *********************************/ +static void gregorio_activate_isolated_h_episema(gregorio_note *note, + const grehepisema_size size, const bool disable_bridge, int n) +{ + if (!note) { + gregorio_message(ngt_("isolated horizontal episema at the beginning " + "of a note sequence, ignored", + "isolated horizontal episema at the beginning of a note " + "sequence, ignored", n), "activate_h_isolated_episema", + VERBOSITY_WARNING, 0); + return; + } + if (note->type != GRE_NOTE) { + gregorio_message(ngt_("isolated horizontal episema after something " + "that is not a note, ignored", + "isolated horizontal episema after something that is not " + "a note, ignored", n), "activate_h_isolated_episema", + VERBOSITY_WARNING, 0); + return; + } + for (; n > 0; --n) { + note = note->previous; + if (!note || note->type != GRE_NOTE) { + gregorio_message(_("found more horizontal episema than notes " + "able to be under"), "activate_h_isolated_episema", + VERBOSITY_WARNING, 0); + return; + } + } + apply_auto_h_episema(note, size, disable_bridge); +} + +void gregorio_add_h_episema(gregorio_note *note, + grehepisema_size size, gregorio_vposition vposition, + bool disable_bridge, unsigned int *nbof_isolated_episema) +{ + if (!note || (note->type != GRE_NOTE && note->type != GRE_BAR)) { + gregorio_message(_("trying to add a horizontal episema on something " + "that is not a note"), "add_h_episema", + VERBOSITY_ERROR, 0); + return; + } + if (!nbof_isolated_episema) { + gregorio_message(_("NULL argument nbof_isolated_episema"), + "add_h_episema", VERBOSITY_FATAL, 0); + return; + } + if (vposition && *nbof_isolated_episema) { + gregorio_message(_("trying to add a forced horizontal episema on a " + "note which already has an automatic horizontal " + "episema"), "add_h_episema", VERBOSITY_ERROR, 0); + return; + } + + if (vposition || !*nbof_isolated_episema) { + switch (vposition) { + case VPOS_ABOVE: + set_h_episema_above(note, HEPISEMA_FORCED, size, !disable_bridge); + break; + + case VPOS_BELOW: + set_h_episema_below(note, HEPISEMA_FORCED, size, !disable_bridge); + break; + + default: /* VPOS_AUTO */ + apply_auto_h_episema(note, size, disable_bridge); + *nbof_isolated_episema = 1; + break; + } + } else { + gregorio_activate_isolated_h_episema(note, size, disable_bridge, + (*nbof_isolated_episema)++); + } +} + +void gregorio_add_sign(gregorio_note *note, gregorio_sign sign, + gregorio_vposition vposition) +{ + if (!note) { + /* error */ + return; + } + switch (sign) { + case _PUNCTUM_MORA: + switch (note->signs) { + case _NO_SIGN: + note->signs = _PUNCTUM_MORA; + break; + case _V_EPISEMA: + note->signs = _V_EPISEMA_PUNCTUM_MORA; + break; + case _PUNCTUM_MORA: + note->signs = _AUCTUM_DUPLEX; + break; + case _V_EPISEMA_PUNCTUM_MORA: + note->signs = _V_EPISEMA_AUCTUM_DUPLEX; + break; + default: + break; + } + + note->mora_vposition = vposition; + break; + + case _V_EPISEMA: + switch (note->signs) { + case _NO_SIGN: + note->signs = _V_EPISEMA; + break; + case _PUNCTUM_MORA: + note->signs = _V_EPISEMA_PUNCTUM_MORA; + break; + case _AUCTUM_DUPLEX: + note->signs = _V_EPISEMA_AUCTUM_DUPLEX; + break; + default: + break; + } + + if (note->type == GRE_NOTE && vposition) { + note->v_episema_height = note->u.note.pitch + vposition; + } + break; + + default: + break; + } +} + +void gregorio_go_to_first_note(gregorio_note **note) +{ + gregorio_note *tmp; + if (!*note) { + return; + } + tmp = *note; + while (tmp->previous) { + tmp = tmp->previous; + } + *note = tmp; +} + +static __inline void free_one_note(gregorio_note *note) +{ + free(note->texverb); + free(note->choral_sign); + free(note); +} + +void gregorio_free_one_note(gregorio_note **note) +{ + gregorio_note *next = NULL; + if (!note || !*note) { + return; + } + if ((*note)->next) { + (*note)->next->previous = NULL; + next = (*note)->next; + } + if ((*note)->previous) { + (*note)->previous->next = NULL; + } + free_one_note(*note); + *note = next; +} + +static void gregorio_free_notes(gregorio_note **note) +{ + gregorio_note *tmp; + while (*note) { + tmp = (*note)->next; + free_one_note(*note); + *note = tmp; + } +} + +static gregorio_glyph *create_and_link_glyph(gregorio_glyph **current_glyph) +{ + gregorio_glyph *glyph = gregorio_calloc(1, sizeof(gregorio_glyph)); + glyph->previous = *current_glyph; + glyph->next = NULL; + if (*current_glyph) { + (*current_glyph)->next = glyph; + } + *current_glyph = glyph; + + return glyph; +} + +void gregorio_add_glyph(gregorio_glyph **current_glyph, + gregorio_glyph_type type, gregorio_note *first_note, + gregorio_liquescentia liquescentia) +{ + gregorio_glyph *next_glyph = create_and_link_glyph(current_glyph); + if (next_glyph) { + next_glyph->type = GRE_GLYPH; + next_glyph->u.notes.glyph_type = type; + next_glyph->u.notes.liquescentia = liquescentia; + next_glyph->u.notes.first_note = first_note; + } +} + +void gregorio_add_pitched_element_as_glyph(gregorio_glyph **current_glyph, + gregorio_type type, signed char pitch, bool flatted_key, + bool force_pitch, char *texverb) +{ + gregorio_glyph *next_glyph = create_and_link_glyph(current_glyph); + assert(type == GRE_C_KEY_CHANGE || type == GRE_F_KEY_CHANGE + || type == GRE_C_KEY_CHANGE_FLATED || type == GRE_F_KEY_CHANGE_FLATED + || type == GRE_CUSTOS || type == GRE_FLAT || type == GRE_NATURAL + || type == GRE_SHARP); + if (next_glyph) { + next_glyph->type = type; + next_glyph->u.misc.pitched.pitch = pitch; + next_glyph->u.misc.pitched.flatted_key = flatted_key; + next_glyph->u.misc.pitched.force_pitch = force_pitch; + next_glyph->texverb = texverb; + } +} + +void gregorio_add_unpitched_element_as_glyph(gregorio_glyph **current_glyph, + gregorio_type type, gregorio_extra_info info, gregorio_sign sign, + char *texverb) +{ + gregorio_glyph *next_glyph = create_and_link_glyph(current_glyph); + assert(type != GRE_NOTE && type != GRE_GLYPH && type != GRE_ELEMENT + && type != GRE_C_KEY_CHANGE && type != GRE_F_KEY_CHANGE + && type != GRE_C_KEY_CHANGE_FLATED && type != GRE_F_KEY_CHANGE_FLATED + && type != GRE_CUSTOS && type != GRE_FLAT && type != GRE_NATURAL + && type != GRE_SHARP); + if (next_glyph) { + next_glyph->type = type; + next_glyph->u.misc.unpitched.info = info; + next_glyph->u.misc.unpitched.special_sign = sign; + next_glyph->texverb = texverb; + } +} + +void gregorio_go_to_first_glyph(gregorio_glyph **glyph) +{ + gregorio_glyph *tmp; + if (!*glyph) { + return; + } + tmp = *glyph; + while (tmp->previous) { + tmp = tmp->previous; + } + *glyph = tmp; +} + +static __inline void free_one_glyph(gregorio_glyph *glyph) +{ + free(glyph->texverb); + if (glyph->type == GRE_GLYPH) { + gregorio_free_notes(&glyph->u.notes.first_note); + } + free(glyph); +} + +void gregorio_free_one_glyph(gregorio_glyph **glyph) +{ + gregorio_glyph *next = NULL; + if (!glyph || !*glyph) { + return; + } + if ((*glyph)->next) { + (*glyph)->next->previous = NULL; + next = (*glyph)->next; + } + if ((*glyph)->previous) { + (*glyph)->previous->next = NULL; + } + free_one_glyph(*glyph); + *glyph = next; +} + +static void gregorio_free_glyphs(gregorio_glyph **glyph) +{ + gregorio_glyph *next_glyph; + if (!glyph || !*glyph) { + return; + } + while (*glyph) { + next_glyph = (*glyph)->next; + free_one_glyph(*glyph); + *glyph = next_glyph; + } +} + +static gregorio_element *create_and_link_element(gregorio_element + **current_element) +{ + gregorio_element *element = gregorio_calloc(1, sizeof(gregorio_element)); + element->previous = *current_element; + element->next = NULL; + if (*current_element) { + (*current_element)->next = element; + } + *current_element = element; + + return element; +} + +void gregorio_add_element(gregorio_element **current_element, + gregorio_glyph *first_glyph) +{ + gregorio_element *next = create_and_link_element(current_element); + if (next) { + next->type = GRE_ELEMENT; + next->u.first_glyph = first_glyph; + } +} + +void gregorio_add_misc_element(gregorio_element **current_element, + gregorio_type type, gregorio_misc_element_info info, char *texverb) +{ + gregorio_element *special = create_and_link_element(current_element); + if (special) { + special->type = type; + special->u.misc = info; + special->texverb = texverb; + } +} + +static __inline void free_one_element(gregorio_element *element) +{ + size_t i; + free(element->texverb); + for (i = 0; i < element->nabc_lines; i++) { + free(element->nabc[i]); + } + if (element->type == GRE_ELEMENT) { + gregorio_free_glyphs(&element->u.first_glyph); + } + free(element); +} + +static void gregorio_free_one_element(gregorio_element **element) +{ + gregorio_element *next = NULL; + if (!element || !*element) { + return; + } + if ((*element)->next) { + (*element)->next->previous = NULL; + next = (*element)->next; + } + if ((*element)->previous) { + (*element)->previous->next = NULL; + } + free_one_element(*element); + *element = next; +} + +static void gregorio_free_elements(gregorio_element **element) +{ + gregorio_element *next; + if (!element || !*element) { + return; + } + while (*element) { + next = (*element)->next; + free_one_element(*element); + *element = next; + } +} + +void gregorio_add_character(gregorio_character **current_character, + grewchar wcharacter) +{ + gregorio_character *element = + (gregorio_character *) gregorio_calloc(1, sizeof(gregorio_character)); + element->is_character = 1; + element->cos.character = wcharacter; + element->next_character = NULL; + element->previous_character = *current_character; + if (*current_character) { + (*current_character)->next_character = element; + } + *current_character = element; +} + +static void gregorio_free_one_character(gregorio_character *current_character) +{ + free(current_character); +} + +static void gregorio_free_characters(gregorio_character *current_character) +{ + gregorio_character *next_character; + if (!current_character) { + return; + } + while (current_character) { + next_character = current_character->next_character; + gregorio_free_one_character(current_character); + current_character = next_character; + } +} + +void gregorio_go_to_first_character(gregorio_character **character) +{ + gregorio_character *tmp; + if (!character || !*character) { + return; + } + tmp = *character; + while (tmp->previous_character) { + tmp = tmp->previous_character; + } + *character = tmp; +} + +void gregorio_begin_style(gregorio_character **current_character, + grestyle_style style) +{ + gregorio_character *element = + (gregorio_character *) gregorio_calloc(1, sizeof(gregorio_character)); + element->is_character = 0; + element->cos.s.type = ST_T_BEGIN; + element->cos.s.style = style; + element->previous_character = *current_character; + element->next_character = NULL; + if (*current_character) { + (*current_character)->next_character = element; + } + *current_character = element; +} + +void gregorio_end_style(gregorio_character **current_character, + grestyle_style style) +{ + gregorio_character *element = + (gregorio_character *) gregorio_calloc(1, sizeof(gregorio_character)); + element->is_character = 0; + element->cos.s.type = ST_T_END; + element->cos.s.style = style; + element->next_character = NULL; + element->previous_character = *current_character; + if (*current_character) { + (*current_character)->next_character = element; + } + *current_character = element; +} + +void gregorio_add_syllable(gregorio_syllable **current_syllable, + int number_of_voices, gregorio_element *elements[], + gregorio_character *first_character, + gregorio_character *first_translation_character, + gregorio_word_position position, char *abovelinestext, + gregorio_tr_centering translation_type, gregorio_nlba no_linebreak_area, + gregorio_euouae euouae, const gregorio_scanner_location *const loc, + const bool first_word) +{ + gregorio_syllable *next; + gregorio_element **tab; + int i; + if (number_of_voices > MAX_NUMBER_OF_VOICES) { + gregorio_message(_("too many voices"), "add_syllable", VERBOSITY_FATAL, + 0); + return; + } + next = gregorio_calloc(1, sizeof(gregorio_syllable)); + next->type = GRE_SYLLABLE; + next->special_sign = _NO_SIGN; + next->position = position; + next->no_linebreak_area = no_linebreak_area; + next->euouae = euouae; + next->text = first_character; + next->translation = first_translation_character; + next->translation_type = translation_type; + next->abovelinestext = abovelinestext; + next->first_word = first_word; + if (loc) { + next->src_line = loc->first_line; + next->src_column = loc->first_column; + next->src_offset = loc->first_offset; + } + next->next_syllable = NULL; + next->previous_syllable = *current_syllable; + tab = (gregorio_element **) gregorio_malloc(number_of_voices * + sizeof(gregorio_element *)); + if (elements) { + for (i = 0; i < number_of_voices; i++) { + tab[i] = elements[i]; + } + } else { + for (i = 0; i < number_of_voices; i++) { + tab[i] = NULL; + } + } + next->elements = tab; + if (*current_syllable) { + (*current_syllable)->next_syllable = next; + } + *current_syllable = next; +} + +static void gregorio_free_one_syllable(gregorio_syllable **syllable, + int number_of_voices) +{ + int i; + gregorio_syllable *next; + if (!syllable || !*syllable) { + gregorio_message(_("function called with NULL argument"), + "free_one_syllable", VERBOSITY_WARNING, 0); + return; + } + for (i = 0; i < number_of_voices; i++) { + gregorio_free_elements((struct gregorio_element **) + &((*syllable)->elements[i])); + } + if ((*syllable)->text) { + gregorio_free_characters((*syllable)->text); + } + if ((*syllable)->translation) { + gregorio_free_characters((*syllable)->translation); + } + free((*syllable)->abovelinestext); + next = (*syllable)->next_syllable; + free((*syllable)->elements); + free(*syllable); + *syllable = next; +} + +static void gregorio_free_syllables(gregorio_syllable **syllable, + int number_of_voices) +{ + if (!syllable || !*syllable) { + gregorio_message(_("function called with NULL argument"), + "free_syllables", VERBOSITY_WARNING, 0); + return; + } + while (*syllable) { + gregorio_free_one_syllable(syllable, number_of_voices); + } +} + +static void gregorio_source_info_init(source_info *si) +{ + si->author = NULL; + si->date = NULL; + si->manuscript = NULL; + si->manuscript_reference = NULL; + si->manuscript_storage_place = NULL; + si->transcriber = NULL; + si->transcription_date = NULL; + si->book = NULL; +} + +gregorio_score *gregorio_new_score(void) +{ + int annotation_num; + gregorio_score *new_score = gregorio_calloc(1, sizeof(gregorio_score)); + new_score->first_syllable = NULL; + new_score->number_of_voices = 1; + new_score->name = NULL; + new_score->gabc_copyright = NULL; + new_score->score_copyright = NULL; + new_score->initial_style = NORMAL_INITIAL; + new_score->office_part = NULL; + new_score->occasion = NULL; + new_score->meter = NULL; + new_score->commentary = NULL; + new_score->arranger = NULL; + gregorio_source_info_init(&new_score->si); + new_score->first_voice_info = NULL; + new_score->mode = 0; + new_score->gregoriotex_font = NULL; + new_score->user_notes = NULL; + for (annotation_num = 0; annotation_num < MAX_ANNOTATIONS; ++annotation_num) { + new_score->annotation[annotation_num] = NULL; + } + return new_score; +} + +static void gregorio_free_source_info(source_info *si) +{ + free(si->date); + free(si->author); + free(si->manuscript); + free(si->manuscript_reference); + free(si->manuscript_storage_place); + free(si->transcriber); + free(si->transcription_date); + free(si->book); +} + +static void gregorio_free_score_infos(gregorio_score *score) +{ + int annotation_num; + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_free_score_infos", VERBOSITY_WARNING, 0); + return; + } + free(score->name); + free(score->gabc_copyright); + free(score->score_copyright); + free(score->office_part); + free(score->occasion); + free(score->meter); + free(score->commentary); + free(score->arranger); + free(score->user_notes); + free(score->gregoriotex_font); + for (annotation_num = 0; annotation_num < MAX_ANNOTATIONS; ++annotation_num) { + free(score->annotation[annotation_num]); + } + gregorio_free_source_info(&score->si); + if (score->first_voice_info) { + gregorio_free_voice_infos(score->first_voice_info); + } +} + +void gregorio_free_score(gregorio_score *score) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "free_one_syllable", VERBOSITY_WARNING, 0); + return; + } + gregorio_free_syllables(&(score->first_syllable), score->number_of_voices); + gregorio_free_score_infos(score); + free(score); +} + +void gregorio_set_score_name(gregorio_score *score, char *name) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_name", VERBOSITY_WARNING, 0); + return; + } + free(score->name); + score->name = name; +} + +void gregorio_set_score_gabc_copyright(gregorio_score *score, + char *gabc_copyright) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_gabc_copyright", VERBOSITY_WARNING, 0); + return; + } + free(score->gabc_copyright); + score->gabc_copyright = gabc_copyright; +} + +void gregorio_set_score_score_copyright(gregorio_score *score, + char *score_copyright) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_score_copyright", VERBOSITY_WARNING, 0); + return; + } + free(score->score_copyright); + score->score_copyright = score_copyright; +} + +void gregorio_set_score_office_part(gregorio_score *score, char *office_part) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_office_part", VERBOSITY_WARNING, 0); + return; + } + free(score->office_part); + score->office_part = office_part; +} + +void gregorio_set_score_occasion(gregorio_score *score, char *occasion) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_occasion", VERBOSITY_WARNING, 0); + return; + } + free(score->occasion); + score->occasion = occasion; +} + +void gregorio_set_score_meter(gregorio_score *score, char *meter) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_meter", VERBOSITY_WARNING, 0); + return; + } + free(score->meter); + score->meter = meter; +} + +void gregorio_set_score_commentary(gregorio_score *score, char *commentary) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_commentary", VERBOSITY_WARNING, 0); + return; + } + free(score->commentary); + score->commentary = commentary; +} + +void gregorio_set_score_arranger(gregorio_score *score, char *arranger) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_arranger", VERBOSITY_WARNING, 0); + return; + } + free(score->arranger); + score->arranger = arranger; +} + +void gregorio_set_score_number_of_voices(gregorio_score *score, + int number_of_voices) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_number_of_voices", VERBOSITY_WARNING, 0); + return; + } + score->number_of_voices = number_of_voices; +} + +void gregorio_set_score_user_notes(gregorio_score *score, char *user_notes) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_user_notes", VERBOSITY_WARNING, 0); + return; + } + free(score->user_notes); + score->user_notes = user_notes; +} + +void gregorio_add_voice_info(gregorio_voice_info **current_voice_info) +{ + gregorio_voice_info *next = gregorio_calloc(1, sizeof(gregorio_voice_info)); + next->initial_key = NO_KEY; + next->flatted_key = false; + next->style = NULL; + next->virgula_position = NULL; + next->next_voice_info = NULL; + if (*current_voice_info) { + (*current_voice_info)->next_voice_info = next; + } + *current_voice_info = next; +} + +void gregorio_free_voice_infos(gregorio_voice_info *voice_info) +{ + gregorio_voice_info *next; + if (!voice_info) { + gregorio_message(_("function called with NULL argument"), + "free_voice_info", VERBOSITY_WARNING, 0); + return; + } + while (voice_info) { + free(voice_info->style); + free(voice_info->virgula_position); + next = voice_info->next_voice_info; + free(voice_info); + voice_info = next; + } +} + +/* + * a set of quite useless function + */ + +void gregorio_set_score_annotation(gregorio_score *score, char *annotation) +{ + int annotation_num; + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_annotation", VERBOSITY_WARNING, 0); + return; + } + /* save the annotation in the first spare place. */ + for (annotation_num = 0; annotation_num < MAX_ANNOTATIONS; ++annotation_num) { + if (score->annotation[annotation_num] == NULL) { + score->annotation[annotation_num] = annotation; + break; + } + } + if (annotation_num >= MAX_ANNOTATIONS) { + free(annotation); + gregorio_message(_("too many annotations"), + "gregorio_set_annotation", VERBOSITY_WARNING, 0); + } +} + +void gregorio_set_score_author(gregorio_score *score, char *author) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_author", VERBOSITY_WARNING, 0); + return; + } + free(score->si.author); + score->si.author = author; +} + +void gregorio_set_score_date(gregorio_score *score, char *date) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_date", VERBOSITY_WARNING, 0); + return; + } + free(score->si.date); + score->si.date = date; +} + +void gregorio_set_score_manuscript(gregorio_score *score, char *manuscript) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_manuscript", VERBOSITY_WARNING, 0); + return; + } + free(score->si.manuscript); + score->si.manuscript = manuscript; +} + +void gregorio_set_score_manuscript_reference(gregorio_score *score, + char *manuscript_reference) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_reference", VERBOSITY_WARNING, 0); + return; + } + free(score->si.manuscript_reference); + score->si.manuscript_reference = manuscript_reference; +} + +void gregorio_set_score_manuscript_storage_place(gregorio_score *score, + char *manuscript_storage_place) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_manuscript_storage_place", + VERBOSITY_WARNING, 0); + return; + } + free(score->si.manuscript_storage_place); + score->si.manuscript_storage_place = manuscript_storage_place; +} + +void gregorio_set_score_book(gregorio_score *score, char *book) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_book", VERBOSITY_WARNING, 0); + return; + } + free(score->si.book); + score->si.book = book; +} + +void gregorio_set_score_transcriber(gregorio_score *score, char *transcriber) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_transcriber", VERBOSITY_WARNING, 0); + return; + } + free(score->si.transcriber); + score->si.transcriber = transcriber; +} + +void gregorio_set_score_transcription_date(gregorio_score *score, + char *transcription_date) +{ + if (!score) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_score_transcription_date", VERBOSITY_WARNING, 0); + return; + } + free(score->si.transcription_date); + score->si.transcription_date = transcription_date; +} + +void gregorio_set_voice_style(gregorio_voice_info *voice_info, char *style) +{ + if (!voice_info) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_voice_style", VERBOSITY_WARNING, 0); + return; + } + free(voice_info->style); + voice_info->style = style; +} + +void gregorio_set_voice_virgula_position(gregorio_voice_info *voice_info, + char *virgula_position) +{ + if (!voice_info) { + gregorio_message(_("function called with NULL argument"), + "gregorio_set_voice_virgula_position", VERBOSITY_WARNING, 0); + return; + } + free(voice_info->virgula_position); + voice_info->virgula_position = virgula_position; +} + +/********************************** + * + * A function to build an integer from a key, very useful to represent + * it in the structure. + * + *The representation is : + * + * * 1 for a C key on the first (bottom) line + * * 3 for a C key on the second line + * * 5 for a C key on the third line (default key) + * * 7 for a C key on the fourth line + * + * * -2 for a F key on the first line + * * 0 for a F key on the second line + * * 2 for a F key on the third line + * * 4 for a F key on the fourth line + * + *********************************/ + +int gregorio_calculate_new_key(char step, int line) +{ + switch (step) { + case C_KEY: + return (2 * line) - 1; + break; + case F_KEY: + return (2 * line) - 4; + break; + default: + gregorio_message(_("can't calculate key"), + "gregorio_calculate_new_key", VERBOSITY_ERROR, 0); + return NO_KEY; + } +} + +/********************************** + * + * The reverse function of the preceeding : give step (c or f) and + * line (1-4) from an integer representing the key. + * + *********************************/ + +void gregorio_det_step_and_line_from_key(int key, char *step, int *line) +{ + switch (key) { + case -2: + *step = 'f'; + *line = 1; + break; + case 0: + *step = 'f'; + *line = 2; + break; + case 2: + *step = 'f'; + *line = 3; + break; + case 4: + *step = 'f'; + *line = 4; + break; + case 1: + *step = 'c'; + *line = 1; + break; + case 3: + *step = 'c'; + *line = 2; + break; + case 5: + *step = 'c'; + *line = 3; + break; + case 7: + *step = 'c'; + *line = 4; + break; + default: + *step = '?'; + *line = 0; + gregorio_message(_("can't determine step and line of the key"), + "gregorio_det_step_and_line_from_key", VERBOSITY_ERROR, 0); + return; + } +} + +static signed char gregorio_syllable_first_note(gregorio_syllable *syllable) +{ + gregorio_element *element; + gregorio_glyph *glyph; + if (!syllable) { + gregorio_message(_("called with a NULL argument"), + "gregorio_syllable_first_note", VERBOSITY_ERROR, 0); + } + element = syllable->elements[0]; + while (element) { + if (element->type == GRE_CUSTOS) { + return element->u.misc.pitched.pitch; + } + if (element->type == GRE_ELEMENT && element->u.first_glyph) { + glyph = element->u.first_glyph; + while (glyph) { + if (glyph->type == GRE_GLYPH && glyph->u.notes.first_note) { + assert(glyph->u.notes.first_note->type == GRE_NOTE); + return glyph->u.notes.first_note->u.note.pitch; + } + glyph = glyph->next; + } + } + element = element->next; + } + return 0; +} + +signed char gregorio_determine_next_pitch(gregorio_syllable *syllable, + gregorio_element *element, gregorio_glyph *glyph) +{ + signed char temp; + if (!element || !syllable) { + gregorio_message(_("called with a NULL argument"), + "gregorio_determine_next_pitch", VERBOSITY_ERROR, 0); + return DUMMY_PITCH; + } + /* we first explore the next glyphs to find a note, if there is one */ + if (glyph) { + glyph = glyph->next; + while (glyph) { + if (glyph->type == GRE_GLYPH && glyph->u.notes.first_note) { + assert(glyph->u.notes.first_note->type == GRE_NOTE); + return glyph->u.notes.first_note->u.note.pitch; + } + glyph = glyph->next; + } + } + /* then we do the same with the elements */ + element = element->next; + while (element) { + if (element->type == GRE_CUSTOS) { + return element->u.misc.pitched.pitch; + } + if (element->type == GRE_ELEMENT && element->u.first_glyph) { + glyph = element->u.first_glyph; + while (glyph) { + if (glyph->type == GRE_GLYPH && glyph->u.notes.first_note) { + assert(glyph->u.notes.first_note->type == GRE_NOTE); + return glyph->u.notes.first_note->u.note.pitch; + } + glyph = glyph->next; + } + } + element = element->next; + } + + /* then we do the same with the syllables */ + syllable = syllable->next_syllable; + while (syllable) { + /* we call another function that will return the pitch of the first + * note if syllable has a note, and 0 else */ + temp = gregorio_syllable_first_note(syllable); + if (temp) { + return temp; + } + syllable = syllable->next_syllable; + } + /* here it means that there is no next note, so we return a stupid value, + * but it won' t be used */ + return DUMMY_PITCH; +} + +/********************************** + * + * A function that may be useful (used in xml-write) : we have a + * tabular of alterations (we must remember all alterations on all + * notes all the time, they are reinitialized when a bar is found), + * and we assign all of them to NO_ALTERATION. + * + *This function works in fact with a tabular of tabular, one per + *voice, for polyphony. + * + *********************************/ + +void gregorio_reinitialize_alterations(char alterations[][13], + int number_of_voices) +{ + int i; + int j; + for (j = 0; j < number_of_voices; j++) { + for (i = 0; i < 13; i++) { + alterations[j][i] = NO_ALTERATION; + } + } +} + +/********************************** + * + * The corresponding function for monophony. + * + *********************************/ + +void gregorio_reinitialize_one_voice_alterations(char alterations[13]) +{ + int i; + for (i = 0; i < 13; i++) { + alterations[i] = NO_ALTERATION; + } +} + +/********************************** + * + * A function called after the entire score is determined : we check + * if the first element is a key change, if it is the case we delete + * it and we update the score->voice-info->initial_key. Works in + * polyphony. + * + *********************************/ + +void gregorio_fix_initial_keys(gregorio_score *score, int default_key) +{ + int clef = 0; + gregorio_element *element; + gregorio_voice_info *voice_info; + int i; + char to_delete = 1; + + if (!score || !score->first_syllable || !score->first_voice_info) { + gregorio_message(_("score is not available"), + "gregorio_fix_initial_keys", VERBOSITY_WARNING, 0); + return; + } + voice_info = score->first_voice_info; + for (i = 0; i < score->number_of_voices; i++) { + element = score->first_syllable->elements[i]; + if (!element) { + continue; + } + if (element->type == GRE_C_KEY_CHANGE) { + clef = + gregorio_calculate_new_key(C_KEY, + element->u.misc.pitched.pitch - '0'); + voice_info->initial_key = clef; + voice_info->flatted_key = element->u.misc.pitched.flatted_key; + gregorio_free_one_element(&(score->first_syllable->elements[i])); + gregorio_messagef("gregorio_fix_initial_keys", VERBOSITY_INFO, 0, + _("in voice %d the first element is a key definition, " + "considered as initial key"), i + 1); + } else if (element->type == GRE_F_KEY_CHANGE) { + clef = + gregorio_calculate_new_key(F_KEY, + element->u.misc.pitched.pitch - '0'); + voice_info->initial_key = clef; + voice_info->flatted_key = element->u.misc.pitched.flatted_key; + gregorio_free_one_element(&(score->first_syllable->elements[i])); + gregorio_messagef("gregorio_fix_initial_keys", VERBOSITY_INFO, 0, + _("in voice %d the first element is a key definition, " + "considered as initial key"), i + 1); + } + voice_info = voice_info->next_voice_info; + } + + /* then we suppress syllables that contain nothing anymore : case of (c2) + * at beginning of files */ + + for (i = 0; i < score->number_of_voices; i++) { + if (score->first_syllable->elements[i]) { + to_delete = 0; + break; + } + } + + if (to_delete) { + gregorio_free_one_syllable(&(score->first_syllable), + score->number_of_voices); + } + /* finally we initialize voice infos that have no initial key to default + * key */ + + voice_info = score->first_voice_info; + + for (i = 0; i < score->number_of_voices; i++) { + if (voice_info->initial_key == NO_KEY) { + voice_info->initial_key = default_key; + gregorio_messagef("gregorio_fix_initial_keys", VERBOSITY_INFO, 0, + _("no initial key definition in voice %d, default key " + "definition applied"), i + 1); + } + voice_info = voice_info->next_voice_info; + } +} + +/********************************** + * + * A small function to determine if an element list contains only + * special elements (bar, key-change, etc.), useful because the + * representation (in xml for example) may vary according to it. + * + *********************************/ + +bool gregorio_is_only_special(gregorio_element *element) +{ + if (!element) { + return 0; + } + while (element) { + if (element->type == GRE_ELEMENT) { + return 0; + } + element = element->next; + } + return 1; +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/struct.h b/Build/source/texk/gregorio/gregorio-src/src/struct.h new file mode 100644 index 00000000000..cf9ddbe998d --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/struct.h @@ -0,0 +1,873 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header defines the Gregorio data structures and functions. + * + * Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +/** + * @file + * The file starts by the definition of all the structures used in + * gregorio. As it is certainly the most important file for + * understanding, read it carefully. + */ + +#include "unicode.h" + +#ifndef STRUCT_H +#define STRUCT_H + +#include "bool.h" +#include "sha1.h" + +#ifdef __cplusplus +#define ENUM_BITFIELD(TYPE) enum TYPE +#elif defined(__GNUC__) && __GNUC__ >= 2 +#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE +#else +#define ENUM_BITFIELD(TYPE) unsigned int +#endif + +/* Lilypond-compatible location counters */ +typedef struct gregorio_scanner_location { + /* - line is the 1-based line number + * - column is the 0-based* column number, tabs expanded to 8-column stops + * - offset is the 0-based number of characters from the start of the line + * + * * = column is calculated and stored as a 0-based number so the tabstop + * math is simpler; it should be printed 1-based */ + + unsigned short first_line; + unsigned short first_column; + unsigned short first_offset; + unsigned short last_line; + unsigned short last_column; + unsigned short last_offset; +} gregorio_scanner_location; + +/* all the different types of things a gregorio_* can be */ + +typedef enum gregorio_type { + GRE_NOTE = 1, + GRE_GLYPH, + GRE_ELEMENT, + GRE_FLAT, + GRE_SHARP, + GRE_NATURAL, + GRE_C_KEY_CHANGE, + GRE_C_KEY_CHANGE_FLATED, + GRE_SYLLABLE, + GRE_F_KEY_CHANGE, + GRE_F_KEY_CHANGE_FLATED, + GRE_END_OF_LINE, + GRE_SPACE, + GRE_BAR, + GRE_END_OF_PAR, + GRE_CUSTOS, + /* I don't really know how I could use the a TEXVERB_NOTE in gregoriotex, + * as we don't write note by note... */ + /* GRE_TEXVERB_NOTE, */ + GRE_TEXVERB_GLYPH, + GRE_TEXVERB_ELEMENT, + /* above lines text, quite the same as GRE_TEXVERB_ELEMENT, but counted + * differently for the spaces above the lines */ + GRE_ALT, + GRE_NLBA, + GRE_MANUAL_CUSTOS +} gregorio_type; + +/* the different shapes, only for notes */ + +typedef enum gregorio_shape { + S_UNDETERMINED = 0, + S_PUNCTUM, + S_PUNCTUM_END_OF_GLYPH, + S_PUNCTUM_INCLINATUM, + S_PUNCTUM_INCLINATUM_DEMINUTUS, + S_PUNCTUM_INCLINATUM_AUCTUS, + S_VIRGA, + S_VIRGA_REVERSA, + S_BIVIRGA, + S_TRIVIRGA, + S_ORISCUS, + S_ORISCUS_AUCTUS, + S_ORISCUS_DEMINUTUS, + S_ORISCUS_SCAPUS, + S_QUILISMA, + S_STROPHA, + S_STROPHA_AUCTA, + S_DISTROPHA, + S_DISTROPHA_AUCTA, + S_TRISTROPHA, + S_TRISTROPHA_AUCTA, + S_PUNCTUM_CAVUM, + S_LINEA_PUNCTUM, + S_LINEA_PUNCTUM_CAVUM, + S_PUNCTUM_CAVUM_INCLINATUM, + S_PUNCTUM_CAVUM_INCLINATUM_AUCTUS, + /* special shapes that must not appear in the final form of the score : + * quadratum is the shape of the first note of a punctum quadratum + * and quilisma quadratum is the shape of the first note of a pes + * quislisma quadratum */ + S_QUADRATUM, + /* those shapes are for now used only in gregoriotex */ + S_QUILISMA_QUADRATUM, + S_PUNCTUM_AUCTUS_ASCENDENS, + S_PUNCTUM_AUCTUS_DESCENDENS, + S_PUNCTUM_DEMINUTUS, + S_LINEA +} gregorio_shape; + +/* the different kind of bars */ + +typedef enum gregorio_bar { + B_NO_BAR = 0, + B_VIRGULA, + B_DIVISIO_MINIMA, + B_DIVISIO_MINOR, + B_DIVISIO_MAIOR, + B_DIVISIO_FINALIS, + B_DIVISIO_MINOR_D1, + B_DIVISIO_MINOR_D2, + B_DIVISIO_MINOR_D3, + B_DIVISIO_MINOR_D4, + B_DIVISIO_MINOR_D5, + B_DIVISIO_MINOR_D6 +} gregorio_bar; + +/* definition of the signs. You can notice that the values are made so + * that if you wan to add a vertical episema to a note, you juste + * make note->signs+=_V_EPISEMA, so please don't change the value as + * this trick is used. */ + +typedef enum gregorio_sign { + _NO_SIGN = 0x00, + _PUNCTUM_MORA = 0x01, + _AUCTUM_DUPLEX = 0x02, + _V_EPISEMA = 0x10, + _V_EPISEMA_PUNCTUM_MORA = 0x11, + _V_EPISEMA_AUCTUM_DUPLEX = 0x12, + /* more rare signs, for now they can't be used with the others */ + _ACCENTUS = 0x03, + _ACCENTUS_REVERSUS = 0x04, + _CIRCULUS = 0x05, + _SEMI_CIRCULUS = 0x06, + _SEMI_CIRCULUS_REVERSUS = 0x07, + /* signs of a bar */ + _BAR_H_EPISEMA = 0x08, + _V_EPISEMA_BAR_H_EPISEMA = 0x18 +} gregorio_sign; + +/* the different spaces */ + +typedef enum gregorio_space { + SP_DEFAULT = 1, + SP_NO_SPACE, + SP_ZERO_WIDTH, + SP_NEUMATIC_CUT, + SP_LARGER_SPACE, + SP_GLYPH_SPACE, + SP_NEUMATIC_CUT_NB, + SP_LARGER_SPACE_NB, + SP_GLYPH_SPACE_NB +} gregorio_space; + +/* the different liquescences, like for the signs, have special + * values: to say that something is initio_debilis, just do + * glyph->liquescentia+=L_INITIO_DEBILIS. So don't change the value, + * the trick is much used */ + +typedef enum gregorio_liquescentia { + L_NO_LIQUESCENTIA = 0, + L_DEMINUTUS = 0x01, + L_AUCTUS_ASCENDENS = 0x02, + L_AUCTUS_DESCENDENS = 0x04, + L_AUCTA = 0x08, + L_INITIO_DEBILIS = 0x10, + L_DEMINUTUS_INITIO_DEBILIS = 0x11, + L_AUCTUS_ASCENDENS_INITIO_DEBILIS = 0x12, + L_AUCTUS_DESCENDENS_INITIO_DEBILIS = 0x14, + L_AUCTA_INITIO_DEBILIS = 0x18 +} gregorio_liquescentia; + +typedef enum grehepisema_size { + H_NORMAL = 0, + H_SMALL_LEFT, + H_SMALL_CENTRE, + H_SMALL_RIGHT +} grehepisema_size; + +/* values are chosen so BELOW/ABOVE can be added to a pitch */ +typedef enum gregorio_vposition { + VPOS_AUTO = 0, + VPOS_BELOW = -1, + VPOS_ABOVE = 1 +} gregorio_vposition; + +/* The different types of glyph */ + +typedef enum gregorio_glyph_type { + G_PUNCTUM_INCLINATUM = 1, + G_2_PUNCTA_INCLINATA_DESCENDENS, + G_3_PUNCTA_INCLINATA_DESCENDENS, + G_4_PUNCTA_INCLINATA_DESCENDENS, + G_5_PUNCTA_INCLINATA_DESCENDENS, + G_2_PUNCTA_INCLINATA_ASCENDENS, + G_3_PUNCTA_INCLINATA_ASCENDENS, + G_4_PUNCTA_INCLINATA_ASCENDENS, + G_5_PUNCTA_INCLINATA_ASCENDENS, + G_TRIGONUS, + G_PUNCTA_INCLINATA, + /* !!! DO NOT CHANGE THE ENUM ORDERING BEFORE THIS LINE !!! */ + G_UNDETERMINED, + G_VIRGA, + G_STROPHA, + G_STROPHA_AUCTA, + G_PUNCTUM, + G_PODATUS, + G_PES_QUADRATUM, + G_FLEXA, + G_TORCULUS, + G_TORCULUS_RESUPINUS, + G_TORCULUS_RESUPINUS_FLEXUS, + G_PORRECTUS, + G_PORRECTUS_FLEXUS, + G_BIVIRGA, + G_TRIVIRGA, + G_DISTROPHA, + G_DISTROPHA_AUCTA, + G_TRISTROPHA, + G_TRISTROPHA_AUCTA, + G_PES_QUADRATUM_FIRST_PART, + G_SCANDICUS, + G_PES_QUILISMA_QUADRATUM_FIRST_PART, + G_ANCUS, + G_ONE_NOTE, + G_PUNCTA_ASCENDENS, + G_PUNCTA_DESCENDENS, + G_VIRGA_REVERSA, + G_SALICUS, + G_VIRGA_STRATA, + G_TORCULUS_LIQUESCENS, + /* additional glyph types, necessary for determination */ + G_PORRECTUS_NO_BAR, + G_PORRECTUS_FLEXUS_NO_BAR, + G_PES_QUILISMA +} gregorio_glyph_type; + +/* + * + * The we define the characters. First we define the different styles. You + * can notice that center is just a style like the others + * + */ + +typedef enum grestyle_style { + ST_NO_STYLE = 0, + ST_ITALIC, + ST_CENTER, + /* when the user types a {}, basically the same behaviour, except for + * the initial */ + ST_FORCED_CENTER, + ST_BOLD, + ST_TT, + ST_SMALL_CAPS, + ST_SPECIAL_CHAR, + ST_VERBATIM, + ST_INITIAL, /* a style used to determine the initial */ + ST_UNDERLINED, + ST_COLORED, + ST_FIRST_WORD, + ST_FIRST_SYLLABLE, + ST_FIRST_SYLLABLE_INITIAL, + ST_SYLLABLE_INITIAL +} grestyle_style; + +/* + * Then the different types of styles. See the next comments for further + * readings. + */ + +typedef enum grestyle_type { + ST_T_NOTHING = 0, + ST_T_BEGIN, + ST_T_END +} grestyle_type; + +/* + * The different types of translation centerings + */ + +typedef enum gregorio_tr_centering { + TR_NORMAL = 0, + TR_WITH_CENTER_BEGINNING, + TR_WITH_CENTER_END +} gregorio_tr_centering; + +/* + * Nothing, beginning or end of area without linebreak + */ + +typedef enum gregorio_nlba { + NLBA_NORMAL = 0, + NLBA_BEGINNING, + NLBA_END +} gregorio_nlba; + +typedef enum gregorio_euouae { + EUOUAE_NORMAL = 0, + EUOUAE_BEGINNING, + EUOUAE_END +} gregorio_euouae; + +typedef enum gregorio_word_position { + WORD_BEGINNING = 1, + WORD_MIDDLE, + WORD_END, + WORD_ONE_SYLLABLE +} gregorio_word_position; + +/* the centering schemes for gabc: */ +typedef enum gregorio_lyric_centering { + SCHEME_DEFAULT = 0, + SCHEME_VOWEL, + SCHEME_SYLLABLE +} gregorio_lyric_centering; + +typedef struct gregorio_extra_info { + /* the sub-type of GRE_END_OF_LINE */ + ENUM_BITFIELD(gregorio_type) sub_type:8; + ENUM_BITFIELD(gregorio_bar) bar:8; + ENUM_BITFIELD(gregorio_space) space:8; + ENUM_BITFIELD(gregorio_nlba) nlba:8; +} gregorio_extra_info; + +typedef union gregorio_misc_element_info { + /* pitched is used for GRE_CUSTOS, GRE_FLAT, GRE_SHARP, GRE_NATURAL, + * GRE_C_KEY_CHANGE, GRE_F_KEY_CHANGE, GRE_C_KEY_CHANGE_FLATED, and + * GRE_F_KEY_CHANGE_FLATED */ + struct { + /* The pitch of the glyph for GRE_FLAT, GRE_NATURAL, GRE_SHARP. + * If a clef change, pitch will be a number indicating the line of + * the clef. */ + signed char pitch; + /* boolean indicating a clef with a B-flat */ + bool flatted_key:1; + bool force_pitch:1; + } pitched; + /* unpitched is used for everything else */ + struct { + struct gregorio_extra_info info; + /* an element might carry a sign. */ + ENUM_BITFIELD(gregorio_sign) special_sign:8; + } unpitched; +} gregorio_misc_element_info; + +/* + * ! We start with the most precise structure, the note structure. The + * note is always a real note (we'll see that glyphs and elements can be + * other things). + */ +typedef struct gregorio_note { + /* then two pointer to other notes, to make a chained list. */ + struct gregorio_note *previous; + struct gregorio_note *next; + /* choral sign is a letter that appears next to a note in some choral + * scores we put it as char* because sometimes two letters appear */ + char *choral_sign; + /* a string containing a possible TeX verbatim; necessary during + * structure generation. */ + char *texverb; + union { + /* note is used for GRE_NOTE, GRE_FLAT, GRE_SHARP, GRE_NATURAL, + * GRE_C_KEY_CHANGE, GRE_F_KEY_CHANGE, GRE_C_KEY_CHANGE_FLATED, and + * GRE_F_KEY_CHANGE_FLATED */ + struct { + /* the pitch is the height of the note on the score, that is to + * say the letter it is represented by in gabc. If a clef + * change, pitch will be a number indicating the line of the + * clef. */ + signed char pitch; + /* shape is the shape of the note... if you want to know the + * different possible shapes, see above. */ + ENUM_BITFIELD(gregorio_shape) shape:8; + /* liquescentia is the liquescence on the note, it is not really + * used in the final score, but it is, like type, used in the + * determination of glyphs. */ + ENUM_BITFIELD(gregorio_liquescentia) liquescentia:8; + } note; + /* other is used for everything else */ + struct gregorio_extra_info other; + } u; + + /* these go to the end for structure alignment */ + unsigned short src_line, src_column, src_offset; + + /* we have seen that notes are always real notes, that is to say + * GRE_NOTE. the type is always that in the final structure. But there + * is however this field in the structure because of the temporary + * states that can appear in the determination, where notes can be + * other things. This is the case for example in gabc reading. */ + ENUM_BITFIELD(gregorio_type) type:8; + /* signs is the signs on the notes, see above for all possible values */ + ENUM_BITFIELD(gregorio_sign) signs:8; + /* special_sign is the sign we sometimes encounter on punctum cavum, like + * accentus, semi-circulus, etc. */ + ENUM_BITFIELD(gregorio_sign) special_sign:8; + /* h_episema_type is the type of horizontal episema, possible values + * are H_ALONE for an isolated horizontal episema, H_MULTI_BEGINNING + * if the note is the first note of an episema on several notes, + * H_MULTI_MIDDLE if it is inside an episema on several notes. I let + * you guess what could be the use of H_MULTI_END. Other values are + * temporary values used in determination, they must not appear in the + * final structure. */ + + const char *gtex_offset_case; + signed char v_episema_height; + signed char h_episema_above; + signed char h_episema_below; + ENUM_BITFIELD(grehepisema_size) h_episema_above_size:2; + ENUM_BITFIELD(grehepisema_size) h_episema_below_size:2; + bool h_episema_above_connect:1; + bool h_episema_below_connect:1; + bool is_lower_note:1; + bool is_upper_note:1; + ENUM_BITFIELD(gregorio_vposition) mora_vposition:2; + bool choral_sign_is_nabc:1; +} gregorio_note; + +/* + * ! @brief The gregorio glyph structure Unlike gregorio_note, + * gregorio_glyph can be other things besides \c GRE_GLYPH: it can also be + * \c GRE_FLAT, \c GRE_NATURAL or \c GRE_SPACE + */ +typedef struct gregorio_glyph { + /* two pointer to make a chained list */ + struct gregorio_glyph *previous; + struct gregorio_glyph *next; + /* a string containing a possible TeX verbatim; necessary during structure + * generation. */ + char *texverb; + union { + /* glyph is used for GRE_GLYPH */ + struct { + /* a pointer to a (chained list of) gregorio_notes, the first of + * the glyph. */ + struct gregorio_note *first_note; + /* The glyph type for a GRE_GLYPH (porrectus, pes, etc.). They + * are all listed above. */ + ENUM_BITFIELD(gregorio_glyph_type) glyph_type:8; + /* liquescentia is really used, because that will determine the + * shape we will have to use. */ + ENUM_BITFIELD(gregorio_liquescentia) liquescentia:8; + } notes; + union gregorio_misc_element_info misc; + } u; + + /* characters go to the end for structure alignment */ + + /* type can have the values explained in the comment just above. */ + ENUM_BITFIELD(gregorio_type) type:8; + + /* There is no additional parameter for GRE_SPACE in a gregorio_glyph + * because gregorio_space in this case can have only one value: + * SP_ZERO_WIDTH, as other spaces would break the glyphs into + * different elements. */ +} gregorio_glyph; + +typedef struct gregorio_element { + /* pointers to the next and previous elements. */ + struct gregorio_element *previous; + struct gregorio_element *next; + /* a string containing a possible TeX verbatim; necessary during structure + * generation. */ + char *texverb; + /* The nabc string */ + char **nabc; + /* we put it here to get the length of the array here too */ + size_t nabc_lines; + union { + /* first_glyph is used for GRE_ELEMENT */ + /* a pointer to the first glyph of the element. */ + struct gregorio_glyph *first_glyph; + union gregorio_misc_element_info misc; + } u; + + /* type can have the values GRE_ELEMENT, GRE_BAR, GRE_C_KEY_CHANGE, + * GRE_F_KEY_CHANGE, GRE_END_OF_LINE, GRE_SPACE, GRE_TEXVERB_ELEMENT + * or GRE_NLBA */ + ENUM_BITFIELD(gregorio_type) type:8; +} gregorio_element; + +/* + * + * gregorio_characters are a bit specials. As there can be styles in the + * text, I had to find a structure mode adapted that just grewchar *. So + * basically a gregorio_character is a double-chained list of things that + * can be grewchar or gregorio_styles. For example if you type (in gabc) + * p<i>o</i>t, the corresponding gregorio_character list will be + * P->style(type: beginning, style italic) -> o -> style(type:end, style: + * italic). But for this list to be coherent, it is mandatory that it is + * xml-compliant, that is to say that a<b>c<i>d</b>e</i> will be + * interpreted as a<b>c<i>d</i></b><i>e</i>. This MUST be done when reading + * a file, so that the structure in memory is coherent. It makes input + * modules more comple, but output modules muche more simpler. The last + * particularity is that center must also be determined in the input + * modules, so that it is already defined in memory. But it is a bit more + * complex, because for TeX-like output modules, we need to close all + * styles before the center style: if the user types <i>pot</i> it must be + * represented as <i>p</i>{<i>o</i>}<i>t</i>. + * + * Here is the declaration of the gregorio_style struct. It is simply two + * chars, one telling the type of style character it is (beginning for a + * character that marks the beginning of a style, and end for a character + * marking the end of a style). The other char simply is the style + * represented by the character (italic, etc.) + * + */ + +typedef struct gregorio_style { + ENUM_BITFIELD(grestyle_style) style:8; + ENUM_BITFIELD(grestyle_type) type:8; +} gregorio_style; + +/* + * + * This union is quite ugly... but necessary for a gregorio_character to be + * able to be a grewchar or gregorio_style. + * + */ +typedef union character_or_style { + grewchar character; + struct gregorio_style s; +} character_or_style; + +/* + * + * Finally the gregorio_character structure in itself, It is first a char + * determining the type (character or gregorio_style). This char is 0 when + * it is a style and something else when it is a character. Then the two + * pointers to build the double chained list, and finally the union. So + * when you want to access to the style of a gregorio_character (when you + * know it is a character of style), you must access to + * mygregoriochar.cos.s.style, and for the character + * mygregoriochar.cos.character . + * + */ + +typedef struct gregorio_character { + bool is_character; + struct gregorio_character *next_character; + struct gregorio_character *previous_character; + union character_or_style cos; +} gregorio_character; + +typedef struct gregorio_syllable { + /* pointer to a gregorio_text structure corresponding to the text. */ + struct gregorio_character *text; + /* pointer to a gregorio_text structure corresponding to the + * translation */ + struct gregorio_character *translation; + /* a string representing the text above the lines (raw TeX) */ + char *abovelinestext; + /* pointer to the next and previous syllable */ + struct gregorio_syllable *next_syllable; + struct gregorio_syllable *previous_syllable; + /* and finally a pointer to the elements of the structure. Here we see + * that we point to an array of elements. In fact it is the array of + * the first elements of the different voices of the syllable, for the + * case of polyphonic score. In most scores (monophonic), the array + * has only one element. */ + struct gregorio_element **elements; + unsigned short src_line, src_column, src_offset; + /* a syllable can be a GRE_SYLLABLE, a GRE_*_KEY_CHANGE or a + * GRE_BAR. It is useful when there is only that in a syllable. */ + char type; + /* again, an additional field to put some signs or other things... */ + ENUM_BITFIELD(gregorio_sign) special_sign:8; + /* type of translation (with center beginning or only center end) */ + ENUM_BITFIELD(gregorio_tr_centering) translation_type:2; + /* beginning or end of area without linebreak? */ + ENUM_BITFIELD(gregorio_nlba) no_linebreak_area:2; + /* beginning or end of euouae area */ + ENUM_BITFIELD(gregorio_euouae) euouae:2; + /* position is WORD_BEGINNING for the beginning of a multi-syllable + * word, WORD_ONE_SYLLABLE for syllable that are alone in their word, + * and i let you gess what are WORD_MIDDLE and WORD_END. */ + ENUM_BITFIELD(gregorio_word_position) position:3; + bool first_word:1; +} gregorio_syllable; + +/* The items in source_info used to be -- well, most of them -- in + * gregorio_voice_info. This is because the different `voices' may + * in future be used for different variants of a melody: + * e.g. notated in square notation, notated in some early neumatic + * form from manuscript A, and another in manuscript B. In that + * case the different voices would naturally have different source + * info. However, this enhancement to gregorio is not yet planned, + * and so this structure is made part of gregorio_score. */ +typedef struct source_info { + char *author; + char *date; + char *manuscript; + char *manuscript_reference; /* was reference */ + char *manuscript_storage_place; /* was storage_place */ + char *book; + char *transcriber; + char *transcription_date; +} source_info; + +/* + * + * Score is the top structure, the structure in which we will convert + * everything, and from which we will construct XML + * + */ + +#define MAX_ANNOTATIONS 2 + +typedef struct gregorio_score { + unsigned char digest[SHA1_DIGEST_SIZE]; + /* the structure starts by a pointer to the first syllable of the + * score. */ + struct gregorio_syllable *first_syllable; + /* the number of voices is very important. In monophony it is one. If + * there are more voices thant number_of_voices, the additional voices + * won't be taken into consideration. */ + int number_of_voices; + /* then start some metadata: */ + char *name; + char *gabc_copyright; + char *score_copyright; + char *office_part; + char *occasion; + /* the meter, numbers of syllables per line, as e.g. 8.8.8.8 */ + char *meter; + char *commentary; + char *arranger; + struct source_info si; + /* the mode of a song is between 1 and 8 */ + char mode; + /* There is one annotation for each line above the initial letter */ + char *annotation[MAX_ANNOTATIONS]; + /* field giving informations on the initial (no initial, normal initial + * or two lines initial) */ + char initial_style; + /* the font to use in gregoriotex */ + char *gregoriotex_font; + size_t nabc_lines; + char *user_notes; + /* the determination method (maximal ambitus, etc.) */ + unsigned char det_method; + /* then, as there are some metadata that are voice-specific, we add a + * pointer to the first voice_info. (see comments below) */ + struct gregorio_voice_info *first_voice_info; + gregorio_lyric_centering centering; +} gregorio_score; + +/* + * + * gregorio_voice info contains everything that is voice_specific, for + * example the key, etc. that can be different from one voice to another. + * The order of the voice_info (it is a chained list) is the same as the + * order of the voices (from top to bottom in their representation on the + * score). + * + */ + +typedef struct gregorio_voice_info { + /* the only thing that is worth a comment here is the key. We have a + * special representation for the key. See comments on + * src/struct-utils.c for further reading. */ + int initial_key; + /* See source_info above for comments about the move of author etc. */ + char *style; + char *virgula_position; + struct gregorio_voice_info *next_voice_info; + bool flatted_key; +} gregorio_voice_info; + +/* the maximum number of voices, more than this is total nonsense in + * gregorian chant. */ +#define MAX_NUMBER_OF_VOICES 10 + +#define MAX_TEXT_LENGTH 200 + +#define C_KEY 'c' +#define F_KEY 'f' +#define NO_KEY -5 +#define DEFAULT_KEY 5 + +#define MONOPHONY 0 + +/* the different initial styles */ + +#define NO_INITIAL 0 +#define NORMAL_INITIAL 1 +#define BIG_INITIAL 2 + +#define NO_ALTERATION USELESS_VALUE +#define FLAT GRE_FLAT +#define NATURAL GRE_NATURAL + +#define USELESS_VALUE 0 + +static __inline bool is_puncta_inclinata(char glyph) +{ + return glyph <= G_5_PUNCTA_INCLINATA_ASCENDENS; +} + +#define IS_INITIO_DEBILIS 5 +#define NO_INITIO_DEBILIS 0 + +static __inline bool is_liquescentia(char liquescentia) +{ + return liquescentia == L_DEMINUTUS || liquescentia == L_AUCTUS_ASCENDENS + || liquescentia == L_AUCTUS_DESCENDENS || liquescentia == L_AUCTA; +} + +static __inline bool is_initio_debilis(char liquescentia) +{ + return liquescentia >= L_INITIO_DEBILIS; +} + +#define HEPISEMA_NONE 0 +#define HEPISEMA_AUTO -1 +#define HEPISEMA_FORCED -2 + +/* The first pitch MUST be an odd number */ +#define LOWEST_PITCH 3 +#define HIGHEST_PITCH (LOWEST_PITCH + 12) +#define DUMMY_PITCH (LOWEST_PITCH + 6) + +gregorio_score *gregorio_new_score(void); +void gregorio_add_note(gregorio_note **current_note, signed char pitch, + gregorio_shape shape, gregorio_sign signs, + gregorio_liquescentia liquescentia, gregorio_note* prototype, + const gregorio_scanner_location *loc); +void gregorio_add_glyph(gregorio_glyph **current_glyph, + gregorio_glyph_type type, gregorio_note *first_note, + gregorio_liquescentia liquescentia); +void gregorio_add_element(gregorio_element **current_element, + gregorio_glyph *first_glyph); +void gregorio_add_syllable(gregorio_syllable **current_syllable, + int number_of_voices, gregorio_element *elements[], + gregorio_character *first_character, + gregorio_character *first_translation_character, + gregorio_word_position position, char *abovelinestext, + gregorio_tr_centering translation_type, gregorio_nlba no_linebreak_area, + gregorio_euouae euouae, const gregorio_scanner_location *loc, + bool first_word); +void gregorio_add_special_sign(gregorio_note *current_note, gregorio_sign sign); +void gregorio_change_shape(gregorio_note *note, gregorio_shape shape); +void gregorio_position_h_episema_above(gregorio_note *note, signed char height, + bool connect); +void gregorio_position_h_episema_below(gregorio_note *note, signed char height, + bool connect); +void gregorio_add_h_episema(gregorio_note *note, grehepisema_size size, + gregorio_vposition vposition, bool disable_bridge, + unsigned int *nbof_isolated_episema); +void gregorio_add_sign(gregorio_note *note, gregorio_sign sign, + gregorio_vposition vposition); +void gregorio_add_liquescentia(gregorio_note *note, + gregorio_liquescentia liquescentia); +void gregorio_add_voice_info(gregorio_voice_info **current_voice_info); +void gregorio_free_voice_infos(gregorio_voice_info *voice_info); +void gregorio_free_one_note(gregorio_note **note); +void gregorio_free_one_glyph(gregorio_glyph **glyph); +void gregorio_free_score(gregorio_score *score); +void gregorio_go_to_first_character(gregorio_character **character); +void gregorio_add_pitched_element_as_glyph(gregorio_glyph **current_glyph, + gregorio_type type, signed char pitch, bool flatted_key, + bool force_pitch, char *texverb); +void gregorio_add_unpitched_element_as_glyph(gregorio_glyph **current_glyph, + gregorio_type type, gregorio_extra_info info, gregorio_sign sign, + char *texverb); +void gregorio_add_end_of_line_as_note(gregorio_note **current_note, + gregorio_type sub_type, const gregorio_scanner_location *loc); +void gregorio_add_custo_as_note(gregorio_note **current_note, + const gregorio_scanner_location *loc); +void gregorio_add_manual_custos_as_note(gregorio_note **current_note, + signed char pitch, const gregorio_scanner_location *loc); +void gregorio_add_clef_change_as_note(gregorio_note **current_note, + gregorio_type type, signed char clef_line, + const gregorio_scanner_location *loc); +void gregorio_add_bar_as_note(gregorio_note **current_note, gregorio_bar bar, + const gregorio_scanner_location *loc); +void gregorio_add_alteration_as_note(gregorio_note **current_note, + gregorio_type type, signed char pitch, + const gregorio_scanner_location *loc); +void gregorio_add_space_as_note(gregorio_note **current_note, + gregorio_space space, + const gregorio_scanner_location *loc); +void gregorio_add_texverb_as_note(gregorio_note **current_note, char *str, + gregorio_type type, const gregorio_scanner_location *loc); +void gregorio_add_nlba_as_note(gregorio_note **current_note, + gregorio_nlba type, const gregorio_scanner_location *loc); +void gregorio_add_texverb_to_note(gregorio_note **current_note, char *str); +void gregorio_add_cs_to_note(gregorio_note *const*current_note, char *str, + bool nabc); +void gregorio_add_misc_element(gregorio_element **current_element, + gregorio_type type, gregorio_misc_element_info info, char *texverb); +void gregorio_reinitialize_alterations(char alterations[][13], + int number_of_voices); +void gregorio_reinitialize_one_voice_alterations(char alterations[13]); +void gregorio_set_score_name(gregorio_score *score, char *name); +void gregorio_set_score_gabc_copyright(gregorio_score *score, char *gabc_copyright); +void gregorio_set_score_score_copyright(gregorio_score *score, + char *score_copyright); +void gregorio_set_score_office_part(gregorio_score *score, char *office_part); +void gregorio_set_score_occasion(gregorio_score *score, char *occasion); +void gregorio_set_score_meter(gregorio_score *score, char *meter); +void gregorio_set_score_commentary(gregorio_score *score, char *commentary); +void gregorio_set_score_arranger(gregorio_score *score, char *arranger); +void gregorio_set_score_gabc_version(gregorio_score *score, char *gabc_version); +void gregorio_set_score_number_of_voices(gregorio_score *score, + int number_of_voices); +void gregorio_set_score_annotation(gregorio_score *score, char *annotation); +void gregorio_set_score_author(gregorio_score *score, char *author); +void gregorio_set_score_date(gregorio_score *score, char *date); +void gregorio_set_score_manuscript(gregorio_score *score, char *manuscript); +void gregorio_set_score_book(gregorio_score *score, char *book); +void gregorio_set_score_manuscript_reference(gregorio_score *score, + char *reference); +void gregorio_set_score_manuscript_storage_place(gregorio_score *score, + char *storage_place); +void gregorio_set_score_transcriber(gregorio_score *score, char *transcriber); +void gregorio_set_score_transcription_date(gregorio_score *score, + char *transcription_date); +void gregorio_set_score_user_notes(gregorio_score *score, char *user_notes); +void gregorio_set_voice_style(gregorio_voice_info *voice_info, char *style); +void gregorio_set_voice_virgula_position(gregorio_voice_info *voice_info, + char *virgula_position); +void gregorio_fix_initial_keys(gregorio_score *score, int default_key); +void gregorio_go_to_first_note(gregorio_note **note); +void gregorio_go_to_first_glyph(gregorio_glyph **glyph); +void gregorio_det_step_and_line_from_key(int key, char *step, int *line); +bool gregorio_is_only_special(gregorio_element *element); +int gregorio_calculate_new_key(char step, int line); +void gregorio_add_character(gregorio_character **current_character, + grewchar wcharacter); +void gregorio_begin_style(gregorio_character **current_character, + grestyle_style style); +void gregorio_end_style(gregorio_character **current_character, + grestyle_style style); +signed char gregorio_determine_next_pitch(gregorio_syllable *syllable, + gregorio_element *element, gregorio_glyph *glyph); + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/support.c b/Build/source/texk/gregorio/gregorio-src/src/support.c new file mode 100644 index 00000000000..1862c9445a5 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/support.c @@ -0,0 +1,93 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file contains miscellaneous support functions. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> +#include <string.h> +#include "support.h" +#include "messages.h" + +/* Our version of snprintf; this is NOT semantically the same as C99's + * snprintf; rather, it's a "lowest common denominator" implementation + * blending C99 and MS-C */ +void gregorio_snprintf(char *s, size_t size, const char *format, ...) +{ + va_list args; + +#ifdef _MSC_VER + memset(s, 0, size * sizeof(char)); +#endif + + va_start(args, format); +#ifdef _MSC_VER + _vsnprintf_s(s, size, _TRUNCATE, format, args); +#else + vsnprintf(s, size, format, args); +#endif + va_end(args); +} + +void *gregorio_malloc(size_t size) +{ + void *result = malloc(size); + if (!result) { + gregorio_message(_("error in memory allocation"), + "gregorio_malloc", VERBOSITY_FATAL, 0); + exit(1); + } + return result; +} + +void *gregorio_calloc(size_t nmemb, size_t size) +{ + void *result = calloc(nmemb, size); + if (!result) { + gregorio_message(_("error in memory allocation"), + "gregorio_calloc", VERBOSITY_FATAL, 0); + exit(1); + } + return result; +} + +void *gregorio_realloc(void *ptr, size_t size) +{ + void *result = realloc(ptr, size); + if (!result) { + gregorio_message(_("error in memory allocation"), + "gregorio_realloc", VERBOSITY_FATAL, 0); + exit(1); + } + return result; +} + +char *gregorio_strdup(const char *s) +{ + char *result = strdup(s); + if (!result) { + gregorio_message(_("error in memory allocation"), + "gregorio_strdup", VERBOSITY_FATAL, 0); + exit(1); + } + return result; +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/support.h b/Build/source/texk/gregorio/gregorio-src/src/support.h new file mode 100644 index 00000000000..f6ec460121a --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/support.h @@ -0,0 +1,35 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header prototypes the miscellaneous support functions. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SUPPORT_H +#define SUPPORT_H + +#include <stdlib.h> + +void gregorio_snprintf(char *s, size_t size, const char *format, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); +void *gregorio_malloc(size_t size); +void *gregorio_calloc(size_t nmemb, size_t size); +void *gregorio_realloc(void *ptr, size_t size); +char *gregorio_strdup(const char *s); + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/unicode.c b/Build/source/texk/gregorio/gregorio-src/src/unicode.c new file mode 100644 index 00000000000..9b15a6d92e4 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/unicode.c @@ -0,0 +1,202 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file contains functions providing UTF-8 support. + * + * Copyright (C) 2008-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <string.h> /* for strlen */ +#include <stdlib.h> +#include "struct.h" +#include "unicode.h" +#include "messages.h" +#include "support.h" + +/* + * + * This file contains some functions to handle UTF-8 correctly. We chose to + * embed them instead of relying on locale or glib, for simplification: with + * these functions we don't rely on anything locale-dependant (such as + * wchar_t). The reason is that Windows XP (...) is not UTF-8 and thus would + * need the glib in oder to run, which make dependencies much bigger. + * + */ + +/* an utf8 version of mbstowcs */ + +static size_t gregorio_mbstowcs(grewchar *dest, const char *src, int n) +{ + unsigned char bytes_to_come; + grewchar result = 0; + unsigned char c; + size_t res = 0; /* number of bytes we've done so far */ + if (!src) { + gregorio_message(_("call with a NULL argument"), "gregorio_mbstowcs", + VERBOSITY_ERROR, 0); + } + while (*src && ((int) res <= n || !dest)) { + c = (unsigned char) (*src); + if (c < 128) { /* 0100xxxx */ + /* one-byte symbol */ + bytes_to_come = 0; + result = c; + } else if (c >= 240) { /* 1111xxxx */ + /* start of a four-byte symbol */ + /* printf("%d\n", c); */ + bytes_to_come = 3; + result = (result << 3) | (c & 7); + } else if (c >= 224) { /* 1110xxxx */ + /* start of a three-byte symbol */ + /* printf("%d\n", c); */ + bytes_to_come = 2; + result = (result << 4) | (c & 15); + } else if (c >= 192) { /* 1100xxxx */ + /* start of a two-byte symbol */ + /* printf("%d\n", c); */ + bytes_to_come = 1; + result = (result << 5) | (c & 31); + } else { + /* printf("%s %d %d\n", src, res, c); */ + gregorio_message(_("malformed UTF-8 sequence1"), + "gregorio_mbstowcs", VERBOSITY_ERROR, 0); + return -1; + } + while (bytes_to_come > 0) { + bytes_to_come--; + src++; + c = (unsigned char) (*src); + if (c < 192 && c >= 128) /* 1000xxxx */ + { + result = (result << 6) | (c & 63); + } else { + gregorio_message(_("malformed UTF-8 sequence2"), + "gregorio_mbstowcs", VERBOSITY_ERROR, 0); + return -1; + } + } + if (dest) { + dest[res] = result; + } + res++; + result = 0; + src++; + } + if (!(*src) && (int) res <= n && dest) { + dest[res] = 0; + } + return res; +} + +/* the value returned by this function must be freed! */ +grewchar *gregorio_build_grewchar_string_from_buf(const char *const buf) +{ + size_t len; + grewchar *gwstring; + if (buf == NULL) { + return NULL; + } + len = strlen(buf); /* to get the length of the syllable in ASCII */ + gwstring = (grewchar *) gregorio_malloc((len + 1) * sizeof(grewchar)); + gregorio_mbstowcs(gwstring, buf, len); /* converting into wchar_t */ + return gwstring; +} + +/* the function to build a gregorio_character list from a buffer. */ + +gregorio_character *gregorio_build_char_list_from_buf(const char *const buf) +{ + int i = 0; + grewchar *gwstring; + gregorio_character *current_character = NULL; + if (buf == NULL) { + return NULL; + } + gwstring = gregorio_build_grewchar_string_from_buf(buf); + /* we add the corresponding characters in the list of gregorio_characters */ + while (gwstring[i]) { + gregorio_add_character(¤t_character, gwstring[i]); + i++; + } + free(gwstring); + gregorio_go_to_first_character(¤t_character); + return current_character; +} + +/* the function to compare a grewchar * and a buf. Returns 1 if different, 0 + * if not. */ + +unsigned char gregorio_wcsbufcmp(grewchar *wstr, const char *buf) +{ + int i = 0; + size_t len; + grewchar *gwbuf; + if (!buf || !wstr) { + return 1; + } + len = strlen(buf); /* to get the length of the syllable in ASCII */ + gwbuf = (grewchar *) gregorio_malloc((len + 1) * sizeof(grewchar)); + gregorio_mbstowcs(gwbuf, buf, len); /* converting into wchar_t */ + /* we add the corresponding characters in the list of gregorio_characters */ + while (gwbuf[i] && wstr[i]) { + if (gwbuf[i] != wstr[i]) { + free(gwbuf); + return 1; + } + i = i + 1; + } + /* we finished the two strings */ + if (gwbuf[i] == 0 && wstr[i] == 0) { + free(gwbuf); + return 0; + } + free(gwbuf); + return 1; +} + +void gregorio_print_unichar(FILE *f, grewchar to_print) +{ + if (to_print <= 0x7F) { + fprintf(f, "%c", (unsigned char) to_print); + return; + } + if (to_print >= 0x80 && to_print <= 0x7FF) { + fprintf(f, "%c%c", 0xC0 | (to_print >> 6), 0x80 | (to_print & 0x3F)); + return; + } + if ((to_print >= 0x800 && to_print <= 0xD7FF) || + (to_print >= 0xE000 && to_print <= 0xFFFF)) { + fprintf(f, "%c%c%c", 0xE0 | (to_print >> 12), + 0x80 | ((to_print >> 6) & 0x3F), 0x80 | (to_print & 0x3F)); + return; + } + if (to_print >= 0x10000 && to_print <= 0x10FFFF) { + fprintf(f, "%c%c%c%c", 0xF0 | (to_print >> 18), + 0x80 | ((to_print >> 12) & 0x3F), + 0x80 | ((to_print >> 6) & 0x3F), 0x80 | (to_print & 0x3F)); + } +} + +void gregorio_print_unistring(FILE *f, grewchar *first_char) +{ + while (*first_char != 0) { + gregorio_print_unichar(f, *first_char); + first_char++; + } +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/unicode.h b/Build/source/texk/gregorio/gregorio-src/src/unicode.h new file mode 100644 index 00000000000..62942edcb1e --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/unicode.h @@ -0,0 +1,70 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header prototypes the UTF-8 support functions. + * + * Copyright (C) 2008-2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef UNICODE_H_FIRST_PART +#define UNICODE_H_FIRST_PART +#define UNICODE_H + +#include <stdio.h> +#ifdef HAVE_STDINT_H +#include <stdint.h> +#else +#include <inttypes.h> +#endif + +typedef uint32_t grewchar; + +void gregorio_print_unichar(FILE *f, grewchar to_print); +void gregorio_print_unistring(FILE *f, grewchar *first_char); +unsigned char gregorio_wcsbufcmp(grewchar *wstr, const char *buf); +grewchar *gregorio_build_grewchar_string_from_buf(const char *buf); + +static __inline size_t gregorio_wcstrlen(const grewchar *wstr) +{ + size_t length = 0; + + while (*(wstr++)) { + ++length; + } + + return length; +} + +/* this macro is for portability under windows, where L'x' is only two-bytes + * long, and thus needs to be cast to a 4-bytes integer. */ +#define GL(wc) ((const grewchar) L'wc') + +#endif + +/* we enter the second part only if struct.h has already been included, because + * we need gregorio_character */ + +#ifdef STRUCT_H + +#ifndef UNICODE_H_SECOND_PART +#define UNICODE_H_SECOND_PART + +gregorio_character *gregorio_build_char_list_from_buf(const char *buf); + +#endif + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/utf8strings.h b/Build/source/texk/gregorio/gregorio-src/src/utf8strings.h new file mode 100644 index 00000000000..8d7dd732933 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/utf8strings.h @@ -0,0 +1,36 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header file contains UTF-8 encoded strings used by Gregorio + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef UTF8STRINGS_H +#define UTF8STRINGS_H + +#define ACCENTED_AE "'\303\246" +#define ACCENTED_OE "'\305\223" + +/* This is a superset of Latin vowels which includes some French, 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. */ +#define DEFAULT_VOWELS "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 diff --git a/Build/source/texk/gregorio/gregorio-src/src/utf8strings.h.in b/Build/source/texk/gregorio/gregorio-src/src/utf8strings.h.in new file mode 100644 index 00000000000..548462844ba --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/utf8strings.h.in @@ -0,0 +1,36 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header file contains UTF-8 encoded strings used by Gregorio + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * Gregorio is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gregorio 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Gregorio. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef UTF8STRINGS_H +#define UTF8STRINGS_H + +#define ACCENTED_AE "'æ" +#define ACCENTED_OE "'œ" + +/* This is a superset of Latin vowels which includes some French, 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. */ +#define DEFAULT_VOWELS "aàáâăąåAÀÁÂĂĄÅeèéêëěęEÈÉÊËĚĘiìíîIÌÍÎ" \ + "oòóôơőøOÒÓÔƠŐØuùúûưůűUÙÚÛƯŮŰyỳýYỲÝæǽÆǼœŒ" + +#endif diff --git a/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-l.c b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-l.c new file mode 100644 index 00000000000..78f76e8a7b6 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-l.c @@ -0,0 +1,1920 @@ +#line 2 "vowel/vowel-rules-l.c" + +#line 4 "vowel/vowel-rules-l.c" + +#define YY_INT_ALIGNED long int + +/* A lexical scanner generated by flex */ + +#define yy_create_buffer gregorio_vowel_rulefile__create_buffer +#define yy_delete_buffer gregorio_vowel_rulefile__delete_buffer +#define yy_flex_debug gregorio_vowel_rulefile__flex_debug +#define yy_init_buffer gregorio_vowel_rulefile__init_buffer +#define yy_flush_buffer gregorio_vowel_rulefile__flush_buffer +#define yy_load_buffer_state gregorio_vowel_rulefile__load_buffer_state +#define yy_switch_to_buffer gregorio_vowel_rulefile__switch_to_buffer +#define yyin gregorio_vowel_rulefile_in +#define yyleng gregorio_vowel_rulefile_leng +#define yylex gregorio_vowel_rulefile_lex +#define yylineno gregorio_vowel_rulefile_lineno +#define yyout gregorio_vowel_rulefile_out +#define yyrestart gregorio_vowel_rulefile_restart +#define yytext gregorio_vowel_rulefile_text +#define yywrap gregorio_vowel_rulefile_wrap +#define yyalloc gregorio_vowel_rulefile_alloc +#define yyrealloc gregorio_vowel_rulefile_realloc +#define yyfree gregorio_vowel_rulefile_free + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 39 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE gregorio_vowel_rulefile_restart(gregorio_vowel_rulefile_in ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t gregorio_vowel_rulefile_leng; + +extern FILE *gregorio_vowel_rulefile_in, *gregorio_vowel_rulefile_out; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up gregorio_vowel_rulefile_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up gregorio_vowel_rulefile_text again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via gregorio_vowel_rulefile_restart()), so that the user can continue scanning by + * just pointing gregorio_vowel_rulefile_in at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when gregorio_vowel_rulefile_text is formed. */ +static char yy_hold_char; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t gregorio_vowel_rulefile_leng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow gregorio_vowel_rulefile_wrap()'s to do buffer switches + * instead of setting up a fresh gregorio_vowel_rulefile_in. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void gregorio_vowel_rulefile_restart (FILE *input_file ); +void gregorio_vowel_rulefile__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE gregorio_vowel_rulefile__create_buffer (FILE *file,int size ); +void gregorio_vowel_rulefile__delete_buffer (YY_BUFFER_STATE b ); +void gregorio_vowel_rulefile__flush_buffer (YY_BUFFER_STATE b ); +void gregorio_vowel_rulefile_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void gregorio_vowel_rulefile_pop_buffer_state (void ); + +static void gregorio_vowel_rulefile_ensure_buffer_stack (void ); +static void gregorio_vowel_rulefile__load_buffer_state (void ); +static void gregorio_vowel_rulefile__init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER gregorio_vowel_rulefile__flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE gregorio_vowel_rulefile__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE gregorio_vowel_rulefile__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE gregorio_vowel_rulefile__scan_bytes (yyconst char *bytes,yy_size_t len ); + +void *gregorio_vowel_rulefile_alloc (yy_size_t ); +void *gregorio_vowel_rulefile_realloc (void *,yy_size_t ); +void gregorio_vowel_rulefile_free (void * ); + +#define yy_new_buffer gregorio_vowel_rulefile__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + gregorio_vowel_rulefile_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + gregorio_vowel_rulefile__create_buffer(gregorio_vowel_rulefile_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + gregorio_vowel_rulefile_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + gregorio_vowel_rulefile__create_buffer(gregorio_vowel_rulefile_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define gregorio_vowel_rulefile_wrap() 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +FILE *gregorio_vowel_rulefile_in = (FILE *) 0, *gregorio_vowel_rulefile_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int gregorio_vowel_rulefile_lineno; + +int gregorio_vowel_rulefile_lineno = 1; + +extern char *gregorio_vowel_rulefile_text; +#define yytext_ptr gregorio_vowel_rulefile_text + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up gregorio_vowel_rulefile_text. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + gregorio_vowel_rulefile_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 17 +#define YY_END_OF_BUFFER 18 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int32_t yy_accept[71] = + { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 18, 16, + 15, 15, 13, 7, 16, 16, 16, 16, 16, 16, + 12, 9, 16, 10, 10, 10, 10, 7, 11, 13, + 0, 0, 0, 0, 0, 0, 0, 12, 8, 10, + 10, 0, 0, 0, 0, 0, 0, 14, 0, 0, + 0, 0, 0, 0, 6, 0, 0, 0, 0, 2, + 0, 3, 0, 4, 0, 0, 1, 0, 5, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 5, 1, 1, 1, 1, 1, + 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 8, 1, 9, 1, 1, 1, 10, 1, 11, 12, + + 13, 14, 15, 1, 16, 1, 1, 17, 1, 18, + 19, 20, 1, 21, 22, 23, 24, 25, 26, 27, + 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 29, 1, 1, 1, + 30, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 31, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[32] = + { 0, + 1, 2, 3, 3, 2, 2, 2, 1, 4, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1 + } ; + +static yyconst flex_int32_t yy_base[78] = + { 0, + 0, 30, 60, 66, 72, 0, 94, 102, 92, 139, + 139, 139, 0, 139, 74, 80, 68, 0, 69, 58, + 0, 139, 67, 0, 0, 0, 5, 0, 139, 0, + 69, 66, 70, 71, 67, 52, 30, 0, 139, 0, + 12, 49, 43, 43, 37, 40, 40, 139, 29, 25, + 32, 28, 29, 27, 139, 33, 15, 29, 12, 139, + 23, 139, 26, 139, 17, 8, 139, 0, 139, 139, + 111, 115, 119, 123, 127, 131, 134 + } ; + +static yyconst flex_int32_t yy_def[78] = + { 0, + 71, 71, 72, 72, 71, 5, 73, 73, 70, 70, + 70, 70, 74, 70, 70, 70, 70, 70, 70, 70, + 75, 70, 70, 76, 76, 76, 77, 76, 70, 74, + 70, 70, 70, 70, 70, 70, 70, 75, 70, 76, + 77, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 0, + 70, 70, 70, 70, 70, 70, 70 + } ; + +static yyconst flex_int32_t yy_nxt[171] = + { 0, + 70, 11, 12, 11, 13, 70, 14, 40, 40, 15, + 70, 70, 34, 30, 40, 40, 16, 70, 70, 17, + 30, 18, 70, 35, 19, 70, 70, 69, 68, 67, + 20, 11, 12, 11, 13, 66, 14, 65, 64, 15, + 63, 62, 61, 60, 59, 58, 16, 57, 56, 17, + 55, 18, 54, 53, 19, 52, 51, 50, 49, 48, + 20, 11, 12, 11, 13, 10, 14, 11, 12, 11, + 13, 10, 14, 11, 12, 11, 13, 47, 14, 22, + 46, 45, 44, 43, 42, 39, 37, 36, 33, 32, + 31, 70, 70, 70, 23, 25, 26, 25, 27, 70, + + 28, 70, 29, 25, 26, 25, 27, 70, 28, 70, + 29, 10, 10, 10, 10, 21, 21, 21, 21, 24, + 24, 24, 24, 30, 30, 70, 30, 38, 70, 70, + 38, 40, 40, 40, 41, 41, 41, 41, 9, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70 + } ; + +static yyconst flex_int32_t yy_chk[171] = + { 0, + 0, 1, 1, 1, 1, 0, 1, 27, 27, 1, + 0, 0, 18, 27, 41, 41, 1, 0, 0, 1, + 41, 1, 0, 18, 1, 0, 0, 68, 66, 65, + 1, 2, 2, 2, 2, 63, 2, 61, 59, 2, + 58, 57, 56, 54, 53, 52, 2, 51, 50, 2, + 49, 2, 47, 46, 2, 45, 44, 43, 42, 37, + 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, + 4, 4, 4, 5, 5, 5, 5, 36, 5, 5, + 35, 34, 33, 32, 31, 23, 20, 19, 17, 16, + 15, 9, 0, 0, 5, 7, 7, 7, 7, 0, + + 7, 0, 7, 8, 8, 8, 8, 0, 8, 0, + 8, 71, 71, 71, 71, 72, 72, 72, 72, 73, + 73, 73, 73, 74, 74, 0, 74, 75, 0, 0, + 75, 76, 76, 76, 77, 77, 77, 77, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int gregorio_vowel_rulefile__flex_debug; +int gregorio_vowel_rulefile__flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *gregorio_vowel_rulefile_text; +#line 1 "vowel/vowel-rules.l" +#line 2 "vowel/vowel-rules.l" +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the vowel rule lexer. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "struct.h" +#include "messages.h" +#include "support.h" + +#include "vowel.h" + +#include "vowel-rules.h" +#include "vowel-rules-y.h" + +#define YY_NO_INPUT + +static __inline void save_lval(void) +{ + gregorio_vowel_rulefile_lval = + gregorio_malloc((gregorio_vowel_rulefile_leng + 1) * sizeof(char)); + strncpy(gregorio_vowel_rulefile_lval, gregorio_vowel_rulefile_text, + gregorio_vowel_rulefile_leng); + gregorio_vowel_rulefile_lval[gregorio_vowel_rulefile_leng] = '\0'; +} + +static __inline void invalid(void) +{ + gregorio_messagef("gregorio_vowel_rulefile_lex", VERBOSITY_WARNING, 0, + _("invalid character in vowel file: %c"), + *gregorio_vowel_rulefile_text); +} + + + +#line 587 "vowel/vowel-rules-l.c" + +#define INITIAL 0 +#define chars 1 +#define lang 2 +#define langname 3 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int gregorio_vowel_rulefile_lex_destroy (void ); + +int gregorio_vowel_rulefile_get_debug (void ); + +void gregorio_vowel_rulefile_set_debug (int debug_flag ); + +YY_EXTRA_TYPE gregorio_vowel_rulefile_get_extra (void ); + +void gregorio_vowel_rulefile_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *gregorio_vowel_rulefile_get_in (void ); + +void gregorio_vowel_rulefile_set_in (FILE * in_str ); + +FILE *gregorio_vowel_rulefile_get_out (void ); + +void gregorio_vowel_rulefile_set_out (FILE * out_str ); + +yy_size_t gregorio_vowel_rulefile_get_leng (void ); + +char *gregorio_vowel_rulefile_get_text (void ); + +int gregorio_vowel_rulefile_get_lineno (void ); + +void gregorio_vowel_rulefile_set_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int gregorio_vowel_rulefile_wrap (void ); +#else +extern int gregorio_vowel_rulefile_wrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + + static int yy_start_stack_ptr = 0; + static int yy_start_stack_depth = 0; + static int *yy_start_stack = NULL; + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( gregorio_vowel_rulefile_text, gregorio_vowel_rulefile_leng, 1, gregorio_vowel_rulefile_out )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( gregorio_vowel_rulefile_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( gregorio_vowel_rulefile_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, gregorio_vowel_rulefile_in))==0 && ferror(gregorio_vowel_rulefile_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(gregorio_vowel_rulefile_in); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int gregorio_vowel_rulefile_lex (void); + +#define YY_DECL int gregorio_vowel_rulefile_lex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after gregorio_vowel_rulefile_text and gregorio_vowel_rulefile_leng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! gregorio_vowel_rulefile_in ) + gregorio_vowel_rulefile_in = stdin; + + if ( ! gregorio_vowel_rulefile_out ) + gregorio_vowel_rulefile_out = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + gregorio_vowel_rulefile_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gregorio_vowel_rulefile__create_buffer(gregorio_vowel_rulefile_in,YY_BUF_SIZE ); + } + + gregorio_vowel_rulefile__load_buffer_state( ); + } + + { +#line 75 "vowel/vowel-rules.l" + + +#line 804 "vowel/vowel-rules-l.c" + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of gregorio_vowel_rulefile_text. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 71 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 139 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 77 "vowel/vowel-rules.l" +{ BEGIN(lang); return LANGUAGE; } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 78 "vowel/vowel-rules.l" +{ BEGIN(chars); return VOWEL; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 79 "vowel/vowel-rules.l" +{ BEGIN(chars); return PREFIX; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 80 "vowel/vowel-rules.l" +{ BEGIN(chars); return SUFFIX; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 81 "vowel/vowel-rules.l" +{ BEGIN(chars); return SECONDARY; } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 82 "vowel/vowel-rules.l" +{ BEGIN(lang); return ALIAS; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 83 "vowel/vowel-rules.l" +{ BEGIN(INITIAL); return SEMICOLON; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 84 "vowel/vowel-rules.l" +{ return TO; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 85 "vowel/vowel-rules.l" +{ BEGIN(langname); } + YY_BREAK +case 10: +/* rule 10 can match eol */ +YY_RULE_SETUP +#line 86 "vowel/vowel-rules.l" +{ save_lval(); return NAME; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 87 "vowel/vowel-rules.l" +{ BEGIN(lang); } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 88 "vowel/vowel-rules.l" +{ save_lval(); return CHARACTERS; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 89 "vowel/vowel-rules.l" +{ } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 90 "vowel/vowel-rules.l" +{ } + YY_BREAK +case 15: +/* rule 15 can match eol */ +YY_RULE_SETUP +#line 91 "vowel/vowel-rules.l" +{ } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 92 "vowel/vowel-rules.l" +{ invalid(); return INVALID; } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 94 "vowel/vowel-rules.l" +ECHO; + YY_BREAK +#line 948 "vowel/vowel-rules-l.c" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(chars): +case YY_STATE_EOF(lang): +case YY_STATE_EOF(langname): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed gregorio_vowel_rulefile_in at a new source and called + * gregorio_vowel_rulefile_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = gregorio_vowel_rulefile_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( gregorio_vowel_rulefile_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * gregorio_vowel_rulefile_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of gregorio_vowel_rulefile_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + gregorio_vowel_rulefile_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + gregorio_vowel_rulefile_restart(gregorio_vowel_rulefile_in ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gregorio_vowel_rulefile_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 71 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 71 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 70); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + gregorio_vowel_rulefile_restart(gregorio_vowel_rulefile_in ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( gregorio_vowel_rulefile_wrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve gregorio_vowel_rulefile_text */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void gregorio_vowel_rulefile_restart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + gregorio_vowel_rulefile_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gregorio_vowel_rulefile__create_buffer(gregorio_vowel_rulefile_in,YY_BUF_SIZE ); + } + + gregorio_vowel_rulefile__init_buffer(YY_CURRENT_BUFFER,input_file ); + gregorio_vowel_rulefile__load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void gregorio_vowel_rulefile__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * gregorio_vowel_rulefile_pop_buffer_state(); + * gregorio_vowel_rulefile_push_buffer_state(new_buffer); + */ + gregorio_vowel_rulefile_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + gregorio_vowel_rulefile__load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (gregorio_vowel_rulefile_wrap()) processing, but the only time this flag + * is looked at is after gregorio_vowel_rulefile_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void gregorio_vowel_rulefile__load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + gregorio_vowel_rulefile_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE gregorio_vowel_rulefile__create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) gregorio_vowel_rulefile_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gregorio_vowel_rulefile__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) gregorio_vowel_rulefile_alloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in gregorio_vowel_rulefile__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + gregorio_vowel_rulefile__init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with gregorio_vowel_rulefile__create_buffer() + * + */ + void gregorio_vowel_rulefile__delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + gregorio_vowel_rulefile_free((void *) b->yy_ch_buf ); + + gregorio_vowel_rulefile_free((void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a gregorio_vowel_rulefile_restart() or at EOF. + */ + static void gregorio_vowel_rulefile__init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + gregorio_vowel_rulefile__flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then gregorio_vowel_rulefile__init_buffer was _probably_ + * called from gregorio_vowel_rulefile_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void gregorio_vowel_rulefile__flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + gregorio_vowel_rulefile__load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void gregorio_vowel_rulefile_push_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + gregorio_vowel_rulefile_ensure_buffer_stack(); + + /* This block is copied from gregorio_vowel_rulefile__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from gregorio_vowel_rulefile__switch_to_buffer. */ + gregorio_vowel_rulefile__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void gregorio_vowel_rulefile_pop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + gregorio_vowel_rulefile__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + gregorio_vowel_rulefile__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void gregorio_vowel_rulefile_ensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)gregorio_vowel_rulefile_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gregorio_vowel_rulefile_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)gregorio_vowel_rulefile_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gregorio_vowel_rulefile_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE gregorio_vowel_rulefile__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) gregorio_vowel_rulefile_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gregorio_vowel_rulefile__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + gregorio_vowel_rulefile__switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to gregorio_vowel_rulefile_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * gregorio_vowel_rulefile__scan_bytes() instead. + */ +YY_BUFFER_STATE gregorio_vowel_rulefile__scan_string (yyconst char * yystr ) +{ + + return gregorio_vowel_rulefile__scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to gregorio_vowel_rulefile_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE gregorio_vowel_rulefile__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + yy_size_t i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) gregorio_vowel_rulefile_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in gregorio_vowel_rulefile__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = gregorio_vowel_rulefile__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in gregorio_vowel_rulefile__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up gregorio_vowel_rulefile_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + gregorio_vowel_rulefile_text[gregorio_vowel_rulefile_leng] = (yy_hold_char); \ + (yy_c_buf_p) = gregorio_vowel_rulefile_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + gregorio_vowel_rulefile_leng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int gregorio_vowel_rulefile_get_lineno (void) +{ + + return gregorio_vowel_rulefile_lineno; +} + +/** Get the input stream. + * + */ +FILE *gregorio_vowel_rulefile_get_in (void) +{ + return gregorio_vowel_rulefile_in; +} + +/** Get the output stream. + * + */ +FILE *gregorio_vowel_rulefile_get_out (void) +{ + return gregorio_vowel_rulefile_out; +} + +/** Get the length of the current token. + * + */ +yy_size_t gregorio_vowel_rulefile_get_leng (void) +{ + return gregorio_vowel_rulefile_leng; +} + +/** Get the current token. + * + */ + +char *gregorio_vowel_rulefile_get_text (void) +{ + return gregorio_vowel_rulefile_text; +} + +/** Set the current line number. + * @param line_number + * + */ +void gregorio_vowel_rulefile_set_lineno (int line_number ) +{ + + gregorio_vowel_rulefile_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see gregorio_vowel_rulefile__switch_to_buffer + */ +void gregorio_vowel_rulefile_set_in (FILE * in_str ) +{ + gregorio_vowel_rulefile_in = in_str ; +} + +void gregorio_vowel_rulefile_set_out (FILE * out_str ) +{ + gregorio_vowel_rulefile_out = out_str ; +} + +int gregorio_vowel_rulefile_get_debug (void) +{ + return gregorio_vowel_rulefile__flex_debug; +} + +void gregorio_vowel_rulefile_set_debug (int bdebug ) +{ + gregorio_vowel_rulefile__flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from gregorio_vowel_rulefile_lex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + + (yy_start_stack_ptr) = 0; + (yy_start_stack_depth) = 0; + (yy_start_stack) = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + gregorio_vowel_rulefile_in = stdin; + gregorio_vowel_rulefile_out = stdout; +#else + gregorio_vowel_rulefile_in = (FILE *) 0; + gregorio_vowel_rulefile_out = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * gregorio_vowel_rulefile_lex_init() + */ + return 0; +} + +/* gregorio_vowel_rulefile_lex_destroy is for both reentrant and non-reentrant scanners. */ +int gregorio_vowel_rulefile_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + gregorio_vowel_rulefile__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + gregorio_vowel_rulefile_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + gregorio_vowel_rulefile_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Destroy the start condition stack. */ + gregorio_vowel_rulefile_free((yy_start_stack) ); + (yy_start_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * gregorio_vowel_rulefile_lex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *gregorio_vowel_rulefile_alloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *gregorio_vowel_rulefile_realloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void gregorio_vowel_rulefile_free (void * ptr ) +{ + free( (char *) ptr ); /* see gregorio_vowel_rulefile_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 94 "vowel/vowel-rules.l" + + + + diff --git a/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-l.h b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-l.h new file mode 100644 index 00000000000..fba97f32dbd --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-l.h @@ -0,0 +1,325 @@ +#ifndef gregorio_vowel_rulefile_HEADER_H +#define gregorio_vowel_rulefile_HEADER_H 1 +#define gregorio_vowel_rulefile_IN_HEADER 1 + +#line 6 "vowel/vowel-rules-l.h" + +#line 8 "vowel/vowel-rules-l.h" + +#define YY_INT_ALIGNED long int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 39 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t gregorio_vowel_rulefile_leng; + +extern FILE *gregorio_vowel_rulefile_in, *gregorio_vowel_rulefile_out; + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +void gregorio_vowel_rulefile_restart (FILE *input_file ); +void gregorio_vowel_rulefile__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE gregorio_vowel_rulefile__create_buffer (FILE *file,int size ); +void gregorio_vowel_rulefile__delete_buffer (YY_BUFFER_STATE b ); +void gregorio_vowel_rulefile__flush_buffer (YY_BUFFER_STATE b ); +void gregorio_vowel_rulefile_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void gregorio_vowel_rulefile_pop_buffer_state (void ); + +YY_BUFFER_STATE gregorio_vowel_rulefile__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE gregorio_vowel_rulefile__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE gregorio_vowel_rulefile__scan_bytes (yyconst char *bytes,yy_size_t len ); + +void *gregorio_vowel_rulefile_alloc (yy_size_t ); +void *gregorio_vowel_rulefile_realloc (void *,yy_size_t ); +void gregorio_vowel_rulefile_free (void * ); + +/* Begin user sect3 */ + +#define gregorio_vowel_rulefile_wrap() 1 +#define YY_SKIP_YYWRAP + +extern int gregorio_vowel_rulefile_lineno; + +extern char *gregorio_vowel_rulefile_text; +#define yytext_ptr gregorio_vowel_rulefile_text + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 +#define chars 1 +#define lang 2 +#define langname 3 + +#endif + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int gregorio_vowel_rulefile_lex_destroy (void ); + +int gregorio_vowel_rulefile_get_debug (void ); + +void gregorio_vowel_rulefile_set_debug (int debug_flag ); + +YY_EXTRA_TYPE gregorio_vowel_rulefile_get_extra (void ); + +void gregorio_vowel_rulefile_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *gregorio_vowel_rulefile_get_in (void ); + +void gregorio_vowel_rulefile_set_in (FILE * in_str ); + +FILE *gregorio_vowel_rulefile_get_out (void ); + +void gregorio_vowel_rulefile_set_out (FILE * out_str ); + +yy_size_t gregorio_vowel_rulefile_get_leng (void ); + +char *gregorio_vowel_rulefile_get_text (void ); + +int gregorio_vowel_rulefile_get_lineno (void ); + +void gregorio_vowel_rulefile_set_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int gregorio_vowel_rulefile_wrap (void ); +#else +extern int gregorio_vowel_rulefile_wrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int gregorio_vowel_rulefile_lex (void); + +#define YY_DECL int gregorio_vowel_rulefile_lex (void) +#endif /* !YY_DECL */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#line 94 "vowel/vowel-rules.l" + + +#line 324 "vowel/vowel-rules-l.h" +#undef gregorio_vowel_rulefile_IN_HEADER +#endif /* gregorio_vowel_rulefile_HEADER_H */ diff --git a/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-y.c b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-y.c new file mode 100644 index 00000000000..3675fadf4c0 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-y.c @@ -0,0 +1,1609 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + +/* Substitute the variable and function names. */ +#define yyparse gregorio_vowel_rulefile_parse +#define yylex gregorio_vowel_rulefile_lex +#define yyerror gregorio_vowel_rulefile_error +#define yydebug gregorio_vowel_rulefile_debug +#define yynerrs gregorio_vowel_rulefile_nerrs + +#define yylval gregorio_vowel_rulefile_lval +#define yychar gregorio_vowel_rulefile_char + +/* Copy the first part of user declarations. */ +#line 1 "vowel/vowel-rules.y" /* yacc.c:339 */ + +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the vowel rule parser. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> +#include "bool.h" +#include "struct.h" +#include "unicode.h" +#include "messages.h" + +#include "vowel.h" + +#include "vowel-rules.h" +#include "vowel-rules-l.h" + +#if ! defined lint || defined __GNUC__ +# define IGNORE(e) ((void) (e)) +#else +# define IGNORE(e) /* empty */ +#endif + +/* NOTE: This parser might allocate a new value for language; this value MUST + * BE FREED after the parser returns (if the value of the language pointer + * changes, then free the pointer). This parser DOES free the language + * pointer before changing it, if status points to RFPS_ALIASED. */ + +/* uncomment it if you want to have an interactive shell to understand the + * details on how bison works for a certain input */ +/*int gregorio_vowel_rulefile_debug=1;*/ + +static void gregorio_vowel_rulefile_error(const char *const filename, + char **const language, rulefile_parse_status *const status, + const char *const error_str) +{ + IGNORE(language); + IGNORE(status); + gregorio_messagef("gregorio_vowel_rulefile_parse", VERBOSITY_ERROR, 0, + _("%s: %s"), filename, error_str); +} + +/* this returns false until the language *after* the desired language */ +static __inline bool match_language(char **language, + rulefile_parse_status *status, char *const name) +{ + if (*status == RFPS_FOUND) { + free(name); + return true; + } + + if (strcmp(*language, name) == 0) { + *status = RFPS_FOUND; + } + + free(name); + return false; +} + +static __inline void alias(char **const language, + rulefile_parse_status *const status, char *const name, + char *const target) +{ + if (strcmp(*language, name) == 0) { + gregorio_messagef("alias", VERBOSITY_INFO, 0, _("Aliasing %s to %s"), + name, target); + if (*status == RFPS_ALIASED) { + free(*language); + } + *language = target; + *status = RFPS_ALIASED; + } else { + free(target); + } + free(name); +} + +static __inline void add(const rulefile_parse_status *const status, + void (*const fn)(const char *), char *const value) +{ + if (*status == RFPS_FOUND) { + fn(value); + } + free(value); +} + +#define _MATCH(NAME) if (match_language(language, status, NAME)) YYACCEPT +#define _ALIAS(NAME, TARGET) alias(language, status, NAME, TARGET) +#define _ADD(TABLE, CHARS) add(status, gregorio_##TABLE##_table_add, CHARS) + + +#line 184 "vowel/vowel-rules-y.c" /* yacc.c:339 */ + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* In a future release of Bison, this section will be replaced + by #include "vowel-rules-y.h". */ +#ifndef YY_GREGORIO_VOWEL_RULEFILE_VOWEL_VOWEL_RULES_Y_H_INCLUDED +# define YY_GREGORIO_VOWEL_RULEFILE_VOWEL_VOWEL_RULES_Y_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int gregorio_vowel_rulefile_debug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + LANGUAGE = 258, + VOWEL = 259, + PREFIX = 260, + SUFFIX = 261, + SECONDARY = 262, + ALIAS = 263, + SEMICOLON = 264, + TO = 265, + NAME = 266, + CHARACTERS = 267, + INVALID = 268 + }; +#endif +/* Tokens. */ +#define LANGUAGE 258 +#define VOWEL 259 +#define PREFIX 260 +#define SUFFIX 261 +#define SECONDARY 262 +#define ALIAS 263 +#define SEMICOLON 264 +#define TO 265 +#define NAME 266 +#define CHARACTERS 267 +#define INVALID 268 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE gregorio_vowel_rulefile_lval; + +int gregorio_vowel_rulefile_parse (const char *const filename, char **language, rulefile_parse_status *const status); + +#endif /* !YY_GREGORIO_VOWEL_RULEFILE_VOWEL_VOWEL_RULES_Y_H_INCLUDED */ + +/* Copy the second part of user declarations. */ + +#line 261 "vowel/vowel-rules-y.c" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 2 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 21 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 14 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 7 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 17 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 28 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 268 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint8 yyrline[] = +{ + 0, 121, 121, 123, 127, 128, 129, 130, 131, 132, + 135, 137, 140, 142, 145, 147, 150, 152 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "LANGUAGE", "VOWEL", "PREFIX", "SUFFIX", + "SECONDARY", "ALIAS", "SEMICOLON", "TO", "NAME", "CHARACTERS", "INVALID", + "$accept", "rules", "rule", "vowels", "prefixes", "suffixes", + "secondaries", YY_NULLPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268 +}; +# endif + +#define YYPACT_NINF -11 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-11))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int8 yypact[] = +{ + -11, 0, -11, -10, -11, -11, -11, -11, -9, -11, + 8, 1, 2, 3, 7, -1, -11, -11, -11, -11, + -11, -11, -11, -11, -11, 9, 12, -11 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 0, 1, 0, 10, 12, 14, 16, 0, 3, + 0, 0, 0, 0, 0, 0, 4, 6, 11, 7, + 13, 8, 15, 9, 17, 0, 0, 5 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -11, -11, -11, -11, -11, -11, -11 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 1, 9, 11, 12, 13, 14 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint8 yytable[] = +{ + 2, 10, 15, 3, 4, 5, 6, 7, 8, 25, + 17, 19, 21, 18, 20, 22, 23, 16, 0, 24, + 26, 27 +}; + +static const yytype_int8 yycheck[] = +{ + 0, 11, 11, 3, 4, 5, 6, 7, 8, 10, + 9, 9, 9, 12, 12, 12, 9, 9, -1, 12, + 11, 9 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 15, 0, 3, 4, 5, 6, 7, 8, 16, + 11, 17, 18, 19, 20, 11, 9, 9, 12, 9, + 12, 9, 12, 9, 12, 10, 11, 9 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 14, 15, 15, 16, 16, 16, 16, 16, 16, + 17, 17, 18, 18, 19, 19, 20, 20 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 2, 3, 5, 3, 3, 3, 3, + 0, 2, 0, 2, 0, 2, 0, 2 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (filename, language, status, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, filename, language, status); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, const char *const filename, char **language, rulefile_parse_status *const status) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (filename); + YYUSE (language); + YYUSE (status); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, const char *const filename, char **language, rulefile_parse_status *const status) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep, filename, language, status); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, const char *const filename, char **language, rulefile_parse_status *const status) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , filename, language, status); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule, filename, language, status); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, const char *const filename, char **language, rulefile_parse_status *const status) +{ + YYUSE (yyvaluep); + YYUSE (filename); + YYUSE (language); + YYUSE (status); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (const char *const filename, char **language, rulefile_parse_status *const status) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: +#line 127 "vowel/vowel-rules.y" /* yacc.c:1646 */ + { _MATCH((yyvsp[-1])); } +#line 1349 "vowel/vowel-rules-y.c" /* yacc.c:1646 */ + break; + + case 5: +#line 128 "vowel/vowel-rules.y" /* yacc.c:1646 */ + { _ALIAS((yyvsp[-3]), (yyvsp[-1])); } +#line 1355 "vowel/vowel-rules-y.c" /* yacc.c:1646 */ + break; + + case 11: +#line 137 "vowel/vowel-rules.y" /* yacc.c:1646 */ + { _ADD(vowel, (yyvsp[0])); } +#line 1361 "vowel/vowel-rules-y.c" /* yacc.c:1646 */ + break; + + case 13: +#line 142 "vowel/vowel-rules.y" /* yacc.c:1646 */ + { _ADD(prefix, (yyvsp[0])); } +#line 1367 "vowel/vowel-rules-y.c" /* yacc.c:1646 */ + break; + + case 15: +#line 147 "vowel/vowel-rules.y" /* yacc.c:1646 */ + { _ADD(suffix, (yyvsp[0])); } +#line 1373 "vowel/vowel-rules-y.c" /* yacc.c:1646 */ + break; + + case 17: +#line 152 "vowel/vowel-rules.y" /* yacc.c:1646 */ + { _ADD(secondary, (yyvsp[0])); } +#line 1379 "vowel/vowel-rules-y.c" /* yacc.c:1646 */ + break; + + +#line 1383 "vowel/vowel-rules-y.c" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (filename, language, status, YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (filename, language, status, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, filename, language, status); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp, filename, language, status); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (filename, language, status, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, filename, language, status); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, filename, language, status); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-y.h b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-y.h new file mode 100644 index 00000000000..df47b6e2d5a --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules-y.h @@ -0,0 +1,86 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef YY_GREGORIO_VOWEL_RULEFILE_VOWEL_VOWEL_RULES_Y_H_INCLUDED +# define YY_GREGORIO_VOWEL_RULEFILE_VOWEL_VOWEL_RULES_Y_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int gregorio_vowel_rulefile_debug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + LANGUAGE = 258, + VOWEL = 259, + PREFIX = 260, + SUFFIX = 261, + SECONDARY = 262, + ALIAS = 263, + SEMICOLON = 264, + TO = 265, + NAME = 266, + CHARACTERS = 267, + INVALID = 268 + }; +#endif +/* Tokens. */ +#define LANGUAGE 258 +#define VOWEL 259 +#define PREFIX 260 +#define SUFFIX 261 +#define SECONDARY 262 +#define ALIAS 263 +#define SEMICOLON 264 +#define TO 265 +#define NAME 266 +#define CHARACTERS 267 +#define INVALID 268 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE gregorio_vowel_rulefile_lval; + +int gregorio_vowel_rulefile_parse (const char *const filename, char **language, rulefile_parse_status *const status); + +#endif /* !YY_GREGORIO_VOWEL_RULEFILE_VOWEL_VOWEL_RULES_Y_H_INCLUDED */ diff --git a/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules.h b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules.h new file mode 100644 index 00000000000..bf99696e538 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules.h @@ -0,0 +1,28 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header shares definitions between the vowel parser and lexer. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#define YYSTYPE char * +#define YYSTYPE_IS_DECLARED 1 + +int gregorio_vowel_rulefile_lex(void); +#define YY_DECL int gregorio_vowel_rulefile_lex(void) + diff --git a/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules.l b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules.l new file mode 100644 index 00000000000..72a04b2e0a6 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules.l @@ -0,0 +1,95 @@ +%{ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the vowel rule lexer. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "struct.h" +#include "messages.h" +#include "support.h" + +#include "vowel.h" + +#include "vowel-rules.h" +#include "vowel-rules-y.h" + +#define YY_NO_INPUT + +static __inline void save_lval(void) +{ + gregorio_vowel_rulefile_lval = + gregorio_malloc((gregorio_vowel_rulefile_leng + 1) * sizeof(char)); + strncpy(gregorio_vowel_rulefile_lval, gregorio_vowel_rulefile_text, + gregorio_vowel_rulefile_leng); + gregorio_vowel_rulefile_lval[gregorio_vowel_rulefile_leng] = '\0'; +} + +static __inline void invalid(void) +{ + gregorio_messagef("gregorio_vowel_rulefile_lex", VERBOSITY_WARNING, 0, + _("invalid character in vowel file: %c"), + *gregorio_vowel_rulefile_text); +} +%} + +%x chars +%x lang +%x langname + +%option stack +%option pointer +%option nounput +%option noyy_push_state +%option noyy_pop_state +%option noyy_top_state +%option align +%option noread +%option nomain +%option noalways-interactive +%option nonever-interactive +%option prefix="gregorio_vowel_rulefile_" +%option noyywrap +%option 8bit + +%% + +<INITIAL>language { BEGIN(lang); return LANGUAGE; } +<INITIAL>vowel { BEGIN(chars); return VOWEL; } +<INITIAL>prefix { BEGIN(chars); return PREFIX; } +<INITIAL>suffix { BEGIN(chars); return SUFFIX; } +<INITIAL>secondary { BEGIN(chars); return SECONDARY; } +<INITIAL>alias { BEGIN(lang); return ALIAS; } +<*>; { BEGIN(INITIAL); return SEMICOLON; } +<lang>to { return TO; } +<lang>"[" { BEGIN(langname); } +<langname>[^\]]+ { save_lval(); return NAME; } +<langname>"]" { BEGIN(lang); } +<chars>[^;,# \t\n\r\v\f]+ { save_lval(); return CHARACTERS; } +<*>#[^\n\r]* { } +<INITIAL>\xEF\xBB\xBF { } +<*>[\ \t\n\r\v\f] { } +<*>. { invalid(); return INVALID; } + +%% + diff --git a/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules.y b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules.y new file mode 100644 index 00000000000..236fa2293c7 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel-rules.y @@ -0,0 +1,153 @@ +%{ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements the vowel rule parser. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> +#include "bool.h" +#include "struct.h" +#include "unicode.h" +#include "messages.h" + +#include "vowel.h" + +#include "vowel-rules.h" +#include "vowel-rules-l.h" + +#if ! defined lint || defined __GNUC__ +# define IGNORE(e) ((void) (e)) +#else +# define IGNORE(e) /* empty */ +#endif + +/* NOTE: This parser might allocate a new value for language; this value MUST + * BE FREED after the parser returns (if the value of the language pointer + * changes, then free the pointer). This parser DOES free the language + * pointer before changing it, if status points to RFPS_ALIASED. */ + +/* uncomment it if you want to have an interactive shell to understand the + * details on how bison works for a certain input */ +/*int gregorio_vowel_rulefile_debug=1;*/ + +static void gregorio_vowel_rulefile_error(const char *const filename, + char **const language, rulefile_parse_status *const status, + const char *const error_str) +{ + IGNORE(language); + IGNORE(status); + gregorio_messagef("gregorio_vowel_rulefile_parse", VERBOSITY_ERROR, 0, + _("%s: %s"), filename, error_str); +} + +/* this returns false until the language *after* the desired language */ +static __inline bool match_language(char **language, + rulefile_parse_status *status, char *const name) +{ + if (*status == RFPS_FOUND) { + free(name); + return true; + } + + if (strcmp(*language, name) == 0) { + *status = RFPS_FOUND; + } + + free(name); + return false; +} + +static __inline void alias(char **const language, + rulefile_parse_status *const status, char *const name, + char *const target) +{ + if (strcmp(*language, name) == 0) { + gregorio_messagef("alias", VERBOSITY_INFO, 0, _("Aliasing %s to %s"), + name, target); + if (*status == RFPS_ALIASED) { + free(*language); + } + *language = target; + *status = RFPS_ALIASED; + } else { + free(target); + } + free(name); +} + +static __inline void add(const rulefile_parse_status *const status, + void (*const fn)(const char *), char *const value) +{ + if (*status == RFPS_FOUND) { + fn(value); + } + free(value); +} + +#define _MATCH(NAME) if (match_language(language, status, NAME)) YYACCEPT +#define _ALIAS(NAME, TARGET) alias(language, status, NAME, TARGET) +#define _ADD(TABLE, CHARS) add(status, gregorio_##TABLE##_table_add, CHARS) + +%} + +%name-prefix "gregorio_vowel_rulefile_" +%parse-param { const char *const filename } +%parse-param { char **language } +%parse-param { rulefile_parse_status *const status } + +%token LANGUAGE VOWEL PREFIX SUFFIX SECONDARY ALIAS SEMICOLON TO +%token NAME CHARACTERS INVALID + +%% + +rules + : + | rules rule + ; + +rule + : LANGUAGE NAME SEMICOLON { _MATCH($2); } + | ALIAS NAME TO NAME SEMICOLON { _ALIAS($2, $4); } + | VOWEL vowels SEMICOLON + | PREFIX prefixes SEMICOLON + | SUFFIX suffixes SEMICOLON + | SECONDARY secondaries SEMICOLON + ; + +vowels + : + | vowels CHARACTERS { _ADD(vowel, $2); } + ; + +prefixes + : + | prefixes CHARACTERS { _ADD(prefix, $2); } + ; + +suffixes + : + | suffixes CHARACTERS { _ADD(suffix, $2); } + ; + +secondaries + : + | secondaries CHARACTERS { _ADD(secondary, $2); } + ; diff --git a/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel.c b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel.c new file mode 100644 index 00000000000..b4843cf2a3c --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel.c @@ -0,0 +1,443 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This file implements vowel rule handling (aside from parsing). + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <errno.h> +#ifdef USE_KPSE + #include <kpathsea/kpathsea.h> +#endif +#include "bool.h" +#include "vowel.h" +#include "unicode.h" +#include "messages.h" +#include "support.h" + +typedef struct character_set { + grewchar *table; + struct character_set **next; + grewchar mask; + unsigned int bins; + unsigned int size; + bool is_final; +} character_set; + +static character_set *character_set_new(const bool alloc_next) +{ + character_set *set = + (character_set *)gregorio_calloc(1, sizeof(character_set)); + set->mask = 0x0f; + set->bins = 16; + set->size = 0; + set->table = (grewchar *)gregorio_calloc(set->bins, sizeof(grewchar)); + if (alloc_next) { + set->next = (character_set **)gregorio_calloc(set->bins, + sizeof(character_set *)); + } + return set; +} + +static void character_set_free(character_set *const set); + +static __inline void character_set_next_elements_free(character_set *const set) +{ + unsigned int i; + assert(set && set->next); + for (i = 0; i < set->bins; ++i) { + if (set->next[i]) { + character_set_free(set->next[i]); + } + } +} + +static void character_set_free(character_set *const set) +{ + if (set) { + if (set->next) { + character_set_next_elements_free(set); + free(set->next); + } + free(set->table); + free(set); + } +} + +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 (index = ((unsigned long)vowel) & set->mask; set->table[index]; + index = (index + 1) & set->mask) { + if (set->table[index] == vowel) { + if (next && set->next) { + *next = set->next[index]; + } + return true; + } + } + return false; +} + +static __inline void character_set_put(character_set *const set, + const grewchar vowel, character_set *next) +{ + unsigned int index; + + assert(set); + + index = ((unsigned long)vowel) & set->mask; + while (set->table[index]) { + index = (index + 1) & set->mask; + } + + set->table[index] = vowel; + if (set->next) { + set->next[index] = next; + } +} + +static __inline void character_set_grow(character_set *const set) { + static grewchar *old_table; + static character_set **old_next; + unsigned int old_bins, i; + + assert(set); + + if (set->bins >= 0x4000L) { + gregorio_message(_("character set too large"), "character_set_grow", + VERBOSITY_FATAL, 0); + return; + } + + old_table = set->table; + old_next = set->next; + old_bins = set->bins; + + set->bins <<= 1; + set->mask = (set->mask << 1) | 0x01; + set->table = gregorio_calloc(set->bins, sizeof(grewchar)); + if (old_next) { + set->table = gregorio_calloc(set->bins, sizeof(character_set *)); + } + 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 { + assert(!old_next || !old_next[i]); + } + } + + free(old_table); + if (old_next) { + free(old_next); + } +} + +static character_set *character_set_add(character_set *const set, + const grewchar vowel) +{ + character_set *next = NULL; + + if (!character_set_contains(set, vowel, &next)) { + if (((++(set->size) * 10) / set->bins) >= 7) { + character_set_grow(set); + } + + if (set->next) { + next = character_set_new(true); + } + + character_set_put(set, vowel, next); + } + + return next; +} + +static __inline void character_set_clear(character_set *const set) +{ + if (set) { + memset(set->table, 0, set->bins * sizeof(grewchar)); + + if (set->next) { + character_set_next_elements_free(set); + memset(set->next, 0, set->bins * sizeof(character_set *)); + } + + set->size = 0; + } +} + +static character_set *vowel_table = NULL; +static character_set *prefix_table = NULL; +static character_set *suffix_table = NULL; +static character_set *secondary_table = NULL; +static grewchar *prefix_buffer = NULL; +static size_t prefix_buffer_size; +static size_t prefix_buffer_mask; + +extern FILE *gregorio_vowel_rulefile_in; + +static void prefix_buffer_grow(size_t required_size) +{ + while (required_size > prefix_buffer_size) { + prefix_buffer_size <<= 1; + prefix_buffer_mask = (prefix_buffer_mask << 1) | 0x01; + } + prefix_buffer = gregorio_realloc(prefix_buffer, + prefix_buffer_size * sizeof(grewchar)); +} + +void gregorio_vowel_tables_init(void) +{ + if (vowel_table) { + character_set_clear(vowel_table); + character_set_clear(prefix_table); + character_set_clear(suffix_table); + character_set_clear(secondary_table); + } else { + vowel_table = character_set_new(false); + prefix_table = character_set_new(true); + suffix_table = character_set_new(true); + secondary_table = character_set_new(true); + + prefix_buffer_size = 16; + prefix_buffer_mask = 0x0f; + prefix_buffer = (grewchar *)gregorio_malloc( + prefix_buffer_size * sizeof(grewchar)); + } +} + +void gregorio_vowel_tables_load(const char *const filename, + char **const language, rulefile_parse_status *status) +{ +#ifdef USE_KPSE + if (!kpse_in_name_ok(filename)) { + gregorio_messagef("gregorio_vowel_tables_load", VERBOSITY_WARNING, 0, + _("kpse disallows read from %s"), filename); + return; + } +#endif + gregorio_vowel_rulefile_in = fopen(filename, "r"); + if (gregorio_vowel_rulefile_in) { + gregorio_vowel_rulefile_parse(filename, language, status); + fclose(gregorio_vowel_rulefile_in); + gregorio_vowel_rulefile_in = NULL; + } else { + gregorio_messagef("gregorio_vowel_tables_load", VERBOSITY_WARNING, 0, + _("unable to open %s: %s"), filename, strerror(errno)); + } +} + +void gregorio_vowel_tables_free(void) +{ + if (vowel_table) { + character_set_free(vowel_table); + } + if (prefix_table) { + character_set_free(prefix_table); + } + if (suffix_table) { + character_set_free(suffix_table); + } + if (secondary_table) { + character_set_free(secondary_table); + } + if (prefix_buffer) { + free(prefix_buffer); + } +} + +void gregorio_vowel_table_add(const char *vowels) +{ + if (vowels) { + grewchar *str = gregorio_build_grewchar_string_from_buf(vowels), *p; + for (p = str; *p; ++p) { + character_set_add(vowel_table, *p); + } + free(str); + } +} + +void gregorio_prefix_table_add(const char *prefix) +{ + character_set *set = prefix_table; + grewchar *str, *p; + + /* store prefixes backwards */ + if (prefix && *prefix) { + str = gregorio_build_grewchar_string_from_buf(prefix); + p = str; + + while (*(++p)) ; + + while (p > str) { + set = character_set_add(set, *(--p)); + } + + set->is_final = true; + prefix_buffer_grow(gregorio_wcstrlen(str)); + free(str); + } +} + +void gregorio_suffix_table_add(const char *suffix) +{ + character_set *set = suffix_table; + grewchar *str, *p; + + if (suffix && *suffix) { + str = gregorio_build_grewchar_string_from_buf(suffix); + p = str; + + while (*p) { + set = character_set_add(set, *(p++)); + } + + set->is_final = true; + free(str); + } +} + +void gregorio_secondary_table_add(const char *secondary) +{ + character_set *set = secondary_table; + grewchar *str, *p; + + if (secondary && *secondary) { + str = gregorio_build_grewchar_string_from_buf(secondary); + p = str; + + while (*p) { + set = character_set_add(set, *(p++)); + } + + set->is_final = true; + free(str); + } +} + +typedef enum { + VWL_BEFORE = 0, + VWL_WITHIN, + VWL_SUFFIX +} vowel_group_state; + +static __inline bool is_in_prefix(size_t bufpos) { + character_set *previous = prefix_table, *prefix; + + while (character_set_contains(previous, prefix_buffer[bufpos], &prefix)) { + bufpos = (bufpos + prefix_buffer_size - 1) & prefix_buffer_mask; + previous = prefix; + } + + return previous->is_final; +} + +bool gregorio_find_vowel_group(const grewchar *const string, int *const start, + int *const end) +{ + size_t bufpos = 0; + vowel_group_state state = VWL_BEFORE; + character_set *cset = NULL; + const grewchar *subject; + int i; + + /* stick the 0 in here to avoid overruns from is_in_prefix */ + prefix_buffer[0] = 0; + + for (i = 0, subject = string; true; ++i, ++subject) { + switch (state) { + case VWL_BEFORE: + bufpos = (bufpos + 1) & prefix_buffer_mask; + prefix_buffer[bufpos] = *subject; + if (character_set_contains(vowel_table, *subject, NULL)) { + /* we found a vowel */ + if (!character_set_contains(vowel_table, *(subject + 1), NULL) + || !is_in_prefix(bufpos)) { + /* no vowel after or not in prefix, so this is the start */ + *start = i; + state = VWL_WITHIN; + } + } + break; + + case VWL_WITHIN: + if (!character_set_contains(vowel_table, *subject, NULL)) { + /* not a vowel; is it a suffix? */ + *end = i; + if (character_set_contains(suffix_table, *subject, &cset)) { + /* it's the start of a suffix */ + state = VWL_SUFFIX; + } else { + /* neither a vowel nor a suffix, so this is the end */ + return true; + } + } + break; + + case VWL_SUFFIX: + if (cset->is_final) { + /* remember the last final position */ + *end = i; + } + if (!character_set_contains(cset, *subject, &cset)) { + /* no longer in valid suffix */ + return true; + } + break; + + default: + assert(false); + } + + if (!*subject) { + break; + } + } + + /* no vowel found; look for a secondary */ + *end = -1; + for (*start = 0; *(subject = string + *start); ++ *start) { + for (cset = secondary_table, i = *start; + character_set_contains(cset, *subject, &cset); ++i, ++subject) { + if (cset->is_final) { + /* remember the last final position */ + *end = i + 1; + } + } + if (*end >= 0) { + return true; + } + } + + /* no center found */ + *start = -1; + return false; +} diff --git a/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel.h b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel.h new file mode 100644 index 00000000000..bd261c218e8 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-src/src/vowel/vowel.h @@ -0,0 +1,49 @@ +/* + * Gregorio is a program that translates gabc files to GregorioTeX + * This header prototypes the vowel handling data structures and entry points. + * + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _VOWEL_H +#define _VOWEL_H + +#include <stdio.h> +#include "bool.h" +#include "unicode.h" + +typedef enum rulefile_parse_status { + RFPS_NOT_FOUND = 0, + RFPS_FOUND, + RFPS_ALIASED +} rulefile_parse_status; + +int gregorio_vowel_rulefile_parse(const char *filename, char **language, + rulefile_parse_status *status); +int gregorio_vowel_rulefile_lex_destroy(void); +void gregorio_vowel_tables_init(void); +void gregorio_vowel_tables_load(const char *filename, char **language, + rulefile_parse_status *status); +void gregorio_vowel_tables_free(void); +void gregorio_vowel_table_add(const char *vowels); +void gregorio_prefix_table_add(const char *prefix); +void gregorio_suffix_table_add(const char *suffix); +void gregorio_secondary_table_add(const char *secondary); +bool gregorio_find_vowel_group(const grewchar *subject, int *start, int *end); + +#endif |