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 

DRAW_CHARACTERS@ in a block IF causing crash?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
LitusSaxonicum



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

PostPosted: Thu Dec 14, 2006 1:00 am    Post subject: DRAW_CHARACTERS@ in a block IF causing crash? Reply with quote

I'm doing graphics to a graphics object on screen, and (sometimes) to a printer graphics object. The program baulks at something which is hard to describe. The graphics have 2 lines of text. The position on screen for this text is different for the hard copy than it is on the screen. If I write the two text lines with:

IIY = 25
IJY = 45
CALL DRAW_CHARACTERS@(TITLE2,10,IIY,RGB@(0,0,0))
CALL DRAW_CHARACTERS@(TITLE1,10,IJY,RGB@(0,0,0))

(TITLE1 and TITLE2 being 80-character strings)

then the text is drawn, although it isn't where I want it on the hard copy.
So, I pass a variable to the subprogram (that draws the particular graphics) which is named NDEV that is 1 for hard copy, and 0 for screen graphics. At several points in the subprogram, I check on NDEV, and do such things as adjusting line thicknesses etc. I then try to use NDEV as follows:

IF (NDEV .EQ. 0) THEN
IIY = 25
IJY = 45
CALL DRAW_CHARACTERS@(TITLE2,10,IIY,RGB@(0,0,0))
CALL DRAW_CHARACTERS@(TITLE1,10,IJY,RGB@(0,0,0))
ELSE
IIY = 25
IJY = 45
CALL DRAW_CHARACTERS@(TITLE2,10,IIY,RGB@(0,0,0))
CALL DRAW_CHARACTERS@(TITLE1,10,IJY,RGB@(0,0,0))
ENDIF

Notice that the coordinates are the same. Obviously, I want IIY and IJY to be different, but I have cut and pasted identical FORTRAN in here, so that whichever route is taken the same sequence occurs. This code causes the program to crash - in my standard WinXP I get the "chord" sound and all the windows close instantly. But when I revert to no IF, it works - no crash. Bizarrely, when NDEV=0, the graphics come up on screen faultlessly.

Anyone know what I'm doing that causes this odd behaviour?

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



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

PostPosted: Thu Dec 14, 2006 1:08 am    Post subject: Reply with quote

... and I forgot to say ...

If I do the DRAW_CHARACTERS@ OUTSIDE the block IF, it works, as in:

IF (NDEV .EQ. 0) THEN
CALL SCALE_FONT@(1.0D0)
IIY = 25
IJY = 45
ELSE
CALL SCALE_FONT@(8.0D0*HSCALE)
IIY = 95*IYRES/100
IJY = 90*IYRES/100
ENDIF

CALL DRAW_CHARACTERS@(TITLE2,10,IIY,RGB@(0,0,0))
CALL DRAW_CHARACTERS@(TITLE1,10,IJY,RGB@(0,0,0))

(slightly more complex than my earlier (simplified) code).

It has taken me a lot of head-scratching to work out the problem, as it seemed to me that my FORTRAN was valid.

Eddie
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Dec 14, 2006 8:09 am    Post subject: Reply with quote

I cannot see anything wrong with this.
If you can post a fully "working" program then I will run some tests on it.
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 -> ClearWin+ 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