pEpEngine/api/to_c.ysl2

55 lines
1.1 KiB
Plaintext
Raw Normal View History

2019-02-05 22:20:23 +01:00
// p≡p API C data types mapping
// Copyleft (c) 2019, p≡p foundation
2019-02-05 22:20:23 +01:00
// this file is under GNU General Public License 3.0
// see LICENSE.txt
// written by Volker Birk
template "*", mode=name {
param "abbr", "false()";
if ".!=/*" {
apply "..", 0, mode=name;
> _
}
choose {
2019-02-05 21:12:23 +01:00
when '@name="basic"'
> «/*/@name»
otherwise
> «@name»
}
}
function "name" {
param "abbr", "false()";
apply ".", mode=name with "abbr", "$abbr";
}
def "func:name" {
param "abbr", "false()";
result call "name" with "abbr", "$abbr";
}
2019-02-07 15:30:58 +01:00
def "func:basetype" {
param "type";
const "definition", "//type[@name=$type]";
choose {
when "$definition/extends"
result "func:c-type($definition/extends/@type)";
otherwise
result "func:c-type($type)";
}
}
def "func:c-type" {
param "dsltype";
choose {
when "$dsltype = 'string' or $dsltype = 'binary'"
result "'char *'";
otherwise
result "$dsltype";
}
}