Browse Source

generate C#

master
Volker Birk 1 month ago
parent
commit
ab3442596a
5 changed files with 53 additions and 3 deletions
  1. +1
    -0
      .gitignore
  2. +10
    -2
      src/Makefile
  3. +37
    -0
      src/gen_cs.ysl2
  4. +4
    -0
      src/rce.tsc
  5. +1
    -1
      src/sctp.tsc

+ 1
- 0
.gitignore View File

@ -165,4 +165,5 @@ src/PEPTransportStatusCode.h
src/transport_status_code.h
src/transport_status_code.c
src/TransportStatusCode.kt
src/transport_status_code.cs

+ 10
- 2
src/Makefile View File

@ -1,6 +1,7 @@
YML2PROC?=yml2proc
PREFIX?=$(HOME)
TARGET=transport_status_code.h transport_status_code.c PEPTransportStatusCode.h TransportStatusCode.kt
TARGET=transport_status_code.h transport_status_code.c PEPTransportStatusCode.h TransportStatusCode.kt transport_status_code.cs
TSC=$(wildcard *.tsc)
@ -18,7 +19,14 @@ PEPTransportStatusCode.h: gen_objc.ysl2 transport_status_code.yml2 $(TSC)
TransportStatusCode.kt: gen_kotlin.ysl2 transport_status_code.yml2 $(TSC)
yml2proc -y $< -o $@ transport_status_code.yml2
.PHONY: clean
transport_status_code.cs: gen_cs.ysl2 transport_status_code.yml2 $(TSC)
yml2proc -y $< -o $@ transport_status_code.yml2
.PHONY: clean install
clean:
rm -f $(TARGET)
install:
mkdir -p $(PREFIX)/include/pEp
cp -f transport_status_code.h $(PREFIX)/include/pEp/

+ 37
- 0
src/gen_cs.ysl2 View File

@ -0,0 +1,37 @@
include yslt.yml2
tstylesheet {
include standardlib.ysl2
template "/enum"
||
namespace pEp {
enum «yml:CamelCase(@name)»
{
`` apply "item|doc", 2
}
}
||
template "item" {
param "hexdigits", 8;
indent 0;
choose {
when "@output='hex'"
> «yml:CamelCase(@name)» = 0x«yml:dec2hex(.,$hexdigits)»
otherwise
> «yml:CamelCase(@name)» = «.»
}
if "position()!=last()" > ,
if "@doc" > // «@doc»
> \n
}
template "doc"
||
// «.»
||
}

+ 4
- 0
src/rce.tsc View File

@ -1,5 +1,9 @@
doc > transport status codes for RCE (0x02)
hex rce_cannot_create_user 0x02800001;
hex rce_cannot_login_user 0x02800002;
hex rce_cannot_find_user 0x02800003;
hex torrent_has_no_seeders 0x02ff0001;
hex unknown_torrent_error 0x02ffffff;

+ 1
- 1
src/sctp.tsc View File

@ -1,3 +1,3 @@
doc > transport status codes for pp over SCTP (0x04)
doc > transport status codes for pEp over SCTP (0x04)
hex unkown_sctp_error 0x04ffffff;

Loading…
Cancel
Save