| 1 |
/* Copyright (C) 2014-21 R. D. Tennent School of Computing, |
| 2 |
* Queen's University, [email protected] |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it |
| 5 |
* and/or modify it under the terms of the GNU General |
| 6 |
* Public License as published by the Free Software |
| 7 |
* Foundation; either version 2 of the License, or (at your |
| 8 |
* option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will |
| 11 |
* be useful, but WITHOUT ANY WARRANTY; without even the |
| 12 |
* implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 13 |
* PARTICULAR PURPOSE. See the GNU General Public License |
| 14 |
* for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General |
| 17 |
* Public License along with this program; if not, write to |
| 18 |
* the Free Software Foundation, Inc., 51 Franklin Street, |
| 19 |
* Fifth Floor, Boston, MA 02110-1301, USA. |
| 20 |
*/ |
| 21 |
|
| 22 |
# include "process_command.h" |
| 23 |
|
| 24 |
char *ps(int spacing) |
| 25 |
/* convert spacing value to note value(s) */ |
| 26 |
{ s_n = s; |
| 27 |
*s = '\0'; |
| 28 |
if (spacing == MAX_SPACING) |
| 29 |
sprintf(s, "MAX_SPACING"); |
| 30 |
else if (spacing == 0) |
| 31 |
sprintf(s, "0"); |
| 32 |
else |
| 33 |
{ int n = 1; |
| 34 |
while (true) |
| 35 |
{ if (spacing >= SMALL_NOTE/n) |
| 36 |
{ s_n = s_n + sprintf (s_n, "SP(%d)", n); |
| 37 |
spacing = spacing - SMALL_NOTE/n; |
| 38 |
if (spacing > 0) |
| 39 |
s_n = s_n + sprintf (s_n, "+"); |
| 40 |
else break; |
| 41 |
} |
| 42 |
n = 2*n; |
| 43 |
} |
| 44 |
} |
| 45 |
return s; |
| 46 |
} |
| 47 |
|
| 48 |
void |
| 49 |
note_segment (char *s) |
| 50 |
{ char *t; |
| 51 |
t = strpbrk (s, "|&$"); |
| 52 |
if (t == NULL) t = s + strlen (s); |
| 53 |
while (s < t) |
| 54 |
{ fputc (*s, logfile); s++; } |
| 55 |
fputc ('\n', logfile); |
| 56 |
} |
| 57 |
|
| 58 |
void |
| 59 |
status (int i) |
| 60 |
{ |
| 61 |
if (active[i]) |
| 62 |
{ fprintf (logfile, "notes[%d]=", i); note_segment (notes[i]); |
| 63 |
fprintf (logfile, "current[%d]=", i); note_segment (current[i]); |
| 64 |
fprintf (logfile, "spacings[%d]=%s\n", i, ps(spacings[i])); |
| 65 |
fprintf (logfile, "vspacing[%d]=%s\n", i, ps(vspacing[i])); |
| 66 |
fprintf (logfile, "outstrings[%d]=%s\n", i, outstrings[i]); |
| 67 |
if (xtuplet[i] > 1) |
| 68 |
fprintf (logfile, "xtuplet[%d]=%d\n", i, xtuplet[i]); |
| 69 |
|
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
void |
| 74 |
status_spacing (void) |
| 75 |
{ |
| 76 |
fprintf (logfile, "spacing=%s\n", ps(spacing)); |
| 77 |
fprintf (logfile, "old_spacing=%s\n", ps(old_spacing)); |
| 78 |
fprintf (logfile, "spacing_staff=%d\n", spacing_staff); |
| 79 |
fprintf (logfile, "oldspacing_staff=%d\n", oldspacing_staff); |
| 80 |
} |
| 81 |
|
| 82 |
void |
| 83 |
status_all (void) |
| 84 |
{ int i; |
| 85 |
for (i=1; i <= nstaffs; i++) |
| 86 |
if (active[i]) status (i); |
| 87 |
status_spacing (); |
| 88 |
fprintf (logfile, "nastaffs=%d\n", nastaffs); |
| 89 |
if (dottedbeamnotes) |
| 90 |
fprintf (logfile, "dottedbeamnotes == true\n"); |
| 91 |
} |
| 92 |
|
| 93 |
void |
| 94 |
status_collective (int i) |
| 95 |
{ |
| 96 |
if (active[i]) |
| 97 |
{ fprintf (logfile, "cspacing[%d]=%s\n", i, ps(cspacing[i])); |
| 98 |
fprintf (logfile, "collective[%d]=%s\n", i, collective[i]); |
| 99 |
fprintf (logfile, "first_collective[%d]=%d\n", i, first_collective[i]); |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
void |
| 104 |
status_beam (int i) |
| 105 |
{ |
| 106 |
if (active[i]) |
| 107 |
{ fprintf (logfile, "beaming[%d]=%s\n", i, ps(beaming[i])); } |
| 108 |
} |