示例#1
0
文件: vmshelp.c 项目: hankem/jed
int input_new_helptopic(struct dsc$descriptor_s *newtopic, /*{{{*/
			struct dsc$descriptor_s *prompt,
			unsigned int *len_newtopic)
{
   char *newtop, prompt_buf[256];
   int dofree;

   strncpy(prompt_buf,prompt->dsc$a_pointer,prompt->dsc$w_length);
   prompt_buf[prompt->dsc$w_length] = 0;

   newtop = "";
   dofree = 0;

   if ((SLang_run_hooks("vms_help_newtopic", 1, prompt_buf + 2) > 0)
       && (0 == SLpop_string (&newtop)))
     dofree = 1;

   strcpy (newtopic->dsc$a_pointer, newtop);
   *len_newtopic = newtopic->dsc$w_length = strlen (newtop);
   newtopic->dsc$b_dtype = DSC$K_DTYPE_T;
   newtopic->dsc$b_class = DSC$K_CLASS_S;

   if (dofree) SLfree(newtop);

   return(1);	/* should add codes that LIB$GET_INPUT can return */
}
示例#2
0
char *Plot_configure_axis (char *opt, int is_log, int has_numbers) /*{{{*/
{
   char *s;

   if (pli_undefined())
     return NULL;

   if (PLI->configure_axis == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: configure_axis operation is not supported");
        return NULL;
     }

   SLang_start_arg_list ();
   SLang_push_string (opt);
   SLang_push_integer (is_log);
   SLang_push_integer (has_numbers);
   SLang_end_arg_list ();

   if (-1 == SLexecute_function (PLI->configure_axis))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "plot: configure_axis failed");
        return NULL;
     }

   if (-1 == SLpop_string (&s))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: configure_axis failed");
        return NULL;
     }

   return s;
}
示例#3
0
char *Plot_get_option_string_default (void) /*{{{*/
{
   char *s;

   if (pli_undefined())
     return NULL;

   if (PLI->default_axis == NULL)
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__,
                    "plot: default_axis operation is not supported");
        return NULL;
     }

   if (-1 == SLexecute_function (PLI->default_axis))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "plot: default_axis failed");
        return NULL;
     }

   if (-1 == SLpop_string (&s))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: default_axis failed");
        return NULL;
     }

   return s;
}
示例#4
0
文件: slstd.c 项目: ebichu/dd-wrt
static void intrin_putenv (void) /*{{{*/
{
   char *s;

   /* Some putenv implementations required malloced strings. */
   if (SLpop_string(&s)) return;

   if (putenv (s))
     {
	SLang_set_error (SL_OS_Error);
	SLfree (s);
     }

   /* Note that s is NOT freed */
}
示例#5
0
static void _readcol (void) /*{{{*/
{
   FILE *fp = NULL;
   char *file = NULL;
   SLang_Array_Type *sl_cols = NULL;
   unsigned int *cols = NULL;
   unsigned int ncols, nx;
   double *x = NULL;
   int ret = -1;

   if ((-1 == SLpop_string (&file))
       || (-1 == SLang_pop_array_of_type (&sl_cols, SLANG_UINT_TYPE))
       || (sl_cols == NULL))
     goto finish;

   cols = (unsigned int *) sl_cols->data;
   ncols = sl_cols->num_elements;

   fp = fopen (file, "r");
   if (fp == NULL)
     {
        isis_vmesg (FAIL, I_READ_OPEN_FAILED, __FILE__, __LINE__, "%s", file);
        goto finish;
     }

   if ((-1 == uniq_cols (cols, &ncols))
       || (-1 == ascii_readcol (fp, cols, ncols, &x, &nx))
       || (-1 == push_cols (x, nx, ncols)))
     goto finish;

   ret = 0;
   finish:

   if (ret) isis_throw_exception (Isis_Error);
   if (fp) fclose (fp);
   ISIS_FREE (x);
   ISIS_FREE (file);
   SLang_free_array (sl_cols);
}
示例#6
0
文件: readline.c 项目: hankem/S-Lang
static char *read_using_readline (SLang_Load_Type *x)
{
    char *s;
    static char *last_s;

    if (last_s != NULL)
    {
        SLfree (last_s);
        last_s = NULL;
    }

    if (SLang_get_error ())
        return NULL;

    SLKeyBoard_Quit = 0;

    s = get_input_line (x);

    if (s == NULL)
        return NULL;

    if ((x->parse_level == 0)
            && (1 == SLang_run_hooks ("slsh_interactive_massage_hook", 1, s)))
    {
        SLfree (s);
        if (-1 == SLpop_string (&s))
            return NULL;
    }

    if (SLang_get_error ())
    {
        SLfree (s);
        return NULL;
    }

    last_s = s;
    return s;
}