Debian Codegraph @

utils/pmx/pmx-src/scor2prt.c

raw
1 #line 1 ""
2 /* -- translated by f2c (version 20200916).
3 You must link the resulting object file with libf2c:
4 on Microsoft Windows system, link with libf2c.lib;
5 on Linux or Unix systems, link with .../path/to/libf2c.a -lm
6 or, if you install libf2c.a in a standard place, with -lf2c -lm
7 -- in that order, at the end of the command line, as in
8 cc *.o -lf2c -lm
9 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
10
11 http://www.netlib.org/f2c/libf2c.zip
12 */
13
14 #include "f2c.h"
15
16 #line 1 ""
17 /* Common Block Declarations */
18
19 struct all_1_ {
20 integer noinow, iorig[24], noinst;
21 logical insetup, replacing;
22 integer instnum[24];
23 logical botv[24];
24 integer nvi[24], nsyst, nvnow;
25 };
26
27 #define all_1 (*(struct all_1_ *) &all_)
28
29 /* Initialized data */
30
31 struct {
32 integer e_1;
33 integer fill_2[24];
34 integer e_3;
35 integer fill_4[26];
36 logical e_5[24];
37 integer e_6[24];
38 integer fill_7[2];
39 } all_ = { 24, {0}, 24, {0}, FALSE_, FALSE_, FALSE_, FALSE_, FALSE_,
40 FALSE_, FALSE_, FALSE_, FALSE_, FALSE_, FALSE_, FALSE_, FALSE_,
41 FALSE_, FALSE_, FALSE_, FALSE_, FALSE_, FALSE_, FALSE_, FALSE_,
42 FALSE_, FALSE_, FALSE_, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
43 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
44
45
46 /* Table of constant values */
47
48 static integer c__9 = 9;
49 static integer c__1 = 1;
50 static integer c__27 = 27;
51 static integer c__2 = 2;
52 static integer c__128 = 128;
53 static integer c_n1 = -1;
54 static integer c__0 = 0;
55 static integer c__3 = 3;
56 static integer c__4 = 4;
57 static integer c__5 = 5;
58 static integer c__79 = 79;
59 static integer c__125 = 125;
60
61 /* ccccccccccccccccccccccccc */
62 /* c */
63 /* c scor2prt 2/19/16 for PMX 2.74 */
64 /* ccccccccccccccccccccccccc */
65 /* This program, developed by Don Simons ([email protected]), is */
66 /* part of the PMX distribution, PMX is a preprocessor for MusiXTeX. In concert */
67 /* with MusiXTeX and TeX, the purpose of PMX is to allow the user to create */
68 /* high-quality typeset musical scores by including a sequence of PMX commands */
69 /* in an ASCII input file. Scor2prt is an auxiliary program that creates PMX */
70 /* input files for individual parts from the PMX input file for the score. */
71
72 /* This program is free software: you can redistribute it and/or modify */
73 /* it under the terms of the GNU General Public License as published by */
74 /* the Free Software Foundation, either version 3 of the License, or */
75 /* (at your option) any later version. */
76
77 /* This program is distributed in the hope that it will be useful, */
78 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
79 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
80 /* GNU General Public License for more details. */
81
82 /* You should have received a copy of the GNU General Public License */
83 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
84
85 /* 2/19/16 */
86 /* Exit gracefully when last input line is comment, with mods in */
87 /* subroutine chkcom, adding logical argument goto999 */
88 /* which is set to .true. in that case, causing input file to */
89 /* be closed after exiting. */
90 /* 4/9/12 */
91 /* Add logical declarations to subroutine dosetup */
92 /* 8/8/11 */
93 /* Copy & mod Ki into parts when after beginning. */
94 /* 7/18/11 */
95 /* Start to fix up for AS..., also Ki was done a little earlier. */
96 /* 7/5/10 */
97 /* Modify Manual to explain extended hex numbering for part-specific comments */
98 /* 5/16/10 */
99 /* Extend part-specific comments for up to 24 parts (subroutine chkcom) */
100 /* Allow files 11-34 for parts */
101 /* Change file 30 to 40 */
102 /* 6/1/08 es2p */
103 /* noimax = 24 */
104
105 /* To do */
106 /* Override fracindent, musicsize? */
107 /* Deal with midbar R? */
108 /* 2/29/04 */
109 /* Check for special character being in quoted string. */
110 /* 10/20/02 PMX 2.407 */
111 /* Interpret AN[n]"[used-defined-part-file-name]" */
112 /* 1/21/02 */
113 /* Deals with rm in multiple parts. */
114 /* s2p15 */
115 /* Get right non-tex index even if there's "\" inside D"..." */
116 /* s2p14 */
117 /* 10/29/00 fix transfer to parts of negative mtrdnp */
118 /* 4/29/00 screen for "%%" followed by "T" */
119 /* Restore change from "Version 2.1a, 21 Dec" */
120 /* s2p13 */
121 /* Allow whole-bar double-whole rests. */
122 /* Bypass MIDI commands "I..." achar(10)="I" */
123 /* s2p12 */
124 /* Let %ablabla ... %cblabla represent pmx input for parts 10-12. But %?blabla */
125 /* only taken as such if ? represents a hex digit .le. noinst, otherwise it's */
126 /* a simple comment. This lessens incompatibility. */
127 /* In subroutine mbrest, properly open parts 10-12 if needed */
128 /* s2p11 */
129 /* Ignore leading blanks */
130 /* Fix undefined linelength in mbrest at very end of comments. */
131 /* s2p10 */
132 /* Fix non-transfer of P..c" " */
133 /* Allow "%%" and "%"n anywhere */
134 /* Version 1.43 */
135 /* Fix bug with P in TeX string. */
136 /* Ignore shifted whole-bar rests when consolidating whole-bar rests */
137 /* Copy type 4 TeX into all parts. */
138 /* Deal with XB and XP. */
139 /* Permit transfer of blank line into parts */
140 /* Change staves/inst in 'M' command. */
141 /* Arbitrary staves/inst. */
142 /* Recognize m1/2/3/4 syntax. */
143 /* Enable comment and one-voice syntax in instrument names */
144
145 /* Changes since 1.1 */
146 /* Deal with saved macros. */
147 /* Revise setup readin, to admit comments. */
148 /* Do not copy 'X' into parts */
149
150 /* ccccccccccccccccccccccccccccccccccccccccccccccc */
151 /* Main program */ int MAIN__(void)
152 {
153 /* Initialized data */
154
155 static char achar[1*10] = "P" "m" "V" "R" "A" "h" "w" "K" "M" "I";
156
157 /* System generated locals */
158 address a__1[2], a__2[3];
159 integer i__1, i__2, i__3[2], i__4[3];
160 char ch__1[44], ch__2[31], ch__3[4], ch__4[1], ch__5[2], ch__6[131];
161 cilist ci__1;
162 icilist ici__1;
163 olist o__1;
164 cllist cl__1;
165 alist al__1;
166 inlist ioin__1;
167
168 /* Builtin functions */
169 integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen),
170 e_wsle(void), s_rsfe(cilist *), do_fio(integer *, char *, ftnlen),
171 e_rsfe(void);
172 /* Subroutine */ int s_stop(char *, ftnlen);
173 integer i_indx(char *, char *, ftnlen, ftnlen);
174 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen), s_cat(char *,
175 char **, integer *, integer *, ftnlen);
176 integer f_inqu(inlist *), f_open(olist *), s_cmp(char *, char *, ftnlen,
177 ftnlen), f_back(alist *), s_wsfe(cilist *), e_wsfe(void), s_rsfi(
178 icilist *), e_rsfi(void), f_clos(cllist *);
179
180 /* Local variables */
181 extern /* Subroutine */ int oddquotesbefore_(char *, integer *, logical *,
182 ftnlen);
183 static logical clefpend;
184 static real xmtrnum0;
185 static char templine[128];
186 extern /* Subroutine */ int allparts_(char *, integer *, ftnlen);
187 static integer musicsize, ia, ib, ic, iv;
188 static char sq[1];
189 static integer nv, idxendname;
190 static real fracindent;
191 static integer ibb, len, ivq, iend, nchk, idxa, ljob;
192 static char line[128];
193 static integer isig, locp, idxq, ndxm, idxs, inst, idxq2, idxstartname;
194 extern integer iargc_(void);
195 static integer kvend;
196 extern /* Subroutine */ int zapbl_(char *, integer *, ftnlen);
197 static integer itemp, iinst, ntinx;
198 static logical oneof2, goto999;
199 extern doublereal readin_(char *, integer *, integer *, ftnlen);
200 extern /* Subroutine */ int chkcom_(char *, logical *, ftnlen), getarg_(
201 integer *, char *, ftnlen);
202 static integer npages;
203 static char holdln[128];
204 static integer iudpfn;
205 static logical yesodd;
206 static integer ludpfn[24];
207 static char udpfnq[128*24];
208 static integer iiinst;
209 static logical fexist;
210 static integer ivlast, mtrdnp;
211 extern integer lenstr_(char *, integer *, ftnlen);
212 static logical frstln;
213 static integer insnow, ndxpmx, mtrnmp;
214 static logical isachar;
215 static char jobname[27];
216 static integer lenhold, lenline;
217 static char infileq[27];
218 static logical gotname;
219 static integer iccount, mtrdenl;
220 extern integer ntindex_(char *, char *, ftnlen, ftnlen);
221 static integer numargs;
222 extern /* Subroutine */ int mbrests_(integer *, char *, integer *,
223 integer *, char *, ftnlen, ftnlen);
224 static logical termrpt;
225 static integer mtrnuml;
226 static char termsym[2], instrum[128*24];
227 static integer kvstart;
228
229 /* Fortran I/O blocks */
230 static cilist io___6 = { 0, 6, 0, 0, 0 };
231 static cilist io___8 = { 0, 6, 0, 0, 0 };
232 static cilist io___9 = { 0, 6, 0, 0, 0 };
233 static cilist io___10 = { 0, 5, 0, "(a)", 0 };
234 static cilist io___13 = { 0, 6, 0, 0, 0 };
235 static cilist io___17 = { 0, 6, 0, 0, 0 };
236 static cilist io___20 = { 0, 10, 0, "(a)", 0 };
237 static cilist io___23 = { 0, 10, 0, "(a)", 0 };
238 static cilist io___24 = { 0, 10, 0, "(a)", 0 };
239 static cilist io___39 = { 0, 6, 0, 0, 0 };
240 static cilist io___40 = { 0, 6, 0, 0, 0 };
241 static cilist io___41 = { 0, 6, 0, 0, 0 };
242 static cilist io___42 = { 0, 10, 0, "(a)", 0 };
243 static cilist io___43 = { 0, 10, 0, "(a)", 0 };
244 static cilist io___45 = { 0, 10, 0, "(a)", 0 };
245 static cilist io___47 = { 0, 10, 0, "(a)", 0 };
246 static cilist io___49 = { 0, 6, 0, 0, 0 };
247 static cilist io___50 = { 0, 0, 0, "(a)", 0 };
248 static cilist io___51 = { 0, 10, 0, "(a)", 0 };
249 static cilist io___52 = { 0, 10, 0, "(a)", 0 };
250 static cilist io___56 = { 0, 10, 0, "(a)", 0 };
251 static cilist io___58 = { 0, 0, 0, "(a2/a)", 0 };
252 static cilist io___60 = { 0, 10, 1, "(a)", 0 };
253 static cilist io___62 = { 0, 10, 0, "(a)", 0 };
254 static cilist io___63 = { 0, 10, 0, "(a)", 0 };
255 static cilist io___69 = { 0, 6, 0, 0, 0 };
256 static cilist io___70 = { 0, 6, 0, 0, 0 };
257 static cilist io___73 = { 0, 10, 0, "(a)", 0 };
258 static cilist io___77 = { 0, 6, 0, 0, 0 };
259 static cilist io___78 = { 0, 6, 0, 0, 0 };
260 static cilist io___79 = { 0, 6, 0, 0, 0 };
261 static cilist io___82 = { 0, 10, 0, "(a)", 0 };
262 static cilist io___84 = { 0, 6, 0, 0, 0 };
263 static cilist io___85 = { 0, 6, 0, 0, 0 };
264 static icilist io___86 = { 0, line+2, 0, "(i1)", 1, 1 };
265 static icilist io___89 = { 0, line+2, 0, "(i2)", 2, 1 };
266 static cilist io___90 = { 0, 6, 0, 0, 0 };
267 static cilist io___91 = { 0, 6, 0, 0, 0 };
268 static cilist io___98 = { 0, 0, 0, "(a)", 0 };
269 static cilist io___103 = { 0, 0, 0, "(a)", 0 };
270 static cilist io___104 = { 0, 0, 0, "(a)", 0 };
271
272
273 #line 104 ""
274 clefpend = FALSE_;
275 #line 105 ""
276 all_1.insetup = TRUE_;
277 #line 106 ""
278 all_1.replacing = FALSE_;
279 #line 107 ""
280 frstln = TRUE_;
281 #line 108 ""
282 lenhold = 0;
283 #line 109 ""
284 *(unsigned char *)sq = '\\';
285 #line 110 ""
286 s_wsle(&io___6);
287 #line 110 ""
288 do_lio(&c__9, &c__1, "This is scor2prt for PMX 2.74, 19 February 2016", (
289 ftnlen)47);
290 #line 110 ""
291 e_wsle();
292 #line 111 ""
293 numargs = iargc_();
294 #line 112 ""
295 if (numargs == 0) {
296 #line 113 ""
297 s_wsle(&io___8);
298 #line 113 ""
299 do_lio(&c__9, &c__1, "You could have entered a jobname on the comman"\
300 "d line,", (ftnlen)53);
301 #line 113 ""
302 e_wsle();
303 #line 114 ""
304 s_wsle(&io___9);
305 #line 114 ""
306 do_lio(&c__9, &c__1, " but you may enter one now:", (ftnlen)32);
307 #line 114 ""
308 e_wsle();
309 #line 115 ""
310 s_rsfe(&io___10);
311 #line 115 ""
312 do_fio(&c__1, jobname, (ftnlen)27);
313 #line 115 ""
314 e_rsfe();
315 #line 116 ""
316 numargs = 1;
317 #line 117 ""
318 } else {
319 /* call getarg(1,jobname,idum) ! May need to replace this w/ next line */
320 #line 119 ""
321 getarg_(&c__1, jobname, (ftnlen)27);
322 #line 120 ""
323 }
324 #line 121 ""
325 ljob = lenstr_(jobname, &c__27, (ftnlen)27);
326 #line 122 ""
327 if (ljob == 0) {
328 #line 123 ""
329 s_wsle(&io___13);
330 #line 123 ""
331 do_lio(&c__9, &c__1, "No was jobname entered. Restart and try again.",
332 (ftnlen)46);
333 #line 123 ""
334 e_wsle();
335 #line 124 ""
336 s_stop("", (ftnlen)0);
337 #line 125 ""
338 }
339
340 /* Strip ".pmx" if necessary */
341
342 /* Computing MAX */
343 #line 129 ""
344 i__1 = i_indx(jobname, ".pmx", (ftnlen)27, (ftnlen)4), i__2 = i_indx(
345 jobname, ".PMX", (ftnlen)27, (ftnlen)4);
346 #line 129 ""
347 ndxpmx = max(i__1,i__2);
348 #line 130 ""
349 if (ndxpmx > 0) {
350 #line 131 ""
351 s_copy(jobname, jobname, (ftnlen)27, ndxpmx - 1);
352 #line 132 ""
353 ljob += -4;
354 #line 133 ""
355 }
356
357 /* Check for existence of input file */
358
359 /* Writing concatenation */
360 #line 137 ""
361 i__3[0] = ljob, a__1[0] = jobname;
362 #line 137 ""
363 i__3[1] = 4, a__1[1] = ".pmx";
364 #line 137 ""
365 s_cat(infileq, a__1, i__3, &c__2, (ftnlen)27);
366 #line 138 ""
367 ioin__1.inerr = 0;
368 #line 138 ""
369 ioin__1.infilen = 27;
370 #line 138 ""
371 ioin__1.infile = infileq;
372 #line 138 ""
373 ioin__1.inex = &fexist;
374 #line 138 ""
375 ioin__1.inopen = 0;
376 #line 138 ""
377 ioin__1.innum = 0;
378 #line 138 ""
379 ioin__1.innamed = 0;
380 #line 138 ""
381 ioin__1.inname = 0;
382 #line 138 ""
383 ioin__1.inacc = 0;
384 #line 138 ""
385 ioin__1.inseq = 0;
386 #line 138 ""
387 ioin__1.indir = 0;
388 #line 138 ""
389 ioin__1.infmt = 0;
390 #line 138 ""
391 ioin__1.inform = 0;
392 #line 138 ""
393 ioin__1.inunf = 0;
394 #line 138 ""
395 ioin__1.inrecl = 0;
396 #line 138 ""
397 ioin__1.innrec = 0;
398 #line 138 ""
399 ioin__1.inblank = 0;
400 #line 138 ""
401 f_inqu(&ioin__1);
402 #line 139 ""
403 if (! fexist) {
404 #line 140 ""
405 s_wsle(&io___17);
406 /* Writing concatenation */
407 #line 140 ""
408 i__3[0] = 17, a__1[0] = "Cannot find file ";
409 #line 140 ""
410 i__3[1] = 27, a__1[1] = infileq;
411 #line 140 ""
412 s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)44);
413 #line 140 ""
414 do_lio(&c__9, &c__1, ch__1, (ftnlen)44);
415 #line 140 ""
416 e_wsle();
417 #line 141 ""
418 s_stop("", (ftnlen)0);
419 #line 142 ""
420 }
421 #line 143 ""
422 o__1.oerr = 0;
423 #line 143 ""
424 o__1.ounit = 10;
425 #line 143 ""
426 o__1.ofnmlen = ljob + 4;
427 /* Writing concatenation */
428 #line 143 ""
429 i__3[0] = ljob, a__1[0] = jobname;
430 #line 143 ""
431 i__3[1] = 4, a__1[1] = ".pmx";
432 #line 143 ""
433 s_cat(ch__2, a__1, i__3, &c__2, (ftnlen)31);
434 #line 143 ""
435 o__1.ofnm = ch__2;
436 #line 143 ""
437 o__1.orl = 0;
438 #line 143 ""
439 o__1.osta = 0;
440 #line 143 ""
441 o__1.oacc = 0;
442 #line 143 ""
443 o__1.ofm = 0;
444 #line 143 ""
445 o__1.oblnk = 0;
446 #line 143 ""
447 f_open(&o__1);
448
449 /* Open all instrument files now for allparts stuff. Later disgard those >nv */
450
451 #line 147 ""
452 for (iv = 1; iv <= 24; ++iv) {
453 #line 148 ""
454 all_1.iorig[iv - 1] = iv;
455 #line 149 ""
456 o__1.oerr = 0;
457 #line 149 ""
458 o__1.ounit = iv + 10;
459 #line 149 ""
460 o__1.ofnm = 0;
461 #line 149 ""
462 o__1.orl = 0;
463 #line 149 ""
464 o__1.osta = "SCRATCH";
465 #line 149 ""
466 o__1.oacc = 0;
467 #line 149 ""
468 o__1.ofm = 0;
469 #line 149 ""
470 o__1.oblnk = 0;
471 #line 149 ""
472 f_open(&o__1);
473 #line 150 ""
474 ludpfn[iv - 1] = 0;
475 #line 151 ""
476 /* L19: */
477 #line 151 ""
478 }
479 #line 152 ""
480 s_rsfe(&io___20);
481 #line 152 ""
482 do_fio(&c__1, line, (ftnlen)128);
483 #line 152 ""
484 e_rsfe();
485 #line 153 ""
486 chkcom_(line, &goto999, (ftnlen)128);
487 #line 154 ""
488 if (s_cmp(line, "---", (ftnlen)3, (ftnlen)3) == 0) {
489 #line 155 ""
490 allparts_(line, &c__128, (ftnlen)128);
491 #line 156 ""
492 L31:
493 #line 156 ""
494 s_rsfe(&io___23);
495 #line 156 ""
496 do_fio(&c__1, line, (ftnlen)128);
497 #line 156 ""
498 e_rsfe();
499 #line 157 ""
500 if (s_cmp(line, "---", (ftnlen)3, (ftnlen)3) != 0) {
501 #line 158 ""
502 allparts_(line, &c__128, (ftnlen)128);
503 #line 159 ""
504 goto L31;
505 #line 160 ""
506 }
507 #line 161 ""
508 allparts_(line, &c__128, (ftnlen)128);
509 #line 162 ""
510 s_rsfe(&io___24);
511 #line 162 ""
512 do_fio(&c__1, line, (ftnlen)128);
513 #line 162 ""
514 e_rsfe();
515 #line 163 ""
516 chkcom_(line, &goto999, (ftnlen)128);
517 #line 164 ""
518 }
519 #line 165 ""
520 iccount = 0;
521 #line 166 ""
522 nv = readin_(line, &iccount, &c__1, (ftnlen)128) + .1f;
523 #line 167 ""
524 all_1.noinst = readin_(line, &iccount, &c__2, (ftnlen)128) + .1f;
525 #line 168 ""
526 if (all_1.noinst > 0) {
527 #line 169 ""
528 all_1.nvi[0] = nv - all_1.noinst + 1;
529 #line 170 ""
530 } else {
531 #line 171 ""
532 all_1.noinst = 1 - all_1.noinst;
533 #line 172 ""
534 i__1 = all_1.noinst;
535 #line 172 ""
536 for (iinst = 1; iinst <= i__1; ++iinst) {
537 #line 173 ""
538 all_1.nvi[iinst - 1] = readin_(line, &iccount, &c_n1, (ftnlen)128)
539 + .1f;
540 #line 174 ""
541 /* L21: */
542 #line 174 ""
543 }
544 #line 175 ""
545 }
546 #line 176 ""
547 all_1.noinow = all_1.noinst;
548 #line 177 ""
549 insnow = 1;
550
551 /* ivlast is last iv in current inst. instnum(iv) is iinst for current voice. */
552
553 #line 181 ""
554 ivlast = all_1.nvi[0];
555 #line 182 ""
556 i__1 = nv;
557 #line 182 ""
558 for (iv = 1; iv <= i__1; ++iv) {
559 #line 183 ""
560 all_1.instnum[iv - 1] = insnow;
561 #line 184 ""
562 if (iv == ivlast) {
563 #line 185 ""
564 if (iv < nv) {
565 #line 185 ""
566 all_1.botv[iv] = TRUE_;
567 #line 185 ""
568 }
569
570 /* The previous stmt will set botv true only for bot voice of iinst>1. It is */
571 /* used when writing termrpts, but the one in voice one is handled differently, */
572 /* so botv(1) is left .false. */
573
574 #line 191 ""
575 if (insnow < all_1.noinst) {
576 #line 192 ""
577 ++insnow;
578 #line 193 ""
579 ivlast += all_1.nvi[insnow - 1];
580 #line 194 ""
581 }
582 #line 195 ""
583 }
584 #line 196 ""
585 /* L22: */
586 #line 196 ""
587 }
588 #line 197 ""
589 mtrnuml = readin_(line, &iccount, &c__0, (ftnlen)128) + .1f;
590 #line 198 ""
591 mtrdenl = readin_(line, &iccount, &c__0, (ftnlen)128) + .1f;
592 #line 199 ""
593 mtrnmp = readin_(line, &iccount, &c__0, (ftnlen)128) + .1f;
594 #line 200 ""
595 mtrdnp = readin_(line, &iccount, &c__0, (ftnlen)128) + .1f;
596 #line 201 ""
597 xmtrnum0 = readin_(line, &iccount, &c__0, (ftnlen)128);
598 #line 202 ""
599 isig = readin_(line, &iccount, &c__0, (ftnlen)128) + .1f;
600 #line 203 ""
601 npages = readin_(line, &iccount, &c__3, (ftnlen)128) + .1f;
602 #line 204 ""
603 all_1.nsyst = readin_(line, &iccount, &c__0, (ftnlen)128) + .1f;
604 #line 205 ""
605 musicsize = readin_(line, &iccount, &c__4, (ftnlen)128) + .1f;
606 #line 206 ""
607 fracindent = readin_(line, &iccount, &c__5, (ftnlen)128);
608 #line 207 ""
609 if (npages == 0) {
610 #line 208 ""
611 s_wsle(&io___39);
612 #line 208 ""
613 do_lio(&c__9, &c__1, "You entered npages=0, which means nsyst is not"\
614 " the total number", (ftnlen)63);
615 #line 208 ""
616 e_wsle();
617 #line 210 ""
618 s_wsle(&io___40);
619 #line 210 ""
620 do_lio(&c__9, &c__1, "of systems. Scor2prt has to know the total nu"\
621 "mber of systems.", (ftnlen)62);
622 #line 210 ""
623 e_wsle();
624 #line 212 ""
625 s_wsle(&io___41);
626 #line 212 ""
627 do_lio(&c__9, &c__1, "Please set npages and nsyst to their real valu"\
628 "es.", (ftnlen)49);
629 #line 212 ""
630 e_wsle();
631 #line 214 ""
632 s_stop("", (ftnlen)0);
633 #line 215 ""
634 }
635
636 /* Must leave insetup=.true. else could bypass ALL instrument names. */
637
638 #line 219 ""
639 s_rsfe(&io___42);
640 #line 219 ""
641 do_fio(&c__1, line, (ftnlen)128);
642 #line 219 ""
643 e_rsfe();
644 #line 220 ""
645 chkcom_(line, &goto999, (ftnlen)128);
646 #line 221 ""
647 al__1.aerr = 0;
648 #line 221 ""
649 al__1.aunit = 10;
650 #line 221 ""
651 f_back(&al__1);
652
653 /* Normally this puts pointer at start of line with 1st inst name */
654 /* Check if prior line was "%%" */
655
656 #line 226 ""
657 al__1.aerr = 0;
658 #line 226 ""
659 al__1.aunit = 10;
660 #line 226 ""
661 f_back(&al__1);
662 #line 227 ""
663 s_rsfe(&io___43);
664 #line 227 ""
665 do_fio(&c__1, line, (ftnlen)128);
666 #line 227 ""
667 e_rsfe();
668 #line 228 ""
669 if (s_cmp(line, "%%", (ftnlen)2, (ftnlen)2) == 0) {
670 #line 228 ""
671 al__1.aerr = 0;
672 #line 228 ""
673 al__1.aunit = 10;
674 #line 228 ""
675 f_back(&al__1);
676 #line 228 ""
677 }
678 #line 229 ""
679 i__1 = all_1.noinst;
680 #line 229 ""
681 for (iv = 1; iv <= i__1; ++iv) {
682 #line 230 ""
683 gotname = FALSE_;
684 #line 231 ""
685 L16:
686 #line 231 ""
687 s_rsfe(&io___45);
688 #line 231 ""
689 do_fio(&c__1, instrum + (iv - 1 << 7), (ftnlen)128);
690 #line 231 ""
691 e_rsfe();
692 #line 232 ""
693 if (s_cmp(instrum + (iv - 1 << 7), "%%", (ftnlen)2, (ftnlen)2) == 0) {
694 #line 233 ""
695 s_rsfe(&io___47);
696 #line 233 ""
697 do_fio(&c__1, line, (ftnlen)128);
698 #line 233 ""
699 e_rsfe();
700 #line 234 ""
701 goto L16;
702 #line 235 ""
703 } else if (*(unsigned char *)&instrum[(iv - 1) * 128] == '%') {
704 #line 236 ""
705 ivq = *(unsigned char *)&instrum[(iv - 1 << 7) + 1] - 48;
706 #line 237 ""
707 if (ivq != iv) {
708
709 /* It's really a comment. Copy to parts, then get another trial name. */
710
711 #line 241 ""
712 allparts_(instrum + (iv - 1 << 7), &c__128, (ftnlen)128);
713 #line 242 ""
714 goto L16;
715 #line 243 ""
716 } else {
717 #line 244 ""
718 s_copy(line, instrum + ((iv - 1 << 7) + 2), (ftnlen)128, (
719 ftnlen)126);
720 #line 245 ""
721 s_copy(instrum + (iv - 1 << 7), line, (ftnlen)128, (ftnlen)
722 128);
723 #line 246 ""
724 gotname = TRUE_;
725 #line 247 ""
726 }
727 #line 248 ""
728 } else {
729 #line 249 ""
730 gotname = TRUE_;
731 #line 250 ""
732 }
733 /* c */
734 /* c The following checks for macro that write original C-clef as part of */
735 /* c instrument name. See pmx.tex */
736 /* c */
737 /* if (index(instrum(iv),'namewpc') .eq. 0) then */
738 /* write(10+iv,'(a)')' ' */
739 /* else */
740 /* inm1 = index(instrum(iv),'{')+1 */
741 /* inm2 = index(instrum(iv),'}')-1 */
742 /* read(instrum(iv)(inm2+2:inm2+8),'(i1,4x,2i1)')ilev,iy1,iy2 */
743 /* write(10+iv,'(a)')sq//'namewpc{}'//char(ilev+48)//'{20}'// */
744 /* * char(iy1+49)//char(iy2+49) */
745 /* instrum(iv) = instrum(iv)(inm1:inm2) */
746 /* end if */
747 #line 265 ""
748 if (! gotname) {
749 #line 266 ""
750 s_wsle(&io___49);
751 #line 266 ""
752 do_lio(&c__9, &c__1, "You must provide a replacement instrument "\
753 "name", (ftnlen)46);
754 #line 266 ""
755 e_wsle();
756 #line 267 ""
757 s_stop("", (ftnlen)0);
758 #line 268 ""
759 }
760 #line 269 ""
761 io___50.ciunit = iv + 10;
762 #line 269 ""
763 s_wsfe(&io___50);
764 #line 269 ""
765 do_fio(&c__1, " ", (ftnlen)1);
766 #line 269 ""
767 e_wsfe();
768 #line 270 ""
769 /* L14: */
770 #line 270 ""
771 }
772 #line 271 ""
773 all_1.replacing = FALSE_;
774 #line 272 ""
775 all_1.nvnow = nv;
776
777 /* Clef string: Note insetup is still T, so "%%" will be treated specially */
778
779 #line 276 ""
780 s_rsfe(&io___51);
781 #line 276 ""
782 do_fio(&c__1, line, (ftnlen)128);
783 #line 276 ""
784 e_rsfe();
785 #line 277 ""
786 chkcom_(line, &goto999, (ftnlen)128);
787 #line 278 ""
788 if (all_1.replacing) {
789
790 /* If here, we have next line after "%%", containing score's clef string */
791 /* Assume all clefs are handled with instrument comments. */
792
793 #line 283 ""
794 s_rsfe(&io___52);
795 #line 283 ""
796 do_fio(&c__1, line, (ftnlen)128);
797 #line 283 ""
798 e_rsfe();
799 #line 284 ""
800 chkcom_(line, &goto999, (ftnlen)128);
801 #line 285 ""
802 al__1.aerr = 0;
803 #line 285 ""
804 al__1.aunit = 10;
805 #line 285 ""
806 f_back(&al__1);
807 #line 286 ""
808 } else {
809
810 /* If here, line has the clef string in it. Handle the old way */
811
812 #line 290 ""
813 kvstart = 1;
814 #line 291 ""
815 kvend = all_1.nvi[0];
816 #line 292 ""
817 i__1 = all_1.noinst;
818 #line 292 ""
819 for (inst = 1; inst <= i__1; ++inst) {
820 #line 293 ""
821 ci__1.cierr = 0;
822 #line 293 ""
823 ci__1.ciunit = inst + 10;
824 /* Writing concatenation */
825 #line 293 ""
826 i__4[0] = 2, a__2[0] = "(a";
827 #line 293 ""
828 *(unsigned char *)&ch__4[0] = all_1.nvi[inst - 1] + 48;
829 #line 293 ""
830 i__4[1] = 1, a__2[1] = ch__4;
831 #line 293 ""
832 i__4[2] = 1, a__2[2] = ")";
833 #line 293 ""
834 ci__1.cifmt = (s_cat(ch__3, a__2, i__4, &c__3, (ftnlen)4), ch__3);
835 #line 293 ""
836 s_wsfe(&ci__1);
837 #line 293 ""
838 do_fio(&c__1, line + (kvstart - 1), kvend - (kvstart - 1));
839 #line 293 ""
840 e_wsfe();
841 #line 295 ""
842 if (inst < all_1.noinst) {
843 #line 296 ""
844 kvstart = kvend + 1;
845 #line 297 ""
846 kvend = kvstart + all_1.nvi[inst] - 1;
847 #line 298 ""
848 }
849 #line 299 ""
850 /* L2: */
851 #line 299 ""
852 }
853 #line 300 ""
854 }
855 #line 301 ""
856 all_1.replacing = FALSE_;
857 #line 302 ""
858 all_1.insetup = FALSE_;
859
860 /* *****NOTE*****This comment applies to stuff done earlier! */
861 /* Before starting the big loop, copy initial instnum and staffnum stuff */
862 /* into working values. Latter may change if noinst changes. Also make */
863 /* list of current inst nums relative to original ones. In addition to those */
864 /* below, must redo instnum(iv) and botv(iv) when we change noinst. */
865
866 /* Path string: ASSUME THIS WILL NEVER BE ALTERED IN PARTS! */
867
868 #line 312 ""
869 L18:
870 #line 312 ""
871 s_rsfe(&io___56);
872 #line 312 ""
873 do_fio(&c__1, line, (ftnlen)128);
874 #line 312 ""
875 e_rsfe();
876 #line 313 ""
877 if (*(unsigned char *)line == '%') {
878 #line 314 ""
879 allparts_(line, &c__128, (ftnlen)128);
880 #line 315 ""
881 goto L18;
882 #line 316 ""
883 }
884 #line 317 ""
885 allparts_(line, &c__128, (ftnlen)128);
886
887 /* Write instrument names. Will be blank if later part of a score. */
888
889 #line 321 ""
890 if (*(unsigned char *)&instrum[0] != ' ') {
891 #line 322 ""
892 i__1 = all_1.noinst;
893 #line 322 ""
894 for (iv = 1; iv <= i__1; ++iv) {
895 #line 323 ""
896 len = lenstr_(instrum + (iv - 1 << 7), &c__79, (ftnlen)128);
897 #line 324 ""
898 io___58.ciunit = iv + 10;
899 #line 324 ""
900 s_wsfe(&io___58);
901 #line 324 ""
902 do_fio(&c__1, "Ti", (ftnlen)2);
903 #line 324 ""
904 do_fio(&c__1, instrum + (iv - 1 << 7), len);
905 #line 324 ""
906 e_wsfe();
907 #line 325 ""
908 /* L3: */
909 #line 325 ""
910 }
911 #line 326 ""
912 }
913
914 /* The big loop. Except for '%%', put all comment lines in all parts. */
915 /* Unless preceeded by '%%', put all type 2 or 3 TeX Strings in all parts */
916 /* If a line starts with %!, put the rest of it in each part. */
917 /* If a line starts with %[n], put the rest of it in part [n]. */
918 /* Check for Tt, Tc, Voltas, Repeats, headers, lower texts, meter changes. */
919 /* Assume they only come at top of block, except terminal repeat needs */
920 /* special handling. */
921 /* Check for "P"; ignore in parts. */
922 /* Check for consecutive full-bar rests; if found, replace with rm[nn] */
923
924 #line 338 ""
925 iv = 1;
926 #line 339 ""
927 iinst = 1;
928 #line 340 ""
929 termrpt = FALSE_;
930 #line 341 ""
931 L4:
932 #line 342 ""
933 i__1 = s_rsfe(&io___60);
934 #line 342 ""
935 if (i__1 != 0) {
936 #line 342 ""
937 goto L999;
938 #line 342 ""
939 }
940 #line 342 ""
941 i__1 = do_fio(&c__1, line, (ftnlen)128);
942 #line 342 ""
943 if (i__1 != 0) {
944 #line 342 ""
945 goto L999;
946 #line 342 ""
947 }
948 #line 342 ""
949 i__1 = e_rsfe();
950 #line 342 ""
951 if (i__1 != 0) {
952 #line 342 ""
953 goto L999;
954 #line 342 ""
955 }
956 #line 343 ""
957 lenline = lenstr_(line, &c__128, (ftnlen)128);
958 #line 344 ""
959 if (lenline == 0) {
960 #line 344 ""
961 goto L4;
962 #line 344 ""
963 }
964 #line 345 ""
965 zapbl_(line, &c__128, (ftnlen)128);
966 #line 346 ""
967 chkcom_(line, &goto999, (ftnlen)128);
968 #line 347 ""
969 if (goto999) {
970 #line 347 ""
971 goto L999;
972 #line 347 ""
973 }
974 #line 348 ""
975 lenline = lenstr_(line, &c__128, (ftnlen)128);
976 #line 349 ""
977 if (lenline == 0) {
978 #line 349 ""
979 goto L4;
980 #line 349 ""
981 }
982 #line 350 ""
983 if (*(unsigned char *)line == 'T') {
984 #line 351 ""
985 allparts_(line, &c__128, (ftnlen)128);
986 #line 352 ""
987 s_rsfe(&io___62);
988 #line 352 ""
989 do_fio(&c__1, line, (ftnlen)128);
990 #line 352 ""
991 e_rsfe();
992 #line 353 ""
993 allparts_(line, &c__128, (ftnlen)128);
994 #line 354 ""
995 goto L4;
996 #line 355 ""
997 } else /* if(complicated condition) */ {
998 /* Writing concatenation */
999 #line 355 ""
1000 i__3[0] = 1, a__1[0] = sq;
1001 #line 355 ""
1002 i__3[1] = 1, a__1[1] = sq;
1003 #line 355 ""
1004 s_cat(ch__5, a__1, i__3, &c__2, (ftnlen)2);
1005 #line 355 ""
1006 if (s_cmp(line, ch__5, (ftnlen)2, (ftnlen)2) == 0) {
1007 #line 356 ""
1008 allparts_(line, &c__128, (ftnlen)128);
1009 #line 357 ""
1010 goto L4;
1011 #line 358 ""
1012 } else if (i_indx("hl", line, (ftnlen)2, (ftnlen)1) > 0 && i_indx(
1013 " +-", line + 1, (ftnlen)3, (ftnlen)1) > 0) {
1014 #line 360 ""
1015 allparts_(line, &c__128, (ftnlen)128);
1016 #line 361 ""
1017 s_rsfe(&io___63);
1018 #line 361 ""
1019 do_fio(&c__1, line, (ftnlen)128);
1020 #line 361 ""
1021 e_rsfe();
1022 #line 362 ""
1023 allparts_(line, &c__128, (ftnlen)128);
1024 #line 363 ""
1025 goto L4;
1026 #line 364 ""
1027 } else if (iv == 1) {
1028 #line 365 ""
1029 for (ia = 1; ia <= 10; ++ia) {
1030 #line 366 ""
1031 L24:
1032 #line 367 ""
1033 idxa = ntindex_(line, achar + (ia - 1), (ftnlen)128, (ftnlen)
1034 1);
1035 #line 368 ""
1036 isachar = idxa > 0;
1037 #line 369 ""
1038 if (idxa > 1) {
1039 #line 369 ""
1040 i__1 = idxa - 2;
1041 #line 369 ""
1042 isachar = s_cmp(line + i__1, " ", idxa - 1 - i__1, (
1043 ftnlen)1) == 0;
1044 #line 369 ""
1045 }
1046
1047 /* 1 2 3 4 5 6 7 8 9 10 */
1048 /* data achar /'P','m','V','R','A','h','w','K','M','I'/ */
1049
1050 #line 374 ""
1051 if (ia == 9) {
1052 #line 374 ""
1053 i__1 = idxa;
1054 #line 374 ""
1055 isachar = isachar && s_cmp(line + i__1, "S", idxa + 1 -
1056 i__1, (ftnlen)1) == 0;
1057 #line 374 ""
1058 }
1059 #line 376 ""
1060 if (isachar) {
1061
1062 /* Check whether character is inside a quoted string by counting */
1063 /* how many quotes precede it in the line */
1064
1065 #line 382 ""
1066 oddquotesbefore_(line, &idxa, &yesodd, (ftnlen)128);
1067 #line 383 ""
1068 if (yesodd) {
1069 #line 383 ""
1070 isachar = FALSE_;
1071 #line 383 ""
1072 }
1073 #line 384 ""
1074 }
1075 #line 385 ""
1076 if (isachar) {
1077
1078 /* Find next blank */
1079
1080 #line 389 ""
1081 for (ib = idxa + 1; ib <= 128; ++ib) {
1082 #line 390 ""
1083 if (*(unsigned char *)&line[ib - 1] == ' ') {
1084 #line 390 ""
1085 goto L7;
1086 #line 390 ""
1087 }
1088 #line 391 ""
1089 /* L6: */
1090 #line 391 ""
1091 }
1092 #line 392 ""
1093 s_wsle(&io___69);
1094 #line 392 ""
1095 do_lio(&c__9, &c__1, "Problem with \"V,R,m,P,A,h,MS, o"\
1096 "r w\"", (ftnlen)35);
1097 #line 392 ""
1098 e_wsle();
1099 #line 393 ""
1100 s_wsle(&io___70);
1101 #line 393 ""
1102 do_lio(&c__9, &c__1, "Send files to Dr. Don at dsimons a"\
1103 "t roadrunner dot com", (ftnlen)54);
1104 #line 393 ""
1105 e_wsle();
1106 #line 395 ""
1107 s_stop("1", (ftnlen)1);
1108 #line 396 ""
1109 L7:
1110
1111 /* Next blank is at position ib. Later, if ia=1, must check for Pc" " ; */
1112 /* i.e., look for '"' between P and blank */
1113
1114 #line 401 ""
1115 if (ia == 4) {
1116
1117 /* Check for terminal repeat. Note if there's a term rpt, there can't be any */
1118 /* others. Also, must process repeats LAST, after m's and 'V's */
1119
1120 #line 406 ""
1121 for (ic = ib + 1; ic <= 128; ++ic) {
1122
1123 /* If any subsequent character on this line is neither blank nor "/", get out */
1124
1125 #line 410 ""
1126 if (i_indx(" /", line + (ic - 1), (ftnlen)2, (
1127 ftnlen)1) == 0) {
1128 #line 410 ""
1129 goto L9;
1130 #line 410 ""
1131 }
1132 #line 411 ""
1133 if (*(unsigned char *)&line[ic - 1] == '/') {
1134 #line 412 ""
1135 termrpt = TRUE_;
1136 #line 413 ""
1137 i__1 = ib - 3;
1138 #line 413 ""
1139 s_copy(termsym, line + i__1, (ftnlen)2, ib -
1140 1 - i__1);
1141
1142 /* Process the line as if there were no "R" */
1143
1144 #line 417 ""
1145 goto L10;
1146 #line 418 ""
1147 }
1148 #line 419 ""
1149 /* L8: */
1150 #line 419 ""
1151 }
1152
1153 /* +++ 060812 */
1154 /* If here, all chars after "R" symbol are blanks, so process the line normally, */
1155 /* but only IF next line is not the M-Tx line " /" */
1156
1157 #line 425 ""
1158 s_rsfe(&io___73);
1159 #line 425 ""
1160 do_fio(&c__1, templine, (ftnlen)128);
1161 #line 425 ""
1162 e_rsfe();
1163 #line 426 ""
1164 if (s_cmp(templine, " /", (ftnlen)2, (ftnlen)2) != 0)
1165 {
1166 #line 427 ""
1167 al__1.aerr = 0;
1168 #line 427 ""
1169 al__1.aunit = 10;
1170 #line 427 ""
1171 f_back(&al__1);
1172 /* and flow out */
1173 #line 428 ""
1174 } else {
1175
1176 /* We have the M-Tx case where one line ends with R? and next is " /". Add / to the line, */
1177 /* and proceed as above */
1178
1179 /* Writing concatenation */
1180 #line 433 ""
1181 i__3[0] = ib, a__1[0] = line;
1182 #line 433 ""
1183 i__3[1] = 1, a__1[1] = "/";
1184 #line 433 ""
1185 s_cat(line, a__1, i__3, &c__2, (ftnlen)128);
1186 #line 434 ""
1187 lenline += 2;
1188 #line 435 ""
1189 termrpt = TRUE_;
1190 #line 436 ""
1191 i__1 = ib - 3;
1192 #line 436 ""
1193 s_copy(termsym, line + i__1, (ftnlen)2, ib - 1 -
1194 i__1);
1195 #line 437 ""
1196 goto L10;
1197 #line 438 ""
1198 }
1199 /* +++ 060812 */
1200
1201 #line 441 ""
1202 } else if (ia == 1) {
1203 #line 442 ""
1204 idxq = ntindex_(line, "\"", (ftnlen)128, (ftnlen)1);
1205 #line 443 ""
1206 if (idxq > idxa && idxq < ib) {
1207
1208 /* Quote is between P and next blank. Find 2nd quote, starting at the blank. */
1209
1210 #line 447 ""
1211 idxq2 = ib - 1 + ntindex_(line, "\"", (ftnlen)128,
1212 (ftnlen)1);
1213 #line 448 ""
1214 i__1 = idxq2;
1215 #line 448 ""
1216 if (idxq == 0 || s_cmp(line + i__1, " ", idxq2 +
1217 1 - i__1, (ftnlen)1) != 0) {
1218 #line 449 ""
1219 s_wsle(&io___77);
1220 #line 449 ""
1221 e_wsle();
1222 #line 450 ""
1223 s_wsle(&io___78);
1224 #line 450 ""
1225 do_lio(&c__9, &c__1, "Error copying P with q"\
1226 "uotes, idxq2:", (ftnlen)35);
1227 #line 450 ""
1228 do_lio(&c__3, &c__1, (char *)&idxq2, (ftnlen)
1229 sizeof(integer));
1230 #line 450 ""
1231 e_wsle();
1232 #line 451 ""
1233 s_wsle(&io___79);
1234 #line 451 ""
1235 do_lio(&c__9, &c__1, line, (ftnlen)60);
1236 #line 451 ""
1237 e_wsle();
1238 #line 452 ""
1239 s_stop("1", (ftnlen)1);
1240 #line 453 ""
1241 }
1242 #line 454 ""
1243 ib = idxq2 + 1;
1244 #line 455 ""
1245 }
1246
1247 /* Do not transfer P into parts. */
1248
1249 #line 459 ""
1250 goto L12;
1251 #line 460 ""
1252 } else if (ia == 9) {
1253
1254 /* Start Saving a macro. After leaving here, a symbol will be sent to all parts, */
1255 /* If all on this line, set ib to end and exit normally. */
1256
1257 #line 465 ""
1258 i__1 = ib;
1259 #line 465 ""
1260 ndxm = i_indx(line + i__1, "M", 128 - i__1, (ftnlen)1)
1261 ;
1262 #line 466 ""
1263 i__1 = ib + ndxm - 2;
1264 #line 466 ""
1265 if (ndxm > 0 && s_cmp(line + i__1, " ", ib + ndxm - 1
1266 - i__1, (ftnlen)1) == 0) {
1267
1268 /* Macro ends on this line */
1269
1270 #line 470 ""
1271 ib = ib + ndxm + 1;
1272 #line 471 ""
1273 } else {
1274
1275 /* Save leading part of current line */
1276
1277 #line 475 ""
1278 lenhold = idxa - 1;
1279 #line 476 ""
1280 if (lenhold > 0) {
1281 #line 476 ""
1282 s_copy(holdln, line, (ftnlen)128, lenhold);
1283 #line 476 ""
1284 }
1285
1286 /* Transfer rest of line */
1287
1288 #line 480 ""
1289 i__1 = 129 - idxa;
1290 #line 480 ""
1291 allparts_(line + (idxa - 1), &i__1, 128 - (idxa -
1292 1));
1293
1294 /* Read next line */
1295
1296 #line 484 ""
1297 L20:
1298 #line 484 ""
1299 s_rsfe(&io___82);
1300 #line 484 ""
1301 do_fio(&c__1, line, (ftnlen)128);
1302 #line 484 ""
1303 e_rsfe();
1304
1305 /* Check for comment, transfer and loop if so */
1306
1307 /* if (line(1:1) .eq.'%') then */
1308 #line 489 ""
1309 L23:
1310 #line 489 ""
1311 if (*(unsigned char *)line == '%') {
1312 /* call allparts(line,128) */
1313 /* go to 20 */
1314 #line 492 ""
1315 chkcom_(line, &goto999, (ftnlen)128);
1316 #line 493 ""
1317 goto L23;
1318 #line 494 ""
1319 }
1320
1321 /* Look for terminal ' M' */
1322
1323 #line 498 ""
1324 if (*(unsigned char *)line == 'M') {
1325 #line 499 ""
1326 ndxm = 1;
1327 #line 500 ""
1328 } else {
1329 #line 501 ""
1330 ndxm = i_indx(line, " M", (ftnlen)128, (
1331 ftnlen)2);
1332 #line 502 ""
1333 if (ndxm > 0) {
1334 #line 502 ""
1335 ++ndxm;
1336 #line 502 ""
1337 }
1338 #line 503 ""
1339 }
1340 #line 504 ""
1341 if (ndxm > 0) {
1342
1343 /* Set parameters, exit normally (but later check for leading part of 1st line */
1344
1345 #line 508 ""
1346 idxa = 1;
1347 #line 509 ""
1348 ib = ndxm + 1;
1349 #line 510 ""
1350 } else {
1351
1352 /* No "M", transfer entire line, loop */
1353
1354 #line 514 ""
1355 allparts_(line, &c__128, (ftnlen)128);
1356 #line 515 ""
1357 goto L20;
1358 #line 516 ""
1359 }
1360 #line 517 ""
1361 }
1362 #line 518 ""
1363 } else if (ia == 10) {
1364
1365 /* Do not transfer MIDI command into parts */
1366
1367 #line 522 ""
1368 goto L12;
1369 #line 523 ""
1370 } else if (ia == 5) {
1371
1372 /* First check for "AS", but S may come after other "A" options */
1373
1374 #line 527 ""
1375 i__1 = idxa;
1376 #line 527 ""
1377 idxs = i_indx(line + i__1, "S", ib - i__1, (ftnlen)1);
1378 #line 528 ""
1379 if (idxs > 0) {
1380
1381 /* Get rid of the string. First check if that's all there is in A. */
1382
1383 #line 532 ""
1384 if (ib - idxa == nv + 2) {
1385 #line 532 ""
1386 goto L12;
1387 #line 532 ""
1388 }
1389 #line 533 ""
1390 i__1 = idxa + idxs + nv;
1391 /* Writing concatenation */
1392 #line 533 ""
1393 i__3[0] = idxa + idxs - 1, a__1[0] = line;
1394 #line 533 ""
1395 i__3[1] = ib - i__1, a__1[1] = line + i__1;
1396 #line 533 ""
1397 s_cat(line, a__1, i__3, &c__2, (ftnlen)128);
1398 #line 534 ""
1399 }
1400
1401 /* Check for user-defined part file name. Must start in column 1 and have */
1402 /* AN[n]"userfilename". */
1403 /* idxa is position of "A" */
1404 /* ib is position of the next blank after "A" */
1405 /* Don't allow any blanks in user */
1406
1407 #line 542 ""
1408 i__1 = idxa;
1409 #line 542 ""
1410 if (s_cmp(line + i__1, "N", idxa + 1 - i__1, (ftnlen)
1411 1) != 0) {
1412 #line 542 ""
1413 goto L9;
1414 #line 542 ""
1415 }
1416 /* bail out */
1417 #line 543 ""
1418 if (idxa != 1) {
1419 #line 544 ""
1420 s_wsle(&io___84);
1421 #line 544 ""
1422 e_wsle();
1423 #line 545 ""
1424 s_wsle(&io___85);
1425 #line 545 ""
1426 do_lio(&c__9, &c__1, "You entered \"AN...\" some"\
1427 "where beyond first column; stopping.", (
1428 ftnlen)60);
1429 #line 545 ""
1430 e_wsle();
1431 #line 547 ""
1432 s_stop("1", (ftnlen)1);
1433 #line 548 ""
1434 }
1435
1436 /* pmxa already checked for valid one- or 2-digit number, so get it */
1437
1438 #line 552 ""
1439 if (*(unsigned char *)&line[3] == '"') {
1440
1441 /* Single digit instrument number */
1442
1443 #line 556 ""
1444 s_rsfi(&io___86);
1445 #line 556 ""
1446 do_fio(&c__1, (char *)&iudpfn, (ftnlen)sizeof(
1447 integer));
1448 #line 556 ""
1449 e_rsfi();
1450 #line 557 ""
1451 idxstartname = 5;
1452 #line 558 ""
1453 } else {
1454 #line 559 ""
1455 s_rsfi(&io___89);
1456 #line 559 ""
1457 do_fio(&c__1, (char *)&iudpfn, (ftnlen)sizeof(
1458 integer));
1459 #line 559 ""
1460 e_rsfi();
1461 #line 560 ""
1462 idxstartname = 6;
1463 #line 561 ""
1464 }
1465 #line 562 ""
1466 ludpfn[iudpfn - 1] = i_indx(line + (idxstartname - 1),
1467 "\"", 128 - (idxstartname - 1), (ftnlen)1) -
1468 1;
1469 #line 563 ""
1470 if (ludpfn[iudpfn - 1] < 0) {
1471 #line 564 ""
1472 s_wsle(&io___90);
1473 #line 564 ""
1474 e_wsle();
1475 #line 565 ""
1476 s_wsle(&io___91);
1477 #line 565 ""
1478 do_lio(&c__9, &c__1, "User-defined part file nam"\
1479 "e must be in quotes", (ftnlen)45);
1480 #line 565 ""
1481 e_wsle();
1482 #line 566 ""
1483 s_stop("1", (ftnlen)1);
1484 #line 567 ""
1485 }
1486 #line 568 ""
1487 idxendname = idxstartname + ludpfn[iudpfn - 1] - 1;
1488 #line 569 ""
1489 s_copy(udpfnq + (iudpfn - 1 << 7), line + (
1490 idxstartname - 1), (ftnlen)128, idxendname - (
1491 idxstartname - 1));
1492
1493 /* Get a new line! */
1494
1495 #line 573 ""
1496 goto L4;
1497 #line 574 ""
1498 } else if (ia == 8) {
1499
1500 /* Key change/transposition. */
1501 /* If not instrument specific, copy to all parts */
1502
1503 #line 579 ""
1504 i__1 = idxa;
1505 #line 579 ""
1506 if (s_cmp(line + i__1, "i", idxa + 1 - i__1, (ftnlen)
1507 1) != 0) {
1508 #line 579 ""
1509 goto L9;
1510 #line 579 ""
1511 }
1512
1513 /* Instrument-wise key/transposition(s): Ki[nn][+/-][dd}[+/-][dd]... */
1514
1515 #line 583 ""
1516 ibb = idxa + 2;
1517 /* Starts on digit after 'i' */
1518 #line 584 ""
1519 L40:
1520 #line 585 ""
1521 ici__1.icierr = 0;
1522 #line 585 ""
1523 ici__1.iciend = 0;
1524 #line 585 ""
1525 ici__1.icirnum = 1;
1526 #line 585 ""
1527 ici__1.icirlen = 1;
1528 #line 585 ""
1529 ici__1.iciunit = line + (ibb - 1);
1530 #line 585 ""
1531 ici__1.icifmt = "(i1)";
1532 #line 585 ""
1533 s_rsfi(&ici__1);
1534 #line 585 ""
1535 do_fio(&c__1, (char *)&iiinst, (ftnlen)sizeof(integer)
1536 );
1537 #line 585 ""
1538 e_rsfi();
1539 /* 1st digit of iinst */
1540 #line 586 ""
1541 i__1 = ibb;
1542 #line 586 ""
1543 itemp = i_indx("01234567890", line + i__1, (ftnlen)11,
1544 ibb + 1 - i__1);
1545 #line 587 ""
1546 if (itemp > 0) {
1547 #line 588 ""
1548 ++ibb;
1549 #line 589 ""
1550 iiinst = iiinst * 10 + itemp - 1;
1551 #line 590 ""
1552 }
1553 #line 591 ""
1554 ++ibb;
1555 /* now at first +/-. Need end of 2nd number */
1556 #line 592 ""
1557 i__1 = ibb;
1558 #line 592 ""
1559 itemp = i_indx(line + i__1, "i", ib - i__1, (ftnlen)1)
1560 ;
1561 /* Rel pos'n of next 'i' */
1562 #line 593 ""
1563 if (itemp > 0) {
1564 #line 594 ""
1565 iend = ibb + itemp - 1;
1566 #line 595 ""
1567 } else {
1568 #line 596 ""
1569 iend = ib - 1;
1570 #line 597 ""
1571 }
1572 #line 598 ""
1573 io___98.ciunit = all_1.iorig[iiinst - 1] + 10;
1574 #line 598 ""
1575 s_wsfe(&io___98);
1576 /* Writing concatenation */
1577 #line 598 ""
1578 i__3[0] = 3, a__1[0] = "Ki1";
1579 #line 598 ""
1580 i__3[1] = iend - (ibb - 1), a__1[1] = line + (ibb - 1)
1581 ;
1582 #line 598 ""
1583 s_cat(ch__6, a__1, i__3, &c__2, (ftnlen)131);
1584 #line 598 ""
1585 do_fio(&c__1, ch__6, iend - (ibb - 1) + 3);
1586 #line 598 ""
1587 e_wsfe();
1588 #line 599 ""
1589 if (itemp > 0) {
1590 #line 600 ""
1591 ibb = iend + 2;
1592 #line 601 ""
1593 goto L40;
1594 #line 602 ""
1595 }
1596 #line 603 ""
1597 goto L12;
1598 /* Remove K command from string, go to next ia */
1599 #line 604 ""
1600 }
1601 #line 605 ""
1602 L9:
1603 #line 606 ""
1604 i__1 = ib - idxa;
1605 #line 606 ""
1606 allparts_(line + (idxa - 1), &i__1, ib - 1 - (idxa - 1));
1607 #line 607 ""
1608 L12:
1609
1610 /* Remove the string from line */
1611
1612 #line 611 ""
1613 if (idxa == 1) {
1614 #line 612 ""
1615 s_copy(line, line + (ib - 1), (ftnlen)128, 128 - (ib
1616 - 1));
1617 #line 613 ""
1618 } else {
1619 /* Writing concatenation */
1620 #line 614 ""
1621 i__3[0] = idxa - 1, a__1[0] = line;
1622 #line 614 ""
1623 i__3[1] = 128 - (ib - 1), a__1[1] = line + (ib - 1);
1624 #line 614 ""
1625 s_cat(line, a__1, i__3, &c__2, (ftnlen)128);
1626 #line 615 ""
1627 }
1628 #line 616 ""
1629 lenline = lenstr_(line, &c__128, (ftnlen)128);
1630
1631 /* Loop if only blanks are left */
1632
1633 #line 620 ""
1634 if (lenline == 0) {
1635 #line 620 ""
1636 goto L4;
1637 #line 620 ""
1638 }
1639
1640 /* Must check for multiple "I" commands, so go to just after start of ia loop */
1641
1642 #line 624 ""
1643 if (ia == 10) {
1644 #line 624 ""
1645 goto L24;
1646 #line 624 ""
1647 }
1648
1649 /* Tack on front part from 1st line of saved macro */
1650
1651 #line 628 ""
1652 if (lenhold > 0) {
1653 /* Writing concatenation */
1654 #line 629 ""
1655 i__4[0] = lenhold, a__2[0] = holdln;
1656 #line 629 ""
1657 i__4[1] = 1, a__2[1] = " ";
1658 #line 629 ""
1659 i__4[2] = lenline, a__2[2] = line;
1660 #line 629 ""
1661 s_cat(line, a__2, i__4, &c__3, (ftnlen)128);
1662 #line 630 ""
1663 lenhold = 0;
1664 #line 631 ""
1665 }
1666 #line 632 ""
1667 }
1668 #line 633 ""
1669 /* L5: */
1670 #line 633 ""
1671 }
1672 #line 634 ""
1673 }
1674 #line 634 ""
1675 }
1676
1677 /* Now a special loop to deal with 'X'. If it was %[n]X..., will have been */
1678 /* copied into part [n] already. If no "B" or "P", remove. If "P", just */
1679 /* remove the "P" so pmxa/b will process. If "B". do nothing. */
1680
1681 #line 640 ""
1682 L10:
1683 #line 641 ""
1684 nchk = 1;
1685 #line 642 ""
1686 L13:
1687 #line 642 ""
1688 ntinx = nchk - 1 + ntindex_(line + (nchk - 1), "X", 128 - (nchk - 1), (
1689 ftnlen)1);
1690 #line 643 ""
1691 if (ntinx > nchk - 1) {
1692
1693 /* There is a non-TeX 'X' at ntinx. Loop if neither 1st nor after a blank. */
1694
1695 #line 647 ""
1696 if (ntinx > 1) {
1697 #line 648 ""
1698 i__1 = ntinx - 2;
1699 #line 648 ""
1700 if (s_cmp(line + i__1, " ", ntinx - 1 - i__1, (ftnlen)1) != 0) {
1701
1702 /* The X is not 1st char of PMX command. Advance starting point, loop. */
1703
1704 #line 652 ""
1705 nchk = ntinx + 1;
1706 #line 653 ""
1707 goto L13;
1708 #line 654 ""
1709 }
1710 #line 655 ""
1711 }
1712
1713 /* We now know the X at ntinx starts a PMX command. Find next blank */
1714
1715 #line 659 ""
1716 i__1 = ntinx;
1717 #line 659 ""
1718 ib = ntinx + i_indx(line + i__1, " ", 128 - i__1, (ftnlen)1);
1719
1720 /* There must be a blank to right of "X", so ib>ntinx */
1721
1722 /* locp = nchk-1+index(line(nchk:ib),'P') */
1723 #line 664 ""
1724 i__1 = ntinx;
1725 #line 664 ""
1726 locp = ntinx + i_indx(line + i__1, "P", ib - i__1, (ftnlen)1);
1727
1728 /* Did not need to use ntindex because we already know bounds of PMX command. */
1729
1730 /* if (locp .gt. nchk-1) then */
1731 #line 669 ""
1732 if (locp > ntinx) {
1733
1734 /* Strip out the 'P' */
1735
1736 #line 673 ""
1737 s_copy(templine, line, (ftnlen)128, locp - 1);
1738 #line 674 ""
1739 i__1 = locp;
1740 /* Writing concatenation */
1741 #line 674 ""
1742 i__3[0] = locp - 1, a__1[0] = templine;
1743 #line 674 ""
1744 i__3[1] = lenline - i__1, a__1[1] = line + i__1;
1745 #line 674 ""
1746 s_cat(line, a__1, i__3, &c__2, (ftnlen)128);
1747 #line 675 ""
1748 --lenline;
1749 #line 676 ""
1750 --ib;
1751 #line 677 ""
1752 }
1753 #line 678 ""
1754 if (i_indx(line + (ntinx - 1), ":", ib - (ntinx - 1), (ftnlen)1) > 0
1755 || i_indx(line + (ntinx - 1), "S", ib - (ntinx - 1), (ftnlen)
1756 1) > 0 || i_indx(line + (ntinx - 1), "B", ib - (ntinx - 1), (
1757 ftnlen)1) > 0 || locp > ntinx) {
1758
1759 /* The X command is a shift, "Both", or "Part". Do not remove. */
1760
1761 #line 684 ""
1762 nchk = ib + 1;
1763 #line 685 ""
1764 goto L13;
1765 #line 686 ""
1766 }
1767
1768 /* Remove the X command. */
1769
1770 #line 690 ""
1771 if (ntinx == 1) {
1772 #line 691 ""
1773 if (ib < lenline) {
1774 #line 692 ""
1775 i__1 = ib;
1776 #line 692 ""
1777 s_copy(line, line + i__1, (ftnlen)128, lenline - i__1);
1778 #line 693 ""
1779 } else {
1780
1781 /* line contains ONLY the "X" command, so get a new line */
1782
1783 #line 697 ""
1784 goto L4;
1785 #line 698 ""
1786 }
1787 #line 699 ""
1788 } else {
1789 #line 700 ""
1790 s_copy(templine, line, (ftnlen)128, ntinx - 1);
1791 #line 701 ""
1792 if (ib < lenline) {
1793 #line 702 ""
1794 i__1 = ib;
1795 /* Writing concatenation */
1796 #line 702 ""
1797 i__3[0] = ntinx - 1, a__1[0] = templine;
1798 #line 702 ""
1799 i__3[1] = lenline - i__1, a__1[1] = line + i__1;
1800 #line 702 ""
1801 s_cat(line, a__1, i__3, &c__2, (ftnlen)128);
1802 #line 703 ""
1803 } else {
1804 #line 704 ""
1805 s_copy(line, templine, (ftnlen)128, ntinx - 1);
1806 #line 705 ""
1807 }
1808 #line 706 ""
1809 }
1810
1811 /* Recompute lenline */
1812
1813 #line 710 ""
1814 lenline = lenstr_(line, &c__128, (ftnlen)128);
1815
1816 /* Resume checking after location of removed command. */
1817
1818 #line 714 ""
1819 nchk = ntinx;
1820 #line 715 ""
1821 goto L13;
1822 #line 716 ""
1823 }
1824
1825 /* End of loop for X-checks */
1826
1827 #line 720 ""
1828 oneof2 = ntindex_(line, "//", (ftnlen)128, (ftnlen)2) > 0;
1829 #line 721 ""
1830 if (termrpt && all_1.botv[iv - 1] && frstln && *(unsigned char *)&line[
1831 lenline - 1] == '/') {
1832
1833 /* Must add a terminal repeat before the slash */
1834
1835 #line 726 ""
1836 if (oneof2) {
1837 #line 726 ""
1838 --lenline;
1839 #line 726 ""
1840 }
1841 #line 727 ""
1842 if (lenline > 1) {
1843 #line 727 ""
1844 io___103.ciunit = all_1.iorig[iinst - 1] + 10;
1845 #line 727 ""
1846 s_wsfe(&io___103);
1847 #line 727 ""
1848 do_fio(&c__1, line, lenline - 1);
1849 #line 727 ""
1850 e_wsfe();
1851 #line 727 ""
1852 }
1853 #line 728 ""
1854 if (! oneof2) {
1855 /* Writing concatenation */
1856 #line 729 ""
1857 i__3[0] = 2, a__1[0] = termsym;
1858 #line 729 ""
1859 i__3[1] = 2, a__1[1] = " /";
1860 #line 729 ""
1861 s_cat(line, a__1, i__3, &c__2, (ftnlen)128);
1862 #line 730 ""
1863 lenline = 4;
1864 #line 731 ""
1865 } else {
1866 /* Writing concatenation */
1867 #line 732 ""
1868 i__3[0] = 2, a__1[0] = termsym;
1869 #line 732 ""
1870 i__3[1] = 3, a__1[1] = " //";
1871 #line 732 ""
1872 s_cat(line, a__1, i__3, &c__2, (ftnlen)128);
1873 #line 733 ""
1874 lenline = 5;
1875 #line 734 ""
1876 }
1877 #line 735 ""
1878 }
1879 #line 736 ""
1880 if (termrpt && frstln && *(unsigned char *)&line[lenline - 1] == '/' &&
1881 iv == all_1.nvnow) {
1882 #line 736 ""
1883 termrpt = FALSE_;
1884 #line 736 ""
1885 }
1886 #line 738 ""
1887 io___104.ciunit = all_1.iorig[iinst - 1] + 10;
1888 #line 738 ""
1889 s_wsfe(&io___104);
1890 #line 738 ""
1891 do_fio(&c__1, line, lenline);
1892 #line 738 ""
1893 e_wsfe();
1894 #line 739 ""
1895 if (oneof2) {
1896 #line 740 ""
1897 frstln = FALSE_;
1898 #line 741 ""
1899 } else if (! frstln) {
1900 #line 742 ""
1901 frstln = TRUE_;
1902 #line 743 ""
1903 }
1904 /* if (ntindex(line,'/').gt.0 .and. index(line,'//').eq.0) then */
1905 #line 745 ""
1906 if (ntindex_(line, "/", (ftnlen)128, (ftnlen)1) > 0 && ntindex_(line,
1907 "//", (ftnlen)128, (ftnlen)2) == 0) {
1908 #line 746 ""
1909 iv = iv % all_1.nvnow + 1;
1910 #line 747 ""
1911 iinst = all_1.instnum[iv - 1];
1912 #line 748 ""
1913 }
1914 #line 749 ""
1915 goto L4;
1916 #line 750 ""
1917 L999:
1918 #line 751 ""
1919 cl__1.cerr = 0;
1920 #line 751 ""
1921 cl__1.cunit = 10;
1922 #line 751 ""
1923 cl__1.csta = 0;
1924 #line 751 ""
1925 f_clos(&cl__1);
1926
1927 /* In the mbrest checks, must run through ALL noinst files (not just noinow) */
1928
1929 #line 755 ""
1930 i__1 = all_1.noinst;
1931 #line 755 ""
1932 for (iinst = 1; iinst <= i__1; ++iinst) {
1933 /* cc+++ */
1934 /* c */
1935 /* c Temporarily transfer entire scratch file to real file */
1936 /* c */
1937 /* rewind(10+iinst) */
1938 /* open(40,file='s2pout'//char(48+iinst)//'.pmx') */
1939 /* do 50 m = 1 , 10000 */
1940 /* read(10+iinst,'(a)',end=51)line */
1941 /* lenline = lenstr(line,128) */
1942 /* if (lenline .ge. 1) then */
1943 /* write(40,'(a)')line(1:lenline) */
1944 /* else */
1945 /* write(40,'(a)')' ' */
1946 /* end if */
1947 /* 50 continue */
1948 /* 51 continue */
1949 /* close(40) */
1950 /* cc+++ */
1951 #line 774 ""
1952 if (all_1.nvi[iinst - 1] == 1) {
1953 #line 775 ""
1954 mbrests_(&iinst, jobname, &ljob, &ludpfn[iinst - 1], udpfnq + (
1955 iinst - 1 << 7), (ftnlen)27, (ftnlen)128);
1956 #line 776 ""
1957 } else {
1958
1959 /* Send a signal with ljob to bypass most mbrest processing */
1960
1961 #line 780 ""
1962 i__2 = -ljob;
1963 #line 780 ""
1964 mbrests_(&iinst, jobname, &i__2, &ludpfn[iinst - 1], udpfnq + (
1965 iinst - 1 << 7), (ftnlen)27, (ftnlen)128);
1966 #line 781 ""
1967 }
1968 #line 782 ""
1969 /* L11: */
1970 #line 782 ""
1971 }
1972 #line 783 ""
1973 return 0;
1974 } /* MAIN__ */
1975
1976 integer lenstr_(char *string, integer *n, ftnlen string_len)
1977 {
1978 /* System generated locals */
1979 integer ret_val;
1980
1981 #line 786 ""
1982 for (ret_val = *n; ret_val >= 1; --ret_val) {
1983 #line 787 ""
1984 if (*(unsigned char *)&string[ret_val - 1] != ' ') {
1985 #line 787 ""
1986 return ret_val;
1987 #line 787 ""
1988 }
1989 #line 788 ""
1990 /* L1: */
1991 #line 788 ""
1992 }
1993 #line 789 ""
1994 ret_val = 0;
1995 #line 790 ""
1996 return ret_val;
1997 } /* lenstr_ */
1998
1999 /* Subroutine */ int allparts_(char *string, integer *n, ftnlen string_len)
2000 {
2001 /* System generated locals */
2002 integer i__1;
2003
2004 /* Builtin functions */
2005 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
2006 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
2007
2008 /* Local variables */
2009 static integer len, iinst;
2010 extern integer lenstr_(char *, integer *, ftnlen);
2011
2012 /* Fortran I/O blocks */
2013 static cilist io___107 = { 0, 0, 0, "(a)", 0 };
2014
2015
2016 #line 798 ""
2017 len = lenstr_(string, n, string_len);
2018 #line 799 ""
2019 if (len == 0) {
2020 #line 800 ""
2021 len = 1;
2022 #line 801 ""
2023 s_copy(string, " ", string_len, (ftnlen)1);
2024 #line 802 ""
2025 }
2026 #line 803 ""
2027 i__1 = all_1.noinow;
2028 #line 803 ""
2029 for (iinst = 1; iinst <= i__1; ++iinst) {
2030 #line 804 ""
2031 io___107.ciunit = all_1.iorig[iinst - 1] + 10;
2032 #line 804 ""
2033 s_wsfe(&io___107);
2034 #line 804 ""
2035 do_fio(&c__1, string, len);
2036 #line 804 ""
2037 e_wsfe();
2038 #line 805 ""
2039 /* L1: */
2040 #line 805 ""
2041 }
2042 #line 806 ""
2043 return 0;
2044 } /* allparts_ */
2045
2046 /* Subroutine */ int mbrests_(integer *iv, char *jobname, integer *ljob,
2047 integer *ludpfn, char *udpfnq, ftnlen jobname_len, ftnlen udpfnq_len)
2048 {
2049 /* System generated locals */
2050 address a__1[2], a__2[3];
2051 integer i__1[2], i__2[3], i__3, i__4;
2052 real r__1;
2053 char ch__1[1], ch__2[18], ch__3[132], ch__4[4], ch__5[2], ch__6[10];
2054 cilist ci__1;
2055 icilist ici__1;
2056 olist o__1;
2057 cllist cl__1;
2058 alist al__1;
2059
2060 /* Builtin functions */
2061 integer f_rew(alist *);
2062 /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen);
2063 integer f_open(olist *), s_rsfe(cilist *), do_fio(integer *, char *,
2064 ftnlen), e_rsfe(void), s_cmp(char *, char *, ftnlen, ftnlen),
2065 s_wsfe(cilist *), e_wsfe(void), s_wsle(cilist *), do_lio(integer *
2066 , integer *, char *, ftnlen), e_wsle(void);
2067 /* Subroutine */ int s_stop(char *, ftnlen);
2068 integer i_indx(char *, char *, ftnlen, ftnlen), s_rsfi(icilist *), e_rsfi(
2069 void);
2070 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
2071 double r_lg10(real *);
2072 integer f_clos(cllist *);
2073
2074 /* Local variables */
2075 static integer i__, il, iw;
2076 static char sq[1];
2077 static integer ip1, ipc, ipe, len, idx;
2078 static char sym[80];
2079 static integer ndig;
2080 static char line[128*50];
2081 static integer idxb, nmbr, idxs, lsym;
2082 static char line1[128];
2083 static logical type4;
2084 static integer icden, iline, lpart;
2085 static char partq[2];
2086 static integer lwbrs, nwbrs, lenbar, ipenew, mtrden;
2087 static logical wbrest;
2088 extern integer lenstr_(char *, integer *, ftnlen);
2089 static logical newmtr;
2090 static integer lwbrsx, mtrnum;
2091 static char wbrsym[3*2];
2092 static integer lenbeat;
2093 static logical alldone;
2094 extern integer ifnodur_(integer *, char *, ftnlen), ntindex_(char *, char
2095 *, ftnlen, ftnlen);
2096 static integer lenmult;
2097 extern /* Subroutine */ int dosetup_(integer *, char *, integer *,
2098 integer *, ftnlen);
2099 static logical rpfirst;
2100 extern /* Subroutine */ int fwbrsym_(integer *, integer *, char *,
2101 integer *, ftnlen), nextsym_(char *, integer *, integer *,
2102 integer *, char *, integer *, ftnlen, ftnlen);
2103
2104 /* Fortran I/O blocks */
2105 static cilist io___114 = { 0, 0, 0, "(a)", 0 };
2106 static cilist io___117 = { 0, 40, 0, "(a)", 0 };
2107 static cilist io___118 = { 0, 40, 0, "(a)", 0 };
2108 static cilist io___119 = { 0, 6, 0, 0, 0 };
2109 static cilist io___122 = { 0, 0, 1, "(a)", 0 };
2110 static cilist io___123 = { 0, 40, 0, "(a)", 0 };
2111 static cilist io___124 = { 0, 0, 0, "(a)", 0 };
2112 static cilist io___125 = { 0, 40, 0, "(a)", 0 };
2113 static cilist io___145 = { 0, 0, 1, "(a)", 0 };
2114 static cilist io___146 = { 0, 40, 0, "(a)", 0 };
2115 static cilist io___147 = { 0, 40, 0, "(a)", 0 };
2116 static cilist io___148 = { 0, 6, 0, 0, 0 };
2117 static cilist io___153 = { 0, 40, 0, "(a)", 0 };
2118 static cilist io___155 = { 0, 6, 0, 0, 0 };
2119 static cilist io___157 = { 0, 40, 0, "(a)", 0 };
2120 static cilist io___159 = { 0, 40, 0, "(a)", 0 };
2121 static cilist io___160 = { 0, 40, 0, "(a)", 0 };
2122 static cilist io___161 = { 0, 40, 0, "(a)", 0 };
2123 static cilist io___162 = { 0, 40, 0, "(a)", 0 };
2124
2125
2126 #line 816 ""
2127 type4 = FALSE_;
2128 #line 817 ""
2129 *(unsigned char *)sq = '\\';
2130 #line 818 ""
2131 alldone = FALSE_;
2132 #line 819 ""
2133 al__1.aerr = 0;
2134 #line 819 ""
2135 al__1.aunit = *iv + 10;
2136 #line 819 ""
2137 f_rew(&al__1);
2138 #line 820 ""
2139 if (*iv < 10) {
2140 #line 821 ""
2141 *(unsigned char *)partq = (char) (*iv + 48);
2142 #line 822 ""
2143 lpart = 1;
2144 #line 823 ""
2145 } else {
2146 #line 824 ""
2147 lpart = 2;
2148 #line 825 ""
2149 if (*iv < 20) {
2150 /* Writing concatenation */
2151 #line 826 ""
2152 i__1[0] = 1, a__1[0] = "1";
2153 #line 826 ""
2154 *(unsigned char *)&ch__1[0] = *iv + 38;
2155 #line 826 ""
2156 i__1[1] = 1, a__1[1] = ch__1;
2157 #line 826 ""
2158 s_cat(partq, a__1, i__1, &c__2, (ftnlen)2);
2159 #line 827 ""
2160 } else {
2161 /* Writing concatenation */
2162 #line 828 ""
2163 i__1[0] = 1, a__1[0] = "2";
2164 #line 828 ""
2165 *(unsigned char *)&ch__1[0] = *iv + 28;
2166 #line 828 ""
2167 i__1[1] = 1, a__1[1] = ch__1;
2168 #line 828 ""
2169 s_cat(partq, a__1, i__1, &c__2, (ftnlen)2);
2170 #line 829 ""
2171 }
2172 #line 830 ""
2173 }
2174 /* 130327 */
2175 /* open(40,file=jobname(1:abs(ljob))//partq(1:lpart)//'.pmx') */
2176 #line 833 ""
2177 if (*ludpfn == 0) {
2178 #line 834 ""
2179 o__1.oerr = 0;
2180 #line 834 ""
2181 o__1.ounit = 40;
2182 #line 834 ""
2183 o__1.ofnmlen = abs(*ljob) + lpart + 4;
2184 /* Writing concatenation */
2185 #line 834 ""
2186 i__2[0] = abs(*ljob), a__2[0] = jobname;
2187 #line 834 ""
2188 i__2[1] = lpart, a__2[1] = partq;
2189 #line 834 ""
2190 i__2[2] = 4, a__2[2] = ".pmx";
2191 #line 834 ""
2192 s_cat(ch__2, a__2, i__2, &c__3, (ftnlen)18);
2193 #line 834 ""
2194 o__1.ofnm = ch__2;
2195 #line 834 ""
2196 o__1.orl = 0;
2197 #line 834 ""
2198 o__1.osta = 0;
2199 #line 834 ""
2200 o__1.oacc = 0;
2201 #line 834 ""
2202 o__1.ofm = 0;
2203 #line 834 ""
2204 o__1.oblnk = 0;
2205 #line 834 ""
2206 f_open(&o__1);
2207 #line 835 ""
2208 } else {
2209 #line 836 ""
2210 o__1.oerr = 0;
2211 #line 836 ""
2212 o__1.ounit = 40;
2213 #line 836 ""
2214 o__1.ofnmlen = *ludpfn + 4;
2215 /* Writing concatenation */
2216 #line 836 ""
2217 i__1[0] = *ludpfn, a__1[0] = udpfnq;
2218 #line 836 ""
2219 i__1[1] = 4, a__1[1] = ".pmx";
2220 #line 836 ""
2221 s_cat(ch__3, a__1, i__1, &c__2, (ftnlen)132);
2222 #line 836 ""
2223 o__1.ofnm = ch__3;
2224 #line 836 ""
2225 o__1.orl = 0;
2226 #line 836 ""
2227 o__1.osta = 0;
2228 #line 836 ""
2229 o__1.oacc = 0;
2230 #line 836 ""
2231 o__1.ofm = 0;
2232 #line 836 ""
2233 o__1.oblnk = 0;
2234 #line 836 ""
2235 f_open(&o__1);
2236 #line 837 ""
2237 }
2238 #line 838 ""
2239 for (i__ = 1; i__ <= 10000; ++i__) {
2240 #line 839 ""
2241 io___114.ciunit = *iv + 10;
2242 #line 839 ""
2243 s_rsfe(&io___114);
2244 #line 839 ""
2245 do_fio(&c__1, line, (ftnlen)128);
2246 #line 839 ""
2247 e_rsfe();
2248 #line 840 ""
2249 if (*(unsigned char *)&line[0] == '%' || s_cmp(line, "---", (ftnlen)3,
2250 (ftnlen)3) == 0 || type4) {
2251 #line 842 ""
2252 len = lenstr_(line, &c__128, (ftnlen)128);
2253 #line 843 ""
2254 if (len > 0) {
2255 #line 844 ""
2256 s_wsfe(&io___117);
2257 #line 844 ""
2258 do_fio(&c__1, line, len);
2259 #line 844 ""
2260 e_wsfe();
2261 #line 845 ""
2262 } else {
2263 #line 846 ""
2264 s_wsfe(&io___118);
2265 #line 846 ""
2266 do_fio(&c__1, " ", (ftnlen)1);
2267 #line 846 ""
2268 e_wsfe();
2269 #line 847 ""
2270 }
2271 #line 848 ""
2272 if (s_cmp(line, "---", (ftnlen)3, (ftnlen)3) == 0) {
2273 #line 848 ""
2274 type4 = ! type4;
2275 #line 848 ""
2276 }
2277 #line 849 ""
2278 } else {
2279 #line 850 ""
2280 goto L11;
2281 #line 851 ""
2282 }
2283 #line 852 ""
2284 /* L10: */
2285 #line 852 ""
2286 }
2287 #line 853 ""
2288 s_wsle(&io___119);
2289 #line 853 ""
2290 do_lio(&c__9, &c__1, "You should not be here in scor2prt. Call Dr. Don",
2291 (ftnlen)49);
2292 #line 853 ""
2293 e_wsle();
2294 #line 854 ""
2295 s_stop("", (ftnlen)0);
2296 #line 855 ""
2297 L11:
2298
2299 /* Finished reading opening type4 TeX and comments. Next line to be read */
2300 /* will contain the first of the input numbers */
2301
2302 #line 860 ""
2303 dosetup_(iv, line, &mtrnum, &mtrden, (ftnlen)128);
2304 #line 861 ""
2305 for (i__ = 1; i__ <= 10000; ++i__) {
2306 #line 862 ""
2307 L13:
2308 #line 862 ""
2309 io___122.ciunit = *iv + 10;
2310 #line 862 ""
2311 i__3 = s_rsfe(&io___122);
2312 #line 862 ""
2313 if (i__3 != 0) {
2314 #line 862 ""
2315 goto L999;
2316 #line 862 ""
2317 }
2318 #line 862 ""
2319 i__3 = do_fio(&c__1, line, (ftnlen)128);
2320 #line 862 ""
2321 if (i__3 != 0) {
2322 #line 862 ""
2323 goto L999;
2324 #line 862 ""
2325 }
2326 #line 862 ""
2327 i__3 = e_rsfe();
2328 #line 862 ""
2329 if (i__3 != 0) {
2330 #line 862 ""
2331 goto L999;
2332 #line 862 ""
2333 }
2334 #line 863 ""
2335 L7:
2336 #line 863 ""
2337 len = lenstr_(line, &c__128, (ftnlen)128);
2338
2339 /* Pass-through (and copy into part file) if instrumnet has >1 voice. */
2340
2341 #line 867 ""
2342 if (*ljob < 0) {
2343 #line 867 ""
2344 goto L2;
2345 #line 867 ""
2346 }
2347 #line 868 ""
2348 if (i_indx("TtTiTch+h-h l ", line, (ftnlen)14, (ftnlen)2) > 0) {
2349
2350 /* Traps titles, instruments, composers, headers, lower strings. Read 2 lines. */
2351
2352 #line 872 ""
2353 s_wsfe(&io___123);
2354 #line 872 ""
2355 do_fio(&c__1, line, len);
2356 #line 872 ""
2357 e_wsfe();
2358 #line 873 ""
2359 io___124.ciunit = *iv + 10;
2360 #line 873 ""
2361 s_rsfe(&io___124);
2362 #line 873 ""
2363 do_fio(&c__1, line, (ftnlen)128);
2364 #line 873 ""
2365 e_rsfe();
2366 #line 874 ""
2367 len = lenstr_(line, &c__128, (ftnlen)128);
2368 #line 875 ""
2369 goto L2;
2370 #line 876 ""
2371 }
2372 #line 877 ""
2373 if (i__ == 1 || i__ > 5 && *(unsigned char *)&line[0] == 'm') {
2374
2375 /* Either just starting, or a new meter is defined. */
2376 /* NOTE! The above test may be bogus. */
2377
2378 #line 882 ""
2379 if (*(unsigned char *)&line[0] == '%') {
2380 #line 883 ""
2381 s_wsfe(&io___125);
2382 #line 883 ""
2383 do_fio(&c__1, line, len);
2384 #line 883 ""
2385 e_wsfe();
2386 #line 884 ""
2387 goto L13;
2388 #line 885 ""
2389 }
2390 #line 886 ""
2391 if (i__ != 1) {
2392
2393 /* New meter. Check for slashes (new meter change syntax) */
2394
2395 #line 890 ""
2396 idxs = i_indx(line, "/", (ftnlen)128, (ftnlen)1);
2397 #line 891 ""
2398 idxb = i_indx(line, " ", (ftnlen)128, (ftnlen)1);
2399 #line 892 ""
2400 newmtr = idxs > 0 && (idxb == 0 || idxs < idxb);
2401 #line 893 ""
2402 if (! newmtr) {
2403
2404 /* Old way, no slashes, uses 'o' for lonesome '1' */
2405
2406 #line 897 ""
2407 icden = 3;
2408 #line 898 ""
2409 if (*(unsigned char *)&line[1] == 'o') {
2410 #line 899 ""
2411 mtrnum = 1;
2412 #line 900 ""
2413 } else {
2414 #line 901 ""
2415 mtrnum = *(unsigned char *)&line[1] - 48;
2416 #line 902 ""
2417 if (mtrnum == 1) {
2418 #line 903 ""
2419 icden = 4;
2420 #line 904 ""
2421 mtrnum = *(unsigned char *)&line[2] - 38;
2422 #line 905 ""
2423 }
2424 #line 906 ""
2425 }
2426 #line 907 ""
2427 mtrden = *(unsigned char *)&line[icden - 1] - 48;
2428 #line 908 ""
2429 } else {
2430
2431 /* New way with slashes: idxs is index of 1st slash! */
2432
2433 #line 912 ""
2434 ici__1.icierr = 0;
2435 #line 912 ""
2436 ici__1.iciend = 0;
2437 #line 912 ""
2438 ici__1.icirnum = 1;
2439 #line 912 ""
2440 ici__1.icirlen = idxs - 2;
2441 #line 912 ""
2442 ici__1.iciunit = line + 1;
2443 /* Writing concatenation */
2444 #line 912 ""
2445 i__2[0] = 2, a__2[0] = "(i";
2446 #line 912 ""
2447 *(unsigned char *)&ch__1[0] = idxs + 46;
2448 #line 912 ""
2449 i__2[1] = 1, a__2[1] = ch__1;
2450 #line 912 ""
2451 i__2[2] = 1, a__2[2] = ")";
2452 #line 912 ""
2453 ici__1.icifmt = (s_cat(ch__4, a__2, i__2, &c__3, (ftnlen)
2454 4), ch__4);
2455 #line 912 ""
2456 s_rsfi(&ici__1);
2457 #line 912 ""
2458 do_fio(&c__1, (char *)&mtrnum, (ftnlen)sizeof(integer));
2459 #line 912 ""
2460 e_rsfi();
2461 #line 913 ""
2462 i__3 = idxs;
2463 #line 913 ""
2464 idxb = i_indx(line + i__3, "/", 128 - i__3, (ftnlen)1);
2465 #line 914 ""
2466 i__3 = idxs;
2467 #line 914 ""
2468 ici__1.icierr = 0;
2469 #line 914 ""
2470 ici__1.iciend = 0;
2471 #line 914 ""
2472 ici__1.icirnum = 1;
2473 #line 914 ""
2474 ici__1.icirlen = idxs + idxb - 1 - i__3;
2475 #line 914 ""
2476 ici__1.iciunit = line + i__3;
2477 /* Writing concatenation */
2478 #line 914 ""
2479 i__2[0] = 2, a__2[0] = "(i";
2480 #line 914 ""
2481 *(unsigned char *)&ch__1[0] = idxb + 47;
2482 #line 914 ""
2483 i__2[1] = 1, a__2[1] = ch__1;
2484 #line 914 ""
2485 i__2[2] = 1, a__2[2] = ")";
2486 #line 914 ""
2487 ici__1.icifmt = (s_cat(ch__4, a__2, i__2, &c__3, (ftnlen)
2488 4), ch__4);
2489 #line 914 ""
2490 s_rsfi(&ici__1);
2491 #line 914 ""
2492 do_fio(&c__1, (char *)&mtrden, (ftnlen)sizeof(integer));
2493 #line 914 ""
2494 e_rsfi();
2495 #line 916 ""
2496 }
2497 #line 917 ""
2498 }
2499 #line 918 ""
2500 lenbeat = ifnodur_(&mtrden, "x", (ftnlen)1);
2501 #line 919 ""
2502 lenmult = 1;
2503 #line 920 ""
2504 if (mtrden == 2) {
2505 #line 921 ""
2506 lenbeat = 16;
2507 #line 922 ""
2508 lenmult = 2;
2509 #line 923 ""
2510 }
2511 #line 924 ""
2512 lenbar = lenmult * mtrnum * lenbeat;
2513 #line 925 ""
2514 fwbrsym_(&lenbar, &nwbrs, wbrsym, &lwbrs, (ftnlen)3);
2515 #line 926 ""
2516 }
2517
2518 /* Finished setting up meter stuff and defining whole-bar rest symbols */
2519
2520 #line 930 ""
2521 ip1 = 0;
2522 #line 931 ""
2523 s_copy(line1, line, (ftnlen)128, (ftnlen)128);
2524 #line 932 ""
2525 i__3 = nwbrs;
2526 #line 932 ""
2527 for (iw = 0; iw <= i__3; ++iw) {
2528 #line 933 ""
2529 if (iw > 0) {
2530 #line 934 ""
2531 idx = ntindex_(line1, wbrsym + (iw - 1) * 3, (ftnlen)128,
2532 lwbrs);
2533 #line 935 ""
2534 if (idx > 0) {
2535
2536 /* Check for blank or shifted rest, discount it if it's there */
2537
2538 #line 939 ""
2539 i__4 = idx + lwbrs - 1;
2540 #line 939 ""
2541 if (s_cmp(line1 + i__4, " ", idx + lwbrs - i__4, (ftnlen)
2542 1) != 0) {
2543 #line 939 ""
2544 idx = 0;
2545 #line 939 ""
2546 }
2547 #line 940 ""
2548 }
2549 #line 941 ""
2550 } else {
2551 #line 942 ""
2552 idx = ntindex_(line1, "rp", (ftnlen)128, (ftnlen)2);
2553
2554 /* Check for raised rest */
2555
2556 #line 946 ""
2557 if (idx > 0) {
2558 #line 947 ""
2559 i__4 = idx + 1;
2560 #line 947 ""
2561 if (s_cmp(line1 + i__4, " ", idx + 2 - i__4, (ftnlen)1) !=
2562 0) {
2563 #line 947 ""
2564 idx = 0;
2565 #line 947 ""
2566 }
2567 #line 948 ""
2568 }
2569 #line 949 ""
2570 }
2571 #line 950 ""
2572 if (idx > 0) {
2573 #line 951 ""
2574 if (ip1 == 0) {
2575 #line 952 ""
2576 ip1 = idx;
2577 #line 953 ""
2578 } else {
2579 #line 954 ""
2580 ip1 = min(ip1,idx);
2581 /* Maybe allows e.g. r0 rp ... */
2582 #line 955 ""
2583 }
2584 #line 956 ""
2585 }
2586 #line 957 ""
2587 /* L3: */
2588 #line 957 ""
2589 }
2590 /* Writing concatenation */
2591 #line 958 ""
2592 i__1[0] = 1, a__1[0] = sq;
2593 #line 958 ""
2594 i__1[1] = 1, a__1[1] = sq;
2595 #line 958 ""
2596 s_cat(ch__5, a__1, i__1, &c__2, (ftnlen)2);
2597 #line 958 ""
2598 if (i__ < 5 || *(unsigned char *)&line[0] == '%' || s_cmp(line, ch__5,
2599 (ftnlen)2, (ftnlen)2) == 0 || ip1 == 0) {
2600 #line 958 ""
2601 goto L2;
2602 #line 958 ""
2603 }
2604
2605 /* Switch to multibar rest search mode!!! Start forward in line(1) */
2606
2607 #line 963 ""
2608 rpfirst = s_cmp(line1 + (ip1 - 1), "rp", (ftnlen)2, (ftnlen)2) == 0;
2609 #line 964 ""
2610 iline = 1;
2611 #line 965 ""
2612 nmbr = 1;
2613 #line 966 ""
2614 if (rpfirst) {
2615 #line 967 ""
2616 lwbrsx = 2;
2617 #line 968 ""
2618 } else {
2619 #line 969 ""
2620 lwbrsx = lwbrs;
2621 #line 970 ""
2622 }
2623 #line 971 ""
2624 ipe = ip1 + lwbrsx - 1;
2625 /* ip at end of 1st wbrsym */
2626 #line 972 ""
2627 L4:
2628 #line 972 ""
2629 if (ipe == len) {
2630
2631 /* Need a new line */
2632
2633 #line 976 ""
2634 ++iline;
2635 #line 977 ""
2636 L6:
2637 #line 977 ""
2638 io___145.ciunit = *iv + 10;
2639 #line 977 ""
2640 i__3 = s_rsfe(&io___145);
2641 #line 977 ""
2642 if (i__3 != 0) {
2643 #line 977 ""
2644 goto L998;
2645 #line 977 ""
2646 }
2647 #line 977 ""
2648 i__3 = do_fio(&c__1, line + (iline - 1 << 7), (ftnlen)128);
2649 #line 977 ""
2650 if (i__3 != 0) {
2651 #line 977 ""
2652 goto L998;
2653 #line 977 ""
2654 }
2655 #line 977 ""
2656 i__3 = e_rsfe();
2657 #line 977 ""
2658 if (i__3 != 0) {
2659 #line 977 ""
2660 goto L998;
2661 #line 977 ""
2662 }
2663 #line 978 ""
2664 len = lenstr_(line + (iline - 1 << 7), &c__128, (ftnlen)128);
2665 #line 979 ""
2666 if (*(unsigned char *)&line[(iline - 1) * 128] == '%') {
2667 #line 980 ""
2668 s_wsfe(&io___146);
2669 #line 980 ""
2670 do_fio(&c__1, "% Following comment has been moved forward", (
2671 ftnlen)42);
2672 #line 980 ""
2673 e_wsfe();
2674 #line 981 ""
2675 s_wsfe(&io___147);
2676 #line 981 ""
2677 do_fio(&c__1, line + (iline - 1 << 7), len);
2678 #line 981 ""
2679 e_wsfe();
2680 #line 982 ""
2681 goto L6;
2682 #line 983 ""
2683 }
2684 #line 984 ""
2685 ipe = 0;
2686 #line 985 ""
2687 goto L4;
2688 #line 986 ""
2689 L998:
2690
2691 /* No more input left */
2692
2693 #line 990 ""
2694 s_wsle(&io___148);
2695 #line 990 ""
2696 do_lio(&c__9, &c__1, "All done!", (ftnlen)9);
2697 #line 990 ""
2698 e_wsle();
2699 #line 991 ""
2700 alldone = TRUE_;
2701 #line 992 ""
2702 ipe = 0;
2703 #line 993 ""
2704 --iline;
2705 #line 994 ""
2706 len = lenstr_(line + (iline - 1 << 7), &c__128, (ftnlen)128);
2707 #line 995 ""
2708 goto L4;
2709 #line 996 ""
2710 } else {
2711 #line 997 ""
2712 if (alldone) {
2713 #line 998 ""
2714 *(unsigned char *)sym = ' ';
2715 #line 999 ""
2716 } else {
2717
2718 /* ipe<len here, so it's ok to get a symbol */
2719
2720 #line 1003 ""
2721 nextsym_(line + (iline - 1 << 7), &len, &ipe, &ipenew, sym, &
2722 lsym, (ftnlen)128, (ftnlen)80);
2723 #line 1004 ""
2724 }
2725
2726 /* Check for end of block or bar line symbol */
2727
2728 #line 1008 ""
2729 if (i_indx("/|", sym, (ftnlen)2, (ftnlen)1) > 0) {
2730 #line 1009 ""
2731 ipe = ipenew;
2732 #line 1010 ""
2733 goto L4;
2734 #line 1011 ""
2735 } else {
2736 #line 1012 ""
2737 wbrest = FALSE_;
2738 #line 1013 ""
2739 if (alldone) {
2740 #line 1013 ""
2741 goto L12;
2742 #line 1013 ""
2743 }
2744 #line 1014 ""
2745 i__3 = nwbrs;
2746 #line 1014 ""
2747 for (iw = 1; iw <= i__3; ++iw) {
2748 #line 1015 ""
2749 wbrest = wbrest || s_cmp(sym, wbrsym + (iw - 1) * 3, lsym,
2750 lwbrs) == 0;
2751 #line 1016 ""
2752 /* L5: */
2753 #line 1016 ""
2754 }
2755 #line 1017 ""
2756 wbrest = wbrest || s_cmp(sym, "r", lsym, (ftnlen)1) == 0 &&
2757 lwbrs == 2 || s_cmp(sym, "rd", lsym, (ftnlen)2) == 0
2758 && lwbrs == 3 || s_cmp(sym, "rp", lsym, (ftnlen)2) ==
2759 0 || s_cmp(sym, "r", lsym, (ftnlen)1) == 0 && rpfirst;
2760 #line 1021 ""
2761 L12:
2762 #line 1021 ""
2763 if (wbrest) {
2764 #line 1022 ""
2765 ipe = ipenew;
2766 #line 1023 ""
2767 ++nmbr;
2768 #line 1024 ""
2769 goto L4;
2770 #line 1025 ""
2771 } else {
2772
2773 /* AHA! Failed prev. test, so last symbol was *not* mbr. */
2774 /* It must be saved, and its starting position is ipenew-lsym+1 */
2775
2776 #line 1030 ""
2777 if (nmbr > 1) {
2778
2779 /* Write stuff up to start of mbr */
2780
2781 #line 1034 ""
2782 if (ip1 > 1) {
2783 #line 1034 ""
2784 s_wsfe(&io___153);
2785 #line 1034 ""
2786 do_fio(&c__1, line, ip1 - 1);
2787 #line 1034 ""
2788 e_wsfe();
2789 #line 1034 ""
2790 }
2791
2792 /* Insert mbr symbol. Always end with a slash just in case next sym must be */
2793 /* at start of block. May think this causes undefined octaves, but */
2794 /* probably not since it's a single voice. */
2795
2796 #line 1040 ""
2797 r__1 = nmbr + .01f;
2798 #line 1040 ""
2799 ndig = (integer) r_lg10(&r__1) + 1;
2800 #line 1041 ""
2801 s_wsle(&io___155);
2802 #line 1041 ""
2803 do_lio(&c__9, &c__1, "Inserting rm, iv,nmbr:", (
2804 ftnlen)22);
2805 #line 1041 ""
2806 do_lio(&c__3, &c__1, (char *)&(*iv), (ftnlen)sizeof(
2807 integer));
2808 #line 1041 ""
2809 do_lio(&c__3, &c__1, (char *)&nmbr, (ftnlen)sizeof(
2810 integer));
2811 #line 1041 ""
2812 e_wsle();
2813 #line 1042 ""
2814 ci__1.cierr = 0;
2815 #line 1042 ""
2816 ci__1.ciunit = 40;
2817 /* Writing concatenation */
2818 #line 1042 ""
2819 i__2[0] = 5, a__2[0] = "(a2,i";
2820 #line 1042 ""
2821 *(unsigned char *)&ch__1[0] = ndig + 48;
2822 #line 1042 ""
2823 i__2[1] = 1, a__2[1] = ch__1;
2824 #line 1042 ""
2825 i__2[2] = 4, a__2[2] = ",a2)";
2826 #line 1042 ""
2827 ci__1.cifmt = (s_cat(ch__6, a__2, i__2, &c__3, (
2828 ftnlen)10), ch__6);
2829 #line 1042 ""
2830 s_wsfe(&ci__1);
2831 #line 1042 ""
2832 do_fio(&c__1, "rm", (ftnlen)2);
2833 #line 1042 ""
2834 do_fio(&c__1, (char *)&nmbr, (ftnlen)sizeof(integer));
2835 #line 1042 ""
2836 do_fio(&c__1, " /", (ftnlen)2);
2837 #line 1042 ""
2838 e_wsfe();
2839 #line 1043 ""
2840 if (alldone) {
2841 #line 1043 ""
2842 goto L999;
2843 #line 1043 ""
2844 }
2845 #line 1044 ""
2846 ipc = ipenew - lsym + 1;
2847 #line 1045 ""
2848 s_copy(line, line + ((iline - 1 << 7) + (ipc - 1)), (
2849 ftnlen)128, len - (ipc - 1));
2850 #line 1046 ""
2851 } else {
2852
2853 /* Write old stuff up to end of original lonesome wbr, save the rest. */
2854 /* 4 cases: (wbr /) , (wbr line-end) , (wbr followed by other non-/ symbols) , */
2855 /* alldone. */
2856 /* In 1st 2 will have gotten some other lines, so write all up to one b4 last */
2857 /* non-comment line; then revert to normal mode on that. In 3rd case must */
2858 /* split line. */
2859
2860 #line 1055 ""
2861 if (alldone) {
2862 #line 1056 ""
2863 s_wsfe(&io___157);
2864 #line 1056 ""
2865 do_fio(&c__1, line, len);
2866 #line 1056 ""
2867 e_wsfe();
2868 #line 1057 ""
2869 goto L999;
2870 #line 1058 ""
2871 } else if (iline > 1) {
2872 #line 1059 ""
2873 i__3 = iline - 1;
2874 #line 1059 ""
2875 for (il = 1; il <= i__3; ++il) {
2876 #line 1060 ""
2877 len = lenstr_(line + (il - 1 << 7), &c__128, (
2878 ftnlen)128);
2879 #line 1061 ""
2880 s_wsfe(&io___159);
2881 #line 1061 ""
2882 do_fio(&c__1, line + (il - 1 << 7), len);
2883 #line 1061 ""
2884 e_wsfe();
2885 #line 1062 ""
2886 /* L9: */
2887 #line 1062 ""
2888 }
2889 #line 1063 ""
2890 s_copy(line, line + (iline - 1 << 7), (ftnlen)128,
2891 (ftnlen)128);
2892 #line 1064 ""
2893 } else {
2894
2895 /* Since iline = 1 the wbr is not the last sym, so must split */
2896
2897 #line 1068 ""
2898 s_wsfe(&io___160);
2899 #line 1068 ""
2900 do_fio(&c__1, line, ip1 + lwbrsx - 1);
2901 #line 1068 ""
2902 e_wsfe();
2903 #line 1069 ""
2904 i__3 = ip1 + lwbrsx;
2905 #line 1069 ""
2906 s_copy(line, line + i__3, (ftnlen)128, len - i__3)
2907 ;
2908 #line 1070 ""
2909 }
2910 #line 1071 ""
2911 }
2912
2913 /* Exit multibar mode */
2914
2915 #line 1075 ""
2916 goto L7;
2917 #line 1076 ""
2918 }
2919 #line 1077 ""
2920 }
2921 #line 1078 ""
2922 }
2923 #line 1079 ""
2924 L2:
2925 #line 1080 ""
2926 if (len > 0) {
2927 #line 1081 ""
2928 s_wsfe(&io___161);
2929 #line 1081 ""
2930 do_fio(&c__1, line, len);
2931 #line 1081 ""
2932 e_wsfe();
2933 #line 1082 ""
2934 } else {
2935 #line 1083 ""
2936 s_wsfe(&io___162);
2937 #line 1083 ""
2938 do_fio(&c__1, " ", (ftnlen)1);
2939 #line 1083 ""
2940 e_wsfe();
2941 #line 1084 ""
2942 }
2943 #line 1085 ""
2944 /* L1: */
2945 #line 1085 ""
2946 }
2947 #line 1086 ""
2948 L999:
2949 #line 1087 ""
2950 cl__1.cerr = 0;
2951 #line 1087 ""
2952 cl__1.cunit = *iv + 10;
2953 #line 1087 ""
2954 cl__1.csta = 0;
2955 #line 1087 ""
2956 f_clos(&cl__1);
2957 #line 1088 ""
2958 cl__1.cerr = 0;
2959 #line 1088 ""
2960 cl__1.cunit = 40;
2961 #line 1088 ""
2962 cl__1.csta = 0;
2963 #line 1088 ""
2964 f_clos(&cl__1);
2965 #line 1089 ""
2966 return 0;
2967 } /* mbrests_ */
2968
2969 integer ifnodur_(integer *idur, char *dotq, ftnlen dotq_len)
2970 {
2971 /* System generated locals */
2972 integer ret_val;
2973
2974 /* Builtin functions */
2975 integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen),
2976 e_wsle(void);
2977 /* Subroutine */ int s_stop(char *, ftnlen);
2978
2979 /* Fortran I/O blocks */
2980 static cilist io___163 = { 0, 6, 0, 0, 0 };
2981
2982
2983 #line 1093 ""
2984 if (*idur == 6) {
2985 #line 1094 ""
2986 ret_val = 1;
2987 #line 1095 ""
2988 } else if (*idur == 3) {
2989 #line 1096 ""
2990 ret_val = 2;
2991 #line 1097 ""
2992 } else if (*idur == 1 || *idur == 16) {
2993 #line 1098 ""
2994 ret_val = 4;
2995 #line 1099 ""
2996 } else if (*idur == 8) {
2997 #line 1100 ""
2998 ret_val = 8;
2999 #line 1101 ""
3000 } else if (*idur == 4) {
3001 #line 1102 ""
3002 ret_val = 16;
3003 #line 1103 ""
3004 } else if (*idur == 2) {
3005 #line 1104 ""
3006 ret_val = 32;
3007 #line 1105 ""
3008 } else if (*idur == 0) {
3009 #line 1106 ""
3010 ret_val = 64;
3011 #line 1107 ""
3012 } else {
3013 #line 1108 ""
3014 s_wsle(&io___163);
3015 #line 1108 ""
3016 do_lio(&c__9, &c__1, "You entered an invalid note-length value", (
3017 ftnlen)40);
3018 #line 1108 ""
3019 e_wsle();
3020 #line 1109 ""
3021 s_stop("", (ftnlen)0);
3022 #line 1110 ""
3023 }
3024 #line 1111 ""
3025 if (*(unsigned char *)dotq == 'd') {
3026 #line 1111 ""
3027 ret_val = ret_val * 3 / 2;
3028 #line 1111 ""
3029 }
3030 #line 1112 ""
3031 return ret_val;
3032 } /* ifnodur_ */
3033
3034 /* Subroutine */ int fwbrsym_(integer *lenbar, integer *nwbrs, char *wbrsym,
3035 integer *lwbrs, ftnlen wbrsym_len)
3036 {
3037 /* Builtin functions */
3038 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
3039 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
3040
3041 /* Fortran I/O blocks */
3042 static cilist io___164 = { 0, 6, 0, "(33H Any whole-bar rests of duratio"
3043 "n ,i3, 26H/64 will not be recognized)", 0 };
3044
3045
3046 #line 1116 ""
3047 /* Parameter adjustments */
3048 #line 1116 ""
3049 wbrsym -= 3;
3050 #line 1116 ""
3051
3052 #line 1116 ""
3053 /* Function Body */
3054 #line 1116 ""
3055 *nwbrs = 1;
3056 #line 1117 ""
3057 *lwbrs = 2;
3058 #line 1118 ""
3059 if (*lenbar == 16) {
3060 #line 1119 ""
3061 s_copy(wbrsym + 3, "r4", (ftnlen)3, (ftnlen)2);
3062 #line 1120 ""
3063 } else if (*lenbar == 32) {
3064 #line 1121 ""
3065 s_copy(wbrsym + 3, "r2", (ftnlen)3, (ftnlen)2);
3066 #line 1122 ""
3067 } else if (*lenbar == 64) {
3068 #line 1123 ""
3069 s_copy(wbrsym + 3, "r0", (ftnlen)3, (ftnlen)2);
3070 #line 1124 ""
3071 } else if (*lenbar == 8) {
3072 #line 1125 ""
3073 s_copy(wbrsym + 3, "r8", (ftnlen)3, (ftnlen)2);
3074 #line 1126 ""
3075 } else if (*lenbar == 128) {
3076 #line 1127 ""
3077 s_copy(wbrsym + 3, "r9", (ftnlen)3, (ftnlen)2);
3078 #line 1128 ""
3079 } else {
3080 #line 1129 ""
3081 *nwbrs = 2;
3082 #line 1130 ""
3083 *lwbrs = 3;
3084 #line 1131 ""
3085 if (*lenbar == 24) {
3086 #line 1132 ""
3087 s_copy(wbrsym + 3, "rd4", (ftnlen)3, (ftnlen)3);
3088 #line 1133 ""
3089 s_copy(wbrsym + 6, "r4d", (ftnlen)3, (ftnlen)3);
3090 #line 1134 ""
3091 } else if (*lenbar == 48) {
3092 #line 1135 ""
3093 s_copy(wbrsym + 3, "rd2", (ftnlen)3, (ftnlen)3);
3094 #line 1136 ""
3095 s_copy(wbrsym + 6, "r2d", (ftnlen)3, (ftnlen)3);
3096 #line 1137 ""
3097 } else if (*lenbar == 96) {
3098 #line 1138 ""
3099 s_copy(wbrsym + 3, "rd0", (ftnlen)3, (ftnlen)3);
3100 #line 1139 ""
3101 s_copy(wbrsym + 6, "r0d", (ftnlen)3, (ftnlen)3);
3102 #line 1140 ""
3103 } else {
3104 #line 1141 ""
3105 s_wsfe(&io___164);
3106 #line 1141 ""
3107 do_fio(&c__1, (char *)&(*lenbar), (ftnlen)sizeof(integer));
3108 #line 1141 ""
3109 e_wsfe();
3110 #line 1143 ""
3111 }
3112 #line 1144 ""
3113 }
3114 #line 1145 ""
3115 return 0;
3116 } /* fwbrsym_ */
3117
3118 /* Subroutine */ int nextsym_(char *line, integer *len, integer *ipeold,
3119 integer *ipenew, char *sym, integer *lsym, ftnlen line_len, ftnlen
3120 sym_len)
3121 {
3122 /* System generated locals */
3123 integer i__1, i__2;
3124
3125 /* Builtin functions */
3126 integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen),
3127 e_wsle(void);
3128 /* Subroutine */ int s_stop(char *, ftnlen), s_copy(char *, char *,
3129 ftnlen, ftnlen);
3130
3131 /* Local variables */
3132 static integer ip, iip;
3133
3134 /* Fortran I/O blocks */
3135 static cilist io___165 = { 0, 6, 0, 0, 0 };
3136 static cilist io___166 = { 0, 6, 0, 0, 0 };
3137 static cilist io___169 = { 0, 6, 0, 0, 0 };
3138
3139
3140
3141 /* Know its the last symbol if on return ipenew = len!. So should never */
3142 /* be called when ipstart=len. */
3143
3144 #line 1154 ""
3145 if (*ipeold >= *len) {
3146 #line 1155 ""
3147 s_wsle(&io___165);
3148 #line 1155 ""
3149 do_lio(&c__9, &c__1, "Called nextsym with ipstart>=len ", (ftnlen)33);
3150 #line 1155 ""
3151 e_wsle();
3152 #line 1156 ""
3153 s_wsle(&io___166);
3154 #line 1156 ""
3155 do_lio(&c__9, &c__1, "Send files to Dr. Don at [email protected]", (
3156 ftnlen)44);
3157 #line 1156 ""
3158 e_wsle();
3159 #line 1157 ""
3160 s_stop("", (ftnlen)0);
3161 #line 1158 ""
3162 }
3163 #line 1159 ""
3164 i__1 = *len;
3165 #line 1159 ""
3166 for (ip = *ipeold + 1; ip <= i__1; ++ip) {
3167 #line 1160 ""
3168 if (*(unsigned char *)&line[ip - 1] != ' ') {
3169
3170 /* symbol starts here (ip). We're committed to exit the loop. */
3171
3172 #line 1164 ""
3173 if (ip < *len) {
3174 #line 1165 ""
3175 i__2 = *len;
3176 #line 1165 ""
3177 for (iip = ip + 1; iip <= i__2; ++iip) {
3178 #line 1166 ""
3179 if (*(unsigned char *)&line[iip - 1] != ' ') {
3180 #line 1166 ""
3181 goto L2;
3182 #line 1166 ""
3183 }
3184
3185 /* iip is the space after the symbol */
3186
3187 #line 1170 ""
3188 *ipenew = iip - 1;
3189 #line 1171 ""
3190 *lsym = *ipenew - ip + 1;
3191 #line 1172 ""
3192 s_copy(sym, line + (ip - 1), (ftnlen)80, *ipenew - (ip -
3193 1));
3194 #line 1173 ""
3195 return 0;
3196 #line 1174 ""
3197 L2:
3198 #line 1174 ""
3199 ;
3200 #line 1174 ""
3201 }
3202
3203 /* Have len>=2 and ends on len */
3204
3205 #line 1178 ""
3206 *ipenew = *len;
3207 #line 1179 ""
3208 *lsym = *ipenew - ip + 1;
3209 #line 1180 ""
3210 s_copy(sym, line + (ip - 1), (ftnlen)80, *ipenew - (ip - 1));
3211 #line 1181 ""
3212 return 0;
3213 #line 1182 ""
3214 } else {
3215
3216 /* ip = len */
3217
3218 #line 1186 ""
3219 *ipenew = *len;
3220 #line 1187 ""
3221 *lsym = 1;
3222 #line 1188 ""
3223 s_copy(sym, line + (ip - 1), (ftnlen)80, (ftnlen)1);
3224 #line 1189 ""
3225 return 0;
3226 #line 1190 ""
3227 }
3228 #line 1191 ""
3229 }
3230 #line 1192 ""
3231 /* L1: */
3232 #line 1192 ""
3233 }
3234 #line 1193 ""
3235 s_wsle(&io___169);
3236 #line 1193 ""
3237 do_lio(&c__9, &c__1, "Error #3. Send files to Dr. Don at dsimons@logico"\
3238 "n.com", (ftnlen)55);
3239 #line 1193 ""
3240 e_wsle();
3241 #line 1194 ""
3242 return 0;
3243 } /* nextsym_ */
3244
3245 integer ntindex_(char *line, char *s2q, ftnlen line_len, ftnlen s2q_len)
3246 {
3247 /* System generated locals */
3248 address a__1[2];
3249 integer ret_val, i__1, i__2[2], i__3;
3250
3251 /* Builtin functions */
3252 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
3253 integer i_indx(char *, char *, ftnlen, ftnlen), s_wsle(cilist *), do_lio(
3254 integer *, integer *, char *, ftnlen), e_wsle(void);
3255 /* Subroutine */ int s_stop(char *, ftnlen), s_cat(char *, char **,
3256 integer *, integer *, ftnlen);
3257 integer s_cmp(char *, char *, ftnlen, ftnlen);
3258
3259 /* Local variables */
3260 static integer ic, len, ndxs2;
3261 static char tline[128];
3262 static integer ndxbs;
3263 static logical intex;
3264 static integer ndxdq1, ndxdq2;
3265 extern integer lenstr_(char *, integer *, ftnlen);
3266
3267 /* Fortran I/O blocks */
3268 static cilist io___175 = { 0, 6, 0, 0, 0 };
3269
3270
3271
3272 /* Returns index(line,s2q) if NOT in TeX string, 0 otherwise */
3273
3274
3275 /* print*,'Starting ntindex. s2q:',s2q,', line(1:79) is below' */
3276 /* print*,line(1:79) */
3277
3278
3279 /* Use a temporary string to store the input and test, so can zap D"..." */
3280
3281 #line 1209 ""
3282 s_copy(tline, line, (ftnlen)128, (ftnlen)128);
3283 #line 1210 ""
3284 ndxs2 = i_indx(tline, s2q, (ftnlen)128, s2q_len);
3285
3286 /* Return point below for rechecks after zapping D" " */
3287
3288 #line 1214 ""
3289 L2:
3290 #line 1215 ""
3291 ndxbs = i_indx(tline, "\\", (ftnlen)128, (ftnlen)1);
3292 #line 1216 ""
3293 if (ndxbs > 0) {
3294
3295 /* Special check in case \ is inside D"..." */
3296
3297 #line 1220 ""
3298 ndxdq1 = i_indx(tline, "D\"", (ftnlen)128, (ftnlen)2);
3299
3300 /* If the following test fails, flow out of if block; else loop up to 2. */
3301
3302 #line 1224 ""
3303 if (ndxdq1 > 0) {
3304
3305 /* Find end of D"..." */
3306
3307 #line 1228 ""
3308 i__1 = ndxdq1 + 1;
3309 #line 1228 ""
3310 ndxdq2 = ndxdq1 + 1 + i_indx(tline + i__1, "\"", 128 - i__1, (
3311 ftnlen)1);
3312 #line 1229 ""
3313 if (ndxdq2 == ndxdq1 + 1) {
3314 #line 1230 ""
3315 s_wsle(&io___175);
3316 #line 1230 ""
3317 do_lio(&c__9, &c__1, "Something is really wierd here", (
3318 ftnlen)30);
3319 #line 1230 ""
3320 e_wsle();
3321 #line 1231 ""
3322 s_stop("", (ftnlen)0);
3323 #line 1232 ""
3324 }
3325 #line 1233 ""
3326 s_copy(tline, tline, (ftnlen)128, ndxdq1 - 1);
3327 #line 1234 ""
3328 i__1 = ndxdq2;
3329 #line 1234 ""
3330 for (ic = ndxdq1; ic <= i__1; ++ic) {
3331 /* Writing concatenation */
3332 #line 1235 ""
3333 i__2[0] = ic - 1, a__1[0] = tline;
3334 #line 1235 ""
3335 i__2[1] = 1, a__1[1] = " ";
3336 #line 1235 ""
3337 s_cat(tline, a__1, i__2, &c__2, (ftnlen)128);
3338 #line 1236 ""
3339 /* L3: */
3340 #line 1236 ""
3341 }
3342 #line 1237 ""
3343 i__1 = ndxdq2;
3344 /* Writing concatenation */
3345 #line 1237 ""
3346 i__2[0] = ndxdq2, a__1[0] = tline;
3347 #line 1237 ""
3348 i__2[1] = 128 - i__1, a__1[1] = line + i__1;
3349 #line 1237 ""
3350 s_cat(tline, a__1, i__2, &c__2, (ftnlen)128);
3351 #line 1238 ""
3352 goto L2;
3353 #line 1239 ""
3354 }
3355 #line 1240 ""
3356 }
3357 #line 1241 ""
3358 if (ndxbs == 0 || ndxs2 < ndxbs) {
3359 #line 1242 ""
3360 ret_val = ndxs2;
3361 /* print*,'No bs, or char is left of 1st bs, ntindex:',ntindex */
3362 #line 1244 ""
3363 } else {
3364
3365 /* There are both bs and s2q, and bs is to the left of sq2. So check bs's to */
3366 /* right of first: End is '\ ', start is ' \' */
3367
3368 #line 1249 ""
3369 len = lenstr_(tline, &c__128, (ftnlen)128);
3370 #line 1250 ""
3371 intex = TRUE_;
3372 /* print*,'intex+>',intex */
3373 #line 1252 ""
3374 i__1 = len;
3375 #line 1252 ""
3376 for (ic = ndxbs + 1; ic <= i__1; ++ic) {
3377 #line 1253 ""
3378 if (ic == ndxs2) {
3379 #line 1254 ""
3380 if (intex) {
3381 #line 1255 ""
3382 ret_val = 0;
3383 #line 1256 ""
3384 i__3 = ic;
3385 #line 1256 ""
3386 ndxs2 = i_indx(tline + i__3, s2q, len - i__3, s2q_len) +
3387 ic;
3388 /* print*,'ndxs2 =>',ndxs2 */
3389 #line 1258 ""
3390 } else {
3391 #line 1259 ""
3392 ret_val = ndxs2;
3393 #line 1260 ""
3394 return ret_val;
3395 #line 1261 ""
3396 }
3397 /* print*,'Internal exit, intex, ntindex:',intex,ntindex */
3398 #line 1263 ""
3399 } else /* if(complicated condition) */ {
3400 #line 1263 ""
3401 i__3 = ic;
3402 #line 1263 ""
3403 if (intex && s_cmp(tline + i__3, "\\ ", ic + 2 - i__3, (
3404 ftnlen)2) == 0) {
3405 #line 1264 ""
3406 intex = FALSE_;
3407 /* print*,'intex+>',intex */
3408 #line 1266 ""
3409 } else /* if(complicated condition) */ {
3410 #line 1266 ""
3411 i__3 = ic;
3412 #line 1266 ""
3413 if (! intex && s_cmp(tline + i__3, " \\", ic + 2 - i__3, (
3414 ftnlen)2) == 0) {
3415 #line 1268 ""
3416 intex = TRUE_;
3417 /* print*,'intex+>',intex */
3418 #line 1270 ""
3419 }
3420 #line 1270 ""
3421 }
3422 #line 1270 ""
3423 }
3424 #line 1271 ""
3425 /* L1: */
3426 #line 1271 ""
3427 }
3428 /* print*,'Out end of loop 1' */
3429 #line 1273 ""
3430 }
3431 /* print*,'Exiting ntindex at the end???' */
3432 #line 1275 ""
3433 return ret_val;
3434 } /* ntindex_ */
3435
3436 /* Subroutine */ int getchar_(char *line, integer *iccount, char *charq,
3437 ftnlen line_len, ftnlen charq_len)
3438 {
3439 /* Builtin functions */
3440 integer s_rsfe(cilist *), do_fio(integer *, char *, ftnlen), e_rsfe(void);
3441
3442 /* Fortran I/O blocks */
3443 static cilist io___179 = { 0, 10, 0, "(a)", 0 };
3444
3445
3446
3447 /* Gets the next character out of line*128. If pointer iccount=128 on entry, */
3448 /* then reads in a new line. Resets iccount to position of the new character. */
3449
3450 #line 1284 ""
3451 if (*iccount == 128) {
3452 #line 1285 ""
3453 s_rsfe(&io___179);
3454 #line 1285 ""
3455 do_fio(&c__1, line, (ftnlen)128);
3456 #line 1285 ""
3457 e_rsfe();
3458 #line 1286 ""
3459 *iccount = 0;
3460 #line 1287 ""
3461 }
3462 #line 1288 ""
3463 ++(*iccount);
3464 #line 1289 ""
3465 *(unsigned char *)charq = *(unsigned char *)&line[*iccount - 1];
3466 #line 1290 ""
3467 return 0;
3468 } /* getchar_ */
3469
3470 doublereal readin_(char *line, integer *iccount, integer *iread, ftnlen
3471 line_len)
3472 {
3473 /* System generated locals */
3474 address a__1[3];
3475 integer i__1[3], i__2;
3476 real ret_val;
3477 char ch__1[27], ch__2[6], ch__3[1];
3478 icilist ici__1;
3479
3480 /* Builtin functions */
3481 integer s_rsfe(cilist *), do_fio(integer *, char *, ftnlen), e_rsfe(void),
3482 i_indx(char *, char *, ftnlen, ftnlen), s_wsle(cilist *);
3483 /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen);
3484 integer do_lio(integer *, integer *, char *, ftnlen), e_wsle(void);
3485 /* Subroutine */ int s_stop(char *, ftnlen);
3486 integer s_rsfi(icilist *), e_rsfi(void);
3487
3488 /* Local variables */
3489 extern /* Subroutine */ int allparts_(char *, integer *, ftnlen);
3490 static integer i1, i2, icf;
3491 static char durq[1];
3492 static logical goto999;
3493 extern /* Subroutine */ int chkcom_(char *, logical *, ftnlen), getchar_(
3494 char *, integer *, char *, ftnlen, ftnlen);
3495
3496 /* Fortran I/O blocks */
3497 static cilist io___180 = { 0, 10, 0, "(a)", 0 };
3498 static cilist io___185 = { 0, 6, 0, 0, 0 };
3499 static cilist io___187 = { 0, 6, 0, 0, 0 };
3500
3501
3502
3503 /* Reads a piece of setup data from line, gets a new line from */
3504 /* file 10 (jobname.pmx) if needed, Transfers comment lines into all parts. */
3505
3506 /* iread controls copying of values into scratch files for parts, but only */
3507 /* if not replacing. */
3508
3509 /* iread input value written */
3510 /* -1 nvi nothing (only used when noinst<0 initially) */
3511 /* 0 various value read */
3512 /* 1 nv -1 , replace later with nvi(i) */
3513 /* 2 noinst 1 */
3514 /* 3 np -2 , replace later with (nsyst-1)/12+1 */
3515 /* 4 musicsize 20 */
3516 /* 5 fracondent 0.05 */
3517
3518 #line 1315 ""
3519 L4:
3520 #line 1315 ""
3521 if (*iccount == 128) {
3522 #line 1316 ""
3523 s_rsfe(&io___180);
3524 #line 1316 ""
3525 do_fio(&c__1, line, (ftnlen)128);
3526 #line 1316 ""
3527 e_rsfe();
3528 #line 1317 ""
3529 if (all_1.replacing) {
3530 #line 1317 ""
3531 all_1.replacing = FALSE_;
3532 #line 1317 ""
3533 }
3534 #line 1318 ""
3535 chkcom_(line, &goto999, (ftnlen)128);
3536 #line 1319 ""
3537 *iccount = 0;
3538 #line 1320 ""
3539 }
3540 #line 1321 ""
3541 ++(*iccount);
3542
3543 /* Find next non-blank or end of line */
3544
3545 #line 1325 ""
3546 for (*iccount = *iccount; *iccount <= 127; ++(*iccount)) {
3547 #line 1326 ""
3548 if (*(unsigned char *)&line[*iccount - 1] != ' ') {
3549 #line 1326 ""
3550 goto L3;
3551 #line 1326 ""
3552 }
3553 #line 1327 ""
3554 /* L2: */
3555 #line 1327 ""
3556 }
3557
3558 /* If here, need to get a new line */
3559
3560 #line 1331 ""
3561 *iccount = 128;
3562 #line 1332 ""
3563 goto L4;
3564 #line 1333 ""
3565 L3:
3566
3567 /* iccount now points to start of number to read */
3568
3569 #line 1337 ""
3570 i1 = *iccount;
3571 #line 1338 ""
3572 L5:
3573 #line 1338 ""
3574 getchar_(line, iccount, durq, (ftnlen)128, (ftnlen)1);
3575
3576 /* Remember that getchar first increments iccount, *then* reads a character. */
3577
3578 #line 1342 ""
3579 if (i_indx("0123456789.-", durq, (ftnlen)12, (ftnlen)1) > 0) {
3580 #line 1342 ""
3581 goto L5;
3582 #line 1342 ""
3583 }
3584 #line 1343 ""
3585 i2 = *iccount - 1;
3586 #line 1344 ""
3587 if (i2 < i1) {
3588 #line 1345 ""
3589 s_wsle(&io___185);
3590 /* Writing concatenation */
3591 #line 1345 ""
3592 i__1[0] = 7, a__1[0] = "Found \"";
3593 #line 1345 ""
3594 i__1[1] = 1, a__1[1] = durq;
3595 #line 1345 ""
3596 i__1[2] = 19, a__1[2] = "\" instead of number";
3597 #line 1345 ""
3598 s_cat(ch__1, a__1, i__1, &c__3, (ftnlen)27);
3599 #line 1345 ""
3600 do_lio(&c__9, &c__1, ch__1, (ftnlen)27);
3601 #line 1345 ""
3602 e_wsle();
3603 #line 1346 ""
3604 s_stop("1", (ftnlen)1);
3605 #line 1347 ""
3606 }
3607 #line 1348 ""
3608 icf = i2 - i1 + 49;
3609 #line 1349 ""
3610 ici__1.icierr = 0;
3611 #line 1349 ""
3612 ici__1.iciend = 0;
3613 #line 1349 ""
3614 ici__1.icirnum = 1;
3615 #line 1349 ""
3616 ici__1.icirlen = i2 - (i1 - 1);
3617 #line 1349 ""
3618 ici__1.iciunit = line + (i1 - 1);
3619 /* Writing concatenation */
3620 #line 1349 ""
3621 i__1[0] = 2, a__1[0] = "(f";
3622 #line 1349 ""
3623 *(unsigned char *)&ch__3[0] = icf;
3624 #line 1349 ""
3625 i__1[1] = 1, a__1[1] = ch__3;
3626 #line 1349 ""
3627 i__1[2] = 3, a__1[2] = ".0)";
3628 #line 1349 ""
3629 ici__1.icifmt = (s_cat(ch__2, a__1, i__1, &c__3, (ftnlen)6), ch__2);
3630 #line 1349 ""
3631 s_rsfi(&ici__1);
3632 #line 1349 ""
3633 do_fio(&c__1, (char *)&ret_val, (ftnlen)sizeof(real));
3634 #line 1349 ""
3635 e_rsfi();
3636 #line 1350 ""
3637 if (! all_1.replacing) {
3638 #line 1351 ""
3639 if (*iread == 0) {
3640 #line 1352 ""
3641 i__2 = i2 - i1 + 1;
3642 #line 1352 ""
3643 allparts_(line + (i1 - 1), &i__2, i2 - (i1 - 1));
3644 #line 1353 ""
3645 } else if (*iread == 1) {
3646 #line 1354 ""
3647 allparts_("-999", &c__4, (ftnlen)4);
3648 #line 1355 ""
3649 } else if (*iread == 2) {
3650 #line 1356 ""
3651 allparts_("1", &c__1, (ftnlen)1);
3652 #line 1357 ""
3653 } else if (*iread == 3) {
3654 #line 1358 ""
3655 allparts_("-998", &c__4, (ftnlen)4);
3656 #line 1359 ""
3657 } else if (*iread == 4) {
3658 #line 1360 ""
3659 allparts_("20", &c__2, (ftnlen)2);
3660 #line 1361 ""
3661 } else if (*iread == 5) {
3662 #line 1362 ""
3663 allparts_(".05", &c__3, (ftnlen)3);
3664 #line 1363 ""
3665 } else if (*iread != -1) {
3666 #line 1364 ""
3667 s_wsle(&io___187);
3668 #line 1364 ""
3669 do_lio(&c__9, &c__1, "Error with iread in readin", (ftnlen)26);
3670 #line 1364 ""
3671 e_wsle();
3672 #line 1365 ""
3673 s_stop("", (ftnlen)0);
3674 #line 1366 ""
3675 }
3676 #line 1367 ""
3677 }
3678 #line 1368 ""
3679 return ret_val;
3680 } /* readin_ */
3681
3682 /* Subroutine */ int chkcom_(char *line, logical *goto999, ftnlen line_len)
3683 {
3684 /* System generated locals */
3685 integer i__1, i__2;
3686
3687 /* Builtin functions */
3688 integer s_rsfe(cilist *), do_fio(integer *, char *, ftnlen), e_rsfe(void),
3689 i_indx(char *, char *, ftnlen, ftnlen), s_cmp(char *, char *,
3690 ftnlen, ftnlen), s_wsfe(cilist *), e_wsfe(void);
3691
3692 /* Local variables */
3693 static logical clefpend;
3694 extern /* Subroutine */ int allparts_(char *, integer *, ftnlen);
3695 static integer j, k, ivq, idxb, idxl, idxm, idxn;
3696 extern /* Subroutine */ int zapbl_(char *, integer *, ftnlen);
3697 static integer iposc0;
3698 extern integer lenstr_(char *, integer *, ftnlen);
3699 static integer lenline;
3700
3701 /* Fortran I/O blocks */
3702 static cilist io___188 = { 0, 10, 0, "(a)", 0 };
3703 static cilist io___197 = { 0, 10, 0, "(a)", 0 };
3704 static cilist io___200 = { 0, 0, 0, "(a)", 0 };
3705 static cilist io___201 = { 0, 0, 0, "(a)", 0 };
3706 static cilist io___202 = { 0, 10, 1, "(a)", 0 };
3707
3708
3709
3710 /* Assume that line has just been read. No need to change iccount since we only */
3711 /* process full lines. */
3712
3713 #line 1380 ""
3714 *goto999 = FALSE_;
3715 #line 1381 ""
3716 L1:
3717 #line 1381 ""
3718 if (*(unsigned char *)line != '%') {
3719 #line 1381 ""
3720 return 0;
3721 #line 1381 ""
3722 }
3723
3724 /* If here, line has some sort of comment */
3725
3726 #line 1385 ""
3727 if (*(unsigned char *)&line[1] == '%') {
3728 #line 1386 ""
3729 if (! all_1.insetup) {
3730
3731 /* Suck up a line, then flow out of "if" block to get another and loop */
3732
3733 #line 1390 ""
3734 s_rsfe(&io___188);
3735 #line 1390 ""
3736 do_fio(&c__1, line, (ftnlen)128);
3737 #line 1390 ""
3738 e_rsfe();
3739 /* ++VV */
3740
3741 /* UNLESS (a) it has a score-only "M" and changes # of inst's. */
3742
3743 #line 1396 ""
3744 if (i_indx(line, "M", (ftnlen)128, (ftnlen)1) > 0) {
3745 #line 1397 ""
3746 idxl = i_indx(line, "L", (ftnlen)128, (ftnlen)1);
3747 #line 1398 ""
3748 idxm = i_indx(line, "M", (ftnlen)128, (ftnlen)1);
3749 #line 1399 ""
3750 idxn = i_indx(line, "n", (ftnlen)128, (ftnlen)1);
3751 #line 1400 ""
3752 idxb = i_indx(line, " ", (ftnlen)128, (ftnlen)1);
3753 #line 1401 ""
3754 if (idxl < idxm && idxm < idxn && (idxb == 0 || idxn < idxb))
3755 {
3756 #line 1403 ""
3757 i__1 = idxn;
3758 #line 1403 ""
3759 all_1.noinow = *(unsigned char *)&line[i__1] - 48;
3760 #line 1404 ""
3761 clefpend = TRUE_;
3762
3763 /* Next noinow digits are original inst. #'s of new inst. set. Next noinow */
3764 /* char's after that are clefs */
3765
3766 #line 1409 ""
3767 all_1.nvnow = 0;
3768 #line 1410 ""
3769 i__1 = all_1.noinow;
3770 #line 1410 ""
3771 for (j = 1; j <= i__1; ++j) {
3772 #line 1411 ""
3773 i__2 = idxn + 1 + j - 1;
3774 #line 1411 ""
3775 all_1.iorig[j - 1] = *(unsigned char *)&line[i__2] -
3776 48;
3777 #line 1412 ""
3778 iposc0 = idxn + 1 + all_1.noinow;
3779 #line 1413 ""
3780 i__2 = all_1.nvi[all_1.iorig[j - 1] - 1];
3781 #line 1413 ""
3782 for (k = 1; k <= i__2; ++k) {
3783 #line 1414 ""
3784 ++all_1.nvnow;
3785 /* clefq(nvnow) = line(iposc0+nvnow:iposc0+nvnow) */
3786 #line 1416 ""
3787 all_1.instnum[all_1.nvnow - 1] = j;
3788 #line 1417 ""
3789 all_1.botv[all_1.nvnow - 1] = k == 1 && j != 1;
3790 #line 1418 ""
3791 /* L25: */
3792 #line 1418 ""
3793 }
3794 #line 1419 ""
3795 /* L24: */
3796 #line 1419 ""
3797 }
3798 #line 1420 ""
3799 }
3800 #line 1421 ""
3801 }
3802
3803 /* or if it's "h" or "l", need to suck up one more line */
3804
3805 #line 1425 ""
3806 if (*(unsigned char *)line == 'h' && i_indx("+- ", line + 1, (
3807 ftnlen)3, (ftnlen)1) > 0 || *(unsigned char *)line == 'T'
3808 || s_cmp(line, "l ", (ftnlen)2, (ftnlen)2) == 0) {
3809 #line 1425 ""
3810 s_rsfe(&io___197);
3811 #line 1425 ""
3812 do_fio(&c__1, line, (ftnlen)128);
3813 #line 1425 ""
3814 e_rsfe();
3815 #line 1425 ""
3816 }
3817
3818 /* 4/29/00 check for T string also */
3819
3820 #line 1431 ""
3821 } else {
3822
3823 /* In setup mode. Set flag, flow out and do use following line */
3824
3825 #line 1435 ""
3826 all_1.replacing = TRUE_;
3827 #line 1436 ""
3828 }
3829 #line 1437 ""
3830 } else if (*(unsigned char *)&line[1] == '!') {
3831
3832 /* Copy to all parts */
3833
3834 #line 1441 ""
3835 allparts_(line + 2, &c__125, (ftnlen)126);
3836 #line 1442 ""
3837 } else {
3838
3839 /* Get value of hex integer 1,2,...,9,a,b,c in 2nd position, zero otherwise */
3840 /* c Get value of extended hex integer 1,2,...,9,a,b,c,...,o in 2nd position, zero otherwise */
3841
3842 #line 1447 ""
3843 ivq = i_indx("123456789abcdefghijklmno", line + 1, (ftnlen)24, (
3844 ftnlen)1);
3845
3846 /* Only treat as part-specific pmx line if number .le. noinst */
3847
3848 #line 1451 ""
3849 if (ivq < 1 || ivq > all_1.noinst) {
3850
3851 /* Simple comment. */
3852
3853 #line 1455 ""
3854 allparts_(line, &c__128, (ftnlen)128);
3855 #line 1456 ""
3856 } else {
3857
3858 /* Instrument comment, copy only to part */
3859
3860 #line 1460 ""
3861 lenline = lenstr_(line, &c__128, (ftnlen)128);
3862 #line 1461 ""
3863 if (lenline > 2) {
3864 #line 1462 ""
3865 io___200.ciunit = ivq + 10;
3866 #line 1462 ""
3867 s_wsfe(&io___200);
3868 #line 1462 ""
3869 do_fio(&c__1, line + 2, lenline - 2);
3870 #line 1462 ""
3871 e_wsfe();
3872 #line 1463 ""
3873 } else {
3874
3875 /* Transferring blank line */
3876
3877 #line 1467 ""
3878 io___201.ciunit = ivq + 10;
3879 #line 1467 ""
3880 s_wsfe(&io___201);
3881 #line 1467 ""
3882 do_fio(&c__1, " ", (ftnlen)1);
3883 #line 1467 ""
3884 e_wsfe();
3885 #line 1468 ""
3886 }
3887 #line 1469 ""
3888 }
3889 #line 1470 ""
3890 }
3891 #line 1471 ""
3892 i__1 = s_rsfe(&io___202);
3893 #line 1471 ""
3894 if (i__1 != 0) {
3895 #line 1471 ""
3896 goto L2;
3897 #line 1471 ""
3898 }
3899 #line 1471 ""
3900 i__1 = do_fio(&c__1, line, (ftnlen)128);
3901 #line 1471 ""
3902 if (i__1 != 0) {
3903 #line 1471 ""
3904 goto L2;
3905 #line 1471 ""
3906 }
3907 #line 1471 ""
3908 i__1 = e_rsfe();
3909 #line 1471 ""
3910 if (i__1 != 0) {
3911 #line 1471 ""
3912 goto L2;
3913 #line 1471 ""
3914 }
3915 #line 1472 ""
3916 zapbl_(line, &c__128, (ftnlen)128);
3917 #line 1473 ""
3918 goto L1;
3919 #line 1474 ""
3920 L2:
3921 #line 1475 ""
3922 *goto999 = TRUE_;
3923 #line 1476 ""
3924 return 0;
3925 } /* chkcom_ */
3926
3927 /* Subroutine */ int dosetup_(integer *iv, char *line, integer *mtrnum,
3928 integer *mtrden, ftnlen line_len)
3929 {
3930 /* System generated locals */
3931 integer i__1, i__2;
3932
3933 /* Builtin functions */
3934 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void),
3935 i_nint(real *);
3936
3937 /* Local variables */
3938 static integer ioi, noi, iset;
3939 static real xdata;
3940 static integer iccount;
3941 extern /* Subroutine */ int partnum_(integer *, integer *, char *, real *,
3942 ftnlen);
3943
3944 /* Fortran I/O blocks */
3945 static cilist io___206 = { 0, 40, 0, "(i5)", 0 };
3946 static cilist io___208 = { 0, 40, 0, "(i5)", 0 };
3947 static cilist io___210 = { 0, 40, 0, "(i5)", 0 };
3948 static cilist io___211 = { 0, 40, 0, "(i5)", 0 };
3949 static cilist io___212 = { 0, 40, 0, "(i5)", 0 };
3950 static cilist io___213 = { 0, 40, 0, "(i5)", 0 };
3951 static cilist io___214 = { 0, 40, 0, "(f5.2)", 0 };
3952
3953
3954
3955 /* Transfers setup data from scratch file to real one for one instrument */
3956 /* Data may be mixed with comments, but on entry 1st item is a number. */
3957 /* Write a comment when encountered, as it comes. */
3958 /* Write numbers one per line. */
3959 /* Three input data require special handling: */
3960 /* If not already replaced, i.e., if negative, then */
3961 /* iset(1) (nv) will be replaced with nvi(i) */
3962 /* iset(9) (npages) will be replaced with (nsyst-1)/12+1 */
3963 /* iset(2), if negative, will be followed by extra numbers to be transf. */
3964
3965 #line 1495 ""
3966 iccount = 0;
3967 #line 1496 ""
3968 for (iset = 1; iset <= 12; ++iset) {
3969 #line 1497 ""
3970 partnum_(iv, &iccount, line, &xdata, (ftnlen)128);
3971 #line 1498 ""
3972 if (iset == 2) {
3973 #line 1499 ""
3974 if (xdata > 0.f) {
3975 #line 1500 ""
3976 s_wsfe(&io___206);
3977 #line 1500 ""
3978 i__1 = (integer) (xdata + .1f);
3979 #line 1500 ""
3980 do_fio(&c__1, (char *)&i__1, (ftnlen)sizeof(integer));
3981 #line 1500 ""
3982 e_wsfe();
3983 #line 1501 ""
3984 } else {
3985 #line 1502 ""
3986 noi = -xdata + .1f;
3987 #line 1503 ""
3988 s_wsfe(&io___208);
3989 #line 1503 ""
3990 do_fio(&c__1, (char *)&noi, (ftnlen)sizeof(integer));
3991 #line 1503 ""
3992 e_wsfe();
3993 #line 1504 ""
3994 i__1 = noi;
3995 #line 1504 ""
3996 for (ioi = 1; ioi <= i__1; ++ioi) {
3997 #line 1505 ""
3998 partnum_(iv, &iccount, line, &xdata, (ftnlen)128);
3999 #line 1506 ""
4000 s_wsfe(&io___210);
4001 #line 1506 ""
4002 i__2 = (integer) (xdata + .1f);
4003 #line 1506 ""
4004 do_fio(&c__1, (char *)&i__2, (ftnlen)sizeof(integer));
4005 #line 1506 ""
4006 e_wsfe();
4007 #line 1507 ""
4008 /* L2: */
4009 #line 1507 ""
4010 }
4011 #line 1508 ""
4012 }
4013 /* else if (iset.ne.8 .and. xdata.lt.0) then */
4014 #line 1510 ""
4015 } else if (iset != 8 && iset != 5 && xdata < 0.f) {
4016
4017 /* Must be either nv or npages */
4018
4019 #line 1514 ""
4020 if ((integer) (-xdata + .1f) == 999) {
4021
4022 /* It's nv */
4023
4024 #line 1518 ""
4025 s_wsfe(&io___211);
4026 #line 1518 ""
4027 do_fio(&c__1, (char *)&all_1.nvi[*iv - 1], (ftnlen)sizeof(
4028 integer));
4029 #line 1518 ""
4030 e_wsfe();
4031 #line 1519 ""
4032 } else {
4033
4034 /* npages must be computed */
4035
4036 #line 1523 ""
4037 s_wsfe(&io___212);
4038 #line 1523 ""
4039 i__1 = (all_1.nsyst - 1) / 12 + 1;
4040 #line 1523 ""
4041 do_fio(&c__1, (char *)&i__1, (ftnlen)sizeof(integer));
4042 #line 1523 ""
4043 e_wsfe();
4044 #line 1524 ""
4045 }
4046 #line 1525 ""
4047 } else if (iset != 7 && iset != 12) {
4048
4049 /* write integer */
4050
4051 #line 1529 ""
4052 s_wsfe(&io___213);
4053 #line 1529 ""
4054 i__1 = i_nint(&xdata);
4055 #line 1529 ""
4056 do_fio(&c__1, (char *)&i__1, (ftnlen)sizeof(integer));
4057 #line 1529 ""
4058 e_wsfe();
4059 #line 1530 ""
4060 } else {
4061
4062 /* write floating number */
4063
4064 #line 1534 ""
4065 s_wsfe(&io___214);
4066 #line 1534 ""
4067 do_fio(&c__1, (char *)&xdata, (ftnlen)sizeof(real));
4068 #line 1534 ""
4069 e_wsfe();
4070 #line 1535 ""
4071 }
4072 #line 1536 ""
4073 if (iset == 3) {
4074 #line 1537 ""
4075 *mtrnum = i_nint(&xdata);
4076 #line 1538 ""
4077 } else if (iset == 4) {
4078 #line 1539 ""
4079 *mtrden = i_nint(&xdata);
4080 #line 1540 ""
4081 }
4082 #line 1541 ""
4083 /* L1: */
4084 #line 1541 ""
4085 }
4086 #line 1542 ""
4087 return 0;
4088 } /* dosetup_ */
4089
4090 /* Subroutine */ int partnum_(integer *iv, integer *iccount, char *line, real
4091 *xdata, ftnlen line_len)
4092 {
4093 /* System generated locals */
4094 address a__1[3];
4095 integer i__1[3];
4096 char ch__1[27], ch__2[6], ch__3[1];
4097 icilist ici__1;
4098
4099 /* Builtin functions */
4100 integer s_rsfe(cilist *), do_fio(integer *, char *, ftnlen), e_rsfe(void),
4101 s_wsfe(cilist *), e_wsfe(void), i_indx(char *, char *, ftnlen,
4102 ftnlen), s_wsle(cilist *);
4103 /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen);
4104 integer do_lio(integer *, integer *, char *, ftnlen), e_wsle(void);
4105 /* Subroutine */ int s_stop(char *, ftnlen);
4106 integer s_rsfi(icilist *), e_rsfi(void);
4107
4108 /* Local variables */
4109 static integer i1, i2, icf, len;
4110 static char durq[1];
4111 extern integer lenstr_(char *, integer *, ftnlen);
4112 extern /* Subroutine */ int getchar_(char *, integer *, char *, ftnlen,
4113 ftnlen);
4114
4115 /* Fortran I/O blocks */
4116 static cilist io___215 = { 0, 0, 0, "(a)", 0 };
4117 static cilist io___217 = { 0, 40, 0, "(a)", 0 };
4118 static cilist io___221 = { 0, 6, 0, 0, 0 };
4119
4120
4121
4122 /* Simplified number parsing. Only looks for comment lines and numbers. */
4123
4124 #line 1550 ""
4125 L2:
4126 #line 1550 ""
4127 if (*iccount == 128) {
4128 #line 1551 ""
4129 io___215.ciunit = *iv + 10;
4130 #line 1551 ""
4131 s_rsfe(&io___215);
4132 #line 1551 ""
4133 do_fio(&c__1, line, (ftnlen)128);
4134 #line 1551 ""
4135 e_rsfe();
4136 #line 1552 ""
4137 if (*(unsigned char *)line == '%') {
4138 #line 1553 ""
4139 len = lenstr_(line, &c__128, (ftnlen)128);
4140 #line 1554 ""
4141 s_wsfe(&io___217);
4142 #line 1554 ""
4143 do_fio(&c__1, line, len);
4144 #line 1554 ""
4145 e_wsfe();
4146 #line 1555 ""
4147 goto L2;
4148 #line 1556 ""
4149 }
4150 #line 1557 ""
4151 *iccount = 0;
4152 #line 1558 ""
4153 }
4154 #line 1559 ""
4155 ++(*iccount);
4156
4157 /* Find next non-blank or end of line */
4158
4159 #line 1563 ""
4160 for (*iccount = *iccount; *iccount <= 127; ++(*iccount)) {
4161 #line 1564 ""
4162 if (*(unsigned char *)&line[*iccount - 1] != ' ') {
4163 #line 1564 ""
4164 goto L3;
4165 #line 1564 ""
4166 }
4167 #line 1565 ""
4168 /* L4: */
4169 #line 1565 ""
4170 }
4171
4172 /* If here, iccount=128 and need to get a new line */
4173
4174 #line 1569 ""
4175 goto L2;
4176 #line 1570 ""
4177 L3:
4178
4179 /* iccount now points to start of number to read */
4180
4181 #line 1574 ""
4182 i1 = *iccount;
4183 #line 1575 ""
4184 L5:
4185 #line 1575 ""
4186 getchar_(line, iccount, durq, (ftnlen)128, (ftnlen)1);
4187
4188 /* Remember that getchar first increments iccount, *then* reads a character. */
4189
4190 #line 1579 ""
4191 if (i_indx("0123456789.-", durq, (ftnlen)12, (ftnlen)1) > 0) {
4192 #line 1579 ""
4193 goto L5;
4194 #line 1579 ""
4195 }
4196 #line 1580 ""
4197 i2 = *iccount - 1;
4198 #line 1581 ""
4199 if (i2 < i1) {
4200 #line 1582 ""
4201 s_wsle(&io___221);
4202 /* Writing concatenation */
4203 #line 1582 ""
4204 i__1[0] = 7, a__1[0] = "Found \"";
4205 #line 1582 ""
4206 i__1[1] = 1, a__1[1] = durq;
4207 #line 1582 ""
4208 i__1[2] = 19, a__1[2] = "\" instead of number";
4209 #line 1582 ""
4210 s_cat(ch__1, a__1, i__1, &c__3, (ftnlen)27);
4211 #line 1582 ""
4212 do_lio(&c__9, &c__1, ch__1, (ftnlen)27);
4213 #line 1582 ""
4214 e_wsle();
4215 #line 1583 ""
4216 s_stop("1", (ftnlen)1);
4217 #line 1584 ""
4218 }
4219 #line 1585 ""
4220 icf = i2 - i1 + 49;
4221 #line 1586 ""
4222 ici__1.icierr = 0;
4223 #line 1586 ""
4224 ici__1.iciend = 0;
4225 #line 1586 ""
4226 ici__1.icirnum = 1;
4227 #line 1586 ""
4228 ici__1.icirlen = i2 - (i1 - 1);
4229 #line 1586 ""
4230 ici__1.iciunit = line + (i1 - 1);
4231 /* Writing concatenation */
4232 #line 1586 ""
4233 i__1[0] = 2, a__1[0] = "(f";
4234 #line 1586 ""
4235 *(unsigned char *)&ch__3[0] = icf;
4236 #line 1586 ""
4237 i__1[1] = 1, a__1[1] = ch__3;
4238 #line 1586 ""
4239 i__1[2] = 3, a__1[2] = ".0)";
4240 #line 1586 ""
4241 ici__1.icifmt = (s_cat(ch__2, a__1, i__1, &c__3, (ftnlen)6), ch__2);
4242 #line 1586 ""
4243 s_rsfi(&ici__1);
4244 #line 1586 ""
4245 do_fio(&c__1, (char *)&(*xdata), (ftnlen)sizeof(real));
4246 #line 1586 ""
4247 e_rsfi();
4248 #line 1587 ""
4249 return 0;
4250 } /* partnum_ */
4251
4252
4253 /* Subroutine */ int zapbl_(char *string, integer *len, ftnlen string_len)
4254 {
4255 /* System generated locals */
4256 integer i__1;
4257
4258 /* Builtin functions */
4259 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
4260
4261 /* Local variables */
4262 static integer i__;
4263
4264 #line 1599 ""
4265 i__1 = *len;
4266 #line 1599 ""
4267 for (i__ = 1; i__ <= i__1; ++i__) {
4268 #line 1600 ""
4269 if (*(unsigned char *)&string[i__ - 1] == ' ') {
4270 #line 1600 ""
4271 goto L1;
4272 #line 1600 ""
4273 }
4274 #line 1601 ""
4275 if (i__ == 1) {
4276 #line 1601 ""
4277 return 0;
4278 #line 1601 ""
4279 }
4280 #line 1602 ""
4281 goto L2;
4282 #line 1603 ""
4283 L1:
4284 #line 1603 ""
4285 ;
4286 #line 1603 ""
4287 }
4288
4289 /* If line is all blank, leave it alone */
4290
4291 #line 1607 ""
4292 return 0;
4293 #line 1608 ""
4294 L2:
4295 #line 1609 ""
4296 s_copy(string, string + (i__ - 1), string_len, *len - (i__ - 1));
4297 #line 1610 ""
4298 return 0;
4299 } /* zapbl_ */
4300
4301 /* Subroutine */ int oddquotesbefore_(char *lineq, integer *indx, logical *
4302 yesodd, ftnlen lineq_len)
4303 {
4304 /* System generated locals */
4305 integer i__1;
4306
4307 /* Local variables */
4308 static integer i__, numdqs;
4309
4310
4311 /* This counts number of double quotes in lineq up to position indx-1, then */
4312 /* sets yesodd according to whether number is odd or even */
4313
4314 #line 1619 ""
4315 numdqs = 0;
4316 #line 1620 ""
4317 i__1 = *indx - 1;
4318 #line 1620 ""
4319 for (i__ = 1; i__ <= i__1; ++i__) {
4320 #line 1621 ""
4321 if (*(unsigned char *)&lineq[i__ - 1] == '"') {
4322 #line 1621 ""
4323 ++numdqs;
4324 #line 1621 ""
4325 }
4326 #line 1622 ""
4327 /* L1: */
4328 #line 1622 ""
4329 }
4330 #line 1623 ""
4331 *yesodd = numdqs % 2 == 1;
4332 #line 1624 ""
4333 return 0;
4334 } /* oddquotesbefore_ */
4335