Browse Source

adding Kotlin

makefile-conf
Volker Birk 9 months ago
parent
commit
c34d1af73e
3 changed files with 41 additions and 1 deletions
  1. +1
    -0
      .gitignore
  2. +4
    -1
      src/Makefile
  3. +36
    -0
      src/gen_kotlin.ysl2

+ 1
- 0
.gitignore View File

@ -164,4 +164,5 @@ ws
src/PEPTransportStatusCode.h
src/transport_status_code.h
src/transport_status_code.c
src/TransportStatusCode.kt

+ 4
- 1
src/Makefile View File

@ -1,6 +1,6 @@
YML2PROC?=yml2proc
TARGET=transport_status_code.h transport_status_code.c PEPTransportStatusCode.h
TARGET=transport_status_code.h transport_status_code.c PEPTransportStatusCode.h TransportStatusCode.kt
TSC=$(wildcard *.tsc)
@ -15,6 +15,9 @@ transport_status_code.c: gen_strings.ysl2 transport_status_code.yml2 $(TSC)
PEPTransportStatusCode.h: gen_objc.ysl2 transport_status_code.yml2 $(TSC)
yml2proc -y $< -o $@ transport_status_code.yml2
TransportStatusCode.kt: gen_kotlin.ysl2 transport_status_code.yml2 $(TSC)
yml2proc -y $< -o $@ transport_status_code.yml2
.PHONY: clean
clean:


+ 36
- 0
src/gen_kotlin.ysl2 View File

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

Loading…
Cancel
Save