forked from pEp.foundation/libpEpTransport
generate header files for enums
parent
dab9e7849b
commit
91ccd168b0
@ -0,0 +1,18 @@
|
||||
YML2PROC?=yml2proc
|
||||
|
||||
TARGET=transport_status_code.h PEPTransportStatusCode.h
|
||||
|
||||
TSC=$(wildcard *.tsc)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
transport_status_code.h: gen_c.ysl2 transport_status_code.yml2 $(TSC)
|
||||
yml2proc -y $< -o $@ transport_status_code.yml2
|
||||
|
||||
PEPTransportStatusCode.h: gen_objc.ysl2 transport_status_code.yml2 $(TSC)
|
||||
yml2proc -y $< -o $@ transport_status_code.yml2
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
@ -0,0 +1,4 @@
|
||||
doc > transport status codes for Control Channel (0xfe)
|
||||
|
||||
hex unkown_sctp_error 0xfeffffff;
|
||||
|
@ -0,0 +1,12 @@
|
||||
doc > transport status codes for email (0x01)
|
||||
|
||||
// smtp
|
||||
|
||||
hex cannot_reach_smtp_server 0x01100001;
|
||||
hex unknown_smtp_error 0x0110ffff;
|
||||
|
||||
// imap
|
||||
|
||||
hex cannot_reach_imap_server 0x01110001;
|
||||
hex unknown_imap_error 0x0111ffff;
|
||||
|
@ -0,0 +1,47 @@
|
||||
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'"
|
||||
> PEP_«../@abbr»_«@name» = 0x«yml:dec2hex(.,$hexdigits)»
|
||||
otherwise
|
||||
> PEP_«../@abbr»_«@name» = «.»
|
||||
}
|
||||
if "position()!=last()" > ,
|
||||
if "@doc" > // «@doc»
|
||||
> \n
|
||||
}
|
||||
|
||||
template "doc"
|
||||
||
|
||||
|
||||
// «.»
|
||||
|
||||
||
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
include yslt.yml2
|
||||
|
||||
tstylesheet {
|
||||
include standardlib.ysl2
|
||||
|
||||
template "/enum"
|
||||
||
|
||||
#ifndef __PEP«yml:CamelCase(@name)»_H__
|
||||
#define __PEP«yml:CamelCase(@name)»_H__
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_CLOSED_ENUM(NSUInteger, PEP«yml:CamelCase(@name)») {
|
||||
`` apply "item|doc"
|
||||
};
|
||||
|
||||
#endif // __PEP«yml:CamelCase(@name)»_H__
|
||||
||
|
||||
|
||||
template "item" {
|
||||
param "hexdigits", 8;
|
||||
indent 0;
|
||||
choose {
|
||||
when "@output='hex'"
|
||||
> PEP«yml:CamelCase(../@name)»«yml:CamelCase(@name)» = 0x«yml:dec2hex(.,$hexdigits)»
|
||||
otherwise
|
||||
> PEP«CamelCase(../@name)»«CamelCase(@name)» = «.»
|
||||
}
|
||||
if "position()!=last()" > ,
|
||||
if "@doc" > // «@doc»
|
||||
> \n
|
||||
}
|
||||
|
||||
template "doc"
|
||||
||
|
||||
|
||||
// «.»
|
||||
|
||||
||
|
||||
}
|
||||
|
@ -0,0 +1,3 @@
|
||||
doc > transport status codes for PDL (0x03)
|
||||
|
||||
hex unknown_eth_error 0x03ffffff;
|
@ -0,0 +1,5 @@
|
||||
doc > transport status codes for RCE (0x02)
|
||||
|
||||
hex torrent_has_no_seeders 0x02ff0001;
|
||||
hex unknown_torrent_error 0x02ffffff;
|
||||
|
@ -0,0 +1,44 @@
|
||||
// this is the mandatory source for general TSCs
|
||||
// to compile set YML_PATH to pEpEngine/api
|
||||
|
||||
decl enum @name;
|
||||
decl item @name;
|
||||
decl hex is item (output=hex);
|
||||
|
||||
// the first octet is the transport id; for general values it is 0x00
|
||||
// the first bit of the second octet is set if this is an error state
|
||||
|
||||
enum transport_status_code abbr=tsc {
|
||||
hex ready 0x00000000;
|
||||
|
||||
doc > non error states
|
||||
|
||||
hex connection_up 0x00000002;
|
||||
hex message_delivered 0x00100000;
|
||||
hex message_on_the_way 0x00100001;
|
||||
hex could_not_deliver_resending 0x00100002;
|
||||
|
||||
doc > error states
|
||||
|
||||
hex connection_down 0x00700001 doc="sent by connection based transports";
|
||||
hex some_recipients_unreachable 0x00700002;
|
||||
hex no_recipients_reachable 0x00700003;
|
||||
hex no_config 0x00700004;
|
||||
hex config_incomplete_or_wrong 0x00700005;
|
||||
hex no_send_config 0x00700006;
|
||||
hex no_recv_config 0x00700007;
|
||||
hex send_config_incomplete_or_wrong 0x00700008;
|
||||
hex recv_config_incomplete_or_wrong 0x00700009;
|
||||
hex network_timeout 0x0070000a;
|
||||
hex could_not_deliver_giving_up 0x0070000b;
|
||||
|
||||
doc > transport is shut down
|
||||
|
||||
hex shut_down 0x00ffffff;
|
||||
|
||||
include ./email.tsc
|
||||
include ./rce.tsc
|
||||
include ./pdl.tsc
|
||||
include ./cc.tsc
|
||||
}
|
||||
|
Loading…
Reference in New Issue