693f1e87154947811c9ac21a092b5aefe1f38836
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

1) /*
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

2)  * EtherPix library
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

3)  *
Stefan Schuermans update copyright year

Stefan Schuermans authored 7 years ago

4)  * Copyright 2010-2017 Stefan Schuermans <stefan schuermans info>
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

5)  *
6)  * This program is free software: you can redistribute it and/or modify
7)  * it under the terms of the GNU General Public License as published by
8)  * the Free Software Foundation, version 3 of the License.
9)  *
10)  *
11)  * This program is distributed in the hope that it will be useful,
12)  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13)  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14)  * GNU General Public License for more details.
15)  *
16)  * You should have received a copy of the GNU Lesser General Public License
17)  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18)  */
19) 
20) #include <errno.h>
21) #include <stdio.h>
22) #include <stdlib.h>
23) #include <string.h>
24) 
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

25) #include <etherpix/msg.h>
26) #include <etherpix/types.h>
Stefan Schuermans move internal includes

Stefan Schuermans authored 7 years ago

27) #include "const_data.h"
28) #include "constants.h"
29) #include "config.h"
30) #include "mapping.h"
31) #include "missing.h"
32) #include "net.h"
33) #include "parse.h"
34) #include "strtod_noloc.h"
35) #include "types.h"
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

36) 
37) /**
38)  * \brief process distributor from config file
39)  *
40)  * \param[in,out] p_ctx context information
41)  * \param[in] p_setting_part2 second half of setting to process
42)  * \param[in] p_value value of setting
43)  * \return 0 in case of success, -1 in case of error
44)  */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

45) int etp_config_proc_distri(etp_config_ctx_t *p_ctx, char *p_setting_part2,
Stefan Schuermans value -> p_value for consis...

Stefan Schuermans authored 7 years ago

46)                            char *p_value)
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

47) {
48)   char *ptr;
49)   unsigned long val;
50)   unsigned int distri, out, pix, i;
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

51)   etp_distri_t *p_distri;
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

52) 
53)   /* get distributor number */
54)   val = strtoul(p_setting_part2, &ptr, 0);
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

55)   if (ptr == p_setting_part2 || *ptr != 0 || val >= ETP_DISTRI_MAX_CNT) {
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

56)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

57)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

58)                         "invalid distributor number \"%s\""
59)                         " in line %u of config file\n",
60)                         p_setting_part2, p_ctx->line_no);
61)     return -1;
62)   }
63)   distri = (unsigned int)val;
64) 
65)   /* get number of outputs and pixels */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

66)   if (etp_parse_two_nos(p_value, &out, &pix, &ptr) || *ptr != 0) {
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

67)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

68)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

69)                         "invalid distributor size \"%s\""
70)                         " in line %u of config file\n",
Stefan Schuermans value -> p_value for consis...

Stefan Schuermans authored 7 years ago

71)                         p_value, p_ctx->line_no);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

72)     return -1;
73)   }
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

74)   if (out >= ETP_OUTPUT_MAX_CNT) {
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

75)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

76)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

77)                         "invalid number of outputs \"%u\""
78)                         " in line %u of config file\n",
79)                         out, p_ctx->line_no);
80)     return -1;
81)   }
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

82)   if (pix >= ETP_PIXEL_MAX_CNT) {
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

83)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

84)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

85)                         "invalid number of pixels \"%u\""
86)                         " in line %u of config file\n",
87)                         pix, p_ctx->line_no);
88)     return -1;
89)   }
90) 
91)   /* check if distributor is already present */
92)   if (p_ctx->p_display->distri_ptrs[distri]) {
93)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

94)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

95)                         "duplicate definition of distributor \"%u\""
96)                         " in line %u of config file\n",
97)                         distri, p_ctx->line_no);
98)     return -1;
99)   }
100) 
101)   /* create a new distributor */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

102)   p_distri = (etp_distri_t *)malloc(sizeof (etp_distri_t));
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

