File: outname.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (48 lines) | stat: -rw-r--r-- 1,479 bytes parent folder | download
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
function [out,nwrk,txt]=outname(nwrk,typ,m,n,excluded)
//cette macro regarde si l'operation suivante est une affectation,
// si oui et si cette affectation ne se fait pas sur une des variables listees
//    dans le vecteur de chaine excluded, la macro retourne dans out
//    le nom sur lequel se fait l'affectation
// sinon elle alloue une matrice de taille m*n de type fortran typ dans le
//    tableau de travail correspondant (modifie en consequence nwrk)
//    et retourne
//      -dans out une chaine de la forme 'work(iwn)' ou 'iwork(iiwn)'
//        le n etant defini automatiquement.
//      -dans txt les lignes fortran permettant de definir iwn ou iiwn
//
//!
// Copyright INRIA
txt=[]
[lhs,rhs]=argn(0)
nvar=prod(size(typ))
if rhs<5 then excluded(nvar)=' ',end
for k=1:nvar
  op=lst(ilst+k)
  out(k)=' ';
  if op(1)=='1'&and(op(2)<>excluded(k)) then
    k3=find(op(2)==vnms(:,2))
    if k3==[] then
// la variable n'existe pas il faut lui allouer de la place
      if isnum(n(k))&isnum(m(k)) then
        //les dimensions sont des nombres l'emplacement sera alloue localement
        out(k)=op(2)
      else
        //dimensions formelles on alloue dans les tableau de travail
        [o,nwrk,t1]=getlocal(nwrk,op(2),typ(k),m(k),n(k))
        txt=[txt;t1]
        out(k)=o;
      end
    else
//  la variable existe deja 
      out(k)=op(2)
    end
  end
  if out(k)==' ' then
    [o,nwrk,t]=getwrk(nwrk,typ(k),m(k),n(k))
    out(k)=o;txt=[txt;t]
  end
end