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
bc33b8d2
Commit
bc33b8d2
authored
Oct 17, 2013
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remote buffer include file parser, support for alignment in classes (refs #138)
parent
2d6dc9a1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
175 additions
and
133 deletions
+175
-133
src/lib/co/src/co_dcli.h
src/lib/co/src/co_dcli.h
+1
-0
src/lib/co/src/co_dcli_struct.c
src/lib/co/src/co_dcli_struct.c
+170
-132
src/msg/co/src/co_dcli_msg.msg
src/msg/co/src/co_dcli_msg.msg
+1
-1
xtt/lib/xtt/src/xtt_xnav.cpp
xtt/lib/xtt/src/xtt_xnav.cpp
+3
-0
No files found.
src/lib/co/src/co_dcli.h
View file @
bc33b8d2
...
...
@@ -138,6 +138,7 @@ typedef struct s_element {
int
type
;
int
size
;
int
elements
;
int
alignment
;
int
undefined
;
char
typestr
[
40
];
char
struct_begin
;
...
...
src/lib/co/src/co_dcli_struct.c
View file @
bc33b8d2
...
...
@@ -467,6 +467,7 @@ static int add_element( t_ctx ctx,
int
undefined
;
int
struct_begin
;
unsigned
int
mask
;
int
alignment
=
0
;
memset
(
line_elem
,
0
,
sizeof
(
line_elem
));
nr
=
dcli_parse
(
line
,
" ;"
,
""
,
...
...
@@ -489,8 +490,6 @@ static int add_element( t_ctx ctx,
if
(
nr
==
0
)
return
DCLI__SUCCESS
;
undefined
=
0
;
if
(
strncmp
(
line_elem
[
0
],
"/*"
,
2
)
==
0
)
{
...
...
@@ -742,6 +741,15 @@ static int add_element( t_ctx ctx,
size
=
0
;
}
/* Third arg is alignment */
alignment
=
0
;
if
(
nr
>
2
)
{
if
(
strcmp
(
line_elem
[
2
],
"pwr_dAlignLW"
)
==
0
)
alignment
=
8
;
else
if
(
strcmp
(
line_elem
[
2
],
"pwr_dAlignW"
)
==
0
)
alignment
=
4
;
}
/* Second arg is name */
if
(
nr
<
2
)
return
DCLI__SUCCESS
;
...
...
@@ -792,6 +800,7 @@ static int add_element( t_ctx ctx,
strcpy
(
element_ptr
->
name
,
line_elem
[
1
]);
element_ptr
->
type
=
type
;
element_ptr
->
size
=
size
;
element_ptr
->
alignment
=
alignment
;
strcpy
(
element_ptr
->
filename
,
filectx
->
filename
);
element_ptr
->
line_nr
=
filectx
->
lines
;
element_ptr
->
mask
=
mask
;
...
...
@@ -902,15 +911,17 @@ static int find_struct( t_ctx ctx,
int
sts
;
int
struct_found
;
int
name_found
;
int
type_found
;
int
start_found
;
int
typedef_line
;
int
begin_line
;
int
begin_typedef
,
end_typedef
;
int
end_of_typedef
;
int
parlevel
;
char
*
s
,
*
t
;
char
*
s
,
*
t
,
*
u
;
char
*
begin_addr
,
*
end_addr
;
char
name
[
40
];
char
name
[
80
];
char
typename
[
80
];
int
i
,
j
,
k
;
dcli_sStructElement
*
element_p
,
*
e_p
,
*
e_ptr
,
*
element_ptr
;
dcli_sStructElement
*
element_list
;
...
...
@@ -1032,6 +1043,7 @@ static int find_struct( t_ctx ctx,
parlevel
=
0
;
end_of_typedef
=
0
;
name_found
=
0
;
type_found
=
0
;
begin_line
=
filectx
->
lines
;
begin_typedef
=
filectx
->
lines
;
begin_addr
=
s
+
strlen
(
"typedef"
);
...
...
@@ -1075,18 +1087,33 @@ static int find_struct( t_ctx ctx,
*
end_addr
=
0
;
begin_addr
++
;
start_found
=
0
;
int
space_found
=
0
;
t
=
name
;
for
(
s
=
begin_addr
;
*
s
;
s
++
)
{
if
(
*
s
==
' '
||
*
s
==
9
)
{
if
(
!
start
_found
)
if
(
!
name
_found
)
continue
;
else
break
;
space_found
=
1
;
}
else
{
if
(
name_found
&&
space_found
)
{
/* Type name */
*
t
=
0
;
strncpy
(
typename
,
name
,
sizeof
(
typename
));
type_found
=
1
;
for
(
u
=
typename
;
*
u
;
u
++
)
{
if
(
*
u
==
' '
||
*
u
==
9
)
{
*
u
=
0
;
break
;
}
}
t
=
name
;
space_found
=
0
;
}
name_found
=
1
;
*
t
=
*
s
;
t
++
;
...
...
@@ -1127,6 +1154,27 @@ static int find_struct( t_ctx ctx,
goto
readstruct_error_return
;
}
if
(
type_found
)
{
dcli_sStructElement
*
e
=
calloc
(
1
,
sizeof
(
*
element_ptr
));
*
e_list
=
e
;
if
(
strcmp
(
typename
,
"pwr_tEnum"
)
==
0
||
strcmp
(
typename
,
"pwr_tMask"
)
==
0
)
{
e
->
type
=
pwr_eType_UInt32
;
e
->
size
=
sizeof
(
pwr_tUInt32
);
strcpy
(
e
->
typestr
,
typename
);
}
else
{
free_filectx
(
filectx
);
return_sts
=
DCLI__STRUCTNOTFOUND
;
goto
readstruct_error_return
;
}
free_filectx
(
filectx
);
if
(
caller
==
READSTRUCT_CALLER_ROOT
)
free
(
ctx
);
return
DCLI__NOSTRUCT
;
}
file
=
fopen
(
normfilename
,
"r"
);
if
(
file
==
NULL
)
{
...
...
@@ -1206,6 +1254,15 @@ static int find_struct( t_ctx ctx,
return_sts
=
DCLI__TYPEUNDEF
;
goto
readstruct_error_return
;
}
if
(
sts
==
DCLI__NOSTRUCT
)
{
e_ptr
->
size
=
element_list
->
size
;
e_ptr
->
type
=
element_list
->
type
;
strcpy
(
e_ptr
->
typestr
,
element_list
->
typestr
);
e_ptr
->
undefined
=
0
;
free
(
element_list
);
element_list
=
0
;
}
else
{
e_ptr
->
undefined
=
0
;
e_ptr
->
struct_begin
=
1
;
...
...
@@ -1215,13 +1272,11 @@ static int find_struct( t_ctx ctx,
elnumcount
=
0
;
struct_element
=
element_list
;
i
=
0
;
while
(
(
s2
=
strchr
(
s1
,
'['
))
!=
0
)
{
while
(
(
s2
=
strchr
(
s1
,
'['
))
!=
0
)
{
/* Extract number of elements */
*
s2
=
0
;
s2
++
;
if
(
(
s1
=
strchr
(
s2
,
']'
))
==
0
)
{
if
(
(
s1
=
strchr
(
s2
,
']'
))
==
0
)
{
strcpy
(
ctx
->
error_file
,
filectx
->
filename
);
ctx
->
error_line
=
filectx
->
lines
;
return_sts
=
DCLI__ELEMSYNTAX
;
...
...
@@ -1230,11 +1285,9 @@ static int find_struct( t_ctx ctx,
*
s1
=
0
;
s1
++
;
nr
=
sscanf
(
s2
,
"%d"
,
&
elnum
[
i
]);
if
(
nr
!=
1
)
{
if
(
nr
!=
1
)
{
sts
=
find_define
(
filectx
,
s2
,
&
elnum
[
i
]);
if
(
EVEN
(
sts
))
{
if
(
EVEN
(
sts
))
{
strcpy
(
ctx
->
error_file
,
filectx
->
filename
);
ctx
->
error_line
=
filectx
->
lines
;
return_sts
=
DCLI__ELEMSYNTAX
;
...
...
@@ -1247,23 +1300,18 @@ static int find_struct( t_ctx ctx,
count
=
0
;
for
(
element_p
=
struct_element
;
element_p
;
element_p
=
element_p
->
next
)
count
++
;
if
(
elnumcount
==
0
)
{
for
(
element_p
=
struct_element
;
element_p
;
element_p
=
element_p
->
next
)
{
if
(
elnumcount
==
0
)
{
for
(
element_p
=
struct_element
;
element_p
;
element_p
=
element_p
->
next
)
{
strcpy
(
tmp
,
element_p
->
name
);
strcpy
(
element_p
->
name
,
e_ptr
->
name
);
strcat
(
element_p
->
name
,
"."
);
strcat
(
element_p
->
name
,
tmp
);
}
}
else
if
(
elnumcount
==
1
)
{
for
(
i
=
1
;
i
<
elnum
[
0
];
i
++
)
{
else
if
(
elnumcount
==
1
)
{
for
(
i
=
1
;
i
<
elnum
[
0
];
i
++
)
{
element_p
=
struct_element
;
for
(
j
=
0
;
j
<
count
;
j
++
)
{
for
(
j
=
0
;
j
<
count
;
j
++
)
{
element_ptr
=
calloc
(
1
,
sizeof
(
*
element_ptr
));
memcpy
(
element_ptr
,
element_p
,
sizeof
(
*
element_p
));
...
...
@@ -1276,27 +1324,21 @@ static int find_struct( t_ctx ctx,
}
}
element_p
=
struct_element
;
for
(
i
=
0
;
i
<
elnum
[
0
];
i
++
)
{
for
(
j
=
0
;
j
<
count
;
j
++
)
{
for
(
i
=
0
;
i
<
elnum
[
0
];
i
++
)
{
for
(
j
=
0
;
j
<
count
;
j
++
)
{
strcpy
(
tmp
,
element_p
->
name
);
sprintf
(
element_p
->
name
,
"%s[%d].%s"
,
e_ptr
->
name
,
i
,
tmp
);
element_p
=
element_p
->
next
;
}
}
}
else
if
(
elnumcount
==
2
)
{
for
(
i
=
0
;
i
<
elnum
[
0
];
i
++
)
{
for
(
k
=
0
;
k
<
elnum
[
1
];
k
++
)
{
else
if
(
elnumcount
==
2
)
{
for
(
i
=
0
;
i
<
elnum
[
0
];
i
++
)
{
for
(
k
=
0
;
k
<
elnum
[
1
];
k
++
)
{
if
(
i
==
0
&&
k
==
0
)
continue
;
element_p
=
struct_element
;
for
(
j
=
0
;
j
<
count
;
j
++
)
{
for
(
j
=
0
;
j
<
count
;
j
++
)
{
element_ptr
=
calloc
(
1
,
sizeof
(
*
element_ptr
));
memcpy
(
element_ptr
,
element_p
,
sizeof
(
*
element_p
));
...
...
@@ -1311,12 +1353,9 @@ static int find_struct( t_ctx ctx,
}
element_p
=
struct_element
;
for
(
i
=
0
;
i
<
elnum
[
0
];
i
++
)
{
for
(
k
=
0
;
k
<
elnum
[
1
];
k
++
)
{
for
(
j
=
0
;
j
<
count
;
j
++
)
{
for
(
i
=
0
;
i
<
elnum
[
0
];
i
++
)
{
for
(
k
=
0
;
k
<
elnum
[
1
];
k
++
)
{
for
(
j
=
0
;
j
<
count
;
j
++
)
{
strcpy
(
tmp
,
element_p
->
name
);
sprintf
(
element_p
->
name
,
"%s[%d][%d].%s"
,
e_ptr
->
name
,
i
,
k
,
tmp
);
element_p
=
element_p
->
next
;
...
...
@@ -1324,8 +1363,7 @@ static int find_struct( t_ctx ctx,
}
}
}
else
{
else
{
strcpy
(
ctx
->
error_file
,
filectx
->
filename
);
ctx
->
error_line
=
filectx
->
lines
;
return_sts
=
DCLI__ARRAYDIM
;
...
...
@@ -1339,7 +1377,7 @@ static int find_struct( t_ctx ctx,
e_p
->
next
=
next_ptr
;
if
(
next_ptr
)
next_ptr
->
prev
=
e_p
;
}
}
}
...
...
src/msg/co/src/co_dcli_msg.msg
View file @
bc33b8d2
...
...
@@ -69,4 +69,4 @@ eof <end of file> /error
undeferr <undefined error> /error
typeundef <undefined type> /error
toolong <qualifier value is too long> /error
nostruct <no struct> /info
xtt/lib/xtt/src/xtt_xnav.cpp
View file @
bc33b8d2
...
...
@@ -4167,6 +4167,9 @@ int XNav::show_object_as_struct(
sprintf
(
attr_str
,
"_A_ %d %d %d %d"
,
objid
.
vid
,
objid
.
oix
,
(
int
)(
parameter_ptr
-
object_ptr
),
e_ptr
->
size
);
if
(
e_ptr
->
alignment
)
parameter_ptr
=
(
char
*
)
pwr_Align
(
(
size_t
)
parameter_ptr
,
e_ptr
->
alignment
);
new
ItemObjectStruct
(
brow
,
e_ptr
->
name
,
attr_str
,
e_ptr
->
type
,
e_ptr
->
size
,
0
,
(
void
*
)
parameter_ptr
,
objid
,
subid
,
NULL
,
flow_eDest_IntoLast
);
...
...
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