103)   if (!p_distri) {
104)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

105)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err, "out of memory\n");
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

106)     return -1;
107)   }
108)   p_distri->distri = distri;
109)   p_distri->output_cnt = out;
110)   p_distri->pixel_cnt = pix;
Stefan Schuermans support multiple addresses...

Stefan Schuermans authored 7 years ago

111)   /* no network address yet */
112)   p_distri->addr_cnt = 0;
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

113)   /* initialize mapping information */
114)   for (i = 0; i < 3; i++) {
115)     p_distri->mapping[i].base = 0.0;
116)     p_distri->mapping[i].gamma = 1.0;
117)     p_distri->mapping[i].factor = 1.0;
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

118)     etp_mapping_precalc(&p_distri->mapping[i]);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

119)   }
120)   /* create and initialize pixel array */
121)   p_distri->p_pixels =
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

122)     (etp_pixel_t *)malloc(out * pix * sizeof (etp_pixel_t));
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

123)   if (!p_distri->p_pixels) {
124)     free(p_distri);
125)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

126)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err, "out of memory\n");
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

127)     return -1;
128)   }
129)   for (i = 0; i < out * pix; i++) {
130)     p_distri->p_pixels[i].x = -1;
131)     p_distri->p_pixels[i].y = -1;
132)   }
133)   /* create and initialize message buffer */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

134)   p_distri->msg_len = ETP_MCUF_HDR_LEN + out * pix * 3;
135)   p_distri->p_msg_buf = (etp_u8_t *)malloc(p_distri->msg_len);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

136)   if (!p_distri->p_msg_buf) {
137)     free(p_distri->p_pixels);
138)     free(p_distri);
139)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

140)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err, "out of memory\n");
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

141)     return -1;
142)   }
143)   memset(p_distri->p_msg_buf, 0, p_distri->msg_len);
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

144)   memcpy(p_distri->p_msg_buf, etp_mcuf_hdr, ETP_MCUF_HDR_LEN);
Stefan Schuermans support more pixels per output

Stefan Schuermans authored 7 years ago

145)   p_distri->p_msg_buf[ETP_MCUF_HDR_OFS_OUTPUTS_U16 + 0] = (etp_u8_t)(out >> 8);
146)   p_distri->p_msg_buf[ETP_MCUF_HDR_OFS_OUTPUTS_U16 + 1] = (etp_u8_t)out;
147)   p_distri->p_msg_buf[ETP_MCUF_HDR_OFS_PIXELS_U16 + 0] = (etp_u8_t)(pix >> 8);
148)   p_distri->p_msg_buf[ETP_MCUF_HDR_OFS_PIXELS_U16 + 1] = (etp_u8_t)pix;
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

149)   /* store pointer to distributor */
150)   p_ctx->p_display->distri_ptrs[distri] = p_distri;
151) 
152)   /* count distributors */
153)   p_ctx->p_display->distri_cnt++;
154) 
155)   return 0;
156) }
157) 
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

158) /**
159)  * \brief process distributor address from config file
160)  *
161)  * \param[in,out] p_ctx context information
162)  * \param[in] p_setting_part2 second half of setting to process
163)  * \param[in] p_value value of setting
164)  * \return 0 in case of success, -1 in case of error
165)  */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

166) int etp_config_proc_distri_addr(etp_config_ctx_t *p_ctx, char *p_setting_part2,
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

167)                                 char *p_value)
168) {
169)   char *ptr;
170)   unsigned long val;
171)   unsigned int distri;
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

172)   etp_distri_t *p_distri;
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

173) 
174)   /* get distributor number */
175)   val = strtoul(p_setting_part2, &ptr, 0);
Stefan Schuermans stricter parsing for distri...

Stefan Schuermans authored 7 years ago

176)   if (ptr == p_setting_part2 || *ptr != 0) {
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

177)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

178)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

