mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
bolt-gen: handle enums
Add parsing know-how for enum fields. This is necessary for internally defined wire generators. Enums are denoted by prefixing the field with an `e:`. Ex: msgdata,msg_name,field_name,e:enum_type,
This commit is contained in:
committed by
Rusty Russell
parent
cfd56d86ee
commit
b30d7d26ea
18
tools/test/enum.c
Normal file
18
tools/test/enum.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "enum.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void towire_test_enum(u8 **pptr, const enum test_enum test_enum)
|
||||
{
|
||||
printf("this would have been the towire for enum %u\n", test_enum);
|
||||
}
|
||||
|
||||
enum test_enum fromwire_test_enum(const u8 **cursor, size_t *max)
|
||||
{
|
||||
printf("fromwire_test_enum at %ld\n", *max);
|
||||
return TEST_ONE;
|
||||
}
|
||||
|
||||
void printwire_test_enum(const char *fieldname, const enum test_enum *test_enum)
|
||||
{
|
||||
printf("%u\n", *test_enum);
|
||||
}
|
||||
Reference in New Issue
Block a user