[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Returning structures to Prolog from C code
From: |
FORT David |
Subject: |
Returning structures to Prolog from C code |
Date: |
Wed, 05 Dec 2001 18:08:26 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6+) Gecko/20011121 |
I see strange things when i try to return structures to prolog from C code,
here's some the samples:
implementation in C:
Bool test_list( PlTerm *list)
{
int ip_atom;
int new_atom;
int functor_atom;
PlTerm args[4];
PlTerm tmp;
ip_atom = Create_Atom( "ip" );
new_atom = Create_Atom( "new" );
functor_atom = ATOM_CHAR(',');
args[0] = Mk_Atom( ip_atom );
args[1] = Mk_String( "192.168.4.134" );
args[2] = Mk_Atom( new_atom );
tmp = Mk_Compound( functor_atom, 3, (PlTerm *)&args );
*list = tmp;
return TRUE;
}
prolog declaration
:- foreign(test_list(-term)).
And the faulty example:
| ?- test_list( X ).
X = ','(ip,'192.168.4.134',new)
yes
| ?-
Here i'd except (ip,'192.168.4.134',new) instead of
','(ip,'192.168.4.134',new)
Am i missing something ?
PS: please CC 'cause i'm not subscribed to the list
--
-- FORT David - address@hidden --
------- intranode: your e-security partner ----------------------
- Returning structures to Prolog from C code,
FORT David <=