Browse Source

generate label function

makefile-conf
Volker Birk 9 months ago
parent
commit
b70fdf9c7a
3 changed files with 47 additions and 1 deletions
  1. +1
    -0
      .gitignore
  2. +4
    -1
      src/Makefile
  3. +42
    -0
      src/gen_strings.ysl2

+ 1
- 0
.gitignore View File

@ -163,4 +163,5 @@ ws
# generated files
src/PEPTransportStatusCode.h
src/transport_status_code.h
src/transport_status_code.c

+ 4
- 1
src/Makefile View File

@ -1,6 +1,6 @@
YML2PROC?=yml2proc
TARGET=transport_status_code.h PEPTransportStatusCode.h
TARGET=transport_status_code.h transport_status_code.c PEPTransportStatusCode.h
TSC=$(wildcard *.tsc)
@ -9,6 +9,9 @@ all: $(TARGET)
transport_status_code.h: gen_c.ysl2 transport_status_code.yml2 $(TSC)
yml2proc -y $< -o $@ transport_status_code.yml2
transport_status_code.c: gen_strings.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


+ 42
- 0
src/gen_strings.ysl2 View File

@ -0,0 +1,42 @@
include yslt.yml2
tstylesheet {
include standardlib.ysl2
template "/enum"
||
#include <pEp/«@name».h>
#ifdef __cplusplus
extern "C" {
#endif
const char *«@name»_label(PEP_«@name» value)
{
switch (value) {
`` apply "item|doc"
default:
return "unknown";
}
} PEP_«@name»;
#ifdef __cplusplus
}
#endif
||
template "item"
||
case PEP_«yml:abbr(../@name)»_«@name»:
return "«translate(@name,'_',' ')»";
||
template "doc"
||
// «.»
||
}

Loading…
Cancel
Save