OpenStep Storage and DPSContext replacements?
OpenStep Storage and DPSContext replacements?
- Subject: OpenStep Storage and DPSContext replacements?
- From: Roberto Abraham <email@hidden>
- Date: Thu, 27 Dec 2001 22:08:23 -0500 (EST)
I'd like to port the OpenStep PGPLOT drivers to Cocoa (PGPLOT is a
widely-used scientific graphics library). I've tried building the OpenStep
driver using Project Builder on Mac OS X and it gets reasonably far before
hitting two roadblocks, which I'm hoping somebody out there might be able
to help me get past:
(1) The driver tries to import objc/Storage.h, which my trolling on the
internet suggests is a standard part of OpenStep. But my scan of the
Foundation and AppKit documentation suggests that this generic Storage
class does not exist for Cocoa. Am I missing a class somewhere, or is an
equivalent class included instead? If not could someone suggest a good
substitute?
(2) The drawing code uses raw postscript drawing commands (references to
the DPSContext are seen). The way this works is explained in a source
comment:
// PGView receives 132 byte character arrays filled with PostScript code.
// PGView saves these buffers in a Storage object. When the PGPLOT
// program executes a flushpg operation, this stored data is then sent to the
// display.
Have I got to figure out some way to transmogrify the postscript code into
equivalent PDF code and reconstruct this functionality, or is there some
more straightforward way to proceed? I'm aware that PDF is in many ways
closely related to postscript so I'm hoping some functionality in Quartz
for translating postscript to PDF exists. True? For reference, here is the
method where drawing occurs (psdata is the Storage object):
- (void) flushpg
{
DPSContext ctxt;
int i, ibeg;
if ([psdata count] > nplot) {
[self lockFocus];
ibeg=nplot;
nplot = [psdata count];
ctxt= DPSGetCurrentContext();
for(i=ibeg; i<nplot; i++) {
DPSPrintf(ctxt, "%s\n", (char *) [psdata elementAt:i]);
}
PScurrentgstate([self gState]);
PSpop();
[myWindow flushWindow];
[self unlockFocus];
}
return;
}
I apologize for the rudimentary nature of these questions. I'm afraid I'm
just beginning my Cocoa programming endeavours (and having a lot of fun
too, though I must say porting OpenStep code is not proving as trivial as
I thought. Hopefully this is just due to my beginner's ignorance).
Thanks,
Bob Abraham
--
------------------------------------------------------------------------
Prof. Roberto Abraham | Office: Rm.1405A
Dept. of Astronomy & Astrophysics | Phone (direct): 416-946-7289
University of Toronto | Phone (cellular): 416-830-8172
60 St. George St | Phone (department): 416-978-2016
Toronto, ON M5S 3H8 | Departmental FAX: 416-946-7287
Canada |
------------------------------------------------------------------------