Browse Source

...

generate_api
Volker Birk 3 years ago
parent
commit
deb2d11a08
4 changed files with 14 additions and 18 deletions
  1. +2
    -0
      api/config.yml2
  2. +10
    -6
      api/gen_c_header.ysl2
  3. +0
    -2
      api/message_api.yml2
  4. +2
    -10
      api/to_c.ysl2

+ 2
- 0
api/config.yml2 View File

@ -0,0 +1,2 @@
version = "version 2.0"
copyleft = "Copyleft (c) 2019, pEp foundation"

+ 10
- 6
api/gen_c_header.ysl2 View File

@ -7,19 +7,23 @@
include yslt.yml2
include ./config.yml2
tstylesheet {
include ./to_c.ysl2
template "/"
apply "package/package[type='api']", 0;
const "version" **version;
const "copyleft" **copyleft;
template "package" document "{@name}_api.h", "text" {
template "/package"
apply "package", 0;
template "package" document "{@name}_{@type}.h", "text" {
||
// pEp API version 2.0
// «../@name»_api.h
// «../@name» «$version»
// «@name»_«@type».h
// Copyleft (c) 2019, p≡p foundation
// «$copyleft»
#pragma once


+ 0
- 2
api/message_api.yml2 View File

@ -6,7 +6,6 @@
// written by Volker Birk
api message {
/*
struct message {
typedef enum _PEP_text_format {
@ -65,5 +64,4 @@ typedef struct _message {
}
*/
}

+ 2
- 10
api/to_c.ysl2 View File

@ -6,14 +6,6 @@
// written by Volker Birk
function "abbr" {
param "text";
if "$text" {
> «substring($text, 1, 1)»
call "abbr" with "text", "substring-after($text, '_')";
}
}
template "*", mode=name {
param "abbr", "false()";
if ".!=/*" {
@ -21,8 +13,8 @@ template "*", mode=name {
> _
}
choose {
when "name()='enum' and $abbr"
call "abbr" with "text", "@name";
when '@name="basic"'
> «/*/@name»
otherwise
> «@name»
}


Loading…
Cancel
Save