casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StandAloneDisplayApp.h
Go to the documentation of this file.
1 //# StandAloneDisplayApp.h: define functions needed for stand-alone display
2 //# Copyright (C) 1999
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef TRIALDISPLAY_STANDALONEDISPLAYAPP_H
29 #define TRIALDISPLAY_STANDALONEDISPLAYAPP_H
30 
31 // <summary>
32 // Definitions of functions needed for stand-alone display applications.
33 // </summary>
34 
35 // <synopsis>
36 // Some services (at the moment just PgPlot services) are implemented
37 // differently depending on whether the display application being built
38 // is a stand-alone application, or is bound to some other process
39 // (eg. Glish/Tk) which already has its own way of providing said
40 // service.
41 // </synopsis>
42 
43 // <motivation>
44 // It seems sensible to provide a single include which looks after
45 // implementation-specific issues for the programmer.
46 // </motivation>
47 
48 // <group name="PgPlot driver definitions for stand-alone display applications">
49 
50 extern "C" {
51 
52 #if defined(__APPLE__)
53  // Prototype for WorldCanvas driver
54 
55  extern void (*late_binding_pgplot_driver_1)(int *, float *, int *, char *,
56  int *, int);
57  extern void (*late_binding_pgplot_driver_2)(int *, float *, int *, char *,
58  int *, int);
59  extern void (*late_binding_pgplot_driver_3)(int *, float *, int *, char *,
60  int *, int);
61 #if defined(__USE_WS_X11__) || defined(__MAC_10_6)
62  extern void add_late_binding_pgdriver(void (*driver)(int *, float *, int *, char *, int *, int *, int));
63  extern void wcdriv_(int *, float *, int *, char *, int *, int *, int);
64 #define INITIALIZE_PGPLOT add_late_binding_pgdriver(wcdriv_);
65 #else
66  extern void wcdriv_(int *, float *, int *, char *, int *, int);
67 #define INITIALIZE_PGPLOT \
68  if ( ! late_binding_pgplot_driver_1 ) \
69  late_binding_pgplot_driver_1 = wcdriv_; \
70  else if ( ! late_binding_pgplot_driver_2 ) \
71  late_binding_pgplot_driver_2 = wcdriv_; \
72  else if ( ! late_binding_pgplot_driver_3 ) \
73  late_binding_pgplot_driver_3 = wcdriv_; \
74  else \
75  std::cerr << "no free late-binding driver slots" << std::endl;
76 
77 #endif
78 
79 
80 #else
81 #define INITIALIZE_PGPLOT
82 
83 
84  // Prototype for WorldCanvas driver
85  void wcdriv_(int *, float *, int *, char *, int*, int *, int);
86  // Null driver
87  void nudriv_(int *, float *, int *, char *, int *, int);
88 
89  // This global function will over-ride the default PGPlot
90  // function. It supports only one device, that being the
91  // Display Library's WorldCanvas.
92  int grexec_(int *idev, int *ifunc, float *rbuf, int *nbuf,
93  char *chr, int *lchr, int len) {
94  static int one = 1;
95  switch (*idev) {
96  case 0:
97  rbuf[0] = float(2);
98  *nbuf = 1;
99  break;
100  case 1:
101  nudriv_(ifunc, rbuf, nbuf, chr, lchr, len);
102  break;
103  case 2:
104  wcdriv_(ifunc, rbuf, nbuf, chr, lchr, &one, len);
105  break;
106  default:
107  std::cerr << "StandAloneDisplayApp: unknown pgplot device " << *idev
108  << std::endl;
109  break;
110  }
111  return 0;
112  }
113 #endif
114 
115 } // extern "C"
116 
117 // </group>
118 
119 #endif
int grexec_(int *idev, int *ifunc, float *rbuf, int *nbuf, char *chr, int *lchr, int len)
This global function will over-ride the default PGPlot function.