File: i_mput.f

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (94 lines) | stat: -rw-r--r-- 2,237 bytes parent folder | download | duplicates (3)
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
86
87
88
89
90
91
92
93
94
       subroutine i_mput(fname)
c
       character*(*) fname
       integer topk,rhsk,topl,fd
       logical checkrhs,checklhs,getsmat,checkval,getscalar
       character*4 ityp

       include '../stack.h'
c
       integer iadr, sadr
       iadr(l)=l+l-1
       sadr(l)=(l/2)+1
       rhs = max(0,rhs)
c
       lbuf = 1
       topk = top 
       rhsk = rhs 
       if(.not.checkrhs(fname,1,3)) return
       if(.not.checklhs(fname,1,1)) return
c
c       checking variable fd (number 3)
c     
       if(rhs .le. 2) then
          fd=-1
       else
          if(.not.getscalar(fname,top,top-rhs+3,lr3)) return
          fd=stk(lr3)
       endif

c       checking variable res (number 1)
c       
       il=iadr(lstk(top-rhs+1))
       n1=istk(il+1)*istk(il+2)
       it=istk(il+3)
       l=il+4

c       checking variable type (number 2)
c 
       if(rhs .le. 1) then
          ityp(1:2)='l'//char(0)
          nlr2=1
       else
          if(.not.getsmat(fname,top,top-rhs+2,m2,n2,1,1,lr2,nlr2))
     $         return
          if(.not.checkval(fname,m2*n2,1)) return
          call cvstr(nlr2,istk(lr2),ityp,1)
          ityp(nlr2+1:nlr2+1)=char(0)
       endif

       if(ityp(1:1).eq.'u') then
          it1=10
          ik=2
       else
          it1=0
          ik=1
       endif
       if(nlr2.eq.3) ik=3
       if(ityp(ik:ik).eq.'c') then
          it1=it1+1
       elseif(ityp(ik:ik).eq.'s') then
          it1=it1+2
       elseif(ityp(ik:ik).eq.'l') then
          it1=it1+4
       else
          buf='Incorrect integer type: '//ityp
          call error(9991)
          return
       endif
c     converting data if necessary
       if(it1.ne.it) then
          inc=1
          if(mod(it,10).lt.mod(it1,10)) then
             inc=-1
             err=sadr(l+memused(it1,n1))-lstk(bot)
             if(err.gt.0) then
                call error(17)
                return
             endif
             call tpconv(it,it1,n1, istk(l),inc,istk(l),inc)
          endif
       endif


       call mputi(fd,istk(l),n1,ityp,err)
       if(err .gt. 0) then 
        buf = fname // ' Internal Error' 
        call error(999)
        return
       endif
c
       top=topk-rhs+1
       istk(il)=0
       lstk(top+1)=sadr(il+1)
       end