179)                         "invalid mapping specifier \"%s\""
180)                         " in line %u of config file\n",
181)                         p_setting_part2, p_ctx->line_no);
182)     return -1;
183)   }
184)   distri = (unsigned int)val;
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

185)   if (distri >= ETP_DISTRI_MAX_CNT) {
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

186)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

187)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

188)                         "invalid distributor number \"%u\""
189)                         " in line %u of config file\n",
190)                         distri, p_ctx->line_no);
191)     return -1;
192)   }
193) 
194)   /* get distributor */
195)   p_distri = p_ctx->p_display->distri_ptrs[distri];
196)   if (!p_distri) {
197)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

198)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

199)                         "no distributor with number \"%u\""
200)                         " in line %u of config file\n",
201)                         distri, p_ctx->line_no);
202)     return -1;
203)   }
204) 
Stefan Schuermans support multiple addresses...

Stefan Schuermans authored 7 years ago

205)   /* check if maximum number of addresses reached */
206)   if (p_distri->addr_cnt >= ETP_DISTRI_MAX_ADDRS) {
207)     if (p_ctx->p_msg_func)
208)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
209)                         "too many addresses (\"%s\") for distributor with"
210)                         " number \"%u\" in line %u of config file\n",
211)                         p_value, distri, p_ctx->line_no);
212)     return -1;
213)   }
214) 
215)   /* get address and add it to distributor */
216)   if (etp_parse_addr(p_value, &p_distri->addrs[p_distri->addr_cnt])) {
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

217)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

218)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

219)                         "invalid address \"%s\" for distributor with number"
220)                         " \"%u\" in line %u of config file\n",
221)                         p_value, distri, p_ctx->line_no);
222)     return -1;
223)   }
Stefan Schuermans support multiple addresses...

Stefan Schuermans authored 7 years ago

224)   ++p_distri->addr_cnt;
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

225) 
226)   return 0;
227) }
228) 
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

229) /**
230)  * \brief process mapping from config file
231)  *
232)  * \param[in,out] p_ctx context information
233)  * \param[in] p_setting_part2 second half of setting to process
234)  * \param[in] p_value value of setting
235)  * \return 0 in case of success, -1 in case of error
236)  */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

237) int etp_config_proc_mapping(etp_config_ctx_t *p_ctx, char *p_setting_part2,
Stefan Schuermans value -> p_value for consis...

Stefan Schuermans authored 7 years ago

238)                             char *p_value)
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

239) {
240)   char *ptr, *ptr2;
241)   unsigned long val;
242)   unsigned int distri, chan;
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

243)   etp_distri_t *p_distri;
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

244)   double base, factor, gamma;
245) 
246)   /* get distributor number */
247)   val = strtoul(p_setting_part2, &ptr, 0);
248)   if (ptr == p_setting_part2
249)       || (*ptr != 0 && *ptr != ' ' && *ptr != '\t'
250)           && *ptr != '\r' && *ptr != '\n')) {
251)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

252)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

253)                         "invalid mapping specifier \"%s\""
254)                         " in line %u of config file\n",
255)                         p_setting_part2, p_ctx->line_no);
256)     return -1;
257)   }
258)   distri = (unsigned int)val;
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

259)   if (distri >= ETP_DISTRI_MAX_CNT) {
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

260)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

261)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

262)                         "invalid distributor number \"%u\""
263)                         " in line %u of config file\n",
264)                         distri, p_ctx->line_no);
265)     return -1;
266)   }
267) 
268)   /* get channel */
269)   while (*ptr == ' ' || *ptr == '\t' || *ptr == '\r' || *ptr == '\n')
270)     ptr++;
271)   if (!strcmp(ptr, "red"))
272)     chan = 0;
273)   else if (!strcmp(ptr, "green"))
274)     chan = 1;
275)   else if (!strcmp(ptr, "blue"))
276)     chan = 2;
277)   else {
278)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

279)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

