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: Vic Bancroft
Subject: Re: Returning structures to Prolog from C code
Date: Wed, 5 Dec 2001 16:11:05 -0500 (EST)

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




reply via email to

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