Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xcap-capability-linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xcap
xcap-capability-linux
Commits
5147626a
Commit
5147626a
authored
Sep 01, 2015
by
Sarah Spall
Committed by
Vikram Narayanan
Oct 25, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverting for moment
parent
730fd7d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
36 deletions
+70
-36
tools/lcd/idl/code_gen/client.cpp
tools/lcd/idl/code_gen/client.cpp
+55
-31
tools/lcd/idl/code_gen/unmarshal.cpp
tools/lcd/idl/code_gen/unmarshal.cpp
+15
-5
No files found.
tools/lcd/idl/code_gen/client.cpp
View file @
5147626a
...
...
@@ -10,51 +10,30 @@ CCSTFile* generate_client_header(File* f)
}
CCSTFile
*
generate_client_source
(
File
*
f
)
{
{
std
::
vector
<
CCSTExDeclaration
*>
definitions
;
for
(
std
::
vector
<
Rpc
*>::
iterator
it
=
f
->
rpc_defs
().
begin
();
it
!=
f
->
rpc_defs
().
end
();
it
++
)
{
Rpc
*
r
=
(
Rpc
*
)
*
it
;
definitions
.
push_back
(
create_function_definition
(
create_function_declaration
(
r
)
,
create_caller_body
(
r
)));
}
CCSTFile
*
c_file
=
new
CCSTFile
(
definitions
);
return
c_file
;
return
new
CCSTFile
(
definitions
);
}
CCSTCompoundStatement
*
create_caller_body
(
Rpc
*
r
)
{
std
::
vector
<
CCSTDeclaration
*>
declarations
;
std
::
vector
<
CCSTStatement
*>
statements
;
std
::
vector
<
Parameter
*>
params
=
r
->
parameters
();
for
(
std
::
vector
<
Parameter
*>::
iterator
it
=
params
.
begin
();
it
!=
params
.
end
();
it
++
)
{
Parameter
*
p
=
(
Parameter
*
)
*
it
;
statements
.
push_back
(
marshal_parameter
(
p
));
}
std
::
vector
<
CCSTStatement
*>
statements
=
marshal_parameters
(
r
->
parameters
());
// implicit returns
std
::
vector
<
Marshal_type
*>
implicit_ret_info
=
r
->
implicit_ret_marshal_info
();
for
(
std
::
vector
<
Marshal_type
*>::
iterator
it
=
implicit_ret_info
.
begin
();
it
!=
implicit_ret_info
.
end
();
it
++
)
{
Marshal_type
*
mt
=
*
it
;
UnmarshalTypeVisitor
*
visitor
=
new
UnmarshalTypeVisitor
();
statements
.
push_back
(
mt
->
accept
(
visitor
));
}
std
::
vector
<
CCSTStatement
*>
uirs
=
unmarshal_implicit_return
(
r
->
implicit_ret_marshal_info
());
statements
.
insert
(
statements
.
end
(),
uirs
.
begin
(),
uirs
.
end
());
if
(
r
->
explicit_return_type
()
->
num
()
!=
5
)
{
// not void
Marshal_type
*
ret_info
=
r
->
explicit_ret_marshal_info
();
CCSTPointer
*
p
=
0x0
;
if
(
r
->
explicit_return_type
()
->
num
()
==
3
)
{
p
=
new
CCSTPointer
();
}
std
::
vector
<
CCSTDecSpecifier
*>
ret_type
=
type
(
r
->
explicit_return_type
());
UnmarshalTypeVisitor
*
visitor
=
new
UnmarshalTypeVisitor
();
ret_info
->
accept
(
visitor
);
statements
.
push_back
(
new
CCSTReturn
(
adfads
));
}
else
{
statements
.
push_back
(
new
CCSTReturn
());
...
...
@@ -63,3 +42,48 @@ CCSTCompoundStatement* create_caller_body(Rpc *r)
return
new
CCSTCompoundstatement
(
declarations
,
statements
);
}
std
::
vector
<
CCSTStatement
*>
marshal_parameters
(
std
::
vector
<
Parameter
*>
params
)
{
std
::
vector
<
CCSTStatement
*>
statements
;
for
(
std
::
vector
<
Parameter
*>::
iterator
it
=
params
.
begin
();
it
!=
params
.
end
();
it
++
)
{
Parameter
*
p
=
(
Parameter
*
)
*
it
;
statements
.
push_back
(
marshal_parameter
(
p
));
}
return
statements
;
}
std
::
vector
<
CCSTStatement
*>
unmarshal_implicit_return
(
std
::
vector
<
Parameter
*>
implicit_returns
)
{
std
::
vector
<
CCSTStatement
*>
statements
;
for
(
std
::
vector
<
Parameter
*>::
iterator
it
=
implicit_returns
.
begin
();
it
!=
implicit_returns
.
end
();
it
++
)
{
Parameter
*
p
=
*
it
;
UnmarshalTypeVisitor
*
visitor
=
new
UnmarshalTypeVisitor
();
statements
.
push_back
(
mt
->
accept
(
visitor
));
}
return
statements
;
}
CCSTStatement
*
unmarshal_explicit_return
(
Marshal_type
*
return_info
)
{
CCSTPointer
*
p
=
0x0
;
if
(
r
->
explicit_return_type
()
->
num
()
==
3
)
{
p
=
new
CCSTPointer
();
}
std
::
vector
<
CCSTDecSpecifier
*>
ret_type
=
type
(
r
->
explicit_return_type
());
UnmarshalTypeVisitor
*
visitor
=
new
UnmarshalTypeVisitor
();
std
::
vector
<
CCSTDeclaration
*>
d
;
std
::
vector
<
CCSTStatement
*>
s
;
s
.
push_back
(
ret_info
->
accept
(
visitor
));
s
.
push_back
(
new
CCSTReturn
(
new
CCSTPrimaryExprId
(
"internal_ret"
)));
}
tools/lcd/idl/code_gen/unmarshal.cpp
View file @
5147626a
...
...
@@ -7,19 +7,28 @@ CCSTCompoundStatement* unmarshal_parameter(Parameter *p)
return
p
->
get_marshal_info
()
->
accept
(
visitor
);
}
CCSTCompoundStatement
*
unmarshal_value
(
)
CCSTCompoundStatement
*
UnmarshalTypeVisitor
::
visit
(
Marshal_projection
*
data
,
const
char
*
name
)
{
// loop through fields.
for
(
std
::
vector
<
ProjectionField
*>::
iterator
it
=
pt
->
fields
().
begin
();
pt
->
fields
().
end
();
it
++
)
{
ProjectionField
*
pf
=
*
it
;
}
}
/* code to unmarshal parameters */
/*
// This code will produce the CAST that unmarshals the params. instead of where it was before
CCSTCompoundStatement
*
UnmarshalTypeVisitor
::
visit
(
Marshal_projection
*
data
)
CCSTCompoundStatement* UnmarshalTypeVisitor::visit(Marshal_projection *data
, const char *name
)
{
ProjectionType *pt = dynamic_cast<ProjectionType*>(data->get_type());
Assert(pt != 0x0, "Error: Expected ProjectionType got something else.\n");
for(std::vector<ProjectionField*>::iterator it = pt->fields().begin(); pt->fields().end(); it ++)
{
}
std::vector<CCSTDeclaration*> declarations;
std::vector<CCSTStatement*> statements;
...
...
@@ -65,6 +74,7 @@ CCSTCompoundStatement* UnmarshalTypeVisitor::visit(Marshal_projection *data)
}
return new CCSTCompoundStatement(declarations, statements);
}
*/
CCSTCompoundStatement
*
UnmarshalTypeVisitor
::
visit
(
Marshal_integer
*
data
)
{
...
...
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