280)                         "invalid channel \"%s\""
281)                         " in line %u of config file\n", ptr,
282)                         p_ctx->line_no);
283)     return -1;
284)   }
285) 
286)   /* get distributor */
287)   p_distri = p_ctx->p_display->distri_ptrs[distri];
288)   if (!p_distri) {
289)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

290)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

291)                         "no distributor with number \"%u\""
292)                         " in line %u of config file\n",
293)                         distri, p_ctx->line_no);
294)     return -1;
295)   }
296) 
297)   /* get mapping parameters: base, factor, gamma */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

298)   base = etp_strtod_noloc(p_value, &ptr);
Stefan Schuermans value -> p_value for consis...

Stefan Schuermans authored 7 years ago

299)   if (ptr == p_value
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

300)       || (*ptr != 0 && *ptr != ' ' && *ptr != '\t'
301)           && *ptr != '\r' && *ptr != '\n')) {
302)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

303)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

304)                         "invalid mapping parameters \"%s\""
305)                         " in line %u of config file\n",
Stefan Schuermans value -> p_value for consis...

Stefan Schuermans authored 7 years ago

306)                         p_value, p_ctx->line_no);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

307)     return -1;
308)   }
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

309)   factor = etp_strtod_noloc(ptr, &ptr2);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

310)   if (ptr2 == ptr
311)       || (*ptr2 != 0 && *ptr2 != ' ' && *ptr2 != '\t'
312)           && *ptr2 != '\r' && *ptr2 != '\n')) {
313)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

314)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

315)                         "invalid mapping parameters \"%s\""
316)                         " in line %u of config file\n",
Stefan Schuermans value -> p_value for consis...

Stefan Schuermans authored 7 years ago

317)                         p_value, p_ctx->line_no);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

318)     return -1;
319)   }
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

320)   gamma = etp_strtod_noloc(ptr2, &ptr);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

321)   if (ptr == ptr2
322)       || (*ptr != 0 && *ptr != ' ' && *ptr != '\t'
323)           && *ptr != '\r' && *ptr != '\n')) {
324)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

325)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

326)                         "invalid mapping parameters \"%s\""
327)                         " in line %u of config file\n",
Stefan Schuermans value -> p_value for consis...

Stefan Schuermans authored 7 years ago

328)                         p_value, p_ctx->line_no);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

329)     return -1;
330)   }
331)   if (gamma <= 0.0) {
332)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

333)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

334)                         "invalid gamma value \"%f\""
335)                         " in line %u of config file\n",
336)                         gamma, p_ctx->line_no);
337)     return -1;
338)   }
339) 
340)   /* store new mapping parameters and re-calculate mapping table */
341)   p_distri->mapping[chan].base = base;
342)   p_distri->mapping[chan].factor = factor;
343)   p_distri->mapping[chan].gamma = gamma;
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

344)   etp_mapping_precalc(&p_distri->mapping[chan]);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

345) 
346)   return 0;
347) }
348) 
349) /**
350)  * \brief process pixel from config file
351)  *
352)  * \param[in,out] p_ctx context information
353)  * \param[in] sz_pixel text of pixel to process
354)  * \param[in] distri number of distributor
355)  * \param[in] out number of output
356)  * \param[in] pix number of pixel
357)  * \return 0 in case of success, -1 in case of error
358)  */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

359) int etp_config_proc_pixel(etp_config_ctx_t *p_ctx, char *sz_pixel,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

360)                           unsigned int distri, unsigned int out,
361)                           unsigned int pix)
362) {
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

363)   etp_distri_t *p_distri = p_ctx->p_display->distri_ptrs[distri];
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

364)   char *ptr;
365)   unsigned int x, y, idx;
366) 
367)   /* get coordinates of pixel */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

368)   if (etp_parse_two_nos(sz_pixel, &x, &y, &ptr) || *ptr != 0
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

369)       || (int)x < 0 || (int)x >= p_ctx->p_display->size.x
370)       || (int)y < 0 || (int)y >= p_ctx->p_display->size.y) {
371)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

