users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Returning structures to Prolog from C code


From: FORT David
Subject: Re: Returning structures to Prolog from C code
Date: Thu, 06 Dec 2001 09:55:17 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6+) Gecko/20011121

Vic Bancroft wrote:


On Wed, 5 Dec 2001, FORT David wrote:

I see strange things when i try to return structures to prolog from C
code, here's some the samples:

implementation in C:
 ...
 functor_atom = ATOM_CHAR(',');
 ...
 tmp = Mk_Compound( functor_atom, 3, (PlTerm *)&args );
 ...
Here i'd expect (ip,'192.168.4.134',new) instead of
','(ip,'192.168.4.134',new)


You specifically asked for the atom ',' to be the functor for the compound
term, did you intend to construct a list instead ?

In that case, you might have been thinking of the '.' list constructor.

A prolog list, [ ip, '192.168.4.134', new ], would really be the same as,

 | ?- X =  '.'(ip, '.'('192.168.4.134', '.'( new, [] ) ) ).

 X = [ip,'192.168.4.134',new]

So instead, you might use, "Mk_Proper_List( 3, (PlTerm *)&args )"
more,
l8r,

-------------------------------------------------------------------
Victor Bancroft
Fellow, Artificial Intelligence Center               (706) 542-0358
Athens, Georgia  30602, U.S.A           http://ai.uga.edu/~bancroft
Principal Engineer, Zvolve Systems                  [v]770.551.4505
1050 Crown Pointe Pkwy, Suite 300, Atlanta GA 30338 [f]770.551.4509


Definitly not,[ip,'192.168.4.134',new] and (ip,'192.168.4.134',new) are not
the same. For example you can't match with (ip,X, Y) if it's a list.

address@hidden gave me the REAL solution: when i write
(ip,'192.168.4.134',new) i should have understand ','( ip, ','('192.168.4.134',new) )

Mk_Proper_List does this with a list, i think a Mk_Proper_Compound is
really missing here.

--
-- FORT David - address@hidden --
------- intranode: your e-security partner ----------------------






reply via email to

[Prev in Thread] Current Thread [Next in Thread]