File: sascii.f

package info (click to toggle)
scilab 2.2-4
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 31,472 kB
  • ctags: 21,963
  • sloc: fortran: 110,983; ansic: 89,717; makefile: 3,016; sh: 1,892; csh: 150; cpp: 101
file content (38 lines) | stat: -rw-r--r-- 1,004 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
      subroutine sascii(n,line,job)
c     n: entier, longueur de la chaine a convertir
c     copi de cvstr 
c     line: vecteur entier, contient des caracteres scilab ou ASCII 
C     qui sont transformes de l'un dans l'autre suivant job 
c     job: entier, si egal a 1: scilab-->ascii
c                  si egal a 0: ascii-->scilab
c
c!
      include '../stack.h'
c
      integer line(*),mc
c
      if(job.eq.0) goto 40
      do 30 j=1,n
         m=line(j)
         if(abs(m).gt.csiz) m=99
         if(m.eq.99) goto 10
         if(m.lt.0) then
            line(j)=ichar(alfb(abs(m)+1))
         else
            line(j)=ichar(alfa(m+1))
         endif
         goto 30
 10      line(j)=ichar('        !')
 30   continue
      return
 40   do 50 j=1,n
         mc=line(j)
         do 45 k=1,csiz
            k1=k
            if(mc.eq.ichar(alfa(k)).or.mc.eq.ichar(alfb(k))) goto 46
 45      continue
 46      line(j)=k1-1
         if(mc.ne.ichar(alfa(k1))) line(j)=-(k1-1)
 50   continue
      end