Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
LabComm
Commits
6ac4ee60
Commit
6ac4ee60
authored
Oct 14, 2014
by
Anders Blomdell
Browse files
2006 tests passes
parent
df9405e0
Changes
6
Hide whitespace changes
Inline
Side-by-side
compiler/C_CodeGen.jrag
View file @
6ac4ee60
...
...
@@ -1269,7 +1269,7 @@ aspect C_Sizeof {
"(" + env.prefix + getName() + " *v)");
env.println("{");
env.indent();
env.println("return labcomm_internal_sizeof(" +
env.println("return labcomm
"+env.verStr+"
_internal_sizeof(" +
"&labcomm" + env.verStr+"_signature_" + env.prefix + getName() +
", v);");
env.unindent();
...
...
@@ -1353,8 +1353,8 @@ aspect C_Sizeof {
public void PrimType.C_emitSizeof(C_env env) {
switch (getToken()) {
case LABCOMM_STRING: {
env.print("{ int l
ength
= strlen(" + env.qualid + "); ");
env.println("result += labcomm_size_packed32(l
ength) + length
; }");
env.print("{ int l = strlen(" + env.qualid + "); ");
env.println("result += labcomm
"+env.verStr+"
_size_packed32(l
) + l
; }");
} break;
default: {
throw new Error(this.getClass().getName() +
...
...
lib/c/2006/labcomm2006.c
View file @
6ac4ee60
...
...
@@ -260,3 +260,11 @@ int labcomm2006_get_local_index(struct labcomm2006_signature *signature)
}
return
signature
->
index
;
}
int
labcomm2006_internal_sizeof
(
struct
labcomm2006_signature
*
signature
,
void
*
v
)
{
int
length
=
signature
->
encoded_size
(
v
);
return
(
labcomm2006_size_packed32
(
signature
->
index
)
+
length
);
}
lib/c/2006/labcomm2006.h
View file @
6ac4ee60
...
...
@@ -44,9 +44,8 @@ struct labcomm2006_decoder;
* Signature entry
*/
struct
labcomm2006_signature
{
int
type
;
char
*
name
;
int
(
*
encoded_size
)(
struct
labcomm2006_signature
*
,
void
*
);
/
/
void
*
== encoded_
sample *
int
(
*
encoded_size
)(
void
*
);
/
*
void*
refers to
sample
_data
*
/
int
size
;
unsigned
char
*
signature
;
int
index
;
...
...
lib/c/2006/labcomm2006_decoder.c
View file @
6ac4ee60
...
...
@@ -190,7 +190,6 @@ static int decode_typedef_or_sample(struct labcomm2006_decoder *d, int kind)
labcomm2006_writer_start
(
&
writer
,
writer
.
action_context
,
0
,
NULL
,
NULL
);
remote_index
=
labcomm2006_read_packed32
(
d
->
reader
);
signature
.
name
=
labcomm2006_read_string
(
d
->
reader
);
signature
.
type
=
kind
;
collect_flat_signature
(
d
,
&
writer
);
labcomm2006_writer_end
(
&
writer
,
writer
.
action_context
);
err
=
writer_ioctl
(
&
writer
,
...
...
@@ -221,7 +220,6 @@ static int decode_typedef_or_sample(struct labcomm2006_decoder *d, int kind)
s
=
LABCOMM_SIGNATURE_ARRAY_REF
(
d
->
memory
,
d
->
local
,
struct
sample_entry
,
i
);
if
(
s
->
signature
&&
s
->
signature
->
type
==
signature
.
type
&&
s
->
signature
->
size
==
signature
.
size
&&
strcmp
(
s
->
signature
->
name
,
signature
.
name
)
==
0
&&
memcmp
((
void
*
)
s
->
signature
->
signature
,
(
void
*
)
signature
.
signature
,
...
...
lib/c/2006/labcomm2006_encoder.c
View file @
6ac4ee60
...
...
@@ -77,7 +77,6 @@ int labcomm2006_internal_encoder_register(
index
=
labcomm2006_get_local_index
(
signature
);
labcomm2006_scheduler_writer_lock
(
e
->
scheduler
);
if
(
signature
->
type
!=
LABCOMM_SAMPLE
)
{
goto
out
;
}
if
(
index
<=
0
)
{
goto
out
;
}
done
=
LABCOMM_SIGNATURE_ARRAY_REF
(
e
->
memory
,
e
->
registered
,
int
,
index
);
if
(
*
done
)
{
goto
out
;
}
...
...
@@ -86,7 +85,7 @@ int labcomm2006_internal_encoder_register(
index
,
signature
,
NULL
);
if
(
err
==
-
EALREADY
)
{
result
=
0
;
goto
out
;
}
if
(
err
!=
0
)
{
result
=
err
;
goto
out
;
}
labcomm2006_write_packed32
(
e
->
writer
,
signature
->
type
);
labcomm2006_write_packed32
(
e
->
writer
,
LABCOMM_SAMPLE
);
labcomm2006_write_packed32
(
e
->
writer
,
index
);
labcomm2006_write_string
(
e
->
writer
,
signature
->
name
);
for
(
i
=
0
;
i
<
signature
->
size
;
i
++
)
{
...
...
lib/c/2006/labcomm2006_private.h
View file @
6ac4ee60
...
...
@@ -377,6 +377,9 @@ int labcomm2006_internal_encoder_ioctl(struct labcomm2006_encoder *encoder,
struct
labcomm2006_signature
*
signature
,
uint32_t
ioctl_action
,
va_list
args
);
int
labcomm2006_internal_sizeof
(
struct
labcomm2006_signature
*
signature
,
void
*
v
);
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define LABCOMM_ENCODE(name, type) \
...
...
Write
Preview
Supports
Markdown
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