| 1 |
/* |
| 2 |
* Gregorio is a program that translates gabc files to GregorioTeX |
| 3 |
* This header defines the Gregorio data structures and functions. |
| 4 |
* |
| 5 |
* Copyright (C) 2006-2025 The Gregorio Project (see CONTRIBUTORS.md) |
| 6 |
* |
| 7 |
* This file is part of Gregorio. |
| 8 |
* |
| 9 |
* Gregorio is free software: you can redistribute it and/or modify |
| 10 |
* it under the terms of the GNU General Public License as published by |
| 11 |
* the Free Software Foundation, either version 3 of the License, or |
| 12 |
* (at your option) any later version. |
| 13 |
* |
| 14 |
* Gregorio is distributed in the hope that it will be useful, |
| 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
* GNU General Public License for more details. |
| 18 |
* |
| 19 |
* You should have received a copy of the GNU General Public License |
| 20 |
* along with Gregorio. If not, see <http://www.gnu.org/licenses/>. |
| 21 |
*/ |
| 22 |
|
| 23 |
/** |
| 24 |
* @file |
| 25 |
* The file starts by the definition of all the structures used in |
| 26 |
* gregorio. As it is certainly the most important file for |
| 27 |
* understanding, read it carefully. |
| 28 |
*/ |
| 29 |
|
| 30 |
#include "unicode.h" |
| 31 |
|
| 32 |
#ifndef STRUCT_H |
| 33 |
#define STRUCT_H |
| 34 |
|
| 35 |
#include <assert.h> |
| 36 |
#include "enum_generator.h" |
| 37 |
#include "bool.h" |
| 38 |
#include "sha1.h" |
| 39 |
#include "messages.h" |
| 40 |
|
| 41 |
#ifdef __cplusplus |
| 42 |
#define ENUM_BITFIELD(TYPE) enum TYPE |
| 43 |
#elif defined(__GNUC__) && __GNUC__ >= 2 |
| 44 |
#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE |
| 45 |
#else |
| 46 |
#define ENUM_BITFIELD(TYPE) unsigned int |
| 47 |
#endif |
| 48 |
|
| 49 |
/* Lilypond-compatible location counters */ |
| 50 |
typedef struct gregorio_scanner_location { |
| 51 |
/* - line is the 1-based line number |
| 52 |
* - column is the 0-based* column number, tabs expanded to 8-column stops |
| 53 |
* - offset is the 0-based number of characters from the start of the line |
| 54 |
* |
| 55 |
* * = column is calculated and stored as a 0-based number so the tabstop |
| 56 |
* math is simpler; it should be printed 1-based */ |
| 57 |
|
| 58 |
unsigned short first_line; |
| 59 |
unsigned short first_column; |
| 60 |
unsigned short first_offset; |
| 61 |
unsigned short last_line; |
| 62 |
unsigned short last_column; |
| 63 |
unsigned short last_offset; |
| 64 |
bool generate_point_and_click:1; |
| 65 |
} gregorio_scanner_location; |
| 66 |
|
| 67 |
/* all the different types of things a gregorio_* can be */ |
| 68 |
|
| 69 |
#define GREGORIO_TYPE(A,E,X,L) \ |
| 70 |
A(GRE_NOTE, 1) \ |
| 71 |
E(GRE_GLYPH) \ |
| 72 |
E(GRE_ELEMENT) \ |
| 73 |
E(GRE_CLEF) \ |
| 74 |
E(GRE_END_OF_LINE) \ |
| 75 |
E(GRE_SPACE) \ |
| 76 |
E(GRE_BAR) \ |
| 77 |
E(GRE_CUSTOS) \ |
| 78 |
E(GRE_MANUAL_CUSTOS) \ |
| 79 |
E(GRE_SUPPRESS_CUSTOS) \ |
| 80 |
/* I don't really know how I could use the a TEXVERB_NOTE in gregoriotex, |
| 81 |
* as we don't write note by note... */ \ |
| 82 |
/* GRE_TEXVERB_NOTE, */ \ |
| 83 |
E(GRE_TEXVERB_GLYPH) \ |
| 84 |
E(GRE_TEXVERB_ELEMENT) \ |
| 85 |
/* above lines text, quite the same as GRE_TEXVERB_ELEMENT, but counted |
| 86 |
* differently for the spaces above the lines */ \ |
| 87 |
E(GRE_ALT) \ |
| 88 |
E(GRE_NLBA) \ |
| 89 |
E(GRE_AUTOFUSE_START) \ |
| 90 |
L(GRE_AUTOFUSE_END) |
| 91 |
ENUM(gregorio_type, GREGORIO_TYPE); |
| 92 |
|
| 93 |
#define GREGORIO_CLEF(A,E,X,L) \ |
| 94 |
A(CLEF_C, 0) \ |
| 95 |
X(CLEF_F, 1) |
| 96 |
ENUM(gregorio_clef, GREGORIO_CLEF); |
| 97 |
|
| 98 |
/* the different shapes, only for notes */ |
| 99 |
|
| 100 |
#define GREGORIO_SHAPE(A,E,X,L) \ |
| 101 |
A(S_UNDETERMINED, 0) \ |
| 102 |
E(S_PUNCTUM) \ |
| 103 |
E(S_PUNCTUM_END_OF_GLYPH) \ |
| 104 |
E(S_PUNCTUM_INCLINATUM_ASCENDENS) \ |
| 105 |
E(S_PUNCTUM_INCLINATUM_STANS) \ |
| 106 |
E(S_PUNCTUM_INCLINATUM_DESCENDENS) \ |
| 107 |
E(S_PUNCTUM_INCLINATUM_DEMINUTUS) \ |
| 108 |
E(S_PUNCTUM_INCLINATUM_AUCTUS) \ |
| 109 |
E(S_VIRGA) \ |
| 110 |
E(S_VIRGA_REVERSA) \ |
| 111 |
E(S_BIVIRGA) \ |
| 112 |
E(S_TRIVIRGA) \ |
| 113 |
E(S_ORISCUS_ASCENDENS) \ |
| 114 |
E(S_ORISCUS_DESCENDENS) \ |
| 115 |
E(S_ORISCUS_DEMINUTUS) \ |
| 116 |
E(S_ORISCUS_SCAPUS_ASCENDENS) \ |
| 117 |
E(S_ORISCUS_SCAPUS_DESCENDENS) \ |
| 118 |
E(S_QUILISMA) \ |
| 119 |
E(S_STROPHA) \ |
| 120 |
E(S_STROPHA_AUCTA) \ |
| 121 |
E(S_DISTROPHA) \ |
| 122 |
E(S_TRISTROPHA) \ |
| 123 |
E(S_LINEA_PUNCTUM) \ |
| 124 |
E(S_FLAT) \ |
| 125 |
E(S_FLAT_PAREN) \ |
| 126 |
E(S_FLAT_SOFT) \ |
| 127 |
E(S_SHARP) \ |
| 128 |
E(S_SHARP_PAREN) \ |
| 129 |
E(S_SHARP_SOFT) \ |
| 130 |
E(S_NATURAL) \ |
| 131 |
E(S_NATURAL_PAREN) \ |
| 132 |
E(S_NATURAL_SOFT) \ |
| 133 |
/* special shapes that must not appear in the final form of the score : |
| 134 |
* quadratum is the shape of the first note of a punctum quadratum |
| 135 |
* and quilisma quadratum is the shape of the first note of a pes |
| 136 |
* quislisma quadratum */ \ |
| 137 |
E(S_ORISCUS_UNDETERMINED) \ |
| 138 |
E(S_ORISCUS_SCAPUS_UNDETERMINED) \ |
| 139 |
E(S_QUADRATUM) \ |
| 140 |
E(S_PUNCTUM_INCLINATUM_UNDETERMINED) \ |
| 141 |
/* those shapes are for now used only in gregoriotex */ \ |
| 142 |
E(S_QUILISMA_QUADRATUM) \ |
| 143 |
E(S_PUNCTUM_AUCTUS_ASCENDENS) \ |
| 144 |
E(S_PUNCTUM_AUCTUS_DESCENDENS) \ |
| 145 |
E(S_PUNCTUM_DEMINUTUS) \ |
| 146 |
L(S_LINEA) |
| 147 |
ENUM(gregorio_shape, GREGORIO_SHAPE); |
| 148 |
|
| 149 |
/* the different kind of bars */ |
| 150 |
|
| 151 |
#define GREGORIO_BAR(A,E,X,L) \ |
| 152 |
A(B_NO_BAR, 0) \ |
| 153 |
E(B_VIRGULA) \ |
| 154 |
E(B_DIVISIO_MINIMA) \ |
| 155 |
E(B_DIVISIO_MINOR) \ |
| 156 |
E(B_DIVISIO_MAIOR) \ |
| 157 |
E(B_DIVISIO_FINALIS) \ |
| 158 |
E(B_DIVISIO_MINOR_D1) \ |
| 159 |
E(B_DIVISIO_MINOR_D2) \ |
| 160 |
E(B_DIVISIO_MINOR_D3) \ |
| 161 |
E(B_DIVISIO_MINOR_D4) \ |
| 162 |
E(B_DIVISIO_MINOR_D5) \ |
| 163 |
E(B_DIVISIO_MINOR_D6) \ |
| 164 |
E(B_DIVISIO_MINOR_D7) \ |
| 165 |
E(B_DIVISIO_MINOR_D8) \ |
| 166 |
E(B_VIRGULA_HIGH) \ |
| 167 |
E(B_DIVISIO_MINIMA_HIGH) \ |
| 168 |
E(B_DIVISIO_MAIOR_DOTTED) \ |
| 169 |
E(B_DIVISIO_MINIMIS) \ |
| 170 |
E(B_DIVISIO_MINIMIS_HIGH) \ |
| 171 |
E(B_VIRGULA_PAREN) \ |
| 172 |
E(B_VIRGULA_PAREN_HIGH) \ |
| 173 |
E(B_DIVISIO_MINIMA_PAREN) \ |
| 174 |
L(B_DIVISIO_MINIMA_PAREN_HIGH) |
| 175 |
ENUM(gregorio_bar, GREGORIO_BAR); |
| 176 |
|
| 177 |
/* definition of the signs. You can notice that the values are made so |
| 178 |
* that if you wan to add a vertical episema to a note, you juste |
| 179 |
* make note->signs+=_V_EPISEMA, so please don't change the value as |
| 180 |
* this trick is used. */ |
| 181 |
|
| 182 |
#define GREGORIO_SIGN(A,E,X,L) \ |
| 183 |
A(_NO_SIGN, 0x00) \ |
| 184 |
A(_PUNCTUM_MORA, 0x01) \ |
| 185 |
A(_AUCTUM_DUPLEX, 0x02) \ |
| 186 |
A(_V_EPISEMA, 0x10) \ |
| 187 |
A(_V_EPISEMA_PUNCTUM_MORA, 0x11) \ |
| 188 |
A(_V_EPISEMA_AUCTUM_DUPLEX, 0x12) \ |
| 189 |
/* more rare signs, for now they can't be used with the others */ \ |
| 190 |
A(_ACCENTUS, 0x03) \ |
| 191 |
A(_ACCENTUS_REVERSUS, 0x04) \ |
| 192 |
A(_CIRCULUS, 0x05) \ |
| 193 |
A(_SEMI_CIRCULUS, 0x06) \ |
| 194 |
A(_SEMI_CIRCULUS_REVERSUS, 0x07) \ |
| 195 |
/* signs of a bar */ \ |
| 196 |
A(_BAR_H_EPISEMA, 0x08) \ |
| 197 |
A(_V_EPISEMA_BAR_H_EPISEMA, 0x18) \ |
| 198 |
/* musica ficta */ \ |
| 199 |
A(_MUSICA_FICTA_FLAT, 0x09) \ |
| 200 |
A(_MUSICA_FICTA_NATURAL, 0x0a) \ |
| 201 |
X(_MUSICA_FICTA_SHARP, 0x0b) |
| 202 |
ENUM(gregorio_sign, GREGORIO_SIGN); |
| 203 |
|
| 204 |
/* the different spaces */ |
| 205 |
|
| 206 |
#define GREGORIO_SPACE(A,E,X,L) \ |
| 207 |
A(SP_DEFAULT, 1) \ |
| 208 |
E(SP_NO_SPACE) \ |
| 209 |
E(SP_ZERO_WIDTH) \ |
| 210 |
E(SP_HALF_SPACE) \ |
| 211 |
E(SP_INTERGLYPH_SPACE) \ |
| 212 |
E(SP_NEUMATIC_CUT) \ |
| 213 |
E(SP_LARGER_SPACE) \ |
| 214 |
E(SP_GLYPH_SPACE) \ |
| 215 |
E(SP_AD_HOC_SPACE) \ |
| 216 |
E(SP_NEUMATIC_CUT_NB) \ |
| 217 |
E(SP_LARGER_SPACE_NB) \ |
| 218 |
E(SP_GLYPH_SPACE_NB) \ |
| 219 |
L(SP_AD_HOC_SPACE_NB) |
| 220 |
ENUM(gregorio_space, GREGORIO_SPACE); |
| 221 |
|
| 222 |
/* the different liquescences, like for the signs, have special |
| 223 |
* values: to say that something is initio_debilis, just do |
| 224 |
* glyph->liquescentia+=L_INITIO_DEBILIS. So don't change the value, |
| 225 |
* the trick is much used */ |
| 226 |
|
| 227 |
#define TAIL_LIQUESCENTIA_MASK 0x07 |
| 228 |
|
| 229 |
#define GREGORIO_LIQUESCENTIA(A,E,X,L) \ |
| 230 |
A(L_NO_LIQUESCENTIA, 0x00) \ |
| 231 |
A(L_DEMINUTUS, 0x01) \ |
| 232 |
A(L_AUCTUS_ASCENDENS, 0x02) \ |
| 233 |
A(L_AUCTUS_DESCENDENS, 0x04) \ |
| 234 |
A(L_INITIO_DEBILIS, 0x10) \ |
| 235 |
A(L_DEMINUTUS_INITIO_DEBILIS, 0x11) \ |
| 236 |
A(L_AUCTUS_ASCENDENS_INITIO_DEBILIS, 0x12) \ |
| 237 |
A(L_AUCTUS_DESCENDENS_INITIO_DEBILIS, 0x14) \ |
| 238 |
A(L_FUSED, 0x20) \ |
| 239 |
A(L_FUSED_DEMINUTUS, 0x21) \ |
| 240 |
A(L_FUSED_AUCTUS_ASCENDENS, 0x22) \ |
| 241 |
X(L_FUSED_AUCTUS_DESCENDENS, 0x24) |
| 242 |
ENUM(gregorio_liquescentia, GREGORIO_LIQUESCENTIA); |
| 243 |
|
| 244 |
#define GREHEPISEMA_SIZE(A,E,X,L) \ |
| 245 |
A(H_NORMAL, 0) \ |
| 246 |
E(H_SMALL_LEFT) \ |
| 247 |
E(H_SMALL_CENTRE) \ |
| 248 |
L(H_SMALL_RIGHT) |
| 249 |
ENUM(grehepisema_size, GREHEPISEMA_SIZE); |
| 250 |
|
| 251 |
/* values are chosen so BELOW/ABOVE can be added to a pitch */ |
| 252 |
#define GREGORIO_VPOSITION(A,E,X,L) \ |
| 253 |
A(VPOS_AUTO, 0) \ |
| 254 |
A(VPOS_BELOW, -1) \ |
| 255 |
X(VPOS_ABOVE, 1) |
| 256 |
ENUM(gregorio_vposition, GREGORIO_VPOSITION); |
| 257 |
|
| 258 |
/* The different types of glyph */ |
| 259 |
|
| 260 |
#define GREGORIO_GLYPH_TYPE(A,E,X,L) \ |
| 261 |
A(G_PUNCTUM_INCLINATUM, 1) \ |
| 262 |
E(G_2_PUNCTA_INCLINATA_DESCENDENS) \ |
| 263 |
E(G_3_PUNCTA_INCLINATA_DESCENDENS) \ |
| 264 |
E(G_4_PUNCTA_INCLINATA_DESCENDENS) \ |
| 265 |
E(G_5_PUNCTA_INCLINATA_DESCENDENS) \ |
| 266 |
E(G_2_PUNCTA_INCLINATA_ASCENDENS) \ |
| 267 |
E(G_3_PUNCTA_INCLINATA_ASCENDENS) \ |
| 268 |
E(G_4_PUNCTA_INCLINATA_ASCENDENS) \ |
| 269 |
E(G_5_PUNCTA_INCLINATA_ASCENDENS) \ |
| 270 |
E(G_PUNCTA_INCLINATA) \ |
| 271 |
/* !!! DO NOT CHANGE THE ENUM ORDERING BEFORE THIS LINE !!! */ \ |
| 272 |
E(G_UNDETERMINED) \ |
| 273 |
E(G_VIRGA) \ |
| 274 |
E(G_STROPHA) \ |
| 275 |
E(G_STROPHA_AUCTA) \ |
| 276 |
E(G_PUNCTUM) \ |
| 277 |
E(G_ALTERATION) \ |
| 278 |
E(G_PODATUS) \ |
| 279 |
E(G_PES_QUADRATUM) \ |
| 280 |
E(G_FLEXA) \ |
| 281 |
E(G_TORCULUS) \ |
| 282 |
E(G_TORCULUS_RESUPINUS) \ |
| 283 |
E(G_TORCULUS_RESUPINUS_FLEXUS) \ |
| 284 |
E(G_PORRECTUS) \ |
| 285 |
E(G_PORRECTUS_FLEXUS) \ |
| 286 |
E(G_BIVIRGA) \ |
| 287 |
E(G_TRIVIRGA) \ |
| 288 |
E(G_DISTROPHA) \ |
| 289 |
E(G_DISTROPHA_AUCTA) \ |
| 290 |
E(G_TRISTROPHA) \ |
| 291 |
E(G_TRISTROPHA_AUCTA) \ |
| 292 |
E(G_PES_QUADRATUM_FIRST_PART) \ |
| 293 |
E(G_SCANDICUS) \ |
| 294 |
E(G_PES_QUILISMA_QUADRATUM_FIRST_PART) \ |
| 295 |
E(G_ANCUS) \ |
| 296 |
E(G_PUNCTA_ASCENDENS) \ |
| 297 |
E(G_PUNCTA_DESCENDENS) \ |
| 298 |
E(G_VIRGA_REVERSA) \ |
| 299 |
E(G_SALICUS) \ |
| 300 |
E(G_SALICUS_FLEXUS) \ |
| 301 |
E(G_PES_ASCENDENS_ORISCUS) \ |
| 302 |
E(G_PES_DESCENDENS_ORISCUS) \ |
| 303 |
E(G_TORCULUS_LIQUESCENS) \ |
| 304 |
/* additional glyph types, necessary for determination */ \ |
| 305 |
E(G_PORRECTUS_NO_BAR) \ |
| 306 |
E(G_PORRECTUS_FLEXUS_NO_BAR) \ |
| 307 |
L(G_FUSED) |
| 308 |
ENUM(gregorio_glyph_type, GREGORIO_GLYPH_TYPE); |
| 309 |
|
| 310 |
/* |
| 311 |
* |
| 312 |
* The we define the characters. First we define the different styles. You |
| 313 |
* can notice that center is just a style like the others |
| 314 |
* |
| 315 |
*/ |
| 316 |
|
| 317 |
#define GRESTYLE_STYLE(A,E,X,L) \ |
| 318 |
A(ST_NO_STYLE, 0) \ |
| 319 |
E(ST_ITALIC) \ |
| 320 |
E(ST_CENTER) \ |
| 321 |
/* when the user types a {}, basically the same behaviour, except for |
| 322 |
* the initial */ \ |
| 323 |
E(ST_FORCED_CENTER) \ |
| 324 |
E(ST_BOLD) \ |
| 325 |
E(ST_TT) \ |
| 326 |
E(ST_SMALL_CAPS) \ |
| 327 |
E(ST_SPECIAL_CHAR) \ |
| 328 |
E(ST_VERBATIM) \ |
| 329 |
E(ST_INITIAL) /* a style used to determine the initial */ \ |
| 330 |
E(ST_UNDERLINED) \ |
| 331 |
E(ST_COLORED) \ |
| 332 |
E(ST_ELISION) \ |
| 333 |
E(ST_FIRST_WORD) \ |
| 334 |
E(ST_FIRST_SYLLABLE) \ |
| 335 |
E(ST_FIRST_SYLLABLE_INITIAL) \ |
| 336 |
E(ST_SYLLABLE_INITIAL) \ |
| 337 |
/* protrusion is implemented a PROTRUSION_FACTOR followed by a PROTRUSION; |
| 338 |
* an automatic protrusion will have a verbatim TeX macro as factor */ \ |
| 339 |
E(ST_PROTRUSION_FACTOR) \ |
| 340 |
E(ST_PROTRUSION) \ |
| 341 |
L(ST_SENTINEL) /* a temporary style to signify the end of a syllable */ |
| 342 |
ENUM(grestyle_style, GRESTYLE_STYLE); |
| 343 |
|
| 344 |
/* |
| 345 |
* Then the different types of styles. See the next comments for further |
| 346 |
* readings. |
| 347 |
*/ |
| 348 |
|
| 349 |
#define GRESTYLE_TYPE(A,E,X,L) \ |
| 350 |
A(ST_T_NOTHING, 0) \ |
| 351 |
E(ST_T_BEGIN) \ |
| 352 |
L(ST_T_END) |
| 353 |
ENUM(grestyle_type, GRESTYLE_TYPE); |
| 354 |
|
| 355 |
/* |
| 356 |
* The different types of translation centerings |
| 357 |
*/ |
| 358 |
|
| 359 |
#define GREGORIO_TR_CENTERING(A,E,X,L) \ |
| 360 |
A(TR_NORMAL, 0) \ |
| 361 |
E(TR_WITH_CENTER_BEGINNING) \ |
| 362 |
L(TR_WITH_CENTER_END) |
| 363 |
ENUM(gregorio_tr_centering, GREGORIO_TR_CENTERING); |
| 364 |
|
| 365 |
/* |
| 366 |
* Nothing, beginning or end of area without linebreak |
| 367 |
*/ |
| 368 |
|
| 369 |
#define GREGORIO_NLBA(A,E,X,L) \ |
| 370 |
A(NLBA_NORMAL, 0) \ |
| 371 |
E(NLBA_BEGINNING) \ |
| 372 |
L(NLBA_END) |
| 373 |
ENUM(gregorio_nlba, GREGORIO_NLBA); |
| 374 |
|
| 375 |
#define GREGORIO_EUOUAE(A,E,X,L) \ |
| 376 |
A(EUOUAE_NORMAL, 0) \ |
| 377 |
E(EUOUAE_BEGINNING) \ |
| 378 |
L(EUOUAE_END) |
| 379 |
ENUM(gregorio_euouae, GREGORIO_EUOUAE); |
| 380 |
|
| 381 |
#define GREGORIO_WORD_POSITION(A,E,X,L) \ |
| 382 |
A(WORD_BEGINNING, 1) \ |
| 383 |
E(WORD_MIDDLE) \ |
| 384 |
E(WORD_END) \ |
| 385 |
L(WORD_ONE_SYLLABLE) |
| 386 |
ENUM(gregorio_word_position, GREGORIO_WORD_POSITION); |
| 387 |
|
| 388 |
#define GREGORIO_SIGN_ORIENTATION(A,E,X,L) \ |
| 389 |
A(SO_OVER, 0) \ |
| 390 |
X(SO_UNDER, 1) |
| 391 |
ENUM(gregorio_sign_orientation, GREGORIO_SIGN_ORIENTATION); |
| 392 |
|
| 393 |
/* the numeric values will be directly passed to TeX */ |
| 394 |
#define GREGORIO_HEPISEMA_VBASEPOS(A,E,X,L) \ |
| 395 |
A(HVB_AUTO, 0) \ |
| 396 |
A(HVB_MIDDLE, 1) \ |
| 397 |
A(HVB_O_LOW, 2) \ |
| 398 |
A(HVB_O_HIGH, 3) \ |
| 399 |
A(HVB_U_LOW, 4) \ |
| 400 |
X(HVB_U_HIGH, 5) |
| 401 |
ENUM(gregorio_hepisema_vbasepos, GREGORIO_HEPISEMA_VBASEPOS); |
| 402 |
|
| 403 |
/* these may be used as bit fields, with LEDGER_EXPLICIT and LEDGER_DRAWN being |
| 404 |
* the bits */ |
| 405 |
#define GREGORIO_LEDGER_SPECIFICITY(A,E,X,L) \ |
| 406 |
A(LEDGER_SUPPOSED, 0) \ |
| 407 |
A(LEDGER_EXPLICIT, 1) \ |
| 408 |
A(LEDGER_DRAWN, 2) \ |
| 409 |
X(LEDGER_EXPLICITLY_DRAWN, 3) |
| 410 |
ENUM(gregorio_ledger_specificity, GREGORIO_LEDGER_SPECIFICITY); |
| 411 |
|
| 412 |
typedef struct gregorio_extra_info { |
| 413 |
char *ad_hoc_space_factor; |
| 414 |
ENUM_BITFIELD(gregorio_bar) bar:5; |
| 415 |
ENUM_BITFIELD(gregorio_space) space:4; |
| 416 |
ENUM_BITFIELD(gregorio_nlba) nlba:2; |
| 417 |
bool eol_ragged:1; |
| 418 |
bool eol_forces_custos:1; |
| 419 |
bool eol_forces_custos_on:1; |
| 420 |
} gregorio_extra_info; |
| 421 |
|
| 422 |
typedef struct gregorio_clef_info { |
| 423 |
signed char line; |
| 424 |
signed char secondary_line; |
| 425 |
signed char pitch_difference; |
| 426 |
ENUM_BITFIELD(gregorio_clef) clef:1; |
| 427 |
bool flatted:1; |
| 428 |
ENUM_BITFIELD(gregorio_clef) secondary_clef:1; |
| 429 |
bool secondary_flatted:1; |
| 430 |
} gregorio_clef_info; |
| 431 |
|
| 432 |
typedef union gregorio_misc_element_info { |
| 433 |
/* pitched is used for GRE_CUSTOS */ |
| 434 |
struct { |
| 435 |
/* The pitch of the glyph. */ |
| 436 |
signed char pitch; |
| 437 |
/* boolean indicating whether the pitch is forced */ |
| 438 |
bool force_pitch:1; |
| 439 |
} pitched; |
| 440 |
/* clef is used for GRE_CLEF */ |
| 441 |
struct gregorio_clef_info clef; |
| 442 |
/* unpitched is used for everything else */ |
| 443 |
struct { |
| 444 |
struct gregorio_extra_info info; |
| 445 |
/* an element might carry a sign. */ |
| 446 |
ENUM_BITFIELD(gregorio_sign) special_sign:8; |
| 447 |
} unpitched; |
| 448 |
} gregorio_misc_element_info; |
| 449 |
|
| 450 |
/* |
| 451 |
* ! We start with the most precise structure, the note structure. The |
| 452 |
* note is always a real note (we'll see that glyphs and elements can be |
| 453 |
* other things). |
| 454 |
*/ |
| 455 |
typedef struct gregorio_note { |
| 456 |
/* then two pointer to other notes, to make a chained list. */ |
| 457 |
struct gregorio_note *previous; |
| 458 |
struct gregorio_note *next; |
| 459 |
/* choral sign is a letter that appears next to a note in some choral |
| 460 |
* scores we put it as char* because sometimes two letters appear */ |
| 461 |
char *choral_sign; |
| 462 |
char *shape_hint; |
| 463 |
union { |
| 464 |
/* note is used for GRE_NOTE */ |
| 465 |
struct { |
| 466 |
/* the pitch is the height of the note on the score, that is to |
| 467 |
* say the letter it is represented by in gabc. If a clef |
| 468 |
* change, pitch will be a number indicating the line of the |
| 469 |
* clef. */ |
| 470 |
signed char pitch; |
| 471 |
/* shape is the shape of the note... if you want to know the |
| 472 |
* different possible shapes, see above. */ |
| 473 |
ENUM_BITFIELD(gregorio_shape) shape:8; |
| 474 |
/* liquescentia is the liquescence on the note, it is not really |
| 475 |
* used in the final score, but it is, like type, used in the |
| 476 |
* determination of glyphs. */ |
| 477 |
ENUM_BITFIELD(gregorio_liquescentia) liquescentia:7; |
| 478 |
bool is_cavum:1; |
| 479 |
} note; |
| 480 |
/* clef is used for GRE_CLEF */ |
| 481 |
struct gregorio_clef_info clef; |
| 482 |
/* other is used for everything else */ |
| 483 |
struct gregorio_extra_info other; |
| 484 |
} u; |
| 485 |
|
| 486 |
/* these go to the end for structure alignment */ |
| 487 |
/* index to a string containing a possible TeX verbatim; necessary during |
| 488 |
* structure generation. */ |
| 489 |
unsigned short texverb; |
| 490 |
unsigned short src_line, src_column, src_offset; |
| 491 |
unsigned short he_adjustment_index[2]; |
| 492 |
|
| 493 |
/* we have seen that notes are always real notes, that is to say |
| 494 |
* GRE_NOTE. the type is always that in the final structure. But there |
| 495 |
* is however this field in the structure because of the temporary |
| 496 |
* states that can appear in the determination, where notes can be |
| 497 |
* other things. This is the case for example in gabc reading. */ |
| 498 |
ENUM_BITFIELD(gregorio_type) type:8; |
| 499 |
/* signs is the signs on the notes, see above for all possible values */ |
| 500 |
ENUM_BITFIELD(gregorio_sign) signs:8; |
| 501 |
/* special_sign is the sign we sometimes encounter on punctum cavum, like |
| 502 |
* accentus, semi-circulus, etc. */ |
| 503 |
ENUM_BITFIELD(gregorio_sign) special_sign:8; |
| 504 |
/* h_episema_type is the type of horizontal episema, possible values |
| 505 |
* are H_ALONE for an isolated horizontal episema, H_MULTI_BEGINNING |
| 506 |
* if the note is the first note of an episema on several notes, |
| 507 |
* H_MULTI_MIDDLE if it is inside an episema on several notes. I let |
| 508 |
* you guess what could be the use of H_MULTI_END. Other values are |
| 509 |
* temporary values used in determination, they must not appear in the |
| 510 |
* final structure. */ |
| 511 |
|
| 512 |
const char *gtex_offset_case; |
| 513 |
signed char v_episema_height; |
| 514 |
signed char h_episema_above; |
| 515 |
signed char h_episema_below; |
| 516 |
ENUM_BITFIELD(grehepisema_size) h_episema_above_size:2; |
| 517 |
ENUM_BITFIELD(grehepisema_size) h_episema_below_size:2; |
| 518 |
bool h_episema_above_connect:1; |
| 519 |
bool h_episema_below_connect:1; |
| 520 |
/* the "specificity" field indicates how to interpret the line flag */ |
| 521 |
bool high_ledger_line:1; |
| 522 |
ENUM_BITFIELD(gregorio_ledger_specificity) high_ledger_specificity:2; |
| 523 |
bool low_ledger_line:1; |
| 524 |
ENUM_BITFIELD(gregorio_ledger_specificity) low_ledger_specificity:2; |
| 525 |
bool is_lower_note:1; |
| 526 |
bool is_upper_note:1; |
| 527 |
ENUM_BITFIELD(gregorio_vposition) mora_vposition:2; |
| 528 |
bool choral_sign_is_nabc:1; |
| 529 |
} gregorio_note; |
| 530 |
|
| 531 |
/* |
| 532 |
* ! @brief The gregorio glyph structure Unlike gregorio_note, gregorio_glyph |
| 533 |
* can be other things besides GRE_GLYPH: it can also be GRE_SPACE |
| 534 |
*/ |
| 535 |
typedef struct gregorio_glyph { |
| 536 |
/* two pointer to make a chained list */ |
| 537 |
struct gregorio_glyph *previous; |
| 538 |
struct gregorio_glyph *next; |
| 539 |
union { |
| 540 |
/* glyph is used for GRE_GLYPH */ |
| 541 |
struct { |
| 542 |
/* a pointer to a (chained list of) gregorio_notes, the first of |
| 543 |
* the glyph. */ |
| 544 |
struct gregorio_note *first_note; |
| 545 |
signed char fuse_to_next_glyph; |
| 546 |
/* The glyph type for a GRE_GLYPH (porrectus, pes, etc.). They |
| 547 |
* are all listed above. */ |
| 548 |
ENUM_BITFIELD(gregorio_glyph_type) glyph_type:8; |
| 549 |
/* liquescentia is really used, because that will determine the |
| 550 |
* shape we will have to use. */ |
| 551 |
ENUM_BITFIELD(gregorio_liquescentia) liquescentia:7; |
| 552 |
bool is_cavum:1; |
| 553 |
} notes; |
| 554 |
union gregorio_misc_element_info misc; |
| 555 |
} u; |
| 556 |
|
| 557 |
/* index to a string containing a possible TeX verbatim; necessary during |
| 558 |
* structure generation. */ |
| 559 |
unsigned short texverb; |
| 560 |
|
| 561 |
/* type can have the values explained in the comment just above. */ |
| 562 |
ENUM_BITFIELD(gregorio_type) type:8; |
| 563 |
|
| 564 |
/* There is no additional parameter for GRE_SPACE in a gregorio_glyph |
| 565 |
* because gregorio_space in this case can have only one value: |
| 566 |
* SP_ZERO_WIDTH, as other spaces would break the glyphs into |
| 567 |
* different elements. */ |
| 568 |
} gregorio_glyph; |
| 569 |
|
| 570 |
typedef struct gregorio_element { |
| 571 |
/* pointers to the next and previous elements. */ |
| 572 |
struct gregorio_element *previous; |
| 573 |
struct gregorio_element *next; |
| 574 |
/* The nabc string */ |
| 575 |
char **nabc; |
| 576 |
/* we put it here to get the length of the array here too */ |
| 577 |
size_t nabc_lines; |
| 578 |
union { |
| 579 |
/* first_glyph is used for GRE_ELEMENT */ |
| 580 |
/* a pointer to the first glyph of the element. */ |
| 581 |
struct gregorio_glyph *first_glyph; |
| 582 |
union gregorio_misc_element_info misc; |
| 583 |
} u; |
| 584 |
|
| 585 |
/* index to a string containing a possible TeX verbatim; necessary during |
| 586 |
* structure generation. */ |
| 587 |
unsigned short texverb; |
| 588 |
/* type can have the values GRE_ELEMENT, GRE_BAR, GRE_CLEF, GRE_CUSTOS, |
| 589 |
* GRE_END_OF_LINE, GRE_SPACE, GRE_TEXVERB_ELEMENT or GRE_NLBA */ |
| 590 |
ENUM_BITFIELD(gregorio_type) type:8; |
| 591 |
} gregorio_element; |
| 592 |
|
| 593 |
/* |
| 594 |
* |
| 595 |
* gregorio_characters are a bit specials. As there can be styles in the |
| 596 |
* text, I had to find a structure mode adapted that just grewchar *. So |
| 597 |
* basically a gregorio_character is a double-chained list of things that |
| 598 |
* can be grewchar or gregorio_styles. For example if you type (in gabc) |
| 599 |
* p<i>o</i>t, the corresponding gregorio_character list will be |
| 600 |
* P->style(type: beginning, style italic) -> o -> style(type:end, style: |
| 601 |
* italic). But for this list to be coherent, it is mandatory that it is |
| 602 |
* xml-compliant, that is to say that a<b>c<i>d</b>e</i> will be |
| 603 |
* interpreted as a<b>c<i>d</i></b><i>e</i>. This MUST be done when reading |
| 604 |
* a file, so that the structure in memory is coherent. It makes input |
| 605 |
* modules more comple, but output modules muche more simpler. The last |
| 606 |
* particularity is that center must also be determined in the input |
| 607 |
* modules, so that it is already defined in memory. But it is a bit more |
| 608 |
* complex, because for TeX-like output modules, we need to close all |
| 609 |
* styles before the center style: if the user types <i>pot</i> it must be |
| 610 |
* represented as <i>p</i>{<i>o</i>}<i>t</i>. |
| 611 |
* |
| 612 |
* Here is the declaration of the gregorio_style struct. It is simply two |
| 613 |
* chars, one telling the type of style character it is (beginning for a |
| 614 |
* character that marks the beginning of a style, and end for a character |
| 615 |
* marking the end of a style). The other char simply is the style |
| 616 |
* represented by the character (italic, etc.) |
| 617 |
* |
| 618 |
*/ |
| 619 |
|
| 620 |
typedef struct gregorio_style { |
| 621 |
ENUM_BITFIELD(grestyle_style) style:6; |
| 622 |
ENUM_BITFIELD(grestyle_type) type:2; |
| 623 |
} gregorio_style; |
| 624 |
|
| 625 |
/* |
| 626 |
* |
| 627 |
* This union is quite ugly... but necessary for a gregorio_character to be |
| 628 |
* able to be a grewchar or gregorio_style. |
| 629 |
* |
| 630 |
*/ |
| 631 |
typedef union character_or_style { |
| 632 |
grewchar character; |
| 633 |
struct gregorio_style s; |
| 634 |
} character_or_style; |
| 635 |
|
| 636 |
/* |
| 637 |
* |
| 638 |
* Finally the gregorio_character structure in itself, It is first a char |
| 639 |
* determining the type (character or gregorio_style). This char is 0 when |
| 640 |
* it is a style and something else when it is a character. Then the two |
| 641 |
* pointers to build the double chained list, and finally the union. So |
| 642 |
* when you want to access to the style of a gregorio_character (when you |
| 643 |
* know it is a character of style), you must access to |
| 644 |
* mygregoriochar.cos.s.style, and for the character |
| 645 |
* mygregoriochar.cos.character . |
| 646 |
* |
| 647 |
*/ |
| 648 |
|
| 649 |
typedef struct gregorio_character { |
| 650 |
bool is_character; |
| 651 |
struct gregorio_character *next_character; |
| 652 |
struct gregorio_character *previous_character; |
| 653 |
union character_or_style cos; |
| 654 |
} gregorio_character; |
| 655 |
|
| 656 |
typedef struct gregorio_syllable { |
| 657 |
/* pointer to a gregorio_text structure corresponding to the text. */ |
| 658 |
struct gregorio_character *text; |
| 659 |
/* pointer to a gregorio_text structure corresponding to the |
| 660 |
* translation */ |
| 661 |
struct gregorio_character *translation; |
| 662 |
/* a string representing the text above the lines (raw TeX) */ |
| 663 |
char *abovelinestext; |
| 664 |
/* pointer to the next and previous syllable */ |
| 665 |
struct gregorio_syllable *next_syllable; |
| 666 |
struct gregorio_syllable *previous_syllable; |
| 667 |
/* and finally a pointer to the elements of the structure. Here we see |
| 668 |
* that we point to an array of elements. In fact it is the array of |
| 669 |
* the first elements of the different voices of the syllable, for the |
| 670 |
* case of polyphonic score. In most scores (monophonic), the array |
| 671 |
* has only one element. */ |
| 672 |
struct gregorio_element **elements; |
| 673 |
unsigned short euouae_id; |
| 674 |
unsigned short src_line, src_column, src_offset; |
| 675 |
/* type of translation (with center beginning or only center end) */ |
| 676 |
ENUM_BITFIELD(gregorio_tr_centering) translation_type:2; |
| 677 |
/* beginning or end of area without linebreak? */ |
| 678 |
ENUM_BITFIELD(gregorio_nlba) no_linebreak_area:2; |
| 679 |
/* beginning or end of euouae area */ |
| 680 |
ENUM_BITFIELD(gregorio_euouae) euouae:2; |
| 681 |
/* position is WORD_BEGINNING for the beginning of a multi-syllable |
| 682 |
* word, WORD_ONE_SYLLABLE for syllable that are alone in their word, |
| 683 |
* and i let you gess what are WORD_MIDDLE and WORD_END. */ |
| 684 |
ENUM_BITFIELD(gregorio_word_position) position:3; |
| 685 |
bool first_word:1; |
| 686 |
bool forced_center:1; |
| 687 |
bool clear:1; |
| 688 |
} gregorio_syllable; |
| 689 |
|
| 690 |
/* Stores a header in a singly-linked list */ |
| 691 |
typedef struct gregorio_header { |
| 692 |
char *name; |
| 693 |
char *value; |
| 694 |
struct gregorio_header *next; |
| 695 |
} gregorio_header; |
| 696 |
|
| 697 |
/* |
| 698 |
* |
| 699 |
* Score is the top structure, the structure in which we will convert |
| 700 |
* everything, and from which we will construct XML |
| 701 |
* |
| 702 |
*/ |
| 703 |
|
| 704 |
#define MAX_ANNOTATIONS 2 |
| 705 |
|
| 706 |
typedef struct gregorio_score { |
| 707 |
unsigned char digest[SHA1_DIGEST_SIZE]; |
| 708 |
/* the structure starts by a pointer to the first syllable of the |
| 709 |
* score. */ |
| 710 |
struct gregorio_syllable *first_syllable; |
| 711 |
/* the number of voices is very important. In monophony it is one. If |
| 712 |
* there are more voices thant number_of_voices, the additional voices |
| 713 |
* won't be taken into consideration. */ |
| 714 |
int number_of_voices; |
| 715 |
/* then start some metadata: */ |
| 716 |
char *name; |
| 717 |
char *gabc_copyright; |
| 718 |
char *score_copyright; |
| 719 |
char *mode; |
| 720 |
char *mode_modifier; |
| 721 |
char *mode_differentia; |
| 722 |
char *author; |
| 723 |
/* There is one annotation for each line above the initial letter */ |
| 724 |
char *annotation[MAX_ANNOTATIONS]; |
| 725 |
/* field giving informations on the initial (no initial, normal initial |
| 726 |
* or two lines initial) */ |
| 727 |
size_t nabc_lines; |
| 728 |
char *user_notes; |
| 729 |
/* the determination method (maximal ambitus, etc.) */ |
| 730 |
unsigned char det_method; |
| 731 |
/* then, as there are some metadata that are voice-specific, we add a |
| 732 |
* pointer to the first voice_info. (see comments below) */ |
| 733 |
struct gregorio_voice_info *first_voice_info; |
| 734 |
struct gregorio_header *headers; |
| 735 |
struct gregorio_header *last_header; |
| 736 |
unsigned char staff_lines; |
| 737 |
signed char highest_pitch; |
| 738 |
signed char high_ledger_line_pitch; |
| 739 |
signed char virgula_far_pitch; |
| 740 |
bool legacy_oriscus_orientation; |
| 741 |
} gregorio_score; |
| 742 |
|
| 743 |
/* |
| 744 |
* |
| 745 |
* gregorio_voice info contains everything that is voice_specific, for |
| 746 |
* example the key, etc. that can be different from one voice to another. |
| 747 |
* The order of the voice_info (it is a chained list) is the same as the |
| 748 |
* order of the voices (from top to bottom in their representation on the |
| 749 |
* score). |
| 750 |
* |
| 751 |
*/ |
| 752 |
|
| 753 |
typedef struct gregorio_voice_info { |
| 754 |
gregorio_clef_info initial_clef; |
| 755 |
struct gregorio_voice_info *next_voice_info; |
| 756 |
} gregorio_voice_info; |
| 757 |
|
| 758 |
typedef struct gregorio_hepisema_adjustment { |
| 759 |
gregorio_hepisema_vbasepos vbasepos; |
| 760 |
char *nudge; |
| 761 |
signed char pitch_extremum; |
| 762 |
} gregorio_hepisema_adjustment; |
| 763 |
|
| 764 |
/* the maximum number of voices, more than this is total nonsense in |
| 765 |
* gregorian chant. */ |
| 766 |
#define MAX_NUMBER_OF_VOICES 10 |
| 767 |
|
| 768 |
#define MAX_TEXT_LENGTH 200 |
| 769 |
|
| 770 |
#define C_KEY 'c' |
| 771 |
#define F_KEY 'f' |
| 772 |
#define NO_KEY -5 |
| 773 |
|
| 774 |
extern unsigned short tex_position_id; |
| 775 |
extern gregorio_clef_info gregorio_default_clef; |
| 776 |
|
| 777 |
#define MONOPHONY 0 |
| 778 |
|
| 779 |
#define USELESS_VALUE 0 |
| 780 |
|
| 781 |
static __inline bool is_puncta_inclinata(char glyph) |
| 782 |
{ |
| 783 |
return glyph <= G_5_PUNCTA_INCLINATA_ASCENDENS; |
| 784 |
} |
| 785 |
|
| 786 |
#define IS_INITIO_DEBILIS 5 |
| 787 |
#define NO_INITIO_DEBILIS 0 |
| 788 |
|
| 789 |
static __inline bool is_tail_liquescentia(char liquescentia) |
| 790 |
{ |
| 791 |
return liquescentia & TAIL_LIQUESCENTIA_MASK; |
| 792 |
} |
| 793 |
|
| 794 |
static __inline bool is_initio_debilis(char liquescentia) |
| 795 |
{ |
| 796 |
return liquescentia & L_INITIO_DEBILIS; |
| 797 |
} |
| 798 |
|
| 799 |
static __inline bool is_fused(char liquescentia) |
| 800 |
{ |
| 801 |
return liquescentia & L_FUSED; |
| 802 |
} |
| 803 |
|
| 804 |
#define HEPISEMA_NONE 0 |
| 805 |
#define HEPISEMA_AUTO -1 |
| 806 |
#define HEPISEMA_FORCED -2 |
| 807 |
|
| 808 |
/* The first pitch MUST be an odd number */ |
| 809 |
#define LOWEST_PITCH 3 |
| 810 |
#define DUMMY_PITCH (LOWEST_PITCH + 6) |
| 811 |
#define LOW_LEDGER_LINE_PITCH (LOWEST_PITCH + 1) |
| 812 |
#define LOW_LINE_PITCH (LOWEST_PITCH + 3) |
| 813 |
#define MAX_PITCH (LOWEST_PITCH + 4 + (2 * 5)) |
| 814 |
|
| 815 |
#define NO_PITCH -128 |
| 816 |
|
| 817 |
/* defines the maximal interval between two notes of the same glyph */ |
| 818 |
#define MAX_AMBITUS 5 |
| 819 |
|
| 820 |
void gregorio_struct_init(void); |
| 821 |
void gregorio_struct_destroy(void); |
| 822 |
gregorio_score *gregorio_new_score(void); |
| 823 |
void gregorio_add_note(gregorio_note **current_note, signed char pitch, |
| 824 |
gregorio_shape shape, gregorio_sign signs, |
| 825 |
gregorio_liquescentia liquescentia, gregorio_note* prototype, |
| 826 |
const gregorio_scanner_location *loc); |
| 827 |
void gregorio_add_glyph(gregorio_glyph **current_glyph, |
| 828 |
gregorio_glyph_type type, gregorio_note *first_note, |
| 829 |
gregorio_liquescentia liquescentia, bool is_cavum); |
| 830 |
void gregorio_add_element(gregorio_element **current_element, |
| 831 |
gregorio_glyph *first_glyph); |
| 832 |
void gregorio_add_syllable(gregorio_syllable **current_syllable, |
| 833 |
int number_of_voices, gregorio_element *elements[], |
| 834 |
gregorio_character *first_character, |
| 835 |
gregorio_character *first_translation_character, |
| 836 |
gregorio_word_position position, char *abovelinestext, |
| 837 |
gregorio_tr_centering translation_type, gregorio_nlba no_linebreak_area, |
| 838 |
gregorio_euouae euouae, const gregorio_scanner_location *loc, |
| 839 |
bool first_word, bool clear); |
| 840 |
void gregorio_add_special_sign(gregorio_note *current_note, gregorio_sign sign); |
| 841 |
void gregorio_change_shape(gregorio_note *note, gregorio_shape shape, |
| 842 |
bool legacy_oriscus_orientation); |
| 843 |
void gregorio_add_cavum(gregorio_note *note); |
| 844 |
void gregorio_position_h_episema_above(gregorio_note *note, signed char height, |
| 845 |
bool connect); |
| 846 |
void gregorio_position_h_episema_below(gregorio_note *note, signed char height, |
| 847 |
bool connect); |
| 848 |
void gregorio_add_h_episema(gregorio_note *note, grehepisema_size size, |
| 849 |
gregorio_vposition vposition, bool disable_bridge, |
| 850 |
unsigned int *nbof_isolated_episema); |
| 851 |
void gregorio_add_sign(gregorio_note *note, gregorio_sign sign, |
| 852 |
gregorio_vposition vposition); |
| 853 |
void gregorio_add_tail_liquescentia(gregorio_note *note, |
| 854 |
gregorio_liquescentia liquescentia, bool legacy_oriscus_orientation); |
| 855 |
void gregorio_add_voice_info(gregorio_voice_info **current_voice_info); |
| 856 |
void gregorio_free_voice_infos(gregorio_voice_info *voice_info); |
| 857 |
void gregorio_free_one_note(gregorio_note **note); |
| 858 |
void gregorio_free_one_glyph(gregorio_glyph **glyph); |
| 859 |
void gregorio_free_one_element(gregorio_element **element); |
| 860 |
void gregorio_free_score(gregorio_score *score); |
| 861 |
void gregorio_free_characters(gregorio_character *current_character); |
| 862 |
void gregorio_go_to_first_character(const gregorio_character **character); |
| 863 |
void gregorio_add_clef_as_glyph(gregorio_glyph **current_glyph, |
| 864 |
gregorio_clef_info clef, unsigned short texverb); |
| 865 |
void gregorio_add_pitched_element_as_glyph(gregorio_glyph **current_glyph, |
| 866 |
gregorio_type type, signed char pitch, bool force_pitch, |
| 867 |
unsigned short texverb); |
| 868 |
void gregorio_add_unpitched_element_as_glyph(gregorio_glyph **current_glyph, |
| 869 |
gregorio_type type, gregorio_extra_info *info, gregorio_sign sign, |
| 870 |
unsigned short texverb); |
| 871 |
void gregorio_add_end_of_line_as_note(gregorio_note **current_note, |
| 872 |
bool eol_ragged, bool eol_forces_custos, bool eol_forces_custos_on, |
| 873 |
const gregorio_scanner_location *loc); |
| 874 |
void gregorio_add_custos_as_note(gregorio_note **current_note, |
| 875 |
const gregorio_scanner_location *loc); |
| 876 |
void gregorio_add_manual_custos_as_note(gregorio_note **current_note, |
| 877 |
signed char pitch, const gregorio_scanner_location *loc); |
| 878 |
void gregorio_add_suppress_custos_as_note(gregorio_note **current_note, |
| 879 |
const gregorio_scanner_location *loc); |
| 880 |
void gregorio_add_clef_as_note(gregorio_note **current_note, |
| 881 |
gregorio_clef clef, signed char clef_line, bool flatted, |
| 882 |
const gregorio_scanner_location *loc); |
| 883 |
void gregorio_add_secondary_clef_to_note(gregorio_note *current_note, |
| 884 |
gregorio_clef clef, signed char clef_line, bool flatted); |
| 885 |
void gregorio_add_bar_as_note(gregorio_note **current_note, gregorio_bar bar, |
| 886 |
const gregorio_scanner_location *loc); |
| 887 |
void gregorio_add_space_as_note(gregorio_note **current_note, |
| 888 |
gregorio_space space, char *factor, |
| 889 |
const gregorio_scanner_location *loc); |
| 890 |
unsigned short gregorio_add_texverb_as_note(gregorio_note **current_note, |
| 891 |
char *str, gregorio_type type, const gregorio_scanner_location *loc); |
| 892 |
void gregorio_add_nlba_as_note(gregorio_note **current_note, |
| 893 |
gregorio_nlba type, const gregorio_scanner_location *loc); |
| 894 |
void gregorio_start_autofuse(gregorio_note **current_note, |
| 895 |
const gregorio_scanner_location *loc); |
| 896 |
void gregorio_end_autofuse(gregorio_note **current_note, |
| 897 |
const gregorio_scanner_location *loc); |
| 898 |
void gregorio_add_texverb_to_note(gregorio_note *current_note, char *str); |
| 899 |
void gregorio_add_cs_to_note(gregorio_note *current_note, char *str, |
| 900 |
bool nabc); |
| 901 |
void gregorio_add_shape_hint_to_note(gregorio_note *current_note, char *str); |
| 902 |
void gregorio_add_misc_element(gregorio_element **current_element, |
| 903 |
gregorio_type type, gregorio_misc_element_info *info, |
| 904 |
unsigned short texverb); |
| 905 |
void gregorio_set_score_annotation(gregorio_score *score, char *annotation); |
| 906 |
void gregorio_set_score_staff_lines(gregorio_score *score, char staff_lines); |
| 907 |
void gregorio_add_score_header(gregorio_score *score, char *name, |
| 908 |
char *value); |
| 909 |
void gregorio_fix_initial_keys(gregorio_score *score, |
| 910 |
gregorio_clef_info default_clef); |
| 911 |
void gregorio_go_to_first_note(gregorio_note **note); |
| 912 |
void gregorio_go_to_first_glyph(gregorio_glyph **glyph); |
| 913 |
bool gregorio_is_only_special(gregorio_element *element); |
| 914 |
int gregorio_calculate_new_key(gregorio_clef_info clef); |
| 915 |
void gregorio_add_character(gregorio_character **current_character, |
| 916 |
grewchar wcharacter); |
| 917 |
void gregorio_begin_style(gregorio_character **current_character, |
| 918 |
grestyle_style style); |
| 919 |
void gregorio_end_style(gregorio_character **current_character, |
| 920 |
grestyle_style style); |
| 921 |
gregorio_character *gregorio_clone_characters(const gregorio_character *source); |
| 922 |
signed char gregorio_determine_next_pitch(const gregorio_syllable *syllable, |
| 923 |
const gregorio_element *element, const gregorio_glyph *glyph, |
| 924 |
gregorio_shape *next_pitch_alteration); |
| 925 |
const char *gregorio_unknown(int value); |
| 926 |
gregorio_element *gregorio_get_clef_change(gregorio_syllable *syllable); |
| 927 |
unsigned short gregorio_add_hepisema_adjustment( |
| 928 |
gregorio_hepisema_vbasepos vbasepos, char *nudge); |
| 929 |
gregorio_hepisema_adjustment *gregorio_get_hepisema_adjustment( |
| 930 |
unsigned short index); |
| 931 |
const char *gregorio_texverb(unsigned short index); |
| 932 |
void gregorio_change_texverb(unsigned short index, char *texverb); |
| 933 |
|
| 934 |
static __inline void gregorio_go_to_first_character_c(gregorio_character **character) |
| 935 |
{ |
| 936 |
gregorio_go_to_first_character((const gregorio_character **)character); |
| 937 |
} |
| 938 |
|
| 939 |
static __inline gregorio_note *gregorio_glyph_last_note( |
| 940 |
const gregorio_glyph *const glyph) |
| 941 |
{ |
| 942 |
gregorio_note *note; |
| 943 |
gregorio_assert(glyph && glyph->type == GRE_GLYPH, gregorio_glyph_last_note, |
| 944 |
"trying to find the last note of something that is not a glyph", |
| 945 |
return NULL); |
| 946 |
for (note = glyph->u.notes.first_note; note->next; note = note->next) { |
| 947 |
/* iterate to find the last note */ |
| 948 |
} |
| 949 |
return note; |
| 950 |
} |
| 951 |
|
| 952 |
static __inline const gregorio_glyph *gregorio_next_non_texverb_glyph( |
| 953 |
const gregorio_glyph *glyph) |
| 954 |
{ |
| 955 |
if (glyph) { |
| 956 |
for (glyph = glyph->next; glyph; glyph = glyph->next) { |
| 957 |
if (glyph->type != GRE_TEXVERB_GLYPH) { |
| 958 |
return glyph; |
| 959 |
} |
| 960 |
} |
| 961 |
} |
| 962 |
return NULL; |
| 963 |
} |
| 964 |
|
| 965 |
static __inline const gregorio_glyph *gregorio_previous_non_texverb_glyph( |
| 966 |
const gregorio_glyph *glyph) |
| 967 |
{ |
| 968 |
if (glyph) { |
| 969 |
for (glyph = glyph->previous; glyph; glyph = glyph->previous) { |
| 970 |
if (glyph->type != GRE_TEXVERB_GLYPH) { |
| 971 |
return glyph; |
| 972 |
} |
| 973 |
} |
| 974 |
} |
| 975 |
return NULL; |
| 976 |
} |
| 977 |
|
| 978 |
static __inline char gregorio_clef_to_char(gregorio_clef clef) |
| 979 |
{ |
| 980 |
return (clef == CLEF_C)? 'c' : 'f'; |
| 981 |
} |
| 982 |
|
| 983 |
static __inline signed char gregorio_adjust_pitch_into_staff( |
| 984 |
const gregorio_score *score, signed char pitch) |
| 985 |
{ |
| 986 |
while (pitch < LOWEST_PITCH) { |
| 987 |
pitch += 7; |
| 988 |
} |
| 989 |
while (pitch > score->highest_pitch) { |
| 990 |
pitch -= 7; |
| 991 |
} |
| 992 |
assert(pitch >= LOWEST_PITCH && pitch <= score->highest_pitch); |
| 993 |
return pitch; |
| 994 |
} |
| 995 |
|
| 996 |
#endif |