Discussions related to Visual Prolog
alex63
Posts: 4
Joined: 11 Mar 2012 10:17

How to transfer a domain int_List to a Visual Prolog 7.5 in C ++?

Unread post by alex63 »

How to transfer a domain int_List to a Visual Prolog 7.5 in C ++?

Code: Select all

domains     int_List =node(integer,int_List);nil().     fnak_addKZ_Robot=(string Kz ,int_list Nodes) -> integer procedure language stdcall.
This structure int_list in C++ not equivalent Visual Prolog 7.5.

<pre>typedef struct node {
unsigned char func ;
int val;
struct node *next;
} int_list;

int fnak_addKZ_Robot(wchar_t *kz ,int_list nodes);</pre>
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

See Functor Domain Layout.

There are no functors in the node's and the empty list is represented by the pointer value 1. It can be declared like this:

<pre>typedef struct node *int_list;

struct node {
int head;
int_list tail;
};

const int_list empty = (int_list)1;</pre>

Also remember the __stdcall in the function declaration:

<pre>extern "C" {
int __stdcall fnak_addKZ_Robot(wchar_t *kz, int_list nodes) {
if (empty == nodes) {
...
} else {
...
}
}
}</pre>
Regards Thomas Linder Puls
PDC
alex63
Posts: 4
Joined: 11 Mar 2012 10:17

Unread post by alex63 »

It helped. Thank you. :D
Post Reply