Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
fa9dede4
Commit
fa9dede4
authored
May 06, 2012
by
Alejandro Mery
Browse files
fex2bin: temporarily introduce VERBOSE define to silent the parser (need getopt)
parent
97976d05
Changes
1
Hide whitespace changes
Inline
Side-by-side
fex2bin.c
View file @
fa9dede4
...
@@ -121,9 +121,11 @@ static int parse_fex(FILE *in, const char *filename, struct script *script)
...
@@ -121,9 +121,11 @@ static int parse_fex(FILE *in, const char *filename, struct script *script)
/* string */
/* string */
p
++
;
*--
pe
=
'\0'
;
p
++
;
*--
pe
=
'\0'
;
if
(
script_string_entry_new
(
last_section
,
key
,
pe
-
p
,
p
))
{
if
(
script_string_entry_new
(
last_section
,
key
,
pe
-
p
,
p
))
{
#ifdef VERBOSE
errf
(
"%s.%s =
\"
%.*s
\"\n
"
,
errf
(
"%s.%s =
\"
%.*s
\"\n
"
,
last_section
->
name
,
key
,
last_section
->
name
,
key
,
(
int
)(
pe
-
p
),
p
);
(
int
)(
pe
-
p
),
p
);
#endif
continue
;
continue
;
}
}
perror
(
"malloc"
);
perror
(
"malloc"
);
...
@@ -141,7 +143,6 @@ static int parse_fex(FILE *in, const char *filename, struct script *script)
...
@@ -141,7 +143,6 @@ static int parse_fex(FILE *in, const char *filename, struct script *script)
else
if
(
v
<
0
||
v
>
255
)
{
else
if
(
v
<
0
||
v
>
255
)
{
errf
(
"E: %s:%zu: port out of range at %zu (%ld).
\n
"
,
errf
(
"E: %s:%zu: port out of range at %zu (%ld).
\n
"
,
filename
,
line
,
p
-
buffer
+
1
,
v
);
filename
,
line
,
p
-
buffer
+
1
,
v
);
goto
parse_error
;
}
else
{
}
else
{
int
data
[]
=
{
-
1
,
-
1
,
-
1
,
-
1
};
int
data
[]
=
{
-
1
,
-
1
,
-
1
,
-
1
};
int
port_num
=
v
;
int
port_num
=
v
;
...
@@ -172,10 +173,12 @@ static int parse_fex(FILE *in, const char *filename, struct script *script)
...
@@ -172,10 +173,12 @@ static int parse_fex(FILE *in, const char *filename, struct script *script)
goto
invalid_char_at_p
;
goto
invalid_char_at_p
;
if
(
script_gpio_entry_new
(
last_section
,
key
,
if
(
script_gpio_entry_new
(
last_section
,
key
,
port
,
port_num
,
data
))
{
port
,
port_num
,
data
))
{
#ifdef VERBOSE
errf
(
"%s.%s = GPIO %d.%d (%d,%d,%d,%d)
\n
"
,
errf
(
"%s.%s = GPIO %d.%d (%d,%d,%d,%d)
\n
"
,
last_section
->
name
,
key
,
last_section
->
name
,
key
,
port
,
port_num
,
port
,
port_num
,
data
[
0
],
data
[
1
],
data
[
2
],
data
[
3
]);
data
[
0
],
data
[
1
],
data
[
2
],
data
[
3
]);
#endif
continue
;
continue
;
}
}
perror
(
"malloc"
);
perror
(
"malloc"
);
...
@@ -192,8 +195,10 @@ static int parse_fex(FILE *in, const char *filename, struct script *script)
...
@@ -192,8 +195,10 @@ static int parse_fex(FILE *in, const char *filename, struct script *script)
errf
(
"E: %s:%zu: value out of range %lld.
\n
"
,
errf
(
"E: %s:%zu: value out of range %lld.
\n
"
,
filename
,
line
,
v
);
filename
,
line
,
v
);
}
else
if
(
script_single_entry_new
(
last_section
,
key
,
v
))
{
}
else
if
(
script_single_entry_new
(
last_section
,
key
,
v
))
{
#ifdef VERBOSE
errf
(
"%s.%s = %lld
\n
"
,
errf
(
"%s.%s = %lld
\n
"
,
last_section
->
name
,
key
,
v
);
last_section
->
name
,
key
,
v
);
#endif
continue
;
continue
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment