Martin Kersten a écrit :
Guillaume Yziquel wrote:
Here's my use case:
I want to use MALparse in order to compile MAL from OCaml. (I want to do some rather involved stuff using Camlp4 to extend the syntax definition accepted by the OCaml compiler).
And I need to pass a Client as argument to MALparse.
The Mapi interface doesn't provide a way to grab Client structs. (It is clearly not its purpose). Therefore, I need a way to grab a Client struct, and it seems that this is available in mal_client.mx.
Then, I do not know how to grab the Client:
-1- Inspected the global array of clients?
-2- Use MCfindClient? Or MCinitClient?
Since you have found the code to deal with clients, you should have noticed there is a global table of Client records. The first represents the admin. In an embedded setting, you can access it directly and from there you are on your own.
Yes. That's what I'm currently doing. In fact, there's two clients. 1 for the admin, and 1 for the Mapi connection, I guess...
yziquel@seldon:~/git/ocaml-monetdb5$ utils/malclient.native Number of clients: 2
Client idx: 0 Client oid: 0 Client scenario: mal
Client idx: 1 Client oid: 0 Client scenario: mal
However, when inspecting the structs of the clients, I get the above. What I do not understand is whether or not the oids for both clients are supposed to be the same or not. Double-checked my code, and I didn't see any mistake. That's why I'm asking about what these oids are, in ClientRec structs.
However, as mentioned before, in an embedded system you preferrably access the kernel as a normal mclient -lmal user, which ensures proper client admin and handle all the MAL authorization, parsing, admin, and execution.
I understand your point. I'm trying to see to see to which extent my camlp4 project is realistic or not. So far, it seems realistic, even if that implies tinkering at a lower level than mapi.
There is no clear application requirement to look and work under the hood. For front-end languages the MAL layer is the abstract machine. Interaction organized through the mapi-interface of ascii text.
It's the ascii text part that I do not like (for my purposes). I'd want some sort of algebraic datatypes, rather. That's why I'm doing all this. -- Guillaume Yziquel http://yziquel.homelinux.org/