diff --git a/examples/Makefile b/examples/Makefile new file mode 100644 index 0000000..9c04384 --- /dev/null +++ b/examples/Makefile @@ -0,0 +1,21 @@ +# TODO: +# Incremental compilation impossible without redundantly specifying +# files that will be generated in the makefile + + +TARGET_XML+=prototype_api.xml + +.PHONY: all yml clean + +all: c_interface $(TARGET_XML) + +c_interface: + YML_PATH=../pEp_idl yml2proc -y ../pEp_idl/gen_c_header.ysl2 prototype_api.yml2 + +xml: $(TARGET_XML) + +%.xml: %.yml2 + YML_PATH=../pEp_idl yml2proc -P $< -o $@ + +clean: + rm -f *.xml *.xsl *.h diff --git a/examples/interface_example1.yml2 b/examples/interface_example1.yml2 new file mode 100644 index 0000000..dd2d1dd --- /dev/null +++ b/examples/interface_example1.yml2 @@ -0,0 +1,84 @@ +include pEp_idl_grammar.yml2 + +package pkg { + version 1.0; + license "License text"; + copyleft "Copyleft text"; + + api api1 { + // These are the idl basetypes + // They should be in the package 'pEpIdl' + // And they need to be 'imported' into every module. + // But currently there is no import/depends concept implemented + type string; + type binary; + type int; + type uint; + type size; + type bool; + type opaque; + + // This is part of the API def + type stringalias is string; + + enum enum1 { + item item1 doc="oneline doc"; + item item2 doc=""; + item item3 + doc= + """ + item 3 + ------ + multiline + doc + """; + }; + + enum enum2 { + item item1 0; + item item2 1; + item item3 2 + doc= + """ + + + + item 3 + ------ + + multiline + + doc with bad formattting """; + }; + + enum enum3 { + hex item1 0x00; + hex item2 0x10 doc="oneline doc"; + hex item3 0xff + doc= + """ + item 3 + ------ + multi line + doc + """; + }; + + struct struct1 { + field int int1; + field size size1 doc="short doc"; + field string string1 + doc=""" + Multiline + Doc + """, + bla="fds"; + }; + }; + + api api2 { + + + } +} +