libpEpTransport/src/gen_c.ysl2

48 lines
835 B
Plaintext
Raw Normal View History

2021-09-01 18:35:33 +02:00
include yslt.yml2
tstylesheet {
include standardlib.ysl2
template "/enum"
||
#ifndef __«yml:ucase(@name)»_H__
#define __«yml:ucase(@name)»_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef enum PEP_«@name» {
`` apply "item|doc"
} PEP_«@name»;
#ifdef __cplusplus
}
#endif
#endif // __«yml:ucase(@name)»_H__
||
template "item" {
param "hexdigits", 8;
indent 0;
choose {
when "@output='hex'"
2021-09-01 21:46:42 +02:00
> PEP_«yml:abbr(../@name)»_«@name» = 0x«yml:dec2hex(.,$hexdigits)»
2021-09-01 18:35:33 +02:00
otherwise
2021-09-01 21:46:42 +02:00
> PEP_«yml:abbr(../@name)»_«@name» = «.»
2021-09-01 18:35:33 +02:00
}
if "position()!=last()" > ,
if "@doc" > // «@doc»
> \n
}
template "doc"
||
// «.»
||
}