From: <and...@us...> - 2010-05-10 21:53:08
|
Revision: 10985 http://plplot.svn.sourceforge.net/plplot/?rev=10985&view=rev Author: andrewross Date: 2010-05-10 21:53:01 +0000 (Mon, 10 May 2010) Log Message: ----------- Update qt driver to support PLESC_GETC escape command. This means for example that plGetCursor now works for the qtwidget device. The -locate option of example 1 demonstrates this. Also support the "Q" keystroke to abort and the "L" keystroke to enter locate mode (consistent with xwin driver). Finally advance page on mouse button down rather than button release (again, consistent with xwin driver). Modified Paths: -------------- trunk/bindings/qt_gui/plqt.cpp trunk/bindings/qt_gui/pyqt4/plplot_pyqt4.sip trunk/drivers/qt.cpp trunk/include/qt.h Modified: trunk/bindings/qt_gui/plqt.cpp =================================================================== --- trunk/bindings/qt_gui/plqt.cpp 2010-05-10 21:34:56 UTC (rev 10984) +++ trunk/bindings/qt_gui/plqt.cpp 2010-05-10 21:53:01 UTC (rev 10985) @@ -85,6 +85,11 @@ { } +void QtPLDriver::setPLStream( PLStream *p ) +{ + pls = p; +} + void QtPLDriver::drawLine( short x1, short y1, short x2, short y2 ) { if ( !m_painterP->isActive() ) return; @@ -314,7 +319,7 @@ return res; } -void QtPLDriver::drawText( PLStream* pls, EscText* txt ) +void QtPLDriver::drawText( EscText* txt ) { if ( !m_painterP->isActive() ) return; @@ -599,6 +604,8 @@ NoPen = QPen( Qt::NoPen ); NoPen.setWidthF( 0. ); + + locate_mode = 0; } QtPLWidget::~QtPLWidget() @@ -848,7 +855,7 @@ // redrawFromLastFlush=true; } -void QtPLWidget::drawText( PLStream* pls, EscText* txt ) +void QtPLWidget::drawText( EscText* txt ) { BufferElement el; el.Element = TEXT; @@ -908,20 +915,188 @@ SolidBrush = QBrush( Qt::SolidPattern ); } -void QtPLWidget::mouseReleaseEvent( QMouseEvent * event ) +void QtPLWidget::lookupButtonEvent( QMouseEvent * event ) { - if ( event->button() == Qt::RightButton ) + Qt::MouseButtons buttons = event->buttons(); + Qt::KeyboardModifiers modifiers = event->modifiers(); + gin.pX = event->x(); + gin.pY = height() - event->y(); + gin.dX = (PLFLT) event->x() / width(); + gin.dY = (PLFLT) ( height() - event->y() ) / height(); + + switch ( event->button() ) { - handler.DeviceChangedPage( this ); + case Qt::LeftButton: + gin.button = 1; + break; + case Qt::MidButton: + gin.button = 2; + break; + case Qt::RightButton: + gin.button = 3; + break; } + + // Map Qt button and key states to the (X windows) values used + // by plplot. + gin.state = 0; + if ( buttons & Qt::LeftButton ) + gin.state |= 1 << 8; + if ( buttons & Qt::MidButton ) + gin.state |= 1 << 9; + if ( buttons & Qt::RightButton ) + gin.state |= 1 << 10; + if ( modifiers & Qt::ShiftModifier ) + gin.state |= 1 << 0; + if ( modifiers & Qt::ControlModifier ) + gin.state |= 1 << 2; + if ( modifiers & Qt::AltModifier ) + gin.state |= 1 << 3; + if ( modifiers & Qt::MetaModifier ) + gin.state |= 1 << 3; + + gin.keysym = 0x20; } +void QtPLWidget::locate() +{ + if ( plTranslateCursor( &gin ) ) + { + if ( locate_mode == 2 ) + { + pltext(); + if ( gin.keysym < 0xFF && isprint( gin.keysym ) ) + std::cout << gin.wX << " " << gin.wY << " " << (char) gin.keysym << std::endl; + else + std::cout << gin.wX << " " << gin.wY << " " << std::hex << gin.keysym << std::endl; + + plgra(); + } + } + else + { + locate_mode = 0; + QApplication::restoreOverrideCursor(); + } +} + +void QtPLWidget::mousePressEvent( QMouseEvent * event ) +{ + lookupButtonEvent( event ); + + if ( locate_mode ) + { + if ( event->button() == Qt::LeftButton ) + { + locate(); + } + } + else + { + if ( event->button() == Qt::RightButton ) + { + handler.DeviceChangedPage( this ); + } + } +} + void QtPLWidget::keyPressEvent( QKeyEvent* event ) { - if ( event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return ) + if ( locate_mode ) { - handler.DeviceChangedPage( this ); + Qt::KeyboardModifiers modifiers = event->modifiers(); + QPoint p = QCursor::pos(); + gin.pX = p.x(); + gin.pY = height() - p.y(); + gin.dX = (PLFLT) p.x() / width(); + gin.dY = (PLFLT) ( height() - p.y() ) / height(); + + switch ( event->key() ) + { + case Qt::Key_Escape: + locate_mode = 0; + QApplication::restoreOverrideCursor(); + plGinInit( &gin ); + break; + case Qt::Key_Shift: + case Qt::Key_Control: + case Qt::Key_Alt: + case Qt::Key_Meta: + case Qt::Key_AltGr: + plGinInit( &gin ); + case Qt::Key_Left: + case Qt::Key_Right: + case Qt::Key_Up: + case Qt::Key_Down: + { + int x1, y1, dx = 0, dy = 0; + int xmin = 0, xmax = width() - 1, ymin = 0, ymax = height() - 1; + switch ( event->key() ) + { + case Qt::Key_Left: + dx = -1; + break; + case Qt::Key_Right: + dx = 1; + break; + case Qt::Key_Up: + dy = -1; + break; + case Qt::Key_Down: + dy = 1; + break; + } + if ( event->modifiers() & Qt::ShiftModifier ) + { + dx *= 5; + dy *= 5; + } + if ( event->modifiers() & Qt::ControlModifier ) + { + dx *= 5; + dy *= 5; + } + if ( event->modifiers() & Qt::AltModifier ) + { + dx *= 5; + dy *= 5; + } + x1 = gin.pX + dx; + y1 = gin.pY + dy; + + if ( x1 < xmin ) dx = xmin - gin.pX; + if ( y1 < ymin ) dy = ymin - gin.pY; + if ( x1 > xmax ) dx = xmax - gin.pX; + if ( y1 > ymax ) dy = ymax - gin.pY; + + QCursor::setPos( p.x() + dx, p.y() + dy ); + plGinInit( &gin ); + break; + } + default: + locate(); + break; + } } + else + { + if ( event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return ) + { + handler.DeviceChangedPage( this ); + } + if ( event->text() == "Q" ) + { + // Terminate on a 'Q' (not 'q', since it's too easy to hit by mistake) + pls->nopause = TRUE; + plexit( "" ); + } + else if ( event->text() == "L" ) + // Begin locate mode + { + locate_mode = 2; + QApplication::setOverrideCursor( Qt::CrossCursor ); + } + } } void QtPLWidget::closeEvent( QCloseEvent* event ) @@ -1147,6 +1322,20 @@ } } +void QtPLWidget::getCursorCmd( PLGraphicsIn *ptr ) +{ + plGinInit( &gin ); + + locate_mode = 1; + QApplication::setOverrideCursor( Qt::CrossCursor ); + + while ( gin.pX < 0 && locate_mode ) + QCoreApplication::processEvents( QEventLoop::AllEvents, 10 ); + + QApplication::restoreOverrideCursor(); + *ptr = gin; +} + #endif #if defined ( PLD_extqt ) @@ -1272,12 +1461,14 @@ void plsetqtdev( QtExtWidget* widget ) { plsc->dev = (void*) widget; + widget->setPLStream( plsc ); } void plsetqtdev( QtExtWidget* widget, int argc, char** argv ) { plparseopts( &argc, (const char**) argv, PL_PARSE_FULL ); plsc->dev = (void*) widget; + widget->setPLStream( plsc ); } void plfreeqtdev() Modified: trunk/bindings/qt_gui/pyqt4/plplot_pyqt4.sip =================================================================== --- trunk/bindings/qt_gui/pyqt4/plplot_pyqt4.sip 2010-05-10 21:34:56 UTC (rev 10984) +++ trunk/bindings/qt_gui/pyqt4/plplot_pyqt4.sip 2010-05-10 21:53:01 UTC (rev 10985) @@ -51,7 +51,7 @@ void clearWidget(); protected: - void mouseReleaseEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event); void keyPressEvent(QKeyEvent *event); void closeEvent(QCloseEvent *event); void nextPage(); Modified: trunk/drivers/qt.cpp =================================================================== --- trunk/drivers/qt.cpp 2010-05-10 21:34:56 UTC (rev 10984) +++ trunk/drivers/qt.cpp 2010-05-10 21:53:01 UTC (rev 10985) @@ -276,6 +276,7 @@ { pls->dev = new QtRasterDevice( pls->xlength, pls->ylength ); } + ( (QtRasterDevice *) pls->dev )->setPLStream( pls ); if ( isMaster ) handler.setMasterDevice( (QtRasterDevice*) ( pls->dev ) ); @@ -406,7 +407,7 @@ /*$$ call the generic ProcessString function * ProcessString( pls, (EscText *)ptr ); */ widget->QtPLDriver::setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); - widget->drawText( pls, (EscText *) ptr ); + widget->drawText( (EscText *) ptr ); break; default: break; @@ -687,6 +688,7 @@ { pls->dev = new QtSVGDevice( pls->xlength, pls->ylength ); } + ( (QtSVGDevice *) pls->dev )->setPLStream( pls ); if ( isMaster ) handler.setMasterDevice( (QtSVGDevice*) ( pls->dev ) ); @@ -735,6 +737,7 @@ pls->dev = new QtSVGDevice( s.width(), s.height() ); ( (QtSVGDevice *) pls->dev )->downscale = downscale; + ( (QtSVGDevice *) pls->dev )->setPLStream( pls ); if ( isMaster ) handler.setMasterDevice( (QtSVGDevice *) pls->dev ); handler.DeviceChangedPage( (QtSVGDevice *) pls->dev ); @@ -833,7 +836,7 @@ /*$$ call the generic ProcessString function * ProcessString( pls, (EscText *)ptr ); */ widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); - widget->drawText( pls, (EscText *) ptr ); + widget->drawText( (EscText *) ptr ); break; default: @@ -962,6 +965,7 @@ { pls->dev = new QtEPSDevice( pls->xlength, pls->ylength ); } + ( (QtEPSDevice *) pls->dev )->setPLStream( pls ); if ( isMaster ) handler.setMasterDevice( (QtEPSDevice*) ( pls->dev ) ); @@ -1112,7 +1116,7 @@ /*$$ call the generic ProcessString function * ProcessString( pls, (EscText *)ptr ); */ widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); - widget->drawText( pls, (EscText *) ptr ); + widget->drawText( (EscText *) ptr ); break; default: break; @@ -1216,6 +1220,7 @@ widget = new QtPLWidget( pls->xlength, pls->ylength ); pls->dev = (void*) widget; } + widget->setPLStream( pls ); if ( isMaster ) handler.setMasterDevice( widget ); @@ -1356,15 +1361,15 @@ case PLESC_HAS_TEXT: widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); - widget->drawText( pls, (EscText *) ptr ); + widget->drawText( (EscText *) ptr ); break; case PLESC_FLUSH: widget->flush(); break; - - - + case PLESC_GETC: + widget->getCursorCmd( (PLGraphicsIn *) ptr ); + break; default: break; } } @@ -1557,7 +1562,7 @@ /*$$ call the generic ProcessString function * ProcessString( pls, (EscText *)ptr ); */ widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); - widget->drawText( pls, (EscText *) ptr ); + widget->drawText( (EscText *) ptr ); break; default: break; Modified: trunk/include/qt.h =================================================================== --- trunk/include/qt.h 2010-05-10 21:34:56 UTC (rev 10984) +++ trunk/include/qt.h 2010-05-10 21:53:01 UTC (rev 10985) @@ -120,13 +120,15 @@ // Constructor, taking the device size as arguments QtPLDriver( PLINT i_iWidth = QT_DEFAULT_X, PLINT i_iHeight = QT_DEFAULT_Y ); - virtual ~QtPLDriver(); // does not delete emitter! + virtual ~QtPLDriver(); // does not delete emitter! + void setPLStream( PLStream *pls ); // store the related stream + // Draws a line from (x1, y1) to (x2, y2) in internal plplot coordinates virtual void drawLine( short x1, short y1, short x2, short y2 ); virtual void drawPolyline( short * x, short * y, PLINT npts ); virtual void drawPolygon( short * x, short * y, PLINT npts ); - virtual void drawText( PLStream* pls, EscText* txt ); + virtual void drawText( EscText* txt ); virtual void setColor( int r, int g, int b, double alpha ); virtual void setBackgroundColor( int r, int g, int b, double alpha ){} virtual void setGradient( int x1, int x2, int y1, int y2, @@ -149,14 +151,16 @@ QPicture getTextPicture( PLUNICODE fci, PLUNICODE* text, int len, PLFLT chrht ); // Text-related variables - bool underlined; - bool overlined; - double currentFontScale; - double currentFontSize; - double yOffset; - double xOffset; + bool underlined; + bool overlined; + double currentFontScale; + double currentFontSize; + double yOffset; + double xOffset; - QPainter* m_painterP; + PLStream *pls; + + QPainter * m_painterP; }; #if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt ) @@ -310,8 +314,9 @@ unsigned char *r, unsigned char *g, unsigned char *b, PLFLT *alpha, PLINT ncol1 ); void setWidth( PLINT r ); - void drawText( PLStream* pls, EscText* txt ); + void drawText( EscText* txt ); void flush(); + void getCursorCmd( PLGraphicsIn *ptr ); protected: @@ -321,6 +326,8 @@ void getPlotParameters( double & io_dXFact, double & io_dYFact, double & io_dXOffset, double & io_dYOffset ); // gives the parameters to scale and center the plot on the page void doPlot( QPainter* p, double x_fact, double y_fact, double x_offset, double y_offset ); // Actually draws the plot. Deported in a function for readability void renderText( QPainter* p, struct TextStruct_* s, double x_fact, double x_offset, double y_fact, double y_offset ); + void lookupButtonEvent( QMouseEvent * event ); + void locate(); void resetPensAndBrushes( QPainter* ); @@ -356,10 +363,13 @@ int g; int b; double alpha; - } bgColour; + } bgColour; + PLGraphicsIn gin; // Graphics Input Structure + int locate_mode; // Set while in locate mode + protected slots: - void mouseReleaseEvent( QMouseEvent * event ); + void mousePressEvent( QMouseEvent * event ); void keyPressEvent( QKeyEvent* event ); void closeEvent( QCloseEvent* event ); void nextPage(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-05-11 14:18:10
|
Revision: 10986 http://plplot.svn.sourceforge.net/plplot/?rev=10986&view=rev Author: andrewross Date: 2010-05-11 14:18:00 +0000 (Tue, 11 May 2010) Log Message: ----------- Update qtwidget driver to return mouse move and button release events in plGetCursor. Modified Paths: -------------- trunk/bindings/qt_gui/plqt.cpp trunk/include/qt.h Modified: trunk/bindings/qt_gui/plqt.cpp =================================================================== --- trunk/bindings/qt_gui/plqt.cpp 2010-05-10 21:53:01 UTC (rev 10985) +++ trunk/bindings/qt_gui/plqt.cpp 2010-05-11 14:18:00 UTC (rev 10986) @@ -980,7 +980,7 @@ } } -void QtPLWidget::mousePressEvent( QMouseEvent * event ) +void QtPLWidget::mouseEvent( QMouseEvent * event ) { lookupButtonEvent( event ); @@ -1000,6 +1000,21 @@ } } +void QtPLWidget::mousePressEvent( QMouseEvent * event ) +{ + mouseEvent( event ); +} + +void QtPLWidget::mouseReleaseEvent( QMouseEvent * event ) +{ + mouseEvent( event ); +} + +void QtPLWidget::mouseMoveEvent( QMouseEvent * event ) +{ + mouseEvent( event ); +} + void QtPLWidget::keyPressEvent( QKeyEvent* event ) { if ( locate_mode ) Modified: trunk/include/qt.h =================================================================== --- trunk/include/qt.h 2010-05-10 21:53:01 UTC (rev 10985) +++ trunk/include/qt.h 2010-05-11 14:18:00 UTC (rev 10986) @@ -322,6 +322,7 @@ void resizeEvent( QResizeEvent* ); void paintEvent( QPaintEvent* ); + void mouseEvent( QMouseEvent * event ); void getPlotParameters( double & io_dXFact, double & io_dYFact, double & io_dXOffset, double & io_dYOffset ); // gives the parameters to scale and center the plot on the page void doPlot( QPainter* p, double x_fact, double y_fact, double x_offset, double y_offset ); // Actually draws the plot. Deported in a function for readability @@ -370,6 +371,8 @@ protected slots: void mousePressEvent( QMouseEvent * event ); + void mouseReleaseEvent( QMouseEvent * event ); + void mouseMoveEvent( QMouseEvent * event ); void keyPressEvent( QKeyEvent* event ); void closeEvent( QCloseEvent* event ); void nextPage(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fu...@us...> - 2010-05-11 17:17:17
|
Revision: 10990 http://plplot.svn.sourceforge.net/plplot/?rev=10990&view=rev Author: furnish Date: 2010-05-11 17:17:11 +0000 (Tue, 11 May 2010) Log Message: ----------- Reimplement the last plot in Tcl example 19, using a global coordinate transform, as is done in x19c. Updates to tclAPI.c to support plstransform(), providing a C-side wrapper which evaluates a Tcl proc to do the job. Example 19 now produces equivalent results in C and Tcl. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c trunk/examples/tcl/x19.tcl Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2010-05-11 14:21:06 UTC (rev 10989) +++ trunk/bindings/tcl/tclAPI.c 2010-05-11 17:17:11 UTC (rev 10990) @@ -60,6 +60,7 @@ static int plshadesCmd( ClientData, Tcl_Interp *, int, const char ** ); static int plmapCmd( ClientData, Tcl_Interp *, int, const char ** ); static int plmeridiansCmd( ClientData, Tcl_Interp *, int, const char ** ); +static int plstransformCmd( ClientData, Tcl_Interp *, int, const char ** ); static int plvectCmd( ClientData, Tcl_Interp *, int, const char ** ); static int plranddCmd( ClientData, Tcl_Interp *, int, const char ** ); static int plgriddataCmd( ClientData, Tcl_Interp *, int, const char ** ); @@ -98,6 +99,7 @@ { "plcont", plcontCmd }, { "plmap", plmapCmd }, { "plmeridians", plmeridiansCmd }, + { "plstransform", plstransformCmd }, { "plmesh", plmeshCmd }, { "plmeshc", plmeshcCmd }, { "plot3d", plot3dCmd }, @@ -3327,7 +3329,99 @@ return TCL_OK; } +static Tcl_Interp *tcl_xform_interp = 0; +static char *tcl_xform_procname = 0; +static const char *tcl_xform_template = + "set result [%s ${_##_x} ${_##_y}] ; lassign $result _##_x _##_y"; + +static char *tcl_xform_code = 0; + +static void +Tcl_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) +{ +// Set Tcl x to x + Tcl_Obj *objx = Tcl_NewDoubleObj( x ); + Tcl_IncrRefCount( objx ); + Tcl_SetVar2Ex( tcl_xform_interp, + "_##_x", NULL, objx, 0 ); + Tcl_DecrRefCount( objx ); + +// Set Tcl y to y + Tcl_Obj *objy = Tcl_NewDoubleObj( y ); + Tcl_IncrRefCount( objy ); + Tcl_SetVar2Ex( tcl_xform_interp, + "_##_y", NULL, objy, 0 ); + Tcl_DecrRefCount( objy ); + +// Call identified Tcl proc. Forget data, Tcl can use namespaces and custom +// procs to manage transmission of the custom client data. +// Proc should return a two element list which is xt yt. + int code = Tcl_Eval( tcl_xform_interp, tcl_xform_code ); + + if ( code != TCL_OK ) + { + printf( "Unable to evaluate Tcl-side coordinate transform.\n" ); + return; + } + + objx = Tcl_GetVar2Ex( tcl_xform_interp, "_##_x", NULL, 0 ); + objy = Tcl_GetVar2Ex( tcl_xform_interp, "_##_y", NULL, 0 ); + +// In case PLFLT != double, we have to make sure we perform the extraction in +// a safe manner. + double dx, dy; + + if ( Tcl_GetDoubleFromObj( tcl_xform_interp, objx, &dx ) != TCL_OK || + Tcl_GetDoubleFromObj( tcl_xform_interp, objy, &dy ) != TCL_OK ) + { + printf( "Unable to extract Tcl results.\n" ); + return; + } + + *xt = dx; + *yt = dy; +} + /*--------------------------------------------------------------------------*\ + * plstransform + * + * Implement Tcl-side global coordinate transformation setting/restoring API. + \*--------------------------------------------------------------------------*/ + +static int +plstransformCmd( ClientData clientData, Tcl_Interp *interp, + int argc, const char *argv[] ) +{ + if ( argc == 1 + || argv[1] == "NULL" ) + { + // The user has requested to clear the transform setting. + plstransform( NULL, NULL ); + tcl_xform_interp = 0; + if ( tcl_xform_procname ) + { + free( tcl_xform_procname ); + tcl_xform_procname = 0; + } + } + else + { + const char *data = argc > 2 ? argv[2] : 0; + + tcl_xform_interp = interp; + tcl_xform_procname = strdup( argv[1] ); + + int len = strlen( tcl_xform_template ) + strlen( tcl_xform_procname ); + tcl_xform_code = malloc( len ); + sprintf( tcl_xform_code, tcl_xform_template, tcl_xform_procname ); + + plstransform( Tcl_transform, NULL ); + } + + return TCL_OK; +} + +/*--------------------------------------------------------------------------*\ * plgriddataCmd * * Processes plgriddata Tcl command. Modified: trunk/examples/tcl/x19.tcl =================================================================== --- trunk/examples/tcl/x19.tcl 2010-05-11 14:21:06 UTC (rev 10989) +++ trunk/examples/tcl/x19.tcl 2010-05-11 17:17:11 UTC (rev 10990) @@ -30,6 +30,18 @@ # The coordinate transformation works directly on the two matrices # containing the x and y coordinates # + +proc map_transform { x y } { + + set scale [expr acos(-1.) / 180.] + + set radius [expr {90. - $y}] + + return [list \ + [expr {$radius * cos( $x * $scale )}] \ + [expr {$radius * sin( $x * $scale )}]] +} + proc mapform19 {n matx maty} { set deg_to_rad [expr {acos(-1.0)/180.0}] @@ -137,50 +149,37 @@ $w cmd plmeridians mapform19 10.0 10.0 0.0 360.0 -10.0 80.0 # Polar, Northern hemisphere -# In x19c this next plot is done with a global, PLplot-wide transform, set -# via plstransform. Looks like we need to build a Tcl proc evaluator -# callback function to handle this case. For now, we just do this plot sort -# of like how we did the last one. +# This time we use a global coordinate transformation, so no coordinate +# transform function is required on the plmap/plmeridians calls. set minx 0 set maxx 360 + $w cmd plstransform map_transform + $w cmd pllsty 1 $w cmd plenv -75 75 -75 75 1 -1 -# If we had a Tcl-analogue for plstransform, then we could drop the mapform19 -# transform function. But since we don't have Tcl support for global -# transform functions yet, we must pass in mapform19 here again. - $w cmd plmap mapform19 globe minx maxx miny maxy + $w cmd plmap globe $minx $maxx $miny $maxy $w cmd pllsty 2 - $w cmd plmeridians mapform19 10.0 10.0 0.0 360.0 -10.0 80.0 + $w cmd plmeridians 10.0 10.0 0.0 360.0 -10.0 80.0 # Show Baltimore, MD on the map. $w cmd plcol0 2 $w cmd plssym 0. 2. -# In the C example, the global transform function has been set, so x19c just -# uses the desired long/lat coords. In Tcl, till we implement a global -# transform capability, we have to do the transforms manually before calling -# the plotting functions. - +# This is kind of a messy way to use plpoin for plotting a single symbol. +# But it's what we have for now. matrix x f 1 matrix y f 1 x 0 = -76.6125 y 0 = 39.2902778 - mapform19 1 x y - $w cmd plpoin 1 x y 18 - x 0 = -76.6125 - y 0 = 43. - - mapform19 1 x y - $w cmd plssym 0. 1. - $w cmd plptex [x 0] [y 0] 0.0 0.0 0.0 "Baltimore, MD" + $w cmd plptex -76.6125 43. 0.0 0.0 0.0 "Baltimore, MD" $w cmd pllsty 1 # No defaults to restore This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-05-12 02:09:54
|
Revision: 10991 http://plplot.svn.sourceforge.net/plplot/?rev=10991&view=rev Author: airwin Date: 2010-05-12 02:09:41 +0000 (Wed, 12 May 2010) Log Message: ----------- Use cmp -i if available on Linux (the -i option may not be available on other POSIX-compliant systems) to compare PostScript files in the configured plplot_test/test_diff.sh(.in) script. This gives a factor of ~1.6 speedup on the test_diff_psc target when all PostScript prerequisites are already built. Modified Paths: -------------- trunk/cmake/modules/plplot.cmake trunk/examples/CMakeLists.txt trunk/examples/plplot_configure.cmake_installed_examples.in trunk/plplot_test/CMakeLists.txt trunk/plplot_test/test_diff.sh.in Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2010-05-11 17:17:11 UTC (rev 10990) +++ trunk/cmake/modules/plplot.cmake 2010-05-12 02:09:41 UTC (rev 10991) @@ -140,12 +140,21 @@ ) endif(NOT SH_EXECUTABLE) -# Find diff, tail and tee which are used to compare results from different +# Find diff and tail which are used to compare results from different # bindings. find_program(DIFF_EXECUTABLE diff) find_program(TAIL_EXECUTABLE tail) +# On Linux find cmp which is faster than diff. N.B. other Unix systems may +# have a POSIX-compliant cmp but without the GNU extension available on +# Linux of the -i option which we use to skip the datestamp on PostScript +# files. +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + find_program(CMP_EXECUTABLE cmp) + if(CMP_EXECUTABLE) + set(HAVE_CMP_I ON) + endif(CMP_EXECUTABLE) +endif(CMAKE_SYSTEM_NAME STREQUAL "Linux") - option(PREBUILD_DIST "Pre-build all components required for distribution" OFF) if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") set( Modified: trunk/examples/CMakeLists.txt =================================================================== --- trunk/examples/CMakeLists.txt 2010-05-11 17:17:11 UTC (rev 10990) +++ trunk/examples/CMakeLists.txt 2010-05-12 02:09:41 UTC (rev 10991) @@ -139,9 +139,11 @@ set(PSTEX_COMMENT "#") endif(NOT PLD_pstex) - if(NOT DIFF_EXECUTABLE OR NOT TAIL_EXECUTABLE) + if(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + set(COMPARE_COMMENT) + else(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) set(COMPARE_COMMENT "#") - endif(NOT DIFF_EXECUTABLE OR NOT TAIL_EXECUTABLE) + endif(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) if(NOT PLD_cgm) set(CGM_COMMENT "#") @@ -480,7 +482,7 @@ endif(ENABLE_${language}) endforeach(language_info ${language_info_LIST}) - if(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + if(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) # Note this target has complete file and target dependencies for # a comparison of stdout and PostScript results. add_custom_target(test_diff_psc COMMAND ${compare_command} @@ -488,9 +490,9 @@ ) add_dependencies(test_diff_psc ${diff_targets_LIST}) set(noninteractive_targets_LIST test_diff_psc) - else(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + else(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) set(noninteractive_targets_LIST) - endif(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + endif(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) else(PLD_psc) set(noninteractive_targets_LIST) endif(PLD_psc) Modified: trunk/examples/plplot_configure.cmake_installed_examples.in =================================================================== --- trunk/examples/plplot_configure.cmake_installed_examples.in 2010-05-11 17:17:11 UTC (rev 10990) +++ trunk/examples/plplot_configure.cmake_installed_examples.in 2010-05-12 02:09:41 UTC (rev 10991) @@ -216,3 +216,4 @@ set(DIFF_EXECUTABLE @DIFF_EXECUTABLE@) set(TAIL_EXECUTABLE @TAIL_EXECUTABLE@) +set(CMP_EXECUTABLE @CMP_EXECUTABLE@) Modified: trunk/plplot_test/CMakeLists.txt =================================================================== --- trunk/plplot_test/CMakeLists.txt 2010-05-11 17:17:11 UTC (rev 10990) +++ trunk/plplot_test/CMakeLists.txt 2010-05-12 02:09:41 UTC (rev 10991) @@ -332,7 +332,7 @@ ) endif(PLD_pdf) - if(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + if(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) configure_file( test_diff.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_diff.sh @@ -342,7 +342,7 @@ add_test(examples_compare ${SH_EXECUTABLE} -c "./test_diff.sh" ) - endif(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + endif(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) # Make a copy of lena.pgm to the test subdirectory of the build Modified: trunk/plplot_test/test_diff.sh.in =================================================================== --- trunk/plplot_test/test_diff.sh.in 2010-05-11 17:17:11 UTC (rev 10990) +++ trunk/plplot_test/test_diff.sh.in 2010-05-12 02:09:41 UTC (rev 10991) @@ -107,11 +107,20 @@ if [ ! -f x${xsuffix}${index}${suffix}.psc ] ; then missing="${missing} ${index}" else - @TAIL_EXECUTABLE@ -n +9 x${xsuffix_c}${index}c.psc > test1.psc - @TAIL_EXECUTABLE@ -n +9 x${xsuffix}${index}${suffix}.psc > test2.psc - @DIFF_EXECUTABLE@ -q test1.psc test2.psc 2>&1 > /dev/null - if [ $? != 0 ] ; then - different="${different} ${index}" + if [ "@HAVE_CMP_I@" = "ON" ] ; then + # Skip first 190 bytes of comparison to ignore date stamp. + @CMP_EXECUTABLE@ -s -i 190 x${xsuffix_c}${index}c.psc x${xsuffix}${index}${suffix}.psc + if [ $? != 0 ] ; then + different="${different} ${index}" + fi + else + # Drop first 8 lines from comparison to ignore date stamp. + @TAIL_EXECUTABLE@ -n +9 x${xsuffix_c}${index}c.psc > test1.psc + @TAIL_EXECUTABLE@ -n +9 x${xsuffix}${index}${suffix}.psc > test2.psc + @DIFF_EXECUTABLE@ -q test1.psc test2.psc 2>&1 > /dev/null + if [ $? != 0 ] ; then + different="${different} ${index}" + fi fi if [ "$index" != "14a" ] ; then if [ -f x${xsuffix}${index}${suffix}_psc.txt ] ; then This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-05-14 18:45:35
|
Revision: 10995 http://plplot.svn.sourceforge.net/plplot/?rev=10995&view=rev Author: airwin Date: 2010-05-14 18:45:29 +0000 (Fri, 14 May 2010) Log Message: ----------- Retire gcw, gnome2, and pygcw. Modified Paths: -------------- trunk/README.release trunk/cmake/modules/drivers-init.cmake trunk/cmake/modules/drivers.cmake trunk/cmake/modules/summary.cmake Modified: trunk/README.release =================================================================== --- trunk/README.release 2010-05-14 16:50:47 UTC (rev 10994) +++ trunk/README.release 2010-05-14 18:45:29 UTC (rev 10995) @@ -60,6 +60,8 @@ or the related gnome2 or pygcw bindings despite the known problems, then they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or ENABLE_pygcw to ON. +N.B. This announcement has been superseded by the subsequent retirement +of gcw, gnome2, and pygcw, see announcement XVII. VII. As of release 5.9.3 we have deprecated the gd device driver which implements the png, jpeg, and gif devices. This device driver is @@ -154,6 +156,16 @@ the degree symbol, unicode escape "#[0x00B0]" where 0x00B0 is the unicode index for the degree symbol or direct UTF8 unicode string "°". +XVII. As of release 5.9.6 we have retired the gcw device driver and +the related gnome2 and pygcw bindings since these are unmaintained and +there are good replacements. These components of PLplot were +deprecated as of release 5.9.3. A good replacement for the gcw device +is either the xcairo or qtwidget device. A good replacement for the +gnome2 bindings is the externally supplied XDrawable or Cairo context +associated with the xcairo device and the extcairo device (see +examples/c/README.cairo). A good replacement for pygcw is our new +pyqt4 bindings for PLplot. + INDEX 0. Tests made for release 5.9.6 Modified: trunk/cmake/modules/drivers-init.cmake =================================================================== --- trunk/cmake/modules/drivers-init.cmake 2010-05-14 16:50:47 UTC (rev 10994) +++ trunk/cmake/modules/drivers-init.cmake 2010-05-14 18:45:29 UTC (rev 10995) @@ -165,8 +165,8 @@ "gif:gd:OFF:F:ON" "jpeg:gd:OFF:F:ON" "png:gd:OFF:F:ON" - # gcw is not maintained. - "gcw:gcw:OFF:I:OFF" + # gcw is retired. + #"gcw:gcw:OFF:I:OFF" # Do not implement gnome which is superseded by gcw #"gnome:gnome:OFF:I:OFF" # hpgl devices produce tons of "Invalid pen selection." messages and the Modified: trunk/cmake/modules/drivers.cmake =================================================================== --- trunk/cmake/modules/drivers.cmake 2010-05-14 16:50:47 UTC (rev 10994) +++ trunk/cmake/modules/drivers.cmake 2010-05-14 18:45:29 UTC (rev 10995) @@ -79,8 +79,12 @@ # not available. include(cairo) include(cgm) -include(gcw) +#Everything having to do with gcw is retired +set(PLD_gcw OFF CACHE INTERNAL "gcw is retired" FORCE) +set(ENABLE_gnome2 OFF CACHE INTERNAL "gnome2 is retired" FORCE) +set(ENABLE_pygcw OFF CACHE INTERNAL "pygcw is retired" FORCE) include(gd) +#include(gcw) # Do not implement gnome which is superseded by gcw #include(gnome) include(linuxvga) Modified: trunk/cmake/modules/summary.cmake =================================================================== --- trunk/cmake/modules/summary.cmake 2010-05-14 16:50:47 UTC (rev 10994) +++ trunk/cmake/modules/summary.cmake 2010-05-14 18:45:29 UTC (rev 10995) @@ -116,7 +116,6 @@ ENABLE_tcl: ${ENABLE_tcl} ENABLE_itcl: ${ENABLE_itcl} ENABLE_tk: ${ENABLE_tk} ENABLE_itk: ${ENABLE_itk} ENABLE_pdl: ${ENABLE_pdl} ENABLE_wxwidgets: ${ENABLE_wxwidgets} -ENABLE_gnome2: ${ENABLE_gnome2} ENABLE_pygcw: ${ENABLE_pygcw} ENABLE_ada: ${ENABLE_ada} ENABLE_d: ${ENABLE_d} ENABLE_ocaml: ${ENABLE_ocaml} ENABLE_lua: ${ENABLE_lua} ENABLE_qt: ${ENABLE_qt} ENABLE_pyqt4: ${ENABLE_pyqt4} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-05-14 21:19:16
|
Revision: 10997 http://plplot.svn.sourceforge.net/plplot/?rev=10997&view=rev Author: andrewross Date: 2010-05-14 21:19:09 +0000 (Fri, 14 May 2010) Log Message: ----------- Add java support for plstransform and update java example 19 to use it. Modified Paths: -------------- trunk/bindings/java/CMakeLists.txt trunk/bindings/java/PLStream.java trunk/bindings/java/plplotjavac.i trunk/bindings/swig-support/plplotcapi.i trunk/examples/java/x19.java Added Paths: ----------- trunk/bindings/java/PLCallbackCT.java Modified: trunk/bindings/java/CMakeLists.txt =================================================================== --- trunk/bindings/java/CMakeLists.txt 2010-05-14 18:48:25 UTC (rev 10996) +++ trunk/bindings/java/CMakeLists.txt 2010-05-14 21:19:09 UTC (rev 10997) @@ -55,6 +55,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/PLStream.java ${CMAKE_CURRENT_SOURCE_DIR}/PLCallbackMapform.java ${CMAKE_CURRENT_SOURCE_DIR}/PLCallbackLabel.java + ${CMAKE_CURRENT_SOURCE_DIR}/PLCallbackCT.java ) @@ -73,6 +74,7 @@ ${class_root}/plplotjavacJNI.class_DEPENDS ${class_root}/PLCallbackMapform.class ${class_root}/PLCallbackLabel.class + ${class_root}/PLCallbackCT.class ) set( @@ -92,6 +94,7 @@ ${class_root}/plplotjavacJNI.class ${class_root}/PLCallbackMapform.class ${class_root}/PLCallbackLabel.class + ${class_root}/PLCallbackCT.class ) set( @@ -101,6 +104,7 @@ ${class_root}/plplotjavac.class ${class_root}/PLCallbackMapform.class ${class_root}/PLCallbackLabel.class + ${class_root}/PLCallbackCT.class ) # This is currently the include list for swig, the C wrapper and the Added: trunk/bindings/java/PLCallbackCT.java =================================================================== --- trunk/bindings/java/PLCallbackCT.java (rev 0) +++ trunk/bindings/java/PLCallbackCT.java 2010-05-14 21:19:09 UTC (rev 10997) @@ -0,0 +1,7 @@ + +package plplot.core; + +public interface PLCallbackCT +{ + public void coordTransform( double x, double y, double xt[], double yt[], Object data ); +}; Property changes on: trunk/bindings/java/PLCallbackCT.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/bindings/java/PLStream.java =================================================================== --- trunk/bindings/java/PLStream.java 2010-05-14 18:48:25 UTC (rev 10996) +++ trunk/bindings/java/PLStream.java 2010-05-14 21:19:09 UTC (rev 10997) @@ -989,6 +989,12 @@ plplotjavac.plstart( devname, nx, ny ); } + public void stransform( PLCallbackCT coordTrans, Object data ) + { + if ( set_stream() == -1) return; + plplotjavac.plstransform( coordTrans, data ); + } + public void stripa( int id, int pen, double x, double y ) { if ( set_stream() == -1 ) return; Modified: trunk/bindings/java/plplotjavac.i =================================================================== --- trunk/bindings/java/plplotjavac.i 2010-05-14 18:48:25 UTC (rev 10996) +++ trunk/bindings/java/plplotjavac.i 2010-05-14 21:19:09 UTC (rev 10997) @@ -1,7 +1,7 @@ /* Copyright (C) 2002 Gary Bishop Copyright (C) 2002, 2004 Alan W. Irwin -Copyright (C) 2004 Andrew Ross +Copyright (C) 2004-2010 Andrew Ross This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify @@ -1080,6 +1080,7 @@ typedef PLINT (*defined_func)(PLFLT, PLFLT); typedef void (*fill_func)(PLINT, PLFLT*, PLFLT*); typedef void (*pltr_func)(PLFLT, PLFLT, PLFLT *, PLFLT*, PLPointer); + typedef void (*ct_func)(PLFLT, PLFLT, PLFLT *, PLFLT*, PLPointer); typedef void (*mapform_func)(PLINT, PLFLT *, PLFLT*); typedef PLFLT (*f2eval_func)(PLINT, PLINT, PLPointer); typedef void (*label_func)(PLINT, PLFLT, char *, PLINT, PLPointer); @@ -1282,6 +1283,94 @@ %typemap(jstype) label_func lf "PLCallbackLabel" %typemap(javain) label_func lf "$javainput" +%{ + + jobject ctClass = 0; + jobject ctClassRef = 0; + + /* C coordinate transform callback function which calls the java + * coordinate transform function in a PLCallbackCoordTrans object. */ + void ct_java(PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data) { + jdouble jx, jy; + jdoubleArray jxt, jyt; + jdouble *xtval; + jdouble *ytval; + jobject jdata; + JNIEnv *cbenv; + jmethodID ctID = 0; + + jx = (jdouble) x; + jy = (jdouble) y; + jdata = (jobject) data; + + if (cached_jvm == NULL) { + fprintf(stderr,"Error! NULL jvm\n"); + return; + } + (*cached_jvm)->GetEnv(cached_jvm,(void **)&cbenv,JNI_VERSION_1_2); + if (cbenv == NULL) { + fprintf(stderr,"Thread not attached\n"); + if ((*cached_jvm)->AttachCurrentThread(cached_jvm, (void **)&cbenv, NULL) != 0) { + fprintf(stderr,"Error attaching to JVM\n"); + return; + } + } + jxt = (*cbenv)->NewDoubleArray(cbenv,1); + jyt = (*cbenv)->NewDoubleArray(cbenv,1); + if (ctClass == 0) { + fprintf(stderr,"Error - callback undefined\n"); + return; + } + jclass cls = (*cbenv)->GetObjectClass(cbenv,ctClass); + if (cls == 0) { + fprintf(stderr,"Error getting callback class\n"); + return; + } + ctID = (*cbenv)->GetMethodID(cbenv,cls, "coordTransform","(DD[D[DLjava/lang/Object;)V" ); + if (ctID != 0) { + (*cbenv)->CallVoidMethod(cbenv,ctClass, ctID, jx, jy, jxt, jyt, jdata); + xtval = (*cbenv)->GetDoubleArrayElements(cbenv,jxt, JNI_FALSE); + ytval = (*cbenv)->GetDoubleArrayElements(cbenv,jyt, JNI_FALSE); + *xt = (PLFLT) xtval[0]; + *yt = (PLFLT) ytval[0]; + } + else { + fprintf(stderr,"Java callback not found\n"); + } + } +%} + + +/* Handle function pointers to coordinate transform function using a + * java class */ +%typemap(in) ct_func ctf { + + jobject obj = $input; + + /* Delete any old references */ + if (ctClass != 0) { + (*jenv)->DeleteGlobalRef(jenv,ctClass); + ctClass = 0; + } + /* Need a reference to this object to ensure it is + * valid when we reach the callback */ + if (obj != NULL) { + ctClass = (*jenv)->NewGlobalRef(jenv,obj); + } + if (ctClass != 0) { + $1 = ct_java; + } + else { + $1 = NULL; + } + +} + +%typemap(jni) ct_func ctf "jobject" +%typemap(jtype) ct_func ctf "PLCallbackCT" +%typemap(jstype) ct_func ctf "PLCallbackCT" +%typemap(javain) ct_func ctf "$javainput" + %typemap(in) PLPointer data { $1 = NULL; } Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2010-05-14 18:48:25 UTC (rev 10996) +++ trunk/bindings/swig-support/plplotcapi.i 2010-05-14 21:19:09 UTC (rev 10997) @@ -829,6 +829,14 @@ void plstart(const char *devname, PLINT nx, PLINT ny); +#ifdef SWIG_JAVA + +%feature("autodoc", "Set the coordinate transform.") plstransform; +void +plstransform( ct_func ctf, PLPointer data ); + +#endif + %feature("autodoc", "Add a point to a stripchart.") plstripa; void plstripa(PLINT id, PLINT pen, PLFLT x, PLFLT y); Modified: trunk/examples/java/x19.java =================================================================== --- trunk/examples/java/x19.java 2010-05-14 18:48:25 UTC (rev 10996) +++ trunk/examples/java/x19.java 2010-05-14 21:19:09 UTC (rev 10997) @@ -31,6 +31,18 @@ import java.lang.Math; +class MapTransform implements PLCallbackCT { + public void coordTransform( double x, double y, double[] xt, double[] yt, Object data ) + { + double radius; + + radius = 90.0 - y; + xt[0] = radius * Math.cos( x * Math.PI / 180.0 ); + yt[0] = radius * Math.sin( x * Math.PI / 180.0 ); + + } +} + class Mapform19 implements PLCallbackMapform { public void mapform( double[] x, double[] y ) { @@ -137,8 +149,13 @@ double minx, maxx, miny, maxy; PLCallbackMapform nullCallback = null; PLCallbackLabel nullLabelCallback = null; + PLCallbackCT nullCTCallback = null; LabelFunc19 geolocation_labeler = new LabelFunc19(); + MapTransform map_transform = new MapTransform(); + double[] x = new double[1]; + double[] y = new double[1]; + // Parse and process command line arguments. pls.parseopts( args, PLStream.PL_PARSE_FULL | PLStream.PL_PARSE_NOPROGRAM ); @@ -188,6 +205,35 @@ pls.lsty( 2 ); pls.meridians( mapform19, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); + + // Polar, Northern hemisphere, this time with a PLplot-wide transform + + minx = 0; + maxx = 360; + + pls.stransform( map_transform, null); + + pls.lsty( 1 ); + pls.env( -75., 75., -75., 75., 1, -1 ); + // No need to set the map transform here as the global transform + // will be used. + pls.map( nullCallback, "globe", minx, maxx, miny, maxy ); + + pls.lsty( 2 ); + pls.meridians( nullCallback, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); + + // Show Baltimore, MD on the map + pls.col0( 2 ); + pls.ssym( 0.0, 2.0 ); + x[0] = -76.6125; + y[0] = 39.2902778; + pls.poin( x, y, 18 ); + pls.ssym( 0.0, 1.0 ); + pls.ptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); + + // For Java, this is how the global transform is cleared + pls.stransform( nullCTCallback, null ); + pls.end(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-05-17 11:39:42
|
Revision: 10999 http://plplot.svn.sourceforge.net/plplot/?rev=10999&view=rev Author: andrewross Date: 2010-05-17 11:39:36 +0000 (Mon, 17 May 2010) Log Message: ----------- Add python support for plstransform and update example 19 to make use of it. Modified Paths: -------------- trunk/bindings/python/plplotcmodule.i trunk/bindings/swig-support/plplotcapi.i trunk/examples/python/xw19.py Modified: trunk/bindings/python/plplotcmodule.i =================================================================== --- trunk/bindings/python/plplotcmodule.i 2010-05-17 09:54:32 UTC (rev 10998) +++ trunk/bindings/python/plplotcmodule.i 2010-05-17 11:39:36 UTC (rev 10999) @@ -60,7 +60,14 @@ #ifdef HAVE_NUMPY #define PyArray_PLINT PyArray_INT32 + +#ifdef PL_DOUBLE +#define NPY_PLFLT NPY_DOUBLE #else +#define NPY_PLFLT NPY_FLOAT +#endif + +#else /* HAVE_NUMPY */ #define PyArray_PLINT PyArray_INT #endif /* python-1.5 compatibility mode? */ @@ -615,6 +622,7 @@ typedef PLINT (*defined_func)(PLFLT, PLFLT); typedef void (*fill_func)(PLINT, PLFLT*, PLFLT*); typedef void (*pltr_func)(PLFLT, PLFLT, PLFLT *, PLFLT*, PLPointer); +typedef void (*ct_func)(PLFLT, PLFLT, PLFLT *, PLFLT*, PLPointer); typedef void (*mapform_func)(PLINT, PLFLT *, PLFLT*); typedef PLFLT (*f2eval_func)(PLINT, PLINT, PLPointer); typedef void (*label_func)(PLINT, PLFLT, char *, PLINT, PLPointer); @@ -623,6 +631,7 @@ typedef PLINT (*defined_func)(PLFLT, PLFLT); typedef void (*fill_func)(PLINT, PLFLT*, PLFLT*); typedef void (*pltr_func)(PLFLT, PLFLT, PLFLT *, PLFLT*, PLPointer); +typedef void (*ct_func)(PLFLT, PLFLT, PLFLT *, PLFLT*, PLPointer); typedef void (*mapform_func)(PLINT, PLFLT *, PLFLT*); typedef PLFLT (*f2eval_func)(PLINT, PLINT, PLPointer); typedef void (*label_func)(PLINT, PLFLT, char *, PLINT, PLPointer); @@ -648,6 +657,7 @@ enum callback_type { CB_0, CB_1, CB_2, CB_Python } pltr_type; PyObject* python_pltr = NULL; PyObject* python_f2eval = NULL; + PyObject* python_ct = NULL; PyObject* python_mapform = NULL; PyObject* python_label = NULL; @@ -807,12 +817,60 @@ } } + void do_ct_callback(PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data) + { + PyObject *px, *py, *pdata, *arglist, *result; +#ifdef HAVE_NUMPY + npy_intp n; +#else + PLINT n; +#endif + n = 1; + + /* the data argument is acutally a pointer to a python object */ + pdata = (PyObject*)data; + if(data == NULL) { + pdata = Py_None; + } + if(python_ct) { /* if not something is terribly wrong */ + /* hold a reference to the data object */ + Py_XINCREF(pdata); + /* grab the Global Interpreter Lock to be sure threads don't mess us up */ + MY_BLOCK_THREADS + /* build the argument list */ +#ifdef HAVE_NUMPY + px = PyArray_SimpleNewFromData(1, &n, NPY_PLFLT,(void *)xt); + py = PyArray_SimpleNewFromData(1, &n, NPY_PLFLT,(char *)yt); +#else + px = PyArray_FromDimsAndData(1, &n, PyArray_PLFLT,(char *)xt); + py = PyArray_FromDimsAndData(1, &n, PyArray_PLFLT,(char *)yt); +#endif + arglist = Py_BuildValue("(ddOOO)", x, y, px, py, pdata); + /* call the python function */ + result = PyEval_CallObject(python_ct, arglist); + /* release the argument list */ + Py_DECREF(arglist); + Py_DECREF(px); + Py_DECREF(py); + Py_DECREF(pdata); + /* check and unpack the result */ + if(result == NULL) { + fprintf(stderr, "call to python coordinate transform function with 5 arguments failed\n"); + PyErr_SetString(PyExc_RuntimeError, "coordinate transform callback must take 5 arguments."); + } + /* release the result */ + Py_XDECREF(result); + /* release the global interpreter lock */ + MY_UNBLOCK_THREADS + } + } + void do_mapform_callback(PLINT n, PLFLT *x, PLFLT *y) { PyObject *px, *py, *arglist, *result; - PyArrayObject *tmpx, *tmpy; + /* PyArrayObject *tmpx, *tmpy; PLFLT *xx, *yy; - PLINT i; + PLINT i; */ if(python_mapform) { /* if not something is terribly wrong */ /* grab the Global Interpreter Lock to be sure threads don't mess us up */ @@ -898,6 +956,19 @@ python_pltr = 0; } +/* marshal the ct function pointer argument */ + ct_func marshal_ct(PyObject* input) { + ct_func result = do_ct_callback; + python_ct = input; + Py_XINCREF(input); + return result; + } + + void cleanup_ct(void) { + Py_XDECREF(python_ct); + python_ct = 0; + } + /* marshal the mapform function pointer argument */ mapform_func marshal_mapform(PyObject* input) { mapform_func result = do_mapform_callback; @@ -980,6 +1051,28 @@ $1 = NULL; } +%typemap(in) ct_func ctf { + if (python_ct) + cleanup_ct(); + /* it must be a callable or none */ + if($input == Py_None) { + $1 = NULL; + } + else { + if(!PyCallable_Check((PyObject*)$input)) { + PyErr_SetString(PyExc_ValueError, "coordinate transform argument must be callable"); + return NULL; + } + $1 = marshal_ct($input); + } +} + +/* you can omit the ct func */ +%typemap(default) ct_func ctf { + python_ct = 0; + $1 = NULL; +} + %typemap(in) mapform_func mapform { /* it must be a callable or none */ if($input == Py_None) { Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2010-05-17 09:54:32 UTC (rev 10998) +++ trunk/bindings/swig-support/plplotcapi.i 2010-05-17 11:39:36 UTC (rev 10999) @@ -829,14 +829,10 @@ void plstart(const char *devname, PLINT nx, PLINT ny); -#ifdef SWIG_JAVA - %feature("autodoc", "Set the coordinate transform.") plstransform; void plstransform( ct_func ctf, PLPointer data ); -#endif - %feature("autodoc", "Add a point to a stripchart.") plstripa; void plstripa(PLINT id, PLINT pen, PLFLT x, PLFLT y); Modified: trunk/examples/python/xw19.py =================================================================== --- trunk/examples/python/xw19.py 2010-05-17 09:54:32 UTC (rev 10998) +++ trunk/examples/python/xw19.py 2010-05-17 11:39:36 UTC (rev 10999) @@ -24,6 +24,15 @@ from plplot_py_demos import * +def map_transform( x, y, xt, yt, data ): + + print "%f %f" % (x, y) + radius = 90.0 - y + xt[0] = radius * cos( x * pi / 180.0 ) + yt[0] = radius * sin( x * pi / 180.0 ) + print "%f %f" % (xt[0], yt[0]) + #return [xt, yt] + # mapform19 # # Defines specific coordinate transformation for example 19. @@ -33,7 +42,7 @@ for i in range(n): radius = 90.0 - y[i] xp = radius * cos(x[i] * pi / 180.0) - yp = radius * sin(x[i] * pi / 180.0) + yp = radius * sin(x[i] * pi / 180.0) x[i] = xp y[i] = yp return [x,y] @@ -127,4 +136,32 @@ pllsty(2) plmeridians(mapform19,10.0, 10.0, 0.0, 360.0, -10.0, 80.0) + # Polar, Northern hemisphere, this time with a PLplot-wide transform + + minx = 0 + maxx = 360 + + plstransform( map_transform, None ) + + pllsty( 1 ) + plenv( -75., 75., -75., 75., 1, -1 ) + # No need to set the map transform here as the global transform will be + # used. + plmap( None, "globe", minx, maxx, miny, maxy ) + + pllsty( 2 ) + plmeridians( None, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ) + + # Show Baltimore, MD on the map + plcol0( 2 ) + plssym( 0.0, 2.0 ) + x = [ -76.6125 ] + y = [ 39.2902778 ] + plpoin( x, y, 18 ) + plssym( 0.0, 1.0 ) + plptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ) + + # For C, this is how the global transform is cleared + plstransform( None, None ) + main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-05-17 21:10:29
|
Revision: 11003 http://plplot.svn.sourceforge.net/plplot/?rev=11003&view=rev Author: andrewross Date: 2010-05-17 21:10:22 +0000 (Mon, 17 May 2010) Log Message: ----------- Implement plstransform for f77 / f95 bindings and update example 19 to use it. Note this produces visually identical results to the C version, but there are lots of minor rounding differences in the postscript files. Modified Paths: -------------- trunk/bindings/f77/plstubs.h trunk/bindings/f77/scstubs.c trunk/bindings/f95/plstubs.h trunk/bindings/f95/scstubs.c trunk/bindings/f95/sfstubsf95.f90 trunk/examples/f77/x19f.fm4 trunk/examples/f95/x19f.f90 Modified: trunk/bindings/f77/plstubs.h =================================================================== --- trunk/bindings/f77/plstubs.h 2010-05-17 13:00:17 UTC (rev 11002) +++ trunk/bindings/f77/plstubs.h 2010-05-17 21:10:22 UTC (rev 11003) @@ -321,6 +321,8 @@ #define PLSSYM FNAME( PLSSYM, plssym ) #define PLSTAR FNAME( PLSTAR, plstar ) #define PLSTART7 FNAME( PLSTART7, plstart7 ) +#define PLSTRANSFORM FNAME( PLSTRANSFORM, plstransform ) +#define PLSTRANSFORMNONE FNAME( PLSTRANSFORMNONE, plstransformnone ) #define PLSTRIPA FNAME( PLSTRIPA, plstripa ) #define PLSTRIPC7 FNAME( PLSTRIPC7, plstripc7 ) #define PLSTRIPD FNAME( PLSTRIPD, plstripd ) Modified: trunk/bindings/f77/scstubs.c =================================================================== --- trunk/bindings/f77/scstubs.c 2010-05-17 13:00:17 UTC (rev 11002) +++ trunk/bindings/f77/scstubs.c 2010-05-17 21:10:22 UTC (rev 11003) @@ -39,8 +39,17 @@ /* Slightly different to (*label_func) as we don't support PLPointer for * additional data in f77. * Note the hidden argument! */ -static void ( STDCALL *pllabelfunc )( PLINT *, PLFLT *, char *, PLINT *, PLINT ); +static void ( STDCALL *pllabelfunc )( PLINT *, PLFLT *, char *, PLINT *, PLINT); +/* Slightly different to C version as we don't support PLPointer for additional data */ +static void ( STDCALL *pltransform )( PLFLT *, PLFLT *, PLFLT *, PLFLT *); +static void +pltransformf2c( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer data ) +{ + ( *pltransform )( &x, &y, tx, ty ); +} + + void PL_SETCONTLABELFORMAT( PLINT *lexp, PLINT *sigdig ) { @@ -952,6 +961,21 @@ } void +PLSTRANSFORM( void ( STDCALL *transformfunc )( PLFLT *, PLFLT *, PLFLT *, PLFLT * ) ) +{ + pltransform = transformfunc; + /* N.B. neglect pointer to additional data for f77 */ + c_plstransform( pltransformf2c, NULL ); +} + +void +PLSTRANSFORMNONE( void ) +{ + pltransform = NULL; + c_plstransform( NULL, NULL ); +} + +void PLSTRIPA( PLINT *id, PLINT *pen, PLFLT *x, PLFLT *y ) { c_plstripa( *id, *pen, *x, *y ); Modified: trunk/bindings/f95/plstubs.h =================================================================== --- trunk/bindings/f95/plstubs.h 2010-05-17 13:00:17 UTC (rev 11002) +++ trunk/bindings/f95/plstubs.h 2010-05-17 21:10:22 UTC (rev 11003) @@ -333,6 +333,9 @@ #define PLSSYM FNAME( PLSSYM, plssym ) #define PLSTAR FNAME( PLSTAR, plstar ) #define PLSTART7 FNAME( PLSTART7, plstart7 ) +#define PLSTRANSFORMON FNAME( PLSTRANSFORMON, plstransformon ) +#define PLSTRANSFORMOFF FNAME( PLSTRANSFORMOFF, plstransformoff ) +#define PLSTRANSFORMNONE FNAME( PLSTRANSFORMNONE, plstransformnone ) #define PLSTRIPA FNAME( PLSTRIPA, plstripa ) #define PLSTRIPC FNAME( PLSTRIPCF77, plstripcf77 ) #define PLSTRIPD FNAME( PLSTRIPD, plstripd ) Modified: trunk/bindings/f95/scstubs.c =================================================================== --- trunk/bindings/f95/scstubs.c 2010-05-17 13:00:17 UTC (rev 11002) +++ trunk/bindings/f95/scstubs.c 2010-05-17 21:10:22 UTC (rev 11003) @@ -40,6 +40,15 @@ * additional data in f77. */ static void ( STDCALL *pllabelfunc )( PLINT *, PLFLT *, char *, PLINT * ); +/* Slightly different to C version as we don't support PLPointer for additional data */ +static void ( STDCALL *pltransform )( PLFLT *, PLFLT *, PLFLT *, PLFLT *); + +static void +pltransformf2c( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer data ) +{ + ( *pltransform )( &x, &y, tx, ty ); +} + void PL_SETCONTLABELFORMAT( PLINT *lexp, PLINT *sigdig ) { @@ -1031,6 +1040,30 @@ } void +PLSTRANSFORMON( void ( STDCALL *transformfunc )( PLFLT *, PLFLT *, PLFLT *, PLFLT * ) ) +{ + pltransform = transformfunc; + + c_plstransform( pltransformf2c, NULL ); +} + +void +PLSTRANSFORMOFF( PLINT *dummy ) +{ + pltransform = NULL; + + c_plstransform( NULL, NULL ); +} + +void +PLSTRANSFORMNONE( void ) +{ + pltransform = NULL; + + c_plstransform( NULL, NULL ); +} + +void PLSTRIPA( PLINT *id, PLINT *pen, PLFLT *x, PLFLT *y ) { c_plstripa( *id, *pen, *x, *y ); Modified: trunk/bindings/f95/sfstubsf95.f90 =================================================================== --- trunk/bindings/f95/sfstubsf95.f90 2010-05-17 13:00:17 UTC (rev 11002) +++ trunk/bindings/f95/sfstubsf95.f90 2010-05-17 21:10:22 UTC (rev 11003) @@ -835,6 +835,28 @@ end subroutine plstar end interface + interface plstransform + subroutine plstransformon( transformfunc ) + interface + subroutine transformfunc(x, y, xt, yt) + use plplot_flt + implicit none + real(kind=plflt) :: x, y, xt, yt + end subroutine transformfunc + end interface + end subroutine plstransformon + + subroutine plstransformoff( dummy ) + implicit none + integer :: dummy + end subroutine plstransformoff + + subroutine plstransformnone + end subroutine plstransformnone + + end interface + + interface subroutine plstripa( id, pen, x, y ) use plplot_flt Modified: trunk/examples/f77/x19f.fm4 =================================================================== --- trunk/examples/f77/x19f.fm4 2010-05-17 13:00:17 UTC (rev 11002) +++ trunk/examples/f77/x19f.fm4 2010-05-17 21:10:22 UTC (rev 11003) @@ -51,6 +51,19 @@ endif end + subroutine map_transform(x, y, xt, yt) + implicit none + + real*8 x, y, xt, yt, radius + real*8 PI + parameter ( PI = 3.1415926535897932384d0 ) + + radius = 90.0d0 - y + xt = radius * cos(x * PI / 180.0d0) + yt = radius * sin(x * PI / 180.0d0) + return + end subroutine + c-------------------------------------------------------------------------- c mapform19 c @@ -152,7 +165,9 @@ program x19f implicit none real*8 minx, maxx, miny, maxy + real*8 x, y external ident + external map_transform external mapform19 external geolocation_labeler @@ -208,5 +223,36 @@ call plmeridians(mapform19,10.0d0, 10.0d0, & 0.0d0, 360.0d0, -10.0d0, & 80.0d0) + +c Polar, Northern hemisphere, this time with a PLplot-wide transform + + minx = 0 + maxx = 360 + + call plstransform( map_transform ) + + call pllsty( 1 ) + call plenv( -75.d0, 75.d0, -75.d0, 75.d0, 1, -1 ) + ! No need to set the map transform here as the global + ! transform will be used. + call plmap( ident, 'globe', minx, maxx, miny, maxy ) + + call pllsty( 2 ) + call plmeridians( ident, 10.0d0, 10.0d0, 0.0d0, + & 360.0d0, -10.0d0, 80.0d0 ) + + ! Show Baltimore, MD on the map + call plcol0( 2 ) + call plssym( 0.0d0, 2.0d0 ) + x=-76.6125d0 + y=39.2902778d0 + call plpoin( 1, x, y, 18 ) + call plssym( 0.0d0, 1.0d0 ) + call plptex( -76.6125d0, 43.0d0, 0.0d0, 0.0d0, + & 0.0d0, 'Baltimore, MD' ) + + ! For f77, this is how the global transform is cleared + call plstransformnone + call plend() end Modified: trunk/examples/f95/x19f.f90 =================================================================== --- trunk/examples/f95/x19f.f90 2010-05-17 13:00:17 UTC (rev 11002) +++ trunk/examples/f95/x19f.f90 2010-05-17 21:10:22 UTC (rev 11003) @@ -38,6 +38,19 @@ return end + + subroutine map_transform(x, y, xt, yt) + use plplot, PI => PL_PI + implicit none + + real(kind=plflt) x, y, xt, yt, radius + + radius = 90.0_plflt - y + xt = radius * cos(x * PI / 180.0_plflt) + yt = radius * sin(x * PI / 180.0_plflt) + return + end subroutine + !-------------------------------------------------------------------------- ! mapform19 ! @@ -75,14 +88,14 @@ real(kind=plflt) :: normalize_longitude real(kind=plflt) :: lon, times - if ((lon .ge. -180.0d0) .and. (lon .le. 180.0d0)) then + if ((lon .ge. -180.0_plflt) .and. (lon .le. 180.0_plflt)) then normalize_longitude = lon else - times = floor ((abs(lon) + 180.0d0) / 360.0d0) - if (lon .lt. 0.0d0) then - normalize_longitude = lon + 360.0d0 * times + times = floor ((abs(lon) + 180.0_plflt) / 360.0_plflt) + if (lon .lt. 0.0_plflt) then + normalize_longitude = lon + 360.0_plflt * times else - normalize_longitude = lon - 360.0d0 * times + normalize_longitude = lon - 360.0_plflt * times endif endif return @@ -103,27 +116,27 @@ if (axis .eq. 2) then label_val = value - if (label_val .gt. 0.0d0) then + if (label_val .gt. 0.0_plflt) then direction_label = ' N' - else if (label_val .lt. 0.0d0) then + else if (label_val .lt. 0.0_plflt) then direction_label = ' S' else direction_label = 'Eq' endif else if (axis .eq. 1) then label_val = normalize_longitude(value) - if (label_val .gt. 0.0d0) then + if (label_val .gt. 0.0_plflt) then direction_label = ' E' - else if (label_val .lt. 0.0d0) then + else if (label_val .lt. 0.0_plflt) then direction_label = ' W' else direction_label = '' endif endif - if (axis .eq. 2 .and. value .eq. 0.0d0) then + if (axis .eq. 2 .and. value .eq. 0.0_plflt) then ! A special case for the equator label = direction_label - else if (abs(label_val) .lt. 100.0d0) then + else if (abs(label_val) .lt. 100.0_plflt) then write(label,'(I2.1,A2)') iabs(int(label_val)),direction_label else write(label,'(I3.1,A2)') iabs(int(label_val)),direction_label @@ -140,8 +153,10 @@ use plplot implicit none real(kind=plflt) minx, maxx, miny, maxy + real(kind=plflt), dimension(1:1) :: x, y integer c external ident + external map_transform external mapform19 external geolocation_labeler @@ -193,5 +208,38 @@ call plmeridians(mapform19,10.0_plflt, 10.0_plflt, & 0.0_plflt, 360.0_plflt, -10.0_plflt, & 80.0_plflt) + +! Polar, Northern hemisphere, this time with a PLplot-wide transform + + minx = 0 + maxx = 360 + + call plstransform( map_transform ) + + call pllsty( 1 ) + call plenv( -75._plflt, 75._plflt, -75._plflt, & + 75._plflt, 1, -1 ) + ! No need to set the map transform here as the global + ! transform will be used. + call plmap( ident, 'globe', minx, maxx, miny, maxy ) + + call pllsty( 2 ) + call plmeridians(ident, 10.0_plflt, 10.0_plflt, & + 0.0_plflt, 360.0_plflt, -10.0_plflt, & + 80.0_plflt ) + + ! Show Baltimore, MD on the map + call plcol0( 2 ) + call plssym( 0.0_plflt, 2.0_plflt ) + x=-76.6125_plflt + y=39.2902778_plflt + call plpoin( x, y, 18 ) + call plssym( 0.0_plflt, 1.0_plflt ) + call plptex( -76.6125_plflt, 43.0_plflt, 0.0_plflt, & + 0.0_plflt, 0.0_plflt, 'Baltimore, MD' ) + + ! For f95, this is how the global transform is cleared + call plstransform( 0 ) + call plend() end program x19f This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-05-18 12:56:20
|
Revision: 11005 http://plplot.svn.sourceforge.net/plplot/?rev=11005&view=rev Author: andrewross Date: 2010-05-18 12:56:14 +0000 (Tue, 18 May 2010) Log Message: ----------- Fix up example 19 for fortran 77 / 95. Having an identity transform in plmap / plmeridians is not the same as having no transform at, particularly when there is a global coordinate transform defined. Add in versions of plmap / plmeridians to genuinely clear the transform. Results for example 19 now agree with C version. Modified Paths: -------------- trunk/bindings/f77/plstubs.h trunk/bindings/f77/scstubs.c trunk/bindings/f77/sfstubs.fm4 trunk/bindings/f95/plstubs.h trunk/bindings/f95/scstubs.c trunk/bindings/f95/sfstubs.f90 trunk/bindings/f95/sfstubsf95.f90 trunk/examples/f77/x19f.fm4 trunk/examples/f95/x19f.f90 Modified: trunk/bindings/f77/plstubs.h =================================================================== --- trunk/bindings/f77/plstubs.h 2010-05-18 07:47:37 UTC (rev 11004) +++ trunk/bindings/f77/plstubs.h 2010-05-18 12:56:14 UTC (rev 11005) @@ -322,7 +322,8 @@ #define PLSTAR FNAME( PLSTAR, plstar ) #define PLSTART7 FNAME( PLSTART7, plstart7 ) #define PLSTRANSFORM FNAME( PLSTRANSFORM, plstransform ) -#define PLSTRANSFORMNONE FNAME( PLSTRANSFORMNONE, plstransformnone ) +#define PLSTRANSFORM_NONE FNAME( PLSTRANSFORM_NONE, plstransform_none ) +#define PLSTRANSFORM_NONE_ FNAME( PLSTRANSFORM_NONE_, plstransform_none_ ) #define PLSTRIPA FNAME( PLSTRIPA, plstripa ) #define PLSTRIPC7 FNAME( PLSTRIPC7, plstripc7 ) #define PLSTRIPD FNAME( PLSTRIPD, plstripd ) Modified: trunk/bindings/f77/scstubs.c =================================================================== --- trunk/bindings/f77/scstubs.c 2010-05-18 07:47:37 UTC (rev 11004) +++ trunk/bindings/f77/scstubs.c 2010-05-18 12:56:14 UTC (rev 11005) @@ -544,7 +544,10 @@ PLFLT *minlong, PLFLT *maxlong, PLFLT *minlat, PLFLT *maxlat ) { - c_plmap( plmapf2c, type, *minlong, *maxlong, *minlat, *maxlat ); + if ( plmapform ) + c_plmap( plmapf2c, type, *minlong, *maxlong, *minlat, *maxlat ); + else + c_plmap( NULL, type, *minlong, *maxlong, *minlat, *maxlat ); } @@ -552,7 +555,10 @@ PLMERIDIANS7( PLFLT *dlong, PLFLT *dlat, PLFLT *minlong, PLFLT *maxlong, PLFLT *minlat, PLFLT *maxlat ) { - c_plmeridians( plmapf2c, *dlong, *dlat, *minlong, *maxlong, *minlat, *maxlat ); + if ( plmapform ) + c_plmeridians( plmapf2c, *dlong, *dlat, *minlong, *maxlong, *minlat, *maxlat ); + else + c_plmeridians( NULL, *dlong, *dlat, *minlong, *maxlong, *minlat, *maxlat ); } void @@ -820,6 +826,7 @@ /* Auxiliary routine - not to be used publicly */ #define PLSETMAPFORMC FNAME( PLSETMAPFORMC, plsetmapformc ) +#define PLCLEARMAPFORMC FNAME( PLCLEARMAPFORMC, plclearmapformc ) void PLSETMAPFORMC( void ( STDCALL *mapform )( PLINT *, PLFLT *, PLFLT * ) ) { @@ -827,6 +834,12 @@ } void +PLCLEARMAPFORMC( ) +{ + plmapform = NULL; +} + +void PLSETOPT7( const char *opt, const char *optarg ) { c_plsetopt( opt, optarg ); @@ -969,13 +982,20 @@ } void -PLSTRANSFORMNONE( void ) +PLSTRANSFORM_NONE( void ) { pltransform = NULL; c_plstransform( NULL, NULL ); } void +PLSTRANSFORM_NONE_( void ) +{ + pltransform = NULL; + c_plstransform( NULL, NULL ); +} + +void PLSTRIPA( PLINT *id, PLINT *pen, PLFLT *x, PLFLT *y ) { c_plstripa( *id, *pen, *x, *y ); Modified: trunk/bindings/f77/sfstubs.fm4 =================================================================== --- trunk/bindings/f77/sfstubs.fm4 2010-05-18 07:47:37 UTC (rev 11004) +++ trunk/bindings/f77/sfstubs.fm4 2010-05-18 12:56:14 UTC (rev 11005) @@ -719,6 +719,23 @@ c*********************************************************************** + subroutine plmap_none(mapname,minx,maxx,miny,maxy) + + implicit none + real*8 minx, maxx, miny, maxy + character*(*) mapname + + include 'sfstubs.h' + + call plstrf2c(mapname, string1, maxlen) + + call plclearmapformc() + call plmap7(s1,minx,maxx,miny,maxy) + + end subroutine + +c*********************************************************************** + subroutine plmeridians(mapform,dlong,dlat,minlong,maxlong, & minlat,maxlat) @@ -736,6 +753,22 @@ c*********************************************************************** + subroutine plmeridians_none(dlong,dlat,minlong,maxlong, + & minlat,maxlat) + + implicit none + real*8 dlong, dlat, minlong, maxlong, minlat, maxlat + + include 'sfstubs.h' + + call plclearmapformc() + call plmeridians7(dlong,dlat,minlong,maxlong,minlat,maxlat) + + end subroutine + + +c*********************************************************************** + subroutine plstripc(id, xspec, yspec, xmin, xmax, xjump, & ymin, ymax, xlpos, ylpos, y_ascl, acc, & colbox, collab, colline, styline, legline, Modified: trunk/bindings/f95/plstubs.h =================================================================== --- trunk/bindings/f95/plstubs.h 2010-05-18 07:47:37 UTC (rev 11004) +++ trunk/bindings/f95/plstubs.h 2010-05-18 12:56:14 UTC (rev 11005) @@ -333,9 +333,9 @@ #define PLSSYM FNAME( PLSSYM, plssym ) #define PLSTAR FNAME( PLSTAR, plstar ) #define PLSTART7 FNAME( PLSTART7, plstart7 ) -#define PLSTRANSFORMON FNAME( PLSTRANSFORMON, plstransformon ) -#define PLSTRANSFORMOFF FNAME( PLSTRANSFORMOFF, plstransformoff ) -#define PLSTRANSFORMNONE FNAME( PLSTRANSFORMNONE, plstransformnone ) +#define PLSTRANSFORM1 FNAME( PLSTRANSFORM1, plstransform1 ) +#define PLSTRANSFORM2 FNAME( PLSTRANSFORM2, plstransform2 ) +#define PLSTRANSFORM3 FNAME( PLSTRANSFORM3, plstransform3 ) #define PLSTRIPA FNAME( PLSTRIPA, plstripa ) #define PLSTRIPC FNAME( PLSTRIPCF77, plstripcf77 ) #define PLSTRIPD FNAME( PLSTRIPD, plstripd ) Modified: trunk/bindings/f95/scstubs.c =================================================================== --- trunk/bindings/f95/scstubs.c 2010-05-18 07:47:37 UTC (rev 11004) +++ trunk/bindings/f95/scstubs.c 2010-05-18 12:56:14 UTC (rev 11005) @@ -587,7 +587,10 @@ PLFLT *minlong, PLFLT *maxlong, PLFLT *minlat, PLFLT *maxlat ) { - c_plmap( plmapf2c, type, *minlong, *maxlong, *minlat, *maxlat ); + if ( plmapform ) + c_plmap( plmapf2c, type, *minlong, *maxlong, *minlat, *maxlat ); + else + c_plmap( NULL, type, *minlong, *maxlong, *minlat, *maxlat ); } @@ -595,7 +598,10 @@ PLMERIDIANS7( PLFLT *dlong, PLFLT *dlat, PLFLT *minlong, PLFLT *maxlong, PLFLT *minlat, PLFLT *maxlat ) { - c_plmeridians( plmapf2c, *dlong, *dlat, *minlong, *maxlong, *minlat, *maxlat ); + if ( plmapform ) + c_plmeridians( plmapf2c, *dlong, *dlat, *minlong, *maxlong, *minlat, *maxlat ); + else + c_plmeridians( NULL, *dlong, *dlat, *minlong, *maxlong, *minlat, *maxlat ); } void @@ -877,11 +883,17 @@ /* Auxiliary routine - not to be used publicly */ #define PLSETMAPFORMC FNAME( PLSETMAPFORMC, plsetmapformc ) +#define PLCLEARMAPFORMC FNAME( PLCLEARMAPFORMC, plclearmapformc ) void PLSETMAPFORMC( void ( STDCALL *mapform )( PLINT *, PLFLT *, PLFLT * ) ) { plmapform = mapform; } +void +PLCLEARMAPFORMC( ) +{ + plmapform = NULL; +} void PLSETOPT7( const char *opt, const char *optarg ) @@ -1040,7 +1052,7 @@ } void -PLSTRANSFORMON( void ( STDCALL *transformfunc )( PLFLT *, PLFLT *, PLFLT *, PLFLT * ) ) +PLSTRANSFORM1( void ( STDCALL *transformfunc )( PLFLT *, PLFLT *, PLFLT *, PLFLT * ) ) { pltransform = transformfunc; @@ -1048,15 +1060,16 @@ } void -PLSTRANSFORMOFF( PLINT *dummy ) +PLSTRANSFORM2( PLINT *dummy ) { pltransform = NULL; c_plstransform( NULL, NULL ); } +/* Provided for symmetry with FORTRAN 77 */ void -PLSTRANSFORMNONE( void ) +PLSTRANSFORM3( void ) { pltransform = NULL; Modified: trunk/bindings/f95/sfstubs.f90 =================================================================== --- trunk/bindings/f95/sfstubs.f90 2010-05-18 07:47:37 UTC (rev 11004) +++ trunk/bindings/f95/sfstubs.f90 2010-05-18 12:56:14 UTC (rev 11005) @@ -793,41 +793,6 @@ !*********************************************************************** - subroutine plmap(mapform,mapname,minx,maxx,miny,maxy) - - implicit none - real(kind=plflt) minx, maxx, miny, maxy - character*(*) mapname - external mapform - - include 'sfstubs.h' - - call plstrf2c(mapname, string1, maxlen) - - call plsetmapformc(mapform) - s1 = transfer( string1, s1 ) - call plmap7(s1,minx,maxx,miny,maxy) - - end subroutine - -!*********************************************************************** - - subroutine plmeridians(mapform,dlong,dlat,minlong,maxlong, & - minlat,maxlat) - - implicit none - real(kind=plflt) dlong, dlat, minlong, maxlong, minlat, maxlat - external mapform - - include 'sfstubs.h' - - call plsetmapformc(mapform) - call plmeridians7(dlong,dlat,minlong,maxlong,minlat,maxlat) - - end subroutine - -!*********************************************************************** - subroutine pltimefmt(fmt) implicit none Modified: trunk/bindings/f95/sfstubsf95.f90 =================================================================== --- trunk/bindings/f95/sfstubsf95.f90 2010-05-18 07:47:37 UTC (rev 11004) +++ trunk/bindings/f95/sfstubsf95.f90 2010-05-18 12:56:14 UTC (rev 11005) @@ -505,6 +505,14 @@ end subroutine pllsty end interface + interface plmap + module procedure plmap1, plmap2 + end interface plmap + + interface plmeridians + module procedure plmeridians1, plmeridians2 + end interface plmeridians + interface plmesh module procedure plmesh end interface @@ -836,7 +844,7 @@ end interface interface plstransform - subroutine plstransformon( transformfunc ) + subroutine plstransform1( transformfunc ) interface subroutine transformfunc(x, y, xt, yt) use plplot_flt @@ -844,19 +852,18 @@ real(kind=plflt) :: x, y, xt, yt end subroutine transformfunc end interface - end subroutine plstransformon + end subroutine plstransform1 - subroutine plstransformoff( dummy ) + subroutine plstransform2( dummy ) implicit none integer :: dummy - end subroutine plstransformoff + end subroutine plstransform2 - subroutine plstransformnone - end subroutine plstransformnone + subroutine plstransform3 + end subroutine plstransform3 end interface - interface subroutine plstripa( id, pen, x, y ) use plplot_flt @@ -1103,6 +1110,67 @@ call plline3f77( size(x), x, y, z ) end subroutine plline3 + subroutine plmap1(mapform,mapname,minx,maxx,miny,maxy) + use plplot_flt + implicit none + real(kind=plflt) minx, maxx, miny, maxy + character*(*) mapname + external mapform + + include 'sfstubs.h' + + call plstrf2c(mapname, string1, maxlen) + + call plsetmapformc(mapform) + s1 = transfer( string1, s1 ) + call plmap7(s1,minx,maxx,miny,maxy) + + end subroutine plmap1 + + subroutine plmap2(mapname,minx,maxx,miny,maxy) + use plplot_flt + implicit none + real(kind=plflt) minx, maxx, miny, maxy + character*(*) mapname + + include 'sfstubs.h' + + call plstrf2c(mapname, string1, maxlen) + + call plclearmapformc() + s1 = transfer( string1, s1 ) + call plmap7(s1,minx,maxx,miny,maxy) + + end subroutine plmap2 + + subroutine plmeridians1(mapform,dlong,dlat,minlong,maxlong, & + minlat,maxlat) + + implicit none + real(kind=plflt) dlong, dlat, minlong, maxlong, minlat, maxlat + external mapform + + include 'sfstubs.h' + + call plsetmapformc(mapform) + call plmeridians7(dlong,dlat,minlong,maxlong,minlat,maxlat) + + end subroutine plmeridians1 + + subroutine plmeridians2(dlong,dlat,minlong,maxlong, & + minlat,maxlat) + + implicit none + real(kind=plflt) dlong, dlat, minlong, maxlong, minlat, maxlat + external mapform + + include 'sfstubs.h' + + call plclearmapformc + call plmeridians7(dlong,dlat,minlong,maxlong,minlat,maxlat) + + end subroutine plmeridians2 + subroutine plmesh( x, y, z, opt ) integer :: opt real(kind=plflt), dimension(:) :: x, y Modified: trunk/examples/f77/x19f.fm4 =================================================================== --- trunk/examples/f77/x19f.fm4 2010-05-18 07:47:37 UTC (rev 11004) +++ trunk/examples/f77/x19f.fm4 2010-05-18 12:56:14 UTC (rev 11005) @@ -20,24 +20,6 @@ c-------------------------------------------------------------------------- -c ident -c -c Defines identity transformation for example 19. -c x(), y() are the coordinates to be plotted. -c This is a 0-OP routine, to play the role of NULL in the C version! -c-------------------------------------------------------------------------- - - subroutine ident(n, x, y) - implicit none - - integer n - real*8 x - real*8 y - - return - end - -c-------------------------------------------------------------------------- c floor c c Compatibility function - keep all examples as equal as possible @@ -51,6 +33,11 @@ endif end +c-------------------------------------------------------------------------- +c map_transform +c +c General coordinate transform function +c-------------------------------------------------------------------------- subroutine map_transform(x, y, xt, yt) implicit none @@ -85,9 +72,7 @@ real*8 xp, yp, radius do i = 1,n - radius = 90.0d0 - y(i) - xp = radius * cos(x(i) * PI / 180.0d0) - yp = radius * sin(x(i) * PI / 180.0d0) + call map_transform(x(i),y(i),xp,yp) x(i) = xp y(i) = yp enddo @@ -166,7 +151,6 @@ implicit none real*8 minx, maxx, miny, maxy real*8 x, y - external ident external map_transform external mapform19 external geolocation_labeler @@ -194,7 +178,7 @@ call plcol0(1) call plenv(minx, maxx, miny, maxy, 1, 70) - call plmap(ident, 'usaglobe', minx, maxx, miny, maxy) + call plmap_none('usaglobe', minx, maxx, miny, maxy) c The Americas @@ -203,7 +187,7 @@ call plcol0(1) call plenv(minx, maxx, miny, maxy, 1, 70) - call plmap(ident, 'usaglobe', minx, maxx, miny, maxy) + call plmap_none('usaglobe', minx, maxx, miny, maxy) c Clear the labeling function c (Note: FORTRAN 77 does not handle NULL pointers, so an @@ -235,10 +219,10 @@ call plenv( -75.d0, 75.d0, -75.d0, 75.d0, 1, -1 ) ! No need to set the map transform here as the global ! transform will be used. - call plmap( ident, 'globe', minx, maxx, miny, maxy ) + call plmap_none( 'globe', minx, maxx, miny, maxy ) call pllsty( 2 ) - call plmeridians( ident, 10.0d0, 10.0d0, 0.0d0, + call plmeridians_none( 10.0d0, 10.0d0, 0.0d0, & 360.0d0, -10.0d0, 80.0d0 ) ! Show Baltimore, MD on the map @@ -252,7 +236,7 @@ & 0.0d0, 'Baltimore, MD' ) ! For f77, this is how the global transform is cleared - call plstransformnone + call plstransform_none call plend() end Modified: trunk/examples/f95/x19f.f90 =================================================================== --- trunk/examples/f95/x19f.f90 2010-05-18 07:47:37 UTC (rev 11004) +++ trunk/examples/f95/x19f.f90 2010-05-18 12:56:14 UTC (rev 11005) @@ -19,26 +19,6 @@ ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -!-------------------------------------------------------------------------- -! ident -! -! Defines identity transformation for example 19. -! x(), y() are the coordinates to be plotted. -! This is a 0-OP routine, to play the role of NULL in the C version! -!-------------------------------------------------------------------------- - - subroutine ident(n, x, y) - use plplot - implicit none - - integer n - real(kind=plflt) x - real(kind=plflt) y - - return - end - - subroutine map_transform(x, y, xt, yt) use plplot, PI => PL_PI implicit none @@ -155,7 +135,6 @@ real(kind=plflt) minx, maxx, miny, maxy real(kind=plflt), dimension(1:1) :: x, y integer c - external ident external map_transform external mapform19 external geolocation_labeler @@ -165,40 +144,40 @@ ! Longitude (x) and latitude (y) - miny = -70 - maxy = 80 + miny = -70._plflt + maxy = 80._plflt call plinit() ! Cartesian plots ! Most of world - minx = 190 - maxx = 190+360 + minx = 190._plflt + maxx = 190._plflt+360._plflt ! Setup a custom latitude and longitude-based scaling function. call plslabelfunc(geolocation_labeler) call plcol0(1) call plenv(minx, maxx, miny, maxy, 1, 70) - call plmap(ident, 'usaglobe', minx, maxx, miny, maxy) + call plmap('usaglobe', minx, maxx, miny, maxy) ! The Americas - minx = 190 - maxx = 340 + minx = 190._plflt + maxx = 340._plflt call plcol0(1) call plenv(minx, maxx, miny, maxy, 1, 70) - call plmap(ident, 'usaglobe', minx, maxx, miny, maxy) + call plmap('usaglobe', minx, maxx, miny, maxy) ! Clear the labeling function call plslabelfunc(0) ! Polar, Northern hemisphere - minx = 0 - maxx = 360 + minx = 0._plflt + maxx = 360._plflt call plenv(-75._plflt, 75._plflt, -75._plflt, & 75._plflt, 1, -1) @@ -211,8 +190,8 @@ ! Polar, Northern hemisphere, this time with a PLplot-wide transform - minx = 0 - maxx = 360 + minx = 0._plflt + maxx = 360._plflt call plstransform( map_transform ) @@ -221,10 +200,10 @@ 75._plflt, 1, -1 ) ! No need to set the map transform here as the global ! transform will be used. - call plmap( ident, 'globe', minx, maxx, miny, maxy ) + call plmap('globe', minx, maxx, miny, maxy ) call pllsty( 2 ) - call plmeridians(ident, 10.0_plflt, 10.0_plflt, & + call plmeridians(10.0_plflt, 10.0_plflt, & 0.0_plflt, 360.0_plflt, -10.0_plflt, & 80.0_plflt ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-05-21 06:12:30
|
Revision: 11016 http://plplot.svn.sourceforge.net/plplot/?rev=11016&view=rev Author: airwin Date: 2010-05-21 06:12:23 +0000 (Fri, 21 May 2010) Log Message: ----------- Style recent changes. Modified Paths: -------------- trunk/bindings/f77/scstubs.c trunk/bindings/f95/scstubs.c trunk/bindings/java/PLStream.java trunk/bindings/tcl/tclAPI.c trunk/examples/java/x19.java Modified: trunk/bindings/f77/scstubs.c =================================================================== --- trunk/bindings/f77/scstubs.c 2010-05-20 06:57:43 UTC (rev 11015) +++ trunk/bindings/f77/scstubs.c 2010-05-21 06:12:23 UTC (rev 11016) @@ -39,14 +39,14 @@ /* Slightly different to (*label_func) as we don't support PLPointer for * additional data in f77. * Note the hidden argument! */ -static void ( STDCALL *pllabelfunc )( PLINT *, PLFLT *, char *, PLINT *, PLINT); +static void ( STDCALL *pllabelfunc )( PLINT *, PLFLT *, char *, PLINT *, PLINT ); /* Slightly different to C version as we don't support PLPointer for additional data */ -static void ( STDCALL *pltransform )( PLFLT *, PLFLT *, PLFLT *, PLFLT *); +static void ( STDCALL *pltransform )( PLFLT *, PLFLT *, PLFLT *, PLFLT * ); static void pltransformf2c( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer data ) { - ( *pltransform )( &x, &y, tx, ty ); + ( *pltransform )( &x, &y, tx, ty ); } @@ -825,8 +825,8 @@ /* Auxiliary routine - not to be used publicly */ -#define PLSETMAPFORMC FNAME( PLSETMAPFORMC, plsetmapformc ) -#define PLCLEARMAPFORMC FNAME( PLCLEARMAPFORMC, plclearmapformc ) +#define PLSETMAPFORMC FNAME( PLSETMAPFORMC, plsetmapformc ) +#define PLCLEARMAPFORMC FNAME( PLCLEARMAPFORMC, plclearmapformc ) void PLSETMAPFORMC( void ( STDCALL *mapform )( PLINT *, PLFLT *, PLFLT * ) ) { Modified: trunk/bindings/f95/scstubs.c =================================================================== --- trunk/bindings/f95/scstubs.c 2010-05-20 06:57:43 UTC (rev 11015) +++ trunk/bindings/f95/scstubs.c 2010-05-21 06:12:23 UTC (rev 11016) @@ -41,12 +41,12 @@ static void ( STDCALL *pllabelfunc )( PLINT *, PLFLT *, char *, PLINT * ); /* Slightly different to C version as we don't support PLPointer for additional data */ -static void ( STDCALL *pltransform )( PLFLT *, PLFLT *, PLFLT *, PLFLT *); +static void ( STDCALL *pltransform )( PLFLT *, PLFLT *, PLFLT *, PLFLT * ); static void pltransformf2c( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer data ) { - ( *pltransform )( &x, &y, tx, ty ); + ( *pltransform )( &x, &y, tx, ty ); } void @@ -882,8 +882,8 @@ /* Auxiliary routine - not to be used publicly */ -#define PLSETMAPFORMC FNAME( PLSETMAPFORMC, plsetmapformc ) -#define PLCLEARMAPFORMC FNAME( PLCLEARMAPFORMC, plclearmapformc ) +#define PLSETMAPFORMC FNAME( PLSETMAPFORMC, plsetmapformc ) +#define PLCLEARMAPFORMC FNAME( PLCLEARMAPFORMC, plclearmapformc ) void PLSETMAPFORMC( void ( STDCALL *mapform )( PLINT *, PLFLT *, PLFLT * ) ) { Modified: trunk/bindings/java/PLStream.java =================================================================== --- trunk/bindings/java/PLStream.java 2010-05-20 06:57:43 UTC (rev 11015) +++ trunk/bindings/java/PLStream.java 2010-05-21 06:12:23 UTC (rev 11016) @@ -991,8 +991,8 @@ public void stransform( PLCallbackCT coordTrans, Object data ) { - if ( set_stream() == -1) return; - plplotjavac.plstransform( coordTrans, data ); + if ( set_stream() == -1 ) return; + plplotjavac.plstransform( coordTrans, data ); } public void stripa( int id, int pen, double x, double y ) Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2010-05-20 06:57:43 UTC (rev 11015) +++ trunk/bindings/tcl/tclAPI.c 2010-05-21 06:12:23 UTC (rev 11016) @@ -3329,15 +3329,15 @@ return TCL_OK; } -static Tcl_Interp *tcl_xform_interp = 0; -static char *tcl_xform_procname = 0; +static Tcl_Interp *tcl_xform_interp = 0; +static char *tcl_xform_procname = 0; static const char *tcl_xform_template = #if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 5 "set result [%s ${_##_x} ${_##_y}] ; set _##_x [lindex $result 0] ; set _##_y [lindex $result 1]" #else "set result [%s ${_##_x} ${_##_y}] ; lassign $result _##_x _##_y" -#endif - ; +#endif +; static char *tcl_xform_code = 0; @@ -3348,14 +3348,14 @@ Tcl_Obj *objx = Tcl_NewDoubleObj( x ); Tcl_IncrRefCount( objx ); Tcl_SetVar2Ex( tcl_xform_interp, - "_##_x", NULL, objx, 0 ); + "_##_x", NULL, objx, 0 ); Tcl_DecrRefCount( objx ); // Set Tcl y to y Tcl_Obj *objy = Tcl_NewDoubleObj( y ); Tcl_IncrRefCount( objy ); Tcl_SetVar2Ex( tcl_xform_interp, - "_##_y", NULL, objy, 0 ); + "_##_y", NULL, objy, 0 ); Tcl_DecrRefCount( objy ); /* printf( "objx=%x objy=%x\n", objx, objy ); */ @@ -3406,7 +3406,7 @@ if ( argc == 1 || argv[1] == "NULL" ) { - // The user has requested to clear the transform setting. + // The user has requested to clear the transform setting. plstransform( NULL, NULL ); tcl_xform_interp = 0; if ( tcl_xform_procname ) @@ -3419,7 +3419,7 @@ { const char *data = argc > 2 ? argv[2] : 0; - tcl_xform_interp = interp; + tcl_xform_interp = interp; tcl_xform_procname = strdup( argv[1] ); int len = strlen( tcl_xform_template ) + strlen( tcl_xform_procname ); Modified: trunk/examples/java/x19.java =================================================================== --- trunk/examples/java/x19.java 2010-05-20 06:57:43 UTC (rev 11015) +++ trunk/examples/java/x19.java 2010-05-21 06:12:23 UTC (rev 11016) @@ -34,12 +34,11 @@ class MapTransform implements PLCallbackCT { public void coordTransform( double x, double y, double[] xt, double[] yt, Object data ) { - double radius; + double radius; - radius = 90.0 - y; - xt[0] = radius * Math.cos( x * Math.PI / 180.0 ); - yt[0] = radius * Math.sin( x * Math.PI / 180.0 ); - + radius = 90.0 - y; + xt[0] = radius * Math.cos( x * Math.PI / 180.0 ); + yt[0] = radius * Math.sin( x * Math.PI / 180.0 ); } } @@ -151,10 +150,10 @@ PLCallbackLabel nullLabelCallback = null; PLCallbackCT nullCTCallback = null; LabelFunc19 geolocation_labeler = new LabelFunc19(); - MapTransform map_transform = new MapTransform(); + MapTransform map_transform = new MapTransform(); - double[] x = new double[1]; - double[] y = new double[1]; + double[] x = new double[1]; + double[] y = new double[1]; // Parse and process command line arguments. pls.parseopts( args, PLStream.PL_PARSE_FULL | PLStream.PL_PARSE_NOPROGRAM ); @@ -206,34 +205,34 @@ pls.meridians( mapform19, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); - // Polar, Northern hemisphere, this time with a PLplot-wide transform + // Polar, Northern hemisphere, this time with a PLplot-wide transform - minx = 0; - maxx = 360; + minx = 0; + maxx = 360; - pls.stransform( map_transform, null); + pls.stransform( map_transform, null ); - pls.lsty( 1 ); - pls.env( -75., 75., -75., 75., 1, -1 ); - // No need to set the map transform here as the global transform - // will be used. - pls.map( nullCallback, "globe", minx, maxx, miny, maxy ); + pls.lsty( 1 ); + pls.env( -75., 75., -75., 75., 1, -1 ); + // No need to set the map transform here as the global transform + // will be used. + pls.map( nullCallback, "globe", minx, maxx, miny, maxy ); - pls.lsty( 2 ); - pls.meridians( nullCallback, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); + pls.lsty( 2 ); + pls.meridians( nullCallback, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); - // Show Baltimore, MD on the map - pls.col0( 2 ); - pls.ssym( 0.0, 2.0 ); - x[0] = -76.6125; - y[0] = 39.2902778; - pls.poin( x, y, 18 ); - pls.ssym( 0.0, 1.0 ); - pls.ptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); - - // For Java, this is how the global transform is cleared - pls.stransform( nullCTCallback, null ); + // Show Baltimore, MD on the map + pls.col0( 2 ); + pls.ssym( 0.0, 2.0 ); + x[0] = -76.6125; + y[0] = 39.2902778; + pls.poin( x, y, 18 ); + pls.ssym( 0.0, 1.0 ); + pls.ptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); + // For Java, this is how the global transform is cleared + pls.stransform( nullCTCallback, null ); + pls.end(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-05-25 09:26:46
|
Revision: 11022 http://plplot.svn.sourceforge.net/plplot/?rev=11022&view=rev Author: andrewross Date: 2010-05-25 09:26:36 +0000 (Tue, 25 May 2010) Log Message: ----------- Add support for plstransform to d bindings. Update d versions of example 6, 7 and 19 consistent with C versions. Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/x06d.d trunk/examples/d/x07d.d trunk/examples/d/x19d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2010-05-25 09:25:49 UTC (rev 11021) +++ trunk/bindings/d/plplot.d 2010-05-25 09:26:36 UTC (rev 11022) @@ -1376,6 +1376,7 @@ alias c_plssym plssym; alias c_plstar plstar; //alias c_plstart plstart; +alias c_plstransform plstransform; alias c_plstripa plstripa; //alias c_plstripc plstripc; alias c_plstripd plstripd; @@ -1952,6 +1953,9 @@ /* Initialize PLplot, passing the device name and windows/page settings. */ void c_plstart( char *devname, PLINT nx, PLINT ny ); +/* Set the coordinate transform */ +void c_plstransform( void ( *coordinate_transform )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ), PLPointer coordinate_transform_data ); + /* Add a point to a stripchart. */ void c_plstripa( PLINT id, PLINT pen, PLFLT x, PLFLT y ); Modified: trunk/examples/d/x06d.d =================================================================== --- trunk/examples/d/x06d.d 2010-05-25 09:25:49 UTC (rev 11021) +++ trunk/examples/d/x06d.d 2010-05-25 09:26:36 UTC (rev 11022) @@ -13,46 +13,65 @@ \*--------------------------------------------------------------------------*/ int main( char[][] args ) { + int maxfont; + /* Parse and process command line arguments */ plparseopts( args, PL_PARSE_FULL ); /* Initialize plplot */ plinit(); - pladv( 0 ); + for ( int kind_font = 0; kind_font < 2; kind_font++ ) + { + plfontld( kind_font ); + if ( kind_font == 0 ) + maxfont = 1; + else + maxfont = 4; - /* Set up viewport and window */ - plcol0( 2 ); - plvpor( 0.1, 1.0, 0.1, 0.9 ); - plwind( 0.0, 1.0, 0.0, 1.3 ); + for ( int font = 0; font < maxfont; font++ ) + { + plfont( font + 1 ); - /* Draw the grid using plbox */ - plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 ); + pladv( 0 ); - /* Write the digits below the frame */ - plcol0( 15 ); - PLFLT[1] x, y; - for ( size_t i = 0; i <= 9; i++ ) - plmtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, format( "%d", i ) ); + /* Set up viewport and window */ + plcol0( 2 ); + plvpor( 0.1, 1.0, 0.1, 0.9 ); + plwind( 0.0, 1.0, 0.0, 1.3 ); + + /* Draw the grid using plbox */ + plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 ); + + /* Write the digits below the frame */ + plcol0( 15 ); + PLFLT[1] x, y; + for ( size_t i = 0; i <= 9; i++ ) + plmtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, format( "%d", i ) ); - size_t k = 0; - for ( size_t i = 0; i <= 12; i++ ) - { - /* Write the digits to the left of the frame */ - plmtex( "lv", 1.0, ( 1.0 - ( 2 * i + 1 ) / 26.0 ), 1.0, format( "%d", 10 * i ) ); - for ( size_t j = 0; j <= 9; j++ ) - { - x[0] = 0.1 * j + 0.05; - y[0] = 1.25 - 0.1 * i; + size_t k = 0; + for ( size_t i = 0; i <= 12; i++ ) + { + /* Write the digits to the left of the frame */ + plmtex( "lv", 1.0, ( 1.0 - ( 2 * i + 1 ) / 26.0 ), 1.0, format( "%d", 10 * i ) ); + for ( size_t j = 0; j <= 9; j++ ) + { + x[0] = 0.1 * j + 0.05; + y[0] = 1.25 - 0.1 * i; - /* Display the symbols (plpoin expects that x and y are arrays so */ - /* pass pointers) */ - if ( k < 128 ) - plpoin( x, y, k ); - k = k + 1; - } + /* Display the symbols (plpoin expects that x and y */ + /* are arrays so pass pointers) */ + if ( k < 128 ) + plpoin( x, y, k ); + k = k + 1; + } + } + + if ( kind_font == 0 ) + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)" ); + else + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)" ); + } } - - plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols" ); plend(); return 0; } Modified: trunk/examples/d/x07d.d =================================================================== --- trunk/examples/d/x07d.d 2010-05-25 09:25:49 UTC (rev 11021) +++ trunk/examples/d/x07d.d 2010-05-25 09:26:36 UTC (rev 11022) @@ -6,7 +6,7 @@ import plplot; import std.string; -int[17] base = [ 0, 200, 500, 600, 700, 800, 900, +int[20] base = [ 0, 100, 0, 100, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900]; @@ -26,9 +26,10 @@ /* Initialize plplot */ plinit(); - plfontld( 1 ); - for ( size_t l = 0; l < 17; l++ ) + plfontld( 0 ); + for ( size_t l = 0; l < 20; l++ ) { + if ( l == 2 ) plfontld( 1 ); pladv( 0 ); /* Set up viewport and window */ @@ -64,7 +65,10 @@ } } - plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols" ); + if ( l < 2 ) + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)" ); + else + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)" ); } plend(); return 0; Modified: trunk/examples/d/x19d.d =================================================================== --- trunk/examples/d/x19d.d 2010-05-25 09:25:49 UTC (rev 11021) +++ trunk/examples/d/x19d.d 2010-05-25 09:26:36 UTC (rev 11022) @@ -11,6 +11,17 @@ import plplot; extern ( C ) { + +void +map_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) +{ + double radius; + + radius = 90.0 - y; + *xt = radius * cos( x * PI / 180.0 ); + *yt = radius * sin( x * PI / 180.0 ); +} + /*--------------------------------------------------------------------------*\ * mapform19 * @@ -135,6 +146,35 @@ pllsty( 2 ); plmeridians( &mapform19, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); + /* Polar, Northern hemisphere, this time with a PLplot-wide transform */ + + minx = 0; + maxx = 360; + + plstransform( &map_transform, null ); + + pllsty( 1 ); + plenv( -75., 75., -75., 75., 1, -1 ); + /* No need to set the map transform here as the global transform will be + * used. */ + plmap( null, "globe", minx, maxx, miny, maxy ); + + pllsty( 2 ); + plmeridians( null, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); + + /* Show Baltimore, MD on the map */ + plcol0( 2 ); + plssym( 0.0, 2.0 ); + PLFLT x[1] = -76.6125; + PLFLT y[1] = 39.2902778; + plpoin( x, y, 18 ); + plssym( 0.0, 1.0 ); + plptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); + + /* For C, this is how the global transform is cleared */ + plstransform( null, null ); + + plend(); return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2010-05-31 00:47:02
|
Revision: 11041 http://plplot.svn.sourceforge.net/plplot/?rev=11041&view=rev Author: hbabcock Date: 2010-05-31 00:46:56 +0000 (Mon, 31 May 2010) Log Message: ----------- Change xwin driver to not call plexit() when the window is closed by clicking on the close box. Instead all subsequent plotting commands sent to the stream are ignored. Modified Paths: -------------- trunk/drivers/xwin.c trunk/include/plxwd.h Modified: trunk/drivers/xwin.c =================================================================== --- trunk/drivers/xwin.c 2010-05-31 00:04:33 UTC (rev 11040) +++ trunk/drivers/xwin.c 2010-05-31 00:46:56 UTC (rev 11041) @@ -284,6 +284,7 @@ /* Get ready for plotting */ + dev->closed = FALSE; dev->xlen = xmax - xmin; dev->ylen = ymax - ymin; @@ -363,6 +364,9 @@ dbug_enter( "plD_line_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -428,6 +432,9 @@ dbug_enter( "plD_polyline_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -469,6 +476,9 @@ dbug_enter( "plD_eop_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -501,6 +511,9 @@ dbug_enter( "plD_bop_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -591,6 +604,9 @@ dbug_enter( "plD_state_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -703,8 +719,13 @@ void plD_esc_xw( PLStream *pls, PLINT op, void *ptr ) { + XwDev *dev = (XwDev *) pls->dev; + dbug_enter( "plD_esc_xw" ); + if ( dev->closed ) + return; + #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -1484,8 +1505,9 @@ if ( event->xclient.data.l[0] == XInternAtom( xwd->display, "WM_DELETE_WINDOW", False ) ) { - pls->nopause = TRUE; - plexit( "" ); + dev->exit_eventloop = TRUE; + dev->closed = TRUE; + return; } } Modified: trunk/include/plxwd.h =================================================================== --- trunk/include/plxwd.h 2010-05-31 00:04:33 UTC (rev 11040) +++ trunk/include/plxwd.h 2010-05-31 00:46:56 UTC (rev 11041) @@ -103,6 +103,8 @@ int drawing_xhairs; /* Set during xhair draws */ XPoint xhair_x[2], xhair_y[2]; /* Crosshair lines */ + int closed; /* Set if the stream is closed */ + void ( *MasterEH )( PLStream *, XEvent * ); /* Master X event handler */ #ifdef HAVE_PTHREAD pthread_t updater; /* The X events updater thread id */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-05-31 19:49:14
|
Revision: 11046 http://plplot.svn.sourceforge.net/plplot/?rev=11046&view=rev Author: airwin Date: 2010-05-31 19:49:08 +0000 (Mon, 31 May 2010) Log Message: ----------- Temporarily revert Hazen's recent improvement to xwin so that -dev tk will work again. The issue here is that -dev tk uses code from xwin.c so that additional changes have to be made to -dev tk to be consistent with Hazen's changes to -dev xwin. Modified Paths: -------------- trunk/drivers/xwin.c trunk/include/plxwd.h Modified: trunk/drivers/xwin.c =================================================================== --- trunk/drivers/xwin.c 2010-05-31 19:46:51 UTC (rev 11045) +++ trunk/drivers/xwin.c 2010-05-31 19:49:08 UTC (rev 11046) @@ -284,7 +284,6 @@ /* Get ready for plotting */ - dev->closed = FALSE; dev->xlen = xmax - xmin; dev->ylen = ymax - ymin; @@ -364,9 +363,6 @@ dbug_enter( "plD_line_xw" ); - if ( dev->closed ) - return; - #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -432,9 +428,6 @@ dbug_enter( "plD_polyline_xw" ); - if ( dev->closed ) - return; - #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -476,9 +469,6 @@ dbug_enter( "plD_eop_xw" ); - if ( dev->closed ) - return; - #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -511,9 +501,6 @@ dbug_enter( "plD_bop_xw" ); - if ( dev->closed ) - return; - #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -604,9 +591,6 @@ dbug_enter( "plD_state_xw" ); - if ( dev->closed ) - return; - #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -719,13 +703,8 @@ void plD_esc_xw( PLStream *pls, PLINT op, void *ptr ) { - XwDev *dev = (XwDev *) pls->dev; - dbug_enter( "plD_esc_xw" ); - if ( dev->closed ) - return; - #ifdef HAVE_PTHREAD if ( usepthreads ) pthread_mutex_lock( &events_mutex ); @@ -1505,9 +1484,8 @@ if ( event->xclient.data.l[0] == XInternAtom( xwd->display, "WM_DELETE_WINDOW", False ) ) { - dev->exit_eventloop = TRUE; - dev->closed = TRUE; - return; + pls->nopause = TRUE; + plexit( "" ); } } Modified: trunk/include/plxwd.h =================================================================== --- trunk/include/plxwd.h 2010-05-31 19:46:51 UTC (rev 11045) +++ trunk/include/plxwd.h 2010-05-31 19:49:08 UTC (rev 11046) @@ -103,8 +103,6 @@ int drawing_xhairs; /* Set during xhair draws */ XPoint xhair_x[2], xhair_y[2]; /* Crosshair lines */ - int closed; /* Set if the stream is closed */ - void ( *MasterEH )( PLStream *, XEvent * ); /* Master X event handler */ #ifdef HAVE_PTHREAD pthread_t updater; /* The X events updater thread id */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-06-01 08:49:42
|
Revision: 11047 http://plplot.svn.sourceforge.net/plplot/?rev=11047&view=rev Author: andrewross Date: 2010-06-01 08:49:36 +0000 (Tue, 01 Jun 2010) Log Message: ----------- Add internal plCloseFile function, in analog to plOpenFile - this will close the output file unless the output is to stdout. Update drivers to i use this new function. Modified Paths: -------------- trunk/drivers/cairo.c trunk/drivers/cgm.c trunk/drivers/gd.c trunk/drivers/hpgl.c trunk/drivers/impress.c trunk/drivers/ljii.c trunk/drivers/ljiip.c trunk/drivers/pbm.c trunk/drivers/pdf.c trunk/drivers/ps.c trunk/drivers/pstex.c trunk/drivers/psttf.cc trunk/drivers/qt.cpp trunk/drivers/svg.c trunk/drivers/tek.c trunk/drivers/tk.c trunk/drivers/xfig.c trunk/include/plstrm.h trunk/src/plctrl.c Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/cairo.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -536,8 +536,7 @@ cairo_destroy( aStream->cairoContext ); cairo_surface_destroy( aStream->cairoSurface ); - if ( pls->OutFile ) - fclose( pls->OutFile ); + plCloseFile( pls ); } /*--------------------------------------------------------------------- Modified: trunk/drivers/cgm.c =================================================================== --- trunk/drivers/cgm.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/cgm.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -727,7 +727,7 @@ } cdImageDestroy( dev->im_out ); - fclose( pls->OutFile ); + plCloseFile( pls ); free_mem( pls->dev ); } Modified: trunk/drivers/gd.c =================================================================== --- trunk/drivers/gd.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/gd.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -1149,7 +1149,7 @@ } #endif - fclose( pls->OutFile ); + plCloseFile( pls ); free_mem( pls->dev ); } Modified: trunk/drivers/hpgl.c =================================================================== --- trunk/drivers/hpgl.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/hpgl.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -333,7 +333,7 @@ plD_tidy_hpgl( PLStream *pls ) { fputs( "SP0\n", OF ); - fclose( OF ); + plCloseFile( pls ); } /*--------------------------------------------------------------------------*\ Modified: trunk/drivers/impress.c =================================================================== --- trunk/drivers/impress.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/impress.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -244,7 +244,7 @@ plD_tidy_imp( PLStream *pls ) { free( (void *) LineBuff ); - fclose( pls->OutFile ); + plCloseFile( pls ); } /*--------------------------------------------------------------------------*\ Modified: trunk/drivers/ljii.c =================================================================== --- trunk/drivers/ljii.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/ljii.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -284,7 +284,7 @@ /* Reset Printer */ fprintf( OF, "%cE", ESC ); - fclose( OF ); + plCloseFile( pls ); free( (void *) bitmap ); } Modified: trunk/drivers/ljiip.c =================================================================== --- trunk/drivers/ljiip.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/ljiip.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -470,7 +470,7 @@ /* Reset Printer */ fprintf( OF, "%cE", ESC ); - fclose( OF ); + plCloseFile( pls ); free( (char *) bitmap ); } Modified: trunk/drivers/pbm.c =================================================================== --- trunk/drivers/pbm.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/pbm.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -263,7 +263,7 @@ if ( nwrite != im_size ) plabort( "pbm driver: Error writing pbm file" ); - fclose( fp ); + plCloseFile( pls ); } free( cmap ); cmap = 0; Modified: trunk/drivers/pdf.c =================================================================== --- trunk/drivers/pdf.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/pdf.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -399,7 +399,7 @@ plexit( "ERROR: Cannot write to file!" ); } - fclose( dev->pdfFile ); + plCloseFile( pls ); /* cleanup */ HPDF_Free( dev->pdf ); Modified: trunk/drivers/ps.c =================================================================== --- trunk/drivers/ps.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/ps.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -566,7 +566,7 @@ fprintf( OF, "%%!PS-Adobe-2.0 EPSF-2.0\n" ); fprintf( OF, "%%%%BoundingBox: %d %d %d %d\n", dev->llx, dev->lly, dev->urx, dev->ury ); - fclose( OF ); + plCloseFile( pls ); } /*--------------------------------------------------------------------------*\ Modified: trunk/drivers/pstex.c =================================================================== --- trunk/drivers/pstex.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/pstex.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -132,7 +132,7 @@ ROUND( ( dev->llx - XOFFSET ) * scale ), ROUND( ( dev->lly - YOFFSET ) * scale ) ); - fclose( fp ); + plCloseFile( pls ); } void Modified: trunk/drivers/psttf.cc =================================================================== --- trunk/drivers/psttf.cc 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/psttf.cc 2010-06-01 08:49:36 UTC (rev 11047) @@ -626,7 +626,7 @@ doc->write(cout,dev->llx,dev->lly,dev->urx,dev->ury); } else { - fclose(pls->OutFile); + plCloseFile( pls ); ofstream out; out.open(pls->FileName); doc->write(out,dev->llx,dev->lly,dev->urx,dev->ury); Modified: trunk/drivers/qt.cpp =================================================================== --- trunk/drivers/qt.cpp 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/qt.cpp 2010-06-01 08:49:36 UTC (rev 11047) @@ -452,7 +452,7 @@ delete widget; pls->dev = NULL; } - fclose( pls->OutFile ); + plCloseFile( pls ); closeQtApp(); } @@ -882,7 +882,7 @@ delete widget; pls->dev = NULL; } - fclose( pls->OutFile ); + plCloseFile( pls ); closeQtApp(); } @@ -1163,7 +1163,7 @@ delete widget; pls->dev = NULL; } - fclose( pls->OutFile ); + plCloseFile( pls ); closeQtApp(); } Modified: trunk/drivers/svg.c =================================================================== --- trunk/drivers/svg.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/svg.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -361,7 +361,7 @@ { return; } - fclose( aStream->svgFile ); + plCloseFile( pls ); } /*--------------------------------------------------------------------- Modified: trunk/drivers/tek.c =================================================================== --- trunk/drivers/tek.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/tek.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -583,7 +583,7 @@ { if ( !pls->termin ) { - fclose( pls->OutFile ); + plCloseFile( pls ); } else { Modified: trunk/drivers/tk.c =================================================================== --- trunk/drivers/tk.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/tk.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -885,7 +885,7 @@ if ( dev->iodev != NULL ) { if ( dev->iodev->file != NULL ) - fclose( dev->iodev->file ); + plCloseFile( pls ); free( (void *) dev->iodev ); } Modified: trunk/drivers/xfig.c =================================================================== --- trunk/drivers/xfig.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/drivers/xfig.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -371,7 +371,7 @@ flushbuffer( pls ); free( (void *) dev->buffptr ); - fclose( pls->OutFile ); + plCloseFile( pls ); } /*--------------------------------------------------------------------------*\ Modified: trunk/include/plstrm.h =================================================================== --- trunk/include/plstrm.h 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/include/plstrm.h 2010-06-01 08:49:36 UTC (rev 11047) @@ -789,6 +789,11 @@ PLDLLIMPEXP void plOpenFile( PLStream *pls ); +/* Close output file */ + +PLDLLIMPEXP void +plCloseFile( PLStream *pls ); + /* Sets up next file member name (in pls->FileName), but does not open it. */ void Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2010-05-31 19:49:08 UTC (rev 11046) +++ trunk/src/plctrl.c 2010-06-01 08:49:36 UTC (rev 11047) @@ -2294,6 +2294,25 @@ } /*--------------------------------------------------------------------------*\ + * plCloseFile() + * + * Closes output file unless it is associated with stdout. + \*--------------------------------------------------------------------------*/ + +void +plCloseFile( PLStream *pls ) +{ + if ( pls->OutFile != NULL) + { + /* Don't close if the output file was stdout */ + if ( pls->FileName && strcmp( pls->FileName, "-" ) == 0 ) return; + + fclose( pls->OutFile ); + pls->OutFile = NULL; + } +} + +/*--------------------------------------------------------------------------*\ * plP_getmember() * * Sets up next file member name (in pls->FileName), but does not open it. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-06-01 15:41:39
|
Revision: 11049 http://plplot.svn.sourceforge.net/plplot/?rev=11049&view=rev Author: airwin Date: 2010-06-01 15:41:33 +0000 (Tue, 01 Jun 2010) Log Message: ----------- Style recent changes. Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/drivers/cairo.c trunk/examples/d/x06d.d trunk/examples/d/x07d.d trunk/examples/d/x19d.d trunk/src/plctrl.c Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2010-06-01 09:03:53 UTC (rev 11048) +++ trunk/bindings/d/plplot.d 2010-06-01 15:41:33 UTC (rev 11049) @@ -1370,16 +1370,16 @@ alias c_plspage plspage; // alias c_plspal0 plspal0; // alias c_plspal1 plspal1; -alias c_plspause plspause; -alias c_plsstrm plsstrm; -alias c_plssub plssub; -alias c_plssym plssym; -alias c_plstar plstar; +alias c_plspause plspause; +alias c_plsstrm plsstrm; +alias c_plssub plssub; +alias c_plssym plssym; +alias c_plstar plstar; //alias c_plstart plstart; alias c_plstransform plstransform; -alias c_plstripa plstripa; +alias c_plstripa plstripa; //alias c_plstripc plstripc; -alias c_plstripd plstripd; +alias c_plstripd plstripd; //alias c_plstyl plstyl; //alias c_plsurf3d plsurf3d; //alias c_plsurf3dl plsurf3dl; Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-06-01 09:03:53 UTC (rev 11048) +++ trunk/drivers/cairo.c 2010-06-01 15:41:33 UTC (rev 11049) @@ -1824,9 +1824,9 @@ aStream->exit_event_loop = 1; break; case ClientMessage: - // plexit("X Window closed"); - aStream->closed = 1; - aStream->exit_event_loop = 1; + // plexit("X Window closed"); + aStream->closed = 1; + aStream->exit_event_loop = 1; break; case Expose: /* Blit the image again after an expose event, but only for the last Modified: trunk/examples/d/x06d.d =================================================================== --- trunk/examples/d/x06d.d 2010-06-01 09:03:53 UTC (rev 11048) +++ trunk/examples/d/x06d.d 2010-06-01 15:41:33 UTC (rev 11049) @@ -24,53 +24,53 @@ { plfontld( kind_font ); if ( kind_font == 0 ) - maxfont = 1; + maxfont = 1; else maxfont = 4; for ( int font = 0; font < maxfont; font++ ) { - plfont( font + 1 ); + plfont( font + 1 ); - pladv( 0 ); + pladv( 0 ); - /* Set up viewport and window */ - plcol0( 2 ); - plvpor( 0.1, 1.0, 0.1, 0.9 ); - plwind( 0.0, 1.0, 0.0, 1.3 ); - - /* Draw the grid using plbox */ - plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 ); - - /* Write the digits below the frame */ - plcol0( 15 ); - PLFLT[1] x, y; - for ( size_t i = 0; i <= 9; i++ ) - plmtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, format( "%d", i ) ); + /* Set up viewport and window */ + plcol0( 2 ); + plvpor( 0.1, 1.0, 0.1, 0.9 ); + plwind( 0.0, 1.0, 0.0, 1.3 ); - size_t k = 0; - for ( size_t i = 0; i <= 12; i++ ) - { - /* Write the digits to the left of the frame */ - plmtex( "lv", 1.0, ( 1.0 - ( 2 * i + 1 ) / 26.0 ), 1.0, format( "%d", 10 * i ) ); - for ( size_t j = 0; j <= 9; j++ ) - { - x[0] = 0.1 * j + 0.05; - y[0] = 1.25 - 0.1 * i; + /* Draw the grid using plbox */ + plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 ); - /* Display the symbols (plpoin expects that x and y */ - /* are arrays so pass pointers) */ - if ( k < 128 ) - plpoin( x, y, k ); - k = k + 1; - } - } - - if ( kind_font == 0 ) - plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)" ); - else - plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)" ); - } + /* Write the digits below the frame */ + plcol0( 15 ); + PLFLT[1] x, y; + for ( size_t i = 0; i <= 9; i++ ) + plmtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, format( "%d", i ) ); + + size_t k = 0; + for ( size_t i = 0; i <= 12; i++ ) + { + /* Write the digits to the left of the frame */ + plmtex( "lv", 1.0, ( 1.0 - ( 2 * i + 1 ) / 26.0 ), 1.0, format( "%d", 10 * i ) ); + for ( size_t j = 0; j <= 9; j++ ) + { + x[0] = 0.1 * j + 0.05; + y[0] = 1.25 - 0.1 * i; + + /* Display the symbols (plpoin expects that x and y */ + /* are arrays so pass pointers) */ + if ( k < 128 ) + plpoin( x, y, k ); + k = k + 1; + } + } + + if ( kind_font == 0 ) + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)" ); + else + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)" ); + } } plend(); return 0; Modified: trunk/examples/d/x07d.d =================================================================== --- trunk/examples/d/x07d.d 2010-06-01 09:03:53 UTC (rev 11048) +++ trunk/examples/d/x07d.d 2010-06-01 15:41:33 UTC (rev 11049) @@ -29,7 +29,7 @@ plfontld( 0 ); for ( size_t l = 0; l < 20; l++ ) { - if ( l == 2 ) plfontld( 1 ); + if ( l == 2 ) plfontld( 1 ); pladv( 0 ); /* Set up viewport and window */ @@ -65,10 +65,10 @@ } } - if ( l < 2 ) - plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)" ); - else - plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)" ); + if ( l < 2 ) + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)" ); + else + plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)" ); } plend(); return 0; Modified: trunk/examples/d/x19d.d =================================================================== --- trunk/examples/d/x19d.d 2010-06-01 09:03:53 UTC (rev 11048) +++ trunk/examples/d/x19d.d 2010-06-01 15:41:33 UTC (rev 11049) @@ -11,7 +11,6 @@ import plplot; extern ( C ) { - void map_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) { Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2010-06-01 09:03:53 UTC (rev 11048) +++ trunk/src/plctrl.c 2010-06-01 15:41:33 UTC (rev 11049) @@ -2302,7 +2302,7 @@ void plCloseFile( PLStream *pls ) { - if ( pls->OutFile != NULL) + if ( pls->OutFile != NULL ) { /* Don't close if the output file was stdout */ if ( pls->FileName && strcmp( pls->FileName, "-" ) == 0 ) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-06-03 23:52:20
|
Revision: 11051 http://plplot.svn.sourceforge.net/plplot/?rev=11051&view=rev Author: jbauck Date: 2010-06-03 23:52:13 +0000 (Thu, 03 Jun 2010) Log Message: ----------- Update Ada bindings and examples 19 for custom coordinate transforms. Modified Paths: -------------- trunk/bindings/ada/plplot.adb.cmake trunk/bindings/ada/plplot.ads.cmake trunk/bindings/ada/plplot_thin.ads.cmake trunk/bindings/ada/plplot_traditional.adb.cmake trunk/bindings/ada/plplot_traditional.ads.cmake trunk/examples/ada/x19a.adb.cmake trunk/examples/ada/xthick19a.adb.cmake Modified: trunk/bindings/ada/plplot.adb.cmake =================================================================== --- trunk/bindings/ada/plplot.adb.cmake 2010-06-02 02:52:32 UTC (rev 11050) +++ trunk/bindings/ada/plplot.adb.cmake 2010-06-03 23:52:13 UTC (rev 11051) @@ -2842,6 +2842,24 @@ end Initialize_Set_Device; + -- Set the coordinate transform. + -- plstransform + procedure Set_Custom_Coordinate_Transform + (Coordinate_Transform_Procedure_Pointer : Coordinate_Transform_Procedure_Pointer_Type; + Coordinate_Transform_Data_Pointer : PLpointer) is + begin + plstransform(Coordinate_Transform_Procedure_Pointer, + Coordinate_Transform_Data_Pointer); + end Set_Custom_Coordinate_Transform; + + + -- Clear the coordinate transform. Ada only; not part of PLplot API. + procedure Clear_Custom_Coordinate_Transform is + begin + Set_Custom_Coordinate_Transform(null, System.Null_Address); + end Clear_Custom_Coordinate_Transform; + + -- Add a point to a stripchart. -- plstripa procedure Update_Stripchart Modified: trunk/bindings/ada/plplot.ads.cmake =================================================================== --- trunk/bindings/ada/plplot.ads.cmake 2010-06-02 02:52:32 UTC (rev 11050) +++ trunk/bindings/ada/plplot.ads.cmake 2010-06-03 23:52:13 UTC (rev 11051) @@ -94,6 +94,10 @@ -- "Rename" callback for custom label functions. subtype Custom_Label_Procedure_Pointer_Type is PLplot_Thin.Custom_Label_Procedure_Pointer_Type; + + -- "Rename" callback for custom coordinate transform procedure. + subtype Coordinate_Transform_Procedure_Pointer_Type is + PLplot_Thin.Coordinate_Transform_Procedure_Pointer_Type; -------------------------------------------------------------------------------- -- Types and constants for thick binding -- @@ -1721,7 +1725,18 @@ (Device_Name : String; Number_Horizontal_Subpages, Number_Vertical_Subpages : Integer := 1); + + -- Set the coordinate transform. + -- plstransform + procedure Set_Custom_Coordinate_Transform + (Coordinate_Transform_Procedure_Pointer : Coordinate_Transform_Procedure_Pointer_Type; + Coordinate_Transform_Data_Pointer : PLpointer); + + + -- Clear the coordinate transform. Ada only; not part of the C API. + procedure Clear_Custom_Coordinate_Transform; + -- Add a point to a stripchart. -- plstripa procedure Update_Stripchart Modified: trunk/bindings/ada/plplot_thin.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_thin.ads.cmake 2010-06-02 02:52:32 UTC (rev 11050) +++ trunk/bindings/ada/plplot_thin.ads.cmake 2010-06-03 23:52:13 UTC (rev 11051) @@ -154,8 +154,7 @@ type Map_Form_Function_Pointer_Type is access procedure (Length_Of_x : Integer; x, y : in out Map_Form_Constrained_Array); pragma Convention(Convention => C, Entity => Map_Form_Function_Pointer_Type); - - + -- Access-to-function type for making contour plots from irregularly -- spaced data which is stored in a 2D array accessed by a single pointer. -- Examples of such functions are in plplot.h and are called plf2eval, @@ -182,7 +181,15 @@ data : PLPointer); pragma Convention(Convention => C, Entity => Custom_Label_Procedure_Pointer_Type); + -- Access-to-procedure type for setting a global custom coordinate tranformation. + type Coordinate_Transform_Procedure_Pointer_Type is access + procedure + (x_In, y_In : Long_Float; + x_Transformed, y_Transformed : out Long_Float; + data : PLpointer); + pragma Convention(Convention => C, Entity => Coordinate_Transform_Procedure_Pointer_Type); + -------------------------------------------------------------------------------- -- Argument parsing things -- -------------------------------------------------------------------------------- @@ -1556,6 +1563,14 @@ pragma Import(C, plstart, "c_plstart"); + --Set the coordinate transform + + procedure + plstransform(coordinate_transform : Coordinate_Transform_Procedure_Pointer_Type; + coordinate_transform_data : PLpointer); + pragma Import (C, plstransform, "c_plstransform"); + + -- Add a point to a stripchart. procedure Modified: trunk/bindings/ada/plplot_traditional.adb.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.adb.cmake 2010-06-02 02:52:32 UTC (rev 11050) +++ trunk/bindings/ada/plplot_traditional.adb.cmake 2010-06-03 23:52:13 UTC (rev 11051) @@ -1235,7 +1235,7 @@ -- Draws a contour plot from data in f(nx,ny). Is just a front-end to -- plfcont, with a particular choice for f2eval and f2eval_data. - -- plcont (universal version using System.Address to the transformation data) + -- (Universal version using System.Address to the transformation data) procedure plcont (z : Real_Matrix; x_Min_Index, x_Max_Index : Integer; @@ -2703,6 +2703,23 @@ end plstart; + -- Set the coordinate transform. + procedure plstransform + (Coordinate_Transform_Procedure_Pointer : Coordinate_Transform_Procedure_Pointer_Type; + Coordinate_Transform_Data_Pointer : PLpointer) is + begin + PLplot_Thin.plstransform(Coordinate_Transform_Procedure_Pointer, + Coordinate_Transform_Data_Pointer); + end plstransform; + + + -- Clear the coordinate transform. Ada only; not part of the C API. + procedure Clear_Custom_Coordinate_Transform is + begin + PLplot_Thin.plstransform(null, System.Null_Address); + end Clear_Custom_Coordinate_Transform; + + -- Add a point to a stripchart. procedure plstripa (ID : Integer; Modified: trunk/bindings/ada/plplot_traditional.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.ads.cmake 2010-06-02 02:52:32 UTC (rev 11050) +++ trunk/bindings/ada/plplot_traditional.ads.cmake 2010-06-03 23:52:13 UTC (rev 11051) @@ -94,6 +94,10 @@ -- "Rename" callback for custom label functions. subtype Custom_Label_Procedure_Pointer_Type is PLplot_Thin.Custom_Label_Procedure_Pointer_Type; + + -- "Rename" callback for custom coordinate transform procedure. + subtype Coordinate_Transform_Procedure_Pointer_Type is + PLplot_Thin.Coordinate_Transform_Procedure_Pointer_Type; -------------------------------------------------------------------------------- -- Types and constants for thick binding -- @@ -753,7 +757,6 @@ -- Draws a contour plot from data in f(nx,ny). Is just a front-end to plfcont, -- with a particular choice for f2eval and f2eval_data. - -- plcont procedure plcont (z : Real_Matrix; x_Min_Index, x_Max_Index : Integer; @@ -1518,7 +1521,7 @@ label_data : PLPointer); - -- Reset to default labeling. Not part of the C API. + -- Reset to default labeling. Ada only; not part of the C API. procedure Use_Default_Labels; @@ -1580,6 +1583,16 @@ procedure plstart (Device_Name : String; Number_Horizontal_Subpages, Number_Vertical_Subpages : Integer := 1); + + + -- Set the coordinate transform. + procedure plstransform + (Coordinate_Transform_Procedure_Pointer : Coordinate_Transform_Procedure_Pointer_Type; + Coordinate_Transform_Data_Pointer : PLpointer); + + + -- Clear the coordinate transform. Ada only; not part of the C API. + procedure Clear_Custom_Coordinate_Transform; -- Add a point to a stripchart. Modified: trunk/examples/ada/x19a.adb.cmake =================================================================== --- trunk/examples/ada/x19a.adb.cmake 2010-06-02 02:52:32 UTC (rev 11050) +++ trunk/examples/ada/x19a.adb.cmake 2010-06-03 23:52:13 UTC (rev 11051) @@ -3,7 +3,7 @@ -- Illustrates backdrop plotting of world, US maps. -- Contributed by Wesley Ebisuzaki. --- Copyright (C) 2008 Jerry Bauck +-- Copyright (C) 2008, 2010 Jerry Bauck -- This file is part of PLplot. @@ -47,9 +47,31 @@ -- Shows two views of the world map. procedure x19a is minx, maxx, miny, maxy : Long_Float; + x, y : Real_Vector(1 .. 1); -- This spec is necessary in order to enforce C calling conventions, used -- in the callback by intervening C code. + procedure map_transform + (x, y : Long_Float; + xt, yt : out Long_Float; + data : PLPointer); + pragma Convention(C, map_transform); + + procedure map_transform + (x, y : Long_Float; + xt, yt : out Long_Float; + data : PLPointer) + is + radius : Long_Float; + begin + radius := 90.0 - y; + xt := radius * cos(x * pi / 180.0); + yt := radius * sin(x * pi / 180.0); + end map_transform; + + + -- This spec is necessary in order to enforce C calling conventions, used + -- in the callback by intervening C code. procedure mapform19(n : Integer; x, y : in out Map_Form_Constrained_Array); pragma Convention(C, mapform19); @@ -65,15 +87,13 @@ -- argument list, and then pass a pointer to _that_ when calling plmap and -- plmeridian. procedure mapform19(n : Integer; x, y : in out Map_Form_Constrained_Array) is - xp, yp, radius : Long_Float; + xp, yp : Long_Float; begin -- DO NOT use x'range for this loop because the C function which calls -- this function WILL NOT SEE IT AND YOU WILL GET A SEGFAULT. Simply -- use 0 .. n - 1 explicitly. for i in 0 .. n - 1 loop - radius := 90.0 - y(i); - xp := radius * cos(x(i) * pi / 180.0); - yp := radius * sin(x(i) * pi / 180.0); + map_transform(x(i), y(i), xp, yp, System.Null_Address); x(i) := xp; y(i) := yp; end loop; @@ -219,5 +239,35 @@ pllsty(2); plmeridians(mapform19'Unrestricted_Access, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0); + + -- Polar, Northern hemisphere, this time with a PLplot-wide transform + minx := 0.0; + maxx := 360.0; + + plstransform(map_transform'Unrestricted_Access, System.Null_Address); + + pllsty(1); + plenv(-75.0, 75.0, -75.0, 75.0, 1, -1); + + -- No need to set the map transform here as the global transform will be used. + plmap(null, Continents, minx, maxx, miny, maxy); + + pllsty(2); + plmeridians(null, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0); + + -- Show Baltimore, MD on the map. + plcol0(2); + plssym(0.0, 2.0); + x(1) := -76.6125; + y(1) := 39.2902778; + plpoin(x, y, 18); + plssym(0.0, 1.0); + plptex(-76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD"); + + -- Clear the global transform. + Clear_Custom_Coordinate_Transform; + -- or... + -- plstransform(null, System.Null_Address); + plend; end x19a; Modified: trunk/examples/ada/xthick19a.adb.cmake =================================================================== --- trunk/examples/ada/xthick19a.adb.cmake 2010-06-02 02:52:32 UTC (rev 11050) +++ trunk/examples/ada/xthick19a.adb.cmake 2010-06-03 23:52:13 UTC (rev 11051) @@ -47,9 +47,31 @@ -- Shows two views of the world map. procedure xthick19a is minx, maxx, miny, maxy : Long_Float; + x, y : Real_Vector(1 .. 1); -- This spec is necessary in order to enforce C calling conventions, used -- in the callback by intervening C code. + procedure map_transform + (x, y : Long_Float; + xt, yt : out Long_Float; + data : PLPointer); + pragma Convention(C, map_transform); + + procedure map_transform + (x, y : Long_Float; + xt, yt : out Long_Float; + data : PLPointer) + is + radius : Long_Float; + begin + radius := 90.0 - y; + xt := radius * cos(x * pi / 180.0); + yt := radius * sin(x * pi / 180.0); + end map_transform; + + + -- This spec is necessary in order to enforce C calling conventions, used + -- in the callback by intervening C code. procedure mapform19(n : Integer; x, y : in out Map_Form_Constrained_Array); pragma Convention(C, mapform19); @@ -65,15 +87,13 @@ -- argument list, and then pass a pointer to _that_ when calling Draw_Map and -- plmeridian. procedure mapform19(n : Integer; x, y : in out Map_Form_Constrained_Array) is - xp, yp, radius : Long_Float; + xp, yp : Long_Float; begin -- DO NOT use x'range for this loop because the C function which calls -- this function WILL NOT SEE IT AND YOU WILL GET A SEGFAULT. Simply -- use 0 .. n - 1 explicitly. for i in 0 .. n - 1 loop - radius := 90.0 - y(i); - xp := radius * cos(x(i) * pi / 180.0); - yp := radius * sin(x(i) * pi / 180.0); + map_transform(x(i), y(i), xp, yp, System.Null_Address); x(i) := xp; y(i) := yp; end loop; @@ -219,5 +239,35 @@ Select_Line_Style(Line_Style => 2); Draw_Latitude_Longitude(mapform19'Unrestricted_Access, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0); + + -- Polar, Northern hemisphere, this time with a PLplot-wide transform + minx := 0.0; + maxx := 360.0; + + Set_Custom_Coordinate_Transform(map_transform'Unrestricted_Access, System.Null_Address); + + Select_Line_Style(1); + Set_Environment(-75.0, 75.0, -75.0, 75.0, Justified, Box); + + -- No need to set the map transform here as the global transform will be used. + Draw_Map(null, Continents, minx, maxx, miny, maxy); + + Select_Line_Style(2); + Draw_Latitude_Longitude(null, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0); + + -- Show Baltimore, MD on the map. + Set_Pen_Color(Yellow); + Set_Symbol_Size(0.0, 2.0); + x(1) := -76.6125; + y(1) := 39.2902778; + Draw_Points(x, y, 18); + Set_Symbol_Size(0.0, 1.0); + Write_Text_World(-76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD"); + + -- Clear the global transform. + Clear_Custom_Coordinate_Transform; + -- or... + -- Set_Custom_Coordinate_Transform(null, System.Null_Address); + End_PLplot; end xthick19a; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-06-05 03:53:45
|
Revision: 11056 http://plplot.svn.sourceforge.net/plplot/?rev=11056&view=rev Author: jbauck Date: 2010-06-05 03:53:38 +0000 (Sat, 05 Jun 2010) Log Message: ----------- Update Ada examples 28 and 29 and the Ada bindings for new time-calculation functionality. Postscript matches C output. Modified Paths: -------------- trunk/bindings/ada/plplot.adb.cmake trunk/bindings/ada/plplot.ads.cmake trunk/bindings/ada/plplot_thin.ads.cmake trunk/bindings/ada/plplot_traditional.adb.cmake trunk/bindings/ada/plplot_traditional.ads.cmake trunk/examples/ada/x28a.adb.cmake trunk/examples/ada/x29a.adb.cmake trunk/examples/ada/xthick28a.adb.cmake trunk/examples/ada/xthick29a.adb.cmake Modified: trunk/bindings/ada/plplot.adb.cmake =================================================================== --- trunk/bindings/ada/plplot.adb.cmake 2010-06-04 20:08:11 UTC (rev 11055) +++ trunk/bindings/ada/plplot.adb.cmake 2010-06-05 03:53:38 UTC (rev 11056) @@ -1160,6 +1160,17 @@ begin plbin(Bin_Values'length, Bin_Values, Bin_Counts, Options); end Histogram_Binned; + + + -- Calculate broken-down time from continuous time for current stream. + -- plbtime + procedure Broken_Down_From_Continuous_Time + (year, month, day, hour, min : out Integer; + sec : out Long_Float; + ctime : Long_Float) is + begin + plbtime(year, month, day, hour, min, sec, ctime); + end Broken_Down_From_Continuous_Time; -- Start new page. Should only be used with pleop(). @@ -1246,6 +1257,28 @@ end Set_Color_Map_1; + -- Configure transformation between continuous and broken-down time (and + -- vice versa) for current stream. + -- plconfigtime + procedure Configure_Time_Transformation + (skale, offset1, offset2 : Long_Float; + ccontrol : Integer; + ifbtime_offset : Boolean; + year, month, day, hour, min : Integer; + sec : Long_Float) is + + ifbtime_offset_As_Integer : Integer; + begin + if ifbtime_offset then + ifbtime_offset_As_Integer := 1; + else + ifbtime_offset_As_Integer := 0; + end if; + plconfigtime(skale, offset1, offset2, ccontrol, + ifbtime_offset_As_Integer, year, month, day, hour, min, sec); + end Configure_Time_Transformation; + + -- Draws a contour plot from data in f(nx,ny). Is just a front-end to -- plfcont, with a particular choice for f2eval and f2eval_data. @@ -1323,6 +1356,17 @@ end Copy_State_Parameters; + -- Calculate continuous time from broken-down time for current stream. + -- plctime + procedure Continuous_From_Broken_Down_Time + (year, month, day, hour, min : Integer; + sec : Long_Float; + ctime : out Long_Float) is + begin + plctime(year, month, day, hour, min, sec, ctime); + end Continuous_From_Broken_Down_Time; + + -- fix this -- Converts input values from relative device coordinates to relative plot -- coordinates. Modified: trunk/bindings/ada/plplot.ads.cmake =================================================================== --- trunk/bindings/ada/plplot.ads.cmake 2010-06-04 20:08:11 UTC (rev 11055) +++ trunk/bindings/ada/plplot.ads.cmake 2010-06-05 03:53:38 UTC (rev 11056) @@ -710,6 +710,14 @@ Options : Integer); -- Options are not defined in plplot.h. + -- Calculate broken-down time from continuous time for current stream. + -- plbtime + procedure Broken_Down_From_Continuous_Time + (year, month, day, hour, min : out Integer; + sec : out Long_Float; + ctime : Long_Float); + + -- Start new page. Should only be used with pleop(). -- plbop procedure Begin_New_Page; @@ -770,6 +778,17 @@ procedure Set_Color_Map_1(Color : Long_Float_0_1_Type); + -- Configure transformation between continuous and broken-down time (and + -- vice versa) for current stream. + -- plconfigtime + procedure Configure_Time_Transformation + (skale, offset1, offset2 : Long_Float; + ccontrol : Integer; + ifbtime_offset : Boolean; + year, month, day, hour, min : Integer; + sec : Long_Float); + + -- Draws a contour plot from data in f(nx,ny). Is just a front-end to plfcont, -- with a particular choice for f2eval and f2eval_data. @@ -813,6 +832,14 @@ Do_Not_Copy_Device_Coordinates : Boolean); + -- Calculate continuous time from broken-down time for current stream. + -- plctime + procedure Continuous_From_Broken_Down_Time + (year, month, day, hour, min : Integer; + sec : Long_Float; + ctime : out Long_Float); + + -- Converts input values from relative device coordinates to relative plot -- coordinates. -- pldid2pc Modified: trunk/bindings/ada/plplot_thin.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_thin.ads.cmake 2010-06-04 20:08:11 UTC (rev 11055) +++ trunk/bindings/ada/plplot_thin.ads.cmake 2010-06-05 03:53:38 UTC (rev 11056) @@ -175,7 +175,7 @@ type Custom_Label_Procedure_Pointer_Type is access procedure (axis : Integer; - a_value : Long_Float; + a_value : PLFLT; label : out Label_String_Type; length : size_t; data : PLPointer); @@ -184,8 +184,8 @@ -- Access-to-procedure type for setting a global custom coordinate tranformation. type Coordinate_Transform_Procedure_Pointer_Type is access procedure - (x_In, y_In : Long_Float; - x_Transformed, y_Transformed : out Long_Float; + (x_In, y_In : PLFLT; + x_Transformed, y_Transformed : out PLFLT; data : PLpointer); pragma Convention(Convention => C, Entity => Coordinate_Transform_Procedure_Pointer_Type); @@ -542,6 +542,13 @@ pragma Import(C, plbin, "c_plbin"); + -- Calculate broken-down time from continuous time for current stream. + procedure + plbtime(year, month, day, hour, min : out PLINT; + sec : out PLFLT; ctime : PLFLT); + pragma Import(C, plbtime, "c_plbtime"); + + -- Start new page. Should only be used with pleop(). procedure @@ -594,6 +601,14 @@ pragma Import(C, plcol1, "c_plcol1"); + -- Configure transformation between continuous and broken-down time (and + -- vice versa) for current stream. + procedure + plconfigtime(skale, offset1, offset2 : PLFLT; ccontrol : PLINT; + ifbtime_offset : PLBOOL; year, month, day, hour, min : PLINT; sec : PLFLT); + pragma Import(C, plconfigtime, "c_plconfigtime"); + + -- Draws a contour plot from data in f(nx,ny). Is just a front-end to -- plfcont, with a particular choice for f2eval and f2eval_data. @@ -624,6 +639,14 @@ pragma Import(C, plcpstrm, "c_plcpstrm"); + -- Calculate continuous time from broken-down time for current stream. + + procedure + plctime(year, month, day, hour, min : PLINT; sec : PLFLT; + ctime : out PLFLT); + pragma Import(C, plctime, "c_plctime"); + + -- Converts input values from relative device coordinates to relative plot -- coordinates. @@ -1181,7 +1204,7 @@ -- Obtain real random number in range [0,1]. function - plrandd return Long_Float; + plrandd return PLFLT; pragma Import(C, plrandd, "c_plrandd"); Modified: trunk/bindings/ada/plplot_traditional.adb.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.adb.cmake 2010-06-04 20:08:11 UTC (rev 11055) +++ trunk/bindings/ada/plplot_traditional.adb.cmake 2010-06-05 03:53:38 UTC (rev 11056) @@ -1153,6 +1153,16 @@ begin PLplot_Thin.plbin(Bin_Values'length, Bin_Values, Bin_Counts, Options); end plbin; + + + -- Calculate broken-down time from continuous time for current stream. + procedure plbtime + (year, month, day, hour, min : out Integer; + sec : out Long_Float; + ctime : Long_Float) is + begin + PLplot_Thin.plbtime(year, month, day, hour, min, sec, ctime); + end plbtime; -- Start new page. Should only be used with pleop(). @@ -1232,6 +1242,27 @@ end plcol1; + -- Configure transformation between continuous and broken-down time (and + -- vice versa) for current stream. + procedure plconfigtime + (skale, offset1, offset2 : Long_Float; + ccontrol : Integer; + ifbtime_offset : Boolean; + year, month, day, hour, min : Integer; + sec : Long_Float) is + + ifbtime_offset_As_Integer : Integer; + begin + if ifbtime_offset then + ifbtime_offset_As_Integer := 1; + else + ifbtime_offset_As_Integer := 0; + end if; + PLplot_Thin.plconfigtime(skale, offset1, offset2, ccontrol, + ifbtime_offset_As_Integer, year, month, day, hour, min, sec); + end plconfigtime; + + -- Draws a contour plot from data in f(nx,ny). Is just a front-end to -- plfcont, with a particular choice for f2eval and f2eval_data. @@ -1307,6 +1338,16 @@ end plcpstrm; + -- Calculate continuous time from broken-down time for current stream. + procedure plctime + (year, month, day, hour, min : Integer; + sec : Long_Float; + ctime : out Long_Float) is + begin + PLplot_Thin.plctime(year, month, day, hour, min, sec, ctime); + end plctime; + + -- fix this -- Converts input values from relative device coordinates to relative plot -- coordinates. Modified: trunk/bindings/ada/plplot_traditional.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.ads.cmake 2010-06-04 20:08:11 UTC (rev 11055) +++ trunk/bindings/ada/plplot_traditional.ads.cmake 2010-06-05 03:53:38 UTC (rev 11056) @@ -701,6 +701,13 @@ Options : Integer); -- Options are not defined in plplot.h. + -- Calculate broken-down time from continuous time for current stream. + procedure plbtime + (year, month, day, hour, min : out Integer; + sec : out Long_Float; + ctime : Long_Float); + + -- Start new page. Should only be used with pleop(). procedure plbop; @@ -754,6 +761,16 @@ procedure plcol1(Color : Long_Float_0_1_Type); + -- Configure transformation between continuous and broken-down time (and + -- vice versa) for current stream. + procedure plconfigtime + (skale, offset1, offset2 : Long_Float; + ccontrol : Integer; + ifbtime_offset : Boolean; + year, month, day, hour, min : Integer; + sec : Long_Float); + + -- Draws a contour plot from data in f(nx,ny). Is just a front-end to plfcont, -- with a particular choice for f2eval and f2eval_data. @@ -793,6 +810,13 @@ Do_Not_Copy_Device_Coordinates : Boolean); + -- Calculate continuous time from broken-down time for current stream. + procedure plctime + (year, month, day, hour, min : Integer; + sec : Long_Float; + ctime : out Long_Float); + + -- Converts input values from relative device coordinates to relative plot -- coordinates. procedure pldid2pc; Modified: trunk/examples/ada/x28a.adb.cmake =================================================================== --- trunk/examples/ada/x28a.adb.cmake 2010-06-04 20:08:11 UTC (rev 11055) +++ trunk/examples/ada/x28a.adb.cmake 2010-06-05 03:53:38 UTC (rev 11056) @@ -2,7 +2,7 @@ -- plmtex3, plptex3 demo --- Copyright (C) 2008 Jerry Bauck +-- Copyright (C) 2008-2010 Jerry Bauck -- This file is part of PLplot. @@ -54,6 +54,18 @@ zmid : Long_Float := 0.5*(zmax + zmin); zrange : Long_Float := zmax - zmin; + ysmin : Long_Float := ymin + 0.1 * yrange; + ysmax : Long_Float := ymax - 0.1 * yrange; + ysrange : Long_Float := ysmax - ysmin; + dysrot : Long_Float := ysrange / Long_Float(nrotation - 1); + dysshear : Long_Float := ysrange / Long_Float(nshear - 1); + zsmin : Long_Float := zmin + 0.1 * zrange; + zsmax : Long_Float := zmax - 0.1 * zrange; + zsrange : Long_Float := zsmax - zsmin; + dzsrot : Long_Float := zsrange / Long_Float(nrotation - 1); + dzsshear : Long_Float := zsrange / Long_Float(nshear - 1); + ys, zs : Long_Float; + x_inclination, y_inclination, z_inclination : Long_Float; x_shear, y_shear, z_shear : Long_Float; omega, sin_omega, cos_omega, domega : Long_Float; @@ -139,6 +151,7 @@ x_shear := -0.5 * xrange * sin_omega; y_shear := 0.0; z_shear := 0.5 * zrange * cos_omega; + zs := zsmax - dzsrot * Long_Float(i); plptex3( xmid, ymax, zmid, x_inclination, y_inclination, z_inclination, @@ -170,8 +183,9 @@ cos_omega := cos(omega); y_shear := 0.5 * yrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; + zs := zsmax - dzsrot * Long_Float(i); plptex3( - xmid, ymax, zmax -(zmax-0.2)*Long_Float(i)/Long_Float(nrotation-1), + xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for y = y#dmax#u"); @@ -189,8 +203,9 @@ cos_omega := cos(omega); x_shear := 0.5 * xrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; + zs := zsmax - dzsrot * Long_Float(i); plptex3( - xmax, ymid, zmax -(zmax-0.2)*Long_Float(i)/Long_Float(nrotation-1), + xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for x = x#dmax#u"); @@ -208,8 +223,9 @@ cos_omega := cos(omega); y_shear := 0.5 * yrange * cos_omega; z_shear := 0.5 * zrange * sin_omega; + ys := ysmax - dysrot * Long_Float(i); plptex3( - xmid, ymax -(ymax-0.2)*Long_Float(i)/Long_Float(nrotation-1), zmin, + xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for z = z#dmin#u"); @@ -245,8 +261,9 @@ cos_omega := cos(omega); x_shear := 0.5 * xrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; + zs := zsmax - dzsshear * Long_Float(i); plptex3( - xmid, ymax, zmax -(zmax-0.2)*Long_Float(i)/Long_Float(nshear-1), + xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for y = y#dmax#u"); @@ -264,8 +281,9 @@ cos_omega := cos(omega); y_shear := -0.5 * yrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; + zs := zsmax - dzsshear * Long_Float(i); plptex3( - xmax, ymid, zmax -(zmax-0.2)*Long_Float(i)/Long_Float(nshear-1), + xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for x = x#dmax#u"); @@ -283,8 +301,9 @@ cos_omega := cos(omega); y_shear := 0.5 * yrange * cos_omega; x_shear := 0.5 * xrange * sin_omega; + ys := ysmax - dysshear * Long_Float(i); plptex3( - xmid, ymax -(ymax-0.2)*Long_Float(i)/Long_Float(nshear-1), zmin, + xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for z = z#dmin#u"); Modified: trunk/examples/ada/x29a.adb.cmake =================================================================== --- trunk/examples/ada/x29a.adb.cmake 2010-06-04 20:08:11 UTC (rev 11055) +++ trunk/examples/ada/x29a.adb.cmake 2010-06-05 03:53:38 UTC (rev 11056) @@ -2,7 +2,7 @@ -- Sample plots using date / time formatting for axes --- Copyright (C) 2008 Jerry Bauck +-- Copyright (C) 2008-2010 Jerry Bauck -- This file is part of PLplot. @@ -21,15 +21,15 @@ -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with + Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, - Ada.Calendar, PLplot_Auxiliary, PLplot_Traditional; use + Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, - Ada.Calendar, PLplot_Auxiliary, PLplot_Traditional; @@ -38,15 +38,23 @@ -------------------------------------------------------------------------------- -- Draws several plots which demonstrate the use of date / time formats for -- the axis labels. --- Time formatting is done using the system strftime routine. See the --- documentation of this for full details of the available formats. +-- Time formatting is done using the strfqsas routine from the qsastime +-- library. This is similar to strftime, but works for a broad +-- date range even on 32-bit systems. See the +-- documentation of strfqsas for full details of the available formats. -- -- 1) Plotting temperature over a day (using hours / minutes) --- 2) Plotting +-- 2) Plotting -- --- Note: Times are stored as seconds since the epoch (usually 1st Jan 1970). +-- Note: We currently use the default call for plconfigtime (done in +-- plinit) which means continuous times are interpreted as seconds since +-- 1970-01-01, but that may change in future, more extended versions of +-- this example. -------------------------------------------------------------------------------- +-- NOTE: The Ada user is reminded that Ada.Calendar is very capable and complete. +-- See especially Time_Of. + procedure x29a is -- Plot a model diurnal cycle of temperature procedure plot1 is @@ -151,32 +159,20 @@ procedure plot3 is - xmin, xmax, ymin, ymax : Long_Float; + xmin, xmax, ymin, ymax, tstart : Long_Float; x, y : Real_Vector(0 .. 61); begin - -- Find the number of seconds since January 1, 1970 to December 1, 2005. - -- Should be 1_133_395_200.0. + -- Calculate continuous time corresponding to 2005-12-01 UTC. + plctime(2005, 11, 01, 0, 0, 0.0, tstart); - -- NOTE that some PLplot developers claim that the Time_Of function - -- is incorrect, saying that this method does not work reliably for - -- time zones which were on daylight saving time on Janary 1 1970, e.g. - -- the UK. However, there is confusion over the C and/or Unix - -- time functions which apparently refer to local time: Time_Of does - -- not refer to local time. The following commented-out line which - -- calculates xmin returns 1133395200.0 which is identical to the - -- PLplot-developer-agreed-to value which is hard-coded here. Go figure. - -- xmin := Long_Float(Time_Of(2005, 12, 1, 0.0) - Time_Of(1970, 1, 1, 0.0)); - - -- For now we will just hard code it - xmin := 1133395200.0; - + xmin := tstart; xmax := xmin + Long_Float(x'length) * 60.0 * 60.0 * 24.0; ymin := 0.0; ymax := 5.0; for i in x'range loop x(i) := xmin + Long_Float(i) * 60.0 * 60.0 * 24.0; - y(i) := 1.0 + sin(2.0 * pi * Long_Float(i) / 7.0 ) + + y(i) := 1.0 + sin(2.0 * pi * Long_Float(i) / 7.0) + exp((Long_Float(Integer'min(i, x'length - i))) / 31.0); end loop; @@ -187,9 +183,8 @@ plcol0(1); - -- Set time format to be ISO 8601 standard YYYY-MM-DD. Note that this is - -- equivalent to %f for C99 compliant implementations of strftime. - pltimefmt("%Y-%m-%d"); + -- Set time format to be ISO 8601 standard YYYY-MM-DD. + pltimefmt("%F"); -- Draw a box with ticks spaced every 14 days in X and 1 hour in Y. plbox("bcnstd", 14.0 * 24.0 * 60.0 * 60.0, 14, "bcnstv", 1.0, 4); @@ -206,10 +201,145 @@ end plot3; -begin + + procedure plot4 is + -- TAI-UTC (seconds) as a function of time. + -- Use Besselian epochs as the continuous time interval just to prove + -- this does not introduce any issues. + + scale, offset1, offset2 : Long_Float; + xmin, xmax, ymin, ymax, xlabel_step : Long_Float; + npts : Integer; + if_TAI_time_format : Boolean; + time_format : Unbounded_String := To_Unbounded_String(""); + title_suffix : Unbounded_String := To_Unbounded_String(""); + xtitle : Unbounded_String := To_Unbounded_String(""); + title : Unbounded_String := To_Unbounded_String(""); + x, y : Real_Vector(0 .. 1000); + tai_year, tai_month, tai_day, tai_hour, tai_min : Integer; + tai_sec, tai : Long_Float; + utc_year, utc_month, utc_day, utc_hour, utc_min : Integer; + utc_sec, utc : Long_Float; + begin + -- Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch + -- B = 1900. + (JD -2415020.31352)/365.242198781 + -- => (as calculated with aid of "bc -l" command) + -- B = (MJD + 678940.364163900)/365.242198781 + -- => + -- MJD = B*365.24219878 - 678940.364163900 + scale := 365.242198781; + offset1 := -678940.0; + offset2 := -0.3641639; + plconfigtime(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); + + for kind in 0 .. 6 loop + if kind = 0 then + plctime(1950, 0, 2, 0, 0, 0.0, xmin); + plctime(2020, 0, 2, 0, 0, 0.0, xmax); + npts := 70 * 12 + 1; + ymin := 0.0; + ymax := 36.0; + time_format := To_Unbounded_String("%Y%"); + if_TAI_time_format := True; + title_suffix := To_Unbounded_String("from 1950 to 2020"); + xtitle := To_Unbounded_String("Year"); + xlabel_step := 10.0; + elsif kind = 1 or kind = 2 then + plctime(1961, 7, 1, 0, 0, 1.64757 - 0.20, xmin); + plctime(1961, 7, 1, 0, 0, 1.64757 + 0.20, xmax); + npts := 1001; + ymin := 1.625; + ymax := 1.725; + time_format := To_Unbounded_String("%S%2%"); + title_suffix := To_Unbounded_String("near 1961-08-01 (TAI)"); + xlabel_step := 0.05 / (scale * 86400.0); + if kind = 1 then + if_TAI_time_format := True; + xtitle := To_Unbounded_String("Seconds (TAI)"); + else + if_TAI_time_format := False; + xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); + end if; + elsif kind = 3 or kind = 4 then + plctime(1963, 10, 1, 0, 0, 2.6972788 - 0.20, xmin); + plctime(1963, 10, 1, 0, 0, 2.6972788 + 0.20, xmax); + npts := 1001; + ymin := 2.55; + ymax := 2.75; + time_format := To_Unbounded_String("%S%2%"); + title_suffix := To_Unbounded_String("near 1963-11-01 (TAI)"); + xlabel_step := 0.05 / (scale * 86400.0); + if kind = 3 then + if_TAI_time_format := True; + xtitle := To_Unbounded_String("Seconds (TAI)"); + else + if_TAI_time_format := False; + xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); + end if; + elsif kind = 5 or kind = 6 then + plctime(2009, 0, 1, 0, 0, 34.0 - 5.0, xmin); + plctime(2009, 0, 1, 0, 0, 34.0 + 5.0, xmax); + npts := 1001; + ymin := 32.5; + ymax := 34.5; + time_format := To_Unbounded_String("%S%2%"); + title_suffix := To_Unbounded_String("near 2009-01-01 (TAI)"); + xlabel_step := 1.0 / (scale * 86400.0); + if kind = 5 then + if_TAI_time_format := True; + xtitle := To_Unbounded_String("Seconds (TAI)"); + else + if_TAI_time_format := False; + xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); + end if; + end if; + + for i in 0 .. npts - 1 loop + x(i) := xmin + Long_Float(i) * (xmax - xmin) / (Long_Float(npts - 1)); + plconfigtime(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); + tai := x(i); + plbtime(tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec, tai); + plconfigtime(scale, offset1, offset2, 2, False, 0, 0, 0, 0, 0, 0.0); + plbtime(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, tai); + plconfigtime(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); + plctime(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, utc); + y(i) := (tai - utc) * scale * 86400.0; + end loop; + + pladv(0); + plvsta; + plwind(xmin, xmax, ymin, ymax); + plcol0(1); + if if_TAI_time_format then + plconfigtime(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); + else + plconfigtime(scale, offset1, offset2, 2, False, 0, 0, 0, 0, 0, 0.0); + end if; + pltimefmt(To_String(time_format)); + plbox("bcnstd", xlabel_step, 0, "bcnstv", 0.0, 0); + plcol0(3); + title := To_Unbounded_String("@frPLplot Example 29 - TAI-UTC "); + title := title & title_suffix; + pllab(To_String(xtitle), "TAI-UTC (sec)", To_String(title)); + + plcol0(4); + + if kind = 0 then -- Shorter x and y + plline(x(0 .. 70 * 12), y(0 .. 70 * 12)); + else -- Longer x and y + plline(x, y); + end if; + + end loop; -- kind + end plot4; + +begin -- main -- Parse command line arguments plparseopts(PL_PARSE_FULL); + -- Change the escape character to a '@' instead of the default '#' + plsesc('@'); + -- Initialize plplot plinit; @@ -219,6 +349,7 @@ plot1; plot2; plot3; + plot4; -- Don't forget to call plend to finish off! plend; Modified: trunk/examples/ada/xthick28a.adb.cmake =================================================================== --- trunk/examples/ada/xthick28a.adb.cmake 2010-06-04 20:08:11 UTC (rev 11055) +++ trunk/examples/ada/xthick28a.adb.cmake 2010-06-05 03:53:38 UTC (rev 11056) @@ -2,7 +2,7 @@ -- Write_Text_Viewport3, Write_Text_World3 demo --- Copyright (C) 2008 Jerry Bauck +-- Copyright (C) 2008-2010 Jerry Bauck -- This file is part of PLplot. @@ -54,6 +54,18 @@ zmid : Long_Float := 0.5*(zmax + zmin); zrange : Long_Float := zmax - zmin; + ysmin : Long_Float := ymin + 0.1 * yrange; + ysmax : Long_Float := ymax - 0.1 * yrange; + ysrange : Long_Float := ysmax - ysmin; + dysrot : Long_Float := ysrange / Long_Float(nrotation - 1); + dysshear : Long_Float := ysrange / Long_Float(nshear - 1); + zsmin : Long_Float := zmin + 0.1 * zrange; + zsmax : Long_Float := zmax - 0.1 * zrange; + zsrange : Long_Float := zsmax - zsmin; + dzsrot : Long_Float := zsrange / Long_Float(nrotation - 1); + dzsshear : Long_Float := zsrange / Long_Float(nshear - 1); + ys, zs : Long_Float; + x_inclination, y_inclination, z_inclination : Long_Float; x_shear, y_shear, z_shear : Long_Float; omega, sin_omega, cos_omega, domega : Long_Float; @@ -139,6 +151,7 @@ x_shear := -0.5 * xrange * sin_omega; y_shear := 0.0; z_shear := 0.5 * zrange * cos_omega; + zs := zsmax - dzsrot * Long_Float(i); Write_Text_World_3D( xmid, ymax, zmid, x_inclination, y_inclination, z_inclination, @@ -170,8 +183,9 @@ cos_omega := cos(omega); y_shear := 0.5 * yrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; + zs := zsmax - dzsrot * Long_Float(i); Write_Text_World_3D( - xmid, ymax, zmax -(zmax-0.2)*Long_Float(i)/Long_Float(nrotation-1), + xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for y = y#dmax#u"); @@ -189,8 +203,9 @@ cos_omega := cos(omega); x_shear := 0.5 * xrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; + zs := zsmax - dzsrot * Long_Float(i); Write_Text_World_3D( - xmax, ymid, zmax -(zmax-0.2)*Long_Float(i)/Long_Float(nrotation-1), + xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for x = x#dmax#u"); @@ -208,8 +223,9 @@ cos_omega := cos(omega); y_shear := 0.5 * yrange * cos_omega; z_shear := 0.5 * zrange * sin_omega; + ys := ysmax - dysrot * Long_Float(i); Write_Text_World_3D( - xmid, ymax -(ymax-0.2)*Long_Float(i)/Long_Float(nrotation-1), zmin, + xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for z = z#dmin#u"); @@ -245,8 +261,9 @@ cos_omega := cos(omega); x_shear := 0.5 * xrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; + zs := zsmax - dzsshear * Long_Float(i); Write_Text_World_3D( - xmid, ymax, zmax -(zmax-0.2)*Long_Float(i)/Long_Float(nshear-1), + xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for y = y#dmax#u"); @@ -264,8 +281,9 @@ cos_omega := cos(omega); y_shear := -0.5 * yrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; + zs := zsmax - dzsshear * Long_Float(i); Write_Text_World_3D( - xmax, ymid, zmax -(zmax-0.2)*Long_Float(i)/Long_Float(nshear-1), + xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for x = x#dmax#u"); @@ -283,8 +301,9 @@ cos_omega := cos(omega); y_shear := 0.5 * yrange * cos_omega; x_shear := 0.5 * xrange * sin_omega; + ys := ysmax - dysshear * Long_Float(i); Write_Text_World_3D( - xmid, ymax -(ymax-0.2)*Long_Float(i)/Long_Float(nshear-1), zmin, + xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for z = z#dmin#u"); Modified: trunk/examples/ada/xthick29a.adb.cmake =================================================================== --- trunk/examples/ada/xthick29a.adb.cmake 2010-06-04 20:08:11 UTC (rev 11055) +++ trunk/examples/ada/xthick29a.adb.cmake 2010-06-05 03:53:38 UTC (rev 11056) @@ -2,7 +2,7 @@ -- Sample plots using date / time formatting for axes --- Copyright (C) 2008 Jerry Bauck +-- Copyright (C) 2008-2010 Jerry Bauck -- This file is part of PLplot. @@ -21,15 +21,15 @@ -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with + Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, - Ada.Calendar, PLplot_Auxiliary, PLplot; use + Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, - Ada.Calendar, PLplot_Auxiliary, PLplot; @@ -38,15 +38,23 @@ -------------------------------------------------------------------------------- -- Draws several plots which demonstrate the use of date / time formats for -- the axis labels. --- Time formatting is done using the system strftime routine. See the --- documentation of this for full details of the available formats. +-- Time formatting is done using the strfqsas routine from the qsastime +-- library. This is similar to strftime, but works for a broad +-- date range even on 32-bit systems. See the +-- documentation of strfqsas for full details of the available formats. -- -- 1) Plotting temperature over a day (using hours / minutes) --- 2) Plotting +-- 2) Plotting -- --- Note: Times are stored as seconds since the epoch (usually 1st Jan 1970). +-- Note: We currently use the default call for plconfigtime (done in +-- plinit) which means continuous times are interpreted as seconds since +-- 1970-01-01, but that may change in future, more extended versions of +-- this example. -------------------------------------------------------------------------------- +-- NOTE: The Ada user is reminded that Ada.Calendar is very capable and complete. +-- See especially Time_Of. + procedure xthick29a is -- Plot a model diurnal cycle of temperature procedure plot1 is @@ -151,33 +159,20 @@ procedure plot3 is - xmin, xmax, ymin, ymax : Long_Float; + xmin, xmax, ymin, ymax, tstart : Long_Float; x, y : Real_Vector(0 .. 61); begin - -- Find the number of seconds since January 1, 1970 to December 1, 2005. - -- Should be 1_133_395_200.0. + -- Calculate continuous time corresponding to 2005-12-01 UTC. + Continuous_From_Broken_Down_Time(2005, 11, 01, 0, 0, 0.0, tstart); - -- NOTE that some PLplot developers claim that the Time_Of function - -- is incorrect, saying that this method does not work reliably for - -- time zones which were on daylight saving time on Janary 1 1970, e.g. - -- the UK. However, there is confusion over the C and/or Unix - -- time functions which apparently refer to local time: Time_Of does - -- not refer to local time. The following commented-out line which - -- calculates xmin returns 1133395200.0 which is identical to the - -- PLplot-developer-agreed-to value which is hard-coded here. Go figure. - -- xmin := Long_Float(Time_Of(2005, 12, 1, 0.0) - Time_Of(1970, 1, 1, 0.0)); - - -- For now we will just hard code it - xmin := 1133395200.0; - - + xmin := tstart; xmax := xmin + Long_Float(x'length) * 60.0 * 60.0 * 24.0; ymin := 0.0; ymax := 5.0; for i in x'range loop x(i) := xmin + Long_Float(i) * 60.0 * 60.0 * 24.0; - y(i) := 1.0 + sin(2.0 * pi * Long_Float(i) / 7.0 ) + + y(i) := 1.0 + sin(2.0 * pi * Long_Float(i) / 7.0) + exp((Long_Float(Integer'min(i, x'length - i))) / 31.0); end loop; @@ -188,9 +183,8 @@ Set_Pen_Color(Red); - -- Set time format to be ISO 8601 standard YYYY-MM-DD. Note that this is - -- equivalent to %f for C99 compliant implementations of strftime. - Set_Date_Time_Label_Format("%Y-%m-%d"); + -- Set time format to be ISO 8601 standard YYYY-MM-DD. + Set_Date_Time_Label_Format("%F"); -- Draw a box with ticks spaced every 14 days in X and 1 hour in Y. Box_Around_Viewport("bcnstd", 14.0 * 24.0 * 60.0 * 60.0, 14, "bcnstv", 1.0, 4); @@ -207,7 +201,139 @@ end plot3; -begin + + procedure plot4 is + -- TAI-UTC (seconds) as a function of time. + -- Use Besselian epochs as the continuous time interval just to prove + -- this does not introduce any issues. + + scale, offset1, offset2 : Long_Float; + xmin, xmax, ymin, ymax, xlabel_step : Long_Float; + npts : Integer; + if_TAI_time_format : Boolean; + time_format : Unbounded_String := To_Unbounded_String(""); + title_suffix : Unbounded_String := To_Unbounded_String(""); + xtitle : Unbounded_String := To_Unbounded_String(""); + title : Unbounded_String := To_Unbounded_String(""); + x, y : Real_Vector(0 .. 1000); + tai_year, tai_month, tai_day, tai_hour, tai_min : Integer; + tai_sec, tai : Long_Float; + utc_year, utc_month, utc_day, utc_hour, utc_min : Integer; + utc_sec, utc : Long_Float; + begin + -- Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch + -- B = 1900. + (JD -2415020.31352)/365.242198781 + -- => (as calculated with aid of "bc -l" command) + -- B = (MJD + 678940.364163900)/365.242198781 + -- => + -- MJD = B*365.24219878 - 678940.364163900 + scale := 365.242198781; + offset1 := -678940.0; + offset2 := -0.3641639; + Configure_Time_Transformation(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); + + for kind in 0 .. 6 loop + if kind = 0 then + Continuous_From_Broken_Down_Time(1950, 0, 2, 0, 0, 0.0, xmin); + Continuous_From_Broken_Down_Time(2020, 0, 2, 0, 0, 0.0, xmax); + npts := 70 * 12 + 1; + ymin := 0.0; + ymax := 36.0; + time_format := To_Unbounded_String("%Y%"); + if_TAI_time_format := True; + title_suffix := To_Unbounded_String("from 1950 to 2020"); + xtitle := To_Unbounded_String("Year"); + xlabel_step := 10.0; + elsif kind = 1 or kind = 2 then + Continuous_From_Broken_Down_Time(1961, 7, 1, 0, 0, 1.64757 - 0.20, xmin); + Continuous_From_Broken_Down_Time(1961, 7, 1, 0, 0, 1.64757 + 0.20, xmax); + npts := 1001; + ymin := 1.625; + ymax := 1.725; + time_format := To_Unbounded_String("%S%2%"); + title_suffix := To_Unbounded_String("near 1961-08-01 (TAI)"); + xlabel_step := 0.05 / (scale * 86400.0); + if kind = 1 then + if_TAI_time_format := True; + xtitle := To_Unbounded_String("Seconds (TAI)"); + else + if_TAI_time_format := False; + xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); + end if; + elsif kind = 3 or kind = 4 then + Continuous_From_Broken_Down_Time(1963, 10, 1, 0, 0, 2.6972788 - 0.20, xmin); + Continuous_From_Broken_Down_Time(1963, 10, 1, 0, 0, 2.6972788 + 0.20, xmax); + npts := 1001; + ymin := 2.55; + ymax := 2.75; + time_format := To_Unbounded_String("%S%2%"); + title_suffix := To_Unbounded_String("near 1963-11-01 (TAI)"); + xlabel_step := 0.05 / (scale * 86400.0); + if kind = 3 then + if_TAI_time_format := True; + xtitle := To_Unbounded_String("Seconds (TAI)"); + else + if_TAI_time_format := False; + xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); + end if; + elsif kind = 5 or kind = 6 then + Continuous_From_Broken_Down_Time(2009, 0, 1, 0, 0, 34.0 - 5.0, xmin); + Continuous_From_Broken_Down_Time(2009, 0, 1, 0, 0, 34.0 + 5.0, xmax); + npts := 1001; + ymin := 32.5; + ymax := 34.5; + time_format := To_Unbounded_String("%S%2%"); + title_suffix := To_Unbounded_String("near 2009-01-01 (TAI)"); + xlabel_step := 1.0 / (scale * 86400.0); + if kind = 5 then + if_TAI_time_format := True; + xtitle := To_Unbounded_String("Seconds (TAI)"); + else + if_TAI_time_format := False; + xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); + end if; + end if; + + for i in 0 .. npts - 1 loop + x(i) := xmin + Long_Float(i) * (xmax - xmin) / (Long_Float(npts - 1)); + Configure_Time_Transformation(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); + tai := x(i); + Broken_Down_From_Continuous_Time(tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec, tai); + Configure_Time_Transformation(scale, offset1, offset2, 2, False, 0, 0, 0, 0, 0, 0.0); + Broken_Down_From_Continuous_Time(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, tai); + Configure_Time_Transformation(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); + Continuous_From_Broken_Down_Time(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, utc); + y(i) := (tai - utc) * scale * 86400.0; + end loop; + + Advance_To_Subpage(Next_Subpage); + Set_Viewport_Standard; + Set_Viewport_World(xmin, xmax, ymin, ymax); + Set_Pen_Color(Red); + if if_TAI_time_format then + Configure_Time_Transformation(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); + else + Configure_Time_Transformation(scale, offset1, offset2, 2, False, 0, 0, 0, 0, 0, 0.0); + end if; + Set_Date_Time_Label_Format(To_String(time_format)); + Box_Around_Viewport("bcnstd", xlabel_step, 0, "bcnstv", 0.0, 0); + Set_Pen_Color(Green); + title := To_Unbounded_String("@frPLplot Example 29 - TAI-UTC "); + title := title & title_suffix; + Write_Labels(To_String(xtitle), "TAI-UTC (sec)", To_String(title)); + + Set_Pen_Color(Aquamarine); + + if kind = 0 then -- Shorter x and y + Draw_Curve(x(0 .. 70 * 12), y(0 .. 70 * 12)); + else -- Longer x and y + Draw_Curve(x, y); + end if; + + end loop; -- kind + end plot4; + +begin -- main -- Parse command line arguments Parse_Command_Line_Arguments(Parse_Full); @@ -220,6 +346,7 @@ plot1; plot2; plot3; + plot4; -- Don't forget to call End_PLplot to finish off! End_PLplot; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2010-06-05 17:23:19
|
Revision: 11059 http://plplot.svn.sourceforge.net/plplot/?rev=11059&view=rev Author: hbabcock Date: 2010-06-05 17:23:12 +0000 (Sat, 05 Jun 2010) Log Message: ----------- Updated for 5.9.7 release. Modified Paths: -------------- trunk/OLD-README.release trunk/README.release Modified: trunk/OLD-README.release =================================================================== --- trunk/OLD-README.release 2010-06-05 15:30:25 UTC (rev 11058) +++ trunk/OLD-README.release 2010-06-05 17:23:12 UTC (rev 11059) @@ -1,3 +1,1095 @@ +PLplot Release 5.9.6 +~~~~~~~~~~~~~~~~~~~~ +This is a development release of PLplot. It represents the ongoing efforts +of the community to improve the PLplot plotting package. Development +releases in the 5.9.x series will be available every few months. The next +stable release will be 5.10.0. + + If you encounter a problem that is not already documented in the +PROBLEMS file or on our bugtracker, then please send bug reports to PLplot +developers via the mailing lists at +http://sourceforge.net/mail/?group_id=2915 (preferred) or on our bugtracker +at http://sourceforge.net/tracker/?group_id=2915&atid=102915. + + Please see the license under which this software is distributed +(LGPL), and the disclaimer of all warranties, given in the COPYING.LIB +file. + +Official Notices for Users. + +I. As of release 5.9.1 we have removed our previously deprecated +autotools-based build system. Instead, use the CMake-based build system +following the directions in the INSTALL file. + +II. As of release 5.9.1 we no longer support Octave-2.1.73 which has a +variety of run-time issues in our tests of the Octave examples on different +platforms. In contrast our tests show we get good run-time results with all +our Octave examples for Octave-3.0.1. Also, that is the recommended stable +version of Octave at http://www.gnu.org/software/octave/download.html so +that is the only version of Octave we support at this time. + +III. As of release 5.9.1 we have decided for consistency sake to change the +PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and +plsc->vpwyma and the results returned by plgvpw to reflect the exact window +limit values input by users using plwind. Previously to this change, the +stream variables and the values returned by plgvpw reflected the internal +slightly expanded range of window limits used by PLplot so that the user's +specified limits would be on the graph. Two users noted this slight +difference, and we agree with them it should not be there. Note that +internally, PLplot still uses the expanded ranges so most users results will +be identical. However, you may notice some small changes to your plot +results if you use these stream variables directly (only possible in C/C++) +or use plgvpw. + +IV. As of release 5.9.2 we have set HAVE_PTHREAD to ON by default for all +platforms other than Darwin. Darwin will follow later once it appears the +Apple version of X supports it. + +V. As of release 5.9.3 our build system requires CMake version 2.6.0 or +higher. + +VI. As of release 5.9.3 we have deprecated the gcw device driver and the +related gnome2 and pygcw bindings since these are essentially unmaintained. +For example, the gcw device and associated bindings still depends on the +plfreetype approach for accessing unicode fonts which has known issues +(inconsistent text offsets, inconvenient font setting capabilities, and +incorrect rendering of CTL languages). To avoid these issues we advise +using the xcairo device and the externally supplied XDrawable or Cairo +context associated with the xcairo device and the extcairo device (see +examples/c/README.cairo) instead. If you still absolutely must use -dev gcw +or the related gnome2 or pygcw bindings despite the known problems, then +they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or +ENABLE_pygcw to ON. +N.B. This announcement has been superseded by the subsequent retirement +of gcw, gnome2, and pygcw, see announcement XVII. + +VII. As of release 5.9.3 we have deprecated the gd device driver which +implements the png, jpeg, and gif devices. This device driver is +essentially unmaintained. For example, it still depends on the plfreetype +approach for accessing unicode fonts which has known issues (inconsistent +text offsets, inconvenient font setting capabilities, and incorrect +rendering of CTL languages). To avoid these issues for PNG format, we +advise using the pngcairo or pngqt devices. To avoid these issues for the +JPEG format, we advise using the jpgqt device. PNG is normally considered a +better raster format than GIF, but if you absolutely require GIF format, we +advise using the pngcairo or pngqt devices and then downgrading the results +to the GIF format using the ImageMagick "convert" application. For those +platforms where libgd (the dependency of the gd device driver) is accessible +while the required dependencies of the cairo and/or qt devices are not +accessible, you can still use these deprecated devices by setting PLD_png, +PLD_jpeg, or PLD_gif to ON. + +VIII. As of release 5.9.3 we have re-enabled the tk, itk, and itcl components +of PLplot by default that were disabled by default as of release 5.9.1 due +to segfaults. The cause of the segfaults was a bug (now fixed) in how +pthread support was implemented for the Tk-related components of PLplot. + +IX. As of release 5.9.4 we have deprecated the pbm device driver (containing +the pbm device) because glibc detects a catastrophic double free. + +X. As of release 5.9.5 we have removed pyqt3 access to PLplot and +replaced it by pyqt4 access to PLplot (see details below). + +XI. As of release 5.9.5 the only method of specifying a non-default compiler +(and associated compiler options) that we support is the environment +variable approach, e.g., + +export CC='gcc -g -fvisibility=hidden' +export CXX='g++ -g -fvisibility=hidden' +export FC='gfortran -g -fvisibility=hidden' + +All other CMake methods of specifying a non-default compiler and associated +compiler options will not be supported until CMake bug 9220 is fixed, see +discussion below of the soft-landing re-implementation for details. + +XII. As of release 5.9.5 we have retired the hpgl driver (containing the +hp7470, hp7580, and lj_hpgl devices), the impress driver (containing the imp +device), the ljii driver (containing the ljii and ljiip devices), and the +tek driver (containing the conex, mskermit, tek4107, tek4107f, tek4010, +tek4010f, versaterm, vlt, and xterm devices). Retirement means we have +removed the build options which would allow these devices to build and +install. Recent tests have shown a number of run-time issues (hpgl, +impress, and ljii) or build-time issues (tek) with these devices, and as far +as we know there is no more user interest in them. Therefore, we have +decided to retire these devices rather than fix them. + +XIII. As of release 5.9.6 we have retired the pbm driver containing the pbm +(actually portable pixmap) file device. This device is quite primitive and +poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font +fallback), falls back to ugly software fills, doesn't support alpha +transparency, etc. It also has a serious run-time issue with example 2 +(double free detected by glibc) which probably indicates some fundamental +issue with the 100 colours in cmap0 for that example. For those who really +need portable pixmap results, we suggest using the ImageMagick convert +programme, e.g., "convert examples/x24c01.pngqt test.ppm" or "convert +examples/x24c01.pngcairo test.ppm" to produce good-looking portable pixmap +results from our best png device results. + +XIV. As of release 5.9.6 we have retired the linuxvga driver +containing the linuxvga interactive device. This device is quite +primitive, difficult to test, and poorly maintained. It ignores +unicode fonts (i.e., uses the Hershey font fallback), falls back to +ugly software fills, doesn't support alpha transparency, etc. It is +Linux only, can only be run as root, and svgalib (the library used by +linuxsvga) is not supported by some mainstream (e.g., Intel) chipsets. +All of these characteristics make it difficult to even test this +device much less use it for anything serious. Finally, it has had a +well-known issue for years (incorrect colours) which has never been +fixed indicating nobody is interested in maintaining this device. + +XV. As of release 5.9.6 we have retired our platform support of djgpp +that used to reside in sys/dos/djgpp. The developer (Andrew Roach) +who used to maintain those support files for djgpp feels that the +djgpp platform is no longer actively developed, and he no longer uses +djgpp himself. + +XVI. As of release 5.9.6 plpoin results for ascii codes 92, 94, and 95 +are changed from centred dot, degree symbol, and centred dot glyphs to +the correct backslash, caret, and underscore glyphs that are +associated with those ascii indices. This change is consistent with +the documentation of plpoin and solves a long-standing issue with +backslash, caret, and underscore ascii characters in character strings +used for example by pl[mp]tex. Those who need access to a centred dot +with plpoin should use index 1. The degree symbol is no longer +accessible with plpoin, but it is available in ordinary text input to +PLplot as Hershey escape "#(718)", where 718 is the Hershey index of +the degree symbol, unicode escape "#[0x00B0]" where 0x00B0 is the +unicode index for the degree symbol or direct UTF8 unicode string "°". + +XVII. As of release 5.9.6 we have retired the gcw device driver and +the related gnome2 and pygcw bindings since these are unmaintained and +there are good replacements. These components of PLplot were +deprecated as of release 5.9.3. A good replacement for the gcw device +is either the xcairo or qtwidget device. A good replacement for the +gnome2 bindings is the externally supplied XDrawable or Cairo context +associated with the xcairo device and the extcairo device (see +examples/c/README.cairo). A good replacement for pygcw is our new +pyqt4 bindings for PLplot. + +XVIII. As of release 5.9.6 we have deprecated support for the python +Numeric array extensions. Numeric is no longer maintained and users +of Numeric are advised to migrate to numpy. Numpy has been the standard +for PLplot for some time. If numpy is not present PLplot will now +disable python by default. If you still require Numeric support in the +short term then set USE_NUMERIC to ON in cmake. The PLplot support +for Numeric will be dropped in a future release. + +XVIV. It has come to our attention that the version of gdc supplied with +several recent versions of Ubuntu has a very serious bug on 64-bit +systems (see https://bugs.launchpad.net/ubuntu/+source/gdc-4.2/+bug/235955) +which causes several of the plplot D examples to crash. If this +affects you, you are recommended to disable the d bindings or switch to +an alternative d compiler (the Digital Mars compiler is reported to +be good). + +INDEX + +0. Tests made for release 5.9.6 + +1. Changes relative to PLplot 5.9.5 (the previous development release) + +1.1 Make PLplot aware of LC_NUMERIC locale +1.2 Linear gradients have been implemented +1.3 Cairo Windows driver implemented +1.4 Custom axis labeling implemented +1.5 Universal coordinate transform implemented +1.6 Support for arbitrary storage of 2D user data +1.7 Font improvements + + +2. Changes relative to PLplot 5.8.0 (the previous stable release) + +2.1 All autotools-related files have now been removed +2.2 Build system bug fixes +2.3 Build system improvements +2.4 Implement build-system infrastructure for installed Ada bindings and +examples +2.5 Code cleanup +2.6 Date / time labels for axes +2.7 Alpha value support +2.8 New PLplot functions +2.9 External libLASi library improvements affecting our psttf device +2.10 Improvements to the cairo driver family +2.11 wxWidgets driver improvements +2.12 pdf driver improvements +2.13 svg driver improvements +2.14 Ada language support +2.15 OCaml language support +2.16 Perl/PDL language support +2.17 Update to various language bindings +2.18 Update to various examples +2.19 Extension of our test framework +2.20 Rename test subdirectory to plplot_test +2.21 Website support files updated +2.22 Internal changes to function visibility +2.23 Dynamic driver support in Windows +2.24 Documentation updates +2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm +2.26 get-drv-info now changed to test-drv-info +2.27 Text clipping now enabled by default for the cairo devices +2.28 A powerful qt device driver has been implemented +2.29 The PLplot API is now accessible from Qt GUI applications +2.30 NaN / Inf support for some PLplot functions +2.31 Various bug fixes +2.32 Cairo driver improvements +2.33 PyQt changes +2.34 Color Palettes +2.35 Re-implementation of a "soft landing" when a bad/missing compiler is +detected +2.36 Make PLplot aware of LC_NUMERIC locale +2.37 Linear gradients have been implemented +2.38 Cairo Windows driver implemented +2.39 Custom axis labeling implemented +2.40 Universal coordinate transform implemented +2.41 Support for arbitrary storage of 2D user data +2.42 Font improvements + + +0. Tests made for release 5.9.6 + +See +http://www.miscdebris.net/plplot_wiki/index.php?title=Testing_PLplot#Testing_Reports +for a summary table of all testing done for PLplot-5.9.6. + +1. Changes relative to PLplot 5.9.5 (the previous development release) + +1.1 Make PLplot aware of LC_NUMERIC locale + +For POSIX-compliant systems, locale is set globally so any external +applications or libraries that use the PLplot library or any external +libraries used by the PLplot library or PLplot device drivers could +potentially change the LC_NUMERIC locale used by PLplot to anything those +external applications and libraries choose. The principal consequence of +such choice is the decimal separator could be a comma (for some locales) +rather than the period assumed for the "C" locale. For previous versions of +PLplot a comma decimal separator would have lead to a large number of +errors, but this issue is now addressed with a side benefit that our plots +now have the capability of displaying the comma (e.g., in axis labels) for +the decimal separator for those locales which require that. + +If you are not satisfied with the results for the default PLplot locale set +by external applications and libraries, then you can now choose the +LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line +option for PLplot (if you do not specify that option, a default locale is +chosen depending on applications and libraries external to PLplot (see +comments above), and (b) setting an environment variable (LC_ALL, +LC_NUMERIC, or LANG on Linux, for example) to some locale that has been +installed on your system. On Linux, to find what locales are installed, use +the "locale -a" option. The "C" locale is always installed, but usually +there is also a principal locale that works on a platform such as +en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build +and install any additional locale you desire. (For example, on Debian Linux +you do that by running "dpkg-reconfigure locales".) + +Normally, users will not use the -locale option since the period +decimal separator that you get for the normal LC_NUMERIC default "C" +locale used by external applications and libraries is fine for their needs. +However, if the resulting decimal separator is not what the user +wants, then they would do something like the following to (a) use a period +decimal separator for command-line input and plots: + +LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 + +or (b) use a comma decimal separator for command-line input and plots: + +LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 + +N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 +in the first case or -ori 0.5 in the second) the floating-point conversion +(using atof) is silently terminated at the wrong separator for the locale, +i.e., the fractional part of the number is silently dropped. This is +obviously not ideal, but on the other hand there are relatively few +floating-point command-line options for PLplot, and we also expect those who +use the -locale option to specifically ask for a given separator for plots +(e.g., axis labels) will then use it for command-line input of +floating-point values as well. + +Certain critical areas of the PLplot library (e.g., our colour palette file +reading routines and much of the code in our device drivers) absolutely +require a period for the decimal separator. We now protect those critical +areas by saving the normal PLplot LC_NUMERIC locale (established with the +above -locale option or by default by whatever is set by external +applications or libraries), setting the LC_NUMERIC "C" locale, executing the +critical code, then restoring back to the normal PLplot LC_NUMERIC locale. +Previous versions of PLplot did not have this protection of the critical +areas so were vulnerable to default LC_NUMERIC settings of external +applications that resulted in a comma decimal separator that did not work +correctly for the critical areas. + +1.2 Linear gradients have been implemented + +The new plgradient routine draws a linear gradient (based on the +current colour map 1) at a specified angle with the x axis for a +specified polygon. Standard examples 25 and 30 now demonstrate use of +plgradient. Some devices use a software fallback to render the +gradient. This fallback is implemented with plshades which uses a +series of rectangles to approximate the gradient. Tiny alignment +issues for those rectangles relative to the pixel grid may look +problematic for transparency gradients. To avoid that issue, we try +to use native gradient capability whenever that is possible for any of +our devices. Currently, this has been implemented for our svg, qt, +and cairo devices. The result is nice-looking smooth transparency +gradients for those devices, for, e.g., example 30, page 2. + +1.3 Cairo Windows driver implemented + +A cairo Windows driver has been implemented. This provides an +interactive cairo driver for Windows similar to xcairo on Linux. +Work to improve its functionality is ongoing. + +1.4 Custom axis labeling implemented + +Axis text labels can now be customized using the new plslabelfunc function. +This allows a user to specify what text should be draw at a given position +along a plot axis. Example 19 has been updated to illustrate this function's +use through labeling geographic coordinates in degrees North, South, East and +West. + +1.5 Universal coordinate transform implemented + +A custom coordinate transformation function can be set using plstransform. +This transformation function affects all subsequent plot function calls which +work with plot window coordinates. Testing and refinement of this support is +ongoing. + +1.6 Support for arbitrary storage of 2D user data + +This improvement courtesy of David MacMahon adds support for arbitrary +storage of 2D user data. This is very similar to the technique employed +by some existing functions (e.g. plfcont and plfshade) that use "evaluator" +functions to access 2D user data that is stored in an arbtrary format. +The new approach extends the concept of a user-supplied (or predefined) +"evaluator" function to a group of user-supplied (or predefined) "operator" +functions. The operator functions provide for various operations on the +arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, +minmax, and f2eval. + +To facilitate the passing of an entire family of operator functions (via +function pointers), a plf2ops_t structure is defined to contain a +pointer to each type of operator function. Predefined operator +functions are defined for several common 2D data storage techniques. +Variables (of type plf2ops_t) containing function pointers for these +operator functions are also defined. + +New variants of functions that accept 2D data are created. The new +variants accept the 2D data as two parameters: a pointer to a plf2ops_t +structure containing (pointers to) suitable operator functions and a +PLPointer to the actual 2D data store. Existing functions that accept +2D data are modified to simply pass their parameters to the +corresponding new variant of the function, along with a pointer to the +suitable predefined plf2ops_t stucture of operator function pointers. + +The list of functions for which new variants are created is: +c_plimage, c_plimagefr, c_plmesh, c_plmeshc, c_plot3d, c_plot3dc, +c_plot3dcl, c_plshade1, c_plshades, c_plsurf3d, and c_plsurf3dl, and +c_plgriddata. The new variants are named the same as their +corresponding existing function except that the "c_" prefix is changed +to "plf" (e.g. the new variant of c_plmesh is called plfmesh). + +Adds plfvect declaration to plplot.h and changes the names (and only the +names) of some plfvect arguments to make them slightly clearer. In +order to maintain backwards API compatibility, this function and the +other existing functions that use "evaluator" functions are NOT changed +to use the new operator functions. + +Makes plplot.h and libplplot consistent vis-a-vis pltr0f and pltr2d. +Moves the definitions of pltr2f (already declared in plplot.h) from the +sccont.c files of the FORTRAN 77 and Fortran 95 bindings into plcont.c. +Removes pltr0f declaration from plplot.h. + +Changes x08c.c to demonstrate use of new support for arbitrary storage +of 2D data arrays. Shows how to do surface plots with the following +four types of 2D data arrays: + +1) PLFLT z[nx][ny]; +2) PLfGrid2 z; +3) PLFLT z[nx*ny]; /* row major order */ +4) PLFLT z[nx*ny]; /* column major order */ + +1.7 Font improvements + +We have added the underscore to the Hershey glyphs (thanks to David +MacMahon) and slightly rearranged the ascii index to the Hershey +indices so that plpoin now generates the complete set of printable +ascii characters in the correct order for the Hershey fonts (and therefore +the Type1 and TrueType fonts as well). + +We have improved how we access TrueType and Type1 fonts via the Hershey +font index (used by plpoin, plsym, and the Hershey escape sequences in pl*tex +commands). We have added considerably to the Hershey index to Unicode index +translation table both for the compact and extended Hershey indexing scheme, +and we have adopted the standard Unicode to Type1 index translation tables +from http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/. + +We have also dropped the momentary switch to symbol font that was +implemented in the PLplot core library. That switch was designed to partially +compensate for the lack of symbol glyphs in the standard Type1 fonts. That +was a bad design because it affected TrueType font devices as well as +the desired Type1 font devices. To replace this bad idea we now +change from Type1 standard fonts to the Type1 Symbol font (and vice +versa) whenever there is a glyph lookup failure in the Type1 font +device drivers (ps and pdf). + +2. Changes relative to PLplot 5.8.0 (the previous stable release) + +2.1 All autotools-related files have now been removed + +CMake is now the only supported build system. It has been tested on +Linux / Unix, Mac OS-X and Windows platforms. + +2.2 Build system bug fixes + +Various fixes include the following: + +Ctest will now work correctly when the build tree path includes symlinks. + +Dependencies for swig generated files fixed so they are not rebuilt every +time make is called. + +Various dependency fixes to ensure that parallel builds (using make -j) +work under unix. + +2.3 Build system improvements + +We now transform link flag results delivered to the CMake environment by +pkg-config into the preferred CMake form of library information. The +practical effect of this improvement is that external libraries in +non-standard locations now have their rpath options set correctly for our +build system both for the build tree and the install tree so you don't have +to fiddle with LD_LIBRARY_PATH, etc. + +2.4 Implement build-system infrastructure for installed Ada bindings and +examples + +Install source files, library information files, and the plplotada library +associated with the Ada bindings. Configure and install the pkg-config file +for the plplotada library. Install the Ada examples and a configured Makefile +to build them in the install tree. + +2.5 Code cleanup + +The PLplot source code has been cleaned up to make consistent use of +(const char *) and (char *) throughout. Some API functions have changed +to use const char * instead of char * to make it clear that the strings +are not modified by the function. The C and C++ examples have been updated +consistent with this. These changes fix a large number of warnings +with gcc-4.2. Note: this should not require programs using PLplot to be +recompiled as it is not a binary API change. + +There has also been some cleanup of include files in the C++ examples +so the code will compile with the forthcoming gcc-4.3. + +2.6 Date / time labels for axes + +PLplot now allows date / time labels to be used on axes. A new option +('d') is available for the xopt and yopt arguments to plbox which +indicates that the axis should be interpreted as a date / time. Similarly +there is a new range of options for plenv to select date / time labels. +The time format is seconds since the epoch (usually 1 Jan 1970). This +format is commonly used on most systems. The C gmtime routine can be +used to calculate this for a given date and time. The format for the +labels is controlled using a new pltimefmt function, which takes a +format string. All formatting is done using the C strftime function. +See documentation for available options on your platform. Example 29 +demonstrates the new capabilities. + +N.B. Our reliance on C library POSIX time routines to (1) convert from +broken-down time to time-epoch, (2) to convert from time-epoch to +broken-down time, and (3) to format results with strftime have proved +problematic for non-C languages which have time routines of variable +quality. Also, it is not clear that even the POSIX time routines are +available on Windows. So we have plans afoot to implement high-quality +versions of (1), (2), and (3) with additional functions to get/set the epoch +in the PLplot core library itself. These routines should work on all C +platforms and should also be uniformly accessible for all our language +bindings. + +WARNING..... Therefore, assuming these plans are implemented, the present +part of our date/time PLplot API that uses POSIX time routines will be +changed. + +2.7 Alpha value support + +PLplot core has been modified to support a transparency or alpha value +channel for each color in color map 0 and 1. In addition a number of new +functions were added the PLplot API so that the user can both set and query +alpha values for color in the two color maps. These functions have the same +name as their non-alpha value equivalents, but with a an "a" added to the +end. Example 30 demonstrates some different ways to use these functions +and the effects of alpha values, at least for those drivers that support alpha +values. This change should have no effect on the device drivers that do not +currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and +aquaterm drivers support alpha values. There are some limitations with the gd +driver due to transparency support in the underlying libgd library. + +2.8 New PLplot functions + +An enhanced version of plimage, plimagefr has been added. This allows images +to be plotted using coordinate transformation, and also for the dynamic range +of the plotted values to be altered. Example 20 has been modified to +demonstrate this new functionality. + +To ensure consistent results in example 21 between different platforms and +language bindings PLplot now includes a small random number generator within +the library. plrandd will return a PLFLT random number in the range 0.0-1.0. +plseed will allow the random number generator to be seeded. + +2.9 External libLASi library improvements affecting our psttf device + +Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been +released at http://sourceforge.net/svn/?group_id=187113 . We recommend +using this latest version of libLASi for building PLplot and the psttf +device since this version of libLASi is more robust against glyph +information returned by pango/cairo/fontconfig that on rare occasions is not +suitable for use by libLASi. + +2.10 Improvements to the cairo driver family + +Jonathan Woithe improved the xcairo driver so that it can optionally be +used with an external user supplied X Drawable. This enables a nice +separation of graphing (PLplot) and window management (Gtk, etc..). Doug +Hunt fixed the bugs that broke the memcairo driver and it is now fully +functional. Additionally, a new extcairo driver was added that will plot +into a user supplied cairo context. + +2.11 wxWidgets driver improvements + +Complete reorganization of the driver code. A new backend was added, based +on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 +and later. This backend produces antialized output similar to the +AGG backend but has no dependency on the AGG library. The basic wxDC +backend and the wxGraphicsContext backend process the text output +on their own, which results in much nicer plots than with the standard +Hershey fonts and is much faster than using the freetype library. New +options were introduced in the wxWidgets driver: + - backend: Choose backend: (0) standard, (1) using AGG library, + (2) using wxGraphicsContext + - hrshsym: Use Hershey symbol set (hrshsym=0|1) + - text: Use own text routines (text=0|1) + - freetype: Use FreeType library (freetype=0|1) +The option "text" changed its meaning, since it enabled the FreeType library +support, while now the option enables the driver's own text routines. + +Some other features were added: + * the wxWidgets driver now correctly clears the background (or parts of it) + * transparency support was added + * the "locate mode" (already available in the xwin and tk driver) was + implemented, where graphics input events are processed and translated + to world coordinates + +2.12 pdf driver improvements + +The pdf driver (which is based on the haru library http://www.libharu.org) +processes the text output now on its own. So far only the Adobe Type1 +fonts are supported. TrueType font support will follow. Full unicode +support will follow after the haru library will support unicode strings. The +driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font +may be used only for symbols. Output can now be compressed, resulting in +much smaller file sizes. +Added new options: + - text: Use own text routines (text=0|1) + - compress: Compress pdf output (compress=0|1) + - hrshsym: Use Hershey symbol set (hrshsym=0|1) + - pagesize: Set page size (pagesize=A4|letter|A3|A5) + +2.13 svg driver improvements + +This device driver has had the following improvements: schema for generated +file now validates properly at http://validator.w3.org/ for the +automatically detected document type of SVG 1.1; -geometry option now works; +alpha channel transparency has been implemented; file familying for +multipage examples has been implemented; coordinate scaling has been +implemented so that full internal PLplot resolution is used; extraneous +whitespace and line endings that were being injected into text in error have +now been removed; and differential correction to string justification is now +applied. + +The result of these improvements is that our SVG device now gives the +best-looking results of all our devices. However, currently you must be +careful of which SVG viewer or editor you try because a number of them have +some bugs that need to be resolved. For example, there is a librsvg bug in +text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that +affects all svg use within GNOME as well as the ImageMagick "display" +application. However, at least the latest konqueror and firefox as well as +inkscape and scribus-ng (but not scribus!) give outstanding looking results +for files generated by our svg device driver. + +2.14 Ada language support + +We now have a complete Ada bindings implemented for PLplot. We also have a +complete set of our standard examples implemented in Ada which give results +that are identical with corresponding results for the C standard examples. +This is an excellent test of a large subset of the Ada bindings. We now +enable Ada by default for our users and request widespread testing of this +new feature. + +2.15 OCaml language support + +Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml +bindings implemented for PLplot. We also have a complete set of our standard +examples implemented in OCaml which give results that are identical with +corresponding results for the C standard examples. This is an excellent test +of a large subset of the OCaml bindings. We now enable OCaml by default for +our users and request widespread testing of this new feature. + +2.16 Perl/PDL language support + +Thanks to Doug Hunt's efforts the external Perl/PDL module, +PDL::Graphics::PLplot version 0.46 available at +http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date +to give access to recently added PLplot API. The instructions for how to +install this module on top of an official PDL release are given in +examples/perl/README.perldemos. Doug has also finished implementing a +complete set of standard examples in Perl/PDL which are part of PLplot and +which produce identical results to their C counterparts if the above updated +module has been installed. Our build system tests the version of +PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the +list of Perl/PDL examples that are run as part of our standard tests is +substantially reduced to avoid examples that use the new functionality. In +sum, if you use PDL::Graphics::PLplot version 0.46 or later the full +complement of PLplot commands is available to you from Perl/PDL, but +otherwise not. + +2.17 Updates to various language bindings + +A concerted effort has been made to bring all the language bindings up to +date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, +Perl/PDL, Python, and Tcl now all support the common PLplot API (with the +exception of the mapping functions which are not yet implemented for all +bindings due to technical issues.) This is a significant step forward for +those using languages other than C. + +2.18 Updates to various examples + +To help test the updates to the language bindings the examples have been +thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set +of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, +Python and Tcl are missing example 19 because of the issue with the mapping +functions. The examples have also been checked to ensure consistent results +between different language bindings. Currently there are still some minor +differences in the results for the tcl examples, probably due to rounding +errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for +proper support for NaNs. + +Also new is an option for the plplot_test.sh script to run the examples +using a debugging command. This is enabled using the --debug option. The +default it to use the valgrind memory checker. This has highlighted at +least one memory leaks in PLplot which have been fixed. It is not part +of the standard ctest tests because it can be _very_ slow for a complete +set of language bindings and device drivers. + +2.19 Extension of our test framework + +The standard test suite for PLplot now carries out a comparison of the +stdout output (especially important for example 31 which tests most of our +set and get functions) and PostScript output for different languages as a +check. Thanks to the addition of example 31, the inclusion of examples 14 +and 17 in the test suite and other recent extensions of the other +examples we now have rigourous testing in place for almost the entirety +of our common API. This extensive testing framework has already helped +us track down a number of bugs, and it should make it much easier for us +to maintain high quality for our ongoing PLplot releases. + +2.20 Rename test subdirectory to plplot_test + +This change was necessary to quit clashing with the "make test" target which +now works for the first time ever (by executing ctest). + +2.21 Website support files updated + +Our new website content is generated with PHP and uses CSS (cascaded style +sheets) to implement a consistent style. This new approach demanded lots of +changes in the website support files that are used to generate and upload +our website and which are automatically included with the release. + +2.22 Internal changes to function visibility + +The internal definitions of functions in PLplot have been significantly +tidied up to allow the use of the -fvisibility=hidden option with newer +versions of gcc. This prevents internal functions from being exported +to the user where possible. This extends the existing support for this +on windows. + +2.23 Dynamic driver support in Windows + +An interface based on the ltdl library function calls was established +which allows to open and close dynamic link libraries (DLL) during +run-time and call functions from these libraries. As a consequence +drivers can now be compiled into single DLLs separate from the core +PLplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now +ON by default for Windows if a shared PLplot library is built. + +2.24 Documentation updates + +The DocBook documentation has been updated to include many of the +C-specific functions (for example plAlloc2dGrid) which are not part +of the common API, but are used in the examples and may be helpful +for PLplot users. + +2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm + +CGM format is a long-established (since 1987) open standard for vector +graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). +PLplot has long had a cgm device driver which depended on the (mostly) +public domain libcd library that was distributed in the mid 90's by National +Institute of Standards and Technology (NIST) and which is still available +from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience +to our -dev cgm users, we have brought that +source code in house under lib/nistcd and now build libnistcd routinely +as part of our ordinary builds. The only changes we have made to the +cd1.3 source code is visibility changes in cd.h and swapping the sense of +the return codes for the test executables so that 0 is returned on success +and 1 on failure. If you want to test libnistcd on your platform, +please run + +make test_nistcd + +in the top-level build tree. (That tests runs all the test executables +that are built as part of cd1.3 and compares the results that are generated +with the *.cgm files that are supplied as part of cd1.3.) + +Two applications that convert and/or display CGM results on Linux are +ralcgm (which is called by the ImageMagick convert and display applications) +and uniconvertor. + +Some additional work on -dev cgm is required to implement antialiasing and +non-Hershey fonts, but both those should be possible using libnistcd according +to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. + +2.26 get-drv-info now changed to test-drv-info + +To make cross-building much easier for PLplot we now configure the *.rc +files that are used to describe our various dynamic devices rather than +generating the required *.rc files with get-drv-info. We have changed the +name of get-drv-info to test-drv-info. That name is more appropriate +because that executable has always tested dynamic loading of the driver +plug-ins as well as generating the *.rc files from the information gleaned +from that dynamic loading. Now, we simply run test-drv-info as an option +(defaults to ON unless cross-building is enabled) and compare the resulting +*.rc file with the one configured by cmake to be sure the dynamic device +has been built correctly. + +2.27 Text clipping now enabled by default for the cairo devices + +When correct text clipping was first implemented for cairo devices, it was +discovered that the libcairo library of that era (2007-08) did that clipping +quite inefficiently so text clipping was disabled by default. Recent tests +of text clipping for the cairo devices using libcairo 1.6.4 (released in +2008-04) shows text clipping is quite efficient now. Therefore, it is now +enabled by default. If you notice a significant slowdown for some libcairo +version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for +your cairo device plots (and accept the improperly clipped text results that +might occur with that option). Better yet, use libcairo 1.6.4 or later. + +2.28 A powerful qt device driver has been implemented + +Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt +device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, +jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an +elementary interactive device where, for now, the possible interactions +consist of resizing the window and right clicking with the mouse (or hitting +<return> to be consistent with other PLplot interactive devices) to control +paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, +pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified +in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable +pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, +svgqt are file devices whose overall sizes are specified in points (1/72 of +an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG +formatted files. The qt device driver is based on the powerful facilities +of Qt4 so all qt devices implement variable opacity (alpha channel) effects +(see example 30). The qt devices also use system unicode fonts, and deal +with CTL (complex text layout) languages automatically without any +intervention required by the user. (To show this, try qt device results +from examples 23 [mathematical symbols] and 24 [CTL languages].) + +Our exhaustive Linux testing of the qt devices (which consisted of detailed +comparisons for all our standard examples between qt device results and the +corresponding cairo device results) indicates this device driver is mature, +but testing on other platforms is requested to confirm that maturity. Qt-4.5 +(the version we used for most of our tests) has some essential SVG +functionality so we recommend that version (downloadable from +http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for +svgqt. One of our developers found that pdfqt was orders of magnitude +slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a +64 bit box. That problem was completely cured by moving to the downloadable +Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on +other platforms. One of our developers also found that all first pages of +examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. +From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we +assume this black first page for qtwidget problem also exists for Qt-4.4.3, +but we haven't tested that combination. + +In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, +but if you run into any difficulty with it please switch to Qt-4.5.x (once +Qt-4.5.x is installed all you have to do is to put the 4.5.x version of +qmake in your path, and cmake does the rest). If the problem persists for +Qt-4.5, then it is worth reporting a qt bug. + +2.29 The PLplot API is now accessible from Qt GUI applications + +This important new feature has been implemented by Alban Rochel of the QSAS +team as a spin-off of the qt device driver project using the extqt device +(which constitutes the tenth qt device). See examples/c++/README.qt_example +for a brief description of a simple Qt example which accesses the PLplot API +and which is built in the installed examples tree using the pkg-config +approach. Our build system has been enhanced to configure the necessary +plplotd-qt.pc file. + +2.30 NaN / Inf support for some PLplot functions + +Some PLplot now correctly handle Nan or Inf values in the data to be plotted. +Line plotting (plline etc) and image plotting (plimage, plimagefr) will +now ignore NaN / Inf values. Currently some of the contour plotting / 3-d +routines do not handle NaN / Inf values. This functionality will +depend on whether the language binding used supports NaN / Inf values. + +2.31 Various bug fixes + +Various bugs in the 5.9.3 release have been fixed including: + +- Include missing file needed for the aqt driver on Mac OS X +- Missing library version number for nistcd +- Fixes for the qt examples with dynamic drivers disabled +- Fixes to several tcl examples so they work with plserver +- Fix pkg-config files to work correctly with Debug / Release build types set +- Make fortran command line argument parsing work with shared libraries on Windows + +2.32 Cairo driver improvements + +Improvements to the cairo driver to give better results for bitmap +formats when used with anti-aliasing file viewers. + +2.33 PyQt changes + +Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot +(some of the functions in plplot_widgetmodule.c in bindings/python) and a +proof-of-concept example (prova.py and qplplot.py in examples/python), but +this code did not gain any developer interest and was therefore not +understood or maintained. Recently one of our core developers has +implemented a sip-generated pyqt4 interface to PLplot (controlled by +plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a +python extension module, and a good-looking pyqt4 example (pyqt4_example.py +in examples/python) that works well. Since this pyqt4 approach is +maintained by a PLplot developer it appears to have a good future, and we +have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot +interface and example completely. + +2.34 Color Palettes + +Support has been added to PLplot for user defined color palette files. +These files can be loaded at the command line using the -cmap0 or +-cmap1 commands, or via the API using the plspal0 and plspal1 commands. +The commands cmap0 / plspal0 are used to load cmap0 type files which +specify the colors in PLplot's color table 0. The commands cmap1 / +plspal1 are used to load cmap1 type files which specify PLplot's color +table 1. Examples of both types of files can be found in either the +plplot-source/data directory or the PLplot installed directory +(typically /usr/local/share/plplotx.y.z/ on Linux). + +2.35 Reimplementation of a "soft landing" when a bad/missing compiler is +detected + +The PLplot core library is written in C so our CMake-based build system will +error out if it doesn't detect a working C compiler. However all other +compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are +optional. If a working compiler is not available, we give a "soft landing" +(give a warning message, disable the optional component, and keep going). +The old implementation of the soft landing was not applied consistently (C++ +was unnecessarily mandatory before) and also caused problems for ccmake (a +CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end +to the cmake application) which incorrectly dropped languages as a result +even when there was a working compiler. + +We now have completely reimplemented the soft landing logic. The result +works well for cmake, ccmake, and cmake-gui. The one limitation of this new +method that we are aware of is it only recognizes either the default +compiler chosen by the generator or else a compiler specified by the +environment variable approach (see Official Notice XII above). Once CMake +bug 9220 has been fixed (so that the OPTIONAL signature of the +enable_language command actually works without erroring out), then our +soft-landing approach (which is a workaround for bug 9220) will be replaced +by the OPTIONAL signature of enable_language, and all CMake methods of +specifying compilers and compiler options will automatically be recognized +as a result. + +2.36 Make PLplot aware of LC_NUMERIC locale + +For POSIX-compliant systems, locale is set globally so any external +applications or libraries that use the PLplot library or any external +libraries used by the PLplot library or PLplot device drivers could +potentially change the LC_NUMERIC locale used by PLplot to anything those +external applications and libraries choose. The principal consequence of +such choice is the decimal separator could be a comma (for some locales) +rather than the period assumed for the "C" locale. For previous versions of +PLplot a comma decimal separator would have lead to a large number of +errors, but this issue is now addressed with a side benefit that our plots +now have the capability of displaying the comma (e.g., in axis labels) for +the decimal separator for those locales which require that. + +If you are not satisfied with the results for the default PLplot locale set +by external applications and libraries, then you can now choose the +LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line +option for PLplot (if you do not specify that option, a default locale is +chosen depending on applications and libraries external to PLplot (see +comments above), and (b) setting an environment variable (LC_ALL, +LC_NUMERIC, or LANG on Linux, for example) to some locale that has been +installed on your system. On Linux, to find what locales are installed, use +the "locale -a" option. The "C" locale is always installed, but usually +there is also a principal locale that works on a platform such as +en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build +and install any additional locale you desire. (For example, on Debian Linux +you do that by running "dpkg-reconfigure locales".) + +Normally, users will not use the -locale option since the period +decimal separator that you get for the normal LC_NUMERIC default "C" +locale used by external applications and libraries is fine for their needs. +However, if the resulting decimal separator is not what the user +wants, then they would do something like the following to (a) use a period +decimal separator for command-line input and plots: + +LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 + +or (b) use a comma decimal separator for command-line input and plots: + +LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 + +N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 +in the first case or -ori 0.5 in the second) the floating-point conversion +(using atof) is silently terminated at the wrong separator for the locale, +i.e., the fractional part of the number is silently dropped. This is +obviously not ideal, but on the other hand there are relatively few +floating-point command-line options for PLplot, and we also expect those who +use the -locale option to specifically ask for a given separator for plots +(e.g., axis labels) will then use it for command-line input of +floating-point values as well. + +Certain critical areas of the PLplot library (e.g., our colour palette file +reading routines and much of the code in our device drivers) absolutely +require a period for the decimal separator. We now protect those critical +areas by saving the normal PLplot LC_NUMERIC locale (established with the +above -locale option or by default by whatever is set by external +applications or libraries), setting the LC_NUMERIC "C" locale, executing the +critical code, then restoring back to the normal PLplot LC_NUMERIC locale. +Previous versions of PLplot did not have this protection of the critical +areas so were vulnerable to default LC_NUMERIC settings of external +applications that resulted in a comma decimal separator that did not work +correctly for the critical areas. + +2.37 Linear gradients have been implemented + +The new plgradient routine draws a linear gradient (based on the +current colour map 1) at a specified angle with the x axis for a +specified polygon. Standard examples 25 and 30 now demonstrate use of +plgradient. Some devices use a software fallback to render the +gradient. This fallback is implemented with plshades which uses a +series of rectangles to approximate the gradient. Tiny alignment +issues for those rectangles relative to the pixel grid may look +problematic for transparency gradients. To avoid that issue, we try +to use native gradient capability whenever that is possible for any of +our devices. Currently, this has been implemented for our svg, qt, +and cairo devices. The result is nice-looking smooth transparency +gradients for those devices, for, e.g., example 30, page 2. + +2.38 Cairo Windows driver implemented + +A cairo Windows driver has been implemented. This provides an +interactive cairo driver for Windows similar to xcairo on Linux. +Work to improve its functionality is ongoing. + +2.39 Custom axis labeling implemented + +Axis text labels can now be customized using the new plslabelfunc function. +This allows a user to specify what text should be draw at a given position +along a plot axis. Example 19 has been updated to illustrate this function's +use through labeling geographic coordinates in degrees North, South, East and +West. + +2.40 Universal coordinate transform implemented + +A custom coordinate transformation function can be set using plstransform. +This transformation function affects all subsequent plot function calls which +work with plot window coordinates. Testing and refinement of this support is +ongoing. + +2.41 Support for arbitrary storage of 2D user data + +This improvement courtesy of David MacMahon adds support for arbitrary +storage of 2D user data. This is very similar to the technique employed +by some existing functions (e.g. plfcont and plfshade) that use "evaluator" +functions to access 2D user data that is stored in an arbtrary format. +The new approach extends the concept of a user-supplied (or predefined) +"evaluator" function to a group of user-supplied (or predefined) "operator" +functions. The operator functions provide for various operations on the +arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, +minmax, and f2eval. + +To facilitate the passing of an entire family of operator functions (via +function pointers), a plf2ops_t structure is defined to contain a +pointer to each type of operator function. Predefined operator +functions are defined for several common 2D data storage techniques. +Variables (of type plf2ops_t) containing function pointers for these +operator functions are also defined. + +New variants of functions that accept 2D data are created. The new +variants accept the 2D data as two parameters: a pointer to a plf2ops_t +structure containing (pointers to) suitable operator functions and a +PLPointer to the actual 2D data store. Existing functions that accept +2D data are modified to simply pass their parameters to the +corresponding new variant of the function, along with a pointer to the +suitable predefined plf2ops_t stucture of operator function pointers. + +The list of functions for which new variants are created is: +c_plimage, c_plimagefr, c_plmesh, c_plmeshc, c_plot3d, c_plot3dc, +c_plot3dcl, c_plshade1, c_plshades, c_plsurf3d, and c_plsurf3dl, and +c_plgriddata. The new variants are named the same as their +corresponding existing function except that the "c_" prefix is changed +to "plf" (e.g. the new variant of c_plmesh is called plfmesh). + +Adds plfvect declaration to plplot.h and changes the names (and only the +names) of some plfvect arguments to make them slightly clearer. In +order to maintain backwards API compatibility, this function and the +other existing functions that use "evaluator" functions are NOT changed +to use the new operator functions. + +Makes plplot.h and libplplot consistent vis-a-vis pltr0f and pltr2d. +Moves the definitions of pltr2f (already declared in plplot.h) from the +sccont.c files of the FORTRAN 77 and Fortran 95 bindings into plcont.c. +Removes pltr0f declaration from plplot.h. + +Changes x08c.c to demonstrate use of new support for arbitrary storage +of 2D data arrays. Shows how to do surface plots with the following +four types of 2D data arrays: + +1) PLFLT z[nx][ny]; +2) PLfGrid2 z; +3) PLFLT z[nx*ny]; /* row major order */ +4) PLFLT z[nx*ny]; /* column major order */ + +2.42 Font improvements + +We have added the underscore to the Hershey glyphs (thanks to David +MacMahon) and slightly rearranged the ascii index to the Hershey +indices so that plpoin now generates the complete set of printable +ascii characters in the correct order for the Hershey fonts (and therefore +the Type1 and TrueType fonts as well). + +We have improved how we access TrueType and Type1 fonts via the Hershey +font index (used by plpoin, plsym, and the Hershey escape sequences in pl*tex +commands). We have added considerably to the Hershey index to Unicode index +translation table both for the compact and extended Hershey indexing scheme, +and we have adopted the standard Unicode to Type1 index translation tables +from http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/. + +We have also dropped the momentary switch to symbol font that was +implemented in the PLplot core library. That switch was designed to partially +compensate for the lack of symbol glyphs in the standard Type1 fonts. That +was a bad design because it affected TrueType font devices as well as +the desired Type1 font devices. To replace this bad idea we now +change from Type1 standard fonts to the Type1 Symbol font (and vice +versa) whenever there is a glyph lookup failure in the Type1 font +device drivers (ps and pdf). + + PLplot Release 5.9.5 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts Modified: trunk/README.release =================================================================== --- trunk/README.release 2010-06-05 15:30:25 UTC (rev 11058) +++ trunk/README.release 2010-06-05 17:23:12 UTC (rev 11059) @@ -1,4 +1,4 @@ -PLplot Release 5.9.6 +PLplot Release 5.9.7 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development @@ -184,19 +184,10 @@ INDEX -0. Tests made for release 5.9.6 +0. Tests made for release 5.9.7 -1. Changes relative to PLplot 5.9.5 (the previous development release) +1. Changes relative to PLplot 5.9.6 (the previous development release) -1.1 Make PLplot aware of LC_NUMERIC locale -1.2 Linear gradients have been implemented -1.3 Cairo Windows driver implemented -1.4 Custom axis labeling implemented -1.5 Universal coordinate transform implemented -1.6 Support for arbitrary storage of 2D user data -1.7 Font improvements - - 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed @@ -245,191 +236,15 @@ 2.42 Font improvements -0. Tests made for release 5.9.6 +0. Tests made for release 5.9.7 See http://www.miscdebris.net/plplot_wiki/index.php?title=Testing_PLplot#Testing_Reports for a summary table of all testing done for PLplot-5.9.6. -1. Changes relative to PLplot 5.9.5 (the previous development release) +1. Changes relative to PLplot 5.9.6 (the previous development release) -1.1 Make PLplot aware of LC_NUMERIC locale -For POSIX-compliant systems, locale is set globally so any external -applications or libraries that use the PLplot library or any external -libraries used by the PLplot library or PLplot device drivers could -potentially change the LC_NUMERIC locale used by PLplot to anything those -external applicat... [truncated message content] |
From: <hba...@us...> - 2010-07-16 18:28:44
|
Revision: 11090 http://plplot.svn.sourceforge.net/plplot/?rev=11090&view=rev Author: hbabcock Date: 2010-07-16 18:28:37 +0000 (Fri, 16 Jul 2010) Log Message: ----------- Apply Simon's patch to add plsmem support to the Python binding. Modify the Python build system to check for a recent enough version of swig and Python to build plsmem properly. Modified Paths: -------------- trunk/bindings/python/CMakeLists.txt trunk/bindings/python/Plframe.py trunk/bindings/swig-support/plplotcapi.i trunk/cmake/modules/python.cmake Modified: trunk/bindings/python/CMakeLists.txt =================================================================== --- trunk/bindings/python/CMakeLists.txt 2010-07-15 22:14:33 UTC (rev 11089) +++ trunk/bindings/python/CMakeLists.txt 2010-07-16 18:28:37 UTC (rev 11090) @@ -64,6 +64,10 @@ set(CMAKE_SWIG_FLAGS -DSWIG_PYTHON) endif(PL_DOUBLE) + if(PYTHON_HAVE_PYBUFFER) + set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -DPYTHON_HAVE_PYBUFFER) + endif(PYTHON_HAVE_PYBUFFER) + set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}) set(SWIG_MODULE_plplotcmodule_EXTRA_DEPS Modified: trunk/bindings/python/Plframe.py =================================================================== --- trunk/bindings/python/Plframe.py 2010-07-15 22:14:33 UTC (rev 11089) +++ trunk/bindings/python/Plframe.py 2010-07-16 18:28:37 UTC (rev 11090) @@ -1249,6 +1249,9 @@ ## min_col, min_wid, max_col, max_wid, rect, ## pltr, xg, yg, wrap ) + def plsmem( ny, ny, plotmem ): + s.cmd('plsmem', nx, ny plotmem ) + def plssub( s, nx, ny ): s.cmd( 'plssub', nx, ny ) Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2010-07-15 22:14:33 UTC (rev 11089) +++ trunk/bindings/swig-support/plplotcapi.i 2010-07-16 18:28:37 UTC (rev 11090) @@ -774,14 +774,15 @@ void plsmaj(PLFLT def, PLFLT scale); -#if 0 -/* plsmem not implemented because don't know how to make block -of memory available from python. */ -%feature("autodoc", "Set the memory area to be plotted (with the 'mem' -driver).") plsmem +#ifdef PYTHON_HAVE_PYBUFFER +%include <pybuffer.i> +%pybuffer_mutable_string(void * plotmem) + +%feature("autodoc", "Set the memory area to be plotted (with the 'mem' driver).") plsmem; void plsmem(PLINT maxx, PLINT maxy, void *plotmem); + #endif %feature("autodoc", "Set up lengths of minor tick marks.") plsmin; Modified: trunk/cmake/modules/python.cmake =================================================================== --- trunk/cmake/modules/python.cmake 2010-07-15 22:14:33 UTC (rev 11089) +++ trunk/cmake/modules/python.cmake 2010-07-16 18:28:37 UTC (rev 11090) @@ -156,4 +156,27 @@ OUTPUT_VARIABLE PYTHON_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE ) + # Get the Python version. + execute_process( + COMMAND + ${PYTHON_EXECUTABLE} -c "import sys; print sys.version.split()[0]" + OUTPUT_VARIABLE PYTHON_version_output + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + SET(PYTHON_VERSION ${PYTHON_version_output} CACHE STRING "Python version") + + # Enable plsmem if the Python and Swig versions support it + transform_version(NUMERICAL_SWIG_MINIMUM_VERSION_FOR_PLSMEM "1.3.38") + transform_version(NUMERICAL_PYTHON_MINIMUM_VERSION_FOR_PLSMEM "2.6.0") + transform_version(NUMERICAL_SWIG_VERSION "${SWIG_VERSION}") + transform_version(NUMERICAL_PYTHON_VERSION "${PYTHON_version_output}") + + SET(PYTHON_HAVE_PYBUFFER OFF) + IF(NUMERICAL_SWIG_MINIMUM_VERSION_FOR_PLSMEM LESS NUMERICAL_SWIG_VERSION) + IF(NUMERICAL_PYTHON_MINIMUM_VERSION_FOR_PLSMEM LESS NUMERICAL_PYTHON_VERSION) + message(STATUS "Building Python binding with plsmem() support") + SET(PYTHON_HAVE_PYBUFFER ON) + ENDIF(NUMERICAL_PYTHON_MINIMUM_VERSION_FOR_PLSMEM LESS NUMERICAL_PYTHON_VERSION) + ENDIF(NUMERICAL_SWIG_MINIMUM_VERSION_FOR_PLSMEM LESS NUMERICAL_SWIG_VERSION) + endif(ENABLE_python) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-07-22 10:59:02
|
Revision: 11095 http://plplot.svn.sourceforge.net/plplot/?rev=11095&view=rev Author: jbauck Date: 2010-07-22 10:58:54 +0000 (Thu, 22 Jul 2010) Log Message: ----------- Removed "Ada 2007" cmake flags (delimited with @) from all of the pseudo-Ada files (files ending in .ads.cmake and .adb.cmake) that had it (68 out of 70). This removes the trivial need to link BLAS and LAPACK libraries when Ada 2005 (called Ada 2007 in most of PLplot) is detected. This should cause absolutely no behavior changes in the Ada part of PLplot. However, the Ada files (examples and bindings) still end in .ads.cmake or .adb.cmake and will need to have .cmake removed and corresponding changes made to the build system. Modified Paths: -------------- trunk/bindings/ada/plplot.adb.cmake trunk/bindings/ada/plplot.ads.cmake trunk/bindings/ada/plplot_auxiliary.ads.cmake trunk/bindings/ada/plplot_thin.ads.cmake trunk/bindings/ada/plplot_traditional.adb.cmake trunk/bindings/ada/plplot_traditional.ads.cmake trunk/examples/ada/x01a.adb.cmake trunk/examples/ada/x02a.adb.cmake trunk/examples/ada/x03a.adb.cmake trunk/examples/ada/x04a.adb.cmake trunk/examples/ada/x05a.adb.cmake trunk/examples/ada/x06a.adb.cmake trunk/examples/ada/x07a.adb.cmake trunk/examples/ada/x08a.adb.cmake trunk/examples/ada/x09a.adb.cmake trunk/examples/ada/x10a.adb.cmake trunk/examples/ada/x11a.adb.cmake trunk/examples/ada/x12a.adb.cmake trunk/examples/ada/x13a.adb.cmake trunk/examples/ada/x14a.adb.cmake trunk/examples/ada/x15a.adb.cmake trunk/examples/ada/x16a.adb.cmake trunk/examples/ada/x17a.adb.cmake trunk/examples/ada/x18a.adb.cmake trunk/examples/ada/x19a.adb.cmake trunk/examples/ada/x20a.adb.cmake trunk/examples/ada/x21a.adb.cmake trunk/examples/ada/x22a.adb.cmake trunk/examples/ada/x23a.adb.cmake trunk/examples/ada/x24a.adb.cmake trunk/examples/ada/x25a.adb.cmake trunk/examples/ada/x26a.adb.cmake trunk/examples/ada/x27a.adb.cmake trunk/examples/ada/x28a.adb.cmake trunk/examples/ada/x29a.adb.cmake trunk/examples/ada/x30a.adb.cmake trunk/examples/ada/x31a.adb.cmake trunk/examples/ada/xthick01a.adb.cmake trunk/examples/ada/xthick02a.adb.cmake trunk/examples/ada/xthick03a.adb.cmake trunk/examples/ada/xthick04a.adb.cmake trunk/examples/ada/xthick05a.adb.cmake trunk/examples/ada/xthick06a.adb.cmake trunk/examples/ada/xthick07a.adb.cmake trunk/examples/ada/xthick08a.adb.cmake trunk/examples/ada/xthick09a.adb.cmake trunk/examples/ada/xthick10a.adb.cmake trunk/examples/ada/xthick11a.adb.cmake trunk/examples/ada/xthick12a.adb.cmake trunk/examples/ada/xthick13a.adb.cmake trunk/examples/ada/xthick14a.adb.cmake trunk/examples/ada/xthick15a.adb.cmake trunk/examples/ada/xthick16a.adb.cmake trunk/examples/ada/xthick17a.adb.cmake trunk/examples/ada/xthick18a.adb.cmake trunk/examples/ada/xthick19a.adb.cmake trunk/examples/ada/xthick20a.adb.cmake trunk/examples/ada/xthick21a.adb.cmake trunk/examples/ada/xthick22a.adb.cmake trunk/examples/ada/xthick23a.adb.cmake trunk/examples/ada/xthick24a.adb.cmake trunk/examples/ada/xthick25a.adb.cmake trunk/examples/ada/xthick26a.adb.cmake trunk/examples/ada/xthick27a.adb.cmake trunk/examples/ada/xthick28a.adb.cmake trunk/examples/ada/xthick29a.adb.cmake trunk/examples/ada/xthick30a.adb.cmake trunk/examples/ada/xthick31a.adb.cmake Modified: trunk/bindings/ada/plplot.adb.cmake =================================================================== --- trunk/bindings/ada/plplot.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/bindings/ada/plplot.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -41,8 +41,8 @@ Ada.Strings.Unbounded, Interfaces.C; -@Ada_Is_2007_With_and_Use_Numerics@ + package body PLplot is -------------------------------------------------------------------------------- Modified: trunk/bindings/ada/plplot.ads.cmake =================================================================== --- trunk/bindings/ada/plplot.ads.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/bindings/ada/plplot.ads.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -32,8 +32,8 @@ PLplot_Auxiliary, Ada.Strings.Unbounded; -@Ada_Is_2007_With_and_Use_Numerics@ + package PLplot is -- Used with Set_Device_Window_Parameters. Modified: trunk/bindings/ada/plplot_auxiliary.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_auxiliary.ads.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/bindings/ada/plplot_auxiliary.ads.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -29,8 +29,8 @@ Ada.Strings.Bounded, Ada.Strings.Unbounded; -@Ada_Is_2007_With_and_Use_Numerics@ + package PLplot_Auxiliary is -------------------------------------------------------------------------------- @@ -47,7 +47,7 @@ -- and plplot_thin.ads. -- type Real_Vector is array (Integer range <>) of Long_Float; -- type Real_Matrix is array (Integer range <>, Integer range <>) of Long_Float; -@Ada_Is_Not_2007_Vector_Matrix_Declarations@ + type Real_Vector is array (Integer range <>) of Long_Float; type Real_Matrix is array (Integer range <>, Integer range <>) of Long_Float; -------------------------------------------------------------------------------- Modified: trunk/bindings/ada/plplot_thin.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_thin.ads.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/bindings/ada/plplot_thin.ads.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -49,7 +49,7 @@ Ada.Strings.Bounded, Ada.Strings.Unbounded; -@Ada_Is_2007_With_and_Use_Numerics@ + package PLplot_Thin is subtype PLINT is Integer; Modified: trunk/bindings/ada/plplot_traditional.adb.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/bindings/ada/plplot_traditional.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -40,8 +40,8 @@ Ada.Strings.Unbounded, Interfaces.C; -@Ada_Is_2007_With_and_Use_Numerics@ + package body PLplot_Traditional is -------------------------------------------------------------------------------- Modified: trunk/bindings/ada/plplot_traditional.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.ads.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/bindings/ada/plplot_traditional.ads.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -32,8 +32,8 @@ PLplot_Auxiliary, Ada.Strings.Unbounded; -@Ada_Is_2007_With_and_Use_Numerics@ + package PLplot_Traditional is -- Used with plsdidev. Modified: trunk/examples/ada/x01a.adb.cmake =================================================================== --- trunk/examples/ada/x01a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x01a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -33,8 +33,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x01a is xs, ys : Real_Vector (0 .. 5); xscale, yscale, xoff, yoff : Long_Float; Modified: trunk/examples/ada/x02a.adb.cmake =================================================================== --- trunk/examples/ada/x02a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x02a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -36,8 +36,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + ------------------------------------------------------------------------------ -- Demonstrates multiple windows and color map 0 palette, both default and -- user-modified. Modified: trunk/examples/ada/x03a.adb.cmake =================================================================== --- trunk/examples/ada/x03a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x03a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -36,8 +36,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x03a is dtr, theta, dx, dy, r, offset : Long_Float; x0, y0 : Real_Vector(0..360); Modified: trunk/examples/ada/x04a.adb.cmake =================================================================== --- trunk/examples/ada/x04a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x04a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x04a is procedure plot1(Plot_Type : Integer) is Modified: trunk/examples/ada/x05a.adb.cmake =================================================================== --- trunk/examples/ada/x05a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x05a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -32,8 +32,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x05a is NPTS : constant Integer := 2047; data : Real_Vector(0 .. NPTS - 1); Modified: trunk/examples/ada/x06a.adb.cmake =================================================================== --- trunk/examples/ada/x06a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x06a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -35,8 +35,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x06a is k, maxfont : Integer; Modified: trunk/examples/ada/x07a.adb.cmake =================================================================== --- trunk/examples/ada/x07a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x07a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -35,8 +35,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x07a is k : Integer; Modified: trunk/examples/ada/x08a.adb.cmake =================================================================== --- trunk/examples/ada/x08a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x08a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot_Traditional, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x08a is XPTS : Integer := 35; Modified: trunk/examples/ada/x09a.adb.cmake =================================================================== --- trunk/examples/ada/x09a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x09a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -33,8 +33,8 @@ PLplot_Traditional, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + -------------------------------------------------------------------------- -- Does several contour plots using different coordinate mappings. -------------------------------------------------------------------------- Modified: trunk/examples/ada/x10a.adb.cmake =================================================================== --- trunk/examples/ada/x10a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x10a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x10a is begin -- Parse and process command line arguments Modified: trunk/examples/ada/x11a.adb.cmake =================================================================== --- trunk/examples/ada/x11a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x11a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot_Traditional, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x11a is XPTS : constant Integer := 35; -- Data points in x YPTS : constant Integer := 46; -- Data points in y Modified: trunk/examples/ada/x12a.adb.cmake =================================================================== --- trunk/examples/ada/x12a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x12a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -36,8 +36,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + ------------------------------------------------------------------------------ -- Does a simple bar chart, using color fill. If color fill is -- unavailable, pattern fill is used instead (automatic). Modified: trunk/examples/ada/x13a.adb.cmake =================================================================== --- trunk/examples/ada/x13a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x13a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + ------------------------------------------------------------------------------ -- Does a simple pie chart. ------------------------------------------------------------------------------ Modified: trunk/examples/ada/x14a.adb.cmake =================================================================== --- trunk/examples/ada/x14a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x14a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -43,8 +43,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + ------------------------------------------------------------------------------ -- Plots several simple functions from other example programs. -- Modified: trunk/examples/ada/x15a.adb.cmake =================================================================== --- trunk/examples/ada/x15a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x15a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -36,8 +36,8 @@ PLplot_Traditional, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x15a is XPTS : constant Integer := 35; -- Data points in x YPTS : constant Integer := 46; -- Data points in y Modified: trunk/examples/ada/x16a.adb.cmake =================================================================== --- trunk/examples/ada/x16a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x16a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -36,8 +36,8 @@ PLplot_Traditional, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x16a is -- Fundamental settings. See notes() for more info. ns : Integer := 20; -- Default number of shade levels Modified: trunk/examples/ada/x17a.adb.cmake =================================================================== --- trunk/examples/ada/x17a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x17a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -35,8 +35,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x17a is autoy, acc : Boolean; pl_errcode : Integer := 0; Modified: trunk/examples/ada/x18a.adb.cmake =================================================================== --- trunk/examples/ada/x18a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x18a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -36,8 +36,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x18a is ---------------------------------------------------------------------------- -- Does a series of 3-d plots for a given data set, with different Modified: trunk/examples/ada/x19a.adb.cmake =================================================================== --- trunk/examples/ada/x19a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x19a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -42,8 +42,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + -- Shows two views of the world map. procedure x19a is minx, maxx, miny, maxy : Long_Float; Modified: trunk/examples/ada/x20a.adb.cmake =================================================================== --- trunk/examples/ada/x20a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x20a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -38,8 +38,8 @@ PLplot_Traditional, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x20a is XDIM : constant Integer := 260; Modified: trunk/examples/ada/x21a.adb.cmake =================================================================== --- trunk/examples/ada/x21a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x21a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -45,8 +45,8 @@ PLplot_Traditional, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x21a is pts : Integer := 500; xp : Integer := 25; Modified: trunk/examples/ada/x22a.adb.cmake =================================================================== --- trunk/examples/ada/x22a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x22a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -33,8 +33,8 @@ PLplot_Traditional, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x22a is -- Pairs of points making the line segments used to plot the user defined arrow arrow_x : Real_Vector(0 .. 5) := (-0.5, 0.5, 0.3, 0.5, 0.3, 0.5); Modified: trunk/examples/ada/x23a.adb.cmake =================================================================== --- trunk/examples/ada/x23a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x23a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -42,8 +42,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x23a is Greek : array(0 .. 47) of String(1 .. 3) := ( Modified: trunk/examples/ada/x24a.adb.cmake =================================================================== --- trunk/examples/ada/x24a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x24a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -27,8 +27,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x24a is red : Integer_Array_1D(0 .. 6) := (240, 204, 204, 204, 0, 39, 125); green : Integer_Array_1D(0 .. 6) := (240, 0, 125, 204, 204, 80, 0); Modified: trunk/examples/ada/x25a.adb.cmake =================================================================== --- trunk/examples/ada/x25a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x25a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -27,8 +27,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + -- Test program for filling polygons and proper clipping procedure x25a is npts : Integer := 0; Modified: trunk/examples/ada/x26a.adb.cmake =================================================================== --- trunk/examples/ada/x26a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x26a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -65,8 +65,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x26a is function x_label(which : Integer) return String is Modified: trunk/examples/ada/x27a.adb.cmake =================================================================== --- trunk/examples/ada/x27a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x27a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -29,8 +29,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + ------------------------------------------------------------------------------ -- Generates two kinds of plots: -- - construction of a cycloid (animated) Modified: trunk/examples/ada/x28a.adb.cmake =================================================================== --- trunk/examples/ada/x28a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x28a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + -- Demonstrates plotting text in 3D. procedure x28a is -- Choose these values to correspond to tick marks. Modified: trunk/examples/ada/x29a.adb.cmake =================================================================== --- trunk/examples/ada/x29a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x29a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -33,8 +33,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + -------------------------------------------------------------------------------- -- Draws several plots which demonstrate the use of date / time formats for -- the axis labels. Modified: trunk/examples/ada/x30a.adb.cmake =================================================================== --- trunk/examples/ada/x30a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x30a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -33,8 +33,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure x30a is red : Integer_Array_1D(0 .. 3) := ( 0, 255, 0, 0); green : Integer_Array_1D(0 .. 3) := ( 0, 0, 255, 0); Modified: trunk/examples/ada/x31a.adb.cmake =================================================================== --- trunk/examples/ada/x31a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/x31a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -41,8 +41,8 @@ PLplot_Auxiliary, PLplot_Traditional; -@Ada_Is_2007_With_and_Use_Numerics@ + -- This example mostly outputs text. As part of the PLplot testing regime, we -- require that the text output match that of the C version, x31c.c, exactly. -- Therefore, certain extra measures were made in this Ada version to assure Modified: trunk/examples/ada/xthick01a.adb.cmake =================================================================== --- trunk/examples/ada/xthick01a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick01a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -33,8 +33,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick01a is xs, ys : Real_Vector (0 .. 5); xscale, yscale, xoff, yoff : Long_Float; Modified: trunk/examples/ada/xthick02a.adb.cmake =================================================================== --- trunk/examples/ada/xthick02a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick02a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -36,8 +36,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + ------------------------------------------------------------------------------ -- Demonstrates multiple windows and color map 0 palette, both default and -- user-modified. Modified: trunk/examples/ada/xthick03a.adb.cmake =================================================================== --- trunk/examples/ada/xthick03a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick03a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -36,8 +36,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick03a is dtr, theta, dx, dy, r, offset : Long_Float; x0, y0 : Real_Vector(0..360); Modified: trunk/examples/ada/xthick04a.adb.cmake =================================================================== --- trunk/examples/ada/xthick04a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick04a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick04a is procedure plot1(Plot_Type : Integer) is Modified: trunk/examples/ada/xthick05a.adb.cmake =================================================================== --- trunk/examples/ada/xthick05a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick05a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -32,8 +32,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick05a is NPTS : constant Integer := 2047; data : Real_Vector(0 .. NPTS - 1); Modified: trunk/examples/ada/xthick06a.adb.cmake =================================================================== --- trunk/examples/ada/xthick06a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick06a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -35,8 +35,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick06a is k, maxfont : Integer; Modified: trunk/examples/ada/xthick07a.adb.cmake =================================================================== --- trunk/examples/ada/xthick07a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick07a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -35,8 +35,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick07a is k : Integer; Modified: trunk/examples/ada/xthick08a.adb.cmake =================================================================== --- trunk/examples/ada/xthick08a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick08a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick08a is XPTS : Integer := 35; Modified: trunk/examples/ada/xthick09a.adb.cmake =================================================================== --- trunk/examples/ada/xthick09a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick09a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -33,8 +33,8 @@ PLplot, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + -------------------------------------------------------------------------- -- Does several contour plots using different coordinate mappings. -------------------------------------------------------------------------- Modified: trunk/examples/ada/xthick10a.adb.cmake =================================================================== --- trunk/examples/ada/xthick10a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick10a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick10a is begin -- Parse and process command line arguments Modified: trunk/examples/ada/xthick11a.adb.cmake =================================================================== --- trunk/examples/ada/xthick11a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick11a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick11a is XPTS : constant Integer := 35; -- Data points in x YPTS : constant Integer := 46; -- Data points in y Modified: trunk/examples/ada/xthick12a.adb.cmake =================================================================== --- trunk/examples/ada/xthick12a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick12a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -35,8 +35,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + ------------------------------------------------------------------------------ -- Does a simple bar chart, using color fill. If color fill is -- unavailable, pattern fill is used instead (automatic). Modified: trunk/examples/ada/xthick13a.adb.cmake =================================================================== --- trunk/examples/ada/xthick13a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick13a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + ------------------------------------------------------------------------------ -- Does a simple pie chart. ------------------------------------------------------------------------------ Modified: trunk/examples/ada/xthick14a.adb.cmake =================================================================== --- trunk/examples/ada/xthick14a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick14a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -43,8 +43,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + ------------------------------------------------------------------------------ -- Plots several simple functions from other example programs. -- Modified: trunk/examples/ada/xthick15a.adb.cmake =================================================================== --- trunk/examples/ada/xthick15a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick15a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -36,8 +36,8 @@ PLplot, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick15a is XPTS : constant Integer := 35; -- Data points in x YPTS : constant Integer := 46; -- Data points in y Modified: trunk/examples/ada/xthick16a.adb.cmake =================================================================== --- trunk/examples/ada/xthick16a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick16a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -36,8 +36,8 @@ PLplot, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick16a is -- Fundamental settings. See notes() for more info. ns : Integer := 20; -- Default number of shade levels Modified: trunk/examples/ada/xthick17a.adb.cmake =================================================================== --- trunk/examples/ada/xthick17a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick17a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -35,8 +35,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick17a is autoy, acc : Boolean; pl_errcode : Integer := 0; Modified: trunk/examples/ada/xthick18a.adb.cmake =================================================================== --- trunk/examples/ada/xthick18a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick18a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -36,8 +36,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick18a is ---------------------------------------------------------------------------- -- Does a series of 3-d plots for a given data set, with different Modified: trunk/examples/ada/xthick19a.adb.cmake =================================================================== --- trunk/examples/ada/xthick19a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick19a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -42,8 +42,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + -- Shows two views of the world map. procedure xthick19a is minx, maxx, miny, maxy : Long_Float; Modified: trunk/examples/ada/xthick20a.adb.cmake =================================================================== --- trunk/examples/ada/xthick20a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick20a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -38,8 +38,8 @@ PLplot, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick20a is XDIM : constant Integer := 260; Modified: trunk/examples/ada/xthick21a.adb.cmake =================================================================== --- trunk/examples/ada/xthick21a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick21a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -45,8 +45,8 @@ PLplot, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick21a is pts : Integer := 500; xp : Integer := 25; Modified: trunk/examples/ada/xthick22a.adb.cmake =================================================================== --- trunk/examples/ada/xthick22a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick22a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -33,8 +33,8 @@ PLplot, PLplot_Auxiliary; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick22a is -- Pairs of points making the line segments used to plot the user defined arrow arrow_x : Real_Vector(0 .. 5) := (-0.5, 0.5, 0.3, 0.5, 0.3, 0.5); Modified: trunk/examples/ada/xthick23a.adb.cmake =================================================================== --- trunk/examples/ada/xthick23a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick23a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -42,8 +42,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick23a is Greek : array(0 .. 47) of String(1 .. 3) := ( Modified: trunk/examples/ada/xthick24a.adb.cmake =================================================================== --- trunk/examples/ada/xthick24a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick24a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -27,8 +27,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick24a is red : Integer_Array_1D(0 .. 6) := (240, 204, 204, 204, 0, 39, 125); green : Integer_Array_1D(0 .. 6) := (240, 0, 125, 204, 204, 80, 0); Modified: trunk/examples/ada/xthick25a.adb.cmake =================================================================== --- trunk/examples/ada/xthick25a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick25a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -27,8 +27,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + -- Test program for filling polygons and proper clipping procedure xthick25a is npts : Integer := 0; Modified: trunk/examples/ada/xthick26a.adb.cmake =================================================================== --- trunk/examples/ada/xthick26a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick26a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -65,8 +65,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick26a is function x_label(which : Integer) return String is Modified: trunk/examples/ada/xthick27a.adb.cmake =================================================================== --- trunk/examples/ada/xthick27a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick27a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -29,8 +29,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + ------------------------------------------------------------------------------ -- Generates two kinds of plots: -- - construction of a cycloid (animated) Modified: trunk/examples/ada/xthick28a.adb.cmake =================================================================== --- trunk/examples/ada/xthick28a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick28a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -31,8 +31,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + -- Demonstrates plotting text in 3D. procedure xthick28a is -- Choose these values to correspond to tick marks. Modified: trunk/examples/ada/xthick29a.adb.cmake =================================================================== --- trunk/examples/ada/xthick29a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick29a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -33,8 +33,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + -------------------------------------------------------------------------------- -- Draws several plots which demonstrate the use of date / time formats for -- the axis labels. Modified: trunk/examples/ada/xthick30a.adb.cmake =================================================================== --- trunk/examples/ada/xthick30a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick30a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -33,8 +33,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + procedure xthick30a is red : Integer_Array_1D(0 .. 3) := ( 0, 255, 0, 0); green : Integer_Array_1D(0 .. 3) := ( 0, 0, 255, 0); Modified: trunk/examples/ada/xthick31a.adb.cmake =================================================================== --- trunk/examples/ada/xthick31a.adb.cmake 2010-07-21 19:10:59 UTC (rev 11094) +++ trunk/examples/ada/xthick31a.adb.cmake 2010-07-22 10:58:54 UTC (rev 11095) @@ -41,8 +41,8 @@ PLplot_Auxiliary, PLplot; -@Ada_Is_2007_With_and_Use_Numerics@ + -- This example mostly outputs text. As part of the PLplot testing regime, we -- require that the text output match that of the C version, x31c.c, exactly. -- Therefore, certain extra measures were made in this Ada version to assure This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-07-22 17:38:53
|
Revision: 11097 http://plplot.svn.sourceforge.net/plplot/?rev=11097&view=rev Author: airwin Date: 2010-07-22 17:38:46 +0000 (Thu, 22 Jul 2010) Log Message: ----------- Previous commit by Jerry removed all configurable items from Ada bindings source files so that the configure of those source files got turned into a copy. Strip out this configure=copy for the Ada bindings source files (but not the examples) and adjust the Ada examples build accordingly for the changed directory for the source. N.B. the result passes the "make test_diff_psc" test, but other tests (e.g., installed examples tests) have not been done yet. Furthermore, the equivalent stripping out of the configure=copy step in the Ada examples has not been done yet. Modified Paths: -------------- trunk/bindings/ada/CMakeLists.txt trunk/examples/ada/CMakeLists.txt Added Paths: ----------- trunk/bindings/ada/plplot.adb trunk/bindings/ada/plplot.ads trunk/bindings/ada/plplot_auxiliary.adb trunk/bindings/ada/plplot_auxiliary.ads trunk/bindings/ada/plplot_thin.adb trunk/bindings/ada/plplot_thin.ads trunk/bindings/ada/plplot_traditional.adb trunk/bindings/ada/plplot_traditional.ads Removed Paths: ------------- trunk/bindings/ada/plplot.adb.cmake trunk/bindings/ada/plplot.ads.cmake trunk/bindings/ada/plplot_auxiliary.adb.cmake trunk/bindings/ada/plplot_auxiliary.ads.cmake trunk/bindings/ada/plplot_thin.adb.cmake trunk/bindings/ada/plplot_thin.ads.cmake trunk/bindings/ada/plplot_traditional.adb.cmake trunk/bindings/ada/plplot_traditional.ads.cmake Modified: trunk/bindings/ada/CMakeLists.txt =================================================================== --- trunk/bindings/ada/CMakeLists.txt 2010-07-22 11:06:33 UTC (rev 11096) +++ trunk/bindings/ada/CMakeLists.txt 2010-07-22 17:38:46 UTC (rev 11097) @@ -49,12 +49,8 @@ set(plplotada${LIB_TAG}_LIB_SRCS) foreach(SOURCE_FILE ${SOURCE_LIST}) - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} - ) list(APPEND plplotada${LIB_TAG}_LIB_SRCS - ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} + ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE} ) endforeach(SOURCE_FILE ${SOURCE_LIST}) Copied: trunk/bindings/ada/plplot.adb (from rev 11096, trunk/bindings/ada/plplot.adb.cmake) =================================================================== --- trunk/bindings/ada/plplot.adb (rev 0) +++ trunk/bindings/ada/plplot.adb 2010-07-22 17:38:46 UTC (rev 11097) @@ -0,0 +1,3369 @@ +-- $Id$ + +-- Thick Ada binding to PLplot + +-- Copyright (C) 2006-2007 Jerry Bauck + +-- This file is part of PLplot. + +-- PLplot is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Library Public License as published +-- by the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. + +-- PLplot is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Library General Public License for more details. + +-- You should have received a copy of the GNU Library General Public License +-- along with PLplot; if not, write to the Free Software +-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +with + PLplot_Thin, + PLplot_Auxiliary, + Ada.Text_IO, + Ada.Numerics.Long_Elementary_Functions, + Ada.Strings.Unbounded, + Ada.Unchecked_Conversion, + Ada.Strings.Maps, + Ada.Command_Line, + System, + System.Address_To_Access_Conversions, + Interfaces.C.Pointers, + Interfaces.C; +use + PLplot_Thin, + PLplot_Auxiliary, + Ada.Text_IO, + Ada.Numerics.Long_Elementary_Functions, + Ada.Strings.Unbounded, + Interfaces.C; + + + +package body PLplot is + +-------------------------------------------------------------------------------- +-- High-Level subroutines for thick binding -- +-------------------------------------------------------------------------------- + + -- When asked to draw white lines on black background, do it. + -- This is the default. + procedure Draw_On_Black is + begin + Set_One_Color_Map_0(Black, 0, 0 , 0); + Set_One_Color_Map_0(White, 255, 255, 255); + end Draw_On_Black; + + + -- When asked to draw black lines on white background, reverse black and white. + -- This might look better on anti-aliased displays. + -- fix this Darken some colors which have low contrast on white background, e.g. Yellow. + -- fix this Make a version that draws on white and converts _all_ colors to black for publications. + -- fix this Make this so that it works on Color Map 1 because as of now, it does + -- not change the background color for e.g. surface plots. See also Draw_On_Black. + procedure Draw_On_White is + begin + Set_One_Color_Map_0(Black, 255, 255, 255); + Set_One_Color_Map_0(White, 0, 0, 0); + end Draw_On_White; + + + -- Set default pen width. Docs don't say, so I'll make it 1. + -- I could make this depend on the type of outut device used. + Default_Pen_Width : constant Integer := 1; + procedure Set_Default_Pen_Width is + begin + Set_Pen_Width(Default_Pen_Width); + end Set_Default_Pen_Width; + + + -- Plotter for up to five x-y pairs and settable axis style, plot + -- line colors, widths, and styles, justification, zoom, and labels. + -- Can be used directly or as part of a "simple" plotter + -- such as those that follow or which are made by the user. + procedure Multiplot_Pairs + (x1 : Real_Vector := Dont_Plot_This; + y1 : Real_Vector := Dont_Plot_This; + x2 : Real_Vector := Dont_Plot_This; + y2 : Real_Vector := Dont_Plot_This; + x3 : Real_Vector := Dont_Plot_This; + y3 : Real_Vector := Dont_Plot_This; + x4 : Real_Vector := Dont_Plot_This; + y4 : Real_Vector := Dont_Plot_This; + x5 : Real_Vector := Dont_Plot_This; + y5 : Real_Vector := Dont_Plot_This; + X_Labels : Label_String_Array_Type := Default_Label_String_Array; + Y_Labels : Label_String_Array_Type := Default_Label_String_Array; + Title_Labels : Label_String_Array_Type := Default_Label_String_Array; + Axis_Style : Axis_Style_Type := Linear_Box_Plus; + Colors : Color_Array_Type := Default_Color_Array; + Line_Widths : Line_Width_Array_Type := Default_Line_Width_Array; + Line_Styles : Line_Style_Array_Type := Default_Line_Style_Array; + Justification : Justification_Type := Not_Justified; + x_Min_Zoom : Long_Float := Long_Float'small; + x_Max_Zoom : Long_Float := Long_Float'large; + y_Min_Zoom : Long_Float := Long_Float'small; + y_Max_Zoom : Long_Float := Long_Float'large) is + + x_Min, y_Min : Long_Float := Long_Float'large; + x_Max, y_Max : Long_Float := Long_Float'small; + + begin + -- Set or find x_Min. + if x_Min_Zoom /= Long_Float'small then -- zoom + x_Min := x_Min_Zoom; + else -- Auto-scale x_Min. + if x1'length /= 1 then + x_Min := Long_Float'min(x_Min, Vector_Min(x1)); + end if; + if x2'length /= 1 then + x_Min := Long_Float'min(x_Min, Vector_Min(x2)); + end if; + if x3'length /= 1 then + x_Min := Long_Float'min(x_Min, Vector_Min(x3)); + end if; + if x4'length /= 1 then + x_Min := Long_Float'min(x_Min, Vector_Min(x4)); + end if; + if x5'length /= 1 then + x_Min := Long_Float'min(x_Min, Vector_Min(x5)); + end if; + end if; -- Set or find x_Min. + + -- Set or find x_Max. + if x_Max_Zoom /= Long_Float'large then -- zoom + x_Max := x_Max_Zoom; + else -- Auto-scale x_Max. + if x1'length /= 1 then + x_Max := Long_Float'max(x_Max, Vector_Max(x1)); + end if; + if x2'length /= 1 then + x_Max := Long_Float'max(x_Max, Vector_Max(x2)); + end if; + if x3'length /= 1 then + x_Max := Long_Float'max(x_Max, Vector_Max(x3)); + end if; + if x4'length /= 1 then + x_Max := Long_Float'max(x_Max, Vector_Max(x4)); + end if; + if x5'length /= 1 then + x_Max := Long_Float'max(x_Max, Vector_Max(x5)); + end if; + end if; -- Set or find x_Max. + + -- Set or find y_Min. + if y_Min_Zoom /= Long_Float'small then -- zoom + y_Min := y_Min_Zoom; + else -- Auto-scale y_Min. + if y1'length /= 1 then + y_Min := Long_Float'min(y_Min, Vector_Min(y1)); + end if; + if y2'length /= 1 then + y_Min := Long_Float'min(y_Min, Vector_Min(y2)); + end if; + if y3'length /= 1 then + y_Min := Long_Float'min(y_Min, Vector_Min(y3)); + end if; + if y4'length /= 1 then + y_Min := Long_Float'min(y_Min, Vector_Min(y4)); + end if; + if y5'length /= 1 then + y_Min := Long_Float'min(y_Min, Vector_Min(y5)); + end if; + end if; -- Set or find y_Min. + + -- Set or find y_Max. + if y_Max_Zoom /= Long_Float'large then -- zoom + y_Max := y_Max_Zoom; + else -- Auto-scale y_Max. + if y1'length /= 1 then + y_Max := Long_Float'max(y_Max, Vector_Max(y1)); + end if; + if y2'length /= 1 then + y_Max := Long_Float'max(y_Max, Vector_Max(y2)); + end if; + if y3'length /= 1 then + y_Max := Long_Float'max(y_Max, Vector_Max(y3)); + end if; + if y4'length /= 1 then + y_Max := Long_Float'max(y_Max, Vector_Max(y4)); + end if; + if y5'length /= 1 then + y_Max := Long_Float'max(y_Max, Vector_Max(y5)); + end if; + end if; -- Set or find x_Max. + + + -- Set environment and its color. + Set_Pen_Color(White); +-- Set_Environment_Clear_Subpage(x_Min, x_Max, y_Min, y_Max, Justification, Axis_Style); + Set_Environment(x_Min, x_Max, y_Min, y_Max, Justification, Axis_Style); + + if x1'length /= 1 and y1'length /= 1 then + Write_Labels(To_String(X_Labels(1)), To_String(Y_Labels(1)), To_String(Title_Labels(1))); + Set_Pen_Color(Colors(1)); + Select_Line_Style(Line_Styles(1)); + Draw_Curve(x1, y1); +--Draw_Hershey_Symbol(x1, y1, 850); +--Draw_Points(x1, y1, 17); -- 17 is "Hershey bullet, same as 850 when using Draw_Hershey. + end if; + + if x2'length /= 1 and y2'length /= 1 then + Write_Labels(To_String(X_Labels(2)), To_String(Y_Labels(2)), To_String(Title_Labels(2))); + Set_Pen_Color(Colors(2)); + Select_Line_Style(Line_Styles(2)); + Draw_Curve(x2, y2); + end if; + + if x3'length /= 1 and y3'length /= 1 then + Write_Labels(To_String(X_Labels(3)), To_String(Y_Labels(3)), To_String(Title_Labels(3))); + Set_Pen_Color(Colors(3)); + Select_Line_Style(Line_Styles(3)); + Draw_Curve(x3, y3); + end if; + + if x4'length /= 1 and y4'length /= 1 then + Write_Labels(To_String(X_Labels(4)), To_String(Y_Labels(4)), To_String(Title_Labels(4))); + Set_Pen_Color(Colors(4)); + Select_Line_Style(Line_Styles(4)); + Draw_Curve(x4, y4); + end if; + + if x5'length /= 1 and y5'length /= 1 then + Write_Labels(To_String(X_Labels(5)), To_String(Y_Labels(5)), To_String(Title_Labels(5))); + Set_Pen_Color(Colors(5)); + Select_Line_Style(Line_Styles(5)); + Draw_Curve(x5, y5); + end if; + + Set_Pen_Color(White); + Set_Default_Pen_Width; + Select_Line_Style(1); --solid + end Multiplot_Pairs; + + +--------- Simple plotters requiring minimal arguments ----- + + + -- Simple plotter for single x array and multiple y arrays + procedure Simple_Plot + (x : Real_Vector; + y1 : Real_Vector := Dont_Plot_This; + y2 : Real_Vector := Dont_Plot_This; + y3 : Real_Vector := Dont_Plot_This; + y4 : Real_Vector := Dont_Plot_This; + y5 : Real_Vector := Dont_Plot_This; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String)) is + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + + Multiplot_Pairs(x, y1, x, y2, x, y3, x, y4, x, y5, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Linear_Major_Grid); + end Simple_Plot; + + + -- Simple log x plotter for single x array and multiple y arrays + -- fix this: Automatically skip zero-valued abscissa; place marker at the + -- left-hand side of the plot at the ordinate of the deleted point. + procedure Simple_Plot_Log_X + (x : Real_Vector; + y1 : Real_Vector := Dont_Plot_This; + y2 : Real_Vector := Dont_Plot_This; + y3 : Real_Vector := Dont_Plot_This; + y4 : Real_Vector := Dont_Plot_This; + y5 : Real_Vector := Dont_Plot_This; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0) is -- Should this default to e? + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + + x_Log : Real_Vector(x'range); + + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + + for i in x_Log'range loop + x_Log(i) := Log(x(i), Log_Base); + end loop; + Multiplot_Pairs(x_Log, y1, x_Log, y2, x_Log, y3, x_Log, y4, x_Log, y5, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Log_X_Minor_Grid); + end Simple_Plot_Log_X; + + + -- Simple log y plotter for multiple x arrays and single y array + -- fix this: Automatically skip zero-valued ordinate; place marker at the + -- bottom of the plot at the abscissa of the deleted point. + procedure Simple_Plot_Log_Y + (x1 : Real_Vector := Dont_Plot_This; + y : Real_Vector := Dont_Plot_This; -- Beware of argument order. + x2 : Real_Vector := Dont_Plot_This; + x3 : Real_Vector := Dont_Plot_This; + x4 : Real_Vector := Dont_Plot_This; + x5 : Real_Vector := Dont_Plot_This; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0) is -- Should this default to e? + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + + y_Log : Real_Vector(y'range); + + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + + for i in y_Log'range loop + y_Log(i) := Log(y(i), Log_Base); + end loop; + Multiplot_Pairs(x1, y_Log, x2, y_Log, x3, y_Log, x4, y_Log, x5, y_Log, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Log_Y_Minor_Grid); + end Simple_Plot_Log_Y; + + + -- Simple log x - log y plotter + procedure Simple_Plot_Log_XY + (x, y : Real_Vector; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String); + x_Log_Base, y_Log_Base : Long_Float := 10.0) is -- Should this default to e? + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + + x_Log : Real_Vector(x'range); + y_Log : Real_Vector(y'range); + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + + for i in x_Log'range loop + x_Log(i) := Log(x(i), x_Log_Base); + y_Log(i) := Log(y(i), y_Log_Base); + end loop; + Multiplot_Pairs(x_Log, y_Log, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Log_XY_Minor_Grid); + end Simple_Plot_Log_XY; + + + -- Simple plotter for multiple x-y arrays specified pairwise. + procedure Simple_Plot_Pairs + (x1 : Real_Vector := Dont_Plot_This; + y1 : Real_Vector := Dont_Plot_This; + x2 : Real_Vector := Dont_Plot_This; + y2 : Real_Vector := Dont_Plot_This; + x3 : Real_Vector := Dont_Plot_This; + y3 : Real_Vector := Dont_Plot_This; + x4 : Real_Vector := Dont_Plot_This; + y4 : Real_Vector := Dont_Plot_This; + x5 : Real_Vector := Dont_Plot_This; + y5 : Real_Vector := Dont_Plot_This; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String)) is + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + + Multiplot_Pairs(x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Linear_Major_Grid); + end Simple_Plot_Pairs; + + +--------- Plotter requiring somewhat more arguments ------ + + -- Single plotter with flexible attributes + -- Similar to Multiplot_Pairs except single trace and no attribute arrays. + procedure Single_Plot + (x, y : Real_Vector; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String); + Axis_Style : Axis_Style_Type := Linear_Major_Grid; + Color : Plot_Color_Type := Red; + Line_Width : Integer := 1; + Line_Style : Line_Style_Type := 1; + Justification : Justification_Type := Not_Justified; + x_Min_Zoom : Long_Float := Long_Float'small; + x_Max_Zoom : Long_Float := Long_Float'large; + y_Min_Zoom : Long_Float := Long_Float'small; + y_Max_Zoom : Long_Float := Long_Float'large) is + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Color_Array : Color_Array_Type := Default_Color_Array; + Line_Width_Array : Line_Width_Array_Type := Default_Line_Width_Array; + Line_Style_Array : Line_Style_Array_Type := Default_Line_Style_Array; + + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + Color_Array(1) := Color; + Line_Width_Array(1) := Line_Width; -- First slot only; others not used. + Line_Style_Array(1) := Line_Style; -- First slot only; others not used. + + -- Process arrays if log plot is indicated. + -- The declare blocks save memory and time for non-log plots. + + -- Log x. + if Axis_Style in Log_X_Box_Plus..Log_X_Minor_Grid then + declare + x_Log : Real_Vector(x'range); + begin + for i in x_Log'range loop + x_Log(i) := Log(x(i), 10.0); + end loop; + + Multiplot_Pairs( + x_Log, y, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Axis_Style, + Colors => Color_Array, + Line_Widths => Line_Width_Array, + Line_Styles => Line_Style_Array, + Justification => Justification, + x_Min_Zoom => x_Min_Zoom, + x_Max_Zoom => x_Max_Zoom, + y_Min_Zoom => y_Min_Zoom, + y_Max_Zoom => y_Max_Zoom); + end; -- declare + end if; -- log x + + -- Log y + if Axis_Style in Log_Y_Box_Plus..Log_Y_Minor_Grid then + declare + y_Log : Real_Vector(y'range); + begin + for i in y_Log'range loop + y_Log(i) := Log(y(i), 10.0); + end loop; + Multiplot_Pairs( + x, y_Log, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Axis_Style, + Colors => Color_Array, + Line_Widths => Line_Width_Array, + Line_Styles => Line_Style_Array, + Justification => Justification, + x_Min_Zoom => x_Min_Zoom, + x_Max_Zoom => x_Max_Zoom, + y_Min_Zoom => y_Min_Zoom, + y_Max_Zoom => y_Max_Zoom); + end; -- declare + end if; -- log y + + -- Log x and log y + if Axis_Style in Log_XY_Box_Plus..Log_XY_Minor_Grid then + declare + x_Log : Real_Vector(x'range); + y_Log : Real_Vector(y'range); + begin + for i in x_Log'range loop + x_Log(i) := Log(x(i), 10.0); + y_Log(i) := Log(y(i), 10.0); + end loop; + Multiplot_Pairs( + x_Log, y_Log, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Axis_Style, + Colors => Color_Array, + Line_Widths => Line_Width_Array, + Line_Styles => Line_Style_Array, + Justification => Justification, + x_Min_Zoom => x_Min_Zoom, + x_Max_Zoom => x_Max_Zoom, + y_Min_Zoom => y_Min_Zoom, + y_Max_Zoom => y_Max_Zoom); + end; -- declare + end if; -- log x and log y + + -- Linear plot is indicated. + if Axis_Style in No_Box..Linear_Minor_Grid then + Multiplot_Pairs( + x, y, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Axis_Style, + Colors => Color_Array, + Line_Widths => Line_Width_Array, + Line_Styles => Line_Style_Array, + Justification => Justification, + x_Min_Zoom => x_Min_Zoom, + x_Max_Zoom => x_Max_Zoom, + y_Min_Zoom => y_Min_Zoom, + y_Max_Zoom => y_Max_Zoom); + end if; -- Linear plot + end Single_Plot; + + +--------- Simple Contour Plotter ------ + + procedure Simple_Contour + (z : Real_Matrix; + Number_Levels : Integer := 10; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String)) is + + Contour_Levels : Real_Vector (0 .. Number_Levels); + + begin + -- Fill the contour vector with some levels. + Calculate_Contour_Levels(Contour_Levels, Matrix_Min(z), Matrix_Max(z)); + + Advance_To_Subpage(Next_Subpage); + Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); + Set_Viewport_World(1.0, 35.0, 1.0, 46.0); -- fix +------- Set_Viewport_World(Long_Float(z'First(1)), Long_Float(z'Last(1)), Long_Float(z'First(2)), Long_Float(z'Last(2))); -- fix + Set_Pen_Color(White); + Box_Around_Viewport("bcnst", 0.0, 0, "bcnstv", 0.0, 0); + Set_Pen_Color(White); + Write_Labels(X_Label, Y_Label, Title_Label); + Set_Pen_Color(White); + Set_Contour_Label_Parameters(0.008, 0.6, 0.1, True); + Contour_Plot(z, z'First(1), z'Last(1), z'First(2), z'Last(2), + Contour_Levels, PLplot_Thin.pltr0'access, System.Null_Address); + end Simple_Contour; + + +--------- Simple 3D Mesh Plotter ------ + + procedure Simple_Mesh_3D + (x, y : Real_Vector; -- data definition points + z : Real_Matrix; -- z(x, y) = z(x(i), y(j)) + x_Min : Long_Float := 0.0; -- user coordinate limits + x_Max : Long_Float := 0.0; -- If x_Min = x_Max = 0.0 then plot + y_Min : Long_Float := 0.0; -- x-limits are found automatically. + y_Max : Long_Float := 0.0; -- Ditto y_Min and y_Max. + Altitude : Long_Float := 30.0; -- viewing elevation angle in degrees + Azimuth : Long_Float := 30.0; -- viewing azimuth in degrees + X_Label : String := "x"; + Y_Label : String := "y"; + Z_Label : String := "z") is + + x_Min_Local, x_Max_Local, y_Min_Local, y_Max_Local : Long_Float; + + begin + -- Set min and max for x and y if they are not the defaults. + if x_Min = 0.0 and x_Max = 0.0 then -- override + x_Min_Local := Vector_Min(x); + x_Max_Local := Vector_Max(x); + else + x_Min_Local := x_Min; + x_Max_Local := x_Max; + end if; + + if y_Min = 0.0 and y_Max = 0.0 then -- override + y_Min_Local := Vector_Min(y); + y_Max_Local := Vector_Max(y); + else + y_Min_Local := y_Min; + y_Max_Local := y_Max; + end if; + + Quick_Set_Color_Map_1(Blue_Green_Red); -- no way to restore after doing this + Advance_To_Subpage(Next_Subpage); + Set_Pen_Color(White); + Set_Viewport_Normalized(0.0, 1.0, 0.0, 1.0); + Set_Viewport_World(-0.9, 0.9, -0.8, 1.5); + Set_Up_3D(1.0, 1.0, 1.0, x_Min_Local, x_Max_Local, y_Min_Local, y_Max_Local, + Matrix_Min(z), Matrix_Max(z), Altitude, Azimuth); -- plw3d + Box_Around_Viewport_3D("bnstu", X_Label, 0.0, 0, + "bnstu", Y_Label, 0.0, 0, + "bcdmnstuv", Z_Label, 0.0, 0); -- plbox3 + Mesh_3D(x, y, z, Lines_Parallel_To_X_And_Y + Magnitude_Color); -- plmesh + end Simple_Mesh_3D; + + +--------- Simple 3D Surface Plotter ------ + + procedure Simple_Surface_3D + (x, y : Real_Vector; -- data definition points + z : Real_Matrix; -- z(x, y) = z(x(i), y(j)) + x_Min : Long_Float := 0.0; -- user coordinate limits + x_Max : Long_Float := 0.0; -- If x_Min = x_Max = 0.0 then plot + y_Min : Long_Float := 0.0; -- x-limits are found automatically. + y_Max : Long_Float := 0.0; -- Ditto y_Min and y_Max. + Altitude : Long_Float := 30.0; -- viewing elevation angle in degrees + Azimuth : Long_Float := 30.0; -- viewing azimuth in degrees + X_Label : String := "x"; + Y_Label : String := "y"; + Z_Label : String := "z") is + + x_Min_Local, x_Max_Local, y_Min_Local, y_Max_Local : Long_Float; + Contour_Levels_Dummy : Real_Vector(0..1) := (others => 0.0); + + begin + -- Set min and max for x and y if they are not the defaults. + if x_Min = 0.0 and x_Max = 0.0 then -- override + x_Min_Local := Vector_Min(x); + x_Max_Local := Vector_Max(x); + else + x_Min_Local := x_Min; + x_Max_Local := x_Max; + end if; + + if y_Min = 0.0 and y_Max = 0.0 then -- override + y_Min_Local := Vector_Min(y); + y_Max_Local := Vector_Max(y); + else + y_Min_Local := y_Min; + y_Max_Local := y_Max; + end if; + + Quick_Set_Color_Map_1(Blue_Green_Red); -- no way to restore after doing this + Advance_To_Subpage(Next_Subpage); + Set_Pen_Color(White); + Set_Viewport_Normalized(0.0, 1.0, 0.0, 1.0); + Set_Viewport_World(-0.9, 0.9, -0.8, 1.5); + Set_Up_3D(1.0, 1.0, 1.0, x_Min_Local, x_Max_Local, y_Min_Local, y_Max_Local, + Matrix_Min(z), Matrix_Max(z), Altitude, Azimuth); -- plw3d + Box_Around_Viewport_3D("bnstu", X_Label, 0.0, 0, + "bnstu", Y_Label, 0.0, 0, + "bcdmnstuv", Z_Label, 0.0, 0); -- plbox3 + Mesh_3D(x, y, z, Lines_Parallel_To_X_And_Y + Magnitude_Color); -- plmesh + Shaded_Surface_3D(x, y, z, Magnitude_Color, Contour_Levels_Dummy); + end Simple_Surface_3D; + + + +--------- Simple color table manipulatons ----- + + -- Things for manipulating color map 0 -- + + -- Make a snapshot of color map 0 for possible later full or partial restoration. + -- This is automatically called at package initialization with results stored + -- in Default_Red_Components, Default_Green_Components, Default_Blue_Components. + procedure Make_Snapshot_Of_Color_Map_0 + (Reds, Greens, Blues : out Integer_Array_1D) is + begin + for i in Reds'range loop + Get_Color_RGB(i, Reds(i), Greens(i), Blues(i)); + end loop; + end Make_Snapshot_Of_Color_Map_0; + + + -- Restore an arbitray snapshot of color map 0. + procedure Restore_Snapshot_Of_Color_Map_0 + (Reds, Greens, Blues : Integer_Array_1D) is + begin + Set_Color_Map_0(Reds, Greens, Blues); + end Restore_Snapshot_Of_Color_Map_0; + + + -- Restore the default colors of color map 0 taken as a snapshot at initialization. + procedure Restore_Default_Snapshot_Of_Color_Map_0 is + begin + Set_Number_Of_Colors_Map_0(Number_Of_Default_Colors); + Set_Color_Map_0(Default_Red_Components, Default_Green_Components, Default_Blue_Components); + end Restore_Default_Snapshot_Of_Color_Map_0; + + + -- Functions which correspond to the default colors of color map 0. Calling + -- one of these (1) resets the corresponding slot in color map 0 to its + -- default value, and (2) returns the correct integer value for the default + -- color specified. Thus, using Set_Pen_Color(Reset_Red) instead of + -- Set_Pen_Color(Red) guarantees that the color will be set to Red even if + -- there have been prior manipulations of color 1. + + function Reset_Black return Integer is + begin + Set_One_Color_Map_0(0, Default_Red_Components(0), Default_Green_Components(0), Default_Blue_Components(0)); + return 0; + end Reset_Black; + + function Reset_Red return Integer is + begin + Set_One_Color_Map_0(1, Default_Red_Components(1), Default_Green_Components(1), Default_Blue_Components(1)); + return 1; + end Reset_Red; + + function Reset_Yellow return Integer is + begin + Set_One_Color_Map_0(2, Default_Red_Components(2), Default_Green_Components(2), Default_Blue_Components(2)); + return 2; + end Reset_Yellow; + + function Reset_Green return Integer is + begin + Set_One_Color_Map_0(3, Default_Red_Components(3), Default_Green_Components(3), Default_Blue_Components(3)); + return 3; + end Reset_Green; + + function Reset_Aquamarine return Integer is + begin + Set_One_Color_Map_0(4, Default_Red_Components(4), Default_Green_Components(4), Default_Blue_Components(4)); + return 4; + end Reset_Aquamarine; + + function Reset_Pink return Integer is + begin + Set_One_Color_Map_0(5, Default_Red_Components(5), Default_Green_Components(5), Default_Blue_Components(5)); + return 5; + end Reset_Pink; + + function Reset_Wheat return Integer is + begin + Set_One_Color_Map_0(6, Default_Red_Components(6), Default_Green_Components(6), Default_Blue_Components(6)); + return 6; + end Reset_Wheat; + + function Reset_Grey return Integer is + begin + Set_One_Color_Map_0(7, Default_Red_Components(7), Default_Green_Components(7), Default_Blue_Components(7)); + return 7; + end Reset_Grey; + + function Reset_Brown return Integer is + begin + Set_One_Color_Map_0(8, Default_Red_Components(8), Default_Green_Components(8), Default_Blue_Components(8)); + return 8; + end Reset_Brown; + + function Reset_Blue return Integer is + begin + Set_One_Color_Map_0(9, Default_Red_Components(9), Default_Green_Components(9), Default_Blue_Components(9)); + return 9; + end Reset_Blue; + + function Reset_BlueViolet return Integer is + begin + Set_One_Color_Map_0(10, Default_Red_Components(10), Default_Green_Components(10), Default_Blue_Components(10)); + return 10; + end Reset_BlueViolet; + + function Reset_Cyan return Integer is + begin + Set_One_Color_Map_0(11, Default_Red_Components(11), Default_Green_Components(11), Default_Blue_Components(11)); + return 11; + end Reset_Cyan; + + function Reset_Turquoise return Integer is + begin + Set_One_Color_Map_0(12, Default_Red_Components(12), Default_Green_Components(12), Default_Blue_Components(12)); + return 12; + end Reset_Turquoise; + + function Reset_Magenta return Integer is + begin + Set_One_Color_Map_0(13, Default_Red_Components(13), Default_Green_Components(13), Default_Blue_Components(13)); + return 13; + end Reset_Magenta; + + function Reset_Salmon return Integer is + begin + Set_One_Color_Map_0(14, Default_Red_Components(14), Default_Green_Components(14), Default_Blue_Components(14)); + return 14; + end Reset_Salmon; + + function Reset_White return Integer is + begin + Set_One_Color_Map_0(15, Default_Red_Components(15), Default_Green_Components(15), Default_Blue_Components(15)); + return 15; + end Reset_White; + + + -- Things for manipulating color map 1 -- + + -- Quick application of pre-fabricated color schemes to color map 1. + procedure Quick_Set_Color_Map_1(Color_Theme : Color_Themes_For_Map_1_Type) is + + Controls_3 : Real_Vector (0..2); -- 3 control points + Controls_4 : Real_Vector (0..3); -- 4 control points + Red_3, Green_3, Blue_3 : Real_Vector (0..2); -- define 3 + Red_4, Green_4, Blue_4 : Real_Vector (0..3); -- define 4 + Hue_3, Lightness_3, Saturation_3 : Real_Vector (0..2); -- define 3 + Hue_4, Lightness_4, Saturation_4 : Real_Vector (0..3); -- define 4 + Reverse_Hue_3 : Boolean_Array_1D (0..2); + Reverse_Hue_4 : Boolean_Array_1D (0..3); + begin + Set_Number_Of_Colors_In_Color_Map_1(256); + + Controls_3(0) := 0.0; + Controls_3(1) := 0.5; + Controls_3(2) := 1.0; + + Controls_4(0) := 0.0; + Controls_4(1) := 0.5; -- allow a "bend" at the mid-point + Controls_4(2) := 0.5; -- allow a "bend" at the mid-point + Controls_4(3) := 1.0; + + -- Initialize everything, even unused stuff. + Red_3(0) := 0.0; + Red_3(1) := 0.0; + Red_3(2) := 0.0; + Green_3(0) := 0.0; + Green_3(1) := 0.0; + Green_3(2) := 0.0; + Blue_3(0) := 0.0; + Blue_3(1) := 0.0; + Blue_3(2) := 0.0; + + Red_4(0) := 0.0; + Red_4(1) := 0.0; + Red_4(2) := 0.0; + Red_4(3) := 0.0; + Green_4(0) := 0.0; + Green_4(1) := 0.0; + Green_4(2) := 0.0; + Green_4(3) := 0.0; + Blue_4(0) := 0.0; + Blue_4(1) := 0.0; + Blue_4(2) := 0.0; + Blue_4(3) := 0.0; + + Hue_3(0) := 0.0; + Hue_3(1) := 0.0; + Hue_3(2) := 0.0; + Lightness_3(0) := 0.0; + Lightness_3(1) := 0.0; + Lightness_3(2) := 0.0; + Saturation_3(0) := 0.0; + Saturation_3(1) := 0.0; + Saturation_3(2) := 0.0; + + Hue_4(0) := 0.0; + Hue_4(1) := 0.0; + Hue_4(2) := 0.0; + Hue_4(3) := 0.0; + Lightness_4(0) := 0.0; + Lightness_4(1) := 0.0; + Lightness_4(2) := 0.0; + Lightness_4(3) := 0.0; + Saturation_4(0) := 0.0; + Saturation_4(1) := 0.0; + Saturation_4(2) := 0.0; + Saturation_4(3) := 0.0; + + case Color_Theme is + when Gray => + begin + Hue_3(0) := 0.0; + Hue_3(1) := 0.0; + Hue_3(2) := 0.0; + Lightness_3(0) := 0.0; + Lightness_3(1) := 0.5; + Lightness_3(2) := 1.0; + Saturation_3(0) := 0.0; + Saturation_3(1) := 0.0; + Saturation_3(2) := 0.0; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(HLS, Controls_3, Hue_3, Lightness_3, Saturation_3, Reverse_Hue_3); + end; + when Blue_Green_Red => -- This appears to be the PLplot default color theme. + begin + Blue_3(0) := 1.0; + Blue_3(1) := 0.0; + Blue_3(2) := 0.0; + Green_3(0) := 0.0; + Green_3(1) := 1.0; + Green_3(2) := 0.0; + Red_3(0) := 0.0; + Red_3(1) := 0.0; + Red_3(2) := 1.0; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(RGB, Controls_3, Red_3, Green_3, Blue_3, Reverse_Hue_3); + end; + when Red_Green_Blue => + begin + Blue_3(0) := 0.0; + Blue_3(1) := 0.0; + Blue_3(2) := 1.0; + Green_3(0) := 0.0; + Green_3(1) := 1.0; + Green_3(2) := 0.0; + Red_3(0) := 1.0; + Red_3(1) := 0.0; + Red_3(2) := 0.0; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(RGB, Controls_3, Red_3, Green_3, Blue_3, Reverse_Hue_3); + end; + when Red_Cyan_Blue => + begin + Hue_3(0) := 360.0; + Hue_3(1) := 300.0; + Hue_3(2) := 240.0; + Saturation_3(0) := 1.0; + Saturation_3(1) := 1.0; + Saturation_3(2) := 1.0; + Lightness_3(0) := 0.5; + Lightness_3(1) := 0.5; + Lightness_3(2) := 0.5; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(HLS, Controls_3, Hue_3, Lightness_3, Saturation_3, Reverse_Hue_3); + end; + when Blue_Black_Red => + begin + Hue_4(0) := 240.0; -- Blue + Hue_4(1) := 240.0; -- Blue + Hue_4(2) := 0.0; -- Red + Hue_4(3) := 0.0; -- Red + Saturation_4(0) := 1.0; + Saturation_4(1) := 1.0; + Saturation_4(2) := 1.0; + Saturation_4(3) := 1.0; + Lightness_4(0) := 0.5; -- Apparently different from Brightness + Lightness_4(1) := 0.0; + Lightness_4(2) := 0.0; + Lightness_4(3) := 0.5; + Reverse_Hue_4(0) := False; + Reverse_Hue_4(1) := False; + Reverse_Hue_4(2) := False; + Reverse_Hue_4(3) := False; + Set_Color_Map_1_Piecewise(HLS, Controls_4, Hue_4, Lightness_4, Saturation_4, Reverse_Hue_4); + end; + when Red_Blue_Green => + begin + Hue_3(0) := 360.0; -- red + Hue_3(1) := 210.0; -- blue + Hue_3(2) := 120.0; -- green + Lightness_3(0) := 0.5; + Lightness_3(1) := 0.5; + Lightness_3(2) := 0.5; + Saturation_3(0) := 1.0; + Saturation_3(1) := 1.0; + Saturation_3(2) := 1.0; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(HLS, Controls_3, Hue_3, Lightness_3, Saturation_3, Reverse_Hue_3); + end; + when Red_Yellow => + begin + Hue_3(0) := 0.0; -- red + Hue_3(1) := 30.0; -- orange + Hue_3(2) := 60.0; -- yellow + Lightness_3(0) := 0.5; + Lightness_3(1) := 0.5; + Lightness_3(2) := 0.5; + Saturation_3(0) := 1.0; + Saturation_3(1) := 1.0; + Saturation_3(2) := 1.0; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(HLS, Controls_3, Hue_3, Lightness_3, Saturation_3, Reverse_Hue_3); + end; + end case; + end Quick_Set_Color_Map_1; + + +-------------------------------------------------------------------------------- +-- Auxiliary things -- +-------------------------------------------------------------------------------- + + -- This is a mask function for Shade_Regions (aka plshades) et al that always + -- returns 1 so that all points are plotted. Can be used as a template + -- for other user-written mask functions. This behaves the same as + -- when passing null for the second argument in Shade_Regions. + function Mask_Function_No_Mask(x, y : Long_Float) return Integer is + begin + return 1; + end Mask_Function_No_Mask; + + + -- Given an array to hold contour levels and function minimum and maximum, + -- fill it and return. Useful for contour and shade plots. + procedure Calculate_Contour_Levels + (Contour_Levels : in out Real_Vector; + z_Min, z_Max : Long_Float) is + + step : Long_Float; + ii : Integer; + begin + step := (z_Max - z_Min) / Long_Float(Contour_Levels'Last - Contour_Levels'First); + for i in Contour_Levels'range loop + ii := i - Contour_Levels'First; -- reference back to 0. + Contour_Levels(i) := z_Min + step * Long_Float(ii); + end loop; + end Calculate_Contour_Levels; + + +-------------------------------------------------------------------------------- +-- Re-define PLplot procedures using Ada style. -- +-------------------------------------------------------------------------------- + +-- These correspond to the section in plot.h called "Function Prototypes". + + -- set the format of the contour labels + -- pl_setcontlabelformat + procedure Set_Contour_Label_Format + (Limit_Exponent : Integer := 4; + Significant_Digits : Integer := 2) is + begin + pl_setcontlabelformat(Limit_Exponent, Significant_Digits); + end Set_Contour_Label_Format; + + + -- set offset and spacing of contour labels + -- pl_setcontlabelparam + procedure Set_Contour_Label_Parameters + (Label_Offset : Long_Float := 0.006; -- Units are ??? + Label_Font_Height : Long_Float := 0.3; -- Units are ??? + Label_Spacing : Long_Float := 0.1; -- Units are??? + Labels_Active : Boolean := False) is + + active : Integer; + + begin + if Labels_Active then + active := 1; + else + active := 0; + end if; + pl_setcontlabelparam(Label_Offset, Label_Font_Height, Label_Spacing, active); + end Set_Contour_Label_Parameters; + + + -- Advance to subpage "page", or to the next one if "page" = 0. + -- pladv + procedure Advance_To_Subpage(Page : Natural) is + begin + pladv(Page); + end Advance_To_Subpage; + + + -- Plot an arc. + -- plarc + procedure Draw_Arc + (x, y, a, b, angle1, angle2 : Long_Float; + fill : Boolean) is + + fill_arc : PLBOOL; + + begin + if fill then + fill_arc := PLtrue; + else + fill_arc := PLfalse; + end if; + plarc(x, y, a, b, angle1, angle2, fill_arc); + end Draw_Arc; + + + -- Draw a 2D vector plot. + -- plvect + procedure Vector_Plot + (u, v : Real_Matrix; + Scale : Long_Float; + Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; + Transformation_Data_Pointer : PLpointer) is + begin + plvect(Matrix_To_Pointers(u), Matrix_To_Pointers(v), u'Length(1), u'Length(2), Scale, Transformation_Procedure_Pointer, Transformation_Data_Pointer); + end Vector_Plot; + + + -- Set the style for the arrow used by plvect to plot vectors. + -- plsvect + procedure Set_Arrow_Style_For_Vector_Plots + (X_Vertices, Y_Vertices : Real_Vector; -- Should be range -0.5..0.5 + Fill_Arrow : Boolean) is + + fill : PLBOOL; + + begin + if Fill_Arrow then + fill := PLtrue; + else + fill := PLfalse; + end if; + plsvect(X_Vertices, Y_Vertices, X_Vertices'length, fill); + end Set_Arrow_Style_For_Vector_Plots; + + + -- This functions similarly to plbox() except that the origin of the axes + -- is placed at the user-specified point (x0, y0). + -- plaxes + procedure Box_Around_Viewport_With_Origin + (X_Origin, Y_Origin : Long_Float; + X_Option_String : String; + X_Major_Tick_Interval : Long_Float; + X_Number_Of_Subintervals : Natural; + Y_Option_String : String; + Y_Major_Tick_Interval : Long_Float; + Y_Number_Of_Subintervals : Natural) is + begin + plaxes + (X_Origin, Y_Origin, + To_C(X_Option_String, True), X_Major_Tick_Interval, X_Number_Of_Subintervals, + To_C(Y_Option_String, True), Y_Major_Tick_Interval, Y_Number_Of_Subintervals); + end Box_Around_Viewport_With_Origin; + + + -- Plot a histogram using x to store data values and y to store frequencies + -- plbin + procedure Histogram_Binned + (Bin_Values : Real_Vector; -- "x" + Bin_Counts : Real_Vector; -- "y" + Options : Integer) is -- Options are not defined in plplot.h. + begin + plbin(Bin_Values'length, Bin_Values, Bin_Counts, Options); + end Histogram_Binned; + + + -- Calculate broken-down time from continuous time for current stream. + -- plbtime + procedure Broken_Down_From_Continuous_Time + (year, month, day, hour, min : out Integer; + sec : out Long_Float; + ctime : Long_Float) is + begin + plbtime(year, month, day, hour, min, sec, ctime); + end Broken_Down_From_Continuous_Time; + + + -- Start new page. Should only be used with pleop(). + -- plbop + procedure Begin_New_Page is + begin + plbop; + end Begin_New_Page; + + + -- This draws a box around the current viewport. + -- plbox + procedure Box_Around_Viewport + (X_Option_String : String; + X_Major_Tick_Interval : Long_Float; + X_Number_Of_Subintervals : Natural := 0; + Y_Option_String : String; + Y_Major_Tick_Interval : Long_Float; + Y_Number_Of_Subintervals : Natural := 0) is + begin + plbox + (To_C(X_Option_String, True), X_Major_Tick_Interval, X_Number_Of_Subintervals, + To_C(Y_Option_String, True), Y_Major_Tick_Interval, Y_Number_Of_Subintervals); + end Box_Around_Viewport; + + + -- This is the 3-d analogue of plbox(). + -- plbox3 + procedure Box_Around_Viewport_3D + (X_Option_String : String; + X_Label : String := To_String(Default_Label_String); + X_Major_Tick_Interval : Long_Float := 0.0; + X_Number_Of_Subintervals : Natural := 0; + + Y_Option_String : String; + Y_Label : String := To_String(Default_Label_String); + Y_Major_Tick_Interval : Long_Float := 0.0; + Y_Number_Of_Subintervals : Natural := 0; + + Z_Option_String : String; + Z_Label : String := To_String(Default_Label_String); + Z_Major_Tick_Interval : Long_Float := 0.0; + Z_Number_Of_Subintervals : Natural := 0) is + begin + plbox3 + (To_C(X_Option_String, True), To_C(X_Label, True), X_Major_Tick_Interval, X_Number_Of_Subintervals, + To_C(Y_Option_String, True), To_C(Y_Label, True), Y_Major_Tick_Interval, Y_Number_Of_Subintervals, + To_C(Z_Option_String, True), To_C(Z_Label, True), Z_Major_Tick_Interval, Z_Number_Of_Subintervals); + end Box_Around_Viewport_3D; + + + -- Calculate world coordinates and subpage from relative device coordinates. + -- plcalc_world + procedure World_From_Relative_Coordinates + (x_Relative, y_Relative : Long_Float_0_1_Type; + x_World, y_World : out Long_Float; + Last_Window_Index : out Integer) is + begin + plcalc_world(x_Relative, y_Relative, x_World, y_World, Last_Window_Index); + end World_From_Relative_Coordinates; + + + -- Clear current subpage. + -- plclear + procedure Clear_Current_Subpage is + begin + plclear; + end Clear_Current_Subpage; + + + -- Set color, map 0. Argument is integer between 0 and 15. + -- plcol0 + procedure Set_Pen_Color(A_Color : Plot_Color_Type) is + begin + plcol0(A_Color); + end Set_Pen_Color; + + + -- Set color, map 1. Argument is a float between 0. and 1. + -- plcol1 + procedure Set_Color_Map_1(Color : Long_Float_0_1_Type) is + begin + plcol1(Color); + end Set_Color_Map_1; + + + -- Configure transformation between continuous and broken-down time (and + -- vice versa) for current stream. + -- plconfigtime + procedure Configure_Time_Transformation + (skale, offset1, offset2 : Long_Float; + ccontrol : Integer; + ifbtime_offset : Boolean; + year, month, day, hour, min : Integer; + sec : Long_Float) is + + ifbtime_offset_As_Integer : Integer; + begin + if ifbtime_offset then + ifbtime_offset_As_Integer := 1; + else + ifbtime_offset_As_Integer := 0; + end if; + plconfigtime(skale, offset1, offset2, ccontrol, + ifbtime_offset_As_Integer, year, month, day, hour, min, sec); + end Configure_Time_Transformation; + + + -- Draws a contour plot from data in f(nx,ny). Is just a front-end to + -- plfcont, with a particular choice for f2eval and f2eval_data. + + -- plcont (universal version using System.Address to the transformation data) + procedure Contour_Plot + (z : Real_Matrix; + x_Min_Index, x_Max_Index : Integer; + y_Min_Index, y_Max_Index : Integer; + Contour_Levels : Real_Vector; + Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; + Transformation_Data_Pointer : PLpointer) is + begin + plcont(Matrix_To_Pointers(z), z'Length(1), z'Length(2), + x_Min_Index, x_Max_Index, y_Min_Index, y_Max_Index, Contour_Levels, + Contour_Levels'Length, Transformation_Procedure_Pointer, + Transformation_Data_Pointer); + end Contour_Plot; + + + -- The procedure plfcont is not documented and is not part of the API. + -- However, it is a very useful capability to have available. + -- I have tried to implement it as I think was intended but this may be incorrect. + -- It appears as though the intent is to pass the arbitrarily organized + -- data (pointed to by Irregular_Data_Pointer) as a (single) pointer to a + -- 2D C-style array. Thus, for examaple, it is not possible to pass the data + -- as triples. + -- For further conversion insight, see plcont, above. + + -- Draws a contour plot using the function evaluator f2eval and data stored + -- by way of the f2eval_data pointer. This allows arbitrary organizations + -- of 2d array data to be used. + + -- plfcont + procedure Contour_Plot_Irregular_Data + (Function_Evaluator_Pointer : Function_Evaluator_Pointer_Type; + Irregular_Data : Real_Matrix; + x_Min_Index, x_Max_Index : Integer; + y_Min_Index, y_Max_Index : Integer; + Contour_Levels : Real_Vector; + Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; + Transformation_Data : Transformation_Data_Type) is + + -- This is a good place to change from the convenient form of passing + -- the transformation data (a record) to the form required by the PLplot + -- API (a pointer); same for the irregularly spaced data matrix. + Transformation_Data_Address : PLpointer; + Irregular_Data_Address : PLpointer; + begin + Transformation_Data_Address := Transformation_Data'Address; + Irregular_Data_Address := Irregular_Data'Address; + + plfcont(Function_Evaluator_Pointer, Irregular_Data_Address, + Irregular_Data'Length(1), Irregular_Data'Length(2), + x_Min_Index, x_Max_Index, y_Min_Index, y_Max_Index, + Contour_Levels, Contour_Levels'Length, + Transformation_Procedure_Pointer, Transformation_Data_Address); + end Contour_Plot_Irregular_Data; + + + -- Copies state parameters from the reference stream to the current stream. + -- plcpstrm + procedure Copy_State_Parameters + (Stream_ID : Integer; + Do_Not_Copy_Device_Coordinates : Boolean) is + + PL_Do_Not_Copy_Device_Coordinates : PLBOOL; + + begin + if Do_Not_Copy_Device_Coordinates then + PL_Do_Not_Copy_Device_Coordinates := PLtrue; + else + PL_Do_Not_Copy_Device_Coordinates := PLfalse; + end if; + plcpstrm(Stream_ID, PL_Do_Not_Copy_Device_Coordinates); + end Copy_State_Parameters; + + + -- Calculate continuous time from broken-down time for current stream. + -- plctime + procedure Continuous_From_Broken_Down_Time + (year, month, day, hour, min : Integer; + sec : Long_Float; + ctime : out Long_Float) is + begin + plctime(year, month, day, hour, min, sec, ctime); + end Continuous_From_Broken_Down_Time; + + + -- fix this + -- Converts input values from relative device coordinates to relative plot + -- coordinates. + -- pldid2pc + procedure pldid2pc_Placeholder is + begin + Put_Line("Not implemented due to lack of documentation."); + end pldid2pc_Placeholder; + + + -- fix this + -- Converts input values from relative plot coordinates to relative + -- device coordinates. + -- pldip2dc + procedure pldip2dc_Placeholder is + begin + Put_Line("Not implemented due to lack of documentation."); + end pldip2dc_Placeholder; + + + -- En... [truncated message content] |
From: <ai...@us...> - 2010-07-23 05:07:52
|
Revision: 11098 http://plplot.svn.sourceforge.net/plplot/?rev=11098&view=rev Author: airwin Date: 2010-07-23 05:07:44 +0000 (Fri, 23 Jul 2010) Log Message: ----------- Move gcw_true and gcw_false determination from gcw.cmake (where it was bypassed since the gcw device has been retired) to examples/c/CMakeLists.txt so that examples/c/Makefile(.examples.in) will be properly configured. This change corrects a long-standing (introduced prior to 5.9.6 by the retirement of the gcw device driver) bug in the traditional Makefile+pkg-config approach to building and testing the installed examples. Modified Paths: -------------- trunk/cmake/modules/gcw.cmake trunk/examples/c/CMakeLists.txt Modified: trunk/cmake/modules/gcw.cmake =================================================================== --- trunk/cmake/modules/gcw.cmake 2010-07-22 17:38:46 UTC (rev 11097) +++ trunk/cmake/modules/gcw.cmake 2010-07-23 05:07:44 UTC (rev 11098) @@ -124,14 +124,6 @@ set(ENABLE_pygcw OFF CACHE BOOL "Enable Python Gnome2 bindings" FORCE) endif(ENABLE_pygcw AND NOT PLD_gcw) -if(ENABLE_gnome2) - set(gcw_true "") - set(gcw_false "#") -else(ENABLE_gnome2) - set(gcw_true "#") - set(gcw_false "") -endif(ENABLE_gnome2) - if(PLD_gcw) if(ENABLE_DYNDRIVERS) if(ENABLE_gnome2) Modified: trunk/examples/c/CMakeLists.txt =================================================================== --- trunk/examples/c/CMakeLists.txt 2010-07-22 17:38:46 UTC (rev 11097) +++ trunk/examples/c/CMakeLists.txt 2010-07-23 05:07:44 UTC (rev 11098) @@ -90,6 +90,11 @@ set(plplotcanvas_DOCS README.plplotcanvas ) + set(gcw_true "") + set(gcw_false "#") + else(ENABLE_gnome2) + set(gcw_true "#") + set(gcw_false "") endif(ENABLE_gnome2) install(FILES ${c_SRCS} ${plplotcanvas_SRCS} ${plplotcanvas_DOCS} ${extXdrawable_SRC} ${extcairo_SRC} ${cairo_DOCS} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-07-26 19:34:26
|
Revision: 11108 http://plplot.svn.sourceforge.net/plplot/?rev=11108&view=rev Author: andrewross Date: 2010-07-26 19:34:19 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Fix recently introduced problems with octave shade function. Also upgrade to allow use of 2-d arrays for x and y coordinates (as with matlab contourf function). Fix problem in example p17 which causes a division by zero error when plimage is called with min and max values set to the same. Switch from using loadimage to imread for example p17 which removes obsolete function warning. Re-enable all p examples in octave interactive script as they should now work again. Modified Paths: -------------- trunk/bindings/octave/PLplot/shade.m trunk/examples/octave/p17.m trunk/plplot_test/test_octave_interactive.sh.in Modified: trunk/bindings/octave/PLplot/shade.m =================================================================== --- trunk/bindings/octave/PLplot/shade.m 2010-07-24 17:11:07 UTC (rev 11107) +++ trunk/bindings/octave/PLplot/shade.m 2010-07-26 19:34:19 UTC (rev 11108) @@ -52,6 +52,12 @@ levels = 2; endif + if (rows(x) > 1 & columns(x) > 1 & rows(y) > 1 & columns(y) > 1) + xymat = 1; + else + xymat = 0; + endif + ## plot color and pen width of boundary of shade region max_color = 0; max_width = 0; @@ -62,8 +68,6 @@ cont_color = 0; cont_width = 0; endif - xlen = length (x); ylen = length (y); - if (ishold == 0) xmm = xm = min(min(x)); xM = max(max(x)); ymm = ym = min(min(y)); yM = max(max(y)); @@ -71,17 +75,19 @@ if (__pl.axis_st(strm)) xm = __pl.axis(strm,1); xM = __pl.axis(strm,2); - ix = find(x >= xm & x <= xM); - x=x(ix); z=z(:,ix); - xlen = length (x); - xmm = min(x); + if (xymat == 0) + ix = find(x >= xm & x <= xM); + x=x(ix); z=z(:,ix); + xmm = min(x); + endif if (length(__pl.axis(strm,:)) >= 4) ym = __pl.axis(strm,3); yM = __pl.axis(strm,4); - iy = find(y >= ym & y <= yM); - y=y(iy); z=z(iy,:); - ylen = length (y); - ymm = min(y); + if (xymat == 0) + iy = find(y >= ym & y <= yM); + y=y(iy); z=z(iy,:); + ymm = min(y); + endif else __pl.axis(strm,3) = ym; __pl.axis(strm,4) = yM; endif @@ -106,10 +112,22 @@ xmm = xm = __pl.axis(strm,1); xM = __pl.axis(strm,2); ymm = ym = __pl.axis(strm,3); yM = __pl.axis(strm,4); zm = __pl.axis(strm,5); zM = __pl.axis(strm,6); - z = z( find(y >= ym & y <= yM), find(x >= xm & x <= xM)); + if (xymat == 0) + ix = find(x >= xm & x <= xM); + iy = find(y >= ym & y <= yM); + z = z( iy, ix ); + x = x( ix ); + y = y( iy ); + endif endif - maxx = max(x); maxy = max(y); minx = min(x); miny = min(y); + maxx = max(max(x)); maxy = max(max(y)); minx = min(min(x)); miny = min(min(y)); + if (columns(x)>1 & rows(x) == 1) + x = x'; + endif + if (columns(y)>1 & rows(y) == 1) + y = y'; + endif if (!isscalar(levels)) n = length(levels)-1; @@ -128,7 +146,7 @@ __pl.lab_pos(strm) = 1; plpsty(0); - if (1) ## plshades() is slower than several calls to plshade() !? and plshades() sometimes fails ?! + if (0) ## plshades() is slower than several calls to plshade() !? and plshades() sometimes fails ?! for i = 1:n plshade1(z', 0, minx, maxx, miny, maxy, clevel(i), clevel(i+1), @@ -136,9 +154,13 @@ cont_color, cont_width, max_color, max_width, 1, x, y); endfor else - - plshadesx(z, minx, maxx, miny, maxy, + if (columns(x) == 1 & columns(y) == 1) + plshades1(z', minx, maxx, miny, maxy, clevel', 1, cont_color, cont_width, 1, x, y); + else + plshades2(z', minx, maxx, miny, maxy, + clevel', 1, cont_color, cont_width, 1, x', y'); + endif endif for i = 1:n @@ -161,7 +183,7 @@ endif if (__pl.legend(strm)) - __pl_draw_legend + __pl_draw_legend; endif plcol(15); Modified: trunk/examples/octave/p17.m =================================================================== --- trunk/examples/octave/p17.m 2010-07-24 17:11:07 UTC (rev 11107) +++ trunk/examples/octave/p17.m 2010-07-26 19:34:19 UTC (rev 11108) @@ -21,11 +21,18 @@ title "Click and Drag button 1 to select"; xlabel "Button 2 to restart and button 3 to finish"; ylabel ""; - [img, map]= loadimage (file_in_loadpath ("lena.img")); + [img, map]= imread (file_in_loadpath ("lena.img")); colormap(map); plimage (img); if (!nargin) [x1, y1, x2, y2] = plrb(1); + % Prevent case where range is zero + if (x1 == x2) + x2 = x1+1; + end + if (y1 == y2) + y2 = y1+1; + end title "Lena"; xlabel ""; plimage (img, x1, x2, y1, y2); Modified: trunk/plplot_test/test_octave_interactive.sh.in =================================================================== --- trunk/plplot_test/test_octave_interactive.sh.in 2010-07-24 17:11:07 UTC (rev 11107) +++ trunk/plplot_test/test_octave_interactive.sh.in 2010-07-26 19:34:19 UTC (rev 11108) @@ -74,7 +74,7 @@ # Remove 17 until an additional fix is done. # Remove combined example 21. plsetopt("dev","$device"); -for i=[1:6 8:15 18:19]; +for i=[1:20]; if (verbose_test) printf("p%d\n",i); endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2010-08-17 06:36:15
|
Revision: 11136 http://plplot.svn.sourceforge.net/plplot/?rev=11136&view=rev Author: arjenmarkus Date: 2010-08-17 06:36:08 +0000 (Tue, 17 Aug 2010) Log Message: ----------- Correct C++-isms that caused MSVisual C/C++ 2008 compiler to complain. These were variable declarations in the middle of a block. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c trunk/examples/c/x19c.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2010-08-17 06:10:27 UTC (rev 11135) +++ trunk/bindings/tcl/tclAPI.c 2010-08-17 06:36:08 UTC (rev 11136) @@ -3344,15 +3344,19 @@ static void Tcl_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) { + Tcl_Obj *objx, *objy; + int code; + double dx, dy; + // Set Tcl x to x - Tcl_Obj *objx = Tcl_NewDoubleObj( x ); + objx = Tcl_NewDoubleObj( x ); Tcl_IncrRefCount( objx ); Tcl_SetVar2Ex( tcl_xform_interp, "_##_x", NULL, objx, 0 ); Tcl_DecrRefCount( objx ); // Set Tcl y to y - Tcl_Obj *objy = Tcl_NewDoubleObj( y ); + objy = Tcl_NewDoubleObj( y ); Tcl_IncrRefCount( objy ); Tcl_SetVar2Ex( tcl_xform_interp, "_##_y", NULL, objy, 0 ); @@ -3365,7 +3369,7 @@ // Call identified Tcl proc. Forget data, Tcl can use namespaces and custom // procs to manage transmission of the custom client data. // Proc should return a two element list which is xt yt. - int code = Tcl_Eval( tcl_xform_interp, tcl_xform_code ); + code = Tcl_Eval( tcl_xform_interp, tcl_xform_code ); if ( code != TCL_OK ) { @@ -3380,8 +3384,6 @@ // In case PLFLT != double, we have to make sure we perform the extraction in // a safe manner. - double dx, dy; - if ( Tcl_GetDoubleFromObj( tcl_xform_interp, objx, &dx ) != TCL_OK || Tcl_GetDoubleFromObj( tcl_xform_interp, objy, &dy ) != TCL_OK ) { @@ -3417,12 +3419,13 @@ } else { + int len; const char *data = argc > 2 ? argv[2] : 0; tcl_xform_interp = interp; tcl_xform_procname = strdup( argv[1] ); - int len = strlen( tcl_xform_template ) + strlen( tcl_xform_procname ); + len = strlen( tcl_xform_template ) + strlen( tcl_xform_procname ); tcl_xform_code = malloc( len ); sprintf( tcl_xform_code, tcl_xform_template, tcl_xform_procname ); Modified: trunk/examples/c/x19c.c =================================================================== --- trunk/examples/c/x19c.c 2010-08-17 06:10:27 UTC (rev 11135) +++ trunk/examples/c/x19c.c 2010-08-17 06:36:08 UTC (rev 11136) @@ -120,6 +120,7 @@ main( int argc, const char **argv ) { PLFLT minx, maxx, miny, maxy; + PLFLT x, y; /* Parse and process command line arguments */ @@ -187,8 +188,8 @@ /* Show Baltimore, MD on the map */ plcol0( 2 ); plssym( 0.0, 2.0 ); - PLFLT x = -76.6125; - PLFLT y = 39.2902778; + x = -76.6125; + y = 39.2902778; plpoin( 1, &x, &y, 18 ); plssym( 0.0, 1.0 ); plptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-09-01 10:53:24
|
Revision: 11158 http://plplot.svn.sourceforge.net/plplot/?rev=11158&view=rev Author: jbauck Date: 2010-09-01 10:53:16 +0000 (Wed, 01 Sep 2010) Log Message: ----------- Update Ada documentation for new approach to declaring vectors and matrices. Remove Ada cruft documentation that has long been incorporated into the main document. Modified Paths: -------------- trunk/doc/docbook/src/ada.xml Removed Paths: ------------- trunk/bindings/ada/README trunk/bindings/ada/README.pdf trunk/bindings/ada/README.rtf Deleted: trunk/bindings/ada/README =================================================================== --- trunk/bindings/ada/README 2010-08-27 22:37:00 UTC (rev 11157) +++ trunk/bindings/ada/README 2010-09-01 10:53:16 UTC (rev 11158) @@ -1,653 +0,0 @@ -Ada Bindings for the PLplot Plotting Package - -1 About the This Document - This document describes the Ada bindings to the PLplot - technical plotting software, how to obtain the necessary software - components, and how to use them together. -2 Overview - The Ada bindings for PLplot provide a way for Ada programmers - to access the powerful PLplot technical plotting facilities directly - from Ada programs while working completely in Ada—the Ada programmer - never needs to know or worry that PLplot itself is written in another - language. - There are a thin binding and two thick bindings provided. The - thin binding presents the application programming interface (API) in - a form very similar to the C API, although in 100% Ada. The thick - bindings present the API in a form to which Ada programmers will be - more accustomed and add some ease-of-use features. It is expected - that the thick bindings will be preferred. -3 About PLplot - PLplot is a general purpose technical plotting package that - can be accessed directly by the user's own program without first - writing the data to be plotted to disk. The package is marked by - speed, convenience, breadth, and flexibility. - The PLplot project is one of the most active on SourceForge, - typically in the 99th percentile for activity. - The following is taken from the PLplot web site at - plplot.sourceforge.net <http://plplot.sourceforge.net/>: - "PLplot is a library of functions that are useful for making - scientific plots. - "PLplot can be used from within compiled languages such as C, - C++, FORTRAN and Java, and interactively from interpreted languages - such as Octave, Python, Perl and Tcl. - "The PLplot library can be used to create standard x-y plots, - semilog plots, log-log plots, contour plots, 3D surface plots, mesh - plots, bar charts and pie charts. Multiple graphs (of the same or - different sizes) may be placed on a single page with multiple lines - in each graph. - "A variety of output file devices such as Postscript, png, - jpeg and others, as well as interactive devices such as xwin, tk, - xterm and Tektronics devices are supported. New devices can be easily - added by writing a small number of device dependent routines. - "There are almost 2000 characters in the extended character - set. This includes four different fonts, the Greek alphabet and a - host of mathematical, musical, and other symbols. Some devices - supports its own way of dealing with text, such as the Postscript - driver, or the png and jpeg drivers that uses the Freetype library." -4 The Bindings - The bindings are a re-expression and extension of the - C-language API and as such are a kind of abstract layer between the - user's code and the PLplot binary library. Additionally, there are a - few capabilities not in the official API but nonetheless which are - available to the C programmer which are included in the bindings and - thus are directly available to the Ada programmer. - The thin binding is a layer between the thick bindings and - the underlying C code. It is mainly a programming convenience for the - developer of the bindings; this is a common implementation for - foreign language bindings and for the most part, the user can ignore - it. - There are two thick bindings provided for the convenience of - the user. Either may be used and they both provide exactly the same - functionality. The thick bindings are the user's main concern with - programming for PLplot. - 4.1 Thin Binding - The thin binding, in the files plplotthin.ads and - plplotthin.adb, is mostly a direct and obvious mapping of the - C application programming interface (API) to Ada. Thus, for - example, where a C program such as plcol0 requires a single - integer argument, there is a corresponding Ada program also - called plcol0 which also requires a single integer argument. - (plcol0 happens to set the drawing color using a number which - is associated with a set of colors.) Various constants from - the C API are also included here. Numeric types as defined in - PLplot are associated with numeric types in Ada in the thin - binding by use of Ada's type system. Thus, the thin binding - refers to the PLplot-centric type PLFLT for floating-point - types while the thick binding uses the usual Ada type - Long_Float. - Many of the comments from the C source header file - (similar in purpose to an Ada specification file) have been - retained in the thin binding, even when they are no longer - sensical. These might be pruned at some point to facilitate - reading the Ada source. - Also included in the thin binding are some other - declarations which help the Ada binding to mesh well with C - by emulating certain data structures which are needed in some - rather specialized usages as well as providing certain - subprogram pointer types. - The Ada programmer working with either of the thick - bindings will have to refer to the thin binding relatively - rarely, if ever, and mainly to examine the subroutine pointer - declarations and the several variant record types which are - used mostly for contour and three-dimensional plots. However, - some of these have been subtype-ed or renames-ed in the thick - bindings so even less reference to the thin binding will be - necessary. The goal is to put everything of interest to the - user in the thick bindings and the user need not with the - thin binding. - 4.2 The Thick Bindings - The thick bindings provide most of the information - that the Ada programmer needs. Normally, only one of the two - thick bindings would be used per user program but it should - be possible to include both but that scenario would be - unusual. - There are three main aspects of the thick bindings: - providing an alternative access to the PLplot API, extending - the PLplot functionality with some easy-to-use features, and - overlaying Ada data structures and types. - In the first aspect, the thick bindings provide a - fully Ada interface to the entire PLplot library. Packages - are with-ed and use-d as normal Ada code. Ada arrays can be - passed as usual, not requiring the array length or start or - end indices to be passed separately. All necessary Ada types - are made to match the underlying C types exactly. - The second aspect of the thick bindings is to provide - some simplified ways to get a lot of plotting done with only - one or two subroutine calls. For example, a single call to - Simple_Plot can display from one to five "y's" as a function - of a single "x" with default plot appearances chosen to suit - many situations. Other simple plotters are available for - three-dimensional and contour plots. Manipulating PLplot's - colors is similarly made easy and some default color schemes - are provided. - The third main aspect of the thick binding is to use - Ada data structures and Ada's type system extensively to - reduce the chances of inappropriate actions. For example, Ada - arrays are used throughout (as opposed to C's - pointer-plus-offset-while-carrying-along-the-size-separately - approach). Quantities which have natural range limits are - subtype-d to reflect those constraints. The hope is that - program errors will result in more-familiar Ada compilation - or run-time errors rather than error reports from the PLplot - library or no reports at all. However, there remain a few - instances where the typing could be improved and PLplot - errors will still be reported from time to time. - Both the specification and body for the standard - thick (and thin) binding contain the C subroutine name as a - comment line immediately above the Ada procedure declaration; - this should help in making the associations between "Ada" - names and "PLplot" names. Also, the subroutine-specific - comments from the C API have been retained verbatim. - 4.3 Standard Thick Binding Using Enhanced Names - The distinguishing feature of this thick binding (the - "standard" binding) is to provide more descriptive names for - PLplot subroutines, variables, constants, arguments, and - other objects. Most Ada programmers will be more comfortable - using these names. For example, in the C API as well as the - thin Ada binding and the other thick Ada binding, the - procedure plcol0(1) sets the drawing color to red. In the - standard thick binding, the same thing is accomplished by - writing Set_Color(Red). The Ada program may just as well - write Set_Color(1) since the binding merely sets a constant - Red to be equal to the integer 1. Many such numeric constants - from the C API are given names in this thick binding. These - renamed integers are discussed more fully in Section 7.2. - The disadvantage of this renaming is that it makes - referring to the PLplot documentation somewhat awkward. There - might be, at some time, a utility for easing this problem by - providing an HTML file with links so that a "normal" PLplot - name can be linked to the "Ada" name along with the - appropriate entry in the Ada specification, as well as - another HTML file with links from the "Ada" name directly to - the PLplot web page that documents that name. It might also - be possible to provide an alternate version of the - documentation with the enhanced names used. (The developer of - the bindings has a sed file prepared which makes most of the - subroutine-name substitutions.) However, this thick binding - retains the original C subprogram names as comments - immediately above the function or procedure name in the code - listing so it is relatively easy to locate the relevant item - in the PLplot documentation. - One simple rule applies in reading the PLplot API - documentation: the argument names are in the same order in - Ada as in the PLplot documentation (the names are different) - except that all array lengths are eliminated. The PLplot - documentation, for each subroutine, shows a "redacted" - version which should be correct for Ada as well as other - languages which have proper arrays. - The standard bindings are in the Ada files plplot.ads - and plplot.adb. - 4.4 Thick Binding Using Traditional Names - This thick binding provides exactly the same - functionality as the standard thick binding but retains the - original names as used in the C code and the PLplot - documentation. - The traditional bindings are in the Ada files - plplot_traditional.ads and plplot_traditional.adb. - 4.5 Examples - An important part of the Ada bindings is the examples, - some 30 of which demonstrate how to use many of the features of - the PLplot package. These examples also serve as a testbed for - the bindings in Ada and other languages by checking the - Postscript files that are generated by each example against those - generated by the C versions. These examples have been completely - re-written in Ada (but retain a C flavor in the names that are - given to objects). All of the Ada examples generate exactly the - same Postscript as the C versions, Examples 14 and 17 excepted - since those operate interactively and don't (normally) make - Postscript. Two versions of each example are available, one - calling the standard binding and the other the traditional - binding. (In development, a sed script does almost all of the - conversion automatically.) -5 Obtaining the Software - There are three software components that you will need: an - Ada compiler, the PLplot library, and the Ada bindings. - 5.1 Obtaining an Ada compiler - You will need an Ada compiler in order to use the Ada - PLplot bindings. There are several compilers available. Here, - we will focus on the free, open source compiler that is - included with the GNU Compiler Collection, (gcc) which is at - the center of much of the open source software movement. The - gcc Ada compiler is known as GNAT, for GNU NYU Ada - Translator, where NYU stands for New York University. - (Although GNAT was originally developed at NYU, it has for - many years been developed and supported commercially by - AdaCore with academic and pro versions available.) - Your computer may already have GNAT installed, or you - can download it from gcc.gnu.org <http://gcc.gnu.org/>. - Another route to obtaining GNAT is from the AdaCore page, - libre2.adacore.com <https://libre2.adacore.com/>. There are - versions for many operating systems and processors including - Apple's OS X or its open source version Darwin, Linux, and - Windows. The gcc and AdaCore versions differ in their - licenses. Download the version that you need and follow the - installation instructions. - 5.2 Download and install PLplot - PLplot can be downloaded from the PLplot home page at - sourceforge.net—plplot - <http://sourceforge.net/projects/plplot>. Follow the - installation instructions after downloading. The installation - process is more involved than other open source software and - requires that your computer has cmake installed. OS X users - can try installing PLplot in its entirety from MacPorts but - that activity is not officially supported by the PLplot - developers. The advantage of using MacPorts is that all - installation dependencies are automatically installed for you. - 5.3 Download the Ada bindings to PLplot - The third major software component is the bindings - themselves. Since they are currently included with the PLplot - software itself, there is no need to download them from - another place. - The bindings themselves are six Ada source files - named (using GNAT filename extensions) plplot.ads, - plplot.adb, plplot_traditional.ads, plplot_traditional.adb, - plplothin.ads, plplotthin.adb. There are two additional - files, plplot_auxiliary.ads and plplot_auxililary.adb which - will be discussed later, in Section 9. These can be stored - somewhere on your system's search paths for easy access. -6 How to use the Ada bindings - 6.1 Ada 95 versus Ada 2005 - The bindings will work for either Ada 95 or Ada 2005. - The only difference that concerns PLplot users is that Ada - 2005, in Annex G.3, provides declarations for real-valued - vectors and matrices (along with some other functionality). - These declarations make available type Real_Vector and type - Real_Matrix. - The installation process for PLplot requires you to - select Ada 95 or Ada 2005. After that, the correct bindings - are generated automatically depending on your choice. The - differences are very minor: If Ada 2005, the type - declarations provided according to Annex G.3 are used; if Ada - 95, similar type declarations are provided. For the most - part, you don't need to think about this much. However, see - Section 9, Compilation Notes, if you are using Ada 95 and - need to declare vectors or matrices. The design goal in - either case is to encourage users to use Real_Vector and - Real_Matrix since these are the "official" versions of these - entities as of Ada 2005. Someone using objects based on these - type definitions in Ada 95 in their PLplot programs should - expect their programs to work without modification if they - should switch to Ada 2005. - 6.2 GNAT versus non-GNAT - The bindings were made using the GNAT compiler and - there is a slight dependence on that compiler. Specifically, - the Unrestricted_Access attribute of GNAT was used in making - the function Matrix_To_Pointers in plplotthin.adb and in a - few callbacks. Matrix_To_Pointers is called whenever an Ada - matrix (2D array) is passed to a PLplot subroutine. For more - about Unrestricted_Access attribute, see Implementation - Defined Attributes in the GNAT Reference Manual. This - dependency shouldn't be difficult to remove by either - incorporating the GNAT code which implements it, by following - the TO-DO comment near the function definition in - plplotthin.adb, or by providing the proper aliasing. - Another GNAT dependency is used to parse command line - arguments in a C-like way. - Most of the GNAT dependencies can be found by - searching the source code for "GNAT" and - "Unrestricted_Access." - The GNAT dependence, though slight, will no doubt - frustrate users of other Ada compilers. We welcome comments - from those users, especially comments with specific - suggestions on how to remove any GNAT-specific usages. - 6.3 Sample command line project - It is instructive to present a simple example that - can be compiled and run from the command line. Although this - example is specific to one installation, it should be fairly - straightforward to adapt it to another installation. Toward - that end, it is helpful to understand the PLplot lingo of - "build directory" and "installation directory." - Here is a simple program that will generate a plot of - part of a parabola. - with - PLplot_Auxiliary, - PLplot; - use - PLplot_Auxiliary, - PLplot; - - procedure Simple_Example is - x, y : Real_Vector(-10 .. 10); - begin - for i in x'range loop - x(i) := Long_Float(i); - y(i) := x(i)**2; - end loop; - - Initialize_PLplot; -- Call this only once. - Simple_Plot(x, y); -- Make the plot. - End_PLplot; -- Call this only once. - end Simple_Example; - - Next is a bash script that will compile, bind, and - link it. It is installation-specific in that paths to the - GNAT compiler, PLplot libraries, and BLAS (Basic Linear - Algebra System) and LAPACK (Linear Algebra Package) are - hard-coded. You will have to adjust the paths to fit your - installation. Some Linux installations which have GNAT 4.3 or - later (Ada 2005) pre-installed might have already set the - paths to the BLAS and LAPACK libraries. - (Note that the G.3 Annex of Ada 2005, in the GNAT - version, depends heavily on BLAS and LAPACK. These packages - are tried-and-true packages that are available from several - places in either C or Fortran versions. The present example - is specific to OS X which has them pre-installed.) - - #!/bin/bash - /usr/local/ada-4.3/bin/gnatmake simple_example.adb \ - -aI/usr/local/plplot_build_dir/bindings/ada \ - -aL/usr/local/plplot_build_dir/bindings/ada/CMakeFiles/plplota - dad.dir \ - -largs \ - /usr/local/plplot/lib/libplplotd.dylib \ - /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libblas.dylib \ - /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/liblapack.dylib - - Beware of inadvertent line wraps in the above code. - The resulting binary program can be run by typing - ./simple_example -7 Unique Features of the Ada bindings - The Ada bindings have been augmented with a number of - features that are not present in other languages which work with - PLplot. These features are intended to greatly simplify the use of - PLplot; many users will find that they can do most of their work - using these "Simple" plotters. Also included are facilities for - easily manipulating the PLplot color tables - 7.1 High-level features for simplified plotting - Foreground-background control - Draw_On_Black, Draw_On_White - The default for PLplot is to draw its graphics on a - black background. A white background can be used - instead with Draw_On_White or reset to the original - mode with Draw_On_Black. Each of these manipulates - color map 0 by swapping black and white so that - e.g.with Draw_On_White, formerly white lines on a - black background autotmatically become black lines on - a white background. - Simple Plotters - Several high-level but flexible plotters are - available, and more might be added in the future. It is - expected that many users will find that these high-level - routines are adequate for most of their day-to-day plotting. - Multiplot_Pairs - Plot up to five x-y pairs with easy labeling, - coloring, line width and styles, justification, and - zooming. - Simple_Plot - Plot up to five y's against a single x with easy - labeling and automatic line colors and styles. - Simple_Plot_Log_X - Same as Simple_Plot but with logarithmic x-axis. - Simple_Plot_Log_Y - Same as Simple_Plot but with logarithmic y-axis. - Simple_Plot_Log_XY - Same as Simple_Plot but with logarithmic x- and - y-axes. - Simple_Plot_Pairs - Plot up to five x–y pairs with easy labeling and - automatic line colors and styles. - Single_Plot - Plot a single x–y pair with flexible labels, axis - styles, colors, line width and style, justification, - and zooming. - Simple_Contour - Make a contour plot with labels - Simple_Mesh_3D - Easy 3D mesh plot with labels, zooming, and - perspective controls - Simple_Surface_3D - Easy 3D surface plot with labels, zooming, and - perspective controls - Simple color map manipulations - PLplot provides extensive manipulation and control of - two separate color maps, color map 0 and color map 1. The Ada - binding makes basic manipulations easier and also adds - facilities for making snapshots of color map 0 so that any - state of the map can easlily be restored later. An initial - snapshot is taken when the package is initialized so that the - default color settings can always be restored after having - been changed. - Another set of features lets the user reset the 16 - individual colors in color map 0 after a color definition has - been changed. It is important to note that while - Set_Pen_Color(Red) (plcol0 in the traditional binding) - normally does what it says, Red simply has the value 1. If - the user changes the color map so that 1 corresponds to - another color, then Set_Pen_Color(Red) will draw in that - color instead of red. To always assure that red is drawn even - if the color map has been changed for integer 1, use - Set_Pen_Color(Reset_Red) instead. These 16 "reset" functions - return the appropriate default integer for the specified - color but also reset that slot in the color table so that a - subsequent call such as Set_Pen_Color(Red) will also cause - drawing in red. - Color map 1 also gets a easy-to-use makeover for Ada - users. There are several pre-built color themes that are - useful for quickly making surface and mesh plots, - Color_Themes_For_Map_1_Type. These color themes can be - quickly applied with Quick_Set_Color_Map_1. - Miscellaneous other Ada features include a pre-built - mask function for Shade_Regions that does no masking; perhaps - the most useful purpose is to provide a template for writing - mask functions that do mask. And there is a handy function - for calculating the contour levels for making contour plots. - Color table snapshots - Make_Snapshot_Of_Color_Map_0 - Restore_Snapshot_Of_Color_Map_0 - Restore_Default_Snapshot_Of_Color_Map_0 - Color resetting functions for the 16 colors of color map 0 - Reset_Black, Reset_Red, … Reset_White - Easy manipulation of color map 1 - Pre-built color themes for color map 1: - Color_Themes_For_Map_1_Type - Quick application of pre-built color themes: - Quick_Set_Color_Map_1 - Other features - A pre-built mask function for Shade_Regions that does - no masking: Mask_Function_No_Mask - An easy way to calculate an array of contour levels - for contour plots: Calculate_Contour_Levels - 7.2 Integer-options Given Ada Names - The C version of PLplot uses a number of integers to mean - specific things. Unfortunately, the meaning is lost when it it - consigned to being a mere integer with no name. The Ada binding - partially rectifies this situation by giving names to these - integer constants—the integer can still be used if desired. (A - more complete and safer rectification would use enumerated types.) - Below is a listing of at least the contexts in which - these "re-namings" have been applied. In some cases the entire - range of values is listed, but if there are more than about four - such values for each context, only a sampling is given. - Instances - Colors: Plot_Color_Type - 0 is Black, 1 is Red, etc. - Justification for plots: Justification_Type - User_Justified - Not_Justified - Justified - Justified_Square_Box - Axis styles: Axis_Style_Type - Linear_Major_Grid - Linear_Minor_Grid - etc. - Font styles: Font_Style_Type - Normal_Font - Roman_Font - Italic_Font - Script_Font - Character sets: Character_Set_Type - Standard_Character_Set - Extended_Character_Set - Plot orientation: Orientation_Type - Landscape - Portrait - Modes for parsing command line arguments: Parse_Mode_Type - E.g. PL_PARSE_PARTIAL - Descriptions of map outlines (continents, states, etc.): - Map_Type - Continents - USA_and_States - Continents_and_Countries - USA_States_and_Continents - Various style and view options for 3D and surface plots - E.g. Lines_Parallel_To_X - Kind of gridding algorithm for interpolating 2D data to a - grid: Gridding_Algorithm_Type - E.g. Grid_Bivariate_Cubic_Spline_Approximation - Flags for histogram style - E.g. Histogram_Default - Flags for histogram binning - E.g. Bin_Default - Names for color space models - Hue, Lightness, Saturation: HLS - Red, Green, Blue: RGB - 7.3 One-offs - Convenient string handling for Get_Device_Name - (plgdev in the traditional binding); a function version is - provided that simplifies the string handling associated with - this feature. - Overloaded Set_Line_Style (plstyl in the traditional - binding) with a version that takes a single argument, - Default_Continuous_Line. This replaces the awkward situation - of calling the normal versions of these procedures with - unused arguments simply to set the line style to the default, - continuous, line. - The contour plotter Contour_Plot_Irregular_Data - (plfcont in the traditional binding) is provided for making - contour plots from irregularly spaced data. This feature is - not documented in the PLplot API documentation. -8 Parts That Retain a C Flavor - There remains at least one area in the Ada bindings which is - still affected by the C underpinnings. This might be cleaned up in - future versions. There might be other residual C influence as well. - 8.1 Map-drawing - plmapform as called by Draw_Latitude_Longitude - (plmap) and Draw_Latitude_Longitude (plmeridians) - This is the only place in the PLplot bindings where a - C subprogram calls an Ada subprogram while passing an array. - If the array is unconstrained, there is no guarantee that it - will work because C has no way of telling Ada what offset to - use for the beginning of the array. But passing a constrained - array is acceptable with the downside that the array size - must be fixed within the bindings as being large enough to - handle any situation; currently, it is sized as 0 .. 2000. - See Example 19 for how this is handled in by the user - program. The constrained array is called - Map_Form_Constrained_Array. -9 Known Issues - 9.1 Stripchart labelling - In Example 17, all of the stripchart labels are the - same regardless of the fact that the calling program sets - them to be different. This is likely to affect user programs - in the same manner. - 9.2 Documentation - In numerous places in the documentation, a feature is - listed or described as "C only." Many of these features are - actually available in Ada. For example, in Contour_Plot - (plcont in the traditional binding), the transformation from - array indices to world coordinates is mentioned as "C only" - but is actually available in Ada. -10 Compilation notes - 10.1 Ada 95 Versus Ada 2005 - As discussed in Section 6.1, the bindings are made to - work with Ada 95 but to also take advantage of the Annex G.3 - (vector-matrix) features of Ada 2005. Actually, this - adaptation takes place during the PLplot build process when - DHAVE_ADA_2007=OFF or DHAVE_ADA_2007=ON is chosen; the - appropriate binding source files are generated automatically. - User programs will work with either compiler type without - modification. - 10.2 GNAT Dependence - There is a slight but significant dependence on the - GNAT version of Ada. This is discussed more fully in Section - 6.2 - 10.3 Compiler Warnings - During normal compilation of the Ada bindings, - approximately a dozen warnings are generated, in pairs, of - the following form: - bar.adb:46: warning: type of argument "foo" is unconstrained - array - bar.adb:46: warning: foreign caller must pass bounds - explicitly - These are normal and an unavoidable consequence of some of - the callback routines interacting with the underlying C code. - 10.4 PLplot_Auxiliary - The bindings include files PLplot_Auxiliary.ads and - PLplot_Auxiliary.adb. These files are currently used to - provide a few convenience subprograms that are used in the - examples. However, they are also very tightly associated with - the above-mentioned facility to accommodate either Ada 95 or - Ada 2005 compilers. The current situation is such that if the - user is using an Ada 95 compiler and requires the Real_Vector - or Real_Matrix type definitions, then he/she should with - PLplot_Auxiliary. If in doubt, PLplot_Auxiliary can always be - with-ed without harm. In the future, this confusion might be - removed and the need for PLplot_Auxiliary removed. (However, - user programs that with it should still work without change.) -11 Notes for Apple Macintosh OS X users - The following comments apply to users of Apple Macintosh - computers which run OS X. OS X users may use Apple's free integrated - development environment (IDE) or may prefer other methods such as - using a favorite editor and building from the command line. - OS X users should be aware that an excellent graphical - terminal program is available and is highly recommended. It is called - AquaTerm and is a full Cocoa program with window control. Performing - a cut operation places a PDF of the front window on the clipboard, a - convenience when working with other graphics or word processing - programs. - 11.1 Using Apple's Xcode IDE - The Macintosh Ada community has made a plug-in for - Apple's free Xcode integrated development environment (IDE) - that makes programming Ada in Xcode possible. The plug-in is - included with the compiler that is available at - www.macada.org <http://www.macada.org/>. Since Xcode is based - on gcc, it is possible to work in the various gcc languages - as well as to incorporate binaries such as the PLplot library. - In order to make an Xcode project, drag-and-drop - source files and the PLplot library file to the Groups & - Files pane of an Ada project. There are a few idiosyncrasies - that you may encounter so make sure to contact the very - friendly Macintosh Ada mailing list at www.macada.org - <http://www.macada.org/> or study the FAQ at that same site - if you have any difficulties. - 11.2 A Note on AquaTerm - AquaTerm is a display option available on Macintosh - computers using OS X and is supported by PLplot. It is a - native Cocoa graphics "terminal" that is highly recommended. - All output is antialiased and is easily cut-and-pasted in OS - X's native PDF format. Get it at - sourceforge.net—showfiles.php - <http://sourceforge.net/project/showfiles.php?group_id=39915>. - It can also be installed from either the Fink - www.finkproject.org <http://www.finkproject.org/> or MacPorts - www.macports.org—projects. - <http://www.macports.org/projects.> projects. - 11.3 X11 - Apple supplies the X11 windowing system that is - popular on some other Unix and Linux operations systems as - part of the Developer Tools. All PLplot programs made with - the Ada bindings will run on X11. In fact, some types of - interactivity such as Examples 14 and 17 will not run on - Apple's X11 (as of OS X 10.4 at least) and must be run on X11 - (or some other output device such as TCL/TK). - 11.4 GNAT for OS X - Apple Macintosh users will benefit from a pre-built - version of GNAT that comes packaged using the usual Apple - software installer and is strongly recommended. This compiler - is available for both PowerPC and Intel Macintoshes at - www.macada.org—Welcome.html. - <http://www.macada.org/macada/Welcome.html.>. This site is - traditionally rather confusing but the mailing list is - extremely helpful. The installer also includes an - Ada-specific plug-in for Apple's Xcode IDE which is strongly - recommended if you plan to work on this platform. Xcode is - part of the Developer Tools and is available on the Apple - system disks that also contain the operating system or it can - be downloaded for free from developer.apple.com—xcode - <http://developer.apple.com/tools/xcode/>. - - - Document version dated September 8, 2008 - Author: Jerry Bauck - © 2008 Jerry Bauck - Distributed as part of the PLplot plotting software Deleted: trunk/bindings/ada/README.pdf =================================================================== (Binary files differ) Deleted: trunk/bindings/ada/README.rtf =================================================================== --- trunk/bindings/ada/README.rtf 2010-08-27 22:37:00 UTC (rev 11157) +++ trunk/bindings/ada/README.rtf 2010-09-01 10:53:16 UTC (rev 11158) @@ -1,734 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf480 -{\fonttbl\f0\fswiss\fcharset77 Arial-BoldMT;\f1\fswiss\fcharset77 ArialMT;\f2\fmodern\fcharset77 Courier; -\f3\fswiss\fcharset77 Arial-ItalicMT;\f4\fswiss\fcharset77 Helvetica;\f5\fnil\fcharset77 BitstreamVeraSansMono-Roman; -} -{\colortbl;\red255\green255\blue255;\red0\green0\blue0;} -\pard\ql\qnatural\pardirnatural - -\f0\b\fs32 \cf0 \up0 \nosupersub \ulnone \obliqueness0 \expansion0 Ada Bindings for the PLplot Plotting Package\ - \ -\ -\pard\tx200\li200\fi-200\ql\qnatural\pardirnatural - -\fs28 1 About the This Document\ -\pard\li200\ql\qnatural\pardirnatural - -\f1\b0\fs24 \cf2 This document describes the Ada bindings to the PLplot technical plotting software, how to obtain the necessary software components, and how to use them together.\ -\pard\tx200\li200\fi-200\ql\qnatural\pardirnatural - -\f0\b\fs28 \cf0 2 Overview\ -\pard\li200\ql\qnatural\pardirnatural - -\f1\b0\fs24 \cf2 The Ada bindings for PLplot provide a way for Ada programmers to access the powerful PLplot technical plotting facilities directly from Ada programs while working completely in Ada\'d1the Ada programmer never needs to know or worry that PLplot itself is written in another language.\ - There are a thin binding and two thick bindings provided. The thin binding presents the application programming interface (API) in a form very similar to the C API, although in 100% Ada. The thick bindings present the API in a form to which Ada programmers will be more accustomed and add some ease-of-use features. It is expected that the thick bindings will be preferred.\ -\pard\tx200\li200\fi-200\ql\qnatural\pardirnatural - -\f0\b\fs28 \cf0 3 About PLplot\ -\pard\li200\ql\qnatural\pardirnatural - -\f1\b0\fs24 \cf2 PLplot is a general purpose technical plotting package that can be accessed directly by the user's own program without first writing the data to be plotted to disk. The package is marked by speed, convenience, breadth, and flexibility.\ - The PLplot project is one of the most active on SourceForge, typically in the 99th percentile for activity.\ - The following is taken from the PLplot web site at {\field{\*\fldinst{HYPERLINK "http://plplot.sourceforge.net/"}}{\fldrslt plplot.sourceforge.net}}:\ - "PLplot is a library of functions that are useful for making scientific plots.\ - "PLplot can be used from within compiled languages such as C, C++, FORTRAN and Java, and interactively from interpreted languages such as Octave, Python, Perl and Tcl.\ - "The PLplot library can be used to create standard x-y plots, semilog plots, log-log plots, contour plots, 3D surface plots, mesh plots, bar charts and pie charts. Multiple graphs (of the same or different sizes) may be placed on a single page with multiple lines in each graph.\ - "A variety of output file devices such as Postscript, png, jpeg and others, as well as interactive devices such as xwin, tk, xterm and Tektronics devices are supported. New devices can be easily added by writing a small number of device dependent routines.\ - "There are almost 2000 characters in the extended character set. This includes four different fonts, the Greek alphabet and a host of mathematical, musical, and other symbols. Some devices supports its own way of dealing with text, such as the Postscript driver, or the png and jpeg drivers that uses the Freetype library."\ -\pard\tx200\li200\fi-200\ql\qnatural\pardirnatural - -\f0\b\fs28 \cf0 4 The Bindings\ -\pard\li200\ql\qnatural\pardirnatural -\cf2 -\f1\b0\fs24 The bindings are a re-expression and extension of the C-language API and as such are a kind of abstract layer between the user's code and the PLplot binary library. Additionally, there are a few capabilities not in the official API but nonetheless which are available to the C programmer which are included in the bindings and thus are directly available to the Ada programmer.\ - The thin binding is a layer between the thick bindings and the underlying C code. It is mainly a programming convenience for the developer of the bindings; this is a common implementation for foreign language bindings and for the most part, the user can ignore it.\ - There are two thick bindings provided for the convenience of the user. Either may be used and they both provide exactly the same functionality. The thick bindings are the user's main concern with programming for PLplot.\ -\pard\tx360\tx740\li740\fi-740\ql\qnatural\pardirnatural - -\f0\b \cf2 4.1 Thin Binding\ -\pard\tx720\li720\fi-720\ql\qnatural\pardirnatural - -\f1\b0 \cf2 The thin binding, in the files -\f2 plplotthin.ads -\f1 and -\f2 plplotthin.adb -\f1 , is mostly a direct and obvious mapping of the C application programming interface (API) to Ada. Thus, for example, where a C program such as -\f2 plcol0 -\f1 requires a single integer argument, there is a corresponding Ada program also called -\f2 plcol0 -\f1 which also requires a single integer argument. ( -\f2 plcol0 -\f1 happens to set the drawing color using a number which is associated with a set of colors.) Various constants from the C API are also included here. Numeric types as defined in PLplot are associated with numeric types in Ada in the thin binding by use of Ada's type system. Thus, the thin binding refers to the PLplot-centric type -\f2 PLFLT -\f1 for floating-point types while the thick binding uses the usual Ada type -\f2 Long_Float -\f1 .\ - Many of the comments from the C source header file (similar in purpose to an Ada specification file) have been retained in the thin binding, even when they are no longer sensical. These might be pruned at some point to facilitate reading the Ada source.\ - Also included in the thin binding are some other declarations which help the Ada binding to mesh well with C by emulating certain data structures which are needed in some rather specialized usages as well as providing certain subprogram pointer types.\ - The Ada programmer working with either of the thick bindings will have to refer to the thin binding relatively rarely, if ever, and mainly to examine the subroutine pointer declarations and the several variant record types which are used mostly for contour and three-dimensional plots. However, some of these have been -\f2 subtype -\f1 -ed or -\f2 renames -\f1 -ed in the thick bindings so even less reference to the thin binding will be necessary. The goal is to put everything of interest to the user in the thick bindings and the user need not -\f2 with -\f1 the thin binding.\ -\pard\tx360\tx740\li740\fi-740\ql\qnatural\pardirnatural - -\f0\b \cf2 4.2 The Thick Bindings\ -\pard\tx720\li720\fi-720\ql\qnatural\pardirnatural - -\f1\b0 \cf0 The thick bindings provide most of the information that the Ada programmer needs. Normally, only one of the two thick bindings would be used per user program but it should be possible to include both but that scenario would be unusual.\ - There are three main aspects of the thick bindings: providing an alternative access to the PLplot API, extending the PLplot functionality with some easy-to-use features, and overlaying Ada data structures and types.\ - In the first aspect, the thick bindings provide a fully Ada interface to the entire PLplot library. Packages are -\f2 with -\f1 -ed and -\f2 use -\f1 -d as normal Ada code. Ada arrays can be passed as usual, not requiring the array length or start or end indices to be passed separately. All necessary Ada types are made to match the underlying C types exactly.\ - The second aspect of the thick bindings is to provide some simplified ways to get a lot of plotting done with only one or two subroutine calls. For example, a single call to -\f2 Simple_Plot -\f1 can display from one to five " -\f3\i y -\f1\i0 's" as a function of a single " -\f3\i x -\f1\i0 " with default plot appearances chosen to suit many situations. Other simple plotters are available for three-dimensional and contour plots. Manipulating PLplot's colors is similarly made easy and some default color schemes are provided.\ - The third main aspect of the thick binding is to use Ada data structures and Ada's type system extensively to reduce the chances of inappropriate actions. For example, Ada arrays are used throughout (as opposed to C's pointer-plus-offset-while-carrying-along-the-size-separately approach). Quantities which have natural range limits are -\f2 subtype -\f1 -d to reflect those constraints. The hope is that program errors will result in more-familiar Ada compilation or run-time errors rather than error reports from the PLplot library or no reports at all. However, there remain a few instances where the typing could be improved and PLplot errors will still be reported from time to time.\ - Both the specification and body for the standard thick (and thin) binding contain the C subroutine name as a comment line immediately above the Ada procedure declaration; this should help in making the associations between "Ada" names and "PLplot" names. Also, the subroutine-specific comments from the C API have been retained verbatim.\ -\pard\tx360\tx740\li740\fi-740\ql\qnatural\pardirnatural - -\f0\b \cf2 4.3 Standard Thick Binding Using Enhanced Names\ -\pard\tx720\li720\fi-720\ql\qnatural\pardirnatural - -\f1\b0 \cf2 The distinguishing feature of this thick binding (the "standard" binding) is to provide more descriptive names for PLplot subroutines, variables, constants, arguments, and other objects. Most Ada programmers will be more comfortable using these names. For example, in the C API as well as the thin Ada binding and the other thick Ada binding, the procedure -\f2 plcol0(1) -\f1 sets the drawing color to red. In the standard thick binding, the same thing is accomplished by writing -\f2 Set_Color(Red) -\f1 . The Ada program may just as well write -\f2 Set_Color(1) -\f1 since the binding merely sets a constant Red to be equal to the integer 1. Many such numeric constants from the C API are given names in this thick binding. These renamed integers are discussed more fully in Section 7.2.\ - The disadvantage of this renaming is that it makes referring to the PLplot documentation somewhat awkward. There might be, at some time, a utility for easing this problem by providing an HTML file with links so that a "normal" PLplot name can be linked to the "Ada" name along with the appropriate entry in the Ada specification, as well as another HTML file with links from the "Ada" name directly to the PLplot web page that documents that name. It might also be possible to provide an alternate version of the documentation with the enhanced names used. (The developer of the bindings has a sed file prepared which makes most of the subroutine-name substitutions.) However, this thick binding retains the original C subprogram names as comments immediately above the -\f2 function -\f1 or -\f2 procedure -\f1 name in the code listing so it is relatively easy to locate the relevant item in the PLplot documentation.\ - One simple rule applies in reading the PLplot API documentation: the argument names are in the same order in Ada as in the PLplot documentation (the names are different) except that all array lengths are eliminated. The PLplot documentation, for each subroutine, shows a "redacted" version which should be correct for Ada as well as other languages which have proper arrays.\ - The standard bindings are in the Ada files plplot.ads and plplot.adb.\ -\pard\tx360\tx740\li740\fi-740\ql\qnatural\pardirnatural - -\f0\b \cf2 4.4 Thick Binding Using Traditional Names\ -\pard\tx720\li720\fi-720\ql\qnatural\pardirnatural - -\f1\b0 \cf2 This thick binding provides exactly the same functionality as the standard thick binding but retains the original names as used in the C code and the PLplot documentation.\ - The traditional bindings are in the Ada files plplot_traditional.ads and plplot_traditional.adb.\ -\pard\tx360\tx740\li740\fi-740\ql\qnatural\pardirnatural - -\f0\b \cf2 4.5 Examples\ -\pard\li740\ql\qnatural\pardirnatural -\cf2 -\f1\b0 An important part of the Ada bindings is the examples, some 30 of which demonstrate how to use many of the features of the PLplot package. These examples also serve as a testbed for the bindings in Ada and other languages by checking the Postscript files that are generated by each example against those generated by the C versions. These examples have been completely re-written in Ada (but retain a C flavor in the names that are given to objects). All of the Ada examples generate exactly the same Postscript as the C versions, Examples 14 and 17 excepted since those operate interactively and don't (normally) make Postscript. Two versions of each example are available, one calling the standard binding and the other the traditional binding. (In development, a sed script does almost all of the conversion automatically.)\ -\pard\tx200\li200\fi-200\ql\qnatural\pardirnatural - -\f0\b\fs28 \cf0 5 Obtaining the Software\ -\pard\li200\ql\qnatural\pardirnatural - -\f1\b0\fs24 \cf2 There are three software components that you will need: an Ada compiler, the PLplot library, and the Ada bindings.\ -\pard\tx360\tx740\li740\fi-740\ql\qnatural\pardirnatural - -\f0\b \cf2 5.1 Obtaining an Ada compiler\ -\pard\tx720\li720\fi-720\ql\qnatural\pardirnatural - -\f1\b0 \cf2 You will need an Ada compiler in order to use the Ada PLplot bindings. There are several compilers available. Here, we will focus on the free, open source compiler that is included with the GNU Compiler Collection, (gcc) which is at the center of much of the open source software movement. The gcc Ada compiler is known as GNAT, for GNU NYU Ada Translator, where NYU stands for New York University. (Although GNAT was originally developed at NYU, it has for many years been developed and supported commercially by AdaCore with academic and pro versions available.)\ - Your computer may already have GNAT installed, or you can download it from {\field{\*\fldinst{HYPERLINK "http://gcc.gnu.org/"}}{\fldrslt gcc.gnu.org}}. Another route to obtaining GNAT is from the AdaCore page, {\field{\*\fldinst{HYPERLINK "https://libre2.adacore.com/"}}{\fldrslt libre2.adacore.com}}. There are versions for many operating systems and processors including Apple's OS X or its open source version Darwin, Linux, and Windows. The gcc and AdaCore versions differ in their licenses. Download the version that you need and follow the installation instructions. \ -\pard\tx360\tx740\li740\fi-740\ql\qnatural\pardirnatural - -\f0\b \cf2 5.2 Download and install PLplot\ -\pard\tx720\li720\fi-720\ql\qnatural\pardirnatural - -\f1\b0 \cf2 PLplot can be downloaded from the PLplot home page at {\field{\*\fldinst{HYPERLINK "http://sourceforge.net/projects/plplot"}}{\fldrslt sourceforge.net\'d1plplot}}. Follow the installation instructions after downloading. The installation process is more involved than other open source software and requires that your computer has cmake installed. OS X users can try installing PLplot in its entirety from MacPorts but that activity is not officially supported by the PLplot developers. The advantage of using MacPorts is that all installation dependencies are automatically installed for you.\ -\pard\tx360\tx740\li740\fi-740\ql\qnatural\pardirnatural - -\f0\b \cf2 5.3 Download the Ada bindings to PLplot\ -\pard\tx720\li720\fi-720\ql\qnatural\pardirnatural - -\f1\b0 \cf2 The third major software component is the bindings themselves. Since they are currently included with the PLplot software itself, there is no need to download them from another place.\ - The bindings themselves are six Ada source files named (using GNAT filename extensions) plplot.ads, plplot.adb, plplot_traditional.ads, plplot_traditional.adb -\f4 \cf0 , -\f1 \cf2 plplothin.ads, plplotthin.adb. There are two additional files, plplot_auxiliary.ads and plplot_auxililary.adb which will be discussed later, in Section 9. These can be stored somewhere on your system's search paths for easy access.\ -\pard\tx200\li200\fi-200\ql\qnatural\pardirnatural - -\f0\b\fs28 \cf0 6 How to use the Ada bindings\ -\pard\tx360\tx740\li740\fi-740\ql\qnatural\pardirnatural - -\fs24 \cf2 6.1 Ada 95 versus Ada 2005\ -\pard\tx720\li720\fi-720\ql\qnatural\pardirnatural - -\f1\b0 \cf2 The bindings will work for either Ada 95 or Ada 2005. The only difference that concerns PLplot users is that Ada 2005, in Annex G.3, provides declarations for real-valued vectors and matrices (along with some other functionality). These declarations make available -\f2 type Real_Vector -\f1 and -\f2 type Real_Matrix.\ - -\f1 The installation process for PLplot requires you to select Ada 95 or Ada 2005. After that, the correct bindings are generated automatically depending on your choice. The differences are very minor: If Ada 2005, the type declarations provided according to Annex G.3 are used; if Ada 95, similar type declarations are provided. For the most part, you don't need to think about this much. However, see Section 9, Compilation Notes, if you are using Ada 95 and need to declare vectors or matrices. The design goal in either case is to encourage users to use -\f2 Real_Vector -\f4 \cf0 -\f1 \cf2 and -\f2 Real_Matrix -\f1 since these are the "official" versions of these entities as of Ada 2005. Someone using objects based on these type definitions in Ada 95 in their PLplot programs should expect their programs to work without modification if they should switch to Ada 2005.\ -\pard\tx360\tx740\li740\fi-740\ql\qnatural\pardirnatural - -\f0\b \cf2 6.2 GNAT versus non-GNAT\ -\pard\tx720\li720\fi-720\ql\qnatural\pardirnatural - -\f1\b0 \cf2 The bindings were made using the GNAT compiler and there is a slight dependence on that compiler. Specifically, the -\f2 Unrestricted_Access -\f1 attribute of GNAT was used in making the function -\f2 Matrix_To_Pointers -\f1 in plplotthin.adb and in a few callbacks. -\f2 Matrix_To_Pointers -\f1 is called whenever an Ada matrix (2D array) is passed to a PLplot subroutine. For more about -\f2 Unrestricted_Access -\f1 attribute, see Implementation Defined Attributes in the GNAT Reference Manual. This dependency shouldn't be difficult to remove by either incorporating the GNAT code which implements it, by following the TO-DO comment near the function definition in plplotthin.adb, or by providing the proper aliasing.\ - Another GNAT dependency is used to parse command line arguments in a C-like way.\ - Most of the GNAT dependencies can be found by searching the source code for " -\f2 GNAT -\f1 " and " -\f2 Unrestricted_Access -\f1 ."\ - The GNAT dependence, though slight, will no doubt frustrate users of other Ada compilers. We welcome comments from those users, especially comments with specific suggestions on how to remove any GNAT-specific usages.\ -\pard\tx360\tx740\li740\fi-740\ql\qnatural\pardirnatural - -\f0\b \cf2 6.3 Sample command line project\ -\pard\tx720\li720\fi-720\ql\qnatural\pardirnatural - -\f1\b0 \cf2 It is instructive to present a simple example that can be compiled and run from the command line. Although this example is specific to one installation, it should be fairly straightforward to adapt it to another installation. Toward that end, it is helpful to understand the PLplot lingo of "build directory" and "installation directory."\ - Here is a simple program that will generate a plot of part of a parabola.\ - -\f2 with\ -\pard\li720\ql\qnatural\pardirnatural -\cf2 PLplot_Auxiliary,\ - PLplot;\ -use\ - PLplot_Auxiliary,\ - PLplot;\ -\ -procedure Simple_Example is\ - x, y : Real_Vector(-10 .. 10);\ -begin\ - for i in x'range loop \ - x(i) := Long_Float(i);\ - y(i) := x(i)**2;\ - end loop;\ -\ - Initialize_PLplot; -- Call this only once.\ - Simple_Plot(x, y); -- Make the plot.\ - End_PLplot; -- Call this only once.\ -end Simple_Example;\ -\ -\pard\tx720\li720\fi-720\ql\qnatural\pardirnatural - -\f1 \cf2 Next is a bash script that will compile, bind, and link it. It is installation-specific in that paths to the GNAT compiler, PLplot libraries, and BLAS (Basic Linear Algebra System) and LAPACK (Linear Algebra Package) are hard-coded. You will have to adjust the paths to fit your installation. Some Linux installations which have GNAT 4.3 or later (Ada 2005) pre-installed might have already set the paths to the BLAS and LAPACK libraries.\ - (Note that the G.3 Annex of Ada 2005, in the GNAT version, depends heavily on BLAS and LAPACK. These packages are tried-and-true packages that are available from several places in either C or Fortran versions. The present example is specific to OS X which has them pre-installed.)\ - \ -\pard\li720\ql\qnatural\pardirnatural - -\f2 \cf2 #!/bin/bash\ -/usr/local/ada-4.3/bin/gnatmake simple_example.adb \\\ --aI/usr/local/plplot_build_dir/bindings/ada \\\ --aL/usr/local/plplot_build_dir/bindings/ada/CMakeFiles/plplotadad.dir \\\ --largs \\\ -/usr/local/plplot/lib/libplplotd.dylib \\\ -/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libblas.dylib \\\ -/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/liblapack.dylib\ -\ -\pard\tx720\li720\fi-720\q... [truncated message content] |