comparison tools/xm2jss.c @ 2408:60e119262c67

Option index re-ordering cleanup work.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 13 Jan 2020 21:21:25 +0200
parents b7cd5dd0b82e
children bc05bcfc4598
comparison
equal deleted inserted replaced
2407:c5a32812dd97 2408:60e119262c67
45 }; 45 };
46 46
47 47
48 static const DMOptArg optList[] = 48 static const DMOptArg optList[] =
49 { 49 {
50 { 0, '?', "help", "Show this help", OPT_NONE }, 50 { 0, '?', "help" , "Show this help", OPT_NONE },
51 { 1, 'v', "verbose", "Be more verbose", OPT_NONE }, 51 { 2, 'v', "verbose" , "Be more verbose", OPT_NONE },
52 { 2, 'i', "ignore", "Ignore errors", OPT_NONE }, 52
53 { 3, 'p', "patterns", "Pattern storage mode", OPT_ARGREQ }, 53 { 10, 'i', "ignore" , "Ignore errors", OPT_NONE },
54 { 4, 'E', "strip-ext-instr","Strip ext. instruments (implies -I -S)", OPT_NONE }, 54 { 12, 'p', "patterns" , "Pattern storage mode", OPT_ARGREQ },
55 { 5, 'I', "strip-instr", "Strip instruments (implies -S)", OPT_NONE }, 55 { 14, 'E', "strip-ext-instr" , "Strip ext. instruments (implies -I -S)", OPT_NONE },
56 { 6, 'S', "strip-samples", "Strip instr. sampledata", OPT_NONE }, 56 { 16, 'I', "strip-instr" , "Strip instruments (implies -S)", OPT_NONE },
57 { 7, '8', "smode8", "8-bit sample conversion flags", OPT_ARGREQ }, 57 { 18, 'S', "strip-samples" , "Strip instr. sampledata", OPT_NONE },
58 { 8, '1', "smode16", "16-bit sample conversion flags", OPT_ARGREQ }, 58 { 20, '8', "smode8" , "8-bit sample conversion flags", OPT_ARGREQ },
59 { 9, 'O', "optimize", "Optimize module", OPT_NONE }, 59 { 22, '1', "smode16" , "16-bit sample conversion flags", OPT_ARGREQ },
60 { 24, 'O', "optimize" , "Optimize module", OPT_NONE },
60 }; 61 };
61 62
62 const int optListN = sizeof(optList) / sizeof(optList[0]); 63 const int optListN = sizeof(optList) / sizeof(optList[0]);
63 64
64 65
84 ); 85 );
85 } 86 }
86 87
87 BOOL argHandleOpt(const int optN, char *optArg, char *currArg) 88 BOOL argHandleOpt(const int optN, char *optArg, char *currArg)
88 { 89 {
89 (void) optArg;
90
91 switch (optN) 90 switch (optN)
92 { 91 {
93 case 0: 92 case 0:
94 argShowHelp(); 93 argShowHelp();
95 exit(0); 94 exit(0);
96 break; 95 break;
97 96
98 case 1: 97
99 dmVerbosity++; 98 case 2:
100 break; 99 dmVerbosity++;
101 100 break;
102 case 2: 101
103 optIgnoreErrors = TRUE; 102 case 10:
104 break; 103 optIgnoreErrors = TRUE;
105 104 break;
106 case 3: 105
107 optPatternMode = atoi(optArg); 106 case 12:
108 if (optPatternMode <= 0 || optPatternMode >= PATMODE_LAST) 107 optPatternMode = atoi(optArg);
109 { 108 if (optPatternMode <= 0 || optPatternMode >= PATMODE_LAST)
110 dmErrorMsg("Unknown pattern conversion mode %d\n", optPatternMode); 109 {
110 dmErrorMsg("Unknown pattern conversion mode %d\n", optPatternMode);
111 return FALSE;
112 }
113 break;
114
115 case 14: optStripExtInstr = TRUE; break;
116 case 16: optStripInstr = TRUE; break;
117 case 18: optStripSamples = TRUE; break;
118
119 case 20: optSampMode8 = atoi(optArg) & JM_SAMPLE_MODE_MASK; break;
120 case 22: optSampMode16 = atoi(optArg) & JM_SAMPLE_MODE_MASK; break;
121
122 case 24: optOptimize = TRUE; break;
123
124 default:
125 dmErrorMsg("Unimplemented option argument '%s'.\n", currArg);
111 return FALSE; 126 return FALSE;
112 }
113 break;
114
115 case 4: optStripExtInstr = TRUE; break;
116 case 5: optStripInstr = TRUE; break;
117 case 6: optStripSamples = TRUE; break;
118
119 case 7: optSampMode8 = atoi(optArg) & JM_SAMPLE_MODE_MASK; break;
120 case 8: optSampMode16 = atoi(optArg) & JM_SAMPLE_MODE_MASK; break;
121
122 case 9: optOptimize = TRUE; break;
123
124 default:
125 dmErrorMsg("Unimplemented option argument '%s'.\n", currArg);
126 return FALSE;
127 } 127 }
128 128
129 return TRUE; 129 return TRUE;
130 } 130 }
131 131