annotate libaf/format.c @ 15891:451c9ca8fd47

Only dump to stdout
author ranma
date Sat, 02 Jul 2005 19:35:15 +0000
parents 85dc314b3d80
children 69eadbd92faa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14748
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
1 #include <stdio.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
2 #include <stdlib.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
3 #include <string.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
4 #include <unistd.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
5 #include <inttypes.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
6 #include <limits.h>
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
7
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
8 #include "af.h"
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
9
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
10 // Convert from string to format
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
11 int af_str2fmt(char* str)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
12 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
13 int format=0;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
14 // Scan for endianess
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
15 if(strstr(str,"be") || strstr(str,"BE"))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
16 format |= AF_FORMAT_BE;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
17 else if(strstr(str,"le") || strstr(str,"LE"))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
18 format |= AF_FORMAT_LE;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
19 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
20 format |= AF_FORMAT_NE;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
21
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
22 // Scan for special formats
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
23 if(strstr(str,"mulaw") || strstr(str,"MULAW")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
24 format |= AF_FORMAT_MU_LAW; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
25 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
26 if(strstr(str,"alaw") || strstr(str,"ALAW")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
27 format |= AF_FORMAT_A_LAW; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
28 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
29 if(strstr(str,"ac3") || strstr(str,"AC3")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
30 format |= AF_FORMAT_AC3; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
31 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
32 if(strstr(str,"mpeg2") || strstr(str,"MPEG2")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
33 format |= AF_FORMAT_MPEG2; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
34 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
35 if(strstr(str,"imaadpcm") || strstr(str,"IMAADPCM")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
36 format |= AF_FORMAT_IMA_ADPCM; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
37 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
38
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
39 // Scan for int/float
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
40 if(strstr(str,"float") || strstr(str,"FLOAT")){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
41 format |= AF_FORMAT_F; return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
42 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
43 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
44 format |= AF_FORMAT_I;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
45
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
46 // Scan for signed/unsigned
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
47 if(strstr(str,"unsigned") || strstr(str,"UNSIGNED"))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
48 format |= AF_FORMAT_US;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
49 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
50 format |= AF_FORMAT_SI;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
51
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
52 return format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
53 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
54
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
55 inline int af_fmt2bits(int format)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
56 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
57 return (format & AF_FORMAT_BITS_MASK)+8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
58 // return (((format & AF_FORMAT_BITS_MASK)>>3)+1) * 8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
59 #if 0
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
60 switch(format & AF_FORMAT_BITS_MASK)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
61 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
62 case AF_FORMAT_8BIT: return 8;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
63 case AF_FORMAT_16BIT: return 16;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
64 case AF_FORMAT_24BIT: return 24;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
65 case AF_FORMAT_32BIT: return 32;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
66 case AF_FORMAT_48BIT: return 48;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
67 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
68 #endif
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
69 return -1;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
70 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
71
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
72 inline int af_bits2fmt(int bits)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
73 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
74 return (bits/8 - 1) << 3;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
75 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
76
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
77 /* Convert format to str input str is a buffer for the
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
78 converted string, size is the size of the buffer */
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
79 char* af_fmt2str(int format, char* str, int size)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
80 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
81 int i=0;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
82
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
83 if (size < 1)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
84 return NULL;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
85 size--; // reserve one for terminating 0
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
86
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
87 // Endianess
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
88 if(AF_FORMAT_LE == (format & AF_FORMAT_END_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
89 i+=snprintf(str,size-i,"little-endian ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
90 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
91 i+=snprintf(str,size-i,"big-endian ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
92
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
93 if(format & AF_FORMAT_SPECIAL_MASK){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
94 switch(format & AF_FORMAT_SPECIAL_MASK){
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
95 case(AF_FORMAT_MU_LAW):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
96 i+=snprintf(&str[i],size-i,"mu-law "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
97 case(AF_FORMAT_A_LAW):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
98 i+=snprintf(&str[i],size-i,"A-law "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
99 case(AF_FORMAT_MPEG2):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
100 i+=snprintf(&str[i],size-i,"MPEG-2 "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
101 case(AF_FORMAT_AC3):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
102 i+=snprintf(&str[i],size-i,"AC3 "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
103 case(AF_FORMAT_IMA_ADPCM):
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
104 i+=snprintf(&str[i],size-i,"IMA-ADPCM "); break;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
105 default:
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
106 printf("Unknown special\n");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
107 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
108 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
109 else{
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
110 // Bits
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
111 i+=snprintf(&str[i],size-i,"%d-bit ", af_fmt2bits(format));
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
112
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
113 // Point
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
114 if(AF_FORMAT_F == (format & AF_FORMAT_POINT_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
115 i+=snprintf(&str[i],size-i,"float ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
116 else{
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
117 // Sign
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
118 if(AF_FORMAT_US == (format & AF_FORMAT_SIGN_MASK))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
119 i+=snprintf(&str[i],size-i,"unsigned ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
120 else
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
121 i+=snprintf(&str[i],size-i,"signed ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
122
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
123 i+=snprintf(&str[i],size-i,"int ");
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
124 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
125 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
126 // remove trailing space
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
127 if (i > 0 && str[i - 1] == ' ')
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
128 i--;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
129 str[i] = 0; // make sure it is 0 terminated.
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
130 return str;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
131 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
132
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
133 char *af_fmt2str_short(int format)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
134 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
135 switch(format)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
136 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
137 // special
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
138 case AF_FORMAT_MU_LAW: return "mulaw";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
139 case AF_FORMAT_A_LAW: return "alaw";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
140 case AF_FORMAT_MPEG2: return "mpeg2";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
141 case AF_FORMAT_AC3: return "ac3";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
142 case AF_FORMAT_IMA_ADPCM: return "imaadpcm";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
143 // ordinary
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
144 case AF_FORMAT_U8: return "u8";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
145 case AF_FORMAT_S8: return "s8";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
146 case AF_FORMAT_U16_LE: return "u16le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
147 case AF_FORMAT_U16_BE: return "u16be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
148 case AF_FORMAT_S16_LE: return "s16le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
149 case AF_FORMAT_S16_BE: return "s16be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
150 case AF_FORMAT_U24_LE: return "u24le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
151 case AF_FORMAT_U24_BE: return "u24be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
152 case AF_FORMAT_S24_LE: return "s24le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
153 case AF_FORMAT_S24_BE: return "s24be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
154 case AF_FORMAT_U32_LE: return "u32le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
155 case AF_FORMAT_U32_BE: return "u32be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
156 case AF_FORMAT_S32_LE: return "s32le";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
157 case AF_FORMAT_S32_BE: return "s32be";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
158 case AF_FORMAT_FLOAT_LE: return "floatle";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
159 case AF_FORMAT_FLOAT_BE: return "floatbe";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
160 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
161 return "??";
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
162 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
163
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
164 int af_str2fmt_short(char* str)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
165 {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
166 int i;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
167 static struct {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
168 const char *name;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
169 const int format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
170 } table[] = {
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
171 { "mulaw", AF_FORMAT_MU_LAW },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
172 { "alaw", AF_FORMAT_A_LAW },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
173 { "mpeg2", AF_FORMAT_MPEG2 },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
174 { "ac3", AF_FORMAT_AC3 },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
175 { "imaadpcm", AF_FORMAT_IMA_ADPCM },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
176
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
177 { "u8", AF_FORMAT_U8 },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
178 { "s8", AF_FORMAT_S8 },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
179 { "u16le", AF_FORMAT_U16_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
180 { "u16be", AF_FORMAT_U16_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
181 { "u16ne", AF_FORMAT_U16_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
182 { "s16le", AF_FORMAT_S16_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
183 { "s16be", AF_FORMAT_S16_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
184 { "s16ne", AF_FORMAT_S16_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
185 { "u24le", AF_FORMAT_U24_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
186 { "u24be", AF_FORMAT_U24_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
187 { "u24ne", AF_FORMAT_U24_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
188 { "s24le", AF_FORMAT_S24_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
189 { "s24be", AF_FORMAT_S24_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
190 { "s24ne", AF_FORMAT_S24_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
191 { "u32le", AF_FORMAT_U32_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
192 { "u32be", AF_FORMAT_U32_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
193 { "u32ne", AF_FORMAT_U32_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
194 { "s32le", AF_FORMAT_S32_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
195 { "s32be", AF_FORMAT_S32_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
196 { "s32ne", AF_FORMAT_S32_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
197 { "floatle", AF_FORMAT_FLOAT_LE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
198 { "floatbe", AF_FORMAT_FLOAT_BE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
199 { "floatne", AF_FORMAT_FLOAT_NE },
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
200
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
201 { NULL, 0 }
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
202 };
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
203
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
204 for (i = 0; table[i].name; i++)
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
205 if (!strcasecmp(str, table[i].name))
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
206 return table[i].format;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
207
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
208 return -1;
85dc314b3d80 move the format related stuff to format.c
alex
parents:
diff changeset
209 }