
4 changed files with 239 additions and 0 deletions
@ -0,0 +1,29 @@ |
|||
YML_PATH+=:../ |
|||
COMPILER=test_api.ysl2 |
|||
BUILD_DIR=output |
|||
|
|||
SRC=$(wildcard *.yml2) |
|||
SRC_XML=$(addsuffix .xml, $(basename $(SRC))) |
|||
|
|||
|
|||
.PHONY: all xml compile clean |
|||
all: xml compile |
|||
|
|||
compile: $(BUILD_DIR)/* |
|||
|
|||
xml: $(SRC_XML) |
|||
|
|||
$(BUILD_DIR)/*: $(BUILD_DIR) $(SRC) $(COMPILER) |
|||
YML_PATH=$(YML_PATH) yml2proc -y $(COMPILER) $(SRC) |
|||
diff $(BUILD_DIR)/typesys.out $(BUILD_DIR)/typesys.out.target |
|||
|
|||
$(BUILD_DIR): |
|||
mkdir $(BUILD_DIR) |
|||
|
|||
%.xml: %.yml2 |
|||
YML_PATH=$(YML_PATH) yml2proc -P $< -o $@ |
|||
|
|||
clean: |
|||
rm -rf \
|
|||
./$(BUILD_DIR)/*.out \
|
|||
$(SRC_XML) |
@ -0,0 +1,136 @@ |
|||
// basetypes |
|||
idltype: string |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: basetype |
|||
idl_type_get_resolved_typekind: basetype |
|||
idl_type_get_resolved_type: string |
|||
idl_type_is_of_typekind_basetype: true |
|||
idl_type_is_of_typekind_deftype: false |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: false |
|||
|
|||
idltype: binary |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: basetype |
|||
idl_type_get_resolved_typekind: basetype |
|||
idl_type_get_resolved_type: binary |
|||
idl_type_is_of_typekind_basetype: true |
|||
idl_type_is_of_typekind_deftype: false |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: false |
|||
|
|||
idltype: int |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: basetype |
|||
idl_type_get_resolved_typekind: basetype |
|||
idl_type_get_resolved_type: int |
|||
idl_type_is_of_typekind_basetype: true |
|||
idl_type_is_of_typekind_deftype: false |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: false |
|||
|
|||
idltype: uint |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: basetype |
|||
idl_type_get_resolved_typekind: basetype |
|||
idl_type_get_resolved_type: uint |
|||
idl_type_is_of_typekind_basetype: true |
|||
idl_type_is_of_typekind_deftype: false |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: false |
|||
|
|||
idltype: size |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: basetype |
|||
idl_type_get_resolved_typekind: basetype |
|||
idl_type_get_resolved_type: size |
|||
idl_type_is_of_typekind_basetype: true |
|||
idl_type_is_of_typekind_deftype: false |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: false |
|||
|
|||
idltype: bool |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: basetype |
|||
idl_type_get_resolved_typekind: basetype |
|||
idl_type_get_resolved_type: bool |
|||
idl_type_is_of_typekind_basetype: true |
|||
idl_type_is_of_typekind_deftype: false |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: false |
|||
|
|||
idltype: opaque |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: basetype |
|||
idl_type_get_resolved_typekind: basetype |
|||
idl_type_get_resolved_type: opaque |
|||
idl_type_is_of_typekind_basetype: true |
|||
idl_type_is_of_typekind_deftype: false |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: false |
|||
|
|||
// deftype basetype |
|||
idltype: deftype1 |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: deftype |
|||
idl_type_get_resolved_typekind: basetype |
|||
idl_type_get_resolved_type: size |
|||
idl_type_is_of_typekind_basetype: false |
|||
idl_type_is_of_typekind_deftype: true |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: false |
|||
|
|||
idltype: deftype2 |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: deftype |
|||
idl_type_get_resolved_typekind: basetype |
|||
idl_type_get_resolved_type: string |
|||
idl_type_is_of_typekind_basetype: false |
|||
idl_type_is_of_typekind_deftype: true |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: false |
|||
|
|||
// deftype generic |
|||
idltype: stringlist |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: deftype |
|||
idl_type_get_resolved_typekind: false |
|||
idl_type_get_resolved_type: list |
|||
idl_type_is_of_typekind_basetype: false |
|||
idl_type_is_of_typekind_deftype: true |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: false |
|||
|
|||
// enum |
|||
idltype: enum1 |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: enum |
|||
idl_type_get_resolved_typekind: enum |
|||
idl_type_get_resolved_type: enum1 |
|||
idl_type_is_of_typekind_basetype: false |
|||
idl_type_is_of_typekind_deftype: false |
|||
idl_type_is_of_typekind_enum: true |
|||
idl_type_is_of_typekind_struct: false |
|||
|
|||
// struct |
|||
idltype: struct1 |
|||
idl_type_is_defined: true |
|||
idl_type_get_typekind_of_type: struct |
|||
idl_type_get_resolved_typekind: struct |
|||
idl_type_get_resolved_type: struct1 |
|||
idl_type_is_of_typekind_basetype: false |
|||
idl_type_is_of_typekind_deftype: false |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: true |
|||
|
|||
// undefined |
|||
idltype: undefined |
|||
idl_type_is_defined: false |
|||
idl_type_get_typekind_of_type: false |
|||
idl_type_get_resolved_typekind: false |
|||
idl_type_get_resolved_type: undefined |
|||
idl_type_is_of_typekind_basetype: false |
|||
idl_type_is_of_typekind_deftype: false |
|||
idl_type_is_of_typekind_enum: false |
|||
idl_type_is_of_typekind_struct: false |
|||
|
@ -0,0 +1,21 @@ |
|||
pEpACIDLang { |
|||
include pEpACIDLang.yml2 |
|||
|
|||
package idl_test { |
|||
api typesys { |
|||
deftype deftype1 as size; |
|||
deftype deftype2 as string; |
|||
deftype stringlist as list<string>; |
|||
|
|||
enum enum1 { |
|||
item item1; |
|||
item item2; |
|||
}; |
|||
|
|||
struct struct1 { |
|||
field int int1; |
|||
field size size1; |
|||
}; |
|||
}; |
|||
}; |
|||
} |
@ -0,0 +1,53 @@ |
|||
include yslt.yml2 |
|||
|
|||
tstylesheet { |
|||
include standardlib.ysl2 |
|||
include idl_api.ysl2 |
|||
|
|||
|
|||
template "api" document "output/typesys.out", "text" { |
|||
|| |
|||
// basetypes |
|||
«func:typeinfo('string')» |
|||
«func:typeinfo('binary')» |
|||
«func:typeinfo('int')» |
|||
«func:typeinfo('uint')» |
|||
«func:typeinfo('size')» |
|||
«func:typeinfo('bool')» |
|||
«func:typeinfo('opaque')» |
|||
// deftype basetype |
|||
«func:typeinfo('deftype1')» |
|||
«func:typeinfo('deftype2')» |
|||
// deftype generic |
|||
«func:typeinfo('stringlist')» |
|||
// enum |
|||
«func:typeinfo('enum1')» |
|||
// struct |
|||
«func:typeinfo('struct1')» |
|||
// undefined |
|||
«func:typeinfo('undefined')» |
|||
|| |
|||
} |
|||
|
|||
def "func:typeinfo" { |
|||
param "idltype"; |
|||
result call "typeinfo" with "idltype", "$idltype"; |
|||
}; |
|||
|
|||
function "typeinfo" { |
|||
param "idltype"; |
|||
|| |
|||
idltype: «$idltype» |
|||
idl_type_is_defined: «func:idl_type_is_defined($idltype)» |
|||
idl_type_get_typekind_of_type: «func:idl_type_get_typekind_of_type($idltype)» |
|||
idl_type_get_resolved_typekind: «func:idl_type_get_resolved_typekind($idltype)» |
|||
idl_type_get_resolved_type: «func:idl_type_get_resolved_type($idltype)» |
|||
idl_type_is_of_typekind_basetype: «func:idl_type_is_of_typekind_basetype($idltype)» |
|||
idl_type_is_of_typekind_deftype: «func:idl_type_is_of_typekind_deftype($idltype)» |
|||
idl_type_is_of_typekind_enum: «func:idl_type_is_of_typekind_enum($idltype)» |
|||
idl_type_is_of_typekind_struct: «func:idl_type_is_of_typekind_struct($idltype)» |
|||
|| |
|||
} |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue