| 1 | |
| 2 | /* Copyright (c) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by Arkkra Enterprises */ |
| 3 | /* All rights reserved */ |
| 4 | |
| 5 | |
| 6 | |
| 7 | /* routines for printing info for debugging purposes */ |
| 8 | /* It would be nicer to write a program to read the header files and |
| 9 | * generate most of these routines from there to keep them up to date, |
| 10 | * but this will do for now. */ |
| 11 | |
| 12 | |
| 13 | #include "defines.h" |
| 14 | #include "structs.h" |
| 15 | #include "globals.h" |
| 16 | |
| 17 | |
| 18 | /* for number-to-English name translations, if we fall off the bottom of |
| 19 | * a switch without a match, need to return something, so use "unknown" */ |
| 20 | static char Unknown[] = "unknown"; |
| 21 | |
| 22 | |
| 23 | /* static functions */ |
| 24 | static void print_ssv P((struct SSV *ssv_p)); |
| 25 | static void print_markorder P((struct SSV *ssv_p, int place)); |
| 26 | static void print_printdata P((struct PRINTDATA *printdata_p)); |
| 27 | static void print_bar P((struct BAR *bar_p)); |
| 28 | static void print_chhead P((struct CHORD *ch_p)); |
| 29 | static void print_staff P((struct STAFF *staff_p)); |
| 30 | static void print_grpsyl P((struct GRPSYL *g_p, char *gstype, int vno)); |
| 31 | static void print_slurtolist P((struct NOTE *note_p)); |
| 32 | static void pr_stuff P((struct STUFF *stuff_p)); |
| 33 | static char *xlate_place P((int place)); |
| 34 | static char *xlate_stufftype P((int stuff_type)); |
| 35 | static char * xlate_linetype P((int ltype)); |
| 36 | static char *xlate_gvalue P((int grpvalue)); |
| 37 | static char *xlate_gsize P((int grpsize)); |
| 38 | static char *xlate_gcont P((int gcont)); |
| 39 | static char *xlate_item P((int item)); |
| 40 | static char *xlate_dir P((int dir)); |
| 41 | static void print_curve P((struct CURVE *curve_p)); |
| 42 | static char *xlate_coordtype P((int coordtype)); |
| 43 | \f |
| 44 | |
| 45 | /* tell what is in the main linked list. Walk down the list and print |
| 46 | * things of interest. */ |
| 47 | |
| 48 | void |
| 49 | print_mainll() |
| 50 | |
| 51 | { |
| 52 | struct MAINLL *mll_p; /* to walk through list */ |
| 53 | register int i; /* count number of items in list */ |
| 54 | int s; /* walk through staffs */ |
| 55 | |
| 56 | |
| 57 | /* only do this stuff if debug level 128 is on */ |
| 58 | if (debug_on(128) == 0) { |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | debug(128, "\n\t\t==== Contents of main linked list ====\n"); |
| 63 | |
| 64 | /* walk down the main linked list, printing things about each struct |
| 65 | * in it */ |
| 66 | for (i = 0, mll_p = Mainllhc_p; mll_p != (struct MAINLL *) 0; |
| 67 | mll_p = mll_p->next, i++) { |
| 68 | |
| 69 | debug(128, "\nmainll %d: type %s", i, stype_name(mll_p->str)); |
| 70 | if (mll_p->inputfile != (char *) 0 && mll_p->inputlineno > 0) { |
| 71 | debug(128, "from file %s inputlineno %d", |
| 72 | mll_p->inputfile, mll_p->inputlineno); |
| 73 | } |
| 74 | |
| 75 | /* print info of interest based on struct type */ |
| 76 | switch (mll_p->str) { |
| 77 | |
| 78 | case S_SSV: |
| 79 | print_ssv(mll_p->u.ssv_p); |
| 80 | break; |
| 81 | |
| 82 | case S_BAR: |
| 83 | print_bar(mll_p->u.bar_p); |
| 84 | break; |
| 85 | |
| 86 | case S_CURVE: |
| 87 | print_curve(mll_p->u.curve_p); |
| 88 | break; |
| 89 | |
| 90 | case S_LINE: |
| 91 | if (mll_p->u.line_p->linetype != L_NORMAL) { |
| 92 | debug(128, "\t%s\n", |
| 93 | xlate_linetype(mll_p->u.line_p->linetype)); |
| 94 | } |
| 95 | break; |
| 96 | |
| 97 | case S_PRHEAD: |
| 98 | print_printdata(mll_p->u.prhead_p->printdata_p); |
| 99 | break; |
| 100 | |
| 101 | case S_FEED: |
| 102 | debug(128, "\tfeed at (%f, %f) with%s pagefeed\n\tnorth %f, south %f, west %f, east %f", |
| 103 | mll_p->u.feed_p->c[AX], mll_p->u.feed_p->c[AY], |
| 104 | mll_p->u.feed_p->pagefeed ? "" : "out", |
| 105 | mll_p->u.feed_p->c[AN], mll_p->u.feed_p->c[AS], |
| 106 | mll_p->u.feed_p->c[AW], mll_p->u.feed_p->c[AE]); |
| 107 | debug(128, "\tleftmargin %f rightmargin %f", |
| 108 | mll_p->u.feed_p->leftmargin, |
| 109 | mll_p->u.feed_p->rightmargin); |
| 110 | if (mll_p->u.feed_p->top_p != 0) { |
| 111 | debug(128, "\ttop block: height %f", |
| 112 | mll_p->u.feed_p->top_p->height); |
| 113 | print_printdata(mll_p->u.feed_p->top_p->printdata_p); |
| 114 | } |
| 115 | if (mll_p->u.feed_p->bot_p != 0) { |
| 116 | debug(128, "\tbot block: height %f", |
| 117 | mll_p->u.feed_p->bot_p->height); |
| 118 | print_printdata(mll_p->u.feed_p->bot_p->printdata_p); |
| 119 | } |
| 120 | /* Note: after placment top2/bot2 are only meaningful |
| 121 | * on final FEED when doing gridsatend with more than |
| 122 | * one page worth of grids. */ |
| 123 | if (mll_p->u.feed_p->top2_p != 0) { |
| 124 | debug(128, "\ttop2 block: height %f", |
| 125 | mll_p->u.feed_p->top2_p->height); |
| 126 | print_printdata(mll_p->u.feed_p->top2_p->printdata_p); |
| 127 | } |
| 128 | if (mll_p->u.feed_p->bot2_p != 0) { |
| 129 | debug(128, "\tbot2 block: height %f", |
| 130 | mll_p->u.feed_p->bot2_p->height); |
| 131 | print_printdata(mll_p->u.feed_p->bot2_p->printdata_p); |
| 132 | } |
| 133 | break; |
| 134 | |
| 135 | case S_CLEFSIG: |
| 136 | debug(128, "\twest at %f, prtimesig %d, hide %d", |
| 137 | mll_p->u.clefsig_p->wclefsiga, |
| 138 | mll_p->u.clefsig_p->prtimesig, |
| 139 | mll_p->u.clefsig_p->hide); |
| 140 | if (mll_p->u.clefsig_p->bar_p != (struct BAR *) 0) { |
| 141 | debug(128, " clefsig includes pseudo bar:"); |
| 142 | print_bar(mll_p->u.clefsig_p->bar_p); |
| 143 | } |
| 144 | for (s = 1; s <= Score.staffs; s++) { |
| 145 | debug(128, " staff %d: prclef %d, %d sharps, %d naturals", |
| 146 | s, mll_p->u.clefsig_p->prclef[s], |
| 147 | mll_p->u.clefsig_p->sharps[s], |
| 148 | mll_p->u.clefsig_p->naturals[s]); |
| 149 | } |
| 150 | break; |
| 151 | |
| 152 | case S_CHHEAD: |
| 153 | print_chhead(mll_p->u.chhead_p->ch_p); |
| 154 | break; |
| 155 | |
| 156 | case S_STAFF: |
| 157 | print_staff(mll_p->u.staff_p); |
| 158 | break; |
| 159 | |
| 160 | case S_BLOCKHEAD: |
| 161 | debug(128, "height %f\n", mll_p->u.blockhead_p->height); |
| 162 | print_printdata(mll_p->u.blockhead_p->printdata_p); |
| 163 | break; |
| 164 | default: |
| 165 | break; |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | \f |
| 170 | |
| 171 | /* translate S_* numbers used for the str field of MAINLL struct to names */ |
| 172 | |
| 173 | char * |
| 174 | stype_name(stype) |
| 175 | |
| 176 | int stype; /* the S_* number to translate */ |
| 177 | |
| 178 | { |
| 179 | switch(stype) { |
| 180 | case S_SSV: |
| 181 | return("S_SSV"); |
| 182 | case S_CHHEAD: |
| 183 | return("S_CHHEAD"); |
| 184 | case S_PRHEAD: |
| 185 | return("S_PRHEAD"); |
| 186 | case S_LINE: |
| 187 | return("S_LINE"); |
| 188 | case S_CURVE: |
| 189 | return("S_CURVE"); |
| 190 | case S_BAR: |
| 191 | return("S_BAR"); |
| 192 | case S_CLEFSIG: |
| 193 | return("S_CLEFSIG"); |
| 194 | case S_FEED: |
| 195 | return("S_FEED"); |
| 196 | case S_STAFF: |
| 197 | return("S_STAFF"); |
| 198 | case S_BLOCKHEAD: |
| 199 | return("S_BLOCKHEAD"); |
| 200 | default: |
| 201 | return(Unknown); |
| 202 | } |
| 203 | } |
| 204 | \f |
| 205 | |
| 206 | /* print some useful info from SSV struct */ |
| 207 | |
| 208 | static void |
| 209 | print_ssv(ssv_p) |
| 210 | |
| 211 | struct SSV *ssv_p; /* which struct to report on */ |
| 212 | |
| 213 | { |
| 214 | debug(128, "\tcontext = %s", contextname(ssv_p->context)); |
| 215 | debug(128, "\tstaffno = %d", ssv_p->staffno); |
| 216 | debug(128, "\tvoiceno = %d", ssv_p->voiceno); |
| 217 | if (ssv_p->strinfo != (struct STRINGINFO *) 0) { |
| 218 | int i; |
| 219 | |
| 220 | for (i = 0; i < ssv_p->stafflines; i++) { |
| 221 | debug(128, "\t\ttab string %d: %c%c nticks=%d, oct=%d", |
| 222 | i, ssv_p->strinfo[i].letter, |
| 223 | ssv_p->strinfo[i].accidental == '\0' |
| 224 | ? ' ' : ssv_p->strinfo[i].accidental, |
| 225 | ssv_p->strinfo[i].nticks, |
| 226 | ssv_p->strinfo[i].octave); |
| 227 | } |
| 228 | } |
| 229 | if (ssv_p->used[ABOVEORDER] == YES) { |
| 230 | print_markorder(ssv_p, PL_ABOVE); |
| 231 | } |
| 232 | if (ssv_p->used[BELOWORDER] == YES) { |
| 233 | print_markorder(ssv_p, PL_BELOW); |
| 234 | } |
| 235 | if (ssv_p->used[BETWEENORDER] == YES) { |
| 236 | print_markorder(ssv_p, PL_BETWEEN); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | static void |
| 241 | print_markorder(ssv_p, place) |
| 242 | |
| 243 | struct SSV *ssv_p; |
| 244 | int place; |
| 245 | |
| 246 | { |
| 247 | int m; |
| 248 | |
| 249 | debug(128, "\tmarkorder %s: ", xlate_place(place)); |
| 250 | for (m = 0; m < NUM_MARK; m++) { |
| 251 | debug(128, "\t\t%d ", ssv_p->markorder[place][m]); |
| 252 | } |
| 253 | debug(128, "\n"); |
| 254 | } |
| 255 | \f |
| 256 | |
| 257 | /* print useful info from STAFF struct */ |
| 258 | |
| 259 | static void |
| 260 | print_staff(staff_p) |
| 261 | |
| 262 | struct STAFF *staff_p; /* which to report on */ |
| 263 | |
| 264 | { |
| 265 | register int i; /* index to walk down a list */ |
| 266 | |
| 267 | |
| 268 | debug(128, "\tstaffno = %d, visible = %s", staff_p->staffno, |
| 269 | staff_p->visible == YES ? "y" : "n"); |
| 270 | |
| 271 | /* print each group */ |
| 272 | for ( i = 0; i < MAXVOICES; i++) { |
| 273 | if (staff_p->groups_p[i] != (struct GRPSYL *) 0) { |
| 274 | print_grpsyl(staff_p->groups_p[i], "GROUP", i + 1); |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | /* print each lyrics syllable */ |
| 279 | for (i = 0; i < staff_p->nsyllists; i++) { |
| 280 | debug(128, "\n\tsylplace = %s", |
| 281 | xlate_place(staff_p->sylplace[i])); |
| 282 | print_grpsyl(staff_p->syls_p[i], "SYLLABLE", |
| 283 | staff_p->syls_p[i]->vno); |
| 284 | } |
| 285 | |
| 286 | pr_stuff(staff_p->stuff_p); |
| 287 | } |
| 288 | \f |
| 289 | |
| 290 | /* print info from a list of GRPSYL structs */ |
| 291 | |
| 292 | static void |
| 293 | print_grpsyl(g_p, gstype, vno) |
| 294 | |
| 295 | struct GRPSYL *g_p; /* which GRPSYL */ |
| 296 | char *gstype; /* "GROUP" or "SYLLABLE" */ |
| 297 | int vno; /* voice number or verse number */ |
| 298 | |
| 299 | { |
| 300 | register int i; /* index through list */ |
| 301 | char *sylbuff; /* syllable with all ASCII characters */ |
| 302 | |
| 303 | |
| 304 | if (debug_on(128) == 0) { |
| 305 | return; |
| 306 | } |
| 307 | |
| 308 | (void) fprintf(stderr, "\tgrpsyl = %s, vno = %d\n", gstype, vno); |
| 309 | |
| 310 | /* print info about the stuff in GRPSYL structs */ |
| 311 | for ( ; g_p != (struct GRPSYL *) 0; g_p = g_p->next) { |
| 312 | |
| 313 | (void) fprintf(stderr, "\n\t\tbasictime = %d, dots = %d, fulltime = %ld/%ld\n", |
| 314 | g_p->basictime, g_p->dots, |
| 315 | g_p->fulltime.n, g_p->fulltime.d); |
| 316 | (void) fprintf(stderr, "\t\tc[AX] = %f, c[AY] = %f\n", |
| 317 | g_p->c[AX], g_p->c[AY]); |
| 318 | (void) fprintf(stderr, "\t\tc[AW] = %f, c[AE] = %f\n", |
| 319 | g_p->c[AW], g_p->c[AE]); |
| 320 | (void) fprintf(stderr, "\t\tc[AN] = %f, c[AS] = %f\n", |
| 321 | g_p->c[AN], g_p->c[AS]); |
| 322 | if (g_p->ho_usage != HO_NONE) { |
| 323 | (void) fprintf(stderr, "\t\tho_usage = %d", g_p->ho_usage); |
| 324 | if (g_p->ho_usage == HO_VALUE) { |
| 325 | (void) fprintf(stderr, ", ho_value = %f", |
| 326 | g_p->ho_value); |
| 327 | } |
| 328 | (void) fprintf(stderr, "\n"); |
| 329 | } |
| 330 | |
| 331 | /* if group, print info about it, including the list of |
| 332 | * notes if any */ |
| 333 | if (g_p->grpsyl == GS_GROUP) { |
| 334 | |
| 335 | (void) fprintf(stderr, "\t\tclef = %d, xdotr = %f, stemx = %f\n", |
| 336 | g_p->clef, g_p->xdotr, g_p->stemx); |
| 337 | (void) fprintf(stderr, "\t\tgrpvalue = %s, grpsize = %s, headshape = %d,\n\t\tgrpcont = %s, beamloc = %s, beamslope=%f\n", |
| 338 | xlate_gvalue(g_p->grpvalue), |
| 339 | xlate_gsize(g_p->grpsize), |
| 340 | g_p->headshape, |
| 341 | xlate_gcont(g_p->grpcont), |
| 342 | xlate_item(g_p->beamloc), |
| 343 | g_p->beamslope); |
| 344 | if (g_p->roll != NOITEM) { |
| 345 | (void) fprintf(stderr, "\t\troll = %s, rolldir = %s\n", |
| 346 | xlate_item(g_p->roll), |
| 347 | xlate_dir(g_p->rolldir)); |
| 348 | } |
| 349 | |
| 350 | if( g_p->padding != 0.0) { |
| 351 | (void) fprintf(stderr, "\t\tpadding=%f\n", g_p->padding); |
| 352 | } |
| 353 | (void) fprintf(stderr, "\t\tis_meas=%d, uncompressible=%d\n", |
| 354 | g_p->is_meas, g_p->uncompressible); |
| 355 | |
| 356 | (void) fprintf(stderr, "\t\tstemlen=%f, stemdir=%s\n", |
| 357 | g_p->stemlen, xlate_dir(g_p->stemdir)); |
| 358 | (void) fprintf(stderr, "\t\ttie=%d, slash_alt=%d\n", |
| 359 | g_p->tie, g_p->slash_alt); |
| 360 | |
| 361 | /* if part of tuplet, print info about that */ |
| 362 | if (g_p->tuploc != NOITEM) { |
| 363 | (void) fprintf(stderr, "\t\ttuploc=%s, tupcont=%d\n", |
| 364 | xlate_item(g_p->tuploc), g_p->tupcont); |
| 365 | (void) fprintf(stderr, "\t\tprinttup=%d, tupside=%s, tupextend=%f\n", |
| 366 | g_p->printtup, xlate_place(g_p->tupside), |
| 367 | g_p->tupextend); |
| 368 | } |
| 369 | |
| 370 | /* print a bit about "with" lists */ |
| 371 | if (g_p->nwith) { |
| 372 | int w; |
| 373 | (void) fprintf(stderr, "\t\t%d items in 'with' list (normwith=%d):\n", |
| 374 | g_p->nwith, g_p->normwith); |
| 375 | for (w = 0; w < g_p->nwith; w++) { |
| 376 | (void) fprintf(stderr, "\t\t\t\"%s\"\n", |
| 377 | ascii_str(g_p->withlist[w], |
| 378 | YES, NO, TM_NONE)); |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | (void) fprintf(stderr, "\t\tnnotes = %d, beamto = %d, stemto = %d, stemto_idx = %d\n", |
| 383 | g_p->nnotes, g_p->beamto, |
| 384 | g_p->stemto, g_p->stemto_idx); |
| 385 | for (i = 0; i < g_p->nnotes; i++) { |
| 386 | if (is_tab_staff(g_p->staffno) == YES) { |
| 387 | (void) fprintf(stderr, "\t\t\tstring %d, fret %d, bend %d %d/%d, fret_paren %d\n", |
| 388 | g_p->notelist[i].STRINGNO, |
| 389 | g_p->notelist[i].FRETNO, |
| 390 | BENDINT(g_p->notelist[i]), |
| 391 | BENDNUM(g_p->notelist[i]), |
| 392 | BENDDEN(g_p->notelist[i]), |
| 393 | g_p->notelist[i].FRET_HAS_PAREN); |
| 394 | continue; |
| 395 | } |
| 396 | (void) fprintf(stderr, "\t\t\t%c %c %d steps %d", |
| 397 | g_p->notelist[i].letter, |
| 398 | g_p->notelist[i].accidental == '\0' |
| 399 | ? ' ' : g_p->notelist[i].accidental, |
| 400 | g_p->notelist[i].octave, |
| 401 | g_p->notelist[i].stepsup); |
| 402 | if (g_p->notelist[i].note_has_paren == YES) { |
| 403 | (void) fprintf(stderr, " note_paren (%f, %f)", |
| 404 | g_p->notelist[i].wlparen, |
| 405 | g_p->notelist[i].erparen); |
| 406 | } |
| 407 | if (g_p->notelist[i].acc_has_paren == YES) { |
| 408 | (void) fprintf(stderr, " acc_paren"); |
| 409 | } |
| 410 | if (g_p->notelist[i].tie == YES) { |
| 411 | (void) fprintf(stderr, " tie(style %d)", |
| 412 | g_p->notelist[i].tiestyle); |
| 413 | } |
| 414 | |
| 415 | (void) fprintf(stderr, " (headshape %d, headchar %d, headfont %d)", |
| 416 | g_p->notelist[i].headshape, |
| 417 | g_p->notelist[i].headchar, |
| 418 | g_p->notelist[i].headfont); |
| 419 | if (g_p->notelist[i].notesize != GS_NORMAL) { |
| 420 | (void) fprintf(stderr, " (size %s)", |
| 421 | xlate_gsize(g_p->notelist[i] |
| 422 | .notesize)); |
| 423 | } |
| 424 | if (g_p->notelist[i].is_bend == YES) { |
| 425 | fprintf(stderr, " is_bend"); |
| 426 | } |
| 427 | if (g_p->notelist[i].smallbend == YES) { |
| 428 | fprintf(stderr, " smallbend"); |
| 429 | } |
| 430 | print_slurtolist( &(g_p->notelist[i]) ); |
| 431 | (void) fprintf(stderr, "\n"); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | |
| 436 | /* if syllable, print it */ |
| 437 | if (g_p->syl != (char *) 0) { |
| 438 | sylbuff = ascii_str(g_p->syl, YES, NO, TM_NONE); |
| 439 | (void) fprintf(stderr, "\t\tsyllable = '%s', font %d, size %d\n", |
| 440 | sylbuff, g_p->syl[0], g_p->syl[1]); |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | \f |
| 445 | |
| 446 | /* print any slurtolist entries */ |
| 447 | |
| 448 | static void |
| 449 | print_slurtolist(note_p) |
| 450 | |
| 451 | struct NOTE *note_p; |
| 452 | |
| 453 | { |
| 454 | register int n; |
| 455 | |
| 456 | if ( (note_p->nslurto == 0) || (debug_on(128) == 0) ) { |
| 457 | return; |
| 458 | } |
| 459 | |
| 460 | (void) fprintf(stderr, " slurred to:"); |
| 461 | for (n = note_p->nslurto - 1; n >= 0; n--) { |
| 462 | switch (note_p->slurtolist[n].octave) { |
| 463 | case IN_UPWARD: |
| 464 | (void) fprintf(stderr, " IN_UPWARD"); |
| 465 | break; |
| 466 | case IN_DOWNWARD: |
| 467 | (void) fprintf(stderr, " IN_DOWNWARD"); |
| 468 | break; |
| 469 | case OUT_UPWARD: |
| 470 | (void) fprintf(stderr, " OUT_UPWARD"); |
| 471 | break; |
| 472 | case OUT_DOWNWARD: |
| 473 | (void) fprintf(stderr, " OUT_DOWNWARD"); |
| 474 | break; |
| 475 | default: |
| 476 | (void) fprintf(stderr, " %c%d", |
| 477 | note_p->slurtolist[n].letter, |
| 478 | note_p->slurtolist[n].octave); |
| 479 | } |
| 480 | } |
| 481 | } |
| 482 | \f |
| 483 | |
| 484 | /* given a GV_* value, return its English name */ |
| 485 | |
| 486 | static char * |
| 487 | xlate_gvalue(grpvalue) |
| 488 | |
| 489 | int grpvalue; |
| 490 | |
| 491 | { |
| 492 | switch (grpvalue) { |
| 493 | case GV_NORMAL: |
| 494 | return("NORMAL"); |
| 495 | case GV_ZERO: |
| 496 | return("ZERO"); |
| 497 | default: |
| 498 | return(Unknown); |
| 499 | } |
| 500 | } |
| 501 | \f |
| 502 | |
| 503 | /* given a GS_* value, return its English name */ |
| 504 | |
| 505 | static char * |
| 506 | xlate_gsize(grpsize) |
| 507 | |
| 508 | int grpsize; |
| 509 | |
| 510 | { |
| 511 | switch(grpsize) { |
| 512 | case GS_NORMAL: |
| 513 | return("NORMAL"); |
| 514 | case GS_SMALL: |
| 515 | return("SMALL"); |
| 516 | default: |
| 517 | return(Unknown); |
| 518 | } |
| 519 | } |
| 520 | \f |
| 521 | |
| 522 | /* given a GC_* grpcont value, return its English name */ |
| 523 | |
| 524 | static char * |
| 525 | xlate_gcont(grpcont) |
| 526 | |
| 527 | int grpcont; |
| 528 | |
| 529 | { |
| 530 | switch(grpcont) { |
| 531 | case GC_NOTES: |
| 532 | return("NOTES"); |
| 533 | case GC_REST: |
| 534 | return("REST"); |
| 535 | case GC_SPACE: |
| 536 | return("SPACE"); |
| 537 | default: |
| 538 | return(Unknown); |
| 539 | } |
| 540 | } |
| 541 | \f |
| 542 | |
| 543 | /* given an "ITEM" value, return its English name */ |
| 544 | |
| 545 | static char * |
| 546 | xlate_item(item) |
| 547 | |
| 548 | int item; |
| 549 | |
| 550 | { |
| 551 | switch(item) { |
| 552 | case NOITEM: |
| 553 | return("NOITEM"); |
| 554 | case INITEM: |
| 555 | return("INITEM"); |
| 556 | case STARTITEM: |
| 557 | return("STARTITEM"); |
| 558 | case ENDITEM: |
| 559 | return("ENDITEM"); |
| 560 | case LONEITEM: |
| 561 | return("LONEITEM"); |
| 562 | default: |
| 563 | return(Unknown); |
| 564 | } |
| 565 | } |
| 566 | \f |
| 567 | |
| 568 | /* translate direction to name */ |
| 569 | |
| 570 | static char * |
| 571 | xlate_dir(dir) |
| 572 | |
| 573 | int dir; |
| 574 | |
| 575 | { |
| 576 | switch(dir) { |
| 577 | case UP: |
| 578 | return("UP"); |
| 579 | case DOWN: |
| 580 | return("DOWN"); |
| 581 | default: |
| 582 | return("UNKNOWN"); |
| 583 | } |
| 584 | } |
| 585 | \f |
| 586 | |
| 587 | /* recursively print info from a list of PRINTDATA structs */ |
| 588 | |
| 589 | static void |
| 590 | print_printdata(printdata_p) |
| 591 | |
| 592 | struct PRINTDATA *printdata_p; |
| 593 | |
| 594 | { |
| 595 | char *buff; /* for all-ASCII version. */ |
| 596 | |
| 597 | |
| 598 | if (printdata_p == (struct PRINTDATA *) 0) { |
| 599 | /* we're at the end of the line... */ |
| 600 | return; |
| 601 | } |
| 602 | |
| 603 | buff = ascii_str(printdata_p->string, YES, NO, TM_NONE); |
| 604 | debug(128, "\tprint (isPostScript %d, justify %d, width %.2f, font %d, size %d) '%s'", |
| 605 | printdata_p->isPostScript, printdata_p->justifytype, |
| 606 | printdata_p->width, (int) printdata_p->string[0], |
| 607 | (int) printdata_p->string[1], buff); |
| 608 | |
| 609 | /* recurse down the list */ |
| 610 | print_printdata(printdata_p->next); |
| 611 | } |
| 612 | \f |
| 613 | |
| 614 | /* print useful info from a bar struct */ |
| 615 | |
| 616 | static void |
| 617 | print_bar(bar_p) |
| 618 | |
| 619 | struct BAR *bar_p; |
| 620 | |
| 621 | { |
| 622 | char *type; |
| 623 | struct TIMEDSSV *tssv_p; /* list of mid-meas param changes */ |
| 624 | |
| 625 | switch(bar_p->bartype) { |
| 626 | case INVISBAR: |
| 627 | type = "INVISBAR"; |
| 628 | break; |
| 629 | case SINGLEBAR: |
| 630 | type = "SINGLEBAR"; |
| 631 | break; |
| 632 | case DOUBLEBAR: |
| 633 | type = "DOUBLEBAR"; |
| 634 | break; |
| 635 | case REPEATSTART: |
| 636 | type = "REPEATSTART"; |
| 637 | break; |
| 638 | case REPEATEND: |
| 639 | type = "REPEATEND"; |
| 640 | break; |
| 641 | case REPEATBOTH: |
| 642 | type = "REPEATBOTH"; |
| 643 | break; |
| 644 | case ENDBAR: |
| 645 | type = "ENDBAR"; |
| 646 | break; |
| 647 | case RESTART: |
| 648 | type = "RESTART"; |
| 649 | break; |
| 650 | default: |
| 651 | type = Unknown; |
| 652 | break; |
| 653 | } |
| 654 | |
| 655 | debug(128, "\tbartype = %d (%s), endingloc=%d", bar_p->bartype, type, |
| 656 | bar_p->endingloc); |
| 657 | debug(128, "\tx = %f, y = %f, mnum = %d", bar_p->c[AX], bar_p->c[AY], |
| 658 | bar_p->mnum); |
| 659 | if (bar_p->reh_string != 0) { |
| 660 | debug(128, "\treh_string = '%s'", |
| 661 | ascii_str(bar_p->reh_string, YES, NO, TM_NONE)); |
| 662 | } |
| 663 | |
| 664 | for (tssv_p = bar_p->timedssv_p; tssv_p != 0; tssv_p = tssv_p->next) { |
| 665 | debug(128, "\tTimed SSV, time_off %d/%d\n", tssv_p->time_off.n, |
| 666 | tssv_p->time_off.d); |
| 667 | print_ssv(&tssv_p->ssv); |
| 668 | } |
| 669 | } |
| 670 | \f |
| 671 | |
| 672 | /* recursively print coord info about chords in chord list */ |
| 673 | |
| 674 | static void |
| 675 | print_chhead(ch_p) |
| 676 | |
| 677 | struct CHORD *ch_p; |
| 678 | |
| 679 | { |
| 680 | struct GRPSYL * gs_p; |
| 681 | |
| 682 | |
| 683 | if (ch_p != (struct CHORD *) 0) { |
| 684 | debug(128, "\tchord at (%f, %f), width %f, fullwidth %f", |
| 685 | ch_p->c[AX], ch_p->c[AY], ch_p->width, ch_p->fullwidth); |
| 686 | debug(128, "\tc[RW] = %f, c[RE] = %f", ch_p->c[RW], ch_p->c[RE]); |
| 687 | debug(128, "\tstarttime %d/%d, duration %d/%d, pseudodur %f", |
| 688 | ch_p->starttime.n, ch_p->starttime.d, |
| 689 | ch_p->duration.n, ch_p->duration.d, |
| 690 | ch_p->pseudodur); |
| 691 | for (gs_p = ch_p->gs_p; gs_p != (struct GRPSYL *) 0; |
| 692 | gs_p = gs_p->gs_p) { |
| 693 | debug(128, "\t\t%s, staff %d, vno %d", |
| 694 | gs_p->grpsyl == GS_GROUP ? "GROUP" |
| 695 | : "SYLLABLE", gs_p->staffno, |
| 696 | gs_p->vno); |
| 697 | } |
| 698 | print_chhead(ch_p->ch_p); |
| 699 | } |
| 700 | } |
| 701 | \f |
| 702 | |
| 703 | /* print information about a STUFF list */ |
| 704 | |
| 705 | static void |
| 706 | pr_stuff(stuff_p) |
| 707 | |
| 708 | struct STUFF *stuff_p; |
| 709 | |
| 710 | { |
| 711 | char *buff; /* for all-ASCII version */ |
| 712 | |
| 713 | |
| 714 | for ( ; stuff_p != (struct STUFF *) 0; stuff_p = stuff_p->next) { |
| 715 | |
| 716 | debug(128, "\nSTUFF: %s %s %s: start=%f (%d) [%f], end=%dm+%f, all=%d, x=%f, y=%f", |
| 717 | xlate_stufftype(stuff_p->stuff_type), |
| 718 | (stuff_p->stuff_type == ST_PHRASE |
| 719 | ? xlate_linetype(stuff_p->modifier) |
| 720 | : stuff_modifier(stuff_p->modifier)), |
| 721 | xlate_place(stuff_p->place), stuff_p->start.count, |
| 722 | stuff_p->gracebackup, stuff_p->start.steps, |
| 723 | stuff_p->end.bars, stuff_p->end.count, stuff_p->all, |
| 724 | stuff_p->c[AX], stuff_p->c[AY]); |
| 725 | |
| 726 | if (stuff_p->string != (char *) 0) { |
| 727 | buff = ascii_str(stuff_p->string, YES, NO, stuff_p->modifier); |
| 728 | debug(128, "\tstring = \"%s\"", buff); |
| 729 | } |
| 730 | } |
| 731 | } |
| 732 | \f |
| 733 | |
| 734 | /* given a PL_* place value, return its English name */ |
| 735 | |
| 736 | static char * |
| 737 | xlate_place(place) |
| 738 | |
| 739 | int place; |
| 740 | |
| 741 | { |
| 742 | switch(place) { |
| 743 | case PL_ABOVE: |
| 744 | return("above"); |
| 745 | case PL_BELOW: |
| 746 | return("below"); |
| 747 | case PL_BETWEEN: |
| 748 | return("between"); |
| 749 | case PL_UNKNOWN: |
| 750 | return("unknown"); |
| 751 | default: |
| 752 | return("invalid place"); |
| 753 | } |
| 754 | } |
| 755 | \f |
| 756 | |
| 757 | /* given a ST_* stufftype, return its English name */ |
| 758 | |
| 759 | |
| 760 | static char * |
| 761 | xlate_stufftype(stuff_type) |
| 762 | |
| 763 | int stuff_type; |
| 764 | |
| 765 | { |
| 766 | switch (stuff_type) { |
| 767 | case ST_ROM: |
| 768 | return("rom"); |
| 769 | case ST_BOLD: |
| 770 | return("bold"); |
| 771 | case ST_ITAL: |
| 772 | return("ital"); |
| 773 | case ST_BOLDITAL: |
| 774 | return("boldital"); |
| 775 | case ST_CRESC: |
| 776 | return("cresc"); |
| 777 | case ST_DECRESC: |
| 778 | return("decresc"); |
| 779 | case ST_MUSSYM: |
| 780 | return("mussym"); |
| 781 | case ST_PHRASE: |
| 782 | return("phrase"); |
| 783 | case ST_PEDAL: |
| 784 | return("pedal"); |
| 785 | case ST_OCTAVE: |
| 786 | return("octave"); |
| 787 | case ST_MIDI: |
| 788 | return("MIDI"); |
| 789 | case ST_TIESLUR: |
| 790 | return("TIESLUR"); |
| 791 | case ST_TABSLUR: |
| 792 | return("TABSLUR"); |
| 793 | case ST_BEND: |
| 794 | return("BEND"); |
| 795 | default: |
| 796 | return("unknown stuff_type"); |
| 797 | } |
| 798 | } |
| 799 | \f |
| 800 | |
| 801 | /* Translate L_ line type to name */ |
| 802 | |
| 803 | static char * |
| 804 | xlate_linetype(ltype) |
| 805 | |
| 806 | int ltype; /* L_* value */ |
| 807 | |
| 808 | { |
| 809 | switch(ltype) { |
| 810 | case L_NORMAL: |
| 811 | return(""); |
| 812 | case L_MEDIUM: |
| 813 | return("medium"); |
| 814 | case L_WIDE: |
| 815 | return("wide"); |
| 816 | case L_DOTTED: |
| 817 | return("dotted"); |
| 818 | case L_DASHED: |
| 819 | return("dashed"); |
| 820 | case L_WAVY: |
| 821 | return("wavy"); |
| 822 | default: |
| 823 | return("unknown"); |
| 824 | } |
| 825 | } |
| 826 | \f |
| 827 | |
| 828 | static void |
| 829 | print_curve(curve_p) |
| 830 | |
| 831 | struct CURVE *curve_p; |
| 832 | |
| 833 | { |
| 834 | struct COORD_INFO *cinfo_p; |
| 835 | int n; |
| 836 | |
| 837 | if (debug_on(128) == 0) { |
| 838 | return; |
| 839 | } |
| 840 | |
| 841 | for (n = 0; n < curve_p->ncoord; n++) { |
| 842 | if ((cinfo_p = find_coord(curve_p->coordlist[n].hor_p)) != 0) { |
| 843 | debug(128, "\thor_p = 0x%lx, page = %d, score = %d, pseudo_bar_p = %lx", |
| 844 | curve_p->coordlist[n].hor_p, |
| 845 | cinfo_p->page, cinfo_p->scorenum, |
| 846 | cinfo_p->pseudo_bar_p); |
| 847 | } |
| 848 | debug(128, "\thtype = %s, hsteps = %f, counts = %f", |
| 849 | xlate_coordtype(curve_p->coordlist[n].htype), |
| 850 | curve_p->coordlist[n].hsteps, |
| 851 | curve_p->coordlist[n].counts); |
| 852 | if ((cinfo_p = find_coord(curve_p->coordlist[n].vert_p)) != 0) { |
| 853 | debug(128, "\tvert_p = 0x%lx, page = %d, score = %d, pseudo_bar_p = %lx", |
| 854 | curve_p->coordlist[n].vert_p, |
| 855 | cinfo_p->page, cinfo_p->scorenum, |
| 856 | cinfo_p->pseudo_bar_p); |
| 857 | } |
| 858 | debug(128, "\tvtype = %s, vsteps = %f\n", |
| 859 | xlate_coordtype(curve_p->coordlist[n].vtype), |
| 860 | curve_p->coordlist[n].vsteps); |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | /* given an absolute coordinate type like AX, return its name */ |
| 865 | |
| 866 | static char |
| 867 | *xlate_coordtype(coordtype) |
| 868 | |
| 869 | int coordtype; |
| 870 | |
| 871 | { |
| 872 | switch(coordtype) { |
| 873 | case AX: |
| 874 | return("AX"); |
| 875 | case AY: |
| 876 | return("AY"); |
| 877 | case AN: |
| 878 | return("AN"); |
| 879 | case AS: |
| 880 | return("AS"); |
| 881 | case AE: |
| 882 | return("AE"); |
| 883 | case AW: |
| 884 | return("AW"); |
| 885 | default: |
| 886 | return(Unknown); |
| 887 | } |
| 888 | } |