mat_getsym Subroutine

public subroutine mat_getsym()

Arguments

None

Contents

Source Code


Variables

Type Visibility Attributes Name Initial
integer, public :: chcnt
integer, public :: i
doubleprecision, public :: s
integer, public :: sign
integer, public :: ss
doubleprecision, public :: syv

Source Code

subroutine mat_getsym()

! ident_5="@(#) M_matrix mat_getsym(3fp) get a symbol"

doubleprecision   :: syv
doubleprecision   :: s

integer      :: sign
integer      :: chcnt
integer      :: ss
integer      :: i
!.......................................................................
   INFINITE : do
      if (G_CHRA .ne. blank) exit INFINITE
      call mat_getch() ! get next character
   enddo INFINITE
!.......................................................................
   G_LINE_POINTER(2) = G_LINE_POINTER(3)
   G_LINE_POINTER(3) = G_LINE_POINTER(4)
   if ( verify(achar(G_CHRA),digit) == 0) then
      call mat_getval(syv)
      if (G_CHRA .ne. dot) goto 60
      call mat_getch() ! get next character
   elseif (verify(achar(G_CHRA),digit//big//little//achar(score))== 0) then ! alphameric (0-9a-zA-Z_)
      ! name
      G_SYM = isname
      G_SYN=blank
      G_SYN(1) = G_CHRA
      do i=2,GG_MAX_NAME_LENGTH
         call mat_getch() ! get next character
         ! if not alphanumeric and not special like eol
         if (verify(achar(G_CHRA),digit//big//little//achar(score))== 0 ) then
            G_SYN(i) = G_CHRA
         else
            exit
         endif
      enddo

      goto 90
   else ! special character
      ss = G_SYM
      G_SYM = G_CHRA
      call mat_getch() ! get next character
      if (G_SYM .ne. dot) goto 90
      ! is dot part of number or operator
      syv = 0.0d0
      if (.not.(verify(achar(G_CHRA),digit)== 0) ) then ! not a number character
         if (G_CHRA.eq.star.or.G_CHRA.eq.slash.or.G_CHRA.eq.bslash) goto 90
         if (ss.eq.star .or. ss.eq.slash .or. ss.eq.bslash) goto 90
      endif
   endif

   ! number
   chcnt = G_LINE_POINTER(4)
   call mat_getval(s)
   chcnt = G_LINE_POINTER(4) - chcnt
   if (G_CHRA .eq. GG_EOL) chcnt = chcnt+1
   syv = syv + s/10.0d0**chcnt
   goto 60

60 continue

   if (.not.(G_CHRA.ne.d_low .and. G_CHRA.ne.e_low .and. G_CHRA.ne.d_up .and. G_CHRA.ne.e_up) )then
      call mat_getch() ! get next character
      sign = G_CHRA
      if (sign.eq.minus .or. sign.eq.plus) call mat_getch() ! get next character
      call mat_getval(s)
      if (sign .ne. minus) syv = syv*10.0d0**s
      if (sign .eq. minus) syv = syv/10.0d0**s
   endif
   GM_IMAGS(GM_BIGMEM) = mat_flop(syv)
   G_SYM = isnum
   goto 90

90 continue

   if (G_CHRA .eq. blank) then
      call mat_getch() ! get next character till a non-blank is found
      goto 90
   endif

end subroutine mat_getsym