Beispiel #1
0
static void rline_call_update_hook (SLrline_Type *rli,
                                    SLFUTURE_CONST char *prompt,
                                    SLFUTURE_CONST char *buf,
                                    unsigned int len,
                                    unsigned int point, VOID_STAR cd)
{
    Rline_CB_Type *cb;

    (void) rli;
    (void) len;
    cb = (Rline_CB_Type *)cd;

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

    if ((-1 == SLang_push_mmt (cb->mmt))
            || (-1 == SLang_push_string (prompt))
            || (-1 == SLang_push_string (buf))
            || (-1 == SLang_push_int ((int) point))
            || ((cb->cd != NULL) && (-1 == SLang_push_anytype (cb->cd))))
    {
        (void) SLang_end_arg_list ();
        return;
    }

    (void) SLexecute_function (cb->update_hook);
}
Beispiel #2
0
void jed_get_blocal_var (char *name) /*{{{*/
{
   Jed_BLocal_Type *lv;

   lv = find_blocal_var (name, 1);
   if (lv == NULL)
     return;

   (void) SLang_push_anytype (lv->value);
}
Beispiel #3
0
static int call_simple_update_cb (SLang_Name_Type *f, Rline_CB_Type *cb, int *opt)
{
    if (f == NULL)
        return 0;

    if (-1 == SLang_start_arg_list ())
        return -1;
    if ((-1 == SLang_push_mmt (cb->mmt))
            || ((opt != NULL) && (-1 == SLang_push_int (*opt)))
            || ((cb->cd != NULL) && (-1 == SLang_push_anytype (cb->cd))))
    {
        (void) SLang_end_arg_list ();
        return -1;
    }
    return SLexecute_function (f);
}
Beispiel #4
0
static int test_type_sget (SLtype type, SLFUTURE_CONST char *name)
{
   Test_Type *t;
   int status;

   (void) type;
   if (-1 == pop_test_type (&t))
     return -1;

   status = -1;
   if (0 == strcmp (name, "field1"))
     status = SLang_push_int (t->field1);
   else if (0 == strcmp (name, "field2"))
     status = SLang_push_int (t->field2);
   else if (0 == strcmp (name, "any"))
     status = SLang_push_anytype (t->any);
   else
     SLang_verror (SL_INVALID_PARM,
		   "Test_Type.%s is invalid", name);

   free_test_type (t);
   return status;
}
Beispiel #5
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;
}