Passing a list as a argument via C

Emanuele Bastianelli <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAMMJy4BiHuXwarKMUoj4tCo429jiHow1TK1F2eNSUXrns=U09g@mail.gmail.com>
Hi to all,

I've a little problem with my C interface to Prolog.
I need to pass a list as an argument to my Prolog query, and i tried to use
PlTail but it didn't work.
This is my code:

PlTermv argomentiVar((int)req.arg.size());

for(int i=0; i<(int)req.arg.size(); ++i){
    if (req.arg[i][0] == '[')
    {

       PlTail list(argomentiVar[i]);
        string substring = req.arg[i].substr(1,req.arg[i].length()-2);
        char* tokens = strtok((char *)substring.c_str(), ",");
        while(tokens != NULL) {
        list.append(tokens);
        tokens = strtok(NULL,",");

    }
    list.close();
    }
}

PlString PlS = PlString(req.predicate.c_str());
PlQuery eF(PlS, argomentiVar);

I want PlTail to be an argument of tipe list, as for the query eF, for
example [a,b,c,d].

Thank you
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.