 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
erie
Joined: 24 Jul 2009 Posts: 6
|
Posted: Fri Jul 24, 2009 10:48 pm Post subject: Using GET_FILES@ doesn't work in Plato, or does it? |
|
|
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 |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Mon Jul 27, 2009 6:22 am Post subject: |
|
|
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 |
|
 |
erie
Joined: 24 Jul 2009 Posts: 6
|
Posted: Tue Jul 28, 2009 7:50 am Post subject: Thanks Paul. I don't know why it doesn't work with my Plato |
|
|
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 |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Tue Jul 28, 2009 8:03 am Post subject: |
|
|
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 |
|
 |
erie
Joined: 24 Jul 2009 Posts: 6
|
Posted: Tue Jul 28, 2009 8:10 am Post subject: Many Thanks Paul, issue is resolved |
|
|
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 |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Tue Jul 28, 2009 1:50 pm Post subject: |
|
|
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 |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Wed Jul 29, 2009 3:05 am Post subject: |
|
|
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 |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Jul 29, 2009 3:36 pm Post subject: |
|
|
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 |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Thu Aug 13, 2009 3:05 pm Post subject: |
|
|
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 |
|
 |
|
|
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
|