Commit b11bd2ab authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Some more 'LABCOMM' to 'LABCOMM2006'/'LABCOMM2014' conversions

parent e3c16fda
......@@ -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 LABCOMM2006_ERROR(name, description) description ,
#include "labcomm2006_error.h"
#undef LABCOMM_ERROR
#undef LABCOMM2006_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(LABCOMM2006_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(LABCOMM2006_ERROR_SIGNATURE_NOT_SET,
"Signature not set: %s", signature->name);
}
return signature->index;
......
......@@ -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(LABCOMM2006_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(LABCOMM2006_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(LABCOMM2006_ERROR_DEC_INDEX_MISMATCH, 5,
"%s(): index mismatch '%s' (id=0x%x != 0x%x)\n",
__FUNCTION__, signature.name, entry->index, remote_index);
result = -ENOENT;
......
......@@ -23,9 +23,9 @@
#define __LABCOMM2006_ERROR_H__
enum labcomm2006_error {
#define LABCOMM_ERROR(name, description) name ,
#define LABCOMM2006_ERROR(name, description) name ,
#include "labcomm2006_error.h"
#undef LABCOMM_ERROR
#undef LABCOMM2006_ERROR
};
struct labcomm2006_error_handler;
......@@ -41,28 +41,28 @@ void labcomm2006_error_fatal_global(enum labcomm2006_error error,
#endif
#ifdef LABCOMM_ERROR
#ifdef LABCOMM2006_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")
LABCOMM2006_ERROR(LABCOMM2006_ERROR_SIGNATURE_ALREADY_SET,
"Signature has already been set")
LABCOMM2006_ERROR(LABCOMM2006_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")
LABCOMM2006_ERROR(LABCOMM2006_ERROR_ENC_NO_REG_SIGNATURE,
"Encoder has no registration for this signature")
LABCOMM2006_ERROR(LABCOMM2006_ERROR_ENC_BUF_FULL,
"The labcomm buffer is full")
LABCOMM2006_ERROR(LABCOMM2006_ERROR_DEC_UNKNOWN_DATATYPE,
"Decoder: Unknown datatype")
LABCOMM2006_ERROR(LABCOMM2006_ERROR_DEC_INDEX_MISMATCH,
"Decoder: index mismatch")
LABCOMM2006_ERROR(LABCOMM2006_ERROR_DEC_TYPE_NOT_FOUND,
"Decoder: type not found")
LABCOMM2006_ERROR(LABCOMM2006_ERROR_UNIMPLEMENTED_FUNC,
"This function is not yet implemented")
LABCOMM2006_ERROR(LABCOMM2006_ERROR_MEMORY,
"Could not allocate memory")
LABCOMM2006_ERROR(LABCOMM2006_ERROR_USER_DEF,
"User defined error")
#endif
......@@ -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(LABCOMM2006_ERROR_MEMORY, 4, "%d byte at %s:%d",
length+1, __FUNCTION__, __LINE__);
return NULL;
}
......
......@@ -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 LABCOMM2014_ERROR(name, description) description ,
#include "labcomm2014_error.h"
#undef LABCOMM_ERROR
#undef LABCOMM2014_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(LABCOMM2014_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(LABCOMM2014_ERROR_SIGNATURE_NOT_SET,
"Signature not set: %s\n", signature->name);
}
return signature->index;
......
......@@ -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
......
......@@ -23,9 +23,9 @@
#define __LABCOMM2014_ERROR_H___
enum labcomm2014_error {
#define LABCOMM_ERROR(name, description) name ,
#define LABCOMM2014_ERROR(name, description) name ,
#include "labcomm2014_error.h"
#undef LABCOMM_ERROR
#undef LABCOMM2014_ERROR
};
struct labcomm2014_error_handler;
......@@ -41,30 +41,30 @@ void labcomm2014_error_fatal_global(enum labcomm2014_error error,
#endif
#ifdef LABCOMM_ERROR
#ifdef LABCOMM2014_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")
LABCOMM2014_ERROR(LABCOMM2014_ERROR_SIGNATURE_ALREADY_SET,
"Signature has already been set")
LABCOMM2014_ERROR(LABCOMM2014_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")
LABCOMM2014_ERROR(LABCOMM2014_ERROR_ENC_NO_REG_SIGNATURE,
"Encoder has no registration for this signature")
LABCOMM2014_ERROR(LABCOMM2014_ERROR_ENC_BUF_FULL,
"The labcomm2014 buffer is full")
LABCOMM2014_ERROR(LABCOMM2014_ERROR_DEC_UNKNOWN_DATATYPE,
"Decoder: Unknown datatype")
LABCOMM2014_ERROR(LABCOMM2014_ERROR_DEC_INDEX_MISMATCH,
"Decoder: index mismatch")
LABCOMM2014_ERROR(LABCOMM2014_ERROR_DEC_TYPE_NOT_FOUND,
"Decoder: type not found")
LABCOMM2014_ERROR(LABCOMM2014_ERROR_UNIMPLEMENTED_FUNC,
"This function is not yet implemented")
LABCOMM2014_ERROR(LABCOMM2014_ERROR_MEMORY,
"Could not allocate memory")
LABCOMM2014_ERROR(LABCOMM2014_ERROR_USER_DEF,
"User defined error")
LABCOMM2014_ERROR(LABCOMM2014_ERROR_BAD_WRITER,
"Decoder: writer_ioctl() failed")
#endif
......@@ -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(LABCOMM2014_ERROR_MEMORY, 4, "%d byte at %s:%d",
length+1, __FUNCTION__, __LINE__);
return NULL;
}
......
......@@ -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);
}
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment