| 1 |
/* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */ |
| 2 |
/* From input file "control.pas" */ |
| 3 |
|
| 4 |
|
| 5 |
#include "p2c.h" |
| 6 |
|
| 7 |
|
| 8 |
#define CONTROL_G |
| 9 |
#include "control.h" |
| 10 |
|
| 11 |
|
| 12 |
#ifndef UTILITY_H |
| 13 |
#include "utility.h" |
| 14 |
#endif |
| 15 |
|
| 16 |
|
| 17 |
/* enables Include: directive */ |
| 18 |
/* one-word shortcut is treated by simply inserting a blank */ |
| 19 |
/* detached form of shortcut allowed */ |
| 20 |
/* C: lines are taken into account */ |
| 21 |
/* U: lines are taken into account */ |
| 22 |
/* L: lines are taken into account */ |
| 23 |
/* non-melismatic eighth and shorter notes in vocal lines are unbeamed */ |
| 24 |
/* blind slurs are hidden */ |
| 25 |
/* U: lines synchronize with words and rests */ |
| 26 |
/* always insert duration into notes */ |
| 27 |
/* include macros in the count */ |
| 28 |
/* literally expand macros */ |
| 29 |
/* keep track of pitch and warn if unreal */ |
| 30 |
/* transform note words to canical form */ |
| 31 |
/* use solfa note names */ |
| 32 |
/* issue warnings even when default action is likely to be correct */ |
| 33 |
/* ignore all errors except fatal errors */ |
| 34 |
/* set instrument names */ |
| 35 |
/* report what is being done */ |
| 36 |
/* write all possible infomative messages */ |
| 37 |
typedef enum { |
| 38 |
noSuchFeature, FmultiFile, FsplitShortcut, FnewWordShortcut, FdoChords, |
| 39 |
FdoUptext, FdoLyrics, FunbeamVocal, FhideBlindSlurs, FuptextOnRests, |
| 40 |
FinsertDuration, FcountMacro, FexpandMacro, FcheckPitch, FrearrangeNote, |
| 41 |
FsolfaNoteNames, FpedanticWarnings, FignoreErrors, FinstrumentNames, |
| 42 |
FbeVerbose, FdebugMode |
| 43 |
} feature; |
| 44 |
|
| 45 |
typedef struct Tfeature { |
| 46 |
Char tag[31]; |
| 47 |
boolean active, changed; |
| 48 |
} Tfeature; |
| 49 |
|
| 50 |
|
| 51 |
#define firstFeature FmultiFile |
| 52 |
#define lastFeature FdebugMode |
| 53 |
|
| 54 |
|
| 55 |
Static Tfeature feat[21] = { |
| 56 |
{ "", false, false }, |
| 57 |
{ "multiFile", true, false }, |
| 58 |
{ "splitShortcut", true, false }, |
| 59 |
{ "newWordShortcut", true, false }, |
| 60 |
{ "doChords", true, false }, |
| 61 |
{ "doUptext", true, false }, |
| 62 |
{ "doLyrics", true, false }, |
| 63 |
{ "unbeamVocal", true, false }, |
| 64 |
{ "hideBlindSlurs", true, false }, |
| 65 |
{ "uptextOnRests", true, false }, |
| 66 |
{ "insertDuration", true, false }, |
| 67 |
{ "countMacro", false, false }, |
| 68 |
{ "expandMacro", false, false }, |
| 69 |
{ "checkPitch", true, false }, |
| 70 |
{ "rearrangeNote", true, false }, |
| 71 |
{ "solfaNoteNames", false, false }, |
| 72 |
{ "pedanticWarnings", false, false }, |
| 73 |
{ "ignoreErrors", false, false }, |
| 74 |
{ "instrumentNames", false, false }, |
| 75 |
{ "beVerbose", false, false }, |
| 76 |
{ "debugMode", false, false } |
| 77 |
}; |
| 78 |
|
| 79 |
|
| 80 |
void printFeatures(boolean anyway) |
| 81 |
{ |
| 82 |
feature i; |
| 83 |
Tfeature *WITH; |
| 84 |
|
| 85 |
for (i = firstFeature; i <= lastFeature; i = (feature)((long)i + 1)) { |
| 86 |
WITH = &feat[(long)i]; |
| 87 |
if (WITH->changed || anyway) |
| 88 |
printf("%s = %s\n", WITH->tag, WITH->active ? " TRUE" : "FALSE"); |
| 89 |
} |
| 90 |
} |
| 91 |
|
| 92 |
|
| 93 |
Static feature featureNamed(Char *s) |
| 94 |
{ |
| 95 |
feature i; |
| 96 |
|
| 97 |
for (i = firstFeature; i <= lastFeature; i = (feature)((long)i + 1)) { |
| 98 |
if (equalsIgnoreCase(s, feat[(long)i].tag)) |
| 99 |
return i; |
| 100 |
} |
| 101 |
return noSuchFeature; |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
boolean setFeature(Char *which, boolean val) |
| 106 |
{ |
| 107 |
boolean Result = false; |
| 108 |
feature f; |
| 109 |
Tfeature *WITH; |
| 110 |
|
| 111 |
f = featureNamed(which); |
| 112 |
if (f != noSuchFeature) { |
| 113 |
WITH = &feat[(long)f]; |
| 114 |
WITH->active = val; |
| 115 |
WITH->changed = true; |
| 116 |
Result = true; |
| 117 |
} |
| 118 |
if (f == FdebugMode && val) |
| 119 |
feat[(long)FbeVerbose].active = true; |
| 120 |
if (f == FbeVerbose && !val) |
| 121 |
feat[(long)FdebugMode].active = false; |
| 122 |
return Result; |
| 123 |
} |
| 124 |
|
| 125 |
|
| 126 |
void mtxLevel(Char *level) |
| 127 |
{ |
| 128 |
if (strcmp(level, "0.57") < 0) { |
| 129 |
setFeature("splitShortcut", false); |
| 130 |
setFeature("newWordShortcut", false); |
| 131 |
} |
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
/* Feature functions. To add a new feature "newFeature": |
| 136 |
1. Insert a new value "FnewFeature" in the declaration of type "feature". |
| 137 |
2. Insert an entry for it in array "feat". |
| 138 |
3. Copy the template below and change "FEATURE" into "newFeature". |
| 139 |
4. Copy the function header to the interface section. |
| 140 |
5. (Optional) Insert code into "mtxLevel" to enable/disable the feature. |
| 141 |
|
| 142 |
function FEATURE: boolean; |
| 143 |
begin FEATURE := feat[FFEATURE].active end; |
| 144 |
*/ |
| 145 |
|
| 146 |
boolean checkPitch(void) |
| 147 |
{ |
| 148 |
return (feat[(long)FcheckPitch].active); |
| 149 |
} |
| 150 |
|
| 151 |
|
| 152 |
boolean countMacro(void) |
| 153 |
{ |
| 154 |
return (feat[(long)FcountMacro].active); |
| 155 |
} |
| 156 |
|
| 157 |
|
| 158 |
boolean expandMacro(void) |
| 159 |
{ |
| 160 |
return (feat[(long)FexpandMacro].active); |
| 161 |
} |
| 162 |
|
| 163 |
|
| 164 |
boolean insertDuration(void) |
| 165 |
{ |
| 166 |
return (feat[(long)FinsertDuration].active); |
| 167 |
} |
| 168 |
|
| 169 |
|
| 170 |
boolean rearrangeNote(void) |
| 171 |
{ |
| 172 |
return (feat[(long)FrearrangeNote].active); |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
boolean beVerbose(void) |
| 177 |
{ |
| 178 |
return (feat[(long)FbeVerbose].active); |
| 179 |
} |
| 180 |
|
| 181 |
|
| 182 |
boolean debugMode(void) |
| 183 |
{ |
| 184 |
return (feat[(long)FdebugMode].active); |
| 185 |
} |
| 186 |
|
| 187 |
|
| 188 |
boolean instrumentNames(void) |
| 189 |
{ |
| 190 |
return (feat[(long)FinstrumentNames].active); |
| 191 |
} |
| 192 |
|
| 193 |
|
| 194 |
boolean hideBlindSlurs(void) |
| 195 |
{ |
| 196 |
return (feat[(long)FhideBlindSlurs].active); |
| 197 |
} |
| 198 |
|
| 199 |
|
| 200 |
boolean doLyrics(void) |
| 201 |
{ |
| 202 |
return (feat[(long)FdoLyrics].active); |
| 203 |
} |
| 204 |
|
| 205 |
|
| 206 |
boolean ignoreErrors(void) |
| 207 |
{ |
| 208 |
return (feat[(long)FignoreErrors].active); |
| 209 |
} |
| 210 |
|
| 211 |
|
| 212 |
boolean pedanticWarnings(void) |
| 213 |
{ |
| 214 |
return (feat[(long)FpedanticWarnings].active); |
| 215 |
} |
| 216 |
|
| 217 |
|
| 218 |
boolean solfaNoteNames(void) |
| 219 |
{ |
| 220 |
return (feat[(long)FsolfaNoteNames].active); |
| 221 |
} |
| 222 |
|
| 223 |
|
| 224 |
boolean uptextOnRests(void) |
| 225 |
{ |
| 226 |
return (feat[(long)FuptextOnRests].active); |
| 227 |
} |
| 228 |
|
| 229 |
|
| 230 |
boolean unbeamVocal(void) |
| 231 |
{ |
| 232 |
return (feat[(long)FunbeamVocal].active); |
| 233 |
} |
| 234 |
|
| 235 |
|
| 236 |
boolean doChords(void) |
| 237 |
{ |
| 238 |
return (feat[(long)FdoChords].active); |
| 239 |
} |
| 240 |
|
| 241 |
|
| 242 |
boolean doUptext(void) |
| 243 |
{ |
| 244 |
return (feat[(long)FdoUptext].active); |
| 245 |
} |
| 246 |
|
| 247 |
|
| 248 |
boolean newWordShortcut(void) |
| 249 |
{ |
| 250 |
return (feat[(long)FnewWordShortcut].active); |
| 251 |
} |
| 252 |
|
| 253 |
|
| 254 |
boolean splitShortcut(void) |
| 255 |
{ |
| 256 |
return (feat[(long)FsplitShortcut].active); |
| 257 |
} |
| 258 |
|
| 259 |
|
| 260 |
boolean multiFile(void) |
| 261 |
{ |
| 262 |
return (feat[(long)FmultiFile].active); |
| 263 |
} |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
/* End. */ |