StandAloneDisplayApp.h

Go to the documentation of this file.
00001 //# StandAloneDisplayApp.h: define functions needed for stand-alone display
00002 //# Copyright (C) 1999
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef TRIALDISPLAY_STANDALONEDISPLAYAPP_H
00029 #define TRIALDISPLAY_STANDALONEDISPLAYAPP_H
00030 
00031 // <summary>
00032 // Definitions of functions needed for stand-alone display applications.
00033 // </summary>
00034 
00035 // <synopsis>
00036 // Some services (at the moment just PgPlot services) are implemented
00037 // differently depending on whether the display application being built
00038 // is a stand-alone application, or is bound to some other process
00039 // (eg. Glish/Tk) which already has its own way of providing said
00040 // service.
00041 // </synopsis>
00042 
00043 // <motivation>
00044 // It seems sensible to provide a single include which looks after
00045 // implementation-specific issues for the programmer.
00046 // </motivation>
00047 
00048 // <group name="PgPlot driver definitions for stand-alone display applications">
00049 
00050 extern "C" {
00051 
00052 #if defined(__APPLE__)
00053         // Prototype for WorldCanvas driver
00054 
00055         extern void (*late_binding_pgplot_driver_1)(int *, float *, int *, char *,
00056                 int *, int);
00057         extern void (*late_binding_pgplot_driver_2)(int *, float *, int *, char *,
00058                 int *, int);
00059         extern void (*late_binding_pgplot_driver_3)(int *, float *, int *, char *,
00060                 int *, int);
00061 #if defined(__USE_WS_X11__) || defined(__MAC_10_6)
00062         extern void add_late_binding_pgdriver(void (*driver)(int *, float *, int *, char *, int *, int *, int));
00063         extern void wcdriv_(int *, float *, int *, char *, int *, int *, int);
00064 #define INITIALIZE_PGPLOT add_late_binding_pgdriver(wcdriv_);
00065 #else
00066         extern void wcdriv_(int *, float *, int *, char *, int *, int);
00067 #define INITIALIZE_PGPLOT                                               \
00068               if ( ! late_binding_pgplot_driver_1 )                               \
00069                   late_binding_pgplot_driver_1 = wcdriv_;                         \
00070               else if ( ! late_binding_pgplot_driver_2 )                          \
00071                   late_binding_pgplot_driver_2 = wcdriv_;                         \
00072               else if ( ! late_binding_pgplot_driver_3 )                          \
00073                   late_binding_pgplot_driver_3 = wcdriv_;                         \
00074               else                                                                \
00075                   std::cerr << "no free late-binding driver slots" << std::endl;
00076 
00077 #endif
00078 
00079 
00080 #else
00081 #define INITIALIZE_PGPLOT
00082 
00083 
00084         // Prototype for WorldCanvas driver
00085         void wcdriv_(int *, float *, int *, char *, int*, int *, int);
00086         // Null driver
00087         void nudriv_(int *, float *, int *, char *, int *, int);
00088 
00089         // This global function will over-ride the default PGPlot
00090         // function.  It supports only one device, that being the
00091         // Display Library's WorldCanvas.
00092         int grexec_(int *idev, int *ifunc, float *rbuf, int *nbuf,
00093                     char *chr, int *lchr, int len) {
00094                 static int one = 1;
00095                 switch (*idev) {
00096                 case 0:
00097                         rbuf[0] = float(2);
00098                         *nbuf = 1;
00099                         break;
00100                 case 1:
00101                         nudriv_(ifunc, rbuf, nbuf, chr, lchr, len);
00102                         break;
00103                 case 2:
00104                         wcdriv_(ifunc, rbuf, nbuf, chr, lchr, &one, len);
00105                         break;
00106                 default:
00107                         std::cerr << "StandAloneDisplayApp: unknown pgplot device " << *idev
00108                                   << std::endl;
00109                         break;
00110                 }
00111                 return 0;
00112         }
00113 #endif
00114 
00115 } // extern "C"
00116 
00117 // </group>
00118 
00119 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1