372)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

373)                         "invalid pixel \"%s\""
374)                         " in line %u of config file\n",
375)                         sz_pixel, p_ctx->line_no);
376)     return -1;
377)   }
378) 
379)   /* check pixel number */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

380)   if (pix >= ETP_PIXEL_MAX_CNT || pix >= p_distri->pixel_cnt) {
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

381)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

382)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

383)                         "too many pixels (more than %u)"
384)                         " in line %u of config file\n",
385)                         p_distri->pixel_cnt, p_ctx->line_no);
386)     return -1;
387)   }
388) 
389)   /* check that pixel is not yet set */
390)   idx = out * p_distri->pixel_cnt + pix;
391)   if (p_distri->p_pixels[idx].x >= 0
392)       && p_distri->p_pixels[idx].y >= 0) {
393)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

394)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

395)                         "pixel %u of output %u of distributor %u already set"
396)                         " to pixel %u,%u in line %u of config file\n",
397)                         pix, out, distri, p_distri->p_pixels[idx].x,
398)                  p_distri->p_pixels[idx].y, p_ctx->line_no);
399)     return -1;
400)   }
401) 
402)   /* set pixel coordinates */
403)   p_distri->p_pixels[idx].x = x;
404)   p_distri->p_pixels[idx].y = y;
405) 
406)   /* count pixels in total */
407)   p_ctx->p_display->pixel_cnt++;
408) 
409)   return 0;
410) }
411) 
412) /**
413)  * \brief process output from config file
414)  *
415)  * \param[in,out] p_ctx context information
416)  * \param[in] p_setting_part2 second half of setting to process
417)  * \param[in] p_value value of setting
418)  * \return 0 in case of success, -1 in case of error
419)  */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

420) int etp_config_proc_output(etp_config_ctx_t *p_ctx, char *p_setting_part2,
Stefan Schuermans value -> p_value for consis...

Stefan Schuermans authored 7 years ago

421)                            char *p_value)
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

422) {
423)   char *ptr, *p_pos, *p_white, white;
424)   unsigned int distri, out, pix;
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

425)   etp_distri_t *p_distri;
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

426)   int err;
427) 
428)   /* get number of distributor and output */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

429)   if (etp_parse_two_nos(p_setting_part2, &distri, &out, &ptr) || *ptr != 0) {
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

430)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

431)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

432)                         "invalid output specifier \"%s\""
433)                         " in line %u of config file\n",
434)                         p_setting_part2, p_ctx->line_no);
435)     return -1;
436)   }
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

437)   if (distri >= ETP_DISTRI_MAX_CNT) {
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

438)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

439)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

440)                         "invalid distributor number \"%u\""
441)                         " in line %u of config file\n",
442)                         distri, p_ctx->line_no);
443)     return -1;
444)   }
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

445)   if (out >= ETP_OUTPUT_MAX_CNT) {
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

446)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

447)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

448)                         "invalid output number \"%u\""
449)                         " in line %u of config file\n",
450)                         out, p_ctx->line_no);
451)     return -1;
452)   }
453) 
454)   /* get distributor */
455)   p_distri = p_ctx->p_display->distri_ptrs[distri];
456)   if (!p_distri) {
457)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

458)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

459)                         "no distributor with number \"%u\""
460)                         " in line %u of config file\n",
461)                         distri, p_ctx->line_no);
462)     return -1;
463)   }
464)   /* check output number */
465)   if (out >= p_distri->output_cnt) {
466)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

467)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

468)                         "no output with output number \"%u\""
469)                         " in line %u of config file\n",
470)                         out, p_ctx->line_no);
471)     return -1;
472)   }
473) 
474)   /* count outputs */
475)   p_ctx->p_display->output_cnt++;
476) 
477)   /* process pixels */
478) 
479)   /* process all parts separated by whitespace */
Stefan Schuermans value -> p_value for consis...

