From 38892389d53b570a37035a4ca4c907ff429afb7b Mon Sep 17 00:00:00 2001 From: Sven Robertz <sven@cs.lth.se> Date: Fri, 12 Apr 2013 10:26:03 +0200 Subject: [PATCH] changed prototype of labcomm_sizeof_sample to include signature_t --- compiler/C_CodeGen.jrag | 6 +++--- lib/c/labcomm.h | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/C_CodeGen.jrag b/compiler/C_CodeGen.jrag index 5b04da8..a936285 100644 --- a/compiler/C_CodeGen.jrag +++ b/compiler/C_CodeGen.jrag @@ -807,7 +807,7 @@ aspect C_Signature { env.prefix + getName() + " = {"); env.indent(); env.println("LABCOMM_SAMPLE, \"" + getName() + "\","); - env.println("(int (*)(void *))labcomm_sizeof_" + + env.println("(int (*)(labcomm_signature_t *, void *))labcomm_sizeof_" + env.prefix + getName() + ","); env.println("sizeof(signature_bytes_" + getName() + "),"); env.println("signature_bytes_"+ getName()); @@ -905,7 +905,7 @@ aspect C_Sizeof { public void SampleDecl.C_emitSizeofDeclaration(C_env env) { env.println("extern int labcomm_sizeof_" + env.prefix + getName() + - "(" + env.prefix + getName() + " *v);"); + "(labcomm_signature_t *sig, " + env.prefix + getName() + " *v);"); } public int Decl.C_fixedSizeof() { @@ -966,7 +966,7 @@ aspect C_Sizeof { public void SampleDecl.C_emitSizeof(C_env env) { env = env.nestStruct("(*v)"); env.println("int labcomm_sizeof_" + env.prefix + getName() + - "(" + env.prefix + getName() + " *v)"); + "(labcomm_signature_t *sig, " + env.prefix + getName() + " *v)"); env.println("{"); env.indent(); if (C_isDynamic()) { diff --git a/lib/c/labcomm.h b/lib/c/labcomm.h index 1d4740f..ee0a589 100644 --- a/lib/c/labcomm.h +++ b/lib/c/labcomm.h @@ -23,17 +23,14 @@ struct labcomm_decoder; /* * Signature entry */ -typedef struct { +typedef struct labcomm_signature{ int type; char *name; - int (*encoded_size)(void *); + int (*encoded_size)(struct labcomm_signature *, void *); // void * == encoded_sample * int size; unsigned char *signature; } labcomm_signature_t; -//TODO: something along the lines of... -void labcomm_encode_signature(struct labcomm_encoder*, labcomm_signature_t*); - /* * Error handling. */ -- GitLab