Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
42fd1bb6
Commit
42fd1bb6
authored
Jul 26, 2019
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msg2cmsg also generates python msg files
parent
ec6c4107
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
src/tools/bld/src/rules.mk
src/tools/bld/src/rules.mk
+2
-2
src/tools/exe/tools_msg2cmsg/src/tools_msg2cmsg.c
src/tools/exe/tools_msg2cmsg/src/tools_msg2cmsg.c
+19
-4
No files found.
src/tools/bld/src/rules.mk
View file @
42fd1bb6
...
@@ -16,11 +16,11 @@ endif
...
@@ -16,11 +16,11 @@ endif
$(bld_dir)/%.cmsg $(inc_dir)/%.h
:
%.msg
$(bld_dir)/%.cmsg $(inc_dir)/%.h
:
%.msg
@
$(log_msg_h)
@
$(log_msg_h)
@
$(tools_msg2cmsg)
$(source)
$(bld_dir)
/
$(tname)
.cmsg
$(inc_dir)
/
$(tname)
.h
@
$(tools_msg2cmsg)
$(source)
$(bld_dir)
/
$(tname)
.cmsg
$(inc_dir)
/
$(tname)
.h
$(exe_dir)
/
$(tname)
.py
$(obj_dir)/%.cmsg $(inc_dir)/%.h
:
%.msg
$(obj_dir)/%.cmsg $(inc_dir)/%.h
:
%.msg
@
$(log_msg_h)
@
$(log_msg_h)
@
$(tools_msg2cmsg)
$(source)
$(obj_dir)
/
$(tname)
.cmsg
$(inc_dir)
/
$(tname)
.h
@
$(tools_msg2cmsg)
$(source)
$(obj_dir)
/
$(tname)
.cmsg
$(inc_dir)
/
$(tname)
.h
$(exe_dir)
/
$(tname)
.py
$(obj_dir)/%.o
:
$(obj_dir)/%.cmsg
$(obj_dir)/%.o
:
$(obj_dir)/%.cmsg
@
$(log_cmsg_obj)
@
$(log_cmsg_obj)
...
...
src/tools/exe/tools_msg2cmsg/src/tools_msg2cmsg.c
View file @
42fd1bb6
...
@@ -219,7 +219,7 @@ static void lex(FILE* fp) {
...
@@ -219,7 +219,7 @@ static void lex(FILE* fp) {
}
}
}
}
static
void
WriteFiles
(
char
*
fname
,
FILE
*
cfp
,
FILE
*
hfp
)
static
void
WriteFiles
(
char
*
fname
,
FILE
*
cfp
,
FILE
*
hfp
,
FILE
*
pfp
)
{
{
struct
LstHead
*
fl
;
struct
LstHead
*
fl
;
struct
LstHead
*
ml
;
struct
LstHead
*
ml
;
...
@@ -255,6 +255,8 @@ static void WriteFiles(char* fname, FILE* cfp, FILE* hfp)
...
@@ -255,6 +255,8 @@ static void WriteFiles(char* fname, FILE* cfp, FILE* hfp)
msg
=
facid
+
0x8000
+
(
idx
<<
3
)
+
LstEntry
(
ml
,
sMsgCB
,
MsgL
)
->
Severity
;
msg
=
facid
+
0x8000
+
(
idx
<<
3
)
+
LstEntry
(
ml
,
sMsgCB
,
MsgL
)
->
Severity
;
snprintf
(
name
,
sizeof
(
name
),
"%s%s"
,
prefix
,
LstEntry
(
ml
,
sMsgCB
,
MsgL
)
->
m
.
MsgName
);
snprintf
(
name
,
sizeof
(
name
),
"%s%s"
,
prefix
,
LstEntry
(
ml
,
sMsgCB
,
MsgL
)
->
m
.
MsgName
);
fprintf
(
hfp
,
"#define %-29s %9.9d /* x%08x */
\n
"
,
name
,
msg
,
msg
);
fprintf
(
hfp
,
"#define %-29s %9.9d /* x%08x */
\n
"
,
name
,
msg
,
msg
);
if
(
pfp
)
fprintf
(
pfp
,
"%s = %d
\n
"
,
name
,
msg
);
fprintf
(
cfp
,
"
\t
{
\"
%s
\"
,
\"
%s
\"
}"
,
LstEntry
(
ml
,
sMsgCB
,
MsgL
)
->
m
.
MsgName
,
fprintf
(
cfp
,
"
\t
{
\"
%s
\"
,
\"
%s
\"
}"
,
LstEntry
(
ml
,
sMsgCB
,
MsgL
)
->
m
.
MsgName
,
LstEntry
(
ml
,
sMsgCB
,
MsgL
)
->
m
.
MsgTxt
);
LstEntry
(
ml
,
sMsgCB
,
MsgL
)
->
m
.
MsgTxt
);
idx
++
;
idx
++
;
...
@@ -275,10 +277,11 @@ int main(int argc, char** argv)
...
@@ -275,10 +277,11 @@ int main(int argc, char** argv)
{
{
FILE
*
cfp
=
NULL
;
FILE
*
cfp
=
NULL
;
FILE
*
hfp
=
NULL
;
FILE
*
hfp
=
NULL
;
FILE
*
pfp
=
NULL
;
FILE
*
in
=
NULL
;
FILE
*
in
=
NULL
;
if
(
argc
!=
4
)
{
if
(
!
(
argc
==
4
||
argc
==
5
)
)
{
printf
(
"Usage: co_msg2cmsg msg-file c_msg-file h
_file
\n
"
);
printf
(
"Usage: co_msg2cmsg msg-file c_msg-file h
-file [py-file]
\n
"
);
exit
(
2
);
exit
(
2
);
}
}
...
@@ -301,6 +304,16 @@ int main(int argc, char** argv)
...
@@ -301,6 +304,16 @@ int main(int argc, char** argv)
exit
(
2
);
exit
(
2
);
}
}
if
(
argc
>=
5
)
{
if
(
!
(
pfp
=
fopen
(
argv
[
4
],
"w"
)))
{
printf
(
"Can't open python-output file: %s
\n
"
,
argv
[
4
]);
fclose
(
in
);
fclose
(
cfp
);
fclose
(
hfp
);
exit
(
2
);
}
}
LstInit
(
&
lFacH
);
LstInit
(
&
lFacH
);
lex
(
in
);
lex
(
in
);
...
@@ -314,11 +327,13 @@ int main(int argc, char** argv)
...
@@ -314,11 +327,13 @@ int main(int argc, char** argv)
if
((
p
=
strchr
(
fname
,
'.'
)))
if
((
p
=
strchr
(
fname
,
'.'
)))
*
p
=
'\0'
;
*
p
=
'\0'
;
WriteFiles
(
fname
,
cfp
,
hfp
);
WriteFiles
(
fname
,
cfp
,
hfp
,
pfp
);
fclose
(
in
);
fclose
(
in
);
fclose
(
cfp
);
fclose
(
cfp
);
fclose
(
hfp
);
fclose
(
hfp
);
if
(
pfp
)
fclose
(
pfp
);
return
0
;
return
0
;
}
}
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