~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/m2sci/sci_files/sci_setstr.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [tree]=sci_setstr(tree)
 
2
// Copyright INRIA
 
3
// M2SCI function
 
4
// Conversion function for Matlab setstr()
 
5
// Input: tree = Matlab funcall tree
 
6
// Ouput: tree = Scilab equivalent for tree
 
7
// Emulation function: mtlb_setstr()
 
8
// V.C.
 
9
 
 
10
X = getrhs(tree)
 
11
 
 
12
if X.vtype==String then
 
13
  set_infos([
 
14
      "In "+expression2code(tree)+" "+expression2code(X)+" is a String"
 
15
      "So result is set to "+expression2code(X)],0)
 
16
  // Because of String concatenation
 
17
  if typeof(X)=="operation" then
 
18
    X.out(1)=tree.lhs(1)
 
19
  elseif typeof(X)=="funcall" then
 
20
    X.lhs(1)=tree.lhs(1)
 
21
  end
 
22
  tree=X
 
23
elseif X.vtype==Unknown then
 
24
  tree.name="mtlb_setstr"
 
25
  tree.lhs(1).dims=X.dims
 
26
  tree.lhs(1).type=Type(String,Real)
 
27
else
 
28
  tree.name="ascii"
 
29
  if X.dims(1)==1 | is_a_scalar(X) then // Row vector or scalar
 
30
    tree.lhs(1).dims=X.dims
 
31
    tree.lhs(1).type=Type(String,Real)
 
32
  else
 
33
    tree.name="mtlb_setstr"
 
34
    tree.lhs(1).dims=X.dims
 
35
    tree.lhs(1).type=Type(String,Real)
 
36
  end
 
37
end
 
38
endfunction