You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
1.2 KiB

// p≡p API C data types mapping
// Copyleft (c) 2019, p≡p foundation
// 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;
if "@name!='basic' and @name != string(../@name)"
> _
}
if "@name!='basic' and @name != string(../@name)"
> «@name»
}
function "name" {
param "abbr", "false()";
apply ".", mode=name with "abbr", "$abbr";
}
def "func:name" {
param "abbr", "false()";
result call "name" with "abbr", "$abbr";
}
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'"
result > char *
when "$dsltype = 'binary'"
result > unsigned char *
when "$dsltype = 'unsigned'"
result > unsigned int
otherwise
result "$dsltype";
}
}