Esempio n. 1
0
int Plot_reset_viewer_size (float width_cm, float aspect) /*{{{*/
{
   int status;

   if (pli_undefined())
     return -1;

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

   SLang_start_arg_list ();
   SLang_push_float (width_cm);
   SLang_push_float (aspect);
   SLang_end_arg_list ();

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

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: set_viewer_size failed");
        return -1;
     }

   return status;
}
Esempio n. 2
0
static int do_binary_function (double (*f)(double, double))
{
   SLtype type;
   Array_Or_Scalar_Type a_ast, b_ast, c_ast;

   if (-1 == pop_2_arrays_or_scalar (&a_ast, &b_ast))
     return -1;

   c_ast.is_float = (a_ast.is_float && b_ast.is_float);
   c_ast.at = NULL;
   c_ast.num = 1;
   c_ast.inc = 0;
   if (c_ast.is_float)
     {
	type = SLANG_FLOAT_TYPE;
	c_ast.fptr = &c_ast.f;
     }
   else
     {
	type = SLANG_DOUBLE_TYPE;
	c_ast.dptr = &c_ast.d;
     }

   if ((a_ast.at != NULL) || (b_ast.at != NULL))
     {
	if (NULL == (c_ast.at = create_from_tmp_array (a_ast.at, b_ast.at, type)))
	  {
	     free_array_or_scalar (&a_ast);
	     free_array_or_scalar (&b_ast);
	     return -1;
	  }
	c_ast.fptr = (float *) c_ast.at->data;
	c_ast.dptr = (double *) c_ast.at->data;
	c_ast.num = c_ast.at->num_elements;
	c_ast.inc = 1;
     }

   if (a_ast.is_float)
     {
	if (b_ast.is_float)
	  (void) do_ff_fun (f, &a_ast, &b_ast, &c_ast);
	else
	  (void) do_fd_fun (f, &a_ast, &b_ast, &c_ast);
     }
   else if (b_ast.is_float)
     (void) do_df_fun (f, &a_ast, &b_ast, &c_ast);
   else
     (void) do_dd_fun (f, &a_ast, &b_ast, &c_ast);
   
   free_array_or_scalar (&a_ast);
   free_array_or_scalar (&b_ast);

   if (c_ast.at != NULL)
     return SLang_push_array (c_ast.at, 1);

   if (c_ast.is_float)
     return SLang_push_float (c_ast.f);

   return SLang_push_double (c_ast.d);
}
Esempio n. 3
0
int Plot_y_errorbar (int n, float *x, float *top, float *bot, /*{{{*/
                     float terminal_length)
{
   int status = -1;

   if (pli_undefined())
     return -1;

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

   SLang_start_arg_list ();
   status = push_three_float_arrays (n, x, top, bot);
   SLang_push_float (terminal_length);
   SLang_end_arg_list ();

   if ((status < 0) || (-1 == SLexecute_function (PLI->plot_y_errorbar)))
     {
        isis_vmesg (FAIL, I_FAILED, __FILE__, __LINE__, "failed plotting Y errorbar");
        return -1;
     }

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "failed plotting Y errorbar");
        return -1;
     }

   return status;
}
Esempio n. 4
0
int _Plot_draw_box (char *xopt, float xtick, int nxsub, /*{{{*/
                     char *yopt, float ytick, int nysub)
{
   int status;

   if (pli_undefined())
     return -1;

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

   SLang_start_arg_list ();
   SLang_push_string (xopt);
   SLang_push_float (xtick);
   SLang_push_integer (nxsub);
   SLang_push_string (yopt);
   SLang_push_float (ytick);
   SLang_push_integer (nysub);
   SLang_end_arg_list ();

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

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: draw_box failed");
        return -1;
     }

   return status;
}
Esempio n. 5
0
int Plot_put_text_offset (char *where, float offset, float ox, float oy, char *text) /*{{{*/
{
   int status;

   if (pli_undefined())
     return -1;

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

   SLang_start_arg_list ();
   SLang_push_string (where);
   SLang_push_float (offset);
   SLang_push_float (ox);
   SLang_push_float (oy);
   SLang_push_string (text);
   SLang_end_arg_list ();

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

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: put_text_offset failed");
        return -1;
     }

   return status;
}
Esempio n. 6
0
int Plot_put_text (float x, float y, float angle, float justify, char *txt) /*{{{*/
{
   int status;

   if (pli_undefined())
     return -1;

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

   SLang_start_arg_list ();
   SLang_push_float (x);
   SLang_push_float (y);
   SLang_push_float (angle);
   SLang_push_float (justify);
   SLang_push_string (txt);
   SLang_end_arg_list ();

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

   if (-1 == SLang_pop_integer (&status))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__, "plot: put_text_xy failed");
        return -1;
     }

   return status;
}
Esempio n. 7
0
static int float_push (SLtype unused, VOID_STAR ptr)
{
    (void) unused;
    SLang_push_float (*(float *) ptr);
    return 0;
}