Browse Source

Add example interface

main
heck 2 years ago
parent
commit
0ffc4b6c1e
  1. 21
      examples/Makefile
  2. 84
      examples/interface_example1.yml2

21
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

84
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 {
}
}
Loading…
Cancel
Save