On 2010-02-04 13:09, Guillaume Yziquel wrote:
Hi.
I'm investigating how to connect custom streams to a Mapi structure. I've been reading, for instance the start_mal_server() function of monetdb5-server-5.16.2/src/tools/embeddedclient.c.in.
I now sort of understand how the stream library works (though not fully), and I'm trying to understand how the streams are effectively used by the client of the Mapi struct.
I've therefore looking at the start_mal_server() function, and here's a piece of code whose semantics I do not understand:
in = ((stream **) arg)[0]; out = ((stream **) arg)[1]; free(arg); snprintf(buf, sizeof(buf), "in := \"" PTRFMT "\":streams;\n" "out := \"" PTRFMT "\":streams;\n" "mapi.malclient(in, out);\n", PTRFMTCAST in, PTRFMTCAST out); callString(mal_clients, buf, 0);
I'm specifically interested in the 'in' stream since it is the one I would like to write to.
Could someone enlighten me here?
All the best,
It's a bit of a hack. The problem is, we have a C pointer to a stream and we want to give that to the MAL layer. So what happens is, a MAL command is constructed which looks something like in := "0x123456":streams; The string value "0x123456" is cast to a MAL streams type, and in doing so, the string is interpreted as a number and the numeric value is then used. -- Sjoerd Mullender