Esempio n. 1
0
static int null_pop (SLtype type, VOID_STAR ptr)
{
   (void) type;

   if (-1 == SLang_pop_null ())
     return -1;

   *(char **) ptr = NULL;
   return 0;
}
Esempio n. 2
0
static void set_prompt_hook (void)
{
    SLang_Name_Type *h;

    if (SLang_peek_at_stack () == SLANG_NULL_TYPE)
    {
        SLang_pop_null ();
        h = NULL;
    }
    else if (NULL == (h = SLang_pop_function ()))
        return;

    if (Prompt_Hook != NULL)
        SLang_free_function (Prompt_Hook);

    Prompt_Hook = h;
}
Esempio n. 3
0
static int pop_fd_set (SLang_Array_Type **ats,
		       fd_set **fd_set_p, fd_set *fd_set_buf,
		       int *max_n)
{
   unsigned int num, i;
   SLang_Array_Type *at;
   SLFile_FD_Type **f;

   *ats = NULL;
   *fd_set_p = NULL;

   if (SLang_peek_at_stack () == SLANG_NULL_TYPE)
     return SLang_pop_null ();

   if (-1 == SLang_pop_array_of_type (&at, SLANG_FILE_FD_TYPE))
     return -1;

   FD_ZERO(fd_set_buf);
   *fd_set_p = fd_set_buf;

   *ats = at;
   num = at->num_elements;
   f = (SLFile_FD_Type **) at->data;

   for (i = 0; i < num; i++)
     {
	int fd;

	if (-1 == SLfile_get_fd (f[i], &fd))
	  continue;

	if (fd > *max_n)
	  *max_n = fd;

	FD_SET(fd, fd_set_buf);
     }

   return 0;
}
Esempio n. 4
0
static int execute_read_callback (CSV_Type *csv, char **sptr)
{
   char *s;

   *sptr = NULL;

   if ((-1 == SLang_start_arg_list ())
       || (-1 == SLang_push_anytype (csv->callback_data))
       || (-1 == SLang_end_arg_list ())
       || (-1 == SLexecute_function (csv->read_callback)))
     return -1;

   if (SLang_peek_at_stack () == SLANG_NULL_TYPE)
     {
	(void) SLang_pop_null ();
	return 0;
     }

   if (-1 == SLang_pop_slstring (&s))
     return -1;

   *sptr = s;
   return 1;
}
Esempio n. 5
0
static int pop_new_push_old (SLang_Name_Type **handler)
{
   SLang_Name_Type *new_handler;
   SLang_Name_Type *old_handler;

   old_handler = *handler;
   if (SLang_peek_at_stack () == SLANG_NULL_TYPE)
     {
	SLang_pop_null ();
	new_handler = NULL;
     }
   else if (NULL == (new_handler = SLang_pop_function ()))
     return -1;

   if (-1 == _pSLang_push_nt_as_ref (old_handler))
     {
	SLang_free_function (new_handler);
	return -1;
     }

   SLang_free_function (old_handler);
   *handler = new_handler;
   return 0;
}
Esempio n. 6
0
static int null_to_bool (SLtype type, int *t)
{
   (void) type;
   *t = 0;
   return SLang_pop_null ();
}