! Calculeaza nodurile "xn" si ponderile "w"
! xn(0:n); w(0:n) - in work
!
subroutine node_weight(kod)
use work

character(80) antet, linie
character(2) n_char, n_egal*6
integer width

character(260) fname_wx, fname_2, titlu*80
integer status

!open(2, file ='Gauss-Leg.dat', status ='old', form ='formatted', err =100)
fname_wx =Exe_Dir(:l_exe)//'\Gauss-Leg.dat'
open(2, file =fname_wx, status ='old', form ='formatted', err =100)
GOTO 200

100 continue
write(*,*) 'Fisierul "Gauss-Leg.dat" nu s-a gasit !'

titlu ='Selecteza Fisierul de Ponderi_si_Noduri'C
call GetFile(fname_2, status, titlu)
open(2, file =fname_2, status ='old', form ='formatted', err =150)
goto 200

150 kod =-1
RETURN

200 continue
! Read w si xn:
read(2, '(a)') antet
! Gaseste "n =n_dat":
n_w =width(n)
write(n_char, '(I<n_w>)') n
n_egal ='      '

n_egal ='n = '//n_char(:n_w)

300 read(2,'(a)', end =400) linie
len_l =len_trim(linie)
if(linie(1:len_l) ==n_egal(:4+n_w)) then
do i=1,n
read(2,*) ii, w(ii), xn(ii)
enddo
!*
do i=1,n
write(*,*) i, w(i), xn(i)
enddo
!*
goto 450

else
goto 300
endif

400 continue
write(*,*) n_egal,' nu s-a gasit!'
write(1,*) n_egal,' nu s-a gasit!'
kod =-1

450 continue
close(2)
END subroutine node_weight