| 1 |
/* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */ |
| 2 |
/* From input file "preamble.pas" */ |
| 3 |
|
| 4 |
|
| 5 |
#include "p2c.h" |
| 6 |
|
| 7 |
|
| 8 |
#define PREAMBLE_G |
| 9 |
#include "preamble.h" |
| 10 |
|
| 11 |
|
| 12 |
#ifndef CONTROL_H |
| 13 |
#include "control.h" |
| 14 |
#endif |
| 15 |
|
| 16 |
#ifndef MTXLINE_H |
| 17 |
#include "mtxline.h" |
| 18 |
#endif |
| 19 |
|
| 20 |
#ifndef STRINGS_H |
| 21 |
#include "strings.h" |
| 22 |
#endif |
| 23 |
|
| 24 |
#ifndef MULTFILE_H |
| 25 |
#include "multfile.h" |
| 26 |
#endif |
| 27 |
|
| 28 |
#ifndef FILES_H |
| 29 |
#include "files.h" |
| 30 |
#endif |
| 31 |
|
| 32 |
#ifndef STATUS_H |
| 33 |
#include "status.h" |
| 34 |
#endif |
| 35 |
|
| 36 |
#ifndef UTILITY_H |
| 37 |
#include "utility.h" |
| 38 |
#endif |
| 39 |
|
| 40 |
|
| 41 |
#define blank_ ' ' |
| 42 |
#define colon_ ':' |
| 43 |
#define semicolon ';' |
| 44 |
#define comma_ ',' |
| 45 |
|
| 46 |
#define max_styles 24 |
| 47 |
|
| 48 |
|
| 49 |
typedef enum { |
| 50 |
none, title, composer, pmx, tex, options, msize, bars, shortnote, style, |
| 51 |
sharps, flats, meter, space, pages, systems, width, height, enable, disable, |
| 52 |
range, name, indent, poet, part, only, octave_, start |
| 53 |
} command_type; |
| 54 |
|
| 55 |
typedef enum { |
| 56 |
unknown, colon_line, command_line, comment_line, plain_line |
| 57 |
} line_type; |
| 58 |
|
| 59 |
typedef char style_index; |
| 60 |
|
| 61 |
typedef char style_index0; |
| 62 |
|
| 63 |
|
| 64 |
#define c1 title |
| 65 |
#define cn start |
| 66 |
|
| 67 |
|
| 68 |
Static short known_styles = 12; |
| 69 |
Static boolean warn_redefine = false; |
| 70 |
|
| 71 |
Static Char commands[28][17] = { |
| 72 |
"NONE", "TITLE", "COMPOSER", "PMX", "TEX", "OPTIONS", "SIZE", "BARS/LINE", |
| 73 |
"SHORT", "STYLE", "SHARPS", "FLATS", "METER", "SPACE", "PAGES", "SYSTEMS", |
| 74 |
"WIDTH", "HEIGHT", "ENABLE", "DISABLE", "RANGE", "NAME", "INDENT", "POET", |
| 75 |
"PART", "ONLY", "OCTAVE", "START" |
| 76 |
}; |
| 77 |
|
| 78 |
/* short */ |
| 79 |
/* systems */ |
| 80 |
|
| 81 |
Static Char cline[28][256] = { |
| 82 |
"", "", "", "", "", "", "", "", "1/4", "", "0", "", "C", "", "1", "1", |
| 83 |
"190mm", "260mm", "", "", "", "", "", "", "", "", "", "" |
| 84 |
}; |
| 85 |
|
| 86 |
Static boolean redefined[28] = { |
| 87 |
false, false, false, false, false, false, false, false, false, false, false, |
| 88 |
false, false, false, false, false, false, false, false, false, false, false, |
| 89 |
false, false, false, false, false, false |
| 90 |
}; |
| 91 |
|
| 92 |
/** Known styles */ |
| 93 |
|
| 94 |
Static Char known_style[max_styles][256] = { |
| 95 |
"SATB: Voices S,A T,B; Choral; Clefs G F", |
| 96 |
"SATB4: Voices S A T B; Choral; Clefs G G G8 F", |
| 97 |
"SINGER: Voices Voice; Vocal; Clefs G", |
| 98 |
"PIANO: Voices RH LH; Continuo; Clefs G F", |
| 99 |
"ORGAN: Voices RH LH Ped; Continuo; Clefs G F F", |
| 100 |
"SOLO: Voices V; Clefs G", "DUET: Voices V1 Vc; Clefs G F", |
| 101 |
"TRIO: Voices V1 Va Vc; Clefs G C F", |
| 102 |
"QUARTET: Voices V1 V2 Va Vc; Clefs G G C F", |
| 103 |
"QUINTET: Voices V1 V2 Va Vc1 Vc2; Clefs G G C F F", |
| 104 |
"SEXTET: Voices V1 V2 Va1 Va2 Vc1 Vc2; Clefs G G C C F F", |
| 105 |
"SEPTET: Voices V1 V2 Va1 Va2 Vc1 Vc2 Cb; Clefs G G C C F F F", "", "", "", |
| 106 |
"", "", "", "", "", "", "", "", "" |
| 107 |
}; |
| 108 |
|
| 109 |
Static style_index old_known_styles; |
| 110 |
Static boolean style_used[max_styles]; |
| 111 |
Static boolean omit_line[lines_in_paragraph]; |
| 112 |
Static style_index0 orig_style_line[max_styles]; |
| 113 |
Static short orig_range_line; |
| 114 |
|
| 115 |
Static short nclefs, n_pages, n_systems, n_sharps, ngroups; |
| 116 |
Static Char part_line[256], title_line[256], composer_line[256], |
| 117 |
pmx_line[256], options_line[256], start_line[256], voices[256], |
| 118 |
clefs[256]; |
| 119 |
Static short group_start[maxgroups], group_stop[maxgroups]; |
| 120 |
Static Char instr_name[maxstaves][41]; |
| 121 |
Static boolean style_supplied; |
| 122 |
|
| 123 |
|
| 124 |
/* ------------------ Styles ------------------ */ |
| 125 |
|
| 126 |
Static voice_index0 voiceCount(Char *s_) |
| 127 |
{ |
| 128 |
Char s[256]; |
| 129 |
short i, l; |
| 130 |
|
| 131 |
strcpy(s, s_); |
| 132 |
l = strlen(s); |
| 133 |
for (i = 0; i <= l - 1; i++) { |
| 134 |
if (s[i] == comma_) |
| 135 |
s[i] = blank_; |
| 136 |
} |
| 137 |
return (wordCount(s)); |
| 138 |
} |
| 139 |
|
| 140 |
|
| 141 |
Static style_index0 findStyle(Char *s_) |
| 142 |
{ |
| 143 |
style_index0 Result = 0; |
| 144 |
Char s[256]; |
| 145 |
style_index0 i = 0; |
| 146 |
|
| 147 |
strcpy(s, s_); |
| 148 |
sprintf(s + strlen(s), "%c", colon_); |
| 149 |
while (i < known_styles) { |
| 150 |
i++; |
| 151 |
if (startsWithIgnoreCase(known_style[i-1], s)) |
| 152 |
return i; |
| 153 |
} |
| 154 |
return Result; |
| 155 |
} |
| 156 |
|
| 157 |
|
| 158 |
Static void addStyle(Char *S) |
| 159 |
{ |
| 160 |
style_index0 sn; |
| 161 |
Char STR1[256]; |
| 162 |
|
| 163 |
sn = findStyle(NextWord(STR1, S, colon_, dummy)); |
| 164 |
if (sn > 0) { |
| 165 |
strcpy(known_style[sn-1], S); |
| 166 |
return; |
| 167 |
} |
| 168 |
if (known_styles < max_styles) { |
| 169 |
known_styles++; |
| 170 |
strcpy(known_style[known_styles-1], S); |
| 171 |
} else |
| 172 |
error("Can't add another style - table full", print); |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
Static void readStyles(void) |
| 177 |
{ |
| 178 |
boolean eofstyle; |
| 179 |
Char S[256]; |
| 180 |
style_index0 l = 0; |
| 181 |
Char *TEMP; |
| 182 |
|
| 183 |
if (styleFileFound()) |
| 184 |
eofstyle = true; |
| 185 |
else |
| 186 |
eofstyle = P_eof(stylefile); |
| 187 |
while (!eofstyle) { |
| 188 |
fgets(S, 256, stylefile); |
| 189 |
TEMP = strchr(S, '\n'); |
| 190 |
if (TEMP != NULL) |
| 191 |
*TEMP = 0; |
| 192 |
if (*S != '\0') { |
| 193 |
addStyle(S); |
| 194 |
l++; |
| 195 |
orig_style_line[known_styles-1] = l; |
| 196 |
} |
| 197 |
eofstyle = P_eof(stylefile); |
| 198 |
} |
| 199 |
} |
| 200 |
|
| 201 |
|
| 202 |
Static void applyStyle(Char *s_, Char *stylename, stave_index first_inst, |
| 203 |
stave_index first_stave) |
| 204 |
{ |
| 205 |
Char s[256]; |
| 206 |
Char clef[256], subline[256], subcommand[256]; |
| 207 |
stave_index0 i, last_inst, last_stave; |
| 208 |
boolean continuo = false, toosoon = false, vocal = false; |
| 209 |
Char STR2[256]; |
| 210 |
|
| 211 |
strcpy(s, s_); |
| 212 |
last_inst = first_inst - 1; |
| 213 |
GetNextWord(subline, s, blank_, colon_); |
| 214 |
while (*s != '\0') { |
| 215 |
GetNextWord(subline, s, semicolon, dummy); |
| 216 |
i = curtail(subline, semicolon); |
| 217 |
GetNextWord(subcommand, subline, blank_, dummy); |
| 218 |
if (equalsIgnoreCase(subcommand, "VOICES")) { |
| 219 |
sprintf(voices + strlen(voices), " %s", subline); |
| 220 |
last_stave = first_stave + wordCount(subline) - 1; |
| 221 |
last_inst = first_inst + voiceCount(subline) - 1; |
| 222 |
} else if (equalsIgnoreCase(subcommand, "CLEFS")) { |
| 223 |
strcpy(clef, subline); |
| 224 |
sprintf(clefs + strlen(clefs), " %s", clef); |
| 225 |
} else if (equalsIgnoreCase(subcommand, "VOCAL")) { |
| 226 |
if (last_inst < first_inst) |
| 227 |
toosoon = true; |
| 228 |
else { |
| 229 |
some_vocal = true; |
| 230 |
vocal = true; |
| 231 |
for (i = first_inst; i <= last_inst; i++) |
| 232 |
setVocal(i, true); |
| 233 |
} |
| 234 |
} else if (equalsIgnoreCase(subcommand, "CHORAL") || |
| 235 |
equalsIgnoreCase(subcommand, "GROUP")) { |
| 236 |
if (last_inst < first_inst) |
| 237 |
toosoon = true; |
| 238 |
else { |
| 239 |
if (equalsIgnoreCase(subcommand, "CHORAL")) { |
| 240 |
some_vocal = true; |
| 241 |
vocal = true; |
| 242 |
for (i = first_inst; i <= last_inst; i++) |
| 243 |
setVocal(i, true); |
| 244 |
} |
| 245 |
if (ngroups == maxgroups) |
| 246 |
error("Too many groups", print); |
| 247 |
else { |
| 248 |
ngroups++; |
| 249 |
group_start[ngroups-1] = first_stave; |
| 250 |
group_stop[ngroups-1] = last_stave; |
| 251 |
} |
| 252 |
} |
| 253 |
} else if (equalsIgnoreCase(subcommand, "CONTINUO")) |
| 254 |
continuo = true; |
| 255 |
else { |
| 256 |
sprintf(STR2, "Subcommand %s in STYLE unknown", subcommand); |
| 257 |
error(STR2, print); |
| 258 |
} |
| 259 |
if (toosoon) { |
| 260 |
sprintf(STR2, "You must first give VOICES before specifying %s", |
| 261 |
subcommand); |
| 262 |
error(STR2, print); |
| 263 |
} |
| 264 |
} |
| 265 |
if (vocal && continuo) |
| 266 |
error("A continuo instrument may not be vocal", print); |
| 267 |
if (wordCount(clef) != last_stave - first_stave + 1) |
| 268 |
error("Number of clefs does not match number of voices", print); |
| 269 |
if (first_stave == last_stave || continuo) { |
| 270 |
strcpy(instr_name[first_stave-1], stylename); |
| 271 |
/* p2c: preamble.pas, line 185: |
| 272 |
* Note: Possible string truncation in assignment [145] */ |
| 273 |
} else { |
| 274 |
for (i = first_stave - 1; i <= last_stave - 1; i++) |
| 275 |
*instr_name[i] = '\0'; |
| 276 |
} |
| 277 |
if (continuo) { |
| 278 |
ninstr++; |
| 279 |
stave[ninstr-1] = first_stave; |
| 280 |
for (i = first_stave - 1; i <= last_stave - 1; i++) |
| 281 |
instr[i] = ninstr; |
| 282 |
return; |
| 283 |
} |
| 284 |
for (i = first_stave; i <= last_stave; i++) { |
| 285 |
ninstr++; |
| 286 |
stave[ninstr-1] = i; |
| 287 |
instr[i-1] = ninstr; |
| 288 |
} |
| 289 |
} |
| 290 |
|
| 291 |
|
| 292 |
Static void applyStyles(void) |
| 293 |
{ |
| 294 |
short n1, n2, sn; |
| 295 |
Char s[256]; |
| 296 |
Char STR2[256]; |
| 297 |
|
| 298 |
*voices = '\0'; |
| 299 |
*clefs = '\0'; |
| 300 |
ninstr = 0; |
| 301 |
while (*cline[(long)style] != '\0') { |
| 302 |
n1 = voiceCount(voices) + 1; |
| 303 |
n2 = wordCount(voices) + 1; |
| 304 |
GetNextWord(s, cline[(long)style], blank_, comma_); |
| 305 |
curtail(s, comma_); |
| 306 |
sn = findStyle(s); |
| 307 |
if (sn == 0) { |
| 308 |
sprintf(STR2, "Style %s unknown", s); |
| 309 |
error(STR2, print); |
| 310 |
} |
| 311 |
line_no = orig_style_line[sn-1]; |
| 312 |
applyStyle(known_style[sn-1], s, n1, n2); |
| 313 |
style_used[sn-1] = true; |
| 314 |
} |
| 315 |
} |
| 316 |
|
| 317 |
|
| 318 |
/* ------------------------------------------------------------- */ |
| 319 |
|
| 320 |
Static void wipeCommands(void) |
| 321 |
{ |
| 322 |
command_type c; |
| 323 |
|
| 324 |
for (c = c1; c <= cn; c = (command_type)((long)c + 1)) |
| 325 |
*cline[(long)c] = '\0'; |
| 326 |
} |
| 327 |
|
| 328 |
|
| 329 |
boolean omitLine(paragraph_index line) |
| 330 |
{ |
| 331 |
return (line > 0 && omit_line[line-1]); |
| 332 |
} |
| 333 |
|
| 334 |
|
| 335 |
Static void setName(void) |
| 336 |
{ |
| 337 |
short i, FORLIM; |
| 338 |
|
| 339 |
if (!redefined[(long)name]) |
| 340 |
return; |
| 341 |
setFeature("instrumentNames", true); |
| 342 |
FORLIM = ninstr; |
| 343 |
for (i = 0; i <= FORLIM - 1; i++) { |
| 344 |
GetNextWord(instr_name[i], cline[(long)name], blank_, dummy); |
| 345 |
/* p2c: preamble.pas, line 226: |
| 346 |
* Note: Possible string truncation in assignment [145] */ |
| 347 |
} |
| 348 |
} |
| 349 |
|
| 350 |
|
| 351 |
Static void setIndent(void) |
| 352 |
{ |
| 353 |
if (redefined[(long)indent]) |
| 354 |
strcpy(fracindent, cline[(long)indent]); |
| 355 |
} |
| 356 |
|
| 357 |
|
| 358 |
Static void setInitOctave(void) |
| 359 |
{ |
| 360 |
if (redefined[(long)octave_]) |
| 361 |
initOctaves(cline[(long)octave_]); |
| 362 |
} |
| 363 |
|
| 364 |
|
| 365 |
Local void checkLabel(Char *w) |
| 366 |
{ |
| 367 |
voice_index j, FORLIM; |
| 368 |
Char STR1[256], STR2[256]; |
| 369 |
|
| 370 |
FORLIM = nvoices; |
| 371 |
for (j = 0; j <= FORLIM - 1; j++) { |
| 372 |
if (!strcmp(w, voice_label[j])) { |
| 373 |
sprintf(STR2, "Voice label %s not unique", w); |
| 374 |
warning(STR2, print); |
| 375 |
return; |
| 376 |
} |
| 377 |
} |
| 378 |
if (strlen(w) > 2) |
| 379 |
return; |
| 380 |
if (pos1(w[0], "CLU") > 0) { |
| 381 |
if (strlen(w) > 1) { |
| 382 |
if (pos1(w[1], "123456789") == 0) |
| 383 |
return; |
| 384 |
} |
| 385 |
} else if (pos1(w[0], "123456789") == 0) |
| 386 |
return; |
| 387 |
sprintf(STR1, "Voice label %s conflicts with reserved label", w); |
| 388 |
error(STR1, print); |
| 389 |
} |
| 390 |
|
| 391 |
|
| 392 |
Static void setVoices(Char *line) |
| 393 |
{ |
| 394 |
short k; |
| 395 |
Char s[256], w[256]; |
| 396 |
Char STR1[256]; |
| 397 |
short FORLIM; |
| 398 |
|
| 399 |
nvoices = 0; |
| 400 |
nstaves = 0; |
| 401 |
do { |
| 402 |
GetNextWord(s, line, blank_, dummy); |
| 403 |
if (*s != '\0') { |
| 404 |
nstaves++; |
| 405 |
k = 0; |
| 406 |
first_on_stave[nstaves-1] = nvoices + 1; |
| 407 |
do { |
| 408 |
GetNextWord(w, s, blank_, comma_); |
| 409 |
curtail(w, comma_); |
| 410 |
if (*w != '\0') { |
| 411 |
k++; |
| 412 |
if (k <= 2) { |
| 413 |
nvoices++; |
| 414 |
checkLabel(w); |
| 415 |
strcpy(voice_label[nvoices-1], w); |
| 416 |
if (*instr_name[nstaves-1] == '\0') { |
| 417 |
strcpy(instr_name[nstaves-1], w); |
| 418 |
/* p2c: preamble.pas, line 266: |
| 419 |
* Note: Possible string truncation in assignment [145] */ |
| 420 |
} |
| 421 |
setStavePos(nvoices, nstaves, k); |
| 422 |
} |
| 423 |
} |
| 424 |
} while (*w != '\0'); |
| 425 |
if (k > 2) { |
| 426 |
sprintf(STR1, "More than two voices per stave: %s", s); |
| 427 |
error(STR1, print); |
| 428 |
} |
| 429 |
if (k == 2) { |
| 430 |
sprintf(instr_name[nstaves-1], "\\mtxTwoInstruments{%s}{%s}", |
| 431 |
voice_label[nvoices-2], voice_label[nvoices-1]); |
| 432 |
/* p2c: preamble.pas, line 273: |
| 433 |
* Note: Possible string truncation in assignment [145] */ |
| 434 |
} |
| 435 |
number_on_stave[nstaves-1] = k; |
| 436 |
} |
| 437 |
} while (*line != '\0'); |
| 438 |
FORLIM = nvoices; |
| 439 |
for (k = 0; k <= FORLIM - 1; k++) |
| 440 |
selected[k] = true; |
| 441 |
} |
| 442 |
|
| 443 |
|
| 444 |
Static void setClefs(Char *line_) |
| 445 |
{ |
| 446 |
Char line[256]; |
| 447 |
Char s[256]; |
| 448 |
|
| 449 |
strcpy(line, line_); |
| 450 |
nclefs = 0; |
| 451 |
do { |
| 452 |
GetNextWord(s, line, blank_, dummy); |
| 453 |
if (*s != '\0') { |
| 454 |
nclefs++; |
| 455 |
if (strlen(s) == 1) |
| 456 |
clef[nclefs-1] = s[0]; |
| 457 |
else |
| 458 |
clef[nclefs-1] = s[1]; |
| 459 |
} |
| 460 |
} while (*s != '\0'); |
| 461 |
} |
| 462 |
|
| 463 |
|
| 464 |
Static void setDimension(Char *line_, command_type lno) |
| 465 |
{ |
| 466 |
Char line[256]; |
| 467 |
short l; |
| 468 |
short n = 0, p = 0; |
| 469 |
Char STR1[256]; |
| 470 |
|
| 471 |
strcpy(line, line_); |
| 472 |
if (*line == '\0') |
| 473 |
return; |
| 474 |
l = strlen(line); |
| 475 |
do { |
| 476 |
n++; |
| 477 |
if (line[n-1] == '.') |
| 478 |
p++; |
| 479 |
} while (n <= l && (line[n-1] == '.' || isdigit(line[n-1]))); |
| 480 |
if (n == p || p > 1 || |
| 481 |
line[n-1] != 'i' && line[n-1] != 'm' && line[n-1] != 'p') |
| 482 |
error("Dimension must be a number followed by in, mm or pt", print); |
| 483 |
sprintf(cline[(long)lno], "w%s", substr_(STR1, line, 1, n)); |
| 484 |
} |
| 485 |
|
| 486 |
|
| 487 |
Static void setSize(Char *line_) |
| 488 |
{ |
| 489 |
Char line[256]; |
| 490 |
stave_index0 i = 0; |
| 491 |
Char word[256]; |
| 492 |
stave_index0 FORLIM; |
| 493 |
|
| 494 |
strcpy(line, line_); |
| 495 |
while (i < ninstr) { |
| 496 |
GetNextWord(word, line, blank_, dummy); |
| 497 |
if (*word == '\0') |
| 498 |
break; |
| 499 |
i++; |
| 500 |
getNum(word, &musicsize); |
| 501 |
stave_size[i-1] = musicsize; |
| 502 |
} |
| 503 |
if ((unsigned)musicsize >= 32 || ((1L << musicsize) & 0x110000L) == 0) { |
| 504 |
FORLIM = ninstr; |
| 505 |
for (i = 0; i <= FORLIM - 1; i++) { |
| 506 |
if (stave_size[i] == unspec) |
| 507 |
stave_size[i] = musicsize; |
| 508 |
} |
| 509 |
} |
| 510 |
if (musicsize < 16) |
| 511 |
musicsize = 16; |
| 512 |
else if (musicsize > 20) |
| 513 |
musicsize = 20; |
| 514 |
} |
| 515 |
|
| 516 |
|
| 517 |
Static command_type findCommand(Char *command) |
| 518 |
{ |
| 519 |
command_type j; |
| 520 |
|
| 521 |
curtail(command, ':'); |
| 522 |
if (equalsIgnoreCase(command, "STYLE")) |
| 523 |
style_supplied = true; |
| 524 |
for (j = c1; j <= cn; j = (command_type)((long)j + 1)) { |
| 525 |
if (equalsIgnoreCase(command, commands[(long)j])) |
| 526 |
return j; |
| 527 |
} |
| 528 |
return none; |
| 529 |
} |
| 530 |
|
| 531 |
|
| 532 |
boolean isCommand(Char *command_) |
| 533 |
{ |
| 534 |
Char command[256]; |
| 535 |
|
| 536 |
strcpy(command, command_); |
| 537 |
return (findCommand(command) != none); |
| 538 |
} |
| 539 |
|
| 540 |
|
| 541 |
Static boolean mustAppend(command_type command) |
| 542 |
{ |
| 543 |
return (command == tex); |
| 544 |
} |
| 545 |
|
| 546 |
|
| 547 |
Static void doEnable(Char *line, boolean choice) |
| 548 |
{ |
| 549 |
Char word[256]; |
| 550 |
Char STR1[256]; |
| 551 |
|
| 552 |
do { |
| 553 |
GetNextWord(word, line, blank_, dummy); |
| 554 |
if (*word != '\0') { |
| 555 |
if (!setFeature(word, choice)) { |
| 556 |
sprintf(STR1, "No such feature: %s", word); |
| 557 |
error(STR1, !print); |
| 558 |
} |
| 559 |
} |
| 560 |
} while (*word != '\0'); |
| 561 |
} |
| 562 |
|
| 563 |
|
| 564 |
Static void setRange(Char *line_) |
| 565 |
{ |
| 566 |
Char line[256]; |
| 567 |
short v, p; |
| 568 |
Char vl[256]; |
| 569 |
short FORLIM; |
| 570 |
Char STR1[256], STR2[256]; |
| 571 |
|
| 572 |
strcpy(line, line_); |
| 573 |
line_no = orig_range_line; |
| 574 |
FORLIM = nvoices; |
| 575 |
for (v = 1; v <= FORLIM; v++) { |
| 576 |
strcpy(vl, voice_label[v-1]); |
| 577 |
sprintf(STR1, "%s=", vl); |
| 578 |
p = strpos2(line, STR1, 1); |
| 579 |
if (p > 0) { |
| 580 |
if (strlen(line) < p + 6) { |
| 581 |
sprintf(STR2, "At least five characters must follow \"%s=\"", vl); |
| 582 |
error(STR2, print); |
| 583 |
} |
| 584 |
defineRange(v, substr_(STR2, line, p + strlen(vl) + 1, 5)); |
| 585 |
} else { |
| 586 |
sprintf(STR2, "No range defined for voice %s", vl); |
| 587 |
warning(STR2, print); |
| 588 |
defineRange(v, ""); |
| 589 |
} |
| 590 |
} |
| 591 |
} |
| 592 |
|
| 593 |
|
| 594 |
/* TODO: This procedure should test for assertions in a comment |
| 595 |
or be removed */ |
| 596 |
Static boolean isAssertion(Char *line) |
| 597 |
{ |
| 598 |
return false; |
| 599 |
} |
| 600 |
|
| 601 |
|
| 602 |
Static line_type doCommand(Char *line_) |
| 603 |
{ |
| 604 |
line_type Result; |
| 605 |
Char line[256]; |
| 606 |
Char command[256]; |
| 607 |
command_type last_command; |
| 608 |
boolean starts_with_note; |
| 609 |
Char STR1[256]; |
| 610 |
Char STR3[70]; |
| 611 |
Char STR4[256]; |
| 612 |
|
| 613 |
strcpy(line, line_); |
| 614 |
if (line[0] == comment && !isAssertion(line)) |
| 615 |
return comment_line; |
| 616 |
starts_with_note = maybeMusicLine(line); |
| 617 |
GetNextWord(command, line, blank_, colon_); |
| 618 |
sprintf(STR1, "%c", colon_); |
| 619 |
if (endsWith(command, STR1)) { |
| 620 |
last_command = findCommand(command); |
| 621 |
Result = command_line; |
| 622 |
if (last_command == enable) |
| 623 |
doEnable(line, true); |
| 624 |
else if (last_command == disable) |
| 625 |
doEnable(line, false); |
| 626 |
else if (last_command == range) |
| 627 |
orig_range_line = line_no; |
| 628 |
if (last_command != none) { |
| 629 |
if (mustAppend(last_command) && redefined[(long)last_command]) { |
| 630 |
if (strlen(cline[(long)last_command]) + strlen(line) > 254) { |
| 631 |
sprintf(STR3, |
| 632 |
"Total length of preamble command %s must not exceed 255", |
| 633 |
commands[(long)last_command]); |
| 634 |
error(STR3, !print); |
| 635 |
} |
| 636 |
sprintf(cline[(long)last_command] + strlen(cline[(long)last_command]), |
| 637 |
"\n%s", line); |
| 638 |
} else { |
| 639 |
strcpy(cline[(long)last_command], line); |
| 640 |
if (warn_redefine && redefined[(long)last_command]) { |
| 641 |
sprintf(STR4, "You have redefined preamble command %s", command); |
| 642 |
warning(STR4, print); |
| 643 |
} |
| 644 |
} |
| 645 |
if (last_command == start) |
| 646 |
strcpy(start_line, line); |
| 647 |
redefined[(long)last_command] = true; |
| 648 |
return Result; |
| 649 |
} |
| 650 |
Result = colon_line; |
| 651 |
sprintf(STR4, "%s%c %s", command, colon_, line); |
| 652 |
addStyle(STR4); |
| 653 |
orig_style_line[known_styles-1] = line_no; |
| 654 |
return Result; |
| 655 |
} else if (starts_with_note) |
| 656 |
return plain_line; |
| 657 |
else |
| 658 |
return unknown; |
| 659 |
return Result; |
| 660 |
} |
| 661 |
|
| 662 |
|
| 663 |
void setOnly(Char *line_) |
| 664 |
{ |
| 665 |
Char line[256]; |
| 666 |
short num, num1, num2, l; |
| 667 |
Char s[256]; |
| 668 |
Char STR1[256]; |
| 669 |
|
| 670 |
strcpy(line, line_); |
| 671 |
if (*line == '\0') |
| 672 |
return; |
| 673 |
if (startsWithIgnoreCase(line, "only")) |
| 674 |
GetNextWord(STR1, line, colon_, dummy); |
| 675 |
for (l = 0; l <= lines_in_paragraph - 1; l++) |
| 676 |
omit_line[l] = true; |
| 677 |
do { |
| 678 |
GetNextWord(s, line, blank_, comma_); |
| 679 |
if (*s == '\0') |
| 680 |
return; |
| 681 |
curtail(s, comma_); |
| 682 |
if (pos1('-', s) == 0) { |
| 683 |
getNum(s, &num); |
| 684 |
if (num > 0 && num <= lines_in_paragraph) |
| 685 |
omit_line[num-1] = false; |
| 686 |
else |
| 687 |
warning("Invalid line number in Only: is skipped", print); |
| 688 |
} else { |
| 689 |
getTwoNums(s, &num1, &num2); |
| 690 |
if (num1 > 0 && num2 <= lines_in_paragraph) { |
| 691 |
for (num = num1 - 1; num <= num2 - 1; num++) |
| 692 |
omit_line[num] = false; |
| 693 |
} else |
| 694 |
warning("Invalid line range in Only: is skipped", print); |
| 695 |
} |
| 696 |
} while (true); |
| 697 |
} |
| 698 |
|
| 699 |
|
| 700 |
void interpretCommands(void) |
| 701 |
{ |
| 702 |
short i, num, den, nbars; |
| 703 |
Char STR2[256]; |
| 704 |
short FORLIM; |
| 705 |
|
| 706 |
strcpy(title_line, cline[(long)title]); |
| 707 |
strcpy(part_line, cline[(long)part]); |
| 708 |
if (*cline[(long)poet] != '\0' || *cline[(long)composer] != '\0') |
| 709 |
sprintf(composer_line, "\\mtxComposerLine{%s}{%s}", |
| 710 |
cline[(long)poet], cline[(long)composer]); |
| 711 |
else |
| 712 |
*composer_line = '\0'; |
| 713 |
strcpy(pmx_line, cline[(long)pmx]); |
| 714 |
GetNextWord(options_line, cline[(long)options], blank_, dummy); |
| 715 |
FORLIM = known_styles; |
| 716 |
for (i = 0; i <= FORLIM - 1; i++) |
| 717 |
style_used[i] = false; |
| 718 |
applyStyles(); |
| 719 |
setVoices(voices); |
| 720 |
FORLIM = known_styles; |
| 721 |
for (i = old_known_styles; i <= FORLIM - 1; i++) { |
| 722 |
if (!style_used[i]) { |
| 723 |
warning("The following style was supplied but not used", !print); |
| 724 |
puts(known_style[i]); |
| 725 |
} |
| 726 |
} |
| 727 |
setClefs(clefs); |
| 728 |
if (!redefined[(long)meter]) { |
| 729 |
sprintf(STR2, "You have not defined Meter, assuming \"%s\" ", |
| 730 |
cline[(long)meter]); |
| 731 |
warning(STR2, !print); |
| 732 |
} |
| 733 |
getMeter(cline[(long)meter], &meternum, &meterdenom, &pmnum, &pmdenom); |
| 734 |
setDefaultDuration(meterdenom); |
| 735 |
if (meternum == 0 && |
| 736 |
!(redefined[(long)pages] || redefined[(long)systems] || |
| 737 |
redefined[(long)bars])) { |
| 738 |
strcpy(cline[(long)bars], "1"); |
| 739 |
redefined[(long)bars] = true; |
| 740 |
} |
| 741 |
if (redefined[(long)pages] || redefined[(long)systems]) { |
| 742 |
if (redefined[(long)bars]) |
| 743 |
warning("BARS/LINE ignored since you specified PAGES or SYSTEMS", print); |
| 744 |
if (redefined[(long)systems]) |
| 745 |
getNum(cline[(long)systems], &n_systems); |
| 746 |
else |
| 747 |
warning("PAGES specified but not SYSTEMS", !print); |
| 748 |
if (redefined[(long)pages]) |
| 749 |
getNum(cline[(long)pages], &n_pages); |
| 750 |
else |
| 751 |
warning("SYSTEMS specified but not PAGES", !print); |
| 752 |
} else if (redefined[(long)bars]) { |
| 753 |
getNum(cline[(long)bars], &nbars); |
| 754 |
if (nbars > 0) { |
| 755 |
n_pages = 0; |
| 756 |
n_systems = nbars; |
| 757 |
} |
| 758 |
} |
| 759 |
getNum(cline[(long)sharps], &n_sharps); |
| 760 |
setSpace(cline[(long)space]); |
| 761 |
setSize(cline[(long)msize]); |
| 762 |
getTwoNums(cline[(long)shortnote], &num, &den); |
| 763 |
if (den == 0) |
| 764 |
den = 1; |
| 765 |
short_note = num * 64 / den; |
| 766 |
if (*cline[(long)flats] != '\0') { |
| 767 |
getNum(cline[(long)flats], &n_sharps); |
| 768 |
n_sharps = -n_sharps; |
| 769 |
} |
| 770 |
setName(); |
| 771 |
setIndent(); |
| 772 |
setInitOctave(); |
| 773 |
setOnly(cline[(long)only]); |
| 774 |
setRange(cline[(long)range]); |
| 775 |
setDimension(cline[(long)width], width); |
| 776 |
setDimension(cline[(long)height], height); |
| 777 |
if (*options_line != '\0') { |
| 778 |
warning("\"Options\" is cryptic and obsolescent.", !print); |
| 779 |
printf(" Use \"Enable\" and \"Disable\" instead.\n"); |
| 780 |
} |
| 781 |
FORLIM = strlen(options_line); |
| 782 |
for (i = 0; i <= FORLIM - 1; i++) |
| 783 |
processOption(options_line[i]); |
| 784 |
} |
| 785 |
|
| 786 |
|
| 787 |
void preambleDefaults(void) |
| 788 |
{ |
| 789 |
short i; |
| 790 |
|
| 791 |
xmtrnum0 = 0.0; |
| 792 |
strcpy(fracindent, "0"); |
| 793 |
musicsize = 20; |
| 794 |
*start_line = '\0'; |
| 795 |
some_vocal = false; |
| 796 |
ngroups = 0; |
| 797 |
style_supplied = false; |
| 798 |
for (i = 1; i <= maxvoices; i++) |
| 799 |
setVocal(i, false); |
| 800 |
for (i = 0; i <= maxstaves - 1; i++) |
| 801 |
stave_size[i] = unspec; |
| 802 |
for (i = 0; i <= maxstaves; i++) |
| 803 |
nspace[i] = unspec; |
| 804 |
/* next line seems to be spurious. 0.63a RDT */ |
| 805 |
/* begin nspace[i]:=unspec; stave_size[i]:=unspec; end; */ |
| 806 |
n_pages = 1; |
| 807 |
n_systems = 1; |
| 808 |
readStyles(); |
| 809 |
old_known_styles = known_styles; |
| 810 |
for (i = 0; i <= lines_in_paragraph - 1; i++) |
| 811 |
omit_line[i] = false; |
| 812 |
} |
| 813 |
|
| 814 |
|
| 815 |
Static void preambleGuess(voice_index maybe_voices) |
| 816 |
{ |
| 817 |
switch (maybe_voices) { |
| 818 |
|
| 819 |
case 1: |
| 820 |
strcpy(cline[(long)style], "Solo"); |
| 821 |
break; |
| 822 |
|
| 823 |
case 2: |
| 824 |
strcpy(cline[(long)style], "Duet"); |
| 825 |
break; |
| 826 |
|
| 827 |
case 3: |
| 828 |
strcpy(cline[(long)style], "Trio"); |
| 829 |
break; |
| 830 |
|
| 831 |
case 4: |
| 832 |
strcpy(cline[(long)style], "Quartet"); |
| 833 |
break; |
| 834 |
|
| 835 |
case 5: |
| 836 |
strcpy(cline[(long)style], "Quintet"); |
| 837 |
break; |
| 838 |
|
| 839 |
case 6: |
| 840 |
strcpy(cline[(long)style], "Sextet"); |
| 841 |
break; |
| 842 |
|
| 843 |
case 7: |
| 844 |
strcpy(cline[(long)style], "Septet"); |
| 845 |
break; |
| 846 |
|
| 847 |
default: |
| 848 |
error("I cannot guess a style", !print); |
| 849 |
return; |
| 850 |
break; |
| 851 |
} |
| 852 |
printf("I guess this piece is a %s for strings in C major.\n", |
| 853 |
cline[(long)style]); |
| 854 |
printf(" Why not provide a STYLE in the setup paragraph to make sure?\n"); |
| 855 |
} |
| 856 |
|
| 857 |
|
| 858 |
/* ------------------------------------------------------------------ */ |
| 859 |
|
| 860 |
void nonMusic(void) |
| 861 |
{ |
| 862 |
paragraph_index i, FORLIM; |
| 863 |
|
| 864 |
FORLIM = para_len; |
| 865 |
for (i = 0; i <= FORLIM - 1; i++) |
| 866 |
doCommand(P[i]); |
| 867 |
setOnly(cline[(long)only]); |
| 868 |
wipeCommands(); |
| 869 |
} |
| 870 |
|
| 871 |
|
| 872 |
boolean thisCase(void) |
| 873 |
{ |
| 874 |
boolean Result; |
| 875 |
|
| 876 |
/* p2c: preamble.pas: Note: Eliminated unused assignment statement [338] */ |
| 877 |
if (!startsWithIgnoreCase(P[0], "case:")) |
| 878 |
return true; |
| 879 |
Result = (choice != ' ' && pos1(choice, P[0]) > 0); |
| 880 |
strcpy(P[0], "%"); |
| 881 |
return Result; |
| 882 |
} |
| 883 |
|
| 884 |
|
| 885 |
void augmentPreamble(boolean control_para) |
| 886 |
{ |
| 887 |
paragraph_index i; |
| 888 |
line_type l; |
| 889 |
short s[5]; |
| 890 |
paragraph_index FORLIM; |
| 891 |
|
| 892 |
if (!thisCase()) |
| 893 |
return; |
| 894 |
for (l = unknown; l <= plain_line; l = (line_type)((long)l + 1)) |
| 895 |
s[(long)l] = 0; |
| 896 |
FORLIM = para_len; |
| 897 |
for (i = 0; i <= FORLIM - 1; i++) { |
| 898 |
line_no = orig_line_no[i]; |
| 899 |
l = doCommand(P[i]); |
| 900 |
s[(long)l]++; |
| 901 |
if (l == comment_line && P[i][1] == comment) { |
| 902 |
predelete(P[i], 2); |
| 903 |
putLine(P[i]); |
| 904 |
} |
| 905 |
if (!control_para && l == unknown) |
| 906 |
error("Unidentifiable line", print); |
| 907 |
} |
| 908 |
if (!control_para && s[(long)command_line] > 0 && s[(long)plain_line] > 0) |
| 909 |
error("Mixture of preamble commands and music", !print); |
| 910 |
} |
| 911 |
|
| 912 |
|
| 913 |
void doPreamble(void) |
| 914 |
{ |
| 915 |
paragraph_index i; |
| 916 |
voice_index0 maybe_voices = 0; |
| 917 |
paragraph_index FORLIM; |
| 918 |
|
| 919 |
if (style_supplied) /*augmentPreamble(not known);*/ |
| 920 |
return; |
| 921 |
if (true) |
| 922 |
warning("No STYLE supplied", !print); |
| 923 |
FORLIM = para_len; |
| 924 |
for (i = 0; i <= FORLIM - 1; i++) { |
| 925 |
if (maybeMusicLine(P[i])) |
| 926 |
maybe_voices++; |
| 927 |
} |
| 928 |
if (maybe_voices > 0) |
| 929 |
preambleGuess(maybe_voices); |
| 930 |
else |
| 931 |
error("No voices found", !print); |
| 932 |
} |
| 933 |
|
| 934 |
|
| 935 |
void respace(void) |
| 936 |
{ |
| 937 |
stave_index i, j; |
| 938 |
Char STR1[256]; |
| 939 |
Char STR2[256], STR3[256]; |
| 940 |
|
| 941 |
for (i = ninstr; i >= 2; i--) { |
| 942 |
j = ninstr - i + 1; |
| 943 |
if (nspace[j] != unspec) { |
| 944 |
sprintf(STR3, "\\mtxInterInstrument{%s}{%s}", |
| 945 |
toString(STR1, i - 1), toString(STR2, nspace[j])); |
| 946 |
TeXtype2(STR3); |
| 947 |
} |
| 948 |
} |
| 949 |
if (nspace[ninstr] != unspec) { |
| 950 |
sprintf(STR3, "\\mtxStaffBottom{%s}", toString(STR1, nspace[ninstr])); |
| 951 |
TeXtype2(STR3); |
| 952 |
} |
| 953 |
must_respace = false; |
| 954 |
} |
| 955 |
|
| 956 |
|
| 957 |
void restyle(void) |
| 958 |
{ |
| 959 |
must_restyle = false; |
| 960 |
} |
| 961 |
|
| 962 |
|
| 963 |
Static short clefno(Char cl) |
| 964 |
{ |
| 965 |
short Result; |
| 966 |
Char STR2[44]; |
| 967 |
|
| 968 |
switch (cl) { |
| 969 |
|
| 970 |
case 'G': |
| 971 |
case '0': |
| 972 |
case 't': |
| 973 |
case '8': |
| 974 |
Result = 0; |
| 975 |
break; |
| 976 |
|
| 977 |
case 's': |
| 978 |
case '1': |
| 979 |
Result = 1; |
| 980 |
break; |
| 981 |
|
| 982 |
case 'm': |
| 983 |
case '2': |
| 984 |
Result = 2; |
| 985 |
break; |
| 986 |
|
| 987 |
case 'a': |
| 988 |
case '3': |
| 989 |
Result = 3; |
| 990 |
break; |
| 991 |
|
| 992 |
case 'n': |
| 993 |
case '4': |
| 994 |
Result = 4; |
| 995 |
break; |
| 996 |
|
| 997 |
case 'r': |
| 998 |
case '5': |
| 999 |
Result = 5; |
| 1000 |
break; |
| 1001 |
|
| 1002 |
case 'F': |
| 1003 |
case 'b': |
| 1004 |
case '6': |
| 1005 |
Result = 6; |
| 1006 |
break; |
| 1007 |
|
| 1008 |
case 'C': |
| 1009 |
Result = 3; |
| 1010 |
break; |
| 1011 |
|
| 1012 |
default: |
| 1013 |
sprintf(STR2, "Unknown clef code \"%c\" - replaced by treble", cl); |
| 1014 |
warning(STR2, print); |
| 1015 |
Result = 0; |
| 1016 |
break; |
| 1017 |
} |
| 1018 |
return Result; |
| 1019 |
} |
| 1020 |
|
| 1021 |
|
| 1022 |
Static void doTenorClefs(void) |
| 1023 |
{ |
| 1024 |
voice_index i; |
| 1025 |
Char c; |
| 1026 |
voice_index FORLIM; |
| 1027 |
Char STR1[256]; |
| 1028 |
Char STR3[256]; |
| 1029 |
|
| 1030 |
FORLIM = nclefs; |
| 1031 |
for (i = 1; i <= FORLIM; i++) { |
| 1032 |
c = clef[i-1]; |
| 1033 |
if (c == '8' || c == 't') { |
| 1034 |
sprintf(STR3, "\\\\mtxTenorClef{%s}\\", toString(STR1, PMXinstr(i))); |
| 1035 |
putLine(STR3); |
| 1036 |
} |
| 1037 |
} |
| 1038 |
} |
| 1039 |
|
| 1040 |
|
| 1041 |
Static void insertTeX(void) |
| 1042 |
{ |
| 1043 |
if (redefined[(long)tex]) |
| 1044 |
TeXtype2(cline[(long)tex]); |
| 1045 |
} |
| 1046 |
|
| 1047 |
|
| 1048 |
Local Char *pmxMeter(Char *Result) |
| 1049 |
{ |
| 1050 |
short denom, num; |
| 1051 |
Char STR1[256], STR3[256], STR4[256], STR5[256]; |
| 1052 |
|
| 1053 |
if (meternum == 0) { |
| 1054 |
num = beatsPerLine(); /** denom := 0; **/ |
| 1055 |
meterChange(old_meter_word, num, meterdenom, true); |
| 1056 |
} else |
| 1057 |
num = meternum; /** denom := pmdenom; **/ |
| 1058 |
/* CMO: unconditonally assign value of pmdenom to denom */ |
| 1059 |
denom = pmdenom; |
| 1060 |
sprintf(Result, "%s %s %s %s", |
| 1061 |
toString(STR1, num), toString(STR3, PMXmeterdenom(meterdenom)), |
| 1062 |
toString(STR4, pmnum), toString(STR5, denom)); |
| 1063 |
return Result; |
| 1064 |
} |
| 1065 |
|
| 1066 |
Local Char *sizecode(Char *Result, short k) |
| 1067 |
{ |
| 1068 |
strcpy(Result, "\\mtxNormalSize"); |
| 1069 |
switch (k) { |
| 1070 |
|
| 1071 |
case 13: |
| 1072 |
if (musicsize == 20) |
| 1073 |
strcpy(Result, "\\mtxTinySize"); |
| 1074 |
else |
| 1075 |
strcpy(Result, "\\mtxSmallSize"); |
| 1076 |
break; |
| 1077 |
|
| 1078 |
case 16: |
| 1079 |
if (musicsize == 20) |
| 1080 |
strcpy(Result, "\\mtxSmallSize"); |
| 1081 |
break; |
| 1082 |
|
| 1083 |
case 20: |
| 1084 |
if (musicsize == 16) |
| 1085 |
strcpy(Result, "\\mtxLargeSize"); |
| 1086 |
break; |
| 1087 |
|
| 1088 |
case 24: |
| 1089 |
if (musicsize == 20) |
| 1090 |
strcpy(Result, "\\mtxLargeSize"); |
| 1091 |
else |
| 1092 |
strcpy(Result, "\\mtxHugeSize"); |
| 1093 |
break; |
| 1094 |
|
| 1095 |
case 29: |
| 1096 |
strcpy(Result, "\\mtxHugeSize"); |
| 1097 |
break; |
| 1098 |
|
| 1099 |
default: |
| 1100 |
error("Valid sizes are 13, 16, 20, 24, 29", print); |
| 1101 |
break; |
| 1102 |
} |
| 1103 |
return Result; |
| 1104 |
} |
| 1105 |
|
| 1106 |
|
| 1107 |
void doPMXpreamble(void) |
| 1108 |
{ |
| 1109 |
static Char clefcode[9] = "0123456"; |
| 1110 |
short i, j; |
| 1111 |
Char clefs[256]; |
| 1112 |
Char STR1[256], STR2[256]; |
| 1113 |
Char STR3[58]; |
| 1114 |
short FORLIM; |
| 1115 |
Char STR5[256]; |
| 1116 |
|
| 1117 |
if (*composer_line != '\0') |
| 1118 |
putLine(composer_line); |
| 1119 |
if (*title_line != '\0') { |
| 1120 |
sprintf(STR2, "\\mtxTitleLine{%s}", title_line); |
| 1121 |
putLine(STR2); |
| 1122 |
} |
| 1123 |
putLine("---"); |
| 1124 |
if (instrumentNames() && !redefined[(long)indent]) |
| 1125 |
strcpy(fracindent, "0.12"); |
| 1126 |
fprintf(outfile, "%d", nstaves); |
| 1127 |
fprintf(outfile, " %d", -ninstr); |
| 1128 |
stave[ninstr] = nstaves + 1; |
| 1129 |
for (j = ninstr; j >= 1; j--) |
| 1130 |
fprintf(outfile, " %d", stave[j] - stave[j-1]); |
| 1131 |
fprintf(outfile, " %s %8.5f %d %d %d %d %s\n", |
| 1132 |
pmxMeter(STR1), xmtrnum0, n_sharps, n_pages, n_systems, musicsize, |
| 1133 |
fracindent); |
| 1134 |
FORLIM = ninstr; |
| 1135 |
for (i = 1; i <= FORLIM; i++) { |
| 1136 |
if (!instrumentNames()) |
| 1137 |
putLine(""); |
| 1138 |
else { |
| 1139 |
sprintf(STR3, "\\mtxInstrName{%s}", instr_name[ninstr - i]); |
| 1140 |
putLine(STR3); |
| 1141 |
} |
| 1142 |
} |
| 1143 |
*clefs = '\0'; |
| 1144 |
for (i = nclefs - 1; i >= 0; i--) |
| 1145 |
sprintf(clefs + strlen(clefs), "%c", clefcode[clefno(clef[i])]); |
| 1146 |
putLine(clefs); |
| 1147 |
if (*texdir == '\0') |
| 1148 |
strcpy(texdir, "./"); |
| 1149 |
putLine(texdir); |
| 1150 |
|
| 1151 |
pmx_preamble_done = true; |
| 1152 |
insertTeX(); |
| 1153 |
respace(); |
| 1154 |
|
| 1155 |
FORLIM = ngroups; |
| 1156 |
for (j = 1; j <= FORLIM; j++) |
| 1157 |
fprintf(outfile, "\\\\mtxGroup{%s}{%s}{%s}\\\n", |
| 1158 |
toString(STR1, j), toString(STR2, ninstr - group_start[j-1] + 1), |
| 1159 |
toString(STR5, ninstr - group_stop[j-1] + 1)); |
| 1160 |
FORLIM = ninstr; |
| 1161 |
for (j = 1; j <= FORLIM; j++) { |
| 1162 |
if (stave_size[j-1] != unspec) { |
| 1163 |
sprintf(STR5, "\\\\mtxSetSize{%s}{%s}\\", |
| 1164 |
toString(STR1, ninstr - j + 1), |
| 1165 |
sizecode(STR2, stave_size[j-1])); |
| 1166 |
putLine(STR5); |
| 1167 |
} |
| 1168 |
} |
| 1169 |
if (*part_line != '\0') { |
| 1170 |
putLine("Ti"); |
| 1171 |
putLine(part_line); |
| 1172 |
} |
| 1173 |
if (*composer_line != '\0') { |
| 1174 |
putLine("Tc"); |
| 1175 |
putLine("\\mtxPoetComposer"); |
| 1176 |
} |
| 1177 |
if (*title_line != '\0') { |
| 1178 |
fprintf(outfile, "Tt"); |
| 1179 |
if (nspace[0] != unspec) |
| 1180 |
fputs(toString(STR1, nspace[0]), outfile); |
| 1181 |
putc('\n', outfile); |
| 1182 |
putLine("\\mtxTitle"); |
| 1183 |
} |
| 1184 |
if (*pmx_line != '\0') |
| 1185 |
putLine(pmx_line); |
| 1186 |
doTenorClefs(); |
| 1187 |
if (*cline[(long)width] != '\0') |
| 1188 |
putLine(cline[(long)width]); |
| 1189 |
wipeCommands(); |
| 1190 |
} |
| 1191 |
|
| 1192 |
|
| 1193 |
Char *startString(Char *Result, voice_index0 voice) |
| 1194 |
{ |
| 1195 |
Char s[256], w[256]; |
| 1196 |
voice_index j; |
| 1197 |
|
| 1198 |
strcpy(s, start_line); |
| 1199 |
for (j = 1; j <= voice; j++) |
| 1200 |
GetNextWord(w, s, dummy, ';'); |
| 1201 |
curtail(w, ';'); |
| 1202 |
if (*w != '\0') { |
| 1203 |
sprintf(Result, "%s ", w); |
| 1204 |
return Result; |
| 1205 |
} else |
| 1206 |
return strcpy(Result, w); |
| 1207 |
} |
| 1208 |
|
| 1209 |
|
| 1210 |
|
| 1211 |
|
| 1212 |
/* End. */ |