Commit 0ffea1dc authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

Merge branch 'master' of gitlab.control.lth.se:anders_blomdell/labcomm

parents 4366700d 98cb774e
...@@ -283,6 +283,9 @@ aspect C_Type { ...@@ -283,6 +283,9 @@ aspect C_Type {
getType().C_emitType(env, env.prefix + getName()); getType().C_emitType(env, env.prefix + getName());
env.println(";"); env.println(";");
env.println("#endif"); env.println("#endif");
env.println("extern const struct labcomm"+env.verStr+"_signature " +
"*labcomm"+env.verStr+"_signature_" + env.prefix + getName() +
";");
} }
public void Type.C_emitType(C_env env, String name) { public void Type.C_emitType(C_env env, String name) {
...@@ -295,6 +298,10 @@ aspect C_Type { ...@@ -295,6 +298,10 @@ aspect C_Type {
env.print("char " + name); env.print("char " + name);
} }
public void SampleRefType.C_emitType(C_env env, String name) {
env.print("const struct labcomm_signature *" + name);
}
public void PrimType.C_emitType(C_env env, String name) { public void PrimType.C_emitType(C_env env, String name) {
switch (getToken()) { switch (getToken()) {
case LABCOMM_BOOLEAN: { env.print("uint8_t"); } break; case LABCOMM_BOOLEAN: { env.print("uint8_t"); } break;
...@@ -516,6 +523,10 @@ aspect C_Decoder { ...@@ -516,6 +523,10 @@ aspect C_Decoder {
public void VoidType.C_emitDecoder(C_env env) { public void VoidType.C_emitDecoder(C_env env) {
} }
public void SampleRefType.C_emitDecoder(C_env env) {
env.println(env.qualid + " = labcomm_internal_decoder_index_to_signature(" +
"r->decoder, labcomm"+env.verStr+"_read_int(r));");
}
public void PrimType.C_emitDecoder(C_env env) { public void PrimType.C_emitDecoder(C_env env) {
env.println(env.qualid + " = labcomm"+env.verStr+"_read_" + getName() + "(r);"); env.println(env.qualid + " = labcomm"+env.verStr+"_read_" + getName() + "(r);");
} }
...@@ -593,6 +604,9 @@ aspect C_Decoder { ...@@ -593,6 +604,9 @@ aspect C_Decoder {
" not declared"); " not declared");
} }
public void SampleRefType.C_emitDecoderDeallocation(C_env env) {
}
public void PrimType.C_emitDecoderDeallocation(C_env env) { public void PrimType.C_emitDecoderDeallocation(C_env env) {
if (C_isDynamic()) { if (C_isDynamic()) {
env.println("labcomm"+env.verStr+"_memory_free(r->memory, 1, " + env.println("labcomm"+env.verStr+"_memory_free(r->memory, 1, " +
...@@ -677,7 +691,7 @@ aspect C_Decoder { ...@@ -677,7 +691,7 @@ aspect C_Decoder {
env.println("return labcomm"+env.verStr+"_internal_decoder_register("); env.println("return labcomm"+env.verStr+"_internal_decoder_register(");
env.indent(); env.indent();
env.println("d,"); env.println("d,");
env.println("&labcomm"+env.verStr+"_signature_" + env.prefix + getName() + ","); env.println("&signature_" + env.prefix + getName() + ",");
env.println("(labcomm"+env.verStr+"_decoder_function)decode_" + env.prefix + getName() + ","); env.println("(labcomm"+env.verStr+"_decoder_function)decode_" + env.prefix + getName() + ",");
env.println("(labcomm"+env.verStr+"_handler_function)handler,"); env.println("(labcomm"+env.verStr+"_handler_function)handler,");
env.println("context"); env.println("context");
...@@ -745,6 +759,12 @@ aspect C_copy { ...@@ -745,6 +759,12 @@ aspect C_copy {
public void VoidType.C_emitCopy(C_env env_src, C_env env_dst) { public void VoidType.C_emitCopy(C_env env_src, C_env env_dst) {
} }
public void SampleRefType.C_emitCopy(C_env env_src, C_env env_dst) {
env_src.println(env_dst.accessor() + env_dst.qualid + " = " +
env_src.accessor() + env_src.qualid + ";");
}
public void PrimType.C_emitCopy(C_env env_src, C_env env_dst) { public void PrimType.C_emitCopy(C_env env_src, C_env env_dst) {
if (C_isDynamic()) { if (C_isDynamic()) {
env_src.println(String.format( env_src.println(String.format(
...@@ -888,6 +908,9 @@ aspect C_copy { ...@@ -888,6 +908,9 @@ aspect C_copy {
public void VoidType.C_emitCopyDeallocation(C_env env) { public void VoidType.C_emitCopyDeallocation(C_env env) {
} }
public void SampleRefType.C_emitCopyDeallocation(C_env env) {
}
public void PrimType.C_emitCopyDeallocation(C_env env) { public void PrimType.C_emitCopyDeallocation(C_env env) {
if (C_isDynamic()) { if (C_isDynamic()) {
env.println("labcomm" + env.verStr + "_memory_free(mem, 1, " + env.println("labcomm" + env.verStr + "_memory_free(mem, 1, " +
...@@ -972,7 +995,7 @@ aspect C_DecoderIoctl { ...@@ -972,7 +995,7 @@ aspect C_DecoderIoctl {
env.println("va_start(va, ioctl_action);"); env.println("va_start(va, ioctl_action);");
env.println("result = labcomm"+env.verStr+"_internal_decoder_ioctl("); env.println("result = labcomm"+env.verStr+"_internal_decoder_ioctl(");
env.indent(); env.indent();
env.println("d, &labcomm"+env.verStr+"_signature_" + env.prefix + getName() + ", "); env.println("d, &signature_" + env.prefix + getName() + ", ");
env.println("ioctl_action, va);"); env.println("ioctl_action, va);");
env.unindent(); env.unindent();
env.println("va_end(va);"); env.println("va_end(va);");
...@@ -1023,7 +1046,7 @@ aspect C_Encoder { ...@@ -1023,7 +1046,7 @@ aspect C_Encoder {
env.println(")"); env.println(")");
env.println("{"); env.println("{");
env.indent(); env.indent();
env.println("return labcomm"+env.verStr+"_internal_encode(e, &labcomm"+env.verStr+"_signature_" + env.println("return labcomm"+env.verStr+"_internal_encode(e, &signature_" +
env.prefix + getName() + env.prefix + getName() +
", (labcomm"+env.verStr+"_encoder_function)encode_" + ", (labcomm"+env.verStr+"_encoder_function)encode_" +
env.prefix + getName() + env.prefix + getName() +
...@@ -1042,6 +1065,13 @@ aspect C_Encoder { ...@@ -1042,6 +1065,13 @@ aspect C_Encoder {
env.println("result = 0;"); env.println("result = 0;");
} }
public void SampleRefType.C_emitEncoder(C_env env) {
env.println("result = labcomm"+env.verStr+"_write_int(w, " +
"labcomm_internal_encoder_signature_to_index(w->encoder, " +
env.qualid + "));");
env.println("if (result != 0) { return result; }");
}
public void PrimType.C_emitEncoder(C_env env) { public void PrimType.C_emitEncoder(C_env env) {
env.println("result = labcomm"+env.verStr+"_write_" + getName() + env.println("result = labcomm"+env.verStr+"_write_" + getName() +
"(w, " + env.qualid + ");"); "(w, " + env.qualid + ");");
...@@ -1124,7 +1154,7 @@ aspect C_Encoder { ...@@ -1124,7 +1154,7 @@ aspect C_Encoder {
env.println("return labcomm"+env.verStr+"_internal_encoder_register("); env.println("return labcomm"+env.verStr+"_internal_encoder_register(");
env.indent(); env.indent();
env.println("e,"); env.println("e,");
env.println("&labcomm"+env.verStr+"_signature_" + env.prefix + getName() + ","); env.println("&signature_" + env.prefix + getName() + ",");
env.println("(labcomm"+env.verStr+"_encoder_function)encode_" + env.prefix + getName()); env.println("(labcomm"+env.verStr+"_encoder_function)encode_" + env.prefix + getName());
env.unindent(); env.unindent();
env.println(");"); env.println(");");
...@@ -1160,7 +1190,7 @@ aspect C_EncoderIoctl { ...@@ -1160,7 +1190,7 @@ aspect C_EncoderIoctl {
env.println("va_start(va, ioctl_action);"); env.println("va_start(va, ioctl_action);");
env.println("result = labcomm"+env.verStr+"_internal_encoder_ioctl("); env.println("result = labcomm"+env.verStr+"_internal_encoder_ioctl(");
env.indent(); env.indent();
env.println("e, &labcomm"+env.verStr+"_signature_" + env.prefix + getName() + ", "); env.println("e, &signature_" + env.prefix + getName() + ", ");
env.println("ioctl_action, va);"); env.println("ioctl_action, va);");
env.unindent(); env.unindent();
env.println("va_end(va);"); env.println("va_end(va);");
...@@ -1272,8 +1302,8 @@ aspect C_Signature { ...@@ -1272,8 +1302,8 @@ aspect C_Signature {
env.println("};"); env.println("};");
C_emitSizeofValue(env); C_emitSizeofValue(env);
env.println("struct labcomm"+env.verStr+"_signature labcomm"+env.verStr+"_signature_" + env.println("static struct labcomm"+env.verStr+"_signature " +
env.prefix + getName() + " = {"); "signature_" + env.prefix + getName() + " = {");
env.indent(); env.indent();
env.println("\"" + getName() + "\","); env.println("\"" + getName() + "\",");
env.println("sizeof_" + env.prefix + getName() + ","); env.println("sizeof_" + env.prefix + getName() + ",");
...@@ -1282,6 +1312,9 @@ aspect C_Signature { ...@@ -1282,6 +1312,9 @@ aspect C_Signature {
env.println("0"); env.println("0");
env.unindent(); env.unindent();
env.println(" };"); env.println(" };");
env.println("const struct labcomm"+env.verStr+"_signature " +
"*labcomm"+env.verStr+"_signature_" + env.prefix + getName() +
" = &signature_" + env.prefix + getName() + ";");
} }
public void Signature.C_emitSignature(C_env env, boolean decl){ public void Signature.C_emitSignature(C_env env, boolean decl){
...@@ -1407,7 +1440,7 @@ aspect C_Constructor { ...@@ -1407,7 +1440,7 @@ aspect C_Constructor {
} }
//XXX //XXX
public void SampleDecl.C_emitConstructor(C_env env) { public void SampleDecl.C_emitConstructor(C_env env) {
env.println("labcomm"+env.verStr+"_set_local_index(&labcomm"+env.verStr+"_signature_" + env.println("labcomm"+env.verStr+"_set_local_index(&signature_" +
env.prefix + getName() + ");"); env.prefix + getName() + ");");
} }
...@@ -1447,7 +1480,7 @@ aspect C_Sizeof { ...@@ -1447,7 +1480,7 @@ aspect C_Sizeof {
env.println("{"); env.println("{");
env.indent(); env.indent();
env.println("return labcomm"+env.verStr+"_internal_sizeof(" + env.println("return labcomm"+env.verStr+"_internal_sizeof(" +
"&labcomm" + env.verStr+"_signature_" + env.prefix + getName() + "&signature_" + env.prefix + getName() +
", v);"); ", v);");
env.unindent(); env.unindent();
env.println("}"); env.println("}");
...@@ -1463,6 +1496,10 @@ aspect C_Sizeof { ...@@ -1463,6 +1496,10 @@ aspect C_Sizeof {
return 0; return 0;
} }
public int SampleRefType.C_fixedSizeof() {
return 4;
}
public int PrimType.C_fixedSizeof() { public int PrimType.C_fixedSizeof() {
switch (getToken()) { switch (getToken()) {
case LABCOMM_BOOLEAN: { return 1; } case LABCOMM_BOOLEAN: { return 1; }
......
...@@ -21,6 +21,10 @@ aspect FlatSignature { ...@@ -21,6 +21,10 @@ aspect FlatSignature {
getType().flatSignature(list); getType().flatSignature(list);
} }
public void SampleRefType.flatSignature(SignatureList list) {
list.addInt(LABCOMM_SAMPLE_REF, "sample");
}
public void VoidType.flatSignature(SignatureList list) { public void VoidType.flatSignature(SignatureList list) {
list.addInt(LABCOMM_STRUCT, "void"); list.addInt(LABCOMM_STRUCT, "void");
list.addInt(0, null); list.addInt(0, null);
...@@ -92,6 +96,10 @@ aspect FlatSignature { ...@@ -92,6 +96,10 @@ aspect FlatSignature {
return getType().signatureComment() + " '" + getName() +"'"; return getType().signatureComment() + " '" + getName() +"'";
} }
public String SampleRefType.signatureComment() {
return "sample";
}
public String PrimType.signatureComment() { public String PrimType.signatureComment() {
return getName(); return getName();
} }
......
...@@ -23,6 +23,7 @@ Field ::= Type <Name:String>; ...@@ -23,6 +23,7 @@ Field ::= Type <Name:String>;
abstract Type; abstract Type;
VoidType : Type; VoidType : Type;
SampleRefType : Type;
PrimType : Type ::= <Name:String> <Token:int>; PrimType : Type ::= <Name:String> <Token:int>;
UserType : Type ::= <Name:String>; UserType : Type ::= <Name:String>;
StructType : Type ::= Field*; StructType : Type ::= Field*;
......
...@@ -33,7 +33,7 @@ public class LabComm { ...@@ -33,7 +33,7 @@ public class LabComm {
println("[ RAPID options ]"); println("[ RAPID options ]");
println(" --rapid Generates RAPID code in FILE.sys"); println(" --rapid Generates RAPID code in FILE.sys");
println("[ Misc options ]"); println("[ Misc options ]");
println(" --pretty Pretty prints on standard output"); println(" --pretty=PFILE Pretty prints to PFILE");
println(" --typeinfo=TIFILE Generates typeinfo in TIFILE"); println(" --typeinfo=TIFILE Generates typeinfo in TIFILE");
} }
......
...@@ -77,6 +77,7 @@ Type type = ...@@ -77,6 +77,7 @@ Type type =
| user_type.u {: return u; :} | user_type.u {: return u; :}
| struct_type.s {: return s; :} | struct_type.s {: return s; :}
| void_type.v {: return v; :} | void_type.v {: return v; :}
| sample_ref_type.s {: return s; :}
; ;
PrimType prim_type = PrimType prim_type =
...@@ -110,6 +111,10 @@ VoidType void_type = ...@@ -110,6 +111,10 @@ VoidType void_type =
VOID {: return new VoidType(); :} VOID {: return new VoidType(); :}
; ;
SampleRefType sample_ref_type =
SAMPLE {: return new SampleRefType(); :}
;
List dim_list = List dim_list =
dim.d {: return new List().add(d); :} dim.d {: return new List().add(d); :}
| dim_list.l dim.d {: return l.add(d); :} | dim_list.l dim.d {: return l.add(d); :}
......
aspect LabCommTokens { aspect LabCommTokens {
public static final int ASTNode.LABCOMM_VERSION = 0x01; public static final int ASTNode.LABCOMM_VERSION = 0x01;
public static final int ASTNode.LABCOMM_SAMPLE = 0x02; // The flat signature public static final int ASTNode.LABCOMM_SAMPLE_DEF = 0x02; // The flat signature
public static final int ASTNode.LABCOMM_TYPE_DEF = 0x03; // and type declarations, hierarchically public static final int ASTNode.LABCOMM_SAMPLE_REF = 0x03;
public static final int ASTNode.LABCOMM_TYPE_DEF = 0x04; // and type declarations, hierarchically
public static final int ASTNode.LABCOMM_ARRAY = 0x10; public static final int ASTNode.LABCOMM_ARRAY = 0x10;
public static final int ASTNode.LABCOMM_STRUCT = 0x11; public static final int ASTNode.LABCOMM_STRUCT = 0x11;
......
...@@ -68,8 +68,8 @@ aspect PrettyPrint { ...@@ -68,8 +68,8 @@ aspect PrettyPrint {
out.print("void"); out.print("void");
} }
public String PrimType.toString() { public void SampleRefType.ppPrefix(PrintStream out) {
return getName(); out.print("sample");
} }
public void PrimType.ppPrefix(PrintStream out) { public void PrimType.ppPrefix(PrintStream out) {
......
...@@ -176,6 +176,9 @@ aspect Signature { ...@@ -176,6 +176,9 @@ aspect Signature {
list.addInt(0, null); list.addInt(0, null);
} }
public void SampleRefType.genSigLineForDecl(SignatureList list, boolean decl) {
list.addInt(LABCOMM_SAMPLE_REF, "sample");
}
public void PrimType.genSigLineForDecl(SignatureList list, boolean decl) { public void PrimType.genSigLineForDecl(SignatureList list, boolean decl) {
list.addInt(getToken(), null); list.addInt(getToken(), null);
} }
...@@ -229,4 +232,5 @@ aspect Signature { ...@@ -229,4 +232,5 @@ aspect Signature {
public void VariableSize.genSigLineForDecl(SignatureList list, boolean decl) { public void VariableSize.genSigLineForDecl(SignatureList list, boolean decl) {
list.addInt(0, null); list.addInt(0, null);
} }
} }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<!-- "jflex" is an ant task class for the scanner generator in JFlex.jar --> <!-- "jflex" is an ant task class for the scanner generator in JFlex.jar -->
<taskdef name="jflex" classname="JFlex.anttask.JFlexTask" classpath="tools/JFlex.jar"/> <taskdef name="jflex" classname="JFlex.anttask.JFlexTask" classpath="tools/JFlex.jar"/>
<!-- "beaver" is an ant task class for the parser generator in beaver.jar --> <!-- "beaver" is an ant task class for the parser generator in beaver.jar -->
<taskdef name="beaver" classname="beaver.comp.run.AntTask" classpath="tools/beaver.jar"/> <taskdef name="beaver" classname="beaver.comp.run.AntTask" classpath="tools/beaver-ant.jar"/>
<!-- "jastadd" is an ant task class in jastadd2.jar --> <!-- "jastadd" is an ant task class in jastadd2.jar -->
<taskdef name="jastadd" classname="jastadd.JastAddTask" <taskdef name="jastadd" classname="jastadd.JastAddTask"
classpath="tools/jastadd2.jar"/> classpath="tools/jastadd2.jar"/>
......
...@@ -106,7 +106,7 @@ static void enqueue_decimation(struct decimating_private *decimating, ...@@ -106,7 +106,7 @@ static void enqueue_decimation(struct decimating_private *decimating,
static int wrap_reader_start( static int wrap_reader_start(
struct labcomm_reader *r, struct labcomm_reader *r,
struct labcomm_reader_action_context *action_context, struct labcomm_reader_action_context *action_context,
int local_index, int remote_index, struct labcomm_signature *signature, int local_index, int remote_index, const struct labcomm_signature *signature,
void *value) void *value)
{ {
struct decimating_private *decimating = action_context->context; struct decimating_private *decimating = action_context->context;
...@@ -133,7 +133,7 @@ static int wrap_reader_ioctl( ...@@ -133,7 +133,7 @@ static int wrap_reader_ioctl(
struct labcomm_reader *r, struct labcomm_reader *r,
struct labcomm_reader_action_context *action_context, struct labcomm_reader_action_context *action_context,
int local_index, int remote_index, int local_index, int remote_index,
struct labcomm_signature *signature, const struct labcomm_signature *signature,
uint32_t action, va_list args) uint32_t action, va_list args)
{ {
struct decimating_private *decimating = action_context->context; struct decimating_private *decimating = action_context->context;
...@@ -197,7 +197,7 @@ static int wrap_writer_alloc( ...@@ -197,7 +197,7 @@ static int wrap_writer_alloc(
static int wrap_writer_start( static int wrap_writer_start(
struct labcomm_writer *w, struct labcomm_writer *w,
struct labcomm_writer_action_context *action_context, struct labcomm_writer_action_context *action_context,
int index, struct labcomm_signature *signature, int index, const struct labcomm_signature *signature,
void *value) void *value)
{ {
struct decimating_private *decimating = action_context->context; struct decimating_private *decimating = action_context->context;
......
...@@ -44,13 +44,13 @@ struct introspecting_private { ...@@ -44,13 +44,13 @@ struct introspecting_private {
LABCOMM_SIGNATURE_ARRAY_DEF(local, LABCOMM_SIGNATURE_ARRAY_DEF(local,
struct local { struct local {
enum introspecting_status status; enum introspecting_status status;
struct labcomm_signature *signature; const struct labcomm_signature *signature;
}); });
}; };
static struct local *get_local(struct introspecting_private *introspecting, static struct local *get_local(struct introspecting_private *introspecting,
int index, int index,
struct labcomm_signature *signature) const struct labcomm_signature *signature)
{ {
/* Called with data_lock held */ /* Called with data_lock held */
struct local *local; struct local *local;
...@@ -137,7 +137,7 @@ static int wrap_reader_alloc( ...@@ -137,7 +137,7 @@ static int wrap_reader_alloc(
struct handles_signature { struct handles_signature {
struct introspecting_private *introspecting; struct introspecting_private *introspecting;
int index; int index;
struct labcomm_signature *signature; const struct labcomm_signature *signature;
}; };
static void send_handles_signature(void *arg) static void send_handles_signature(void *arg)
...@@ -156,7 +156,7 @@ static void send_handles_signature(void *arg) ...@@ -156,7 +156,7 @@ static void send_handles_signature(void *arg)
static int wrap_reader_start( static int wrap_reader_start(
struct labcomm_reader *r, struct labcomm_reader *r,
struct labcomm_reader_action_context *action_context, struct labcomm_reader_action_context *action_context,
int local_index, int remote_index, struct labcomm_signature *signature, int local_index, int remote_index, const struct labcomm_signature *signature,
void *value) void *value)
{ {
struct introspecting_private *introspecting = action_context->context; struct introspecting_private *introspecting = action_context->context;
...@@ -180,7 +180,7 @@ static int wrap_reader_start( ...@@ -180,7 +180,7 @@ static int wrap_reader_start(
struct labcomm_encoder *encoder, struct labcomm_encoder *encoder,
void *context) void *context)
{ {
struct labcomm_signature *signature = context; const struct labcomm_signature *signature = context;
introspecting_messages_handles_signature handles_signature; introspecting_messages_handles_signature handles_signature;
int index = 0; int index = 0;
...@@ -224,7 +224,7 @@ static int wrap_writer_alloc( ...@@ -224,7 +224,7 @@ static int wrap_writer_alloc(
static int wrap_writer_start( static int wrap_writer_start(
struct labcomm_writer *w, struct labcomm_writer *w,
struct labcomm_writer_action_context *action_context, struct labcomm_writer_action_context *action_context,
int index, struct labcomm_signature *signature, int index, const struct labcomm_signature *signature,
void *value) void *value)
{ {
struct introspecting_private *introspecting = action_context->context; struct introspecting_private *introspecting = action_context->context;
...@@ -243,7 +243,7 @@ static int wrap_writer_start( ...@@ -243,7 +243,7 @@ static int wrap_writer_start(
static int wrap_writer_ioctl( static int wrap_writer_ioctl(
struct labcomm_writer *w, struct labcomm_writer *w,
struct labcomm_writer_action_context *action_context, struct labcomm_writer_action_context *action_context,
int index, struct labcomm_signature *signature, int index, const struct labcomm_signature *signature,
uint32_t ioctl_action, va_list args) uint32_t ioctl_action, va_list args)
{ {
struct introspecting_private *introspecting = action_context->context; struct introspecting_private *introspecting = action_context->context;
......
...@@ -64,7 +64,7 @@ int labcomm_reader_free(struct labcomm_reader *r, ...@@ -64,7 +64,7 @@ int labcomm_reader_free(struct labcomm_reader *r,
int labcomm_reader_start(struct labcomm_reader *r, int labcomm_reader_start(struct labcomm_reader *r,
struct labcomm_reader_action_context *action_context, struct labcomm_reader_action_context *action_context,
int local_index, int remote_index, int local_index, int remote_index,
struct labcomm_signature *signature, const struct labcomm_signature *signature,
void *value) void *value)
{ {
UNWRAP(start, r, action_context, local_index, remote_index, signature, value); UNWRAP(start, r, action_context, local_index, remote_index, signature, value);
...@@ -85,7 +85,7 @@ int labcomm_reader_fill(struct labcomm_reader *r, ...@@ -85,7 +85,7 @@ int labcomm_reader_fill(struct labcomm_reader *r,
int labcomm_reader_ioctl(struct labcomm_reader *r, int labcomm_reader_ioctl(struct labcomm_reader *r,
struct labcomm_reader_action_context *action_context, struct labcomm_reader_action_context *action_context,
int local_index, int remote_index, int local_index, int remote_index,
struct labcomm_signature *signature, const struct labcomm_signature *signature,
uint32_t ioctl_action, va_list args) uint32_t ioctl_action, va_list args)
{ {
UNWRAP(ioctl, r, action_context, UNWRAP(ioctl, r, action_context,
...@@ -106,7 +106,7 @@ int labcomm_writer_free(struct labcomm_writer *w, ...@@ -106,7 +106,7 @@ int labcomm_writer_free(struct labcomm_writer *w,
int labcomm_writer_start(struct labcomm_writer *w, int labcomm_writer_start(struct labcomm_writer *w,
struct labcomm_writer_action_context *action_context, struct labcomm_writer_action_context *action_context,
int index, struct labcomm_signature *signature, int index, const struct labcomm_signature *signature,
void *value) void *value)
{ {
UNWRAP(start, w, action_context, index, signature, value); UNWRAP(start, w, action_context, index, signature, value);
...@@ -127,7 +127,7 @@ int labcomm_writer_flush(struct labcomm_writer *w, ...@@ -127,7 +127,7 @@ int labcomm_writer_flush(struct labcomm_writer *w,
int labcomm_writer_ioctl(struct labcomm_writer *w, int labcomm_writer_ioctl(struct labcomm_writer *w,
struct labcomm_writer_action_context *action_context, struct labcomm_writer_action_context *action_context,
int index, int index,
struct labcomm_signature *signature, const struct labcomm_signature *signature,
uint32_t ioctl_action, va_list args) uint32_t ioctl_action, va_list args)
{ {
UNWRAP(ioctl, w, action_context, index, signature, ioctl_action, args); UNWRAP(ioctl, w, action_context, index, signature, ioctl_action, args);
...@@ -250,7 +250,7 @@ void labcomm_set_local_index(struct labcomm_signature *signature) ...@@ -250,7 +250,7 @@ void labcomm_set_local_index(struct labcomm_signature *signature)
local_index++; local_index++;
} }
int labcomm_get_local_index(struct labcomm_signature *signature) int labcomm_get_local_index(const struct labcomm_signature *signature)
{ {
if (signature->index == 0) { if (signature->index == 0) {
labcomm_error_fatal_global(LABCOMM_ERROR_SIGNATURE_NOT_SET, labcomm_error_fatal_global(LABCOMM_ERROR_SIGNATURE_NOT_SET,
...@@ -259,7 +259,7 @@ int labcomm_get_local_index(struct labcomm_signature *signature) ...@@ -259,7 +259,7 @@ int labcomm_get_local_index(struct labcomm_signature *signature)
return signature->index; return signature->index;
} }
int labcomm_internal_sizeof(struct labcomm_signature *signature, int labcomm_internal_sizeof(const struct labcomm_signature *signature,
void *v) void *v)
{ {
int length = signature->encoded_size(v); int length = signature->encoded_size(v);
......
...@@ -119,6 +119,9 @@ int labcomm_decoder_decode_one( ...@@ -119,6 +119,9 @@ int labcomm_decoder_decode_one(
struct labcomm_decoder *decoder); struct labcomm_decoder *decoder);
void labcomm_decoder_run( void labcomm_decoder_run(
struct labcomm_decoder *decoder); struct labcomm_decoder *decoder);
int labcomm_decoder_sample_ref_register(
struct labcomm_decoder *decoder,