File: sci_xstringb.c

package info (click to toggle)
scilab 5.2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 334,832 kB
  • ctags: 52,586
  • sloc: xml: 526,945; ansic: 223,590; fortran: 163,080; java: 56,934; cpp: 33,840; tcl: 27,936; sh: 20,397; makefile: 9,908; ml: 9,451; perl: 1,323; cs: 614; lisp: 30
file content (85 lines) | stat: -rw-r--r-- 2,457 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

/*
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2006 - INRIA - Fabrice Leray
 * Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
 * 
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at    
 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 *
 */

/*------------------------------------------------------------------------*/
/* file: sci_xstringb.c                                                   */
/* desc : interface for xstringb routine                                  */
/*------------------------------------------------------------------------*/

#include "gw_graphics.h"
#include "stack-c.h"
#include "Scierror.h"
#include "sciCall.h"
#include "freeArrayOfString.h"
#include "localization.h"
/*--------------------------------------------------------------------------*/
int sci_xstringb(char *fname,unsigned long fname_len)
{
  int m1,n1,l1,m2,n2,l2,m3,n3,m4,n4,l4,m5,n5,l5,m6,n6,l6;
  BOOL autoSize = TRUE ;
  double x,y,w,hx;
  char **Str;
  double rect[4],angle=0;
  long hdlstr;
  double userSize[2] ;

  if ( Rhs <= 0 )
  {
    /* demo */
    sci_demo(fname, fname_len);
    return 0 ;
  }

  CheckRhs(5,6);

  GetRhsVar(1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&l1); CheckScalar(1,m1,n1);  x = *stk(l1);
  GetRhsVar(2,MATRIX_OF_DOUBLE_DATATYPE,&m2,&n2,&l2); CheckScalar(2,m2,n2);  y = *stk(l2);
  GetRhsVar(3,MATRIX_OF_STRING_DATATYPE,&m3,&n3,&Str);
  if ( m3*n3 == 0 )
	{
		LhsVar(1)=0;
		C2F(putlhsvar)();
		return 0;
	} 

  GetRhsVar(4,MATRIX_OF_DOUBLE_DATATYPE,&m4,&n4,&l4); CheckScalar(4,m4,n4);  w = *stk(l4);
  GetRhsVar(5,MATRIX_OF_DOUBLE_DATATYPE,&m5,&n5,&l5); CheckScalar(5,m5,n5);  hx = *stk(l5);

  if (Rhs == 6)
  {
    GetRhsVar(6,STRING_DATATYPE,&m6,&n6,&l6);
    if ( m6*n6 !=0 && strcmp(cstk(l6),"fill") == 0 )
    {
      autoSize = FALSE ;
    } 
    else
    {
      Scierror(999,_("%s: Wrong value for input argument #%d: '%s' expected.\n"), fname, 6, "fill");
      return 0;
    }
  }

  userSize[0] = w ;
  userSize[1] = hx ;
  Objstring (Str,m3,n3,x,y,&angle,rect,autoSize,userSize,&hdlstr,TRUE,NULL,NULL,FALSE,TRUE,FALSE,ALIGN_CENTER);

	freeArrayOfString(Str,m3*n3);

  LhsVar(1)=0;
	C2F(putlhsvar)();

  return 0;

}
/*--------------------------------------------------------------------------*/