Generated Code (Re: [OPW] Generated swapping and size-checking code integration)
Christian Linhart
chris at DemoRecorder.com
Wed Feb 25 23:51:13 PST 2015
Hi all,
Since Asalle is sick since a while,
I post here the generated code from one of the last revisions
of Asalle's repository,
so that we can discuss the generated code here,
( The latest revision of her repo has a make-issue,
so I took the generated code from a workspace that
I have built on Feb 16th)
The general approach of this generator is to treat
fixed-size parts and variable-sized parts of the
protocol the same way. This has the advantage of
making the generator much simpler,
and therefore more reliable and easier to understand
and to maintain.
I'll post the generated code in-message as replies to this
message. This will make commenting the code easier.
(Since I use a web-mailer, some line-breaks may be introduced.
I hope that this will not make much difference.
After all, this is just C-code and not a patch.)
Regards,
Chris
On 02/16/15 20:46, Asal Mirzaieva wrote:
> Hi all,
>
> I am the Outreachy (called before OP, OPW) participant for Xorg (www.x.org/wiki/XorgOPW/ <http://www.x.org/wiki/XorgOPW/>) for project "Server-side XCB", my task is to write generator for swapping and size-checking functions and integrate the generated code into Xsever.
>
> Here is the link tobitbucket <bitbucket.org/AsalleKim/gen_swap_check>. I didn't create patch, because in my opinion it's pretty inconvenient to send patches with code written from scratch, though it's a powerful tool for maintaining already existing code. The repo contains forked xserver from main xserver repo <http://cgit.freedesktop.org/xorg/xserver/>. It uses some changes in xcb made by Christian Linhart and Jaya Tiwari, the changes are in pending patches and will be soon applied (if they are not already). This mainly touches the valueparam to switch replacement in xproto.xml.
> As valueparam is deprecated, the generator, I am working on, does not support it.
>
> Generator's code can process almost all extensions, but I am now mainly working on Shape and Xproto.
> For now it creates source file and header file in the directory proto/gen and then they are built with automake (proto/Makefile.am).
>
> There are several things I was not sure about.
> 1. The working name of the swapping and size-checking functions generator is gen_swap_check, which is rather awkward. But I couldn't invent anything better.
>
> 2. To test the code I need to integrate it to the xserver. I already made some changes into Xext/shape.c so it uses the generated code now. The Xext/shape.h must include the swapcheck_shape.h (generated one). Would it be okay if I copy all generated headers to {installdir}/include/xcb, mixing the genswap-generated code and the regular code, generated by c_client.py? And copy the compiled swapcheck_* files to {installdir}/lib.
>
> 3. proto/Makefile.am is written in such way that no make targets are declared. How can I add cp commad to it?
>
> 4. When building several warnings in included file os.h appeared. How can I get rid of them? Or should I ignore them?
> /home/asalle/xorg/Debug2/test-install/include/xorg/os.h:541:1: warning: redundant redeclaration of 'strndup' [-Wredundant-decls]
> 1055 strndup(const char *str, size_t n);
> This is the short overview of swapping and size-checking functions generator,
> I would be glad to hear your comments and messages about found bugs,
> Asalle
>
>
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
More information about the xorg-devel
mailing list