I'm playing around with GDDM and have run into an odd problem. As far as I can tell from the pubs, I should be able to create several graphical segments using the GSSEG (n) call, then close it with the GSSCLS call. The idea being that I can manipulate a group of graphics primitives easily, and have images layered on top of one another. As far as I can tell, GSSCLS is supposed to close the current segment, thereby making the active segment = null.
From the reference guide :
Causes the current segment to be closed, so that no more
primitives can be added to it. After this operation, there is no
current segment within the page. Closing a segment does
not delete the segment or affect the graphics primitives that
If an area is open, GSSCLS closes it as if a GSENDA call
had been issued immediately before the GSSCLS call. All
graphics attributes are reset to the values for the attributes
that were in effect at the time the corresponding segment
That all sounds logical, but when I attempt to actually do this, I get an error at the point of attempting to create the second segment. GDDM tells me that the first segment I opened is still the primary one, it ignores the call to create the second segment, which in turn creates lots of other problems.
Here's the error:
ADM0055 E GSSEG, AT X'A193DABA'
ADM0150 E GRAPHICS SEGMENT 1 IS CURRENT
and here's the section of code that is causing the problem (in C) :
...//draw the first primitive
..//draw the second primative
I am totally confused as to why the segment isn't closing as it should. I suspect it's something minor, but I'm just not seeing it. Any help y'all can provide would be much appreciated!
yes, I've tried GSENDA and attempted to draw the second segment w/o closing the first. I still get the same errors. I've also tried commenting out the first gsseg(n) line to see if the gsscls statement would issue a "no active segment" error but it didn't. As far as I can tell, it's like the gsscls statement is being ignored completely and I can't for the life of me figure out why.
I just figured out what the problem was. When calling gsscls from C, you need to use the syntax gsscls(), not gsscls. The strange thing is that the compiler doesn't give you a syntax error when you omit the parenthesis, it seems to just ignore the statement. Oh well, it works and I'm a happy code monkey.