~ubuntu-branches/ubuntu/utopic/texlive-bin/utopic

« back to all changes in this revision

Viewing changes to utils/mtx/mtx-0.60d/control.c

  • Committer: Package Import Robot
  • Author(s): Norbert Preining
  • Date: 2012-05-07 10:47:49 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20120507104749-p00ot5sajjbkp1hp
Tags: 2011.20120507-1
* new upstream checkout: uptex 1.10
* drop patches for config file inclusion in (x)dvipdfmx, included upstream
* add man page for etex
* include pmpost patches and build it
* adapt/unfuzzify patches for current sources
* disable mtx building, we have prepmx package in Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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(anyway)
 
81
boolean anyway;
 
82
{
 
83
  feature i;
 
84
  Tfeature *WITH;
 
85
 
 
86
  for (i = firstFeature; (long)i <= (long)lastFeature; i = (feature)((long)i + 1)) {
 
87
    WITH = &feat[(long)i];
 
88
    if (WITH->changed || anyway)
 
89
      printf("%s = %s\n", WITH->tag, WITH->active ? " TRUE" : "FALSE");
 
90
  }
 
91
}
 
92
 
 
93
 
 
94
Static feature featureNamed(s)
 
95
Char *s;
 
96
{
 
97
  feature i;
 
98
 
 
99
  for (i = firstFeature; (long)i <= (long)lastFeature; i = (feature)((long)i + 1)) {
 
100
    if (equalsIgnoreCase(s, feat[(long)i].tag))
 
101
      return i;
 
102
  }
 
103
  return noSuchFeature;
 
104
}
 
105
 
 
106
 
 
107
boolean setFeature(which, val)
 
108
Char *which;
 
109
boolean val;
 
110
{
 
111
  boolean Result = false;
 
112
  feature f;
 
113
  Tfeature *WITH;
 
114
 
 
115
  f = featureNamed(which);
 
116
  if (f != noSuchFeature) {
 
117
    WITH = &feat[(long)f];
 
118
    WITH->active = val;
 
119
    WITH->changed = true;
 
120
    Result = true;
 
121
  }
 
122
  if (f == FdebugMode && val)
 
123
    feat[(long)FbeVerbose].active = true;
 
124
  if (f == FbeVerbose && !val)
 
125
    feat[(long)FdebugMode].active = false;
 
126
  return Result;
 
127
}
 
128
 
 
129
 
 
130
Void mtxLevel(level)
 
131
Char *level;
 
132
{
 
133
  if (strcmp(level, "0.57") < 0) {
 
134
    setFeature("splitShortcut", false);
 
135
    setFeature("newWordShortcut", false);
 
136
  }
 
137
}
 
138
 
 
139
 
 
140
/* Feature functions.  To add a new feature "newFeature":
 
141
   1. Insert a new value "FnewFeature" in the declaration of type "feature".
 
142
   2. Insert an entry for it in array "feat".
 
143
   3. Copy the template below and change "FEATURE" into "newFeature".
 
144
   4. Copy the function header to the interface section.
 
145
   5. (Optional) Insert code into "mtxLevel" to enable/disable the feature.
 
146
 
 
147
function FEATURE: boolean;
 
148
begin FEATURE := feat[FFEATURE].active end;
 
149
*/
 
150
 
 
151
boolean checkPitch()
 
152
{
 
153
  return (feat[(long)FcheckPitch].active);
 
154
}
 
155
 
 
156
 
 
157
boolean countMacro()
 
158
{
 
159
  return (feat[(long)FcountMacro].active);
 
160
}
 
161
 
 
162
 
 
163
boolean expandMacro()
 
164
{
 
165
  return (feat[(long)FexpandMacro].active);
 
166
}
 
167
 
 
168
 
 
169
boolean insertDuration()
 
170
{
 
171
  return (feat[(long)FinsertDuration].active);
 
172
}
 
173
 
 
174
 
 
175
boolean rearrangeNote()
 
176
{
 
177
  return (feat[(long)FrearrangeNote].active);
 
178
}
 
179
 
 
180
 
 
181
boolean beVerbose()
 
182
{
 
183
  return (feat[(long)FbeVerbose].active);
 
184
}
 
185
 
 
186
 
 
187
boolean debugMode()
 
188
{
 
189
  return (feat[(long)FdebugMode].active);
 
190
}
 
191
 
 
192
 
 
193
boolean instrumentNames()
 
194
{
 
195
  return (feat[(long)FinstrumentNames].active);
 
196
}
 
197
 
 
198
 
 
199
boolean hideBlindSlurs()
 
200
{
 
201
  return (feat[(long)FhideBlindSlurs].active);
 
202
}
 
203
 
 
204
 
 
205
boolean doLyrics()
 
206
{
 
207
  return (feat[(long)FdoLyrics].active);
 
208
}
 
209
 
 
210
 
 
211
boolean ignoreErrors()
 
212
{
 
213
  return (feat[(long)FignoreErrors].active);
 
214
}
 
215
 
 
216
 
 
217
boolean pedanticWarnings()
 
218
{
 
219
  return (feat[(long)FpedanticWarnings].active);
 
220
}
 
221
 
 
222
 
 
223
boolean solfaNoteNames()
 
224
{
 
225
  return (feat[(long)FsolfaNoteNames].active);
 
226
}
 
227
 
 
228
 
 
229
boolean uptextOnRests()
 
230
{
 
231
  return (feat[(long)FuptextOnRests].active);
 
232
}
 
233
 
 
234
 
 
235
boolean unbeamVocal()
 
236
{
 
237
  return (feat[(long)FunbeamVocal].active);
 
238
}
 
239
 
 
240
 
 
241
boolean doChords()
 
242
{
 
243
  return (feat[(long)FdoChords].active);
 
244
}
 
245
 
 
246
 
 
247
boolean doUptext()
 
248
{
 
249
  return (feat[(long)FdoUptext].active);
 
250
}
 
251
 
 
252
 
 
253
boolean newWordShortcut()
 
254
{
 
255
  return (feat[(long)FnewWordShortcut].active);
 
256
}
 
257
 
 
258
 
 
259
boolean splitShortcut()
 
260
{
 
261
  return (feat[(long)FsplitShortcut].active);
 
262
}
 
263
 
 
264
 
 
265
boolean multiFile()
 
266
{
 
267
  return (feat[(long)FmultiFile].active);
 
268
}
 
269
 
 
270
 
 
271
 
 
272
 
 
273
 
 
274
/* End. */