Stefan Schuermans authored 7 years ago

480)   p_pos = p_value;
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

481)   err = 0;
482)   pix = 0;
483)   while (*p_pos != 0) {
484) 
485)     /* get end of item (first whitespace) */
486)     for (p_white = p_pos;
487)          *p_white && *p_white != ' ' && *p_white != '\t'
488)          && *p_white != '\r' && *p_white != '\n'; p_white++);
489) 
490)     /* process item: a pixel */
491)     white = *p_white; /* terminate item */
492)     *p_white = 0;
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

493)     if (etp_config_proc_pixel(p_ctx, p_pos, distri, out, pix)) /* process */
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

494)       err = -1;       /* remember errors */
495)     pix++;            /* count pixels */
496)     *p_white = white; /* undo termination */
497) 
498)     /* skip whitespace and continue after it */
499)     for (;
500)          *p_white == ' ' || *p_white == '\t'
501)          || *p_white == '\r' || *p_white == '\n'; p_white++);
502)     p_pos = p_white;
503) 
504)   } /* while (*p_pos != 0) */
505) 
506)   return err;
507) }
508) 
509) /**
510)  * \brief process setting from config file
511)  *
512)  * \param[in,out] p_ctx context information
513)  * \param[in] p_setting setting to process
514)  * \param[in] p_value value of setting
515)  * \return 0 in case of success, -1 in case of error
516)  */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

517) int etp_config_proc_setting(etp_config_ctx_t *p_ctx, char *p_setting,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

518)                             char *p_value)
519) {
520)   char *ptr;
521)   unsigned int x, y;
522) 
523)   /* replace all whitespace with spaces in setting */
524)   while ((ptr = strchr(p_setting, '\t')))
525)     *ptr = ' ';
526)   while ((ptr = strchr(p_setting, '\r')))
527)     *ptr = ' ';
528)   while ((ptr = strchr(p_setting, '\n')))
529)     *ptr = ' ';
530) 
531)   /* bind address for UDP output */
532)   if (!strcmp(p_setting, "bindAddr")) {
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

533)     if (etp_parse_addr(p_value, &p_ctx->p_display->bind_addr)) {
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

534)       if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

535)         p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

536)                           "invalid address \"%s\" for \"%s\""
537)                           " in line %u of config file\n",
538)                           p_value, p_setting, p_ctx->line_no);
539)       return -1;
540)     }
541)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

542)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_info, "bind address: %s\n", p_value);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

543)     return 0;
544)   }
545) 
546)   /* size of display */
547)   if (!strcmp(p_setting, "size")) {
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

548)     if (etp_parse_two_nos(p_value, &x, &y, &ptr)
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

549)         || (int)x <= 0 || (int)y <= 0) {
550)       if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

551)         p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

552)                           "invalid value \"%s\" for \"%s\""
553)                           " in line %u of config file\n",
554)                           p_value, p_setting, p_ctx->line_no);
555)       return -1;
556)     }
557)     p_ctx->p_display->size.x = x;
558)     p_ctx->p_display->size.y = y;
559)     return 0;
560)   }
561) 
562)   /* distributor */
563)   if (!strncmp(p_setting, "distributor ", 12))
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

564)     return etp_config_proc_distri(p_ctx, p_setting + 12, p_value);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

565) 
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

566)   /* distributor address */
567)   if (!strncmp(p_setting, "distributorAddr ", 16))
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

568)     return etp_config_proc_distri_addr(p_ctx, p_setting + 16, p_value);
Stefan Schuermans add support for configuring...

Stefan Schuermans authored 7 years ago

569) 
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

570)   /* mapping */
571)   if (!strncmp(p_setting, "mapping ", 8))
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

572)     return etp_config_proc_mapping(p_ctx, p_setting + 8, p_value);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

573) 
574)   /* output */
575)   if (!strncmp(p_setting, "output ", 7))
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

