~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to examples/interface-tutorial-so/intview.c

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "stack-c.h"
 
2
 
 
3
 
 
4
/*--------------------------------------------------------
 
5
 * intview: interface for C displ function 
 
6
 *     should provide [X,Y,Z]=view(X,Y,Z)  at Scilab level 
 
7
 *
 
8
 *--------------------------------------------------------*/
 
9
 
 
10
extern void displ __PARAMS((double *a, int ma, int na, int *b, int mb, int nb, char *c, int mc, int nc));
 
11
 
 
12
int intview(fname) 
 
13
     char *fname;
 
14
{
 
15
  static int l1, m1, n1, l2, m2, n2, m3, n3, l3;
 
16
  static int minlhs=1, maxlhs=3, minrhs=3, maxrhs=3;
 
17
 
 
18
  /* Check number of inputs (rhs=3) and outputs (lhs=3) */
 
19
  CheckRhs(minrhs,maxrhs) ;
 
20
  CheckLhs(minlhs,maxlhs) ;
 
21
 
 
22
  /* Get X (1 ,double), Y (2, int) and  C (3, string) */
 
23
  GetRhsVar(1, "d", &m1, &n1, &l1);
 
24
  GetRhsVar(2, "i", &m2, &n2, &l2);
 
25
  GetRhsVar(3, "c", &m3, &n3, &l3);
 
26
 
 
27
  /* Call display function
 
28
     stk(l1)->X (double), istk(l2)->Y (int), cstk(l3)->Z  (char)    */
 
29
  displ(stk(l1), m1, n1, istk(l2), m2, n2, cstk(l3), m3, n3);
 
30
 
 
31
  /*  Return variables  */
 
32
  LhsVar(1) = 1;
 
33
  LhsVar(2) = 2;
 
34
  LhsVar(3) = 3;
 
35
  return 0;
 
36
}
 
37
 
 
38
/*--------------------------------------------------------
 
39
 * C function displ 
 
40
 *--------------------------------------------------------*/
 
41
 
 
42
void displ(a, ma, na, b, mb, nb, c, mc, nc)
 
43
     double *a; int *b; char *c;
 
44
     int ma, na, mb, nb, mc, nc;
 
45
{
 
46
  sciprint("First parameter (matrix) is %i x %i:\r\n",ma,na);
 
47
  sciprint("its (1,1) entry is %e (double).\r\n", a[0]);
 
48
  sciprint("Second parameter (matrix) is %i x %i:\r\n",mb,nb);
 
49
  sciprint("its (1,1) entry is %i (int).\r\n", b[0]);
 
50
  sciprint("Third parameter (string) is %i character long: it is the string \"%s\"\r\n",mc*nc, c);
 
51
}
 
52
 
 
53
 
 
54
 
 
55
 
 
56