To build the list {1 2.3 {(5.8, 3.9) "Test"}} and push it onto the stack :

tst4.c

#include <hpgcc49.h>
#include <hpstack.h>

void main (void)
{
int ret;

// Creates the main list
list_t *lst, *lst2;
if (hps_list_create (&lst) == HPS_OK)
{
// Adds the values to the list
(void) hps_list_add_int (lst, 1);
(void) hps_list_add_real (lst, 2.4);

// Creates the sub-list
if (hps_list_create (&lst2) == HPS_OK)
{
// Complete the sub-list
complex_t cpx = {5.8, 3.9};
(void) hps_list_add_complex (lst2, &cpx);
(void) hps_list_add_str (lst2, "Test");

// Complete the main list
(void) hps_list_add_list (lst, lst2);
}

// Push it onto the stack
(void) hps_push_list (lst);

// Frees the allocated objects
(void) hps_list_destroy (&lst);

}
}

->



To push a 3 dimensions C array of integers :

tst5.c

#include <hpgcc49.h>
#include <hpstack.h>

int main(void)
{
int Ret;
array_t *array;

long long tab[3][2][4];
int i, j, k;

for (i = 0; i < 3; i++)
{
for (j = 0; j < 2; j++)
{
for (k = 0; k < 4; k++)
{
tab[i][j][k] = 100*i+10*j+k;
}
}
}

if ((Ret = hps_array_build (&array, (void *) tab, SAT_DOINT, 3, 3, 2, 4)) == HPS_OK)
{
(void) hps_push_array (array);
(void) hps_array_destroy (&array);
}
else
{
(void) hps_push_str (hps_error (Ret));
}

return (0);
}

->