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:
lisa neigut
2019-07-23 15:53:44 -05:00
committed by Rusty Russell
parent cfd56d86ee
commit b30d7d26ea
5 changed files with 46 additions and 6 deletions

15
tools/test/enum.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef LIGHTNING_TOOLS_TEST_ENUM_H
#define LIGHTNING_TOOLS_TEST_ENUM_H
#include <ccan/short_types/short_types.h>
#include <stdlib.h>
enum test_enum {
TEST_ONE,
TEST_TWO,
};
void towire_test_enum(u8 **pptr, const enum test_enum test_enum);
enum test_enum fromwire_test_enum(const u8 **cursor, size_t *max);
void printwire_test_enum(const char *fieldname, const enum test_enum *test_enum);
#endif /* LIGHTNING_TOOLS_TEST_ENUM_H */