midlc-0.6.0 released / Samba4 Stubs

Andrew Tridgell tridge at osdl.org
Thu Feb 10 22:31:54 GMT 2005


Mike,

 >   http://jcifs.samba.org/src/midlc-0.6.0.tar.gz

Thanks! I've been looking through the code a bit, and I've found it
quite interesting. As I think you'd agree, its not a viable
replacement for pidl in Samba4, but if/when we do recode pidl in C
then I'd look at midlc for some ideas.

Perhaps the biggest shared problem between pidl and midlc is that
neither are template based. Both are based on initially processing the
IDL into an intermediate form, then having a secondary processor that
produces the target form from the intermediate form. Both suffer from
having too much "knowledge" embedded in the secondary processing. For
example, in midlc the emit_decoder_fragment() code in emit_svr_dec_c.c
has to "know" quite a lot about NDR, and mixes in a lot of C logic
with the actual template code. This is somewhat similar to the problem
in parser.pm in pidl, where the perl code has to know quite a lot
about the target, and mixes this knowledge into the generator
code. 

Ideally I'd like to see a template system, where a template file
contains named code fragments from the target language, with
substitution macros.

The difficult part is coming up with a templating system that allows
good separation of the "data" (the code fragments) from the logic,
without inventing a whole new language for the templating system
itself. It needs to be flexible enough to generate code for Java, C
and also different target systems (like ethereal code vs Samba code).

Jelmer is doing a bit of work at the moment to simplify the internals
of pidl. Once that is all done the code might be simple enough to
consider adding a template system. Jelmers aim is to simplify the code
enough so he can add support for some features he needs for DCOM that
would be too messy to add right now, but it might also be a good
starting point for doing templates eventually.

Cheers, Tridge


More information about the samba-technical mailing list