2014.08.12 11:26, Anton Lavrik rašė:
> Here is the correct sequence of commands:
>
> $ piqi cc > piqi.piqi
$ piqi cc -o piqi.endpoint.piqi piqi.endpoint # missed this
> $ piqi cc -t pb -o endpoint.piqi.pb piqi.endpoint.piqi
> $ piqi compile --self-spec endpoint.piqi.pb demo.piqi
$ piqi cc > piqi.piqi
Put built-in piqi specification (NOT language) to a file. This has default extensions (protobuf, json).
$ piqi cc -o piqi.endpoint.piqi piqi.endpoint
Concatenate piqi.endpoint and piqi.piqi. Make an extended piqi definition here.
$ piqi cc -t pb -o endpoint.piqi.pb piqi.endpoint.piqi
Make protobuf version of extended piqi definition.
$ piqi compile --self-spec endpoint.piqi.pb demo.piqi
$ piqi compile --self-spec endpoint.piqi.pb demo.piqi -o demo.pb
So this is the xml|json|pb|piqi version of my demo.piqi. To prove a point, I could load it from C++:
* $ piqi to-proto piqi.endpoint.piqi
* piqi.endpoint.piqi.proto is the definition of the language (compile C++ files from it)
* demo.piqi is the protobuf payload.
Now the question is: if I want to extend piqic-erlang to generate a constant with a list in a header file, I have to modify piqic-erlang, in particular src/piqic_erlang_types.erl.
Is my understanding sort of correct?
> "piqi cc" and "piqi compile" are meant to be used together and their only purpose is to work with language extensions. They are useless otherwise.
`piqi cc` manipulates the (extended) language.
`piqi compile` manipulates the payload in a given extended language.
Is my understanding correct?
> To understand what is going on under the hood, especially with regard to imports/includes you can run commands with --trace flag (well, to some extent...).
'--trace' only prints when it's searching for included modules and trying to resolve symbols.. Useful, but doesn't help understanding the flow.
If my assumptions about piqic-erlang are correct, it will keep me busy for a while (or at least evaluate that we are not going this route). Thanks!
Motiejus