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
Sven Gestegård Robertz
LabComm
Commits
b11bd2ab
Commit
b11bd2ab
authored
Feb 24, 2015
by
Anders Blomdell
Browse files
Some more 'LABCOMM' to 'LABCOMM2006'/'LABCOMM2014' conversions
parent
e3c16fda
Changes
10
Hide whitespace changes
Inline
Side-by-side
lib/c/2006/labcomm2006.c
View file @
b11bd2ab
...
...
@@ -138,9 +138,9 @@ int labcomm2006_writer_ioctl(struct labcomm2006_writer *w,
static
const
char
*
labcomm2006_error_string
[]
=
{
#define LABCOMM_ERROR(name, description) description ,
#define LABCOMM
2006
_ERROR(name, description) description ,
#include "labcomm2006_error.h"
#undef LABCOMM_ERROR
#undef LABCOMM
2006
_ERROR
};
static
const
int
labcomm2006_error_string_count
=
(
sizeof
(
labcomm2006_error_string
)
/
sizeof
(
labcomm2006_error_string
[
0
]));
...
...
@@ -242,7 +242,7 @@ static int local_index = LABCOMM_USER;
void
labcomm2006_set_local_index
(
struct
labcomm2006_signature
*
signature
)
{
if
(
signature
->
index
!=
0
)
{
labcomm2006_error_fatal_global
(
LABCOMM_ERROR_SIGNATURE_ALREADY_SET
,
labcomm2006_error_fatal_global
(
LABCOMM
2006
_ERROR_SIGNATURE_ALREADY_SET
,
"Signature already set: %s"
,
signature
->
name
);
}
signature
->
index
=
local_index
;
...
...
@@ -252,7 +252,7 @@ void labcomm2006_set_local_index(struct labcomm2006_signature *signature)
int
labcomm2006_get_local_index
(
const
struct
labcomm2006_signature
*
signature
)
{
if
(
signature
->
index
==
0
)
{
labcomm2006_error_fatal_global
(
LABCOMM_ERROR_SIGNATURE_NOT_SET
,
labcomm2006_error_fatal_global
(
LABCOMM
2006
_ERROR_SIGNATURE_NOT_SET
,
"Signature not set: %s"
,
signature
->
name
);
}
return
signature
->
index
;
...
...
lib/c/2006/labcomm2006_decoder.c
View file @
b11bd2ab
...
...
@@ -91,7 +91,7 @@ static int collect_flat_signature(
result
=
decoder
->
reader
->
error
;
if
(
result
<
0
)
{
goto
out
;
}
if
(
type
>=
LABCOMM_USER
)
{
decoder
->
on_error
(
LABCOMM_ERROR_UNIMPLEMENTED_FUNC
,
3
,
decoder
->
on_error
(
LABCOMM
2006
_ERROR_UNIMPLEMENTED_FUNC
,
3
,
"Implement %s ... (1) for type 0x%x
\n
"
,
__FUNCTION__
,
type
);
}
else
{
labcomm2006_write_packed32
(
writer
,
type
);
...
...
@@ -132,7 +132,7 @@ static int collect_flat_signature(
}
break
;
default:
{
result
=
-
ENOSYS
;
decoder
->
on_error
(
LABCOMM_ERROR_UNIMPLEMENTED_FUNC
,
3
,
decoder
->
on_error
(
LABCOMM
2006
_ERROR_UNIMPLEMENTED_FUNC
,
3
,
"Implement %s (2) for type 0x%x...
\n
"
,
__FUNCTION__
,
type
);
}
break
;
}
...
...
@@ -250,7 +250,7 @@ static int decode_typedef_or_sample(struct labcomm2006_decoder *d, int kind)
d->on_new_datatype(d, &signature);
result = -ENOENT;
} else if (entry->index && entry->index != remote_index) {
d->on_error(LABCOMM_ERROR_DEC_INDEX_MISMATCH, 5,
d->on_error(LABCOMM
2006
_ERROR_DEC_INDEX_MISMATCH, 5,
"%s(): index mismatch '%s' (id=0x%x != 0x%x)\n",
__FUNCTION__, signature.name, entry->index, remote_index);
result = -ENOENT;
...
...
lib/c/2006/labcomm2006_error.h
View file @
b11bd2ab
...
...
@@ -23,9 +23,9 @@
#define __LABCOMM2006_ERROR_H__
enum
labcomm2006_error
{
#define LABCOMM_ERROR(name, description) name ,
#define LABCOMM
2006
_ERROR(name, description) name ,
#include "labcomm2006_error.h"
#undef LABCOMM_ERROR
#undef LABCOMM
2006
_ERROR
};
struct
labcomm2006_error_handler
;
...
...
@@ -41,28 +41,28 @@ void labcomm2006_error_fatal_global(enum labcomm2006_error error,
#endif
#ifdef LABCOMM_ERROR
#ifdef LABCOMM
2006
_ERROR
LABCOMM_ERROR
(
LABCOMM_ERROR_SIGNATURE_ALREADY_SET
,
"Signature has already been set"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_SIGNATURE_NOT_SET
,
"Signature has not been set"
)
LABCOMM
2006
_ERROR
(
LABCOMM
2006
_ERROR_SIGNATURE_ALREADY_SET
,
"Signature has already been set"
)
LABCOMM
2006
_ERROR
(
LABCOMM
2006
_ERROR_SIGNATURE_NOT_SET
,
"Signature has not been set"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_ENC_NO_REG_SIGNATURE
,
"Encoder has no registration for this signature"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_ENC_BUF_FULL
,
"The labcomm buffer is full"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_DEC_UNKNOWN_DATATYPE
,
"Decoder: Unknown datatype"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_DEC_INDEX_MISMATCH
,
"Decoder: index mismatch"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_DEC_TYPE_NOT_FOUND
,
"Decoder: type not found"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_UNIMPLEMENTED_FUNC
,
"This function is not yet implemented"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_MEMORY
,
"Could not allocate memory"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_USER_DEF
,
"User defined error"
)
LABCOMM
2006
_ERROR
(
LABCOMM
2006
_ERROR_ENC_NO_REG_SIGNATURE
,
"Encoder has no registration for this signature"
)
LABCOMM
2006
_ERROR
(
LABCOMM
2006
_ERROR_ENC_BUF_FULL
,
"The labcomm buffer is full"
)
LABCOMM
2006
_ERROR
(
LABCOMM
2006
_ERROR_DEC_UNKNOWN_DATATYPE
,
"Decoder: Unknown datatype"
)
LABCOMM
2006
_ERROR
(
LABCOMM
2006
_ERROR_DEC_INDEX_MISMATCH
,
"Decoder: index mismatch"
)
LABCOMM
2006
_ERROR
(
LABCOMM
2006
_ERROR_DEC_TYPE_NOT_FOUND
,
"Decoder: type not found"
)
LABCOMM
2006
_ERROR
(
LABCOMM
2006
_ERROR_UNIMPLEMENTED_FUNC
,
"This function is not yet implemented"
)
LABCOMM
2006
_ERROR
(
LABCOMM
2006
_ERROR_MEMORY
,
"Could not allocate memory"
)
LABCOMM
2006
_ERROR
(
LABCOMM
2006
_ERROR_USER_DEF
,
"User defined error"
)
#endif
lib/c/2006/labcomm2006_private.h
View file @
b11bd2ab
...
...
@@ -241,7 +241,7 @@ static inline char *labcomm2006_read_string(struct labcomm2006_reader *r)
length
=
labcomm2006_read_packed32
(
r
);
result
=
labcomm2006_memory_alloc
(
r
->
memory
,
1
,
length
+
1
);
if
(
!
result
)
{
labcomm2006_on_error_fprintf
(
LABCOMM_ERROR_MEMORY
,
4
,
"%d byte at %s:%d"
,
labcomm2006_on_error_fprintf
(
LABCOMM
2006
_ERROR_MEMORY
,
4
,
"%d byte at %s:%d"
,
length
+
1
,
__FUNCTION__
,
__LINE__
);
return
NULL
;
}
...
...
lib/c/2014/labcomm2014.c
View file @
b11bd2ab
...
...
@@ -138,9 +138,9 @@ int labcomm2014_writer_ioctl(struct labcomm2014_writer *w,
static
const
char
*
labcomm2014_error_string
[]
=
{
#define LABCOMM_ERROR(name, description) description ,
#define LABCOMM
2014
_ERROR(name, description) description ,
#include "labcomm2014_error.h"
#undef LABCOMM_ERROR
#undef LABCOMM
2014
_ERROR
};
static
const
int
labcomm2014_error_string_count
=
(
sizeof
(
labcomm2014_error_string
)
/
sizeof
(
labcomm2014_error_string
[
0
]));
...
...
@@ -241,7 +241,7 @@ static int local_index = LABCOMM_USER;
void
labcomm2014_set_local_index
(
struct
labcomm2014_signature
*
signature
)
{
if
(
signature
->
index
!=
0
)
{
labcomm2014_error_fatal_global
(
LABCOMM_ERROR_SIGNATURE_ALREADY_SET
,
labcomm2014_error_fatal_global
(
LABCOMM
2014
_ERROR_SIGNATURE_ALREADY_SET
,
"Signature already set: %s
\n
"
,
signature
->
name
);
}
signature
->
index
=
local_index
;
...
...
@@ -251,7 +251,7 @@ void labcomm2014_set_local_index(struct labcomm2014_signature *signature)
int
labcomm2014_get_local_index
(
const
struct
labcomm2014_signature
*
signature
)
{
if
(
signature
->
index
==
0
)
{
labcomm2014_error_fatal_global
(
LABCOMM_ERROR_SIGNATURE_NOT_SET
,
labcomm2014_error_fatal_global
(
LABCOMM
2014
_ERROR_SIGNATURE_NOT_SET
,
"Signature not set: %s
\n
"
,
signature
->
name
);
}
return
signature
->
index
;
...
...
lib/c/2014/labcomm2014_encoder.c
View file @
b11bd2ab
...
...
@@ -87,7 +87,7 @@ struct labcomm2014_encoder *labcomm2014_encoder_new(
struct
labcomm2014_memory
*
memory
,
struct
labcomm2014_scheduler
*
scheduler
)
{
return
internal_encoder_new
(
writer
,
error
,
memory
,
scheduler
,
TRUE
);
return
internal_encoder_new
(
writer
,
error
,
memory
,
scheduler
,
LABCOMM2014_
TRUE
);
}
void
labcomm2014_encoder_free
(
struct
labcomm2014_encoder
*
e
)
{
...
...
@@ -310,7 +310,7 @@ static int calc_sig_encoded_size(struct labcomm2014_encoder *e,
const
struct
labcomm2014_signature
*
sig
)
{
int
result
=
0
;
map_signature
(
sig_size
,
&
result
,
sig
,
FALSE
);
map_signature
(
sig_size
,
&
result
,
sig
,
LABCOMM2014_
FALSE
);
return
result
;
}
...
...
@@ -344,7 +344,7 @@ static int internal_reg_type(
labcomm2014_write_packed32
(
e
->
writer
,
index
);
labcomm2014_write_string
(
e
->
writer
,
signature
->
name
);
labcomm2014_write_packed32
(
e
->
writer
,
sig_size
);
do_write_signature
(
e
,
signature
,
FALSE
);
do_write_signature
(
e
,
signature
,
LABCOMM2014_
FALSE
);
labcomm2014_writer_end
(
e
->
writer
,
e
->
writer
->
action_context
);
result
=
e
->
writer
->
error
;
...
...
@@ -359,7 +359,7 @@ int labcomm2014_internal_encoder_type_register(
const
struct
labcomm2014_signature
*
signature
)
{
#ifndef LABCOMM_WITHOUT_TYPE_DEFS
return
internal_reg_type
(
e
,
signature
,
FALSE
);
return
internal_reg_type
(
e
,
signature
,
LABCOMM2014_
FALSE
);
#else
return
0
;
#endif
...
...
lib/c/2014/labcomm2014_error.h
View file @
b11bd2ab
...
...
@@ -23,9 +23,9 @@
#define __LABCOMM2014_ERROR_H___
enum
labcomm2014_error
{
#define LABCOMM_ERROR(name, description) name ,
#define LABCOMM
2014
_ERROR(name, description) name ,
#include "labcomm2014_error.h"
#undef LABCOMM_ERROR
#undef LABCOMM
2014
_ERROR
};
struct
labcomm2014_error_handler
;
...
...
@@ -41,30 +41,30 @@ void labcomm2014_error_fatal_global(enum labcomm2014_error error,
#endif
#ifdef LABCOMM_ERROR
#ifdef LABCOMM
2014
_ERROR
LABCOMM_ERROR
(
LABCOMM_ERROR_SIGNATURE_ALREADY_SET
,
"Signature has already been set"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_SIGNATURE_NOT_SET
,
"Signature has not been set"
)
LABCOMM
2014
_ERROR
(
LABCOMM
2014
_ERROR_SIGNATURE_ALREADY_SET
,
"Signature has already been set"
)
LABCOMM
2014
_ERROR
(
LABCOMM
2014
_ERROR_SIGNATURE_NOT_SET
,
"Signature has not been set"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_ENC_NO_REG_SIGNATURE
,
"Encoder has no registration for this signature"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_ENC_BUF_FULL
,
"The labcomm2014 buffer is full"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_DEC_UNKNOWN_DATATYPE
,
"Decoder: Unknown datatype"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_DEC_INDEX_MISMATCH
,
"Decoder: index mismatch"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_DEC_TYPE_NOT_FOUND
,
"Decoder: type not found"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_UNIMPLEMENTED_FUNC
,
"This function is not yet implemented"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_MEMORY
,
"Could not allocate memory"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_USER_DEF
,
"User defined error"
)
LABCOMM_ERROR
(
LABCOMM_ERROR_BAD_WRITER
,
"Decoder: writer_ioctl() failed"
)
LABCOMM
2014
_ERROR
(
LABCOMM
2014
_ERROR_ENC_NO_REG_SIGNATURE
,
"Encoder has no registration for this signature"
)
LABCOMM
2014
_ERROR
(
LABCOMM
2014
_ERROR_ENC_BUF_FULL
,
"The labcomm2014 buffer is full"
)
LABCOMM
2014
_ERROR
(
LABCOMM
2014
_ERROR_DEC_UNKNOWN_DATATYPE
,
"Decoder: Unknown datatype"
)
LABCOMM
2014
_ERROR
(
LABCOMM
2014
_ERROR_DEC_INDEX_MISMATCH
,
"Decoder: index mismatch"
)
LABCOMM
2014
_ERROR
(
LABCOMM
2014
_ERROR_DEC_TYPE_NOT_FOUND
,
"Decoder: type not found"
)
LABCOMM
2014
_ERROR
(
LABCOMM
2014
_ERROR_UNIMPLEMENTED_FUNC
,
"This function is not yet implemented"
)
LABCOMM
2014
_ERROR
(
LABCOMM
2014
_ERROR_MEMORY
,
"Could not allocate memory"
)
LABCOMM
2014
_ERROR
(
LABCOMM
2014
_ERROR_USER_DEF
,
"User defined error"
)
LABCOMM
2014
_ERROR
(
LABCOMM
2014
_ERROR_BAD_WRITER
,
"Decoder: writer_ioctl() failed"
)
#endif
lib/c/2014/labcomm2014_private.h
View file @
b11bd2ab
...
...
@@ -281,7 +281,7 @@ static inline char *labcomm2014_read_string(struct labcomm2014_reader *r)
length
=
labcomm2014_read_packed32
(
r
);
result
=
labcomm2014_memory_alloc
(
r
->
memory
,
1
,
length
+
1
);
if
(
!
result
)
{
labcomm20142014_on_error_fprintf
(
LABCOMM_ERROR_MEMORY
,
4
,
"%d byte at %s:%d"
,
labcomm20142014_on_error_fprintf
(
LABCOMM
2014
_ERROR_MEMORY
,
4
,
"%d byte at %s:%d"
,
length
+
1
,
__FUNCTION__
,
__LINE__
);
return
NULL
;
}
...
...
lib/c/2014/labcomm2014_type_signature.c
View file @
b11bd2ab
...
...
@@ -30,7 +30,7 @@ static labcomm2014_bool sig_dump_checked(struct labcomm2014_signature_data *sign
/* buf (out) : byte array to write signature into
len (in/out): input: buf size, out: signature length
return TRUE if aborted due to overrun
return
LABCOMM2014_
TRUE if aborted due to overrun
*/
labcomm2014_bool
labcomm2014_signature_dump
(
struct
labcomm2014_signature_data
*
signature
,
char
*
buf
,
int
*
len
)
...
...
@@ -62,7 +62,7 @@ static labcomm2014_bool sig_dump_checked(struct labcomm2014_signature_data *sign
buf
+=
inner_len
;
}
else
{
//printf("neither data nor ref, bailing out.\n");
return
TRUE
;
return
LABCOMM2014_
TRUE
;
}
p
+=
1
;
}
...
...
@@ -70,7 +70,7 @@ static labcomm2014_bool sig_dump_checked(struct labcomm2014_signature_data *sign
}
/* compare signature (flattened, if needed) to other
return TRUE if equal
return
LABCOMM2014_
TRUE if equal
*/
labcomm2014_bool
labcomm2014_signature_cmp
(
struct
labcomm2014_signature_data
*
s1
,
struct
labcomm2014_signature_data
*
s2
)
...
...
@@ -84,7 +84,7 @@ labcomm2014_bool labcomm2014_signature_cmp( struct labcomm2014_signature_data *s
labcomm2014_bool
res2
=
labcomm2014_signature_dump
(
s2
,
buf2
,
&
len2
);
if
(
res1
||
res2
)
{
printf
(
"WARNING: OVERRUN
\n
"
);
return
FALSE
;
return
LABCOMM2014_
FALSE
;
}
else
{
return
(
len1
==
len2
&&
memcmp
(
buf1
,
buf2
,
len1
)
==
0
);
}
...
...
lib/c/2014/labcomm2014_type_signature.h
View file @
b11bd2ab
...
...
@@ -4,8 +4,8 @@
//XXX move to common.h
#ifndef labcomm2014_bool
#define labcomm2014_bool char
#define TRUE 1
#define FALSE 0
#define
LABCOMM2014_
TRUE 1
#define
LABCOMM2014_
FALSE 0
#endif
/*
...
...
@@ -112,7 +112,7 @@ int labcomm2014_decoder_register_labcomm2014_type_binding(
void
labcomm2014_signature_print
(
struct
labcomm2014_signature_data
*
signature
);
/* compare signatures (flattened, if needed) to other
* return TRUE if equal
* return
LABCOMM2014_
TRUE if equal
*/
labcomm2014_bool
labcomm2014_signature_cmp
(
struct
labcomm2014_signature_data
*
s2
,
struct
labcomm2014_signature_data
*
s1
);
...
...
@@ -121,7 +121,7 @@ labcomm2014_bool labcomm2014_signature_cmp( struct labcomm2014_signature_data *s
* buf (out) : byte array to write signature into
* len (in/out): input: buf size, out: signature length
*
* return TRUE if aborted due to overrun
* return
LABCOMM2014_
TRUE if aborted due to overrun
*/
labcomm2014_bool
labcomm2014_signature_dump
(
struct
labcomm2014_signature_data
*
signature
,
char
*
buf
,
int
*
len
);
...
...
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