/* CTF 1.8 */
typealias integer { size = 8; align = 8; signed = false; base = hex; } := uint8_t;
typealias integer { size = 32; align = 8; signed = false; base = hex;  } := uint32_t;

trace {
    major = 1;
    minor = 2;
    byte_order = le;
    uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa";
    packet.header := struct  {
        uint32_t magic;                        
    };
};

variant var {
    uint8_t small;
    uint32_t big;
};

enum select : uint8_t { small = 0, big = 1 };

stream {
    event.header := struct {
        enum select a;
    };
};

event {
    name = event1;
    fields := struct {
	/*
	 * TODO: Only an identifier is expected in the variant/sequence
	 * tag. It should be a dotted expression (a path).
	 *
	 */
        variant var <stream.event.header.a> b;

	/*
	 * TODO
	 * The path lookup only allows lookup for a full path starting
	 * from the root or for a field within the current scope. The
	 * CTF spec allows defining a relative sub-scope for a preceding
	 * field.
	 */
	struct {
		enum select sel2;
	} str2;
        variant var2 <str2.sel2> b;

	/*
	 * TODO: Deal with path name lookup conflict, e.g. if a field is
	 * named "stream", it conflicts with the stream dynamic scope.
	 * Local fields hide dynamic scopes.
	 */
	struct {
		enum select sel3
	} stream;
        variant var3 <stream.sel3> c;
	/* But now the following lookup should fail: */
	/* variant var4 <stream.event.header.a> d; */

	/*
	 * TODO: support conflict-free local-scoped tags, starting with
	 * ".".
	 */
	variant var5 <.stream.sel3> e;
    };
};
