|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Dec 14, 2006 1:00 am Post subject: DRAW_CHARACTERS@ in a block IF causing crash? |
|
|
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 |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Dec 14, 2006 1:08 am Post subject: |
|
|
... 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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Dec 14, 2006 8:09 am Post subject: |
|
|
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 |
|
|
|
|
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
|