576)     return etp_config_proc_output(p_ctx, p_setting + 7, p_value);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

577) 
578)   /* unknown setting */
579)   if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

580)     p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_warn,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

581)                       "unknown setting \"%s\""
582)                       " in line %u of config file, ignored\n",
583)                       p_setting, p_ctx->line_no);
584)   return 0;
585) }
586) 
587) /**
588)  * \brief process line from config file
589)  *
590)  * \param[in,out] p_ctx context information
591)  * \param[in] p_line line to process
592)  * \return 0 in case of success, -1 in case of error
593)  */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

594) int etp_config_proc_line(etp_config_ctx_t *p_ctx, char *p_line)
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

595) {
596)   char *p_hash, *p_equal, *p_setting, *p_value;
597)   int i;
598) 
599)   /* remove comment */
600)   p_hash = strchr(p_line, '#');
601)   if (p_hash)
602)     *p_hash = 0;
603) 
604)   /* remove trailing whitespace */
605)   for (i = strlen(p_line) - 1;
606)        i >= 0 && (p_line[i] == ' ' || p_line[i] == '\t'
607)                   || p_line[i] == '\r' || p_line[i] == '\n'); i--)
608)     p_line[i] = 0;
609) 
610)   /* remove leading whitespace */
611)   for (; *p_line == ' ' || *p_line == '\t'
612)          || *p_line == '\r' || *p_line == '\n'; p_line++);
613) 
614)   /* ignore empty line */
615)   if (!p_line[0])
616)     return 0;
617) 
618)   /* find equal sign */
619)   p_equal = strchr(p_line, '=');
620)   if (!p_equal) {               /* no equal sign found */
621)     if (p_ctx->p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

622)       p_ctx->p_msg_func(p_ctx->p_msg_ctx, etp_msg_type_warn,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

623)                         "invalid line %u in config file, ignored\n",
624)                         p_ctx->line_no);
625)     return 0;
626)   }
627) 
628)   /* split string at equal sign */
629)   *p_equal = 0;
630)   p_setting = p_line;
631)   p_value = p_equal + 1;
632) 
633)   /* remove trailing whitespaces in setting name */
634)   for (i = strlen(p_setting) - 1;
635)        i >= 0 && (p_setting[i] == ' ' || p_setting[i] == '\t'
636)                   || p_setting[i] == '\r' || p_setting[i] == '\n'); i--)
637)     p_setting[i] = 0;
638) 
639)   /* remove leading whitespaces in value */
640)   for (; *p_value == ' ' || *p_value == '\t'
641)          || *p_value == '\r' || *p_value == '\n'; p_value++);
642) 
643)   /* process setting */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

644)   return etp_config_proc_setting(p_ctx, p_setting, p_value);
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

645) }
646) 
Stefan Schuermans support multiple addresses...

Stefan Schuermans authored 7 years ago

647) /**
648)  * \brief set default addresses of distributors
649)  * \param[in,out] p_ctx context information
650)  */
651) static void etp_config_set_def_distri_addrs(etp_config_ctx_t *p_ctx)
652) {
653)   unsigned int distri;
654)   etp_distri_t *p_distri;
655) 
656)   /* set default addresses of distributors */
657)   for (distri = 0; distri < ETP_DISTRI_MAX_CNT; distri++) {
658)     p_distri = p_ctx->p_display->distri_ptrs[distri];
659)     if (p_distri) {
660) 
661)       /* no address yet -> use default */
662)       if (p_distri->addr_cnt == 0) {
663)         p_distri->addr_cnt = 1;
664)         p_distri->addrs[0].sin_family = AF_INET;
665)         p_distri->addrs[0].sin_addr.s_addr =
666)             htonl(ETP_DEST_IP_BASE + p_distri->distri * ETP_DEST_IP_STEP);
667)         p_distri->addrs[0].sin_port = htons(ETP_DEST_PORT);
668)       }
669) 
670)     }  // if (p_distri)
671)   } // for (distri ...)
672) }
673) 
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

