C++ - SWI-Prolog : Question regarding PL_new_term_refs

View: New views
1 Messages — Rating Filter:   Alert me  

C++ - SWI-Prolog : Question regarding PL_new_term_refs

by Uwe Lesta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

The manual say
term_t PL_new_term_refs(int n)
     Return n new term references. The first term-reference is returned. The others are t+1, t+2, etc. ...


But i get the same term_t for different calls


void test()
{
        printf("test\n");
        PlTermv av(2);

        term_t t1;
        term_t t2;

        t1 = PL_new_term_refs(2);
        t2 = PL_new_term_refs(2);
        printf("---------------\n");
        printf("%ld", t1);
        printf("\n");
        printf("%ld", t2);
        printf("\n\n");

// All ok here output ist 13 and 15. fine

        av[1] = PlCodeList("abc");

        PlQuery q("member", av);
        int count = 0;
        while( q.next_solution() )
        {
                printf((char *)av[0]);
                printf("\n");

                // NOT OK HERE
                if(count == 0)
                        t1 = PL_new_term_refs(2);
                else if(count == 1)
                        t2 = PL_new_term_refs(2);

                count ++;
        }

        printf("---------------\n");
        printf("%ld", t1);
        printf("\n");
        printf("%ld", t2);
        printf("\n");

// OUTPUT IS 77 and 77 I'll expect 77 and 79
}


Can someone explain please.

What i realy like to do is to copy the PlTermV av of all
solutions into a list as copies.


Thanks in advance

Uwe




--

Kind regards

Uwe Lesta


Telefon: +49(531) 38747-14
Fax:     +49(531) 38747-17
E-Mail:  Lesta at sbs-softwaresysteme.de


SBS-Softwaresysteme GmbH                Geschäftsführer:
Jasperalleee 13                         Klaus Wagner
D -38102 Braunschweig
Tel.: +49(531) 38747-0


Handelsregister Sitz der Gesellschaft:
Amtsgericht Braunschweig HRB 4481       38102 Braunschweig
Steuernummer: 14/201/32196




------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@...