forked from mandovinnie/Lute-Tab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathargs.cc
829 lines (784 loc) · 22.8 KB
/
args.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
/*
This program is copyright 1991 by Wayne Cripps,
P.O. Box 677 Hanover N.H. 03755.
All rights reserved. It is supplied "as is"
without express or implied warranty.
Permission is granted to use, copy, modify and distribute
this software without fee, provided that this notice appears
in all copies, and that a copy of this notice is provided to
anyone who recieves a binary copy without sources.
This software may not be used for commercial purposes
without explicit, prior written permission.
Please mail bug reports, suggestions, and improvements
*/
#include "win.h"
#include "tab.h"
#include "system.h"
#include "tree.h"
#define N_ARGS 12
/* EXTERN */
void args(int argc, char ** argv, struct file_info *f);
void set_ps_size(int num, int size);
void set_ps_font(int num, char * name);
void ps_text_tfm(struct file_info *f, int fontnum);
extern char flag_to_staff[];
extern int title_font, text_font;
char *get_real_name(const char *short_name, int dump);
int setflag(file_info *f, char * string, pass pass);
void show_usage()
{
dbg0(Warning, "Usage: tab [options] tab_file\n");
}
void set_font_flag(const char *value, struct file_info *f)
{
// vals 1 2 3 4
// this used to swap between italic and text
}
void set_C(const char *value, struct file_info *f) { bar_count++; }
void set_c(const char *value, struct file_info *f) { barCount++; }
void set_CC(const char *value, struct file_info *f) {
barCCount++;
}
void set_b(const char *value, struct file_info *f) {
if (thin_renaissance)
dbg0(Error, "Args.cc: You can't use both -thin and -b at the same time \n");
baroque++;
}
void set_d(const char *value, struct file_info *f) {
if (! strncmp(value, "File", 4)) {
dbg0(Warning, "Setting debug to File\n");
dbg_set(File);
}
if (! strncmp(value, "Path", 4)) {
dbg0(Warning, "Setting debug to Path\n");
dbg_set(Path);
}
else if (! strncmp(value, "TFM", 3)) {
dbg0(Warning, "Setting debug to TFM\n");
dbg_set(TFM);
}
else if (! strncmp(value, "Inter", 4)) {
dbg0(Warning, "Setting debug to Inter\n");
dbg_set(Inter);
}
else if (! strncmp(value, "Flow", 4)) {
dbg0(Warning, "Setting debug to Flow\n");
dbg_set(Flow);
}
else if (! strncmp(value, "Warning", 4)) {
dbg0(Warning, "Setting debug to Warning\n");
dbg_set(Warning);
}
else if (! strncmp(value, "Error", 4)) {
dbg0(Warning, "Setting debug to Error\n");
dbg_set(Error);
}
else if (! strncmp(value, "Stack", 4)) {
dbg0(Warning, "Setting debug to Stack\n");
dbg_set(Stack);
}
else if (! strncmp(value, "Proceedure", 4)) {
dbg0(Warning, "Setting debug to Proceedure\n");
dbg_set(Proceedure);
}
else if (! strncmp(value, "Fonts", 4)) {
dbg0(Warning, "Setting debug to Font\n");
dbg_set(Fonts);
}
else if (! strncmp(value, "Bug", 3)) {
dbg0(Warning, "Setting debug to Bug\n");
dbg_set(Bug);
}
else if (! strncmp(value, "Widths", 4)) {
dbg0(Warning, "Setting debug to Widths\n");
dbg_set(Widths);
}
f->flags |= DEBUG;
}
void set_B(const char *value, struct file_info *f) {
f->line_flag = BETWEEN_LINE;
f->flag_flag = BOARD_FLAGS;
f->char_flag = BOARD_CHAR;
f->num_flag = STAND_NUM;
f->note_conv = 0;
f->note_flag = ITAL_NOTES;}
void set_D(const char *value, struct file_info *f) {
f->line_flag = BETWEEN_LINE;
f->flag_flag = THIN_FLAGS;
f->char_flag = STAND_CHAR;
f->num_flag = STAND_NUM;
f->note_conv = 0;
f->note_flag = ITAL_NOTES;}
void set_e(const char *value, struct file_info *f) { f->flags |= ROTATE; }
void set_E(const char *value, struct file_info *f) { f->flags |= DRAFT; }
void set_ff(const char *value, struct file_info *f) {
f->flag_flag = STAND_FLAGS; }
void set_fc(const char *value, struct file_info *f) {
f->char_flag = STAND_CHAR;}
void set_f(const char *value, struct file_info *f) {
f->line_flag = BETWEEN_LINE;
f->flag_flag = STAND_FLAGS;
f->char_flag = STAND_CHAR;
f->num_flag = STAND_NUM;
f->note_flag = ITAL_NOTES;}
void set_F(const char *value, struct file_info *f) {
f->line_flag = BETWEEN_LINE;
f->flag_flag = CONTEMP_FLAGS;
f->char_flag = STAND_CHAR;
f->num_flag = STAND_NUM;
f->note_flag = ITAL_NOTES;}
void set_G(const char *value, struct file_info *f)
{ f->flags |= COPYRIGHT;}
void set_h(const char *value, struct file_info *f) {
if ( f->flags & CONVERT ) f->flags &= ~CONVERT;
else f->flags |= CONVERT;
f->num_flag = ITAL_NUM;
f->note_flag = ITAL_NOTES;
f->flag_flag = S_ITAL_FLAGS;}
void set_H(const char *value, struct file_info *f) {
if ( f->flags & CON_SEV) f->flags &= ~CON_SEV;
else f->flags |= CON_SEV;
set_h(value, f);}
void set_i(const char *value, struct file_info *f) {
if (f->flags & MANUSCRIPT) {
f->line_flag = BETWEEN_LINE;
}
else if ( f->flags & CONVERT) {
if (f->line_flag == ON_LINE )
f->line_flag = BETWEEN_LINE;
else
f->line_flag = ON_LINE;
}
else
f->line_flag = ON_LINE;
if (!baroque)
f->flag_flag = S_ITAL_FLAGS;
f->char_flag = STAND_CHAR;
f->num_flag = ITAL_NUM;
f->note_flag = ITAL_NOTES;}
void set_I(const char *value, struct file_info *f) {
f->line_flag = BETWEEN_LINE;
f->flag_flag = S_ITAL_FLAGS;
f->char_flag = STAND_CHAR;
f->num_flag = ITAL_NUM;
f->note_flag = ITAL_NOTES;}
void set_K(const char *value, struct file_info *f) {f->m_flags |= NO_AUTO_END;}
void set_x(const char *value, struct file_info *f) {
f->line_flag = ON_LINE;
f->flag_flag = THIN_FLAGS;
f->char_flag = STAND_CHAR;
f->num_flag = ITAL_NUM;
f->note_flag = ITAL_NOTES;}
void set_O(const char *value, struct file_info *f) {
f->line_flag = ON_LINE;
f->flag_flag = CAP_FLAGS;
f->char_flag = STAND_CHAR;
f->num_flag = ITAL_NUM;
f->note_flag = ITAL_NOTES;}
void set_s(const char *value, struct file_info *f) { f->flags |= CON_SEV;}
void set_T(const char *value, struct file_info *f) {
// f->line_flag = BETWEEN_LINE;
f->flag_flag = THIN_FLAGS;
// f->char_flag = STAND_CHAR;
// f->num_flag = STAND_NUM;
// f->note_flag = ITAL_NOTES;}
}
void set_w(const char *value, struct file_info *f) {
f->line_flag = ON_LINE;
f->flag_flag = S_ITAL_FLAGS;
f->char_flag = STAND_CHAR;
f->num_flag = ITAL_NUM;
f->note_flag = ITAL_NOTES;
f->flags |= WALLACE;
f->flags |= NO_MUSIC_B;
f->flags |= BIGNOTES;
f->flags |= ROTATE;
f->flags |= SHARP_UP;
f->note_conv = 0;}
void set_Z(const char *value, struct file_info *f) {
f->line_flag = ON_LINE;
f->flag_flag = S_ITAL_FLAGS;
f->char_flag = STAND_CHAR;
f->note_flag = ITAL_NOTES;
f->num_flag = ITAL_NUM;
f->flags |= NO_MUSIC_B;
f->flags |= BIGNOTES;
f->note_conv = 0;}
void set_j(const char *value, struct file_info *f) { f->flags |= CONV_COR;}
void set_m(const char *value, struct file_info *f) { f->flags |= MANUSCRIPT;}
void set_M(const char *value, struct file_info *f) { f->flags |= MARKS;}
void set_n(const char *value, struct file_info *f) {
f->char_flag = MACE_CHAR; }
void set_N(const char *value, struct file_info *f) {
f->char_flag = ROB_CHAR;}
void set_p(const char *value, struct file_info *f) { f->flags |= PAGENUM;}
void set_P(const char *value, struct file_info *f) {
f->flags |= PS;
f->flags &= ~PDF;
f->flags &= ~DVI_O;}
void set_dvi(const char *value, struct file_info *f) {
f->flags |= DVI_O;
f->flags &= ~PDF;
f->flags &= ~PS;}
void set_pdf(const char *value, struct file_info *f) {
/* void set_o(const char *value, struct file_info *f); */
/* now this runs the PS through ghostscript
f->flags &= ~DVI_O;
f->flags &= ~PS;
f->flags |= PDF;}
*/
f->flags &= ~DVI_O;
f->flags |= PS;
f->m_flags |= GS;
/* set_o("stdpipe.ps", f); */
}
void set_2(const char *value, struct file_info *f) {
f->m_flags |= DPI1200;
f->flags &= ~DPI600;
red = 1.0;}
void set_6(const char *value, struct file_info *f) {
f->flags |= DPI600;
}
void set_300(const char *value, struct file_info *f) {
f->flags &= ~DPI600;
}
void set_360(const char *value, struct file_info *f) {
f->flags &= ~DPI600;
f->m_flags |= DPI360;
}
void set_24(const char *value, struct file_info *f) {
f->m_flags |= DPI2400;
f->flags &= ~DPI600;
red = 1.0;}
void set_Q(const char *value, struct file_info *f) {f->flags |= BIGNOTES;}
void set_q(const char *value, struct file_info *f) {f->m_flags |= QUIET;}
void set_r(const char *value, struct file_info *f) {baroque=0;}
void set_S(const char *value, struct file_info *f) {f->flags |= SAMELINE;}
void set_t(const char *value, struct file_info *f) {f->line_flag |= ON_LINE;}
void set_v(const char *value, struct file_info *f) {
f->flags |= VERBOSE;
dbg_set(Inter);}
void set_V(const char *value, struct file_info *f) {}
void set_wide(const char *value, struct file_info *f) {
f->m_flags |= AWIDE;
}
void set_W(const char *value, struct file_info *f) {
f->line_flag = BETWEEN_LINE;
f->flag_flag = S_ITAL_FLAGS;
f->char_flag = STAND_CHAR;
f->num_flag = ITAL_NUM;
f->note_flag = ITAL_NOTES;
f->flags |= WALLACE;
f->flags |= NO_MUSIC_B;
f->flags |= BIGNOTES;
f->flags |= ROTATE;
f->flags |= SHARP_UP;
f->flags |= CONVERT;
f->note_conv = 0;}
void set_X(const char *value, struct file_info *f) { f->flags |= NO_EXPAND;}
void set_Y(const char *value, struct file_info *f) { f->flags |= NO_WORD;}
void set_y(const char *value, struct file_info *f) {}
void set_z(const char *value, struct file_info *f) {}
void set_0(const char *value, struct file_info *f) {
f->flags &= ~FOUR;
f->flags &= ~FIVE;
f->m_flags &= ~SEVEN;
}
void set_4(const char *value, struct file_info *f) {
f->flags |= FOUR;
f->flags &= ~FIVE;
f->m_flags &= ~SEVEN;
}
void set_5(const char *value, struct file_info *f) {
f->flags &= ~FOUR;
f->flags |= FIVE;
f->m_flags &= ~SEVEN;
}
void set_7(const char *value, struct file_info *f) {
f->flags &= ~FOUR;
f->flags &= ~FIVE;
f->m_flags |= SEVEN;
}
void set_l(const char *value, struct file_info *f) {
if ( ! strncmp ("reset", value, 5))
staff_len = o_staff_len;
else {
o_staff_len = staff_len;
staff_len = str_to_inch(value);
}
}
void set_R95(const char *value, struct file_info *f) { red = 0.94440;}
void set_R9(const char *value, struct file_info *f) { red = 0.88880;}
void set_R8(const char *value, struct file_info *f) { red = 0.777770;}
void set_R7(const char *value, struct file_info *f) { red = 0.6666666;}
void set_listfonts(const char *value, struct file_info *f) {
(void)get_real_name("pncr", 1);
}
void set_o(const char *value, struct file_info *f) {
#ifndef MAC
char * ptr;
if (!value) {
dbg0 (Warning, "-o with no output file specified, using default\n");
return;
}
strcpy (f->out_file, value);
if ((ptr = strstr (f->out_file, ".tab"))) {
*ptr = '\0';
}
if ((ptr = strstr (f->out_file, ".ps"))) {
*ptr = '\0';
}
if ((ptr = strstr (f->out_file, ".mid"))) {
*ptr = '\0';
}
#ifndef NO_STDOUT
if (f->m_flags & SOUND ) {
strncat (f->out_file, ".mid ", 4);
}
else if (f->flags & PS ) {
if ( strcmp (f->out_file, "stdout")) {
strncat (f->out_file, ".ps ", 3);
}
}
#endif /* NO_STDOUT */
else strncat (f->out_file, ".dvi ", 4);
if ( ! (f->m_flags & QUIET)) {
dbg1 (Warning, "tab: sending output to %s\n", (void *)f->out_file);
}
#endif /* MAC */
}
void set_tuning(const char *value, struct file_info *f) {
extern char *arg_str;
// dbg1(Warning, "in set_tuning %s\n", (void *) value);
arg_str=(char *)malloc(strlen(value)+1);
strcpy(arg_str, value);
}
void set_sharp_up(const char *value, struct file_info *f)
{
f->flags |= SHARP_UP;
}
void set_sharp_normal(const char *value, struct file_info *f)
{
f->flags &= ~SHARP_UP;
}
void set_highlight_paren(const char *value, struct file_info *f)
{
f->m_flags |= PAREN;
}
void set_highlight_red(const char *value, struct file_info *f)
{
f->m_flags |= RED;
}
void set_sound(const char *value, struct file_info *f)
{
f->m_flags |= SOUND;
f->flags |= MANUSCRIPT;
f->m_flags |= QUIET;
#ifndef NO_STDOUT
strncat (f->out_file, "stdout ", 6); // was /dev/null
#endif
}
void set_alttitle(const char *value, struct file_info *f)
{
// printf("args: setting alt title\n");
f->m_flags |= ALTTITLE;
}
void set_alttitle_off(const char *value, struct file_info *f)
{
// printf("args: turning off alt title\n");
f->m_flags &= ~ALTTITLE;
}
void set_a4(const char *value, struct file_info *f)
{
f->m_flags |= A4;
}
void set_nobox(const char *value, struct file_info *f)
{
f->m_flags |= NOBOX;
}
void set_sItalNotes(const char *value, struct file_info *f)
{
f->flag_flag = S_ITAL_FLAGS;
}
void set_italFlags(const char *value, struct file_info *f)
{
f->note_flag = ITAL_NOTES;
}
void set_twostaff(const char *value, struct file_info *f)
{
f->m_flags |= TWOSTAFF;
}
void set_longbar(const char *value, struct file_info *f)
{
f->m_flags |= LONGBAR;
}
void set_comp_staff(const char *value, struct file_info *f)
{
strcpy(interspace, "9.0 pt");
m_space = 0.068;
}
void set_autoKey(const char *value, struct file_info *f)
{
f->m_flags |= AUTOKEY;
}
void set_allDsup(const char *value, struct file_info *f)
{
f->m_flags |= DSUP;
f->m_flags &= ~DSDOWN;
}
void set_allDsdown(const char *value, struct file_info *f)
{
f->m_flags |= DSDOWN;
f->m_flags &= ~DSUP;
}
void set_ModNotes(const char *value, struct file_info *f)
{
f->note_flag |= MOD_NOTES;
}
void set_EPSF(const char *value, struct file_info *f)
{
f->m_flags |= EPSF;
}
void set_ascii(const char *value, struct file_info *f)
{
f->m_flags |= ASCII;
}
void set_fontpath(const char *value, struct file_info *f)
{
extern char *font_path;
// dbg1(Warning, "in set_fontpath %s\n", (void *) value);
font_path=(char *)malloc(strlen(value)+1);
strcpy(font_path, value);
}
void set_milan(const char *value, struct file_info *f)
{
f->m_flags |= MILAN;
}
void set_nmidi(const char *value, struct file_info *f)
{
f->m_flags |= NMIDI;
f->m_flags |= QUIET;
}
void set_amidi_patch(const char *value, struct file_info *f)
{
f->midi_patch = atoi(value);
}
void set_guitar(const char *value, struct file_info *f)
{
f->m_flags |= GUIT;
f->flags |= MANUSCRIPT;
}
void set_line_thickness(const char *value, struct file_info *f)
{
strncpy(staff_height, value, 20);
}
void set_thin_font(const char *value, struct file_info *f)
{
if (baroque)
dbg0(Error, "Args.cc: You can't use both -thin and -b at the same time \n");
thin_renaissance=1;
}
void set_tfmdump(const char *value, struct file_info *f)
{
dbg_set(TFM);
}
void set_twelvedots(const char *value, struct file_info *f)
{
f->m_flags |= TWELVEDOTS;
}
void set_curly_e(const char *value, struct file_info *f)
{
f->m_flags |= BAROQUE_E;
}
void set_spanish(const char *value, struct file_info *f)
{
f->m_flags |= SPANISH;
}
void set_no_space_after_note(const char *value, struct file_info *f)
{
f->m_flags |=NOSPACE;
}
void set_no_space_before_note(const char *value, struct file_info *f)
{
f->m_flags |=NOSPACEBEFORE;
}
void set_count_dots(const char *value, struct file_info *f)
{
f->m_flags |=COUNT_DOTS;
}
void show_tabfontpath()
{
extern char *font_path;
char *p = 0;
if (font_path) dbg1(Warning, "args: font path set on command line %s\n", font_path);
else {
p = getenv("TABFONTS");
if (p)
dbg1(Warning, "args: font path set in env TABFONTS %s\n", p);
else {
#ifdef TFM_PATH
dbg1(Warning, "args: font path set at compile time by TFM_PATH to %s\n",
(void *)TFM_PATH);
#else /* TFM_PATH */
dbg0(Warning, "args: font path compiled in .\n");
#endif /* TFM_PATH */
}
}
// if (p) printf ("args: p is %s\n", p);
}
void args(int argc, char ** argv, struct file_info *f)
{
char *aa=0;
// void (*r) (const char *, struct file_info *f);
void (*r)(const char *, struct file_info *);
struct tuple arglist[] = {
{(char*)"af", (void*)set_font_flag},
{(char*)"C", (void*)set_C},
{(char*)"c", (void*)set_c},
{(char*)"CC", (void*)set_CC},
{(char*)"b", (void*)set_b},
{(char*)"B", (void*)set_B},
{(char*)"D", (void*)set_D},
{(char*)"debug", (void*)set_d},
{(char*)"e", (void*)set_e},
{(char*)"E", (void*)set_E},
{(char*)"f", (void*)set_f},
{(char*)"fc", (void*)set_fc},
{(char*)"ff", (void*)set_ff},
{(char*)"F", (void*)set_F},
{(char*)"G", (void*)set_G},
{(char*)"H", (void*)set_H},
{(char*)"h", (void*)set_h},
{(char*)"i", (void*)set_i},
{(char*)"I", (void*)set_I},
{(char*)"K", (void*)set_K},
{(char*)"x", (void*)set_x},
{(char*)"O", (void*)set_O},
{(char*)"s", (void*)set_s},
{(char*)"T", (void*)set_T},
{(char*)"w", (void*)set_w},
{(char*)"Z", (void*)set_Z},
{(char*)"j", (void*)set_j},
{(char*)"l", (void*)set_l},
{(char*)"m", (void*)set_m},
{(char*)"M", (void*)set_M}, //not used
{(char*)"0", (void*)set_0},
{(char*)"2", (void*)set_2},
{(char*)"1200", (void*)set_2},
{(char*)"2400", (void*)set_24},
{(char*)"300", (void*)set_300},
{(char*)"360", (void*)set_360},
{(char*)"4", (void*)set_4},
{(char*)"5", (void*)set_5},
{(char*)"6", (void*)set_6},
{(char*)"600", (void*)set_6},
{(char*)"7", (void*)set_7},
{(char*)"N", (void*)set_N},
{(char*)"P", (void*)set_P},
{(char*)"dvi", (void*)set_dvi},
{(char*)"pdf", (void*)set_pdf},
{(char*)"Q", (void*)set_Q},
{(char*)"R7", (void*)set_R7},
{(char*)"R8", (void*)set_R8},
{(char*)"R8.5", (void*)set_R8},
{(char*)"R9", (void*)set_R9},
{(char*)"R95", (void*)set_R95},
{(char*)"R9.5", (void*)set_R95},
{(char*)"S", (void*)set_S},
{(char*)"V", (void*)set_V},
{(char*)"W", (void*)set_W},
{(char*)"X", (void*)set_X},
{(char*)"Y", (void*)set_Y},
{(char*)"listfonts", (void*)set_listfonts},
{(char*)"n", (void*)set_n},
{(char*)"o", (void*)set_o},
{(char*)"p", (void*)set_p},
{(char*)"q", (void*)set_q},
{(char*)"r", (void*)set_r},
{(char*)"t", (void*)set_t},
{(char*)"v", (void*)set_v},
{(char*)"y", (void*)set_y},
{(char*)"z", (void*)set_z},
{(char*)"tuning", (void*)set_tuning},
{(char*)"sharpUp", (void*)set_sharp_up},
{(char*)"sharpNorm", (void*)set_sharp_normal},
{(char*)"highlightparen", (void*)set_highlight_paren},
{(char*)"highlightred", (void*)set_highlight_red},
{(char*)"sound", (void*)set_sound},
{(char*)"midi", (void*)set_sound},
{(char*)"alttitle", (void*)set_alttitle},
{(char*)"alttitle-off", (void*)set_alttitle_off},
{(char*)"a4", (void*)set_a4},
{(char*)"nobox", (void*)set_nobox},
{(char*)"sItalNotes", (void*)set_sItalNotes},
{(char*)"italFlags", (void*)set_italFlags},
{(char*)"twostaff", (void*)set_twostaff},
{(char*)"longbar", (void*)set_longbar},
{(char*)"compressStaff", (void*)set_comp_staff},
{(char*)"autoKey", (void*)set_autoKey},
{(char*)"allDsup", (void*)set_allDsup},
{(char*)"allDsdown", (void*)set_allDsdown},
{(char*)"modernNotes", (void*)set_ModNotes},
{(char*)"EPSF", (void*)set_EPSF},
{(char*)"ascii", (void*)set_ascii},
{(char*)"wide", (void*)set_wide},
{(char*)"fontpath", (void*)set_fontpath},
{(char*)"milan", (void*)set_milan},
{(char*)"nmidi", (void*)set_nmidi},
{(char*)"midi-patch", (void*)set_amidi_patch},
{(char*)"guitar", (void*)set_guitar},
{(char*)"staff-line-thickness", (void*)set_line_thickness},
{(char*)"thin", (void*)set_thin_font},
{(char*)"tfmdump", (void*)set_tfmdump},
{(char*)"twelvedots", (void*) set_twelvedots},
{(char*)"curly-e", (void*) set_curly_e},
{(char*)"spanish", (void*) set_spanish},
{(char*)"no_space_after_note", (void*) set_no_space_after_note},
{(char*)"no_space_before_note", (void*) set_no_space_before_note},
{(char*)"count_dots", (void*) set_count_dots},
{(char*)"tabfontpath", (void *) show_tabfontpath},
{(char*)0, (void*)0}
};
static tree at(arglist);
/* check for blank after flag */
while (argc > 0) {
if (**argv == '-') {
(*argv)++;
r = (void(*)(const char*, file_info*))at.get(*argv);
if (r) {
aa = argv[1];
(*r)(aa, f);
// setit(r, aa, f);
}
else {
aa = argv[0];
dbg1(Warning, "tab: args: unknown flag %s\n", (void*)aa);
}
//swallow argument values here
switch (argv[0][0]){
case 't':
if (strncmp(argv[0], "tuning", 6 ))
break;
else {
*argv++;
argc--;
break;
}
case 'd':
if ( strncmp(argv[0], "debug", 5 ))
break;
else {
*argv++;
argc--;
break;
}
case 'f':
if ( strncmp(argv[0], "font", 4 ))
break;
else {
*argv++;
argc--;
break;
}
case 'a':
if ( argv[0][1] != 'f') break;
case 'm':
if (strncmp(argv[0], "midi-patch", 10 ))
break;
case 's':
if (strncmp(argv[0], "staff-line-thickness", 18 ))
break;
case 'l':
case 'o':
*argv++;
argc--;
break;
default:
break;
}
*argv++;
argc--;
}
else if (**argv == '$') {
(*argv)++;
(void)setflag(f, *argv, first);
// dbg1(Warning, "tab: $ parameters not allowed on command line: %s\n",
// *argv);
*argv++;
argc--; }
/* assume what is left is filename */
else { /* not - */
strcpy (f->file, *argv);
//#ifdef WIN32
// if (!strstr(f->file, ".")) {
//#else
if (!strstr(f->file, ".tab")) {
//#endif /* WIN32 */
strcat (f->file, ".tab");
}
if ( ! (f->m_flags & QUIET))
dbg1 (Warning, "setting filename to %s\n", f->file);
*argv++;
argc--;
}
}
if (strlen(f->file) == 0) {
show_usage();
dbg0 (Error, "No file name given\n");
}
}
#define ARG_LEN 120
void args_from_string(char *buf, struct file_info *f)
{
int argc=0, i, j;
char argv[ARG_LEN];
char *argp[N_ARGS];
int quote=0;
memset(argv, 0, sizeof(argv));
for (i=0,j=0; i<sizeof (argv) && buf[i] != (char)'\0'; /* i++, */ j++) {
while (buf[i] == ' ')
i++; /* strip leading spaces */
if (buf[i] == '\0') break;
if (buf[i] == NEWLINE) break;
argp[argc] = &argv[j]; /* start a new arg */
argc++;
while (1) {
argv[j] = buf[i];
// the 0xd2 and 0xd3 are apple textedit quotes
if (argv[j] == '"' || argv[j] == '\'' ||
argv[j] == (signed char)0xd2 ||
argv[j] == (signed char)0xd3 ||
argv[j] == (signed char)0xe2 ) {
if (argv[j] == (signed char)0xe2 ) {
argv[j] = '"';
i++;i++;
}
if (quote) { /* end quote */
quote = 0;
argv[j] = '\0';
i++;
}
else {
i++;
argv[j] = buf[i];
quote++;
}
}
j++;
i++;
if (buf[i] == '\0') break;
if (buf[i] == NEWLINE) break;
if (!quote && buf[i] == ' ') {
argv[j] = '\0';
break;
}
}
}
argv[i]='\0';
memset(&argv[i], 0, ARG_LEN - i);
for (j=argc; j < N_ARGS; j++ ) {
argp[j]=0;
}
args(argc, argp, f);
}