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

« back to all changes in this revision

Viewing changes to macros/m2sci/sci_files/sci_fseek.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_fseek(tree)
 
2
// Copyright INRIA
 
3
// M2SCI function
 
4
// Conversion function for Matlab fseek()
 
5
// Input: tree = Matlab funcall tree
 
6
// Ouput: tree = Scilab equivalent for tree
 
7
// V.C.
 
8
 
 
9
[fid,offset,origin]=getrhs(tree)
 
10
 
 
11
if typeof(origin)=="cste" then
 
12
  select origin.value
 
13
  case "bof" then
 
14
    flag="set"
 
15
  case "cof" then
 
16
    flag="cur"
 
17
  case "eof" then
 
18
    flag="end"
 
19
  case -1 then
 
20
    flag="set" // Should not happen because -1 is an operation...
 
21
  case 0 then
 
22
    flag="cur"
 
23
  case 1 then
 
24
    flag="end"
 
25
  else
 
26
    set_infos("Not enough information on "+expression2code(origin)+" to set the proper flag",1)
 
27
    flag=Funcall("fseek_origin",1,list(origin),list())
 
28
  end
 
29
else
 
30
  if typeof(origin)=="operation" then
 
31
    if origin.operator=="-" then
 
32
      if origin.operands==list(Cste(1)) then
 
33
        flag="set"
 
34
      end
 
35
    end
 
36
  else
 
37
    set_infos("Not enough information on "+expression2code(origin)+" to set the proper flag",1)
 
38
    flag=Funcall("fseek_origin",1,list(origin),list())
 
39
  end
 
40
end
 
41
 
 
42
tree.name="mseek"
 
43
tree.rhs=Rhs(offset,fid,flag)
 
44
 
 
45
tree.lhs(1).dims=list(1,1)
 
46
tree.lhs(1).type=Type(Double,Real)
 
47
 
 
48
endfunction