replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Using GET_FILES@ doesn't work in Plato, or does it?
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using GET_FILES@ doesn't work in Plato, or does it?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
erie



Joined: 24 Jul 2009
Posts: 6

PostPosted: Fri Jul 24, 2009 10:48 pm    Post subject: Using GET_FILES@ doesn't work in Plato, or does it? Reply with quote

Hi everyone. I use Plato 4.2.0 recently dowloaded in my laptop, Windows Vista. GET_FILES@ is a standard subroutine in F77 language also carried on in FTN95. So I am not sure what's going on. I use the following subroutine call and produces nothing (no compiling errors either, only warnings) although it should give me the files names in current working directory. Any suggestions? Your help is very much appreciated.

subroutine GET_FILES@(wildcard, files, maxfiles, nfiles, error_code)
character (len=*), intent(in) :: wildcard
integer (kind=2), intent(in) :: maxfiles
character(256), intent(out) :: files(maxfiles)
integer (kind=2), intent(out) :: nfiles, error_code
end subroutine GET_FILES@
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8211
Location: Salford, UK

PostPosted: Mon Jul 27, 2009 6:22 am    Post subject: Reply with quote

The following programs runs OK on my Vista machine...

Code:
INTEGER (KIND=2),PARAMETER::MAXFILES=50
INTEGER (KIND=2) NFILES, ERROR_CODE
CHARACTER (LEN=256)::FILES(MAXFILES)
CALL GET_FILES@("*.f90", FILES, MAXFILES, NFILES, ERROR_CODE)
DO I=1,NFILES
  PRINT*, FILES(I)(1:LEN_TRIM(FILES(I)))
ENDDO 
END
Back to top
View user's profile Send private message AIM Address
erie



Joined: 24 Jul 2009
Posts: 6

PostPosted: Tue Jul 28, 2009 7:50 am    Post subject: Thanks Paul. I don't know why it doesn't work with my Plato Reply with quote

Any ideas why it might not be working on my Plato?
Maybe I need to set up some compiling options or something?

Code:

program getingfiles
integer (kind=2),parameter ::MAXFILES=50
integer (kind=2) NFILES, ERROR_CODE
character (LEN=256)::FILES(MAXFILES)
call GET_FILES@("*.pdf", FILES, MAXFILES, NFILES, ERROR_CODE)
do I=1,NFILES
  print*, FILES(I)(1:LEN_TRIM(FILES(I)))
enddo
end getingfiles

subroutine GET_FILES@(wildcard, files, maxfiles, nfiles, error_code)
character (len=*), intent(in) :: wildcard
integer (kind=2), intent(in) :: maxfiles
character(256), intent(out) :: files(maxfiles)
integer (kind=2), intent(out) :: nfiles, error_code
end subroutine GET_FILES@
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8211
Location: Salford, UK

PostPosted: Tue Jul 28, 2009 8:03 am    Post subject: Reply with quote

You don't need any special compiler options. Just run the code as I presented it. The routine is built-in and does not need the subroutine code that you have included.

The effect of your code is to create your own version of the subroutine and your version returns without doing anything.
Back to top
View user's profile Send private message AIM Address
erie



Joined: 24 Jul 2009
Posts: 6

PostPosted: Tue Jul 28, 2009 8:10 am    Post subject: Many Thanks Paul, issue is resolved Reply with quote

Paul, thank you so much. I thought I needed to define the subroutine but you were right is built in and what I had done was wrong. Appreciate your time and help.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2615
Location: Sydney

PostPosted: Tue Jul 28, 2009 1:50 pm    Post subject: Reply with quote

You may have been trying to use an interface definition.

Code:

program getingfiles
!
INTERFACE
subroutine GET_FILES@(wildcard, files, maxfiles, nfiles, error_code)
character (len=*), intent(in) :: wildcard
integer (kind=2), intent(in) :: maxfiles
character(256), intent(out) :: files(maxfiles)
integer (kind=2), intent(out) :: nfiles, error_code
end subroutine GET_FILES@
END INTERFACE
!
integer (kind=2),parameter ::MAXFILES=50
integer (kind=2) NFILES, ERROR_CODE
character (LEN=256)::FILES(MAXFILES)
!
call GET_FILES@("*.pdf", FILES, MAXFILES, NFILES, ERROR_CODE)
do I=1,NFILES
  print*, TRIM (FILES(I))
enddo
!
print*, 'ERROR_CODE =', ERROR_CODE
print*, 'NFILES =', NFILES
end getingfiles
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2615
Location: Sydney

PostPosted: Wed Jul 29, 2009 3:05 am    Post subject: Reply with quote

Paul,

I could not get my INTERFACE example to compile ?
I even tried to clean out the KIND warnings, but that didn't help.
Is there a problem with :-
my use of INTERFACE,
defining for GET_FILES@, which is a Salford routine, or
is there a problem with FTN95 ?

My "cleaned" code is now:
Code:

program getingfiles
!
INTERFACE
 subroutine GET_FILES@ (wildcard, file_list, max_files, num_files, error_code)
  character*(*), intent(in)  :: wildcard
  integer*2,     intent(in)  :: max_files
  character*256, intent(out) :: file_list(max_files)
  integer*2,     intent(out) :: num_files
  integer*2,     intent(out) :: error_code
 end subroutine GET_FILES@
END INTERFACE
!
integer*2, parameter :: MAXFILES=50
integer*2     NFILES, ERROR_CODE, I
character*256 FILES(MAXFILES)
!
call GET_FILES@ ('*.pdf', FILES, MAXFILES, NFILES, ERROR_CODE)
!
do I=1,NFILES
  print*, TRIM (FILES(I))
enddo
!
print*, 'ERROR_CODE =', ERROR_CODE
print*, 'NFILES =', NFILES
end getingfiles


And the error message when compiling with /debug is:

[FTN95/Win32 Ver. 5.30.0 Copyright (c) Silverfrost Ltd 1993-2009]

0017) call GET_FILES@ ('*.pdf', FILES, MAXFILES, NFILES, ERROR_CODE)
*** Error 326: SUBROUTINE GET_FILES@ has been called with too many arguments
1 ERROR [<GETINGFILES> FTN95/Win32 v5.30.0]
*** Compilation failed
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8211
Location: Salford, UK

PostPosted: Wed Jul 29, 2009 3:36 pm    Post subject: Reply with quote

Your code demonstrates a previously unknown bug that takes the form of a missing error message (say).

What happens is this. The @ symbol at the end of GET_FILES@ is reserved for FTN95 intrinsics, none of which require an interface.

Instead of providing a warning or error message as it should, the compiler soldiers on after the INTERFACE but with a blank argument list and then there is an argument miss-match when it encounters the call.

We can change the compiler to make it flag an error (or fix it in some other way) but in the mean time routines that end in @ should not appear in an INTERFACE.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8211
Location: Salford, UK

PostPosted: Thu Aug 13, 2009 3:05 pm    Post subject: Reply with quote

The next release of FTN95 will give a fatal error report when you try to provide an INTERFACE for an FTN95 intrinsic.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group