soccer jersey forums.silverfrost.com :: View topic - Error 410
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 

Error 410

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



Joined: 26 Sep 2005
Posts: 13

PostPosted: Tue Oct 25, 2005 7:30 am    Post subject: Error 410 Reply with quote

Hi,

I occasionally suffer from the following error message:-

"Error 410, A function called from within an I/O statement has itself performed I/O"

I'm struggling to get to grips with the reasons for this to occur, as it doesn't appear to be an easily repeatable error.

The most recent time that this error occurred was during an OpenGL graphics repaint , which was initiated in the callback function for the OpenGL graphics using clearwin_string@('CALL_BACK_REASON') the reason being DIRTY The program was populating a character string for subsequent plotting to the screen. The line of code where the error occurred was:-

WRITE(STRING,FORM)VAL

where VAL is a double precision real number, string is a 23 character string variable, and FORM is 9 character string variable containing the text '(F23.1) '

Does an internal write statement really count as being I/O ?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Oct 26, 2005 1:19 am    Post subject: Error 410 Reply with quote

The problem usually arises with a call of the form

WRITE(*,*) foo(x)

where the function foo contains WRITE statements.

I do not think that the information that you give is sufficient to indicate what is going wrong in your program. Is it possible to post a small but fully working program that illlustrates the failure?

I guess that the IO is using the same buffers when writing to a string and that this is why recursive calls are not permitted.



Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2393
Location: Yateley, Hants, UK

PostPosted: Wed Oct 26, 2005 4:53 am    Post subject: Error 410 Reply with quote

Probably not helpful, I'm afraid, but some observations.

I've always disliked using functions to return an error or status code (like WINIO@ ! ), believing that functions should return a "numeric value" (I include LOGICAL here) for use in some computation, and have always believed that functions shouldn't ever do I/O for precisely the reason Paul adduces above. (Subroutines can, because they cannot be used in I/O lists). However, my view is a lost cause, especially as far as Clearwin is concerned.

Now that Fortran 95 permits recursive functions, shouldn't the limitation that functions called during I/O shouldn't themselves do I/O be relaxed? It opens a can of worms, but doesn't all recursion?

I've always considered reading and writing to character expressions and the predecessor ENCODE and DECODE as "internal I/O". Now where did I get that expression from?

Eddie B.
Back to top
View user's profile Send private message
JohnH



Joined: 26 Sep 2005
Posts: 13

PostPosted: Wed Oct 26, 2005 7:14 am    Post subject: Error 410 Reply with quote

Paul and Eddie,

Thanks for your replies. Unfortunately I'm not any closer to resolving the problem, as I'm not using a function with a write statement as Paul states is the normal cause of this error. And of course the program is far too large to post here ! Writing a small but fully working program would take some time, but I may have to do this to fully demonstrate the problem. All I am doing is preparing text strings for placement on the screen as part of the graphics image, in this case stress contour levels, which most of the time is trouble free. My only work around appears to be using IOSTAT=IERROR to at least stop the program from crashing. Is it possible that I am getting too many callbacks to refresh the screen image, and thus interfering with each other?

Eddie, I do understand where you are coming from, having cut my teeth using Fortran IV, however with a "windows" gui every menu item invokes a call back to an integer function, which of course must contain or call subroutines with write statements in them ! Beyond that I use functions very sparingly, but in evaluating NURBS (Non-Uniform Rational B-Splines) with my limited maths knowledge of these beasts I found the ability of Fortran 95 to have code like "RECURSIVE FUNCTION BLEND(I,K,T,NK,AKNOT) RESULT (BLEND_RES)" staggeringly powerful, evaluating NURBS with earlier standards of Fortran would have been a nightmare !

regards,
John
Sad(
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2393
Location: Yateley, Hants, UK

PostPosted: Wed Oct 26, 2005 4:11 pm    Post subject: Error 410 Reply with quote

I did admit that I had lost that particular crusade (beaten by the call-back function).

Any chance that your problem could be solved or lessened with more stack or heap?

I'm afraid my own code is very much in the Fortran-77 mould, and on a small scale. I am using WINAPP with the default heap and stack sizes suggested in the very first CLEARWIN example I ever saw - where the WINAPP directive needed you to specify stack and heap sizes. They seemed pretty big to me in the example (300000 and 500000). Perhaps your code could do with much more. I've struggled with the FTN95 / Plato documentation, and it looks to me as though stack and heap sizes aren't used any more. But perhaps the defaults aren't enough for what you are doing, and you need to set bigger values.

I'm not all that clear on how stack is used by Salford FTN-anything, but at one stage I was coding Assembler routines for M$ Fortran, and every time a function was called it devoured stack space ... long lists of parameters speeding up the use of stack, as the address of every parameter was pushed on it, together with the return address and much more besides. (COMMON seemed to be a device for minimising stack usage, as it reduced subprogram parameter requirements). Noting also that the executable code is often calling routines the high level programmer knows nowt about, each of which is also using the stack, presumably you could eventually run out. Is the stack space protected, or can one overflow? The DOS stack was rather small, and in effect, limited the degree of nesting of subroutine calls. I have an even sketchier idea of what the heap is for.

Apologies for a ramble, and a not particularly well-informed one at that.

Regards
Eddie
Back to top
View user's profile Send private message
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Thu Oct 27, 2005 3:31 pm    Post subject: Error 410 Reply with quote

[small]Eddie Bromhead wrote:[/small]
it looks to me as though stack and heap sizes aren't used any more

Yep, you're correct there ! I haven't used the WINAPP directive in a very long time. I use virtual common and dynamic arrays in subroutines, which makes the exe's so incredibly efficient, grabbing memory when required and releasing it when not required. Thus small models take up very little memory resources and run like greased lightning, whilst big models also run as efficiently as possible by only allocating just enough memory on demand. This is where in my opinion FTN95 is so much better than earlier standards of fortran.

So, no my problem is not a memory resource issue, but thanks for trying any way !
_________________
John Horspool
Roshaz Software Ltd.
Gloucestershire
Back to top
View user's profile Send private message Visit poster's website
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