674) /**
675)  * \brief process config file
676)  *
677)  * \param[in,out] p_display display to configure
678)  * \param[in] sz_config_file name of config file to read
679)  * \param[in] p_msg_func message callback function or NULL
680)  * \param[in] p_msg_ctx user context for message callback
681)  * \return 0 in case of success, -1 in case of error
682)  */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

683) int etp_config_proc_file(etp_display_t *p_display,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

684)                          const char *sz_config_file,
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

685)                          etp_msg_func_p_t p_msg_func, void *p_msg_ctx)
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

686) {
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

687)   etp_config_ctx_t ctx;
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

688)   FILE *file;
689) 
690)   /* set up context */
691)   ctx.p_display = p_display;
692)   ctx.p_msg_func = p_msg_func;
693)   ctx.p_msg_ctx = p_msg_ctx;
694) 
695)   /* check if file is present */
696)   if (!sz_config_file || !sz_config_file[0]) {
697)     if (p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

698)       p_msg_func(p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

699)                  "no config file specified\n");
700)     return -1;
701)   }
702) 
703)   if (p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

704)     p_msg_func(p_msg_ctx, etp_msg_type_info,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

705)                "using config file \"%s\"\n",
706)                sz_config_file);
707) 
708)   /* open file */
709)   file = fopen(sz_config_file, "rt");
710)   if (!file) {
Stefan Schuermans v1.0.2

Stefan Schuermans authored 13 years ago

711)     if (p_msg_func) {
712)       char errmsg[256];
713)       strerror_r(errno, errmsg, sizeof(errmsg));
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

714)       p_msg_func(p_msg_ctx, etp_msg_type_err,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

715)                  "cannot open config file \"%s\" for reading: %s\n",
Stefan Schuermans v1.0.2

Stefan Schuermans authored 13 years ago

716)                  sz_config_file, errmsg);
717)     }
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

718)     return -1;
719)   }
720) 
721)   /* process lines in file */
722)   ctx.line_no = 1;
723)   while (!feof(file)) {
724)     char line[4096], *p_lf;
725) 
726)     /* read a line */
727)     line[0] = 0;
Stefan Schuermans adaptions for gcc 5

Stefan Schuermans authored 7 years ago

728)     if (fgets(line, sizeof (line), file) == NULL)
729)       break;
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

730)     p_lf = strchr(line, '\n'); /* find LF in line in replace it with 0 */
731)     if (p_lf)
732)       *p_lf = 0;
733)     else {                     /* no LF in line */
734)       if (!feof(file)) {       /* not at end of file */
735)         char dummy[4096];
736)         if (p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

737)           p_msg_func(p_msg_ctx, etp_msg_type_warn,
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

738)                      "line %u too long in config file, truncated\n",
739)                      ctx.line_no);
740)         /* jump over in rest of line */
741)         dummy[0] = 0;
742)         while (!feof(file) && !strchr(dummy, '\n'))
Stefan Schuermans adaptions for gcc 5

Stefan Schuermans authored 7 years ago

743)           if (fgets(dummy, sizeof (dummy), file) == NULL)
744)             break;
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

745)       }
746)     }
747) 
748)     /* process line from file */
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

749)     if (etp_config_proc_line(&ctx, line))
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

750)       return -1;
751) 
752)     ctx.line_no++;
753)   }
754) 
755)   /* close file */
756)   fclose(file);
757) 
Stefan Schuermans support multiple addresses...

Stefan Schuermans authored 7 years ago

758)   /* set default addresses of distributors */
759)   etp_config_set_def_distri_addrs(&ctx);
760) 
Stefan Schuermans v1.0.0

Stefan Schuermans authored 13 years ago

761)   if (p_msg_func)
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

762)     p_msg_func(p_msg_ctx, etp_msg_type_info,