Togl is a Tk widget for OpenGL rendering.
Togl was originally based on OGLTK, written by Benjamin Bederson at
the University of New Mexico.
Togl adds the new features:
color-index mode support including color allocation functions
support for requesting stencil, accumulation, alpha buffers, etc
multiple OpenGL drawing widgets
OpenGL extension testing from Tcl
simple, portable font support
overlay plane support
Togl allows one to create and manage a special Tk/OpenGL widget
with Tcl and render into it with a C program. That is,
a typical Togl program will have Tcl code for managing the user interface
and a C program for computations and OpenGL rendering.
There are basically two ways of using Togl with your application:
Link or "compile in" Togl with your executable or shared library. In this
case you must call Togl_Init() from your C code to initialize Togl. This
is the way the included Togl examples are built.
Install the Togl shared library and pkgIndex.tcl file
(using make install) and then load it into wish using
package require Togl.
Then, before creating the Togl widget, call functions in your application
code (also a compiled into a shared library and loaded into wish)
to setup the Togl widget for the OpenGL rendering.
Create the blank Togl widget,
and then you're managing redraws and buffer swapping from the Tcl level.
Since Togl is compiled into a shared library using the Tcl/Tk stubs-interface,
the same binary can be used with any version of Tck/Tk from 8.06 and up.
See README.stubs for more info.
Unix/X11 usage
Unix/X systems only need the togl.c, togl.h
and the public Tcl/Tk include files.
Windows 95/NT/2000/XP usage
Windows platforms need tkWinInt.h
and other internal Tk header files. So you need a Tcl/Tk
source distribution in addition to the Togl distribution
(or copy over the various include files).
Here's the minimal way to build Togl with Tcl/Tk
using the gcc that is distributed
as part of the cygwin tools
(Microsoft's compilers work too):
VER=8.4.12
SRCDIR=`pwd`
cd $SRCDIR/tcl$VER/win
env 'CC=gcc -mno-cygwin' ./configure --enable-threads
make libtclstub84.a
cd $SRCDIR/tk$VER/win
env 'CC=gcc -mno-cygwin' ./configure --enable-threads
make libtkstub84.a
cd $SRCDIR/Togl
env 'CC=gcc -mno-cygwin' ./configure --with-tcl=../tcl$VER/win --with-tk=../tk$VER/win
make
The resulting Togl17.dll and pkgIndex.tcl
should be installed into your Tcl distribution just like any other package.
Mac OS X usage
These special instructions are for building the Aqua version of Togl.
Mac OS X needs tkMacOSXInt.h
and other internal Tk header files. Unfortunately, the Tcl and Tk
frameworks that Apple distributes are missing the internal headers.
So you need a Tcl/Tk source distribution in addition to the Togl
distribution (or copy over the various include files).
You would probably want a newer version of Tcl and Tk anyway
because each minor revision of 8.4 has many Aqua bug fixes.
Here's one way to build Tcl, Tk, and Togl on Mac OS X (assuming they
are all in the same directory) to install in your home directory:
VER=8.4.12
mkdir -p ~/bin
make -C tcl$VER/macosx install PREFIX="${HOME}" INSTALL_PATH="${HOME}/Library/Frameworks"
make -C tk$VER/macosx install PREFIX="${HOME}" INSTALL_PATH="${HOME}/Library/Frameworks"
(cd Togl; ./configure --prefix="${HOME}")
make -C Togl install
Register C functions to be called by Tcl/Tk when a widget is realized,
must be redrawn, is resized, or is destroyed respectively.
Each C callback must be of the form:
void callback(Togl *togl)
{
...your code...
}
void Togl_TimerFunc(Togl_Callback *proc)
Register a C timer callback function which will be called every
n milliseconds. The interval n is specified
by the -time option to the Togl Tcl command.
Used to create a new Togl sub-command. The C function which implements
the command must be of the form:
int callback(Togl *togl, int argc, char *argv[])
{
...your code...
return TCL_OK or TCL_ERROR;
}
Drawing-related Commands
void Togl_PostRedisplay(Togl *togl)
Signals that the widget should be redrawn. When Tk is next idle the
user's C render callback will be invoked. This is typically called
from within a Togl sub-command which was registered with
Togl_CreateCommand().
void Togl_SwapBuffers(const Togl *togl)
Swaps the front and back color buffers for a double-buffered widget.
glFlush() is executed if the window is single-buffered. This is
typically called in the rendering function which was registered with
Togl_DisplayFunc().
void Togl_MakeCurrent(const Togl *togl)
Sets the current rendering context to the given widget. This is done
automatically before the Togl callback functions are called. So the
call is only needed if you have multiple widgets with separate OpenGL
contexts. If the argument is NULL, then the rendering context is cleared
and subsequent OpenGL commands will fail.
Query Functions
char *Togl_Ident(const Togl *togl)
Returns a pointer to the identification string associated with a Togl
widget or NULL if there's no identifier string.
int Togl_Width(const Togl *togl)
Returns the width of the given Togl widget. Typically called in the
function registered with Togl_ReshapeFunc().
int Togl_Height(const Togl *togl)
Returns the height of the given Togl widget. Typically called in the
function registered with Togl_ReshapeFunc().
Tcl_Interp *Togl_Interp(const Togl *togl)
Returns the Tcl interpreter associated with the given Togl widget.
Tk_Window Togl_TkWin(const Togl *togl)
Returns the Tk window associated with the given Togl widget.
Color Index Mode Functions
These functions are only used for color index mode.
unsigned long Togl_AllocColor(Togl *togl, float red, float green, float blue)
Allocate a color from a read-only colormap. Given a color specified
by red, green, and blue return a colormap index (aka pixel value)
whose entry most closely matches the red, green, blue color. Red,
green, and blue are values in [0,1]. This function is only used in
color index mode when the -privatecmap option is false.
void Togl_FreeColor(Togl *togl, unsigned long index)
Free a color in a read-only colormap. Index is a value which was
returned by the Togl_AllocColor() function. This function is only
used in color index mode when the -privatecmap option
is false.
Load the colormap entry specified by index with the given red, green
and blue values. Red, green, and blue are values in [0,1]. This
function is only used in color index mode when the
-privatecmap option is true.
Load the named font as a set of glBitmap display lists.
fontname may be one of
TOGL_BITMAP_8_BY_13
TOGL_BITMAP_9_BY_15
TOGL_BITMAP_TIMES_ROMAN_10
TOGL_BITMAP_TIMES_ROMAN_24
TOGL_BITMAP_HELVETICA_10
TOGL_BITMAP_HELVETICA_12
TOGL_BITMAP_HELVETICA_18
or any X11 font name
Zero is returned if this function fails.
After Togl_LoadBitmapFont() has been called, returning fontbase,
you can render a string s with:
clientData is a pointer to an arbitrary user data structure.
Each Togl struct has such a pointer.
This function sets the Togl widget's client data pointer.
ClientData Togl_GetClientData(const Togl *togl)
clientData is a pointer to an arbitrary user data structure.
Each Togl struct has such a pointer.
This function returns the Togl widget's client data pointer.
void Togl_ClientData(ClientData clientData)
clientData is a pointer to an arbitrary user data structure.
Set default client data pointer for subsequent new Togl widgets.
Default value is NULL.
Overlay Functions
These functions are modelled after GLUT's overlay sub-API.
void Togl_UseLayer(Togl *togl, int layer)
Select the layer into which subsequent OpenGL rendering will be
directed. layer may be either TOGL_OVERLAY or
TOGL_NORMAL.
void Togl_ShowOverlay(Togl *togl)
Display the overlay planes, if any.
void Togl_HideOverlay(Togl *togl)
Hide the overlay planes, if any.
void Togl_PostOverlayRedisplay(Togl *togl)
Signal that the overlay planes should be redraw.
When Tk is next idle the user's C overlay display callback will be invoked.
This is typically called from within a Togl sub-command which was
registered with Togl_CreateCommand().
void Togl_OverlayDisplayFunc(Togl_Callback *proc)
Registers the C callback function which should be called to redraw the
overlay planes. This is the function which will be called in
response to Togl_PostOverlayRedisplay().
The callback must be of the form:
Allocate a color in the overlay planes. Red, green, and blue are
values in [0,1]. Return the color index or -1 if the allocation
fails.
void Togl_FreeColorOverlay(const Togl *togl, unsigned long index)
Free a color which was allocated with Togl_AllocColorOverlay().
X11-only Functions
These functions are only implemented on systems using the X Window System.
We recommend that you avoid using these functions in your application since
they are not portable to other operating/window systems
(use Togl_TkWin() and normal Tk functions instead).
Display *Togl_Display(const Togl *togl)
Returns the X Display of a Togl widget.
Screen *Togl_Screen(const Togl *togl)
Returns the X Screen of a Togl widget.
int Togl_ScreenNumber(const Togl *togl)
Returns the X screen number of a Togl widget.
Colormap Togl_Colormap(const Togl *togl)
Returns the X Colormap used by a Togl widget.
Postscript Output
int Togl_DumpToEpsFile(const Togl *togl,
const char *filename, int rgbFlag, void (*user_redraw)())
Generate an encapsulated Postscript file of the image in a Togl widget.
filename is the name of the file to generate.
If rgbFlag is non-zero then an RGB image file is written,
else a grayscale image file is written.
user_redraw is a pointer to the function which will render the
desired image. This will typically be the same as the function passed
to Togl_DisplayFunc().
These are the Togl commands one may call from a Tcl program.
togl pathName [options]
Creates a new togl widget with name pathName and
an optional list of configuration options. Options include:
Option
Default
Comments
-width
400
Width of widget in pixels.
-height
400
Height of widget in pixels.
-ident
""
A user identification string. This is used match widgets
for the -sharecontext
and the -sharelist options (see below).
This is also useful in your callback functions
to determine which Togl widget is the caller.
-rgba
true
If true, use RGB(A) mode, otherwise use Color Index mode.
-redsize
1
Minimum number of bits in red component.
-greensize
1
Minimum number of bits in green component.
-bluesize
1
Minimum number of bits in blue component.
-alpha
1
If true and -rgba is true, request an alpha channel.
-alphasize
1
Minimum number of bits in alpha component.
-double
false
If true, request a double-buffered window, otherwise
request a single-buffered window.
-depth
false
If true, request a depth buffer.
-depthsize
1
Minimum number of bits in depth buffer.
-accum
false
If true, request an accumulation buffer.
-accumredsize
1
Minimum number of bits in accumulation buffer red component.
-accumgreensize
1
Minimum number of bits in accumulation buffer green component.
-accumbluesize
1
Minimum number of bits in accumulation buffer blue component.
-accumalphasize
1
Minimum number of bits in accumulation buffer alpha component.
-stencil
false
If true, request a stencil buffer.
-stencilsize
1
Minimum number of bits in stencil component.
-auxbuffers
0
Desired number of auxiliary buffers.
-privatecmap
false
Only applicable in color index mode.
If false, use a shared read-only colormap.
If true, use a private read/write colormap.
-overlay
false
If true, request overlay planes.
-stereo
false
If true, request a stereo-capable window.
-oldstereo
false
On SGI workstations only: if true, request divided-screen stereo.
-time
1
Specifies the interval, in milliseconds, for
calling the C timer callback function which
was registered with Togl_TimerFunc.
-sharelist
""
Name of an existing Togl widget with which to
share display lists.
-sharecontext
""
Name of an existing Togl widget with which to
share the OpenGL context. NOTE: most other
attributes such as double buffering, RGBA vs CI,
ancillary buffer specs, etc are then ignored.
-indirect
false
If present, request an indirect rendering context.
A direct rendering context is normally requested.
Only significant on Unix/X11.
-cursor
""
Set the cursor in the widget window.
-pixelformat
0
Set the pixel format to the (platform-dependent) given value.
pathName configure
Returns all configuration records for the named togl widget.
pathName configure -option
Returns configuration information for the specifed option
which may be one of:
-width
Returns the width configuration of the widget in the form:
-width width Width Ww
where W is the default width in pixels
and w is the current width in pixels
-height
Returns the height configuration of the widget in the form:
-height height Height Hh
where H is the default height in pixels
and h is the current height in pixels
-extensions
Returns a list of OpenGL extensions available. For example:
GL_EXT_polygon_offset GL_EXT_vertex_array
pathName configure -optionvalue
Reconfigure a Togl widget. option may be any one of the
options listed in the togl command above.
pathName render
Causes the render callback function to be called for pathName.
pathName swapbuffers
Causes front/back buffers to be swapped if in double buffer mode.
And flushs the OpenGL command buffer if in single buffer mode.
(So this is appropriate to call after every frame is drawn.)
pathName makecurrent
Make the widget specified by pathName and its OpenGL context
the current ones.
— compares single vs double buffering with two Togl widgets
texture.tcl
— lets you play with texture mapping options
index.tcl
— demo of using color index mode
overlay.tcl
— example of using overlay planes (requires overlay hardware)
stereo.tcl
— stereo example
gears.tcl
— spinning gears demo
To compile the demos, edit the Makefile to suit your system, then
type make demos.
The demos are compiled into shared libraries,
that can are loaded into the Tcl interpreter as Tcl/Tk-extensions.
Demos are started by running the corrsponding Tcl script.
To run a demo just type ./double.tcl or ./texture.tcl etc.
Quad-buffered stereo-in-a-window is supported. Quad-buffer stereo
is only available on workstation-class graphics cards
(3Dlabs Wildcat series,
ATI FireGL series,
NVidia Quadro series,
and SGI workstations).
Legacy support for divided-screen stereo on SGI workstations is
available via the -oldstereo option.
Developers for SGI workstations might also like the
autostereo package to automatically switch the display
in and out of stereo (other systems already do it automatically).
Full-screen stereo that gaming graphics cards support (ATI Radeon,
NVidia GeForce) is not supported.
If you have something to add to this section please let us know.
Bad Match X errors on Sun systems
There's a bug in Sun's XmuLookupStandardColormap X library function.
If you compile togl.c with the SOLARIS_BUG symbol defined (-DSOLARIS_BUG)
this function call will be omitted.
There is a bug database on the
Togl Project Page.
You may also discuss bugs on the mailing list.
When reporting bugs please provide as much information as possible.
Also, it's very helpful to us if you can provide an example program
which demonstrates the problem.
Several people have contributed new features to Togl. Among them are:
Ramon Ramsan — overlay plane support
Miguel A. De Riera Pasenau — more overlay functions, X11 functions
and EPS output
Peter Dern and Elmar Gerwalin — Togl_TimerFunc and related code
Robert Casto — Windows NT port
Geza Groma — Windows 95/NT patches
Ben Evans — SGI stereo support
Paul Thiessen — Macintosh support
Jonas Beskow — Tcl/Tk stubs support
Paul Kienzle — TEA debugging and patches
Greg Couch — version 1.7
Many others have contributed bug fixes. Thanks for your contributions!
Last edited on 25 October 2005 by Greg Couch.
antennavis-0.3.1.orig/VisField.c 0000644 0001750 0001750 00000225273 10350336104 015241 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include "MyTypes.h"
#include "TkAntenna.h"
#include "togl.h"
#include "ant.h"
#include "pcard.h"
#include "VisField.h"
#include "VisWires.h"
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Global Variables **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
extern double POINT_DIST_SCALE; /** For point clouds, in dBi **/
extern double POINT_SIZE_SCALE; /** ..also in terms of dBi **/
extern double ALPHA; /** Alpha transparency factor **/
extern double curr_step_size; /** Updated when the NEC called **/
extern double NULL_THRESHOLD; /** As a percentage of max dBi **/
extern double NULL_DISTANCE; /** So null maps float above **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Function Prototypes **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void TKA_Cylinder(GLfloat radius, GLfloat height, GLint slices, GLint rings);
void TKA_Cube(GLfloat size);
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** AntNormalize **/
/** **/
/** Normalizes a vector by reducing it to unit length. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void AntNormalize(double v[3]) {
double d; /** Temporary value **/
d = sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
if (d == 0.0) {
fprintf(stderr,"Zero length vector\n");
return;
} /** Error **/
v[0] = v[0] / d;
v[1] = v[1] / d;
v[2] = v[2] / d;
} /** End of AntNormalize **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** AntNormCrossProd **/
/** **/
/** Performs a cross product and normalizes the resulting vector. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void AntNormCrossProd(double v1[3], double v2[3], double out[3]) {
out[0] = v1[1]*v2[2] - v1[2]*v2[1];
out[1] = v1[2]*v2[0] - v1[0]*v2[2];
out[2] = v1[0]*v2[1] - v1[1]*v2[0];
AntNormalize(out);
} /** End of AntNormCrossProd **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** PlotPoint **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void PlotPoint(GLfloat azimuth, GLfloat elevation, GLfloat dist) {
glPushMatrix();
glRotatef(azimuth, 0.0, 1.0, 0.0);
glRotatef(elevation, 1.0, 0.0, 0.0);
glTranslatef(0.0, 0.0, dist * POINT_DIST_SCALE);
TKA_Cube(dist * POINT_SIZE_SCALE);
glPopMatrix();
} /** End of PlotPoint **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawRFPowerDensityPoints **/
/** **/
/** This function traverses each of the points and draws it on the screen **/
/** using PlotPoint. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawRFPowerDensityPoints(Ant *antData) {
GLfloat green_color[] = {0.1, 0.8, 0.1, 1.0}; /** Color of points **/
int i; /** Loop counter **/
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green_color);
for(i = 0; i < antData->fieldData->count; i++) {
PlotPoint(antData->fieldData->vals[i].theta,
antData->fieldData->vals[i].phi,
exp(antData->fieldData->vals[i].total_gain/10.0));
} /** For each point **/
} /** End of DrawRFPowerDensityPoints **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawPolarizationSensePoints **/
/** **/
/** This function traverses each of the points and draws it on the screen **/
/** using PlotPoint. Each control point is color coded depending on the **/
/** polarization sense. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawPolarizationSensePoints(Ant *antData) {
GLfloat point_color[4]; /** Color of points **/
int i; /** Loop counter **/
for(i = 0; i < antData->fieldData->count; i++) {
if (antData->fieldData->vals[i].sense == LINEAR) {
point_color[0] = 0.0;
point_color[1] = 1.0;
point_color[2] = 0.0;
} /** Linear **/
if (antData->fieldData->vals[i].sense == RIGHT) {
point_color[0] = 1.0;
point_color[1] = 1.0;
point_color[2] = 1.0;
} /** Linear **/
if (antData->fieldData->vals[i].sense == LEFT) {
point_color[0] = 0.0;
point_color[1] = 0.0;
point_color[2] = 1.0;
} /** Linear **/
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
PlotPoint(antData->fieldData->vals[i].theta,
antData->fieldData->vals[i].phi,
exp(antData->fieldData->vals[i].total_gain/10.0));
} /** For each point **/
} /** End of DrawPolarizationSensePoints **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawPolarizationTiltPoints **/
/** **/
/** This function traverses each of the points and draws it on the screen **/
/** using PlotPoint. Each control point is color coded depending on the **/
/** polarization tilt. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawPolarizationTiltPoints(Ant *antData) {
GLfloat point_color[4]; /** Color of points **/
int i; /** Loop counter **/
double range; /** Range of tilt **/
double current_value; /** Current color value **/
range = antData->fieldData->maxtilt - antData->fieldData->mintilt;
for(i = 0; i < antData->fieldData->count; i++) {
current_value = (antData->fieldData->vals[i].tilt +
(-1 * antData->fieldData->mintilt)) / range;
point_color[0] = current_value;
point_color[1] = 1.0;
point_color[2] = current_value;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
PlotPoint(antData->fieldData->vals[i].theta,
antData->fieldData->vals[i].phi,
exp(antData->fieldData->vals[i].total_gain/10.0));
} /** For each point **/
} /** End of DrawPolarizationTiltPoints **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawAxialRatioPoints **/
/** **/
/** This function traverses each of the points and draws it on the screen **/
/** using PlotPoint. Each control point is color coded depending on the **/
/** axial ratio. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawAxialRatioPoints(Ant *antData) {
GLfloat point_color[4]; /** Color of points **/
int i; /** Loop counter **/
double range; /** Range of tilt **/
double current_value; /** Current color value **/
range=antData->fieldData->maxaxialratio - antData->fieldData->minaxialratio;
for(i = 0; i < antData->fieldData->count; i++) {
current_value = (antData->fieldData->vals[i].axial_ratio +
(-1 * antData->fieldData->minaxialratio)) / range;
ComputeColor(current_value,
antData->fieldData->minaxialratio,
antData->fieldData->maxaxialratio,
point_color);
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
PlotPoint(antData->fieldData->vals[i].theta,
antData->fieldData->vals[i].phi,
exp(antData->fieldData->vals[i].total_gain/10.0));
} /** For each point **/
} /** End of DrawAxialRatioPoints **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawShowNullsPoints **/
/** **/
/** This function traverses each of the points and draws it on the screen **/
/** using PlotPoint. Each control point is color coded if it is in the **/
/** null of the pattern. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawShowNullsPoints(Ant *antData) {
GLfloat point_color[4]; /** Color of points **/
int i; /** Loop counter **/
double range; /** Range of tilt **/
double current_value; /** Current color value **/
range = antData->fieldData->maxgain + (-1*antData->fieldData->mingain);
for(i = 0; i < antData->fieldData->count; i++) {
current_value = ((antData->fieldData->vals[i].total_gain +
(-1*antData->fieldData->mingain))
/ range);
point_color[0] = 1.0;
point_color[1] = 0.0;
point_color[2] = 0.0;
if (current_value < NULL_THRESHOLD)
point_color[3] = ALPHA;
else
point_color[3] = 0.0;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
if (point_color[3] > 0.0) {
PlotPoint(antData->fieldData->vals[i].theta,
antData->fieldData->vals[i].phi,
exp(antData->fieldData->vals[i].total_gain/10.0) +
(NULL_DISTANCE / 5));
} /** Plot a point **/
} /** For each point **/
} /** End of DrawShowNullsPoints **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawRFPowerDensitySurface **/
/** **/
/** This function traverses each of the points and draws it on the screen **/
/** as a triangular mesh rendered smooth shaded. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawRFPowerDensitySurface(Ant *antData) {
int increments; /** Number of incs **/
int az; /** Loop counter **/
int el; /** Loop counter **/
int latitude; /** Loop counter **/
int longitude; /** Loop counter **/
int i; /** Loop counter **/
double tx; /** Temporary x **/
double ty; /** Temporary y **/
double tz; /** Temporary z **/
double ttheta; /** Temporary angle **/
double tphi; /** Temporary angle **/
double tdist; /** Temp distance **/
GLfloat green_color[4]; /** Color surface **/
GLfloat red_color[4]; /** Color surface **/
GLfloat blue_color[4]; /** Color surface **/
GLfloat yellow_color[4]; /** Color surface **/
GLfloat white_color[4]; /** Color surface **/
green_color[0] = 0.1;
green_color[1] = 0.8;
green_color[2] = 0.1;
green_color[3] = ALPHA;
red_color[0] = 0.8;
red_color[1] = 0.1;
red_color[2] = 0.1;
red_color[3] = ALPHA;
blue_color[0] = 0.1;
blue_color[1] = 0.1;
blue_color[2] = 0.8;
blue_color[3] = ALPHA;
yellow_color[0] = 1.0;
yellow_color[1] = 1.0;
yellow_color[2] = 0.0;
yellow_color[3] = ALPHA;
white_color[0] = 1.0;
white_color[1] = 1.0;
white_color[2] = 1.0;
white_color[3] = ALPHA;
if (antData->fieldData->count != 0) {
/** Build data structure **/
increments = 360 / curr_step_size;
i = 0;
for (el = 0; el < increments; el++) {
for (az = 0; az < increments; az++) {
ttheta = antData->fieldData->vals[i].theta * 2.0 * PI / 360.0;
tphi = antData->fieldData->vals[i].phi * 2.0 * PI / 360.0;
tdist = exp(antData->fieldData->vals[i].total_gain / 10.0) *
POINT_DIST_SCALE;
ty = cos(ttheta) * cos(tphi) * tdist;
tx = sin(ttheta) * cos(tphi) * tdist;
tz = sin(tphi) * tdist;
antData->surfaceMesh[el][az].posx = tx;
antData->surfaceMesh[el][az].posy = ty;
antData->surfaceMesh[el][az].posz = tz;
/*
if (el >= increments/4 && el < increments *3 /4)
surfaceMesh[el][az].posy = surfaceMesh[el][az].posy * -1;
*/
i++;
} /** By elevation **/
} /** By azimuth **/
for (el = 0; el < increments; el++) {
antData->surfaceMesh[el][increments].posx =
antData->surfaceMesh[el][0].posx;
antData->surfaceMesh[el][increments].posy =
antData->surfaceMesh[el][0].posy;
antData->surfaceMesh[el][increments].posz =
antData->surfaceMesh[el][0].posz;
} /** Wrap around buffer **/
for (az = 0; az < increments; az++) {
antData->surfaceMesh[increments][az].posx =
antData->surfaceMesh[0][az].posx;
antData->surfaceMesh[increments][az].posy =
antData->surfaceMesh[0][az].posy;
antData->surfaceMesh[increments][az].posz =
antData->surfaceMesh[0][az].posz;
} /** Wrap around buffer **/
glPushMatrix();
glEnable(GL_BLEND);
glShadeModel(GL_SMOOTH);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green_color);
for (latitude=0; latitude < increments; latitude++) {
longitude = 0;
glBegin(GL_TRIANGLE_STRIP);
while (longitude <= increments/2) {
glNormal3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glNormal3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
longitude++;
} /** For all latitudes control points **/
glEnd();
} /** Triangle strips **/
glDisable(GL_BLEND);
glPopMatrix();
} /** Not empty **/
} /** End of DrawRFPowerDensitySurface **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawPolarizationSenseSurface **/
/** **/
/** This function traverses each of the points and draws it on the screen **/
/** as a triangular mesh rendered smooth shaded. Each control point is **/
/** color coded depending on the polarization sense. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawPolarizationSenseSurface(Ant *antData) {
int increments; /** Number of incs **/
int az; /** Loop counter **/
int el; /** Loop counter **/
int latitude; /** Loop counter **/
int longitude; /** Loop counter **/
int i; /** Loop counter **/
double tx; /** Temporary x **/
double ty; /** Temporary y **/
double tz; /** Temporary z **/
double ttheta; /** Temporary angle **/
double tphi; /** Temporary angle **/
double tdist; /** Temp distance **/
GLfloat green_color[4]; /** Color surface **/
GLfloat red_color[4]; /** Color surface **/
GLfloat blue_color[4]; /** Color surface **/
GLfloat yellow_color[4]; /** Color surface **/
GLfloat white_color[4]; /** Color surface **/
GLfloat point_color[4]; /** Color surface **/
green_color[0] = 0.1;
green_color[1] = 0.8;
green_color[2] = 0.1;
green_color[3] = ALPHA;
red_color[0] = 0.8;
red_color[1] = 0.1;
red_color[2] = 0.1;
red_color[3] = ALPHA;
blue_color[0] = 0.1;
blue_color[1] = 0.1;
blue_color[2] = 0.8;
blue_color[3] = ALPHA;
yellow_color[0] = 1.0;
yellow_color[1] = 1.0;
yellow_color[2] = 0.0;
yellow_color[3] = ALPHA;
white_color[0] = 1.0;
white_color[1] = 1.0;
white_color[2] = 1.0;
white_color[3] = ALPHA;
if (antData->fieldData->count != 0) {
/** Build data structure **/
increments = 360 / curr_step_size;
i = 0;
for (el = 0; el < increments; el++) {
for (az = 0; az < increments; az++) {
ttheta = antData->fieldData->vals[i].theta * 2.0 * PI / 360.0;
tphi = antData->fieldData->vals[i].phi * 2.0 * PI / 360.0;
tdist = exp(antData->fieldData->vals[i].total_gain / 10.0) *
POINT_DIST_SCALE;
ty = cos(ttheta) * cos(tphi) * tdist;
tx = sin(ttheta) * cos(tphi) * tdist;
tz = sin(tphi) * tdist;
antData->surfaceMesh[el][az].posx = tx;
antData->surfaceMesh[el][az].posy = ty;
antData->surfaceMesh[el][az].posz = tz;
/*
if (el >= increments/4 && el < increments *3 /4)
surfaceMesh[el][az].posy = surfaceMesh[el][az].posy * -1;
*/
if (antData->fieldData->vals[i].sense == LINEAR) {
antData->surfaceMesh[el][az].r = 0.0;
antData->surfaceMesh[el][az].g = 1.0;
antData->surfaceMesh[el][az].b = 0.0;
} /** Linear **/
if (antData->fieldData->vals[i].sense == RIGHT) {
antData->surfaceMesh[el][az].r = 1.0;
antData->surfaceMesh[el][az].g = 1.0;
antData->surfaceMesh[el][az].b = 1.0;
} /** Right **/
if (antData->fieldData->vals[i].sense == LEFT) {
antData->surfaceMesh[el][az].r = 0.0;
antData->surfaceMesh[el][az].g = 0.0;
antData->surfaceMesh[el][az].b = 1.0;
} /** Left **/
i++;
} /** By elevation **/
} /** By azimuth **/
for (el = 0; el < increments; el++) {
antData->surfaceMesh[el][increments].posx =
antData->surfaceMesh[el][0].posx;
antData->surfaceMesh[el][increments].posy =
antData->surfaceMesh[el][0].posy;
antData->surfaceMesh[el][increments].posz =
antData->surfaceMesh[el][0].posz;
antData->surfaceMesh[el][increments].r = antData->surfaceMesh[el][0].r;
antData->surfaceMesh[el][increments].g = antData->surfaceMesh[el][0].g;
antData->surfaceMesh[el][increments].b = antData->surfaceMesh[el][0].b;
} /** Wrap around buffer **/
for (az = 0; az < increments; az++) {
antData->surfaceMesh[increments][az].posx =
antData->surfaceMesh[0][az].posx;
antData->surfaceMesh[increments][az].posy =
antData->surfaceMesh[0][az].posy;
antData->surfaceMesh[increments][az].posz =
antData->surfaceMesh[0][az].posz;
antData->surfaceMesh[increments][az].r = antData->surfaceMesh[0][az].r;
antData->surfaceMesh[increments][az].g = antData->surfaceMesh[0][az].g;
antData->surfaceMesh[increments][az].b = antData->surfaceMesh[0][az].b;
} /** Wrap around buffer **/
glPushMatrix();
glEnable(GL_BLEND);
glShadeModel(GL_SMOOTH);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
for (latitude=0; latitude < increments; latitude++) {
longitude = 0;
glBegin(GL_TRIANGLE_STRIP);
while (longitude <= increments/2) {
point_color[0] = antData->surfaceMesh[latitude][longitude].r;
point_color[1] = antData->surfaceMesh[latitude][longitude].g;
point_color[2] = antData->surfaceMesh[latitude][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
point_color[0] = antData->surfaceMesh[latitude+1][longitude].r;
point_color[1] = antData->surfaceMesh[latitude+1][longitude].g;
point_color[2] = antData->surfaceMesh[latitude+1][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
longitude++;
} /** For all latitudes control points **/
glEnd();
} /** Triangle strips **/
glDisable(GL_BLEND);
glPopMatrix();
} /** Not empty **/
} /** End of DrawPolarizationSenseSurface **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawPolarizationTiltSurface **/
/** **/
/** This function traverses each of the points and draws it on the screen **/
/** as a triangular mesh rendered smooth shaded. Each control point is **/
/** color coded depending on the polarization tilt. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawPolarizationTiltSurface(Ant *antData) {
int increments; /** Number of incs **/
int az; /** Loop counter **/
int el; /** Loop counter **/
int latitude; /** Loop counter **/
int longitude; /** Loop counter **/
int i; /** Loop counter **/
double tx; /** Temporary x **/
double ty; /** Temporary y **/
double tz; /** Temporary z **/
double ttheta; /** Temporary angle **/
double tphi; /** Temporary angle **/
double tdist; /** Temp distance **/
GLfloat point_color[4]; /** Color surface **/
double range; /** Range of tilt **/
double current_value; /** Current color value **/
range = antData->fieldData->maxtilt - antData->fieldData->mintilt;
if (antData->fieldData->count != 0) {
/** Build data structure **/
increments = 360 / curr_step_size;
i = 0;
for (el = 0; el < increments; el++) {
for (az = 0; az < increments; az++) {
ttheta = antData->fieldData->vals[i].theta * 2.0 * PI / 360.0;
tphi = antData->fieldData->vals[i].phi * 2.0 * PI / 360.0;
tdist = exp(antData->fieldData->vals[i].total_gain / 10.0) *
POINT_DIST_SCALE;
ty = cos(ttheta) * cos(tphi) * tdist;
tx = sin(ttheta) * cos(tphi) * tdist;
tz = sin(tphi) * tdist;
antData->surfaceMesh[el][az].posx = tx;
antData->surfaceMesh[el][az].posy = ty;
antData->surfaceMesh[el][az].posz = tz;
current_value = (antData->fieldData->vals[i].tilt +
(-1 * antData->fieldData->mintilt)) / range;
antData->surfaceMesh[el][az].r = current_value;
antData->surfaceMesh[el][az].g = 1.0;
antData->surfaceMesh[el][az].b = current_value;
i++;
} /** By elevation **/
} /** By azimuth **/
for (el = 0; el < increments; el++) {
antData->surfaceMesh[el][increments].posx =
antData->surfaceMesh[el][0].posx;
antData->surfaceMesh[el][increments].posy =
antData->surfaceMesh[el][0].posy;
antData->surfaceMesh[el][increments].posz =
antData->surfaceMesh[el][0].posz;
antData->surfaceMesh[el][increments].r = antData->surfaceMesh[el][0].r;
antData->surfaceMesh[el][increments].g = antData->surfaceMesh[el][0].g;
antData->surfaceMesh[el][increments].b = antData->surfaceMesh[el][0].b;
} /** Wrap around buffer **/
for (az = 0; az < increments; az++) {
antData->surfaceMesh[increments][az].posx =
antData->surfaceMesh[0][az].posx;
antData->surfaceMesh[increments][az].posy =
antData->surfaceMesh[0][az].posy;
antData->surfaceMesh[increments][az].posz =
antData->surfaceMesh[0][az].posz;
antData->surfaceMesh[increments][az].r = antData->surfaceMesh[0][az].r;
antData->surfaceMesh[increments][az].g = antData->surfaceMesh[0][az].g;
antData->surfaceMesh[increments][az].b = antData->surfaceMesh[0][az].b;
} /** Wrap around buffer **/
glPushMatrix();
glEnable(GL_BLEND);
glShadeModel(GL_SMOOTH);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
for (latitude=0; latitude < increments; latitude++) {
longitude = 0;
glBegin(GL_TRIANGLE_STRIP);
while (longitude <= increments/2) {
point_color[0] = antData->surfaceMesh[latitude][longitude].r;
point_color[1] = antData->surfaceMesh[latitude][longitude].g;
point_color[2] = antData->surfaceMesh[latitude][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
point_color[0] = antData->surfaceMesh[latitude+1][longitude].r;
point_color[1] = antData->surfaceMesh[latitude+1][longitude].g;
point_color[2] = antData->surfaceMesh[latitude+1][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
longitude++;
} /** For all latitudes control points **/
glEnd();
} /** Triangle strips **/
glDisable(GL_BLEND);
glPopMatrix();
} /** Not empty **/
} /** End of DrawPolarizationTiltSurface **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawAxialRatioSurface **/
/** **/
/** This function traverses each of the points and draws it on the screen **/
/** as a triangular mesh rendered smooth shaded. Each control point is **/
/** color coded depending on the axial ratio. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawAxialRatioSurface(Ant *antData) {
int increments; /** Number of incs **/
int az; /** Loop counter **/
int el; /** Loop counter **/
int latitude; /** Loop counter **/
int longitude; /** Loop counter **/
int i; /** Loop counter **/
double tx; /** Temporary x **/
double ty; /** Temporary y **/
double tz; /** Temporary z **/
double ttheta; /** Temporary angle **/
double tphi; /** Temporary angle **/
double tdist; /** Temp distance **/
GLfloat point_color[4]; /** Color surface **/
double range; /** Range of tilt **/
double current_value; /** Current color value **/
range= antData->fieldData->maxaxialratio - antData->fieldData->minaxialratio;
if (antData->fieldData->count != 0) {
/** Build data structure **/
increments = 360 / curr_step_size;
i = 0;
for (el = 0; el < increments; el++) {
for (az = 0; az < increments; az++) {
ttheta = antData->fieldData->vals[i].theta * 2.0 * PI / 360.0;
tphi = antData->fieldData->vals[i].phi * 2.0 * PI / 360.0;
tdist = exp(antData->fieldData->vals[i].total_gain / 10.0) *
POINT_DIST_SCALE;
ty = cos(ttheta) * cos(tphi) * tdist;
tx = sin(ttheta) * cos(tphi) * tdist;
tz = sin(tphi) * tdist;
antData->surfaceMesh[el][az].posx = tx;
antData->surfaceMesh[el][az].posy = ty;
antData->surfaceMesh[el][az].posz = tz;
current_value = (antData->fieldData->vals[i].axial_ratio +
(-1 * antData->fieldData->minaxialratio)) / range;
ComputeColor(current_value,
antData->fieldData->minaxialratio,
antData->fieldData->maxaxialratio,
point_color);
antData->surfaceMesh[el][az].r = point_color[0];
antData->surfaceMesh[el][az].g = point_color[1];
antData->surfaceMesh[el][az].b = point_color[2];
i++;
} /** By elevation **/
} /** By azimuth **/
for (el = 0; el < increments; el++) {
antData->surfaceMesh[el][increments].posx =
antData->surfaceMesh[el][0].posx;
antData->surfaceMesh[el][increments].posy =
antData->surfaceMesh[el][0].posy;
antData->surfaceMesh[el][increments].posz =
antData->surfaceMesh[el][0].posz;
antData->surfaceMesh[el][increments].r = antData->surfaceMesh[el][0].r;
antData->surfaceMesh[el][increments].g = antData->surfaceMesh[el][0].g;
antData->surfaceMesh[el][increments].b = antData->surfaceMesh[el][0].b;
} /** Wrap around buffer **/
for (az = 0; az < increments; az++) {
antData->surfaceMesh[increments][az].posx =
antData->surfaceMesh[0][az].posx;
antData->surfaceMesh[increments][az].posy =
antData->surfaceMesh[0][az].posy;
antData->surfaceMesh[increments][az].posz =
antData->surfaceMesh[0][az].posz;
antData->surfaceMesh[increments][az].r = antData->surfaceMesh[0][az].r;
antData->surfaceMesh[increments][az].g = antData->surfaceMesh[0][az].g;
antData->surfaceMesh[increments][az].b = antData->surfaceMesh[0][az].b;
} /** Wrap around buffer **/
glPushMatrix();
glEnable(GL_BLEND);
glShadeModel(GL_SMOOTH);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
for (latitude=0; latitude < increments; latitude++) {
longitude = 0;
glBegin(GL_TRIANGLE_STRIP);
while (longitude <= increments/2) {
point_color[0] = antData->surfaceMesh[latitude][longitude].r;
point_color[1] = antData->surfaceMesh[latitude][longitude].g;
point_color[2] = antData->surfaceMesh[latitude][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
point_color[0] = antData->surfaceMesh[latitude+1][longitude].r;
point_color[1] = antData->surfaceMesh[latitude+1][longitude].g;
point_color[2] = antData->surfaceMesh[latitude+1][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
longitude++;
} /** For all latitudes control points **/
glEnd();
} /** Triangle strips **/
glDisable(GL_BLEND);
glPopMatrix();
} /** Not empty **/
} /** End of DrawAxialRatioSurface **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawShowNullsSurface **/
/** **/
/** This function traverses each of the points and draws it on the screen **/
/** as a triangular mesh rendered smooth shaded. Each control point is **/
/** colored only if it is in a NULL **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawShowNullsSurface(Ant *antData) {
int increments; /** Number of incs **/
int az; /** Loop counter **/
int el; /** Loop counter **/
int latitude; /** Loop counter **/
int longitude; /** Loop counter **/
int i; /** Loop counter **/
double tx; /** Temporary x **/
double ty; /** Temporary y **/
double tz; /** Temporary z **/
double ttheta; /** Temporary angle **/
double tphi; /** Temporary angle **/
double tdist; /** Temp distance **/
GLfloat point_color[4]; /** Color surface **/
double range; /** Range of tilt **/
double current_value; /** Current color value **/
range = antData->fieldData->maxtilt - antData->fieldData->mintilt;
if (antData->fieldData->count != 0) {
/** Build data structure **/
increments = 360 / curr_step_size;
i = 0;
for (el = 0; el < increments; el++) {
for (az = 0; az < increments; az++) {
ttheta = antData->fieldData->vals[i].theta * 2.0 * PI / 360.0;
tphi = antData->fieldData->vals[i].phi * 2.0 * PI / 360.0;
tdist = (exp(antData->fieldData->vals[i].total_gain / 10.0) *
POINT_DIST_SCALE) + NULL_DISTANCE;
ty = cos(ttheta) * cos(tphi) * tdist;
tx = sin(ttheta) * cos(tphi) * tdist;
tz = sin(tphi) * tdist;
antData->surfaceMesh[el][az].posx = tx;
antData->surfaceMesh[el][az].posy = ty;
antData->surfaceMesh[el][az].posz = tz;
range = antData->fieldData->maxgain + (-1*antData->fieldData->mingain);
current_value = ((antData->fieldData->vals[i].total_gain +
(-1*antData->fieldData->mingain))
/ range);
if (current_value < NULL_THRESHOLD) {
antData->surfaceMesh[el][az].r = 1.0;
antData->surfaceMesh[el][az].g = 0.0;
antData->surfaceMesh[el][az].b = 0.0;
} else {
antData->surfaceMesh[el][az].r = 0.0;
antData->surfaceMesh[el][az].g = 0.0;
antData->surfaceMesh[el][az].b = 0.0;
} /** Not a null **/
i++;
} /** By elevation **/
} /** By azimuth **/
for (el = 0; el < increments; el++) {
antData->surfaceMesh[el][increments].posx =
antData->surfaceMesh[el][0].posx;
antData->surfaceMesh[el][increments].posy =
antData->surfaceMesh[el][0].posy;
antData->surfaceMesh[el][increments].posz =
antData->surfaceMesh[el][0].posz;
antData->surfaceMesh[el][increments].r = antData->surfaceMesh[el][0].r;
antData->surfaceMesh[el][increments].g = antData->surfaceMesh[el][0].g;
antData->surfaceMesh[el][increments].b = antData->surfaceMesh[el][0].b;
} /** Wrap around buffer **/
for (az = 0; az < increments; az++) {
antData->surfaceMesh[increments][az].posx =
antData->surfaceMesh[0][az].posx;
antData->surfaceMesh[increments][az].posy =
antData->surfaceMesh[0][az].posy;
antData->surfaceMesh[increments][az].posz =
antData->surfaceMesh[0][az].posz;
antData->surfaceMesh[increments][az].r = antData->surfaceMesh[0][az].r;
antData->surfaceMesh[increments][az].g = antData->surfaceMesh[0][az].g;
antData->surfaceMesh[increments][az].b = antData->surfaceMesh[0][az].b;
} /** Wrap around buffer **/
glPushMatrix();
glEnable(GL_BLEND);
glShadeModel(GL_SMOOTH);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
for (latitude=0; latitude < increments; latitude++) {
longitude = 0;
glBegin(GL_TRIANGLE_STRIP);
while (longitude <= increments/2) {
point_color[0] = antData->surfaceMesh[latitude][longitude].r;
point_color[1] = antData->surfaceMesh[latitude][longitude].g;
point_color[2] = antData->surfaceMesh[latitude][longitude].b;
if (point_color[0] == 1.0)
point_color[3] = ALPHA;
else
point_color[3] = 0.0;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
point_color[0] = antData->surfaceMesh[latitude+1][longitude].r;
point_color[1] = antData->surfaceMesh[latitude+1][longitude].g;
point_color[2] = antData->surfaceMesh[latitude+1][longitude].b;
if (point_color[0] == 1.0)
point_color[3] = ALPHA;
else
point_color[3] = 0.0;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
longitude++;
} /** For all latitudes control points **/
glEnd();
} /** Triangle strips **/
glDisable(GL_BLEND);
glPopMatrix();
} /** Not empty **/
} /** End of DrawShowNullsSurface **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawRFPowerDensitySphere **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawRFPowerDensitySphere(Ant *antData) {
int increments; /** Number of incs **/
int az; /** Loop counter **/
int el; /** Loop counter **/
int latitude; /** Loop counter **/
int longitude; /** Loop counter **/
int i; /** Loop counter **/
double tx; /** Temporary x **/
double ty; /** Temporary y **/
double tz; /** Temporary z **/
double ttheta; /** Temporary angle **/
double tphi; /** Temporary angle **/
double tdist; /** Temp distance **/
GLfloat green_color[4]; /** Color surface **/
green_color[0] = 0.1;
green_color[1] = 0.8;
green_color[2] = 0.1;
green_color[3] = ALPHA;
if (antData->fieldData->count != 0) {
/** Build data structure **/
increments = 360 / curr_step_size;
i = 0;
for (el = 0; el < increments; el++) {
for (az = 0; az < increments; az++) {
ttheta = antData->fieldData->vals[i].theta * 2.0 * PI / 360.0;
tphi = antData->fieldData->vals[i].phi * 2.0 * PI / 360.0;
tdist = 1.0 * POINT_DIST_SCALE;
ty = cos(ttheta) * cos(tphi) * tdist;
tx = sin(ttheta) * cos(tphi) * tdist;
tz = sin(tphi) * tdist;
antData->surfaceMesh[el][az].posx = tx;
antData->surfaceMesh[el][az].posy = ty;
antData->surfaceMesh[el][az].posz = tz;
i++;
} /** By elevation **/
} /** By azimuth **/
for (el = 0; el < increments; el++) {
antData->surfaceMesh[el][increments].posx =
antData->surfaceMesh[el][0].posx;
antData->surfaceMesh[el][increments].posy =
antData->surfaceMesh[el][0].posy;
antData->surfaceMesh[el][increments].posz =
antData->surfaceMesh[el][0].posz;
} /** Wrap around buffer **/
for (az = 0; az < increments; az++) {
antData->surfaceMesh[increments][az].posx =
antData->surfaceMesh[0][az].posx;
antData->surfaceMesh[increments][az].posy =
antData->surfaceMesh[0][az].posy;
antData->surfaceMesh[increments][az].posz =
antData->surfaceMesh[0][az].posz;
} /** Wrap around buffer **/
glPushMatrix();
glEnable(GL_BLEND);
glShadeModel(GL_SMOOTH);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
for (latitude=0; latitude < increments; latitude++) {
longitude = 0;
glBegin(GL_TRIANGLE_STRIP);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green_color);
while (longitude <= increments/2) {
glNormal3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glNormal3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
longitude++;
} /** For all latitudes control points **/
glEnd();
} /** Triangle strips **/
glDisable(GL_BLEND);
glPopMatrix();
} /** Not empty **/
} /** End of DrawRFPowerDensitySphere **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawPolarizationSenseSphere **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawPolarizationSenseSphere(Ant *antData) {
int increments; /** Number of incs **/
int az; /** Loop counter **/
int el; /** Loop counter **/
int latitude; /** Loop counter **/
int longitude; /** Loop counter **/
int i; /** Loop counter **/
double tx; /** Temporary x **/
double ty; /** Temporary y **/
double tz; /** Temporary z **/
double ttheta; /** Temporary angle **/
double tphi; /** Temporary angle **/
double tdist; /** Temp distance **/
GLfloat green_color[4]; /** Color surface **/
GLfloat red_color[4]; /** Color surface **/
GLfloat blue_color[4]; /** Color surface **/
GLfloat yellow_color[4]; /** Color surface **/
GLfloat white_color[4]; /** Color surface **/
GLfloat point_color[4]; /** Color surface **/
green_color[0] = 0.1;
green_color[1] = 0.8;
green_color[2] = 0.1;
green_color[3] = ALPHA;
red_color[0] = 0.8;
red_color[1] = 0.1;
red_color[2] = 0.1;
red_color[3] = ALPHA;
blue_color[0] = 0.1;
blue_color[1] = 0.1;
blue_color[2] = 0.8;
blue_color[3] = ALPHA;
yellow_color[0] = 1.0;
yellow_color[1] = 1.0;
yellow_color[2] = 0.0;
yellow_color[3] = ALPHA;
white_color[0] = 1.0;
white_color[1] = 1.0;
white_color[2] = 1.0;
white_color[3] = ALPHA;
if (antData->fieldData->count != 0) {
/** Build data structure **/
increments = 360 / curr_step_size;
i = 0;
for (el = 0; el < increments; el++) {
for (az = 0; az < increments; az++) {
ttheta = antData->fieldData->vals[i].theta * 2.0 * PI / 360.0;
tphi = antData->fieldData->vals[i].phi * 2.0 * PI / 360.0;
tdist = 1.0 * POINT_DIST_SCALE;
ty = cos(ttheta) * cos(tphi) * tdist;
tx = sin(ttheta) * cos(tphi) * tdist;
tz = sin(tphi) * tdist;
antData->surfaceMesh[el][az].posx = tx;
antData->surfaceMesh[el][az].posy = ty;
antData->surfaceMesh[el][az].posz = tz;
if (antData->fieldData->vals[i].sense == LINEAR) {
antData->surfaceMesh[el][az].r = 0.0;
antData->surfaceMesh[el][az].g = 1.0;
antData->surfaceMesh[el][az].b = 0.0;
} /** Linear **/
if (antData->fieldData->vals[i].sense == RIGHT) {
antData->surfaceMesh[el][az].r = 1.0;
antData->surfaceMesh[el][az].g = 1.0;
antData->surfaceMesh[el][az].b = 1.0;
} /** Right **/
if (antData->fieldData->vals[i].sense == LEFT) {
antData->surfaceMesh[el][az].r = 0.0;
antData->surfaceMesh[el][az].g = 0.0;
antData->surfaceMesh[el][az].b = 1.0;
} /** Left **/
i++;
} /** By elevation **/
} /** By azimuth **/
for (el = 0; el < increments; el++) {
antData->surfaceMesh[el][increments].posx =
antData->surfaceMesh[el][0].posx;
antData->surfaceMesh[el][increments].posy =
antData->surfaceMesh[el][0].posy;
antData->surfaceMesh[el][increments].posz =
antData->surfaceMesh[el][0].posz;
antData->surfaceMesh[el][increments].r = antData->surfaceMesh[el][0].r;
antData->surfaceMesh[el][increments].g = antData->surfaceMesh[el][0].g;
antData->surfaceMesh[el][increments].b = antData->surfaceMesh[el][0].b;
} /** Wrap around buffer **/
for (az = 0; az < increments; az++) {
antData->surfaceMesh[increments][az].posx =
antData->surfaceMesh[0][az].posx;
antData->surfaceMesh[increments][az].posy =
antData->surfaceMesh[0][az].posy;
antData->surfaceMesh[increments][az].posz =
antData->surfaceMesh[0][az].posz;
antData->surfaceMesh[increments][az].r = antData->surfaceMesh[0][az].r;
antData->surfaceMesh[increments][az].g = antData->surfaceMesh[0][az].g;
antData->surfaceMesh[increments][az].b = antData->surfaceMesh[0][az].b;
} /** Wrap around buffer **/
glPushMatrix();
glEnable(GL_BLEND);
glShadeModel(GL_SMOOTH);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
for (latitude=0; latitude < increments; latitude++) {
longitude = 0;
glBegin(GL_TRIANGLE_STRIP);
while (longitude <= increments/2) {
point_color[0] = antData->surfaceMesh[latitude][longitude].r;
point_color[1] = antData->surfaceMesh[latitude][longitude].g;
point_color[2] = antData->surfaceMesh[latitude][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
point_color[0] = antData->surfaceMesh[latitude+1][longitude].r;
point_color[1] = antData->surfaceMesh[latitude+1][longitude].g;
point_color[2] = antData->surfaceMesh[latitude+1][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
longitude++;
} /** For all latitudes control points **/
glEnd();
} /** Triangle strips **/
glDisable(GL_BLEND);
glPopMatrix();
} /** Not empty **/
} /** End of DrawPolarizationSenseSphere **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawPolarizationTiltSphere **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawPolarizationTiltSphere(Ant *antData) {
int increments; /** Number of incs **/
int az; /** Loop counter **/
int el; /** Loop counter **/
int latitude; /** Loop counter **/
int longitude; /** Loop counter **/
int i; /** Loop counter **/
double tx; /** Temporary x **/
double ty; /** Temporary y **/
double tz; /** Temporary z **/
double ttheta; /** Temporary angle **/
double tphi; /** Temporary angle **/
double tdist; /** Temp distance **/
GLfloat point_color[4]; /** Color surface **/
double range; /** Range of tilt **/
double current_value; /** Current color value **/
range = antData->fieldData->maxtilt - antData->fieldData->mintilt;
if (antData->fieldData->count != 0) {
/** Build data structure **/
increments = 360 / curr_step_size;
i = 0;
for (el = 0; el < increments; el++) {
for (az = 0; az < increments; az++) {
ttheta = antData->fieldData->vals[i].theta * 2.0 * PI / 360.0;
tphi = antData->fieldData->vals[i].phi * 2.0 * PI / 360.0;
tdist = 1.0 * POINT_DIST_SCALE;
ty = cos(ttheta) * cos(tphi) * tdist;
tx = sin(ttheta) * cos(tphi) * tdist;
tz = sin(tphi) * tdist;
antData->surfaceMesh[el][az].posx = tx;
antData->surfaceMesh[el][az].posy = ty;
antData->surfaceMesh[el][az].posz = tz;
current_value = (antData->fieldData->vals[i].tilt +
(-1 * antData->fieldData->mintilt)) / range;
antData->surfaceMesh[el][az].r = current_value;
antData->surfaceMesh[el][az].g = 1.0;
antData->surfaceMesh[el][az].b = current_value;
i++;
} /** By elevation **/
} /** By azimuth **/
for (el = 0; el < increments; el++) {
antData->surfaceMesh[el][increments].posx =
antData->surfaceMesh[el][0].posx;
antData->surfaceMesh[el][increments].posy =
antData->surfaceMesh[el][0].posy;
antData->surfaceMesh[el][increments].posz =
antData->surfaceMesh[el][0].posz;
antData->surfaceMesh[el][increments].r = antData->surfaceMesh[el][0].r;
antData->surfaceMesh[el][increments].g = antData->surfaceMesh[el][0].g;
antData->surfaceMesh[el][increments].b = antData->surfaceMesh[el][0].b;
} /** Wrap around buffer **/
for (az = 0; az < increments; az++) {
antData->surfaceMesh[increments][az].posx =
antData->surfaceMesh[0][az].posx;
antData->surfaceMesh[increments][az].posy =
antData->surfaceMesh[0][az].posy;
antData->surfaceMesh[increments][az].posz =
antData->surfaceMesh[0][az].posz;
antData->surfaceMesh[increments][az].r = antData->surfaceMesh[0][az].r;
antData->surfaceMesh[increments][az].g = antData->surfaceMesh[0][az].g;
antData->surfaceMesh[increments][az].b = antData->surfaceMesh[0][az].b;
} /** Wrap around buffer **/
glPushMatrix();
glEnable(GL_BLEND);
glShadeModel(GL_SMOOTH);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
for (latitude=0; latitude < increments; latitude++) {
longitude = 0;
glBegin(GL_TRIANGLE_STRIP);
while (longitude <= increments/2) {
point_color[0] = antData->surfaceMesh[latitude][longitude].r;
point_color[1] = antData->surfaceMesh[latitude][longitude].g;
point_color[2] = antData->surfaceMesh[latitude][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
point_color[0] = antData->surfaceMesh[latitude+1][longitude].r;
point_color[1] = antData->surfaceMesh[latitude+1][longitude].g;
point_color[2] = antData->surfaceMesh[latitude+1][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
longitude++;
} /** For all latitudes control points **/
glEnd();
} /** Triangle strips **/
glDisable(GL_BLEND);
glPopMatrix();
} /** Not empty **/
} /** End of DrawPolarizationTiltSphere **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawAxialRatioSphere **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawAxialRatioSphere(Ant *antData) {
int increments; /** Number of incs **/
int az; /** Loop counter **/
int el; /** Loop counter **/
int latitude; /** Loop counter **/
int longitude; /** Loop counter **/
int i; /** Loop counter **/
double tx; /** Temporary x **/
double ty; /** Temporary y **/
double tz; /** Temporary z **/
double ttheta; /** Temporary angle **/
double tphi; /** Temporary angle **/
double tdist; /** Temp distance **/
GLfloat point_color[4]; /** Color surface **/
double range; /** Range of tilt **/
double current_value; /** Current color value **/
range= antData->fieldData->maxaxialratio - antData->fieldData->minaxialratio;
if (antData->fieldData->count != 0) {
/** Build data structure **/
increments = 360 / curr_step_size;
i = 0;
for (el = 0; el < increments; el++) {
for (az = 0; az < increments; az++) {
ttheta = antData->fieldData->vals[i].theta * 2.0 * PI / 360.0;
tphi = antData->fieldData->vals[i].phi * 2.0 * PI / 360.0;
tdist = 1.0 * POINT_DIST_SCALE;
ty = cos(ttheta) * cos(tphi) * tdist;
tx = sin(ttheta) * cos(tphi) * tdist;
tz = sin(tphi) * tdist;
antData->surfaceMesh[el][az].posx = tx;
antData->surfaceMesh[el][az].posy = ty;
antData->surfaceMesh[el][az].posz = tz;
current_value = (antData->fieldData->vals[i].axial_ratio +
(-1 * antData->fieldData->minaxialratio)) / range;
ComputeColor(current_value,
antData->fieldData->minaxialratio,
antData->fieldData->maxaxialratio,
point_color);
antData->surfaceMesh[el][az].r = point_color[0];
antData->surfaceMesh[el][az].g = point_color[1];
antData->surfaceMesh[el][az].b = point_color[2];
i++;
} /** By elevation **/
} /** By azimuth **/
for (el = 0; el < increments; el++) {
antData->surfaceMesh[el][increments].posx =
antData->surfaceMesh[el][0].posx;
antData->surfaceMesh[el][increments].posy =
antData->surfaceMesh[el][0].posy;
antData->surfaceMesh[el][increments].posz =
antData->surfaceMesh[el][0].posz;
antData->surfaceMesh[el][increments].r = antData->surfaceMesh[el][0].r;
antData->surfaceMesh[el][increments].g = antData->surfaceMesh[el][0].g;
antData->surfaceMesh[el][increments].b = antData->surfaceMesh[el][0].b;
} /** Wrap around buffer **/
for (az = 0; az < increments; az++) {
antData->surfaceMesh[increments][az].posx =
antData->surfaceMesh[0][az].posx;
antData->surfaceMesh[increments][az].posy =
antData->surfaceMesh[0][az].posy;
antData->surfaceMesh[increments][az].posz =
antData->surfaceMesh[0][az].posz;
antData->surfaceMesh[increments][az].r = antData->surfaceMesh[0][az].r;
antData->surfaceMesh[increments][az].g = antData->surfaceMesh[0][az].g;
antData->surfaceMesh[increments][az].b = antData->surfaceMesh[0][az].b;
} /** Wrap around buffer **/
glPushMatrix();
glEnable(GL_BLEND);
glShadeModel(GL_SMOOTH);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
for (latitude=0; latitude < increments; latitude++) {
longitude = 0;
glBegin(GL_TRIANGLE_STRIP);
while (longitude <= increments/2) {
point_color[0] = antData->surfaceMesh[latitude][longitude].r;
point_color[1] = antData->surfaceMesh[latitude][longitude].g;
point_color[2] = antData->surfaceMesh[latitude][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
point_color[0] = antData->surfaceMesh[latitude+1][longitude].r;
point_color[1] = antData->surfaceMesh[latitude+1][longitude].g;
point_color[2] = antData->surfaceMesh[latitude+1][longitude].b;
point_color[3] = ALPHA;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
longitude++;
} /** For all latitudes control points **/
glEnd();
} /** Triangle strips **/
glDisable(GL_BLEND);
glPopMatrix();
} /** Not empty **/
} /** End of DrawAxialRatioSphere **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawShowNullsSphere **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawShowNullsSphere(Ant *antData) {
int increments; /** Number of incs **/
int az; /** Loop counter **/
int el; /** Loop counter **/
int latitude; /** Loop counter **/
int longitude; /** Loop counter **/
int i; /** Loop counter **/
double tx; /** Temporary x **/
double ty; /** Temporary y **/
double tz; /** Temporary z **/
double ttheta; /** Temporary angle **/
double tphi; /** Temporary angle **/
double tdist; /** Temp distance **/
GLfloat point_color[4]; /** Color surface **/
double range; /** Range of tilt **/
double current_value; /** Current color value **/
range = antData->fieldData->maxtilt - antData->fieldData->mintilt;
if (antData->fieldData->count != 0) {
/** Build data structure **/
increments = 360 / curr_step_size;
i = 0;
for (el = 0; el < increments; el++) {
for (az = 0; az < increments; az++) {
ttheta = antData->fieldData->vals[i].theta * 2.0 * PI / 360.0;
tphi = antData->fieldData->vals[i].phi * 2.0 * PI / 360.0;
tdist = 1.0 * POINT_DIST_SCALE + NULL_DISTANCE;
ty = cos(ttheta) * cos(tphi) * tdist;
tx = sin(ttheta) * cos(tphi) * tdist;
tz = sin(tphi) * tdist;
antData->surfaceMesh[el][az].posx = tx;
antData->surfaceMesh[el][az].posy = ty;
antData->surfaceMesh[el][az].posz = tz;
range = antData->fieldData->maxgain + (-1*antData->fieldData->mingain);
current_value = ((antData->fieldData->vals[i].total_gain +
(-1*antData->fieldData->mingain))
/ range);
if (current_value < NULL_THRESHOLD) {
antData->surfaceMesh[el][az].r = 1.0;
antData->surfaceMesh[el][az].g = 0.0;
antData->surfaceMesh[el][az].b = 0.0;
} else {
antData->surfaceMesh[el][az].r = 0.0;
antData->surfaceMesh[el][az].g = 0.0;
antData->surfaceMesh[el][az].b = 0.0;
} /** Not a null **/
i++;
} /** By elevation **/
} /** By azimuth **/
for (el = 0; el < increments; el++) {
antData->surfaceMesh[el][increments].posx =
antData->surfaceMesh[el][0].posx;
antData->surfaceMesh[el][increments].posy =
antData->surfaceMesh[el][0].posy;
antData->surfaceMesh[el][increments].posz =
antData->surfaceMesh[el][0].posz;
antData->surfaceMesh[el][increments].r = antData->surfaceMesh[el][0].r;
antData->surfaceMesh[el][increments].g = antData->surfaceMesh[el][0].g;
antData->surfaceMesh[el][increments].b = antData->surfaceMesh[el][0].b;
} /** Wrap around buffer **/
for (az = 0; az < increments; az++) {
antData->surfaceMesh[increments][az].posx =
antData->surfaceMesh[0][az].posx;
antData->surfaceMesh[increments][az].posy =
antData->surfaceMesh[0][az].posy;
antData->surfaceMesh[increments][az].posz =
antData->surfaceMesh[0][az].posz;
antData->surfaceMesh[increments][az].r = antData->surfaceMesh[0][az].r;
antData->surfaceMesh[increments][az].g = antData->surfaceMesh[0][az].g;
antData->surfaceMesh[increments][az].b = antData->surfaceMesh[0][az].b;
} /** Wrap around buffer **/
glPushMatrix();
glEnable(GL_BLEND);
glShadeModel(GL_SMOOTH);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
for (latitude=0; latitude < increments; latitude++) {
longitude = 0;
glBegin(GL_TRIANGLE_STRIP);
while (longitude <= increments/2) {
point_color[0] = antData->surfaceMesh[latitude][longitude].r;
point_color[1] = antData->surfaceMesh[latitude][longitude].g;
point_color[2] = antData->surfaceMesh[latitude][longitude].b;
if (point_color[0] == 1.0)
point_color[3] = ALPHA;
else
point_color[3] = 0.0;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude][longitude].posx,
antData->surfaceMesh[latitude][longitude].posy,
antData->surfaceMesh[latitude][longitude].posz);
point_color[0] = antData->surfaceMesh[latitude+1][longitude].r;
point_color[1] = antData->surfaceMesh[latitude+1][longitude].g;
point_color[2] = antData->surfaceMesh[latitude+1][longitude].b;
if (point_color[0] == 1.0)
point_color[3] = ALPHA;
else
point_color[3] = 0.0;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, point_color);
glNormal3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
glVertex3f(antData->surfaceMesh[latitude+1][longitude].posx,
antData->surfaceMesh[latitude+1][longitude].posy,
antData->surfaceMesh[latitude+1][longitude].posz);
longitude++;
} /** For all latitudes control points **/
glEnd();
} /** Triangle strips **/
glDisable(GL_BLEND);
glPopMatrix();
} /** Not empty **/
} /** End of DrawShowNullsSphere **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of VisField.c **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/configure.ac 0000644 0001750 0001750 00000003746 10401365241 015656 0 ustar tomy tomy AC_PREREQ(2.57)
AC_INIT(antennavis, 0.3, pg4i@amsat.org)
AC_PREFIX_DEFAULT(/usr/local)
AC_CONFIG_SRCDIR([AntennaWidget.c])
# Checks for programs.
AC_PROG_CC
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib"
# Checks for libraries.
AC_CHECK_LIB([GLU], [gluCylinder])
AC_CHECK_LIB([Xmu], [XmuLookupStandardColormap])
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([stddef.h stdlib.h string.h unistd.h])
# Check for tcl/tk
AC_ARG_WITH(tcltk,
[ --with-tcltk=DIR Use DIR/include and DIR/lib for tcl and tk])
if test -n "$tcltk" -a "$tcltk" != "no" ; then
CPPFLAGS="-I$tcltk/include $CPPFLAGS"
LDFLAGS"$LDFLAGS -L$tcltk/lib"
fi
AC_ARG_WITH(tkdir,
[ --with-tkdir=TKDIR Use TKDIR/include and TKDIR/lib for tk if it
is in a different place from tcl directory
and is not auto-detected properly])
if test -n "$tkdir" -a "$tkdir" != "no" ; then
CPPFLAGS="-I$tkdir/include $CPPFLAGS"
LDFLAGS"$LDFLAGS -L$tkdir/lib"
fi
dnl A function to search for header files
AC_DEFUN(AC_SEARCH_HEADERS,
[
for search_header in $1
do
[AC_CHECK_HEADER($search_header,
[$2=`AS_DIRNAME($search_header)`]
[if test "$$2" != "/usr/include"; then
CPPFLAGS="-I$$2 $CPPFLAGS"
fi
break]
,
[])]
done
])
if test "x$with_tcltk" != "xno" ; then
AC_SEARCH_LIBS([Tcl_Init], [tcl84 tcl8.4 tcl83 tcl8.3 tcl8.0],
AC_SEARCH_LIBS([Tk_Init], [tk84 tk8.4 tk83 tk8.3 tk8.0],
[AC_SEARCH_HEADERS(/usr/include/tcl8.4/tcl.h /usr/include/tcl8.3/tcl.h /usr/include/tcl8.0/tcl.h /usr/include/tcl.h
,BASE_TCL_DIR)
AC_SEARCH_HEADERS("$BASE_TCL_DIR/tk.h" /usr/include/tk8.4/tk.h /usr/include/tk8.3/tk.h /usr/include/tk8.0/tk.h /usr/include/tk.h
,BASE_TK_DIR)]))
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([sqrt strdup strstr])
AC_CONFIG_FILES([makefile])
AC_OUTPUT
antennavis-0.3.1.orig/ParseArgs.h 0000644 0001750 0001750 00000010443 10401342136 015416 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef PARSEARGS_H
#define PARSEARGS_H
#include
#include
#include "MyTypes.h"
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Definitions **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
#define PA_CHANGED 7
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Data Types **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
enum PA_Type {PA_END, PA_FLOAT, PA_BOOL, PA_INT, PA_RGB};
struct PA_Config {
enum PA_Type type; /** Type for parsing **/
char *name; /** Name **/
int offset; /** An offset **/
};
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Function Prototypes **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
extern GLint PA_ParseArgs(Tcl_Interp *interp,
GLint argc,
CONST84 char **argv,
struct PA_Config *cfg,
void *data);
#endif
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of ParseArgs.h **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/AUTHORS 0000644 0001750 0001750 00000000155 11324333315 014431 0 ustar tomy tomy Written by: Joop Stakenborg PG4I
Maintained by: Nanakos Chrysostomos
antennavis-0.3.1.orig/ant.c 0000644 0001750 0001750 00000141327 10401342654 014317 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "MyTypes.h"
#include "TkAntenna.h"
#include "togl.h"
#include "ant.h"
#include "pcard.h"
#include "VisField.h"
#include "VisWires.h"
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Global Variables **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
double SCALE_FACTOR; /** Scale factor for antenna **/
double DEFAULT_BOOMHEIGHT; /** In case no ground specd **/
double POINT_DIST_SCALE; /** For point clouds, in dBi **/
double POINT_SIZE_SCALE; /** ..also in terms of dBi **/
double STEP_SIZE; /** Degrees between control points **/
double NULL_THRESHOLD; /** As a percentage of max dBi **/
double NULL_DISTANCE; /** So null maps float above **/
double ALPHA; /** Alpha transparency factor **/
double TUBE_WIDTH_SCALE=2; /** Tube width scale **/
double curr_step_size; /** Updated when the NEC called **/
int WireDrawMode; /** Mode to draw the wires in **/
int MultipleAntMode; /** Current antenna or all in phase **/
int ShowRadPat; /** Show radiation pattern? **/
int ShowPolSense; /** Show polarization sense? **/
int ShowPolTilt; /** Show polarization tilt? **/
int ShowAxialRatio; /** Show axial ratios? **/
int ShowNulls; /** Show nulls in pattern? **/
int DrawMode = 0; /** Mode to draw output in **/
int FreqSteps; /** Frequency steps **/
AntArray TheAnts; /** The antennas' geometries **/
bool FieldDataComputed = false; /** Do we need to compute field? **/
bool RFPowerDensityOn = false; /** Draw RF Power Density? **/
bool AntennasInScene = false; /** Are there antennas yet? **/
Point Center; /** Center of scene **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Function Prototypes **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void TKA_Cylinder(GLfloat radius, GLfloat height, GLint slices, GLint rings);
void TKA_Cube(GLfloat size);
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawAxes **/
/** **/
/** Debugging function. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawAxes() {
GLfloat fcolor[4]; /** Color **/
fcolor[0] = 1.0; fcolor[1] = 0.0; fcolor[2] = 0.0; fcolor[3] = 1.0;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, fcolor);
glLineWidth(2.0);
glBegin(GL_LINES);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(1.0, 0.0, 0.0);
glEnd();
fcolor[0] = 0.0; fcolor[1] = 1.0; fcolor[2] = 0.0; fcolor[3] = 1.0;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, fcolor);
glBegin(GL_LINES);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, 1.0, 0.0);
glEnd();
fcolor[0] = 0.0; fcolor[1] = 0.0; fcolor[2] = 1.0; fcolor[3] = 1.0;
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, fcolor);
glBegin(GL_LINES);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, 0.0, 1.0);
glEnd();
} /** End of DrawAxes **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** InsertTube **/
/** **/
/** Add an element to the antenna. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void InsertTubeR(Tube *root, Tube *the_tube) {
if(root == NULL)
return;
else if(root->next == NULL) {
root->next = (Tube*)malloc(sizeof(Tube));
*root->next = *the_tube;
root->next->next = NULL;
}
else
InsertTubeR(root->next, the_tube);
} /** End of InsertTubeR **/
void InsertTube(Ant *the_ant, Tube *the_tube) {
if(the_ant->first_tube == NULL) {
the_ant->first_tube = (Tube*)malloc(sizeof(Tube));
*the_ant->first_tube = *the_tube;
the_ant->first_tube->next = NULL;
} else
InsertTubeR(the_ant->first_tube, the_tube);
the_ant->tube_count++;
} /** End of InsertTube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** SetPoint **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void SetPoint(Point *p, double x, double y, double z) {
p->x = x;
p->y = y;
p->z = z;
} /** End of SetPoint **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Square double **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
double sqr(double x) {
return(x*x);
} /** End of sqr **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** PointDist **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
double PointDist(Point p1, Point p2) {
double result; /** Distance **/
result = (sqr(p2.x-p1.x) + sqr(p2.y-p1.y) + sqr(p2.z-p1.z));
return(sqrt(result));
} /** End of PointDist **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ToggleDrawMode **/
/** **/
/** This is called by the Tk widget code and toggles the variable that **/
/** determines which mode to draw the antenna pattern in. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void ToggleDrawMode(int mode) {
DrawMode = mode;
} /** End of ToggleDrawMode **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ChangeFrequency **/
/** **/
/** This changes the frequency in MHz that the selected antenna gets **/
/** computed at by the NEC code. This should be a positive value. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void ChangeFrequency(double MHz) {
if (MHz < 0)
TheAnts.ants[TheAnts.curr_ant].frequency = 0.0;
else
TheAnts.ants[TheAnts.curr_ant].frequency = MHz;
} /** End of ToggleDrawMode **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** InitDisplay **/
/** **/
/** An inelegant mechanism for initializing some globals. Oh well, what **/
/** can you do? **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void InitDisplay(void) {
static int here_before; /** Have we been here before **/
if(here_before == 0) {
if (AntennasInScene == false)
TheAnts.ant_count = 0;
curr_step_size = 5;
ShowRadPat = 0;
ShowPolSense = 1;
ShowPolTilt = 0;
ShowNulls = 0;
NULL_THRESHOLD = 0.85;
NULL_DISTANCE = 5.0;
here_before = 1;
SetPoint(&Center, 0, 0, 0);
} /** Thing we do once ever **/
} /** End of InitDisplay **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DisplayField **/
/** **/
/** Displays the radiation field of the antenna. This is basically a **/
/** giant switch. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DisplayField(Ant *antData) {
if(RFPowerDensityOn == true) {
glPushMatrix();
if (DrawMode == 0) {
if(ShowRadPat)
DrawRFPowerDensityPoints(antData);
if(ShowPolSense)
DrawPolarizationSensePoints(antData);
if(ShowPolTilt)
DrawPolarizationTiltPoints(antData);
if(ShowAxialRatio)
DrawAxialRatioPoints(antData);
if(ShowNulls)
DrawShowNullsPoints(antData);
} /** Points **/
else if (DrawMode == 1) {
if(ShowRadPat)
DrawRFPowerDensitySurface(antData);
if(ShowPolSense)
DrawPolarizationSenseSurface(antData);
if(ShowPolTilt)
DrawPolarizationTiltSurface(antData);
if(ShowAxialRatio)
DrawAxialRatioSurface(antData);
if(ShowNulls)
DrawShowNullsSurface(antData);
} /** Surface **/
else if (DrawMode == 2) {
if(ShowRadPat)
DrawRFPowerDensitySphere(antData);
if(ShowPolSense)
DrawPolarizationSenseSphere(antData);
if(ShowPolTilt)
DrawPolarizationTiltSphere(antData);
if(ShowAxialRatio)
DrawAxialRatioSphere(antData);
if(ShowNulls)
DrawShowNullsSphere(antData);
} /** Sphere **/
glPopMatrix();
} /** Draw Power Density **/
} /** End of DisplayField **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DisplaySelectedAnt **/
/** **/
/** This will render the antenna on the screen with a boom and mast if **/
/** applicable. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DisplaySelectedAnt(Ant *ant, GLint slices, GLint rings, bool selected) {
double boomlength; /** Length of the boom **/
double boomcenter=0; /** Distance to boom center **/
double boomheight=0; /** Height of boom above ground **/
double boomwidth; /** Width of boom **/
double boomshift; /** How far we need to center **/
GLfloat selected_color[4]; /** The selected color **/
if (selected == true)
selected_color[0] = 1.0;
else
selected_color[0] = 0.5;
selected_color[1] = 0.5;
selected_color[2] = 0.5;
selected_color[3] = 1.0;
glPushMatrix();
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, selected_color);
if (ant->tube_count != 0) { /** Display only with antenna **/
glScalef(ant->visual_scale, ant->visual_scale, ant->visual_scale);
glTranslatef(ant->dx, ant->dy, ant->dz);
/** Antenna support structure **/
if ((ant->type == YAGI) || (ant->type == QUAD) ||(ant->type == DIPOLE)) {
boomheight = GetBoomHeight(ant->first_tube);
} /** Determine boomheight **/
if (ant->type == ELEVATED_VERTICAL) {
boomheight = GetVerticalHeight(ant->first_tube);
} /** Determine boomheight **/
if (ant->ground_specified == false) {
if ((ant->type == YAGI) ||
(ant->type == QUAD) ||
(ant->type == DIPOLE) ||
(ant->type == ELEVATED_VERTICAL)) {
boomheight = DEFAULT_BOOMHEIGHT;
boomheight = boomheight / SCALE_FACTOR;
} /** Common gain antennas **/
if (ant->type == VERTICAL) {
boomheight = 0.0;
} /** Verticals **/
} else {
boomheight = boomheight / SCALE_FACTOR;
} /** Boomheight given **/
boomwidth = GetBoomWidth(ant->first_tube);
if ((ant->type == YAGI) ||
(ant->type == QUAD) ||
(ant->type == DIPOLE) ||
(ant->type == ELEVATED_VERTICAL)) {
glPushMatrix();
glRotatef(-90.0, 1.0 , 0.0, 0.0 );
if (boomheight != 0.0)
TKA_Cylinder(boomwidth * 1.5, boomheight, slices, rings);
glPopMatrix();
} /** Only for elevated antennas **/
/** Antenna Boom **/
boomlength = GetBoomLength(ant->first_tube);
boomlength = boomlength / SCALE_FACTOR;
boomshift = GetBoomShift(ant->first_tube);
boomshift = boomshift / SCALE_FACTOR;
boomcenter = (boomlength / 2.0) + boomshift;
if ((ant->type == YAGI) ||
(ant->type == QUAD)) {
glPushMatrix();
glTranslatef((boomlength / -2.0), boomheight , 0.0);
glRotatef(90.0, 0.0, 1.0, 0.0);
if (boomlength != 0.0)
TKA_Cylinder(boomwidth, boomlength, slices, rings);
glPopMatrix();
} /** Only for antennas with booms **/
} /** Draw only with antenna **/
/** Antenna elements **/
glPushMatrix();
if (ant->ground_specified == false) {
glTranslatef((boomcenter * -1.0), boomheight*1, 0.0);
} else {
glTranslatef((boomcenter * -1.0), boomheight*0, 0.0);
} /** Move into position **/
if (ant->fieldComputed == false) {
DrawTubeList(ant->first_tube, ant->current_tube, slices, rings);
} else {
if (WireDrawMode == 0) {
DrawTubeList(ant->first_tube, ant->current_tube, slices, rings);
} else if (WireDrawMode == 1) {
DrawWireCurrentMagnitudeList(ant->first_tube,
ant->current_tube,
ant->max_current_mag,
ant->min_current_mag,
slices,
rings);
} else if (WireDrawMode == 2) {
DrawWireCurrentPhaseList(ant->first_tube,
ant->current_tube,
ant->max_current_phase,
ant->min_current_phase,
slices,
rings);
/*
DrawTubeList(ant->first_tube, ant->current_tube, slices, rings);
*/
} /** How to draw wires **/
} /** Only if field computed **/
glPopMatrix();
/** Radiation field **/
glPushMatrix();
if ((ant->fieldComputed == true) && (MultipleAntMode == 0)) {
glTranslatef(0.0, boomheight, 0.0);
glScalef((1.0/ant->visual_scale),
(1.0/ant->visual_scale),
(1.0/ant->visual_scale));
DisplayField(ant);
} /** Only if field is computed **/
glPopMatrix();
glPopMatrix();
} /** End of DisplaySelectedAnt **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DisplayAnt **/
/** **/
/** This should be DisplayAnts plural. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DisplayAnt(GLint slices, GLint rings) {
double median_x=0; /** Median X value **/
double median_y=0; /** Median Y value **/
double median_z=0; /** Median Z value **/
double boomheight=0;/** Height of boom above ground **/
int i; /** Loop counter **/
int j; /** Loop counter **/
InitDisplay();
if (MultipleAntMode == 1) {
/** Antenna support structure **/
if ((TheAnts.ants[TheAnts.curr_ant].type == YAGI) ||
(TheAnts.ants[TheAnts.curr_ant].type == QUAD) ||
(TheAnts.ants[TheAnts.curr_ant].type == DIPOLE)) {
boomheight = GetBoomHeight(TheAnts.ants[TheAnts.curr_ant].first_tube);
} /** Determine boomheight **/
if (TheAnts.ants[TheAnts.curr_ant].type == ELEVATED_VERTICAL) {
boomheight=GetVerticalHeight(TheAnts.ants[TheAnts.curr_ant].first_tube);
} /** Determine boomheight **/
if (TheAnts.ants[TheAnts.curr_ant].ground_specified == false) {
if ((TheAnts.ants[TheAnts.curr_ant].type == YAGI) ||
(TheAnts.ants[TheAnts.curr_ant].type == QUAD) ||
(TheAnts.ants[TheAnts.curr_ant].type == DIPOLE) ||
(TheAnts.ants[TheAnts.curr_ant].type == ELEVATED_VERTICAL)) {
boomheight = DEFAULT_BOOMHEIGHT;
boomheight = boomheight / SCALE_FACTOR;
} /** Common gain antennas **/
if (TheAnts.ants[TheAnts.curr_ant].type == VERTICAL) {
boomheight = 0.0;
} /** Verticals **/
} else {
boomheight = boomheight / SCALE_FACTOR;
} /** Boomheight given **/
median_x = 0.0;
median_y = 0.0;
median_z = 0.0;
for (j=0;jfirst_tube = NULL;
ant->tube_count = 0;
ant->fieldData = NULL;
ant->dx = 0.0;
ant->dy = 0.0;
ant->dz = 0.0;
} /** End of InitAnt **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ReadFile **/
/** **/
/** This is the callback function that loads an antenna into memory. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void ReadFile(CONST84 char *file_name) {
if (AntennasInScene == false) {
TheAnts.ant_count = 0;
AntennasInScene = true;
} /** Initialize antenna count **/
TheAnts.ant_count++;
ChangeCurrentAnt(1);
InitAnt(&TheAnts.ants[TheAnts.curr_ant]);
TheAnts.ants[TheAnts.curr_ant].tube_count = 0;
TheAnts.ants[TheAnts.curr_ant].fieldComputed = false;
ReadCardFile(file_name, &TheAnts.ants[TheAnts.curr_ant]);
RFPowerDensityOn = false;
TheAnts.ants[TheAnts.curr_ant].current_tube =
TheAnts.ants[TheAnts.curr_ant].first_tube;
} /** End of ReadFile **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DeleteCurrentAnt **/
/** **/
/** There may be a memory leak here. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DeleteCurrentAnt(void) {
int i; /** Array index **/
for(i = TheAnts.curr_ant; i < TheAnts.ant_count-1; i++) {
TheAnts.ants[i] = TheAnts.ants[i+1];
} /** Locate current antenna **/
if(TheAnts.ant_count > 0)
TheAnts.ant_count--;
if(TheAnts.curr_ant >= TheAnts.ant_count)
TheAnts.curr_ant--;
} /** End of DeleteCurrentTube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** MoveCurrentAnt **/
/** **/
/** Moves the current antenna position. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void MoveCurrentAnt(double dx, double dy, double dz) {
if(TheAnts.ants[TheAnts.curr_ant].current_tube != NULL) {
TheAnts.ants[TheAnts.curr_ant].dx += dx;
TheAnts.ants[TheAnts.curr_ant].dy += dy;
TheAnts.ants[TheAnts.curr_ant].dz += dz;
} /** While more elements **/
} /** End of MoveCurrentAnt **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** MoveCurrentTube **/
/** **/
/** Moves the current antenna element. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void MoveCurrentTube(double dx, double dy, double dz) {
Tube *current; /** Current tube **/
if(TheAnts.ants[TheAnts.curr_ant].current_tube != NULL) {
current = TheAnts.ants[TheAnts.curr_ant].current_tube;
if (current->type == IS_TUBE) {
TheAnts.ants[TheAnts.curr_ant].current_tube->e1.x += dx;
TheAnts.ants[TheAnts.curr_ant].current_tube->e1.y += dy;
TheAnts.ants[TheAnts.curr_ant].current_tube->e1.z += dz;
TheAnts.ants[TheAnts.curr_ant].current_tube->e2.x += dx;
TheAnts.ants[TheAnts.curr_ant].current_tube->e2.y += dy;
TheAnts.ants[TheAnts.curr_ant].current_tube->e2.z += dz;
} /** Only for elements **/
} /** While more elements **/
} /** End of MoveCurrentTube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** MoveCurrentWall **/
/** **/
/** Moves the current wall. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void MoveCurrentWall(double dx, double dy, double dz) {
Tube *current; /** Current tube **/
if(TheAnts.ants[TheAnts.curr_ant].current_tube != NULL) {
current = TheAnts.ants[TheAnts.curr_ant].current_tube;
if (current->type == IS_WALL) {
TheAnts.ants[TheAnts.curr_ant].current_tube->e1.x += dx;
TheAnts.ants[TheAnts.curr_ant].current_tube->e1.y += dy;
TheAnts.ants[TheAnts.curr_ant].current_tube->e1.z += dz;
TheAnts.ants[TheAnts.curr_ant].current_tube->e2.x += dx;
TheAnts.ants[TheAnts.curr_ant].current_tube->e2.y += dy;
TheAnts.ants[TheAnts.curr_ant].current_tube->e2.z += dz;
} /** Only for walls **/
} /** While more elements **/
} /** End of MoveCurrentWall **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** MoveCenter **/
/** **/
/** Moves the viewing center. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void TransformPoint(Point *old_point, double azimuth, double elevation,
double dist, Point *new_point)
{
Point save_old;
save_old = *old_point;
new_point->y = -dist*sin(elevation/57.3);
new_point->z = dist*cos(elevation/57.3);
new_point->x = new_point->z*sin(azimuth/57.3);
new_point->z = new_point->z*cos(azimuth/57.3);
/* new_point->x = dist*sin(azimuth/57.3);
new_point->z = dist*cos(azimuth/57.3);
new_point->y = -new_point->z*sin(elevation/57.3);
new_point->z = new_point->z*cos(elevation/57.3);*/
new_point->x += save_old.x;
new_point->y += save_old.y;
new_point->z += save_old.z;
}/*TransformPoint*/
void DoMoveCenter(double x, double y, double azimuth, double elevation,
double dist) {
TransformPoint(&Center, -azimuth - 90, 0, -x/35.0, &Center);
TransformPoint(&Center, -azimuth, -elevation -90, -y/35.0, &Center);
/*Center.x += x;
Center.y += y; */
}
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** RotateCurrentTube **/
/** **/
/** Causes the current antenna element to rotate about its center. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void RotateCurrentTube(double rx, double ry, double rz) {
Point e1; /** Left endpoint **/
Point e2; /** Right endpoint **/
Point center; /** Pivot point **/
double x; /** Computed value **/
double y; /** Computed value **/
if(TheAnts.ants[TheAnts.curr_ant].current_tube != NULL) {
if(TheAnts.ants[TheAnts.curr_ant].current_tube->type == IS_TUBE) {
e1 = TheAnts.ants[TheAnts.curr_ant].current_tube->e1;
e2 = TheAnts.ants[TheAnts.curr_ant].current_tube->e2;
center.x = (e1.x + e2.x)/2;
center.y = (e1.y + e2.y)/2;
center.z = (e1.z + e2.z)/2;
e1.x -= center.x;
e1.y -= center.y;
e1.z -= center.z;
e2.x -= center.x;
e2.y -= center.y;
e2.z -= center.z;
y = e1.y*cos(rx/57.3) - e1.z*sin(rx/57.3);
e1.z = e1.y*sin(rx/57.3) + e1.z*cos(rx/57.3);
e1.y = y;
y = e2.y*cos(rx/57.3) - e2.z*sin(rx/57.3);
e2.z = e2.y*sin(rx/57.3) + e2.z*cos(rx/57.3);
e2.y = y;
x = e1.x*cos(ry/57.3) + e1.z*sin(ry/57.3);
e1.z = -e1.x*sin(ry/57.3) + e1.z*cos(ry/57.3);
e1.x = x;
x = e2.x*cos(ry/57.3) + e2.z*sin(ry/57.3);
e2.z = -e2.x*sin(ry/57.3) + e2.z*cos(ry/57.3);
e2.x = x;
x = e1.x*cos(rz/57.3) - e1.y*sin(rz/57.3);
e1.y = e1.x*sin(rz/57.3) + e1.y*cos(rz/57.3);
e1.x = x;
x = e2.x*cos(rz/57.3) - e2.y*sin(rz/57.3);
e2.y = e2.x*sin(rz/57.3) + e2.y*cos(rz/57.3);
e2.x = x;
e1.x += center.x;
e1.y += center.y;
e1.z += center.z;
e2.x += center.x;
e2.y += center.y;
e2.z += center.z;
TheAnts.ants[TheAnts.curr_ant].current_tube->e1 = e1;
TheAnts.ants[TheAnts.curr_ant].current_tube->e2 = e2;
} /** Only for elements **/
} /** While more elements **/
} /** End of RotateCurrentTube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** RotateCurrentAntenna **/
/** **/
/** Causes the current antenna to rotate about its mast. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void RotateCurrentAntenna(double rx, double ry, double rz) {
Point e1; /** Left endpoint **/
Point e2; /** Right endpoint **/
Point center; /** Pivot point **/
double x; /** Computed value **/
double y; /** Computed value **/
if(TheAnts.ants[TheAnts.curr_ant].current_tube != NULL) {
e1 = TheAnts.ants[TheAnts.curr_ant].current_tube->e1;
e2 = TheAnts.ants[TheAnts.curr_ant].current_tube->e2;
center.x = (e1.x + e2.x)/2;
center.y = (e1.y + e2.y)/2;
center.z = (e1.z + e2.z)/2;
e1.x -= center.x;
e1.y -= center.y;
e1.z -= center.z;
e2.x -= center.x;
e2.y -= center.y;
e2.z -= center.z;
y = e1.y*cos(rx/57.3) - e1.z*sin(rx/57.3);
e1.z = e1.y*sin(rx/57.3) + e1.z*cos(rx/57.3);
e1.y = y;
y = e2.y*cos(rx/57.3) - e2.z*sin(rx/57.3);
e2.z = e2.y*sin(rx/57.3) + e2.z*cos(rx/57.3);
e2.y = y;
x = e1.x*cos(ry/57.3) + e1.z*sin(ry/57.3);
e1.z = -e1.x*sin(ry/57.3) + e1.z*cos(ry/57.3);
e1.x = x;
x = e2.x*cos(ry/57.3) + e2.z*sin(ry/57.3);
e2.z = -e2.x*sin(ry/57.3) + e2.z*cos(ry/57.3);
e2.x = x;
x = e1.x*cos(rz/57.3) - e1.y*sin(rz/57.3);
e1.y = e1.x*sin(rz/57.3) + e1.y*cos(rz/57.3);
e1.x = x;
x = e2.x*cos(rz/57.3) - e2.y*sin(rz/57.3);
e2.y = e2.x*sin(rz/57.3) + e2.y*cos(rz/57.3);
e2.x = x;
e1.x += center.x;
e1.y += center.y;
e1.z += center.z;
e2.x += center.x;
e2.y += center.y;
e2.z += center.z;
TheAnts.ants[TheAnts.curr_ant].current_tube->e1 = e1;
TheAnts.ants[TheAnts.curr_ant].current_tube->e2 = e2;
} /** While more elements **/
} /** End of RotateCurrentAntenna **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ScaleCurrentWall **/
/** **/
/** Changes the size of the obstruction. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void ScaleCurrentWall(double sx, double sy, double sz) {
Tube *current; /** The element **/
current = TheAnts.ants[TheAnts.curr_ant].current_tube;
if (current->type == IS_WALL) {
TheAnts.ants[TheAnts.curr_ant].current_tube->e2.x += sx;
TheAnts.ants[TheAnts.curr_ant].current_tube->e2.y += sy;
TheAnts.ants[TheAnts.curr_ant].current_tube->e2.z += sz;
} /** Only affect walls **/
} /** End of ScaleCurrentWall **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ScaleCurrentTube **/
/** **/
/** Changes the physical length and diameter of the current antenna **/
/** element. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void ScaleCurrentTube(double scale, double width) {
double cx; /** Point c value X **/
double cy; /** Point c value Y **/
double cz; /** Point c value Z **/
double dx; /** Point d value X **/
double dy; /** Point d value Y **/
double dz; /** Point d value Z **/
Tube *current; /** The element **/
Ant TheAnt; /** The antenna **/
current = TheAnts.ants[TheAnts.curr_ant].current_tube;
if (current->type == IS_TUBE) {
TheAnt = TheAnts.ants[TheAnts.curr_ant];
if(TheAnt.current_tube != NULL) {
cx = (TheAnt.current_tube->e2.x + TheAnt.current_tube->e1.x) / 2.0;
cy = (TheAnt.current_tube->e2.y + TheAnt.current_tube->e1.y) / 2.0;
cz = (TheAnt.current_tube->e2.z + TheAnt.current_tube->e1.z) / 2.0;
dx = TheAnt.current_tube->e1.x - cx;
dy = TheAnt.current_tube->e1.y - cy;
dz = TheAnt.current_tube->e1.z - cz;
if((dx*dx + dy*dy + dz*dz > 0.01) || (scale > 0)) {
TheAnt.current_tube->e1.x = cx + dx*(1 + scale);
TheAnt.current_tube->e1.y = cy + dy*(1 + scale);
TheAnt.current_tube->e1.z = cz + dz*(1 + scale);
TheAnt.current_tube->e2.x = cx - dx*(1 + scale);
TheAnt.current_tube->e2.y = cy - dy*(1 + scale);
TheAnt.current_tube->e2.z = cz - dz*(1 + scale);
} /** Assuming things are visible at all **/
TheAnt.current_tube->width *= (width + 1);
if(TheAnt.current_tube->width < 0.001)
TheAnt.current_tube->width = 0.001;
} /** While there are still elements **/
} /** Only if it's not a wall **/
} /** End of MoveCurrentTube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ChangeCurrentAnt **/
/** **/
/** Causes the next antenna in the scene to be selected. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void ChangeCurrentAnt(int count) {
if(TheAnts.ant_count != 0) {
TheAnts.curr_ant++;
if(TheAnts.curr_ant >= TheAnts.ant_count)
TheAnts.curr_ant = 0;
} /** Increment current pointer **/
} /** End of ChangeCurrentAnt **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ChangeCurrentTube **/
/** **/
/** Causes the next element in the antenna to be selected. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void ChangeCurrentTube(int count) {
Ant TheAnt; /** Temporary storage **/
TheAnt = TheAnts.ants[TheAnts.curr_ant];
while(count > 0) {
if(TheAnt.current_tube == NULL)
TheAnt.current_tube = TheAnt.first_tube;
else {
TheAnt.current_tube = TheAnt.current_tube->next;
if(TheAnt.current_tube == NULL)
TheAnt.current_tube = TheAnt.first_tube;
} /** While still elements **/
count--;
} /** Traverse element list **/
TheAnts.ants[TheAnts.curr_ant] = TheAnt;
} /** End of ChangeCurrentTube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** GenerateNECFile **/
/** **/
/** This function traverses the details of the antenna we have stored in **/
/** memory and output a .nec file that NEC2 will load by default. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void GenerateNECFile(CONST84 char *file_name) {
curr_step_size = STEP_SIZE;
if (MultipleAntMode == 0) {
WriteCardFile(file_name,
&TheAnts.ants[TheAnts.curr_ant],
STEP_SIZE,
TheAnts.ants[TheAnts.curr_ant].frequency);
} else if (MultipleAntMode == 1) {
WriteMultAntsFile(file_name,
STEP_SIZE,
TheAnts.ants[TheAnts.curr_ant].frequency);
} /** Single or all antennas **/
} /** End of GenerateNECFile **/
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** AddWall **/
/** **/
/** The callback function for adding an obstruction into the scene. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void AddWall(void) {
Tube a_tube; /** Wall element to be added **/
a_tube.width = 1;
a_tube.type = IS_WALL;
SetPoint(&a_tube.e1, -2, 0, 0);
SetPoint(&a_tube.e2, -1, 2, 4);
InsertTube(&TheAnts.ants[TheAnts.curr_ant], &a_tube);
} /** End of AddWall **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ComputeField **/
/** **/
/** This function calls the NEC2 code to recompute the field of radiation **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void ComputeField(bool changed) {
FILE *fin; /** Input file **/
long parentpid; /** Process ID of parent **/
long childpid; /** Process ID of child **/
int status; /** Status of child process **/
int ferror; /** File access error **/
/** Check to see if antennas exist **/
if (AntennasInScene == true) {
if ((TheAnts.ants[TheAnts.curr_ant].fieldComputed == false) ||
(changed == true)){
ferror = remove("output.nec");
ferror = remove("input.nec");
/** Output our current antenna to disk **/
GenerateNECFile("input.nec");
/** Run NEC code on that file **/
parentpid = getpid();
if ((childpid = fork()) < 0) {
fprintf(stderr,"Can't fork\n");
exit(-2);
} /** Error state **/
if (childpid == 0) { /** We are child **/
printf("Running NEC2 code... please stand by...\n");
execlp("nec2", "nec2", "input.nec", "output.nec", NULL);
exit(-1); /** We should never reach here **/
} /** We are child **/
else { /** We are parent **/
if (wait(&status) != childpid) {
fprintf(stderr,"Problem with child\n");
exit(-3);
} /** Error state **/
} /** We are parent **/
/** Read in results from disk **/
fin = fopen("output.nec", "rt");
if(fin != NULL) {
ParseFieldData(fin, &TheAnts.ants[TheAnts.curr_ant], true, true);
fclose(fin);
}
else {
fprintf(stderr, "Could Not Open File output.nec!!!\n");
return;
}
/*
ferror = remove("output.nec");
ferror = remove("input.nec");
*/
printf("Field computation complete.\n");
RFPowerDensityOn = true;
FieldDataComputed = true;
} /** Need to compute field **/
} /** Antennas are in scene **/
} /** End of ComputeField **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of ant.c **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/togl.h 0000644 0001750 0001750 00000014137 10401332713 014500 0 ustar tomy tomy /* $Id: togl.h,v 1.2 2006/03/01 14:55:07 pa4tu Exp $ */
/* vi:set sw=4: */
/*
* Togl - a Tk OpenGL widget
*
* Copyright (C) 1996-1998 Brian Paul and Ben Bederson
* See the LICENSE file for copyright details.
*/
#ifndef TOGL_H
# define TOGL_H
# include "togl_ws.h"
# ifdef TOGL_WGL
# define WIN32_LEAN_AND_MEAN
# include
# undef WIN32_LEAN_AND_MEAN
# if defined(_MSC_VER)
# define DllEntryPoint DllMain
# endif
# endif
# ifdef _WIN32
# define TOGL_EXTERN __declspec(dllexport) extern
# else
# define TOGL_EXTERN extern
# endif /* _WIN32 */
# ifdef TOGL_AGL_CLASSIC
# ifndef MAC_TCL
# define MAC_TCL 1
# endif
# endif
# ifdef TOGL_AGL
# ifndef MAC_OSX_TCL
# define MAC_OSX_TCL 1
# endif
# ifndef MAC_OSX_TK
# define MAC_OSX_TK 1
# endif
# endif
# include
# include
# if defined(TOGL_AGL) || defined(TOGL_AGL_CLASSIC)
# include
# else
# include
# endif
# ifdef __sgi
# include
# include
# endif
# ifndef CONST84
# define CONST84
# endif
# ifndef NULL
# define NULL 0
# endif
# ifndef TOGL_USE_FONTS
# define TOGL_USE_FONTS 1 /* needed for demos */
# endif
# ifdef __cplusplus
/* *INDENT-OFF* */
extern "C" {
/* *INDENT-ON* */
# endif
# define TOGL_VERSION "1.7"
# define TOGL_MAJOR_VERSION 1
# define TOGL_MINOR_VERSION 7
/*
* "Standard" fonts which can be specified to Togl_LoadBitmapFont()
*/
# define TOGL_BITMAP_8_BY_13 ((char *) 1)
# define TOGL_BITMAP_9_BY_15 ((char *) 2)
# define TOGL_BITMAP_TIMES_ROMAN_10 ((char *) 3)
# define TOGL_BITMAP_TIMES_ROMAN_24 ((char *) 4)
# define TOGL_BITMAP_HELVETICA_10 ((char *) 5)
# define TOGL_BITMAP_HELVETICA_12 ((char *) 6)
# define TOGL_BITMAP_HELVETICA_18 ((char *) 7)
/*
* Normal and overlay plane constants
*/
# define TOGL_NORMAL 1
# define TOGL_OVERLAY 2
struct Togl;
typedef struct Togl Togl;
typedef void (Togl_Callback) (Togl *togl);
typedef int (Togl_CmdProc) (Togl *togl, int argc, CONST84 char *argv[]);
TOGL_EXTERN int Togl_Init(Tcl_Interp *interp);
/*
* Default/initial callback setup functions
*/
TOGL_EXTERN void Togl_CreateFunc(Togl_Callback *proc);
TOGL_EXTERN void Togl_DisplayFunc(Togl_Callback *proc);
TOGL_EXTERN void Togl_ReshapeFunc(Togl_Callback *proc);
TOGL_EXTERN void Togl_DestroyFunc(Togl_Callback *proc);
TOGL_EXTERN void Togl_TimerFunc(Togl_Callback *proc);
TOGL_EXTERN void Togl_ResetDefaultCallbacks(void);
/*
* Change callbacks for existing widget
*/
TOGL_EXTERN void Togl_SetCreateFunc(Togl *togl, Togl_Callback *proc);
TOGL_EXTERN void Togl_SetDisplayFunc(Togl *togl, Togl_Callback *proc);
TOGL_EXTERN void Togl_SetReshapeFunc(Togl *togl, Togl_Callback *proc);
TOGL_EXTERN void Togl_SetDestroyFunc(Togl *togl, Togl_Callback *proc);
TOGL_EXTERN void Togl_SetTimerFunc(Togl *togl, Togl_Callback *proc);
/*
* Miscellaneous
*/
TOGL_EXTERN int Togl_Configure(Tcl_Interp *interp, Togl *togl,
int argc, const char *argv[], int flags);
TOGL_EXTERN void Togl_MakeCurrent(const Togl *togl);
TOGL_EXTERN void Togl_CreateCommand(char *cmd_name, Togl_CmdProc *cmd_proc);
TOGL_EXTERN void Togl_PostRedisplay(Togl *togl);
TOGL_EXTERN void Togl_SwapBuffers(const Togl *togl);
/*
* Query functions
*/
TOGL_EXTERN const char *Togl_Ident(const Togl *togl);
TOGL_EXTERN int Togl_Width(const Togl *togl);
TOGL_EXTERN int Togl_Height(const Togl *togl);
TOGL_EXTERN Tcl_Interp *Togl_Interp(const Togl *togl);
TOGL_EXTERN Tk_Window Togl_TkWin(const Togl *togl);
/*
* Color Index mode
*/
TOGL_EXTERN unsigned long Togl_AllocColor(const Togl *togl, float red,
float green, float blue);
TOGL_EXTERN void Togl_FreeColor(const Togl *togl, unsigned long index);
TOGL_EXTERN void Togl_SetColor(const Togl *togl, unsigned long index,
float red, float green, float blue);
# if TOGL_USE_FONTS == 1
/*
* Bitmap fonts
*/
TOGL_EXTERN GLuint Togl_LoadBitmapFont(const Togl *togl, const char *fontname);
TOGL_EXTERN void Togl_UnloadBitmapFont(const Togl *togl, GLuint fontbase);
# endif
/*
* Overlay functions
*/
TOGL_EXTERN void Togl_UseLayer(Togl *togl, int layer);
TOGL_EXTERN void Togl_ShowOverlay(Togl *togl);
TOGL_EXTERN void Togl_HideOverlay(Togl *togl);
TOGL_EXTERN void Togl_PostOverlayRedisplay(Togl *togl);
TOGL_EXTERN void Togl_OverlayDisplayFunc(Togl_Callback *proc);
TOGL_EXTERN int Togl_ExistsOverlay(const Togl *togl);
TOGL_EXTERN int Togl_GetOverlayTransparentValue(const Togl *togl);
TOGL_EXTERN int Togl_IsMappedOverlay(const Togl *togl);
TOGL_EXTERN unsigned long Togl_AllocColorOverlay(const Togl *togl,
float red, float green, float blue);
TOGL_EXTERN void Togl_FreeColorOverlay(const Togl *togl, unsigned long index);
/*
* User client data
*/
TOGL_EXTERN void Togl_ClientData(ClientData clientData);
TOGL_EXTERN ClientData Togl_GetClientData(const Togl *togl);
TOGL_EXTERN void Togl_SetClientData(Togl *togl, ClientData clientData);
# ifdef TOGL_X11
/*
* X11-only commands.
* Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES)
*/
TOGL_EXTERN Display *Togl_Display(const Togl *togl);
TOGL_EXTERN Screen *Togl_Screen(const Togl *togl);
TOGL_EXTERN int Togl_ScreenNumber(const Togl *togl);
TOGL_EXTERN Colormap Togl_Colormap(const Togl *togl);
# endif
# ifdef __sgi
/*
* SGI stereo-only commands.
* Contributed by Ben Evans (Ben.Evans@anusf.anu.edu.au)
*/
TOGL_EXTERN void Togl_OldStereoDrawBuffer(GLenum mode);
TOGL_EXTERN void Togl_OldStereoClear(GLbitfield mask);
# endif
TOGL_EXTERN void Togl_StereoFrustum(GLfloat left, GLfloat right, GLfloat bottom,
GLfloat top, GLfloat near, GLfloat far, GLfloat eyeDist,
GLfloat eyeOffset);
/*
* Generate EPS file.
* Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES)
*/
TOGL_EXTERN int Togl_DumpToEpsFile(const Togl *togl, const char *filename,
int inColor, void (*user_redraw) (const Togl *));
# ifdef TOGL_AGL_CLASSIC
/*
* Mac-specific setup functions
*/
extern int Togl_MacInit(void);
extern int Togl_MacSetupMainInterp(Tcl_Interp *interp);
# endif
# ifdef __cplusplus
/* *INDENT-OFF* */
}
/* *INDENT-ON* */
# endif
#endif
antennavis-0.3.1.orig/antenna.tcl 0000644 0001750 0001750 00000243501 10401312073 015506 0 ustar tomy tomy #!/bin/sh
# the next line restarts using TkAnt \
exec TkAnt "$0" "$@"
###############################################################################
###############################################################################
## ##
## Antenna Visualization Toolkit ##
## ##
## Copyright (C) 1998 Adrian Agogino, Ken Harker ##
## Copyright (C) 2005 Joop Stakenborg ##
## ##
###############################################################################
###############################################################################
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program 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 General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
###############################################################################
###############################################################################
## ##
## Global Variables ##
## ##
###############################################################################
###############################################################################
# set out mouse control
set MouseControl "View"
# set our antenna
set WAntenna ""
# set our material
set Material "Antenna"
# set our shading type
set Shade "Smooth"
# set our basic light
set Light "View"
# set our type
set Type "Off"
# set our viewer
set Viewer "Global"
# set our antenna type
set AntType "TV"
# material update list
set MaterialLs {}
# light update list
set LightLs {}
# global update list
set GlobalLs {}
# general enable and disable list
set AbleLs {}
# light enable and disable list
set LightAbleLs {}
# our font
set font "-*-helvetica-medium-r-*-*-*-*-*-*-*-*-*"
# our bold font
set boldfont "-*-helvetica-bold-r-*-*-*-*-*-*-*-*-*"
# our relief
set relief groove
# our borderwidth
set borderwidth 1
#our pad
set pad 1
# our enable color
set enablecolor ""
# our disable color
set disablecolor gray60
# mouse position for user interaction
set MouseX 0
set MouseY 0
# real eye position (not a view point from a light)
set EyeLongitude 0
set EyeLatitude 0
set EyeDistance 0
# default distance for directional light
set EyeDefaultDistance 0
# names of the mouse widgets
set WMouseLeft ""
set WMouseMiddle ""
set WMouseRight ""
###############################################################################
###############################################################################
## ##
## Window Initialization ##
## ##
## Create the basic frames and positions them. ##
## ##
###############################################################################
###############################################################################
proc CreateUserInterface {} {
# define global variables
global WAntenna font relief borderwidth pad MaterialLs LightLs \
EyeLongitude EyeLatitude EyeDistance EyeDefaultDistance GlobalLs \
WMouseLeft WMouseMiddle WMouseRight boldfont AbleLs LightAbleLs \
enablecolor disablecolor AntType
# Give it a title
wm title . "Antenna Visualization Toolkit: Antennavis"
# the basics
set WTopFrame .top
frame $WTopFrame
set WBottomFrame .bottom
frame $WBottomFrame
set enablecolor [lindex [$WBottomFrame configure -background] 4]
###########################################################################
###########################################################################
## ##
## Antenna Display Frame ##
## ##
## This is the region of the screen where the antenna is displayed. ##
## ##
###########################################################################
###########################################################################
set WAntennaFrame $WTopFrame.antennaFrame
frame $WAntennaFrame -borderwidth $borderwidth -relief $relief
set WAntenna $WAntennaFrame.antenna
togl $WAntenna -rgba true -double true -depth true -height 390
pack $WAntenna -fill both -fill both -expand 1
pack $WAntennaFrame -side left -fill both -expand 1 -padx $pad -pady $pad
# remember values for the eye-point
set EyeLongitude [eval $WAntenna eye longitude]
set EyeLatitude [eval $WAntenna eye latitude]
set EyeDistance [eval $WAntenna eye distance]
set EyeDefaultDistance $EyeDistance
###########################################################################
###########################################################################
## ##
## File Control Frame ##
## ##
## Initializes the buttons in the File Control frame. ##
## ##
###########################################################################
###########################################################################
set WFileControlFrame $WBottomFrame.fileControlFrame
frame $WFileControlFrame -borderwidth $borderwidth -relief $relief
label $WFileControlFrame.label -text "File Control" -font $boldfont
pack $WFileControlFrame.label -side top
set WloadButton $WFileControlFrame.loadButton
button $WloadButton -relief $relief -text "Load Antenna File" \
-command "LoadAntFile" \
-font $font
pack $WloadButton -side top -pady $pad
set WdeleteButton $WFileControlFrame.deleteButton
button $WdeleteButton -relief $relief -text "Unload Current Antenna" \
-command "DeleteCurrentAnt" \
-font $font
pack $WdeleteButton -side top -pady $pad
set WsaveFileButton $WFileControlFrame.saveFileButton
button $WsaveFileButton -relief $relief -text "Save Antenna File" \
-command "SaveFile $WAntenna" \
-font $font
pack $WsaveFileButton -side top -pady $pad
set WsaveImageButton $WFileControlFrame.saveImageButton
button $WsaveImageButton -relief $relief -text "Save As EPS Image" \
-command "SaveRGBImage $WAntenna" \
-font $font
pack $WsaveImageButton -side top -pady $pad
pack $WFileControlFrame -side left -padx $pad -pady $pad -fill y
###########################################################################
###########################################################################
## ##
## Controls Frame ##
## ##
## Parent frame for Antenna and File control frames. ##
## ##
###########################################################################
###########################################################################
set WControlsFrame $WBottomFrame.controlsFrame
frame $WControlsFrame
pack $WControlsFrame -side left -fill y
###########################################################################
###########################################################################
## ##
## Vis Control Frame ##
## ##
## Initializes the buttons in the Visualization Control frame. ##
## ##
###########################################################################
###########################################################################
set WVisControlFrame $WControlsFrame.visControlFrame
frame $WVisControlFrame -borderwidth $borderwidth -relief $relief
label $WVisControlFrame.label -text "Visualization Control" -font $boldfont
pack $WVisControlFrame.label -side top
set Wdraw_RFPowerDensityButton \
$WVisControlFrame.draw_RFPowerDensityButton
button $Wdraw_RFPowerDensityButton -relief $relief -text "Compute RF Field" \
-command {$WAntenna draw_RFPowerDensity} \
-font $font
pack $Wdraw_RFPowerDensityButton -side top -pady $pad
set MultAntsVariable 0
set SingleAntButton $WVisControlFrame.single_ant_button
radiobutton $SingleAntButton -text "Current Antenna" -font $font \
-variable MultAntsVariable -value 0 \
-command {$WAntenna change_ant_mode "SingleAnt" \
$MultAntsVariable}
$SingleAntButton select
pack $SingleAntButton -side top
set MultipleAntButton $WVisControlFrame.multiple_ant_button
radiobutton $MultipleAntButton -text "All Antennas" -font $font \
-variable MultAntsVariable -value 1 \
-command {$WAntenna change_ant_mode "MultipleAnt" \
$MultAntsVariable}
pack $MultipleAntButton -side top
###########################################################################
###########################################################################
## ##
## Antenna Control Frame ##
## ##
## Initializes the buttons in the Antenna Control frame. ##
## ##
###########################################################################
###########################################################################
set WAntennaControlFrame $WControlsFrame.antennaControlFrame
frame $WAntennaControlFrame -borderwidth $borderwidth -relief $relief
label $WAntennaControlFrame.label -text "Antenna Control" -font $boldfont
pack $WAntennaControlFrame.label -side top
set Wnext_antButton $WAntennaControlFrame.next_antButton
button $Wnext_antButton -relief $relief -text "Select Next Antenna" \
-command {$WAntenna change_current_ant 1} \
-font $font
pack $Wnext_antButton -side top -pady $pad
set Wnext_tubeButton $WAntennaControlFrame.next_tubeButton
button $Wnext_tubeButton -relief $relief -text "Select Next Element" \
-command {$WAntenna change_current_tube 1} \
-font $font
pack $Wnext_tubeButton -side top -pady $pad
set Winsert_wallButton $WAntennaControlFrame.insert_wallButton
button $Winsert_wallButton -relief $relief -text "Insert Wall" \
-command {InsertAnt "Wall"} \
-font $font
pack $Winsert_wallButton -side top -pady $pad
set WFreqButton $WAntennaControlFrame.freq_button
button $WFreqButton -relief $relief -text "Set Frequency" \
-command {SetFrequency} \
-font $font
pack $WFreqButton -side top -pady $pad
UpdateAntennaControl
###########################################################################
###########################################################################
## ##
## Mouse Control Frame ##
## ##
## Initializes the mouse control frame. ##
## ##
###########################################################################
###########################################################################
set WMouseControlFrame $WControlsFrame.mouseControlFrame
frame $WMouseControlFrame -borderwidth $borderwidth -relief $relief
label $WMouseControlFrame.label -text "Mouse Control" -font $boldfont
pack $WMouseControlFrame.label -side top
set WMMouseControl $WMouseControlFrame.mousecontrol
chooser $WMMouseControl MouseControl \
{"View" "Antenna Position" "Element Position" \
"Element Rotation" "Element Size" "Wall Position" "Wall Size"} {}
pack $WMMouseControl -side top -pady $pad
pack $WMouseControlFrame -side top -padx $pad -pady $pad -fill y
pack $WAntennaControlFrame -side top -padx $pad -pady $pad -fill y
pack $WVisControlFrame -side top -padx $pad -pady $pad -fill y
###########################################################################
###########################################################################
## ##
## Displays Frame ##
## ##
## Parent frame for Field and Wire displays. ##
## ##
###########################################################################
###########################################################################
set WDisplayFrame $WBottomFrame.displayFrame
frame $WDisplayFrame
pack $WDisplayFrame -side left -fill y
###########################################################################
###########################################################################
## ##
## Field Display Mode Frame ##
## ##
## Initializes the frame where the user chooses the options for ##
## visualizing the RF field. ##
## ##
###########################################################################
###########################################################################
set WFieldDisplayControlFrame $WDisplayFrame.fieldDisplayFrame
frame $WFieldDisplayControlFrame -borderwidth $borderwidth -relief $relief
label $WFieldDisplayControlFrame.label \
-text "Field Display Mode" -font $boldfont
pack $WFieldDisplayControlFrame.label -side top
set SurfChooser $WFieldDisplayControlFrame.surf_chooser
chooser $SurfChooser SurfType \
{"Dots" "Surface" "Sphere"} {$WAntenna change_mode "DrawMode" $SurfType}
pack $SurfChooser -side top -pady $pad
set RadiationButton $WFieldDisplayControlFrame.radiation_button
checkbutton $RadiationButton -text "Show Radiation Pattern" -font $font \
-variable ShowRadPat \
-command {$WAntenna change_mode "ShowRadPat" $ShowRadPat}
pack $RadiationButton -side top
set PolarizationButton $WFieldDisplayControlFrame.polarization_button
checkbutton $PolarizationButton -text "Show Polarization Sense" -font $font \
-variable ShowPolSense \
-command {$WAntenna change_mode "ShowPolSense" $ShowPolSense}
$PolarizationButton select
pack $PolarizationButton -side top
set PolarizationTiltButton \
$WFieldDisplayControlFrame.polarization_tilt_button
checkbutton $PolarizationTiltButton -text "Show Polarization Tilt" \
-font $font \
-variable ShowPolTilt \
-command {$WAntenna change_mode "ShowPolTilt" $ShowPolTilt}
pack $PolarizationTiltButton -side top
set AxialRatioButton $WFieldDisplayControlFrame.axial_ratio_button
checkbutton $AxialRatioButton -text "Show Axial Ratio" -font $font \
-variable ShowAxialRatio \
-command {$WAntenna change_mode "ShowAxialRatio" $ShowAxialRatio}
pack $AxialRatioButton -side top
set DispNullsButton $WFieldDisplayControlFrame.disp_nulls_button
checkbutton $DispNullsButton -text "Display Nulls in Pattern" -font $font \
-variable ShowNulls \
-command {$WAntenna change_mode "ShowNulls" $ShowNulls}
pack $DispNullsButton -side top
pack $WFieldDisplayControlFrame -side top -padx $pad -pady $pad -fill y
###########################################################################
###########################################################################
## ##
## Wire Display Mode Frame ##
## ##
## Initializes the frame where the user chooses the options for ##
## visualizing the wire characteristics. ##
## ##
###########################################################################
###########################################################################
set WWireDisplayControlFrame $WDisplayFrame.wireDisplayFrame
frame $WWireDisplayControlFrame -borderwidth $borderwidth -relief $relief
label $WWireDisplayControlFrame.label -text "Wire Display Mode" \
-font $boldfont
pack $WWireDisplayControlFrame.label -side top
set WireDisplayVariable 0
set GeometryButton $WWireDisplayControlFrame.geometry_button
radiobutton $GeometryButton -text "Show Geometry" -font $font \
-variable WireDisplayVariable -value 0 \
-command {$WAntenna change_wire_mode "ShowGeometry" \
$WireDisplayVariable}
$GeometryButton select
pack $GeometryButton -side top
set CurrentsButton $WWireDisplayControlFrame.currents_button
radiobutton $CurrentsButton -text "Show Current Magnitude" -font $font \
-variable WireDisplayVariable -value 1 \
-command {$WAntenna change_wire_mode "ShowCurrentMagnitude" \
$WireDisplayVariable}
pack $CurrentsButton -side top
set PhaseButton $WWireDisplayControlFrame.phase_button
radiobutton $PhaseButton -text "Show Current Phase" -font $font \
-variable WireDisplayVariable -value 2 \
-command {$WAntenna change_wire_mode "ShowCurrentPhase" \
$WireDisplayVariable}
pack $PhaseButton -side top
pack $WWireDisplayControlFrame -side top -padx $pad -pady $pad -fill y
###########################################################################
###########################################################################
## ##
## Frame oh frames oh my! ##
## ##
###########################################################################
###########################################################################
# The global frame
set WGlobalFrame $WBottomFrame.globalFrame
frame $WGlobalFrame
set WGRightFrame $WGlobalFrame.rightFrame
frame $WGRightFrame
###########################################################################
###########################################################################
## ##
## Mouse Feedback Frame ##
## ##
## Initializes the frame where the application advises the user on what ##
## the various mouse buttons do in the display window. ##
## ##
###########################################################################
###########################################################################
set WGMouseFrame $WGRightFrame.mouseFrame
frame $WGMouseFrame -borderwidth $borderwidth -relief $relief
set WGMouseLeftLabel $WGMouseFrame.leftLabel
label $WGMouseLeftLabel -text "Left Mouse Button" -font $boldfont
pack $WGMouseLeftLabel -side top
set WMouseLeft $WGMouseFrame.leftText
label $WMouseLeft -text "-" -font $font -height 1
pack $WMouseLeft -side top
set WGMouseMiddleLabel $WGMouseFrame.middleLabel
label $WGMouseMiddleLabel -text "Middle Mouse Button" -font $boldfont
pack $WGMouseMiddleLabel -side top
set WMouseMiddle $WGMouseFrame.middleText
label $WMouseMiddle -text "-" -font $font -height 1
pack $WMouseMiddle -side top
set WGMouseRightLabel $WGMouseFrame.rightLabel
label $WGMouseRightLabel -text "Right Mouse Button" -font $boldfont
pack $WGMouseRightLabel -side top
set WMouseRight $WGMouseFrame.rightText
label $WMouseRight -text "-" -font $font -height 1
pack $WMouseRight -side top
pack $WGMouseFrame -side top -fill both -expand 1 \
-padx $pad -pady $pad -ipadx $pad -ipady $pad
###########################################################################
###########################################################################
## ##
## Slider Devices Frame ##
## ##
## Creates the slider bars in the bottom right corner of the screen ##
## that control the many different variables that affect the display ##
## of the output. ##
## ##
###########################################################################
###########################################################################
set WGScalesFrame $WGRightFrame.scalesFrame
frame $WGScalesFrame -borderwidth $borderwidth -relief $relief
set WGRings $WGScalesFrame.rings
lscale $WGRings "Rings " "SetGlobal rings" horizontal 1 64
pack $WGRings -side bottom -fill x
lappend GlobalLs "lscale_set $WGRings \[$WAntenna global rings\]"
set WGSlices $WGScalesFrame.slices
lscale $WGSlices "Slices" "SetGlobal slices" horizontal 3 64
pack $WGSlices -side bottom -fill x
lappend GlobalLs "lscale_set $WGSlices \[$WAntenna global slices\]"
set WGDBHeight $WGScalesFrame.db_height
lscale2 $WGDBHeight "Default Boom Height" "DBHeight" \
horizontal 5 60
$WGDBHeight.slider set 30
pack $WGDBHeight -side bottom -fill x
set WGScale $WGScalesFrame.scale
lscale2 $WGScale "Antenna Scale" "Scale" \
horizontal 1 16
$WGScale.slider set 5
pack $WGScale -side bottom -fill x
set WGPDScale $WGScalesFrame.pd_scale
lscale2 $WGPDScale "Field Scale" "PDScale" \
horizontal 1 20
$WGPDScale.slider set 5
pack $WGPDScale -side bottom -fill x
set WGPSScale $WGScalesFrame.ps_scale
lscale2 $WGPSScale "Dot Size" "PSScale" \
horizontal 1 100
$WGPSScale.slider set 10
pack $WGPSScale -side bottom -fill x
set WGStepSize $WGScalesFrame.step_size
lscale2 $WGStepSize "Resolution" "StepSize" \
horizontal 1 45
$WGStepSize.slider set 5
pack $WGStepSize -side bottom -fill x
set WGNullThreshold $WGScalesFrame.null_threshold
lscale2 $WGNullThreshold "Null Threshold" "NullThreshold" \
horizontal 1 11
$WGNullThreshold.slider set 8.5
pack $WGNullThreshold -side bottom -fill x
set WGAlpha $WGScalesFrame.alpha
lscale2 $WGAlpha "Transparency" "Alpha" \
horizontal 10 0
$WGAlpha.slider set 5
pack $WGAlpha -side bottom -fill x
set WGFreqSteps $WGScalesFrame.freq_steps
lscale2 $WGFreqSteps "Frequency Steps" "FreqSteps" \
horizontal 0 30
$WGFreqSteps.slider set 5
pack $WGFreqSteps -side bottom -fill x
pack $WGScalesFrame -side top -fill x \
-padx $pad -pady $pad -ipadx $pad -ipady $pad
###########################################################################
###########################################################################
## ##
## Control Buttons Frame ##
## ##
## Sets the control buttons in the bottom right corner of the screen. ##
## ##
###########################################################################
###########################################################################
set WGControlFrame $WDisplayFrame.controlFrame
frame $WGControlFrame
label $WGControlFrame.label -font $font
pack $WGControlFrame.label -side left -padx $pad -pady $pad
set WexitButton $WGControlFrame.exitButton
button $WexitButton -relief $relief -text "Exit" -command "destroy ." \
-font $font
pack $WexitButton -side right -pady $pad
set WresetButton $WGControlFrame.resetButton
button $WresetButton -relief $relief -text "Reset" \
-command "$WAntenna reset; UpdateAntennaControl; UpdateLight; \
UpdateGlobal" -font $font
pack $WresetButton -side right -pady $pad
pack $WGControlFrame -side bottom -fill x
pack $WGRightFrame -side right -fill both -expand 1
pack $WGlobalFrame -side left -fill x -expand 1
UpdateGlobal
pack $WTopFrame -side top -fill both -expand 1
pack $WBottomFrame -side bottom -fill x -expand 0
###########################################################################
###########################################################################
## ##
## Binding Things Together ##
## ##
###########################################################################
###########################################################################
bind $WAntenna {MouseText 1}
bind $WAntenna {MouseText 0}
bind $WAntenna {MouseButtonAntenna %x %y 1 %W}
bind $WAntenna {MouseMotionAntenna %x %y 1 %W}
bind $WAntenna {MouseButtonAntenna %x %y 2 %W}
bind $WAntenna {MouseMotionAntenna %x %y 2 %W}
bind $WAntenna {MouseButtonAntenna %x %y 3 %W}
bind $WAntenna {MouseMotionAntenna %x %y 3 %W}
}
###############################################################################
###############################################################################
## ##
## Updates ##
## ##
## Update values of the antenna widget. ##
## ##
## newpos = new positon of the mouse in pixels ##
## oldpos = old (last) positon of the mouse in pixels ##
## valpp = amount the value should change per pixel ##
## minval = minimum possible for value ##
## maxval = maximum possible for value ##
## cyclic = 1 if value exits minval or maxval it should wrap around ##
## command = command to read/set the value ##
## ##
###############################################################################
###############################################################################
proc ValueUpdate {newpos oldpos valpp minval maxval cyclic command} {
#read the old value
set value [eval $command]
# calculate a new value
set value [expr $value + ($oldpos - $newpos) * $valpp ]
# make sure the new value is in range
if {$cyclic} {
while {$value > $maxval} {set value [expr $value - ($maxval - $minval)]}
while {$value < $minval} {set value [expr $value + ($maxval - $minval)]}
} else {
if {$value > $maxval} {set value $maxval}
if {$value < $minval} {set value $minval}
}
# finally set the new value
eval $command $value
}
###############################################################################
###############################################################################
## ##
## MouseButtonAntenna ##
## ##
## Handle mouse button presses in the antenna's widget. ##
## ##
###############################################################################
###############################################################################
proc MouseButtonAntenna {x y button window} {
global MouseX MouseY
set MouseX $x
set MouseY $y
}
###############################################################################
###############################################################################
## ##
## Handle Mouse Movement ##
## ##
## Handle the motion of the mouse in the antenna's widget. ##
## ##
###############################################################################
###############################################################################
proc MouseMotionAntenna {x y button window} {
global MouseControl MouseX MouseY EyeLongitude EyeLatitude EyeDistance
if {$MouseControl == "Element Position"} {
if {$button == 1} {
$window control_tube 1 [expr $x - $MouseX]
}
if {$button == 2} {
$window control_tube 2 [expr $x - $MouseX]
}
if {$button == 3} {
$window control_tube 3 [expr $x - $MouseX]
}
} elseif {$MouseControl == "Antenna Position"} {
if {$button == 1} {
$window control_ant 1 [expr $x - $MouseX]
}
if {$button == 2} {
$window control_ant 2 [expr $x - $MouseX]
}
if {$button == 3} {
$window control_ant 3 [expr $x - $MouseX]
}
} elseif {$MouseControl == "Element Rotation"} {
if {$button == 1} {
$window control_tube 13 [expr $x - $MouseX]
}
if {$button == 2} {
$window control_tube 14 [expr $x - $MouseX]
}
if {$button == 3} {
$window control_tube 15 [expr $x - $MouseX]
}
} elseif {$MouseControl == "Element Size"} {
if {$button == 1} {
$window control_tube 4 [expr $x - $MouseX]
}
if {$button == 2} {
$window control_tube 5 [expr $x - $MouseX]
}
if {$button == 3} {
$window control_tube 6 [expr $x - $MouseX]
}
} elseif {$MouseControl == "Wall Size"} {
if {$button == 1} {
$window control_tube 7 [expr $x - $MouseX] [expr $y - $MouseY]
}
if {$button == 2} {
$window control_tube 8 [expr $x - $MouseX] [expr $y - $MouseY]
}
if {$button == 3} {
$window control_tube 9 [expr $x - $MouseX] [expr $y - $MouseY]
}
} elseif {$MouseControl == "Wall Position"} {
if {$button == 1} {
$window control_tube 10 [expr $x - $MouseX]
}
if {$button == 2} {
$window control_tube 11 [expr $x - $MouseX]
}
if {$button == 3} {
$window control_tube 12 [expr $x - $MouseX]
}
} elseif {$MouseControl == "View"} {
if {$button == 1} {
ValueUpdate $x $MouseX -1 0 360 1 "$window eye longitude"
ValueUpdate $y $MouseY -0.5 0 90 0 "$window eye latitude"
set EyeLongitude [eval $window eye longitude]
set EyeLatitude [eval $window eye latitude]
}
if {$button == 2} {
ValueUpdate $y $MouseY 0.002 0 1 0 "$window eye distance"
set EyeDistance [eval $window eye distance]
}
if {$button == 3} {
$window move_center [expr $x - $MouseX] [expr $y - $MouseY]
#puts [expr $x - $MouseX]
}
}
#store mouse pos as oldpos
set MouseX $x
set MouseY $y
}
###############################################################################
###############################################################################
## ##
## Chooser Button ##
## ##
## Creates a chooser button. ##
## ##
## path = name of window path ##
## variable = global variable name that holds the current value ##
## texts = list of text. One for each menu entry ##
## command = command that will be executed after the user chooses ##
## default = index that will be the active one at start ##
## ##
###############################################################################
###############################################################################
proc chooser {path variable texts {command {}} {default 0}} {
global font relief AbleLs disablecolor enablecolor
# create menu Button and menu
menubutton $path -text [lindex "$texts" $default] \
-relief $relief -menu $path.menu -indicatoron true -font $font
menu $path.menu
# create menu entries
foreach text $texts {
if {$command != {}} {
set c "$path configure -text \"$text\";eval $command"
} else {
set c "$path configure -text \"$text\""
}
$path.menu add radiobutton -label $text -indicatoron false \
-variable $variable -value $text -font $font -command $c
}
lappend AbleLs [list \
"$path configure -state disabled -background $disablecolor" \
"$path configure -state normal -background $enablecolor"]
}
###############################################################################
###############################################################################
## ##
## Chooser Set ##
## ##
## Set the value of a chooser button. ##
## ##
## path = name of window path ##
## index = index of the menu that should be set ##
## ##
###############################################################################
###############################################################################
proc chooser_set {path index} {
eval $path.menu invoke [expr $index +1]
}
###############################################################################
###############################################################################
## ##
## Set Up Scale Device ##
## ##
## Creates a scale with a label. ##
## ##
## path = name of window path ##
## orient = horizontal | vertical ##
## from/to = range of the value ##
## resolution = slider can only have certain values (or resolution = 0) ##
## range = 1 print number at the beginning and at the end ##
## command = command to be executed when the slider has been moved ##
## command pathname value ##
## ##
###############################################################################
###############################################################################
proc lscale {path {text {}} {command {}} {orient vertical} {from 1.0} \
{to 0.0} {resolution 0.0} {range 0}} {
global font relief borderwidth AbleLs disablecolor enablecolor WAntenna
set r {}
if {$range} {
set r "-tickinterval [expr $to - $from]"
}
frame $path
label $path.label -text $text -font $font
eval scale $path.slider -orient $orient -from $from -to $to $r -width 10 \
-resolution $resolution -showvalue false \
-command \"$command $path\" \
-font $font
if {$orient == "horizontal"} {
pack $path.label -side left
pack $path.slider -side right -fill x -expand 1
} else {
pack $path.label -side top
pack $path.slider -side bottom -fill y -expand 1
}
lappend AbleLs [list \
"$path.slider configure -state disabled" \
"$path.slider configure -state normal" ]
lappend AbleLs [ list \
"$path configure -background $disablecolor" \
"$path configure -background $enablecolor" ]
lappend AbleLs [ list \
"$path.slider configure -background $disablecolor \
-troughcolor $disablecolor -highlightbackground $disablecolor" \
"$path.slider configure -background $enablecolor \
-troughcolor $enablecolor -highlightbackground $enablecolor" ]
lappend AbleLs [ list \
"$path.label configure -background $disablecolor" \
"$path.label configure -background $enablecolor"]
}
proc lscale2 {path {text {}} {command {}} {orient vertical} {from 1.0} \
{to 0.0} {resolution 0.0} {range 0}} {
global font relief borderwidth AbleLs disablecolor enablecolor WAntenna
set r {}
if {$range} {
set r "-tickinterval [expr $to - $from]"
}
frame $path
label $path.label -text $text -font $font
scale $path.slider -orient $orient -from $from -to $to -width 10 \
-command "$WAntenna change_mode $command" \
-resolution $resolution -showvalue false \
-font $font
if {$orient == "horizontal"} {
pack $path.label -side left
pack $path.slider -side right -fill x -expand 1
} else {
pack $path.label -side top
pack $path.slider -side bottom -fill y -expand 1
}
lappend AbleLs [list \
"$path.slider configure -state disabled" \
"$path.slider configure -state normal" ]
lappend AbleLs [ list \
"$path configure -background $disablecolor" \
"$path configure -background $enablecolor" ]
lappend AbleLs [ list \
"$path.slider configure -background $disablecolor \
-troughcolor $disablecolor -highlightbackground $disablecolor" \
"$path.slider configure -background $enablecolor \
-troughcolor $enablecolor -highlightbackground $enablecolor" ]
lappend AbleLs [ list \
"$path.label configure -background $disablecolor" \
"$path.label configure -background $enablecolor"]
}
###############################################################################
###############################################################################
## ##
## Set the Value of a Scale ##
## ##
## path = name of window path ##
## value = new value for scale ##
## ##
###############################################################################
###############################################################################
proc lscale_set {path value} {
set state [$path.slider configure -state]
$path.slider configure -state normal
eval $path.slider set $value
$path.slider configure -state [lindex $state end]
}
###############################################################################
###############################################################################
## ##
## Set Up Three Scales ##
## ##
## path = name of window path ##
## text = name for the whole thing ##
## labels = list for three names for each of the three scales ##
## orient = horizontal | vertical ##
## from/to = range of the value ##
## resolution = slider can only have certain values (or resolution = 0) ##
## range = 1 print number at the beginning and at the end ##
## command = command to be executed when the slider has been moved ##
## command pathname Rvalue Gvalue Bvalue ##
## ##
###############################################################################
###############################################################################
proc rgbscale {path text {command {}} {labels {R G B}} {orient vertical} \
{from {1.0 1.0 1.0}} {to {0.0 0.0 0.0}} {resolution 0.0} {range {0 0 0}}} {
global font borderwidth relief disablecolor enablecolor AbleLs
set com {}
if {$command != {}} {
set com "rgbscale_exec \{$command\} $path"
}
frame $path -relief $relief -borderwidth $borderwidth
frame $path.scales
label $path.label -text $text -font $font
foreach {c n} {r 0 g 1 b 2} {
lscale $path.scales.$c [lindex $labels $n] $com $orient \
[lindex $from $n] [lindex $to $n] $resolution [lindex $range $n]
if {$orient == "vertical"} {
pack $path.scales.$c -side left -fill y
} else {
pack $path.scales.$c -side top -fill x
}
}
if {$orient == "vertical"} {
pack $path.label -side top
pack $path.scales -side bottom -fill y -expand 1
} else {
pack $path.label -side top
pack $path.scales -side bottom -fill x -expand 1
}
lappend AbleLs [list \
"$path configure -background $disablecolor" \
"$path configure -background $enablecolor"]
lappend AbleLs [list \
"$path.scales configure -background $disablecolor" \
"$path.scales configure -background $enablecolor"]
lappend AbleLs [list \
"$path.label configure -background $disablecolor" \
"$path.label configure -background $enablecolor"]
}
proc rgbscale_exec {command path p v} {
eval $command $path [eval $path.scales.r.slider get] \
[eval $path.scales.g.slider get] [eval $path.scales.b.slider get]
}
###############################################################################
###############################################################################
## ##
## Set Up Scales ##
## ##
## path = name of window path ##
## valueR = new value for red scale ##
## valueG = new value for green scale ##
## valueB = new value for blue scale ##
## ##
###############################################################################
###############################################################################
proc rgbscale_set {path valueR valueG valueB} {
lscale_set $path.scales.r $valueR
lscale_set $path.scales.g $valueG
lscale_set $path.scales.b $valueB
}
###############################################################################
###############################################################################
## ##
## Set Material Properties ##
## ##
###############################################################################
###############################################################################
proc SetMaterial {prop {path .} {r 0.0} {g 0.0} {b 0.0}} {
global Material WAntenna Shade
set m 0
if {$Material == "Table"} {set m 1}
if {$Material == "Cube"} {set m 2}
if {$prop == "shininess"} {
$WAntenna material $m $prop $r
} elseif {$prop == "smooth"} {
if {$Shade == "Flat"} {
$WAntenna material $m $prop 0
} else {
$WAntenna material $m $prop 1
}
} else {
$WAntenna material $m $prop $r $g $b
}
}
###############################################################################
###############################################################################
## ##
## Update Material Properties ##
## ##
###############################################################################
###############################################################################
proc UpdateAntennaControl {} {
global Material MaterialLs
set m 0
if {$Material == "Table"} {set m 1}
if {$Material == "Cube"} {set m 2}
foreach e $MaterialLs {
eval eval $e
}
}
###############################################################################
###############################################################################
## ##
## Create a Set of Scales ##
## ##
## frame = pathname of the supporting widget ##
## scalenames = list of names for the scales ##
## each entry my by one name or two names ##
## in the later case is the first name used for the ##
## commands and the last one as text at the widget ##
## setcommand = command that is used to send the values to the antenna ##
## type = type of scales for update command (material|light) ##
## updatelist = listname for the updatecommand ##
## ##
###############################################################################
###############################################################################
proc rgbscales {frame scalenames setcommand type updatelist} {
global $updatelist pad WAntenna
foreach el $scalenames {
if {[llength $el] == 1} {
set name $el
set Name "[string toupper [string index $name 0]]\
[string range $name 1 end ]"
} else {
set name [lindex $el 0]
set Name [lindex $el 1]
}
set Widget $frame.$name
rgbscale $Widget $Name "$setcommand $name"
pack $Widget -side left -fill y -padx $pad -pady $pad
lappend $updatelist "rgbscale_set $Widget \[$WAntenna $type $name\]"
}
}
###############################################################################
###############################################################################
## ##
## Update Light Properties ##
## ##
###############################################################################
###############################################################################
proc UpdateLight {} {
global Light LightLs WAntenna EyeLongitude EyeLatitude EyeDistance \
EyeDefaultDistance LightAbleLs
if {$Light == "Antenna"} {
eval $WAntenna eye longitude $EyeLongitude
eval $WAntenna eye latitude $EyeLatitude
eval $WAntenna eye distance $EyeDistance
LightAble
} elseif {$Light == "View"} {
eval $WAntenna eye longitude $EyeLongitude
eval $WAntenna eye latitude $EyeLatitude
eval $WAntenna eye distance $EyeDistance
LightAble
} else {
set m [string index $Light [expr [string length $Light] -1]]
foreach e $LightLs {
eval eval $e
}
eval $WAntenna eye longitude [eval $WAntenna light $m longitude]
eval $WAntenna eye latitude [eval $WAntenna light $m latitude]
if {[eval $WAntenna light $m type] > 1} {
eval $WAntenna eye distance [eval $WAntenna light $m distance]
} else {
eval $WAntenna eye distance $EyeDefaultDistance
}
}
}
###############################################################################
###############################################################################
## ##
## Set Light Properties ##
## ##
###############################################################################
###############################################################################
proc SetLight {prop {path .} {r 0.0} {g ""} {b ""}} {
global Light WAntenna Type EyeDefaultDistance
if {$Light == "Antenna"} {
} elseif {$Light == "View"} {
} else {
set m [string index $Light [expr [string length $Light] -1]]
if {$prop == "type"} {
if {$Type == "Off"} {
$WAntenna light $m $prop 0
eval $WAntenna eye distance $EyeDefaultDistance
} elseif {$Type == "Direct."} {
$WAntenna light $m $prop 1
eval $WAntenna eye distance $EyeDefaultDistance
} elseif {$Type == "Posit."} {
$WAntenna light $m $prop 2
eval $WAntenna eye distance [eval $WAntenna light $m distance]
} else {
$WAntenna light $m $prop 3
eval $WAntenna eye distance [eval $WAntenna light $m distance]
}
} else {
eval $WAntenna light $m $prop $r $g $b
}
}
}
###############################################################################
###############################################################################
## ##
## Update Light Attenuation Properties ##
## ##
###############################################################################
###############################################################################
proc SetAttenuation {path constant linear quadratic} {
global Light WAntenna
if {$Light != "Antenna" && $Light != "View"} {
set m [string index $Light [expr [string length $Light] -1]]
eval $WAntenna light $m constant $constant
eval $WAntenna light $m linear $linear
eval $WAntenna light $m quadratic $quadratic
}
}
###############################################################################
###############################################################################
## ##
## Update Light Properties ##
## ##
###############################################################################
###############################################################################
proc Attenuation_Set {path} {
global Light WAntenna
if {$Light != "Antenna" && $Light != "View"} {
set m [string index $Light [expr [string length $Light] -1]]
rgbscale_set $path [ $WAntenna light $m constant ] \
[$WAntenna light $m linear] \
[$WAntenna light $m quadratic]
}
}
###############################################################################
###############################################################################
## ##
## Update Global Properties ##
## ##
###############################################################################
###############################################################################
proc UpdateGlobal {} {
global GlobalLs WAntenna
foreach e $GlobalLs {
eval eval $e
}
}
###############################################################################
###############################################################################
## ##
## Set Global Properties ##
## ##
###############################################################################
###############################################################################
proc SetGlobal {prop {path ""} {r ""} {g ""} {b ""}} {
global WAntenna Viewer
if {$prop == "viewer"} {
if {$Viewer == "Global"} {
$WAntenna global $prop 1
} else {
$WAntenna global $prop 0
}
} else {
eval $WAntenna global $prop $r $g $b
}
}
###############################################################################
###############################################################################
## ##
## Help Text ##
## ##
## enter = 1 if the mouse is in the window, 0 else ##
## ##
###############################################################################
###############################################################################
proc MouseText {enter} {
global Light MouseControl WMouseLeft WMouseMiddle WMouseRight Type
if {$enter} {
if {$MouseControl == "View"} {
set l "Rotate and move antenna"
set m "Change distance from antenna"
set r "Translate antenna position"
} elseif {$MouseControl == "Antenna Position"} {
set l "Move forward and backward"
set m "Move left and right"
set r "Move up and down"
} elseif {$MouseControl == "Element Position"} {
set l "Move forward and backward"
set m "Move left and right"
set r "Move up and down"
} elseif {$MouseControl == "Element Size"} {
set l "Change length"
set m "Change diameter"
set r ""
} elseif {$MouseControl == "Wall Position"} {
set l "Move forward and backward"
set m "Move left and right"
set r "Move up and down"
} elseif {$MouseControl == "Wall Size"} {
set l "Change depth"
set m "Change width"
set r "Change height"
} else {
set l ""
set m ""
set r ""
}
$WMouseLeft configure -text $l
$WMouseMiddle configure -text $m
$WMouseRight configure -text $r
} else {
$WMouseLeft configure -text "-"
$WMouseMiddle configure -text "-"
$WMouseRight configure -text "-"
}
}
###############################################################################
###############################################################################
## ##
## Light Frame ##
## ##
## Enables or disables the different parts of the light frame ##
## LightAbleLs contains five elements. ##
## Each element is a pair. Each element of that pair is a list ##
## of commands. The first element of the pair disables widgets and ##
## the secound enables them. ##
## ##
###############################################################################
###############################################################################
proc LightAble {} {
global WAntenna Light LightAbleLs LightLs
if {$Light == "Antenna" || $Light == "View"} {
set n 0
} else {
set m [ string index $Light [ expr [ string length $Light ] -1 ] ]
set n [ expr [ $WAntenna light $m type ] + 1 ]
}
foreach ls $LightAbleLs {
foreach com $ls {
eval [ lindex $com [ expr $n > 0 ] ]
}
incr n -1
}
}
###############################################################################
###############################################################################
## ##
## InsertAnt ##
## ##
## Inserts and antenna into the scene. ##
## ##
###############################################################################
###############################################################################
proc InsertAnt {ant_type} {
global WAntenna
$WAntenna std_ant "$ant_type"
}
###############################################################################
###############################################################################
## ##
## LoadAntFile ##
## ##
## Puts up a file selection dialog box. ##
## ##
###############################################################################
###############################################################################
proc LoadAntFile {} {
global WAntenna
set file_name [fileselect "File Selection" "*.nec"]
if {[string length $file_name] > 0} {
$WAntenna load_ant $file_name
}
}
###############################################################################
###############################################################################
## ##
## ScaleAction ##
## ##
## Performs scaling of values. ##
## ##
###############################################################################
###############################################################################
proc ScaleAction {value} {
puts "value = $value"
}
###############################################################################
###############################################################################
## ##
## SaveFile ##
## ##
## Saves the antenna as a .nec file. ##
## ##
###############################################################################
###############################################################################
proc SaveFile {WAntenna} {
set file_name [GetValue "Please Enter File Name"]
if {[string length $file_name] > 0} {
$WAntenna save_file $file_name
}
}
###############################################################################
###############################################################################
## ##
## SaveRGBImage ##
## ##
## Saves the image in the main antenna vis window as a color EPS file. ##
## ##
###############################################################################
###############################################################################
proc SaveRGBImage {WAntenna} {
set file_name [GetValue "Please Enter File Name"]
if {[string length $file_name] > 0} {
$WAntenna save_rgb_image $file_name
}
}
###############################################################################
###############################################################################
## ##
## DeleteCurrentAnt ##
## ##
## Presently does not ask for confirmation. ##
## ##
###############################################################################
###############################################################################
proc DeleteCurrentAnt {} {
global WAntenna
$WAntenna delete_ant
}
###############################################################################
###############################################################################
## ##
## SetFrequency ##
## ##
## Pops up a dialog box to ask for the frequency value. ##
## ##
###############################################################################
###############################################################################
proc SetFrequency {} {
global WAntenna
set Frequency [GetValue "Please Enter Frequency"]
if {[string length $Frequency] > 0} {
$WAntenna change_mode "Freq" $Frequency
}
}
###############################################################################
###############################################################################
## ##
## GetValue ##
## ##
## Used by functions that require a popup dialog box. ##
## ##
###############################################################################
###############################################################################
proc GetValue { string } {
global prompt font
set f [toplevel .prompt -borderwidth 10]
message $f.msg -text $string -font $font
entry $f.entry -textvariable prompt(result)
set b [frame $f.buttons -bd 10]
pack $f.msg $f.entry $f.buttons -side top -fill x
button $b.ok -text OK -command {set prompt(ok) 1} \
-underline 0
button $b.cancel -text Cancel -command {set prompt(ok) 0} \
-underline 0
pack $b.ok -side left
pack $b.cancel -side right
foreach w [list $f.entry $b.ok $b.cancel] {
bindtags $w [list .prompt [winfo class $w] $w all]
}
bind .prompt "focus $b.ok ; break"
bind .prompt "focus $b.cancel ; break"
bind .prompt break
bind .prompt {set prompt(ok) 1}
bind .prompt {set prompt(ok) 0}
focus $f.entry
grab $f
tkwait variable prompt(ok)
grab release $f
destroy $f
if {$prompt(ok)} {
return $prompt(result)
} else {
return {}
}
}
###############################################################################
###############################################################################
## ##
## fileselectResources ##
## ##
## Used by functions that require a popup dialog box for traversing the ##
## directory structure and selecting a file. ##
## ##
###############################################################################
###############################################################################
proc fileselectResources {} {
# path is used to enter the file name
option add *Fileselect*path.relief sunken startup
option add *Fileselect*path.background white startup
option add *Fileselect*path.foreground black startup
# Text for the label on pathname entry
option add *Fileselect*l.text File: startup
# Text for the OK and Cancel buttons
option add *Fileselect*ok*text OK startup
option add *Fileselect*ok*underline 0 startup
option add *Fileselect*cancel.text Cancel startup
option add *Fileselect*cancel.underline 0 startup
# Size of the listbox
option add *Fileselect*list.width 20 startup
option add *Fileselect*list.height 10 startup
}
###############################################################################
###############################################################################
## ##
## fileselect ##
## ##
## Used by functions that require a popup dialog box for traversing the ##
## directory structure and selecting a file. ##
## ##
## Returns the selected pathname, or {} ##
## ##
###############################################################################
###############################################################################
proc fileselect {{why "File Selection"} {default {}} {mustExist 1} } {
global fileselect
set t [toplevel .fileselect -bd 4 -class Fileselect]
fileselectResources
message $t.msg -aspect 1000 -text $why
pack $t.msg -side top -fill x
# Create a read-only entry for the current directory
set fileselect(dirEnt) [entry $t.dir -width 15 \
-relief flat -state disabled]
pack $t.dir -side top -fill x
# Create an entry for the pathname
# The value is kept in fileselect(path)
frame $t.top
label $t.top.l -padx 0
set e [entry $t.top.path -textvariable fileselect(path)]
pack $t.top -side top -fill x
pack $t.top.l -side left
pack $t.top.path -side right -fill x -expand true
# Create a listbox to hold the directory contents
set lb [listbox $t.list \
-yscrollcommand [list $t.scroll set]]
scrollbar $t.scroll -command [list $lb yview]
# Create the OK and Cancel buttons
# The OK button has a rim to indicate it is the default
frame $t.buttons -bd 10
frame $t.buttons.ok -bd 2 -relief sunken
set ok [button $t.buttons.ok.b \
-command fileselectOK]
set can [button $t.buttons.cancel \
-command fileselectCancel]
# Pack the list, scrollbar, and button box
# in a horizontal stack below the upper widgets
pack $t.list -side left -fill both -expand true
pack $t.scroll -side left -fill y
pack $t.buttons -side left -fill both
pack $t.buttons.ok $t.buttons.cancel \
-side top -padx 10 -pady 5
pack $t.buttons.ok.b -padx 4 -pady 4
fileselectBindings $t $e $lb $ok $can
# Initialize variables and list the directory
if {[string length $default] == 0} {
set fileselect(path) {}
set dir [pwd]
} else {
set fileselect(path) [file tail $default]
set dir [file dirname $default]
}
set fileselect(dir) {}
set fileselect(done) 0
set fileselect(mustExist) $mustExist
# Wait for the listbox to be visible so
# we can provide feedback during the listing
tkwait visibility .fileselect.list
fileselectList $dir
tkwait variable fileselect(done)
destroy $t
return $fileselect(path)
}
###############################################################################
###############################################################################
## ##
## fileselectBindings ##
## ##
## t - toplevel ##
## e - name entry ##
## lb - listbox ##
## ok - OK button ##
## can - Cancel button ##
## ##
###############################################################################
###############################################################################
proc fileselectBindings { t e lb ok can } {
# Elimate the all binding tag because we
# do our own focus management
foreach w [list $e $lb $ok $can] {
bindtags $w [list $t [winfo class $w] $w]
}
# Dialog-global cancel binding
bind $t fileselectCancel
# Entry bindings
bind $e fileselectOK
bind $e fileselectComplete
# A single click, or , puts the name in the entry
# A double-click, or , selects the name
bind $lb "fileselectTake $%W ; focus $e"
bind $lb \
"fileselectClick %W %y ; focus $e"
bind $lb "fileselectTake %W ; fileselectOK"
bind $lb \
"fileselectClick %W %y ; fileselectOK"
# Focus management.
# or selects the name.
bind $e "focus $lb ; $lb select set 0"
bind $lb "focus $e"
# Button focus. Extract the underlined letter
# from the button label to use as the focus key.
foreach but [list $ok $can] {
set char [string tolower [string index \
[$but cget -text] [$but cget -underline]]]
bind $t "focus $but ; break"
}
bind $ok "focus $can"
bind $can "focus $ok"
# Set up for type in
focus $e
}
###############################################################################
###############################################################################
## ##
## fileselectList ##
## ##
## Gets the list of files to select from. ##
## ##
###############################################################################
###############################################################################
proc fileselectList { dir {files {}} } {
global fileselect
# Update the directory display
set e $fileselect(dirEnt)
$e config -state normal
$e delete 0 end
$e insert 0 $dir
$e config -state disabled
# scroll to view the tail end
$e xview moveto 1
.fileselect.list delete 0 end
set fileselect(dir) $dir
if ![file isdirectory $dir] {
.fileselect.list insert 0 "Bad Directory"
return
}
.fileselect.list insert 0 Listing...
update idletasks
.fileselect.list delete 0
if {[string length $files] == 0} {
# List the directory and add an
# entry for the parent directory
set files [glob -nocomplain $fileselect(dir)/*]
.fileselect.list insert end ../
}
# Sort the directories to the front
set dirs {}
set others {}
foreach f [lsort $files] {
if [file isdirectory $f] {
lappend dirs [file tail $f]/
} else {
lappend others [file tail $f]
}
}
foreach f [concat $dirs $others] {
.fileselect.list insert end $f
}
}
###############################################################################
###############################################################################
## ##
## fileselectOK ##
## ##
###############################################################################
###############################################################################
proc fileselectOK {} {
global fileselect
# Handle the parent directory specially
if {[regsub {^\.\./?} $fileselect(path) {} newpath] != 0} {
set fileselect(path) $newpath
set fileselect(dir) [file dirname $fileselect(dir)]
fileselectOK
return
}
set path [string trimright $fileselect(dir)/$fileselect(path) /]
if [file isdirectory $path] {
set fileselect(path) {}
fileselectList $path
return
}
if [file exists $path] {
set fileselect(path) $path
set fileselect(done) 1
return
}
# Neither a file or a directory.
# See if glob will find something
if [catch {glob $path} files] {
# No, perhaps the user typed a new
# absolute pathname
if [catch {glob $fileselect(path)} path] {
# Nothing good
if {$fileselect(mustExist)} {
# Attempt completion
fileselectComplete
} elseif [file isdirectory \
[file dirname $fileselect(path)]] {
# Allow new name
set fileselect(done) 1
}
return
} else {
# OK - try again
set fileselect(dir) [file dirname $fileselect(path)]
set fileselect(path) [file tail $fileselect(path)]
fileselectOK
return
}
} else {
# Ok - current directory is ok,
# either select the file or list them.
if {[llength [split $files]] == 1} {
set fileselect(path) $files
fileselectOK
} else {
set fileselect(dir) [file dirname [lindex $files 0]]
fileselectList $fileselect(dir) $files
}
}
}
###############################################################################
###############################################################################
## ##
## fileselectCancel ##
## ##
###############################################################################
###############################################################################
proc fileselectCancel {} {
global fileselect
set fileselect(done) 1
set fileselect(path) {}
}
###############################################################################
###############################################################################
## ##
## fileselectClick ##
## ##
## Take the item the user clicked on. ##
## ##
###############################################################################
###############################################################################
proc fileselectClick { lb y } {
global fileselect
set fileselect(path) [$lb get [$lb nearest $y]]
}
###############################################################################
###############################################################################
## ##
## fileselectTake ##
## ##
## Take the currently selected list item. ##
## ##
###############################################################################
###############################################################################
proc fileselectTake { lb } {
global fileselect
set fileselect(path) [$lb get [$lb curselection]]
}
###############################################################################
###############################################################################
## ##
## fileselectComplete ##
## ##
## Complete the file selection list. ##
## ##
###############################################################################
###############################################################################
proc fileselectComplete {} {
global fileselect
# Do file name completion
# Nuke the space that triggered this call
set fileselect(path) [string trim $fileselect(path) \t\ ]
# Figure out what directory we are looking at
# dir is the directory
# tail is the partial name
if {[string match /* $fileselect(path)]} {
set dir [file dirname $fileselect(path)]
set tail [file tail $fileselect(path)]
} elseif [string match ~* $fileselect(path)] {
if [catch {file dirname $fileselect(path)} dir] {
return ;# Bad user
}
set tail [file tail $fileselect(path)]
} else {
set path $fileselect(dir)/$fileselect(path)
set dir [file dirname $path]
set tail [file tail $path]
}
# See what files are there
set files [glob -nocomplain $dir/$tail*]
if {[llength [split $files]] == 1} {
# Matched a single file
set fileselect(dir) $dir
set fileselect(path) [file tail $files]
} else {
if {[llength [split $files]] > 1} {
# Find the longest common prefix
set l [expr [string length $tail]-1]
set miss 0
# Remember that files has absolute paths
set file1 [file tail [lindex $files 0]]
while {!$miss} {
incr l
if {$l == [string length $file1]} {
# file1 is a prefix of all others
break
}
set new [string range $file1 0 $l]
foreach f $files {
if ![string match $new* [file tail $f]] {
set miss 1
incr l -1
break
}
}
}
set fileselect(path) [string range $file1 0 $l]
}
fileselectList $dir $files
}
}
###############################################################################
###############################################################################
## ##
## Main ##
## ##
###############################################################################
###############################################################################
CreateUserInterface
tkwait window .
###############################################################################
###############################################################################
## ##
## End of antenna.tcl ##
## ##
###############################################################################
###############################################################################
antennavis-0.3.1.orig/Makefile.in 0000644 0001750 0001750 00000006063 11324333200 015423 0 ustar tomy tomy ###############################################################################
###############################################################################
## ##
## Antenna Visualization Toolkit ##
## ##
## Copyright (C) 1998 Adrian Agogino, Ken Harker ##
## Copyright (C) 2005 Joop Stakenborg ##
## ##
###############################################################################
###############################################################################
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program 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 General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## Please do not edit "makefile", as it is auto-generated
## by ./configure from makefile.in Edit makefile.in instead.
##
CFLAGS := @CFLAGS@
CPPFLAGS := @CPPFLAGS@
LIBS := @LIBS@
LDFLAGS := @LDFLAGS@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
datadir = @datadir@
mandir = @mandir@
CFLAGS += -c -Wall $(CPPFLAGS)
#
# Standard configuration method.
#
define CONFIGURE
if [ -x ./config.status ] ; then \
./config.status --recheck && ./config.status; \
else \
./configure; \
fi
endef
subdir =
files =
clean-files = TkAnt *.o
distclean-files = config.log config.status input.nec output.nec *~ Makefile
srcfiles = configure configure.in Makefile Makefile.in
default: TkAnt
HEADERS = TkAntenna.h ParseArgs.h ant.h pcard.h VisField.h togl.h
OBJS = TkAntenna.o AntennaWidget.o ParseArgs.o togl.o ant.o pcard.o \
VisField.o VisWires.o
TkAnt: TkAntenna.o AntennaWidget.o ParseArgs.o ant.o pcard.o \
VisField.o VisWires.o togl.o $(HEADERS)
$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
##
## .c files
##
.c.o:
$(CC) $(CFLAGS) $*.c
##
## make sure the build system is consistant.
##
Makefile: configure Makefile.in
$(CONFIGURE)
configure:
aclocal
autoconf
install: TkAnt
install -s TkAnt $(bindir)
install antenna.tcl $(bindir)/antennavis
mkdir -p $(mandir)/man1
install -m 0644 antennavis.1 $(mandir)/man1
install -m 0644 TkAnt.1 $(mandir)/man1
uninstall:
-rm -f $(bindir)/TkAnt
-rm -f $(bindir)/antennavis
-rm -f $(mandir)/man1/antennavis.1
-rm -f $(mandir)/man1/TkAnt.1
clean:
-rm -f $(clean-files)
distclean: clean
-rm -f $(distclean-files)
antennavis-0.3.1.orig/configure 0000755 0001750 0001750 00000536473 11324333031 015304 0 ustar tomy tomy #! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for antennavis 0.3.
#
# Report bugs to .
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
DUALCASE=1; export DUALCASE # for MKS sh
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# Work around bugs in pre-3.0 UWIN ksh.
$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
$as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)$' \| \
. : '\(.\)' 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
/^X\/\(\/\/\)$/{ s//\1/; q; }
/^X\/\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" || {
# Find who we are. Look in the path if we contain no path at all
# relative or not.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
{ echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
{ (exit 1); exit 1; }; }
fi
case $CONFIG_SHELL in
'')
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for as_base in sh bash ksh sh5; do
case $as_dir in
/*)
if ("$as_dir/$as_base" -c '
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
$as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
$as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
CONFIG_SHELL=$as_dir/$as_base
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$0" ${1+"$@"}
fi;;
esac
done
done
;;
esac
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line before each line; the second 'sed' does the real
# work. The second script uses 'N' to pair each line-number line
# with the numbered line, and appends trailing '-' during
# substitution so that $LINENO is not a special case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
sed '=' <$as_myself |
sed '
N
s,$,-,
: loop
s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
t loop
s,-$,,
s,^['$as_cr_digits']*\n,,
' >$as_me.lineno &&
chmod +x $as_me.lineno ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensible to this).
. ./$as_me.lineno
# Exit status is that of the last command.
exit
}
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
*c*,-n*) ECHO_N= ECHO_C='
' ECHO_T=' ' ;;
*c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
*) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
# We could just check for DJGPP; but this test a) works b) is more generic
# and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
if test -f conf$$.exe; then
# Don't use ln at all; we don't have any links
as_ln_s='cp -p'
else
as_ln_s='ln -s'
fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
'
IFS=" $as_nl"
# CDPATH.
$as_unset CDPATH
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
exec 6>&1
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_config_libobj_dir=.
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
# This variable seems obsolete. It should probably be removed, and
# only ac_max_sed_lines should be used.
: ${ac_max_here_lines=38}
# Identity of this package.
PACKAGE_NAME='antennavis'
PACKAGE_TARNAME='antennavis'
PACKAGE_VERSION='0.3'
PACKAGE_STRING='antennavis 0.3'
PACKAGE_BUGREPORT='pg4i@amsat.org'
ac_default_prefix=/usr/local
ac_unique_file="AntennaWidget.c"
# Factoring default headers for most tests.
ac_includes_default="\
#include
#if HAVE_SYS_TYPES_H
# include
#endif
#if HAVE_SYS_STAT_H
# include
#endif
#if STDC_HEADERS
# include
# include
#else
# if HAVE_STDLIB_H
# include
# endif
#endif
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include
# endif
# include
#endif
#if HAVE_STRINGS_H
# include
#endif
#if HAVE_INTTYPES_H
# include
#else
# if HAVE_STDINT_H
# include
# endif
#endif
#if HAVE_UNISTD_H
# include
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
ac_prev=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
datadir=$ac_optarg ;;
-disable-* | --disable-*)
ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
eval "enable_$ac_feature=no" ;;
-enable-* | --enable-*)
ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
case $ac_option in
*=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
| --locals | --local | --loca | --loc | --lo)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
case $ac_option in
*=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package | sed 's/-/_/g'`
eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) { echo "$as_me: error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; }
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid variable name: $ac_envvar" >&2
{ (exit 1); exit 1; }; }
ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
eval "$ac_envvar='$ac_optarg'"
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
{ echo "$as_me: error: missing argument to $ac_option" >&2
{ (exit 1); exit 1; }; }
fi
# Be sure to have absolute paths.
for ac_var in exec_prefix prefix
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* | NONE | '' ) ;;
*) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# Be sure to have absolute paths.
for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
localstatedir libdir includedir oldincludedir infodir mandir
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* ) ;;
*) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
ac_confdir=`(dirname "$0") 2>/dev/null ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$0" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
{ (exit 1); exit 1; }; }
else
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
{ (exit 1); exit 1; }; }
fi
fi
(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
{ echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
{ (exit 1); exit 1; }; }
srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
ac_env_build_alias_set=${build_alias+set}
ac_env_build_alias_value=$build_alias
ac_cv_env_build_alias_set=${build_alias+set}
ac_cv_env_build_alias_value=$build_alias
ac_env_host_alias_set=${host_alias+set}
ac_env_host_alias_value=$host_alias
ac_cv_env_host_alias_set=${host_alias+set}
ac_cv_env_host_alias_value=$host_alias
ac_env_target_alias_set=${target_alias+set}
ac_env_target_alias_value=$target_alias
ac_cv_env_target_alias_set=${target_alias+set}
ac_cv_env_target_alias_value=$target_alias
ac_env_CC_set=${CC+set}
ac_env_CC_value=$CC
ac_cv_env_CC_set=${CC+set}
ac_cv_env_CC_value=$CC
ac_env_CFLAGS_set=${CFLAGS+set}
ac_env_CFLAGS_value=$CFLAGS
ac_cv_env_CFLAGS_set=${CFLAGS+set}
ac_cv_env_CFLAGS_value=$CFLAGS
ac_env_LDFLAGS_set=${LDFLAGS+set}
ac_env_LDFLAGS_value=$LDFLAGS
ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
ac_cv_env_LDFLAGS_value=$LDFLAGS
ac_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_env_CPPFLAGS_value=$CPPFLAGS
ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_cv_env_CPPFLAGS_value=$CPPFLAGS
ac_env_CPP_set=${CPP+set}
ac_env_CPP_value=$CPP
ac_cv_env_CPP_set=${CPP+set}
ac_cv_env_CPP_value=$CPP
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures antennavis 0.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print \`checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
_ACEOF
cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--infodir=DIR info documentation [PREFIX/info]
--mandir=DIR man documentation [PREFIX/man]
_ACEOF
cat <<\_ACEOF
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of antennavis 0.3:";;
esac
cat <<\_ACEOF
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-tcltk=DIR Use DIR/include and DIR/lib for tcl and tk
--with-tkdir=TKDIR Use TKDIR/include and TKDIR/lib for tk if it
is in a different place from tcl directory
and is not auto-detected properly
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have
headers in a nonstandard directory
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to .
_ACEOF
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
ac_popdir=`pwd`
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d $ac_dir || continue
ac_builddir=.
if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A "../" for each directory in $ac_dir_suffix.
ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
else
ac_dir_suffix= ac_top_builddir=
fi
case $srcdir in
.) # No --srcdir option. We are building in place.
ac_srcdir=.
if test -z "$ac_top_builddir"; then
ac_top_srcdir=.
else
ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
fi ;;
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
case "$ac_dir" in
.) ac_abs_builddir=`pwd`;;
[\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
*) ac_abs_builddir=`pwd`/"$ac_dir";;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
case ${ac_top_builddir}. in
.) ac_abs_top_builddir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
*) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
case $ac_srcdir in
.) ac_abs_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
*) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
case $ac_top_srcdir in
.) ac_abs_top_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
*) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
esac;;
esac
cd $ac_dir
# Check for guested configure; otherwise get Cygnus style configure.
if test -f $ac_srcdir/configure.gnu; then
echo
$SHELL $ac_srcdir/configure.gnu --help=recursive
elif test -f $ac_srcdir/configure; then
echo
$SHELL $ac_srcdir/configure --help=recursive
elif test -f $ac_srcdir/configure.ac ||
test -f $ac_srcdir/configure.in; then
echo
$ac_configure --help
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
cd "$ac_popdir"
done
fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
antennavis configure 0.3
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit 0
fi
exec 5>config.log
cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by antennavis $as_me 0.3, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
_ACEOF
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
echo "PATH: $as_dir"
done
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_sep=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
2)
ac_configure_args1="$ac_configure_args1 '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
# Get rid of the leading space.
ac_sep=" "
;;
esac
done
done
$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Be sure not to use single quotes in there, as some shells,
# such as our DU 5.0 friend, will then `close' the trap.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
echo
cat <<\_ASBOX
## ---------------- ##
## Cache variables. ##
## ---------------- ##
_ASBOX
echo
# The following way of writing the cache mishandles newlines in values,
{
(set) 2>&1 |
case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
*ac_space=\ *)
sed -n \
"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
;;
*)
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
}
echo
cat <<\_ASBOX
## ----------------- ##
## Output variables. ##
## ----------------- ##
_ASBOX
echo
for ac_var in $ac_subst_vars
do
eval ac_val=$`echo $ac_var`
echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
if test -n "$ac_subst_files"; then
cat <<\_ASBOX
## ------------- ##
## Output files. ##
## ------------- ##
_ASBOX
echo
for ac_var in $ac_subst_files
do
eval ac_val=$`echo $ac_var`
echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
fi
if test -s confdefs.h; then
cat <<\_ASBOX
## ----------- ##
## confdefs.h. ##
## ----------- ##
_ASBOX
echo
sed "/^$/d" confdefs.h | sort
echo
fi
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core &&
rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -rf conftest* confdefs.h
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
echo >confdefs.h
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
else
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
{ echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special
# files actually), so we avoid doing that.
if test -f "$cache_file"; then
{ echo "$as_me:$LINENO: loading cache $cache_file" >&5
echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . $cache_file;;
*) . ./$cache_file;;
esac
fi
else
{ echo "$as_me:$LINENO: creating cache $cache_file" >&5
echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in `(set) 2>&1 |
sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val="\$ac_cv_env_${ac_var}_value"
eval ac_new_val="\$ac_env_${ac_var}_value"
case $ac_old_set,$ac_new_set in
set,)
{ echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
{ echo "$as_me:$LINENO: former value: $ac_old_val" >&5
echo "$as_me: former value: $ac_old_val" >&2;}
{ echo "$as_me:$LINENO: current value: $ac_new_val" >&5
echo "$as_me: current value: $ac_new_val" >&2;}
ac_cache_corrupted=:
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
{ echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
echo "$as_me: error: changes in the environment can compromise the build" >&2;}
{ { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Changes and error cleaning from Nanakos Chrysostomos
# Checks for programs.
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
CC=$ac_ct_CC
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
CC=$ac_ct_CC
else
CC="$ac_cv_prog_CC"
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$ac_ct_CC" && break
done
CC=$ac_ct_CC
fi
fi
test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&5
echo "$as_me: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
# Provide some information about the compiler.
echo "$as_me:$LINENO:" \
"checking for C compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5
(eval $ac_compiler --version &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5
(eval $ac_compiler -v &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5
(eval $ac_compiler -V &5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
(eval $ac_link_default) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
# Find the output, starting from the most likely. This scheme is
# not robust to junk in `.', hence go to wildcards (a.*) only as a last
# resort.
# Be careful to initialize this variable, since it used to be cached.
# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
ac_cv_exeext=
# b.out is created by i960 compilers.
for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
;;
conftest.$ac_ext )
# This is the source file.
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
# FIXME: I believe we export ac_cv_exeext for Libtool,
# but it would be cool to find out if it's true. Does anybody
# maintain Libtool? --akim.
export ac_cv_exeext
break;;
* )
break;;
esac
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
See \`config.log' for more details." >&5
echo "$as_me: error: C compiler cannot create executables
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }
fi
ac_exeext=$ac_cv_exeext
echo "$as_me:$LINENO: result: $ac_file" >&5
echo "${ECHO_T}$ac_file" >&6
# Check the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
echo "$as_me:$LINENO: checking whether the C compiler works" >&5
echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
# If not cross compiling, check that we can run a simple program.
if test "$cross_compiling" != yes; then
if { ac_try='./$ac_file'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cross_compiling=no
else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details." >&5
echo "$as_me: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
fi
fi
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
rm -f a.out a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
# Check the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $cross_compiling" >&5
echo "${ECHO_T}$cross_compiling" >&6
echo "$as_me:$LINENO: checking for suffix of executables" >&5
echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
export ac_cv_exeext
break;;
* ) break;;
esac
done
else
{ { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest$ac_cv_exeext
echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
echo "${ECHO_T}$ac_cv_exeext" >&6
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
echo "$as_me:$LINENO: checking for suffix of object files" >&5
echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
if test "${ac_cv_objext+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute suffix of object files: cannot compile
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
echo "${ECHO_T}$ac_cv_objext" >&6
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_compiler_gnu=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_compiler_gnu=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
CFLAGS="-g"
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_prog_cc_g=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
if test "${ac_cv_prog_cc_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include
#include
#include
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std1 is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std1. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
# Don't try gcc -ansi; that turns off useful extensions and
# breaks some systems' header files.
# AIX -qlanglvl=ansi
# Ultrix and OSF/1 -std1
# HP-UX 10.20 and later -Ae
# HP-UX older versions -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_stdc=$ac_arg
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext
done
rm -f conftest.$ac_ext conftest.$ac_objext
CC=$ac_save_CC
fi
case "x$ac_cv_prog_cc_stdc" in
x|xno)
echo "$as_me:$LINENO: result: none needed" >&5
echo "${ECHO_T}none needed" >&6 ;;
*)
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
CC="$CC $ac_cv_prog_cc_stdc" ;;
esac
# Some people use a C++ compiler to compile C. Since we use `exit',
# in C++ we need to declare it. In case someone uses the same compiler
# for both compiling C and C++ we need to have the C++ compiler decide
# the declaration of exit, since it's the most demanding environment.
cat >conftest.$ac_ext <<_ACEOF
#ifndef __cplusplus
choke me
#endif
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
for ac_declaration in \
'' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \
'void exit (int);'
do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_declaration
#include
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
continue
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_declaration
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
rm -f conftest*
if test -n "$ac_declaration"; then
echo '#ifdef __cplusplus' >>confdefs.h
echo $ac_declaration >>confdefs.h
echo '#endif' >>confdefs.h
fi
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib"
# Checks for libraries.
echo "$as_me:$LINENO: checking for gluCylinder in -lGLU" >&5
echo $ECHO_N "checking for gluCylinder in -lGLU... $ECHO_C" >&6
if test "${ac_cv_lib_GLU_gluCylinder+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lGLU $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char gluCylinder ();
int
main ()
{
gluCylinder ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_GLU_gluCylinder=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_GLU_gluCylinder=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_GLU_gluCylinder" >&5
echo "${ECHO_T}$ac_cv_lib_GLU_gluCylinder" >&6
if test $ac_cv_lib_GLU_gluCylinder = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBGLU 1
_ACEOF
LIBS="-lGLU $LIBS"
else
{ { echo "$as_me:$LINENO: error: libGLU is required to compile antennavis. Please install it and proceed." >&5
echo "$as_me: error: libGLU is required to compule antennavis. Please install it and proceed.">&2;}
{ (exit 1); exit 1; }; }
fi
echo "$as_me:$LINENO: checking for XmuLookupStandardColormap in -lXmu" >&5
echo $ECHO_N "checking for XmuLookupStandardColormap in -lXmu... $ECHO_C" >&6
if test "${ac_cv_lib_Xmu_XmuLookupStandardColormap+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lXmu $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char XmuLookupStandardColormap ();
int
main ()
{
XmuLookupStandardColormap ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_Xmu_XmuLookupStandardColormap=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_Xmu_XmuLookupStandardColormap=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_Xmu_XmuLookupStandardColormap" >&5
echo "${ECHO_T}$ac_cv_lib_Xmu_XmuLookupStandardColormap" >&6
if test $ac_cv_lib_Xmu_XmuLookupStandardColormap = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBXMU 1
_ACEOF
LIBS="-lXmu $LIBS"
else
{ { echo "$as_me:$LINENO: error: libXmu is required to compile antennavis. Please intall it and proceed." >&5
echo "$as_me: error: libXmu is required to compule antennavis. Please install it and proceed." >&2;}
{ (exit 1); exit 1; }; }
fi
# Checks for header files.
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
if test "${ac_cv_prog_CPP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
do
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
break
fi
done
ac_cv_prog_CPP=$CPP
fi
CPP=$ac_cv_prog_CPP
else
ac_cv_prog_CPP=$CPP
fi
echo "$as_me:$LINENO: result: $CPP" >&5
echo "${ECHO_T}$CPP" >&6
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
:
else
{ { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&5
echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
echo "$as_me:$LINENO: checking for egrep" >&5
echo $ECHO_N "checking for egrep... $ECHO_C" >&6
if test "${ac_cv_prog_egrep+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if echo a | (grep -E '(a|b)') >/dev/null 2>&1
then ac_cv_prog_egrep='grep -E'
else ac_cv_prog_egrep='egrep'
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
echo "${ECHO_T}$ac_cv_prog_egrep" >&6
EGREP=$ac_cv_prog_egrep
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include
#include
#include
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_header_stdc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_header_stdc=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then
:
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then
:
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then
:
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
exit(2);
exit (0);
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
echo "${ECHO_T}$ac_cv_header_stdc" >&6
if test $ac_cv_header_stdc = yes; then
cat >>confdefs.h <<\_ACEOF
#define STDC_HEADERS 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6
if test "${ac_cv_header_sys_wait_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif
int
main ()
{
int s;
wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_header_sys_wait_h=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_header_sys_wait_h=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
if test $ac_cv_header_sys_wait_h = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_SYS_WAIT_H 1
_ACEOF
fi
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_Header=no"
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_header in stddef.h stdlib.h string.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ----------------------------- ##
## Report this to pg4i@amsat.org ##
## ----------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
# Check for tcl/tk
# Check whether --with-tcltk or --without-tcltk was given.
if test "${with_tcltk+set}" = set; then
withval="$with_tcltk"
fi;
if test -n "$tcltk" -a "$tcltk" != "no" ; then
CPPFLAGS="-I$tcltk/include $CPPFLAGS"
LDFLAGS"$LDFLAGS -L$tcltk/lib"
fi
# Check whether --with-tkdir or --without-tkdir was given.
if test "${with_tkdir+set}" = set; then
withval="$with_tkdir"
fi;
if test -n "$tkdir" -a "$tkdir" != "no" ; then
CPPFLAGS="-I$tkdir/include $CPPFLAGS"
LDFLAGS"$LDFLAGS -L$tkdir/lib"
fi
if test "x$with_tcltk" != "xno" ; then
echo "$as_me:$LINENO: checking for library containing Tcl_Init" >&5
echo $ECHO_N "checking for library containing Tcl_Init... $ECHO_C" >&6
if test "${ac_cv_search_Tcl_Init+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_func_search_save_LIBS=$LIBS
ac_cv_search_Tcl_Init=no
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char Tcl_Init ();
int
main ()
{
Tcl_Init ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_search_Tcl_Init="none required"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test "$ac_cv_search_Tcl_Init" = no; then
for ac_lib in tcl84 tcl8.4 tcl83 tcl8.3 tcl8.0; do
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char Tcl_Init ();
int
main ()
{
Tcl_Init ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_search_Tcl_Init="-l$ac_lib"
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
done
fi
LIBS=$ac_func_search_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_search_Tcl_Init" >&5
echo "${ECHO_T}$ac_cv_search_Tcl_Init" >&6
if test "$ac_cv_search_Tcl_Init" != no; then
test "$ac_cv_search_Tcl_Init" = "none required" || LIBS="$ac_cv_search_Tcl_Init $LIBS"
echo "$as_me:$LINENO: checking for library containing Tk_Init" >&5
echo $ECHO_N "checking for library containing Tk_Init... $ECHO_C" >&6
if test "${ac_cv_search_Tk_Init+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_func_search_save_LIBS=$LIBS
ac_cv_search_Tk_Init=no
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char Tk_Init ();
int
main ()
{
Tk_Init ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_search_Tk_Init="none required"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test "$ac_cv_search_Tk_Init" = no; then
for ac_lib in tk84 tk8.4 tk83 tk8.3 tk8.0; do
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char Tk_Init ();
int
main ()
{
Tk_Init ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_search_Tk_Init="-l$ac_lib"
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
done
fi
LIBS=$ac_func_search_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_search_Tk_Init" >&5
echo "${ECHO_T}$ac_cv_search_Tk_Init" >&6
if test "$ac_cv_search_Tk_Init" != no; then
test "$ac_cv_search_Tk_Init" = "none required" || LIBS="$ac_cv_search_Tk_Init $LIBS"
for search_header in /usr/include/tcl8.4/tcl.h /usr/include/tcl8.3/tcl.h /usr/include/tcl8.0/tcl.h /usr/include/tcl.h
do
as_ac_Header=`echo "ac_cv_header_$search_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $search_header" >&5
echo $ECHO_N "checking for $search_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $search_header usability" >&5
echo $ECHO_N "checking $search_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$search_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $search_header presence" >&5
echo $ECHO_N "checking $search_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$search_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $search_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $search_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $search_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $search_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $search_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $search_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $search_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $search_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $search_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $search_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ----------------------------------- ##
## Report this to nanakos@wired-net.gr ##
## ----------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $search_header" >&5
echo $ECHO_N "checking for $search_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
BASE_TCL_DIR=`(dirname $search_header) 2>/dev/null ||
$as_expr X$search_header : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X$search_header : 'X\(//\)[^/]' \| \
X$search_header : 'X\(//\)$' \| \
X$search_header : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X$search_header |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
if test "$BASE_TCL_DIR" != "/usr/include"; then
CPPFLAGS="-I$BASE_TCL_DIR $CPPFLAGS"
fi
break
fi
done
for search_header in "$BASE_TCL_DIR/tk.h" /usr/include/tk8.4/tk.h /usr/include/tk8.3/tk.h /usr/include/tk8.0/tk.h /usr/include/tk.h
do
as_ac_Header=`echo "ac_cv_header_$search_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $search_header" >&5
echo $ECHO_N "checking for $search_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $search_header usability" >&5
echo $ECHO_N "checking $search_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$search_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $search_header presence" >&5
echo $ECHO_N "checking $search_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$search_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $search_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $search_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $search_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $search_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $search_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $search_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $search_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $search_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $search_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $search_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $search_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ----------------------------------- ##
## Report this to nanakos@wired-net.gr ##
## ----------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $search_header" >&5
echo $ECHO_N "checking for $search_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
BASE_TK_DIR=`(dirname $search_header) 2>/dev/null ||
$as_expr X$search_header : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X$search_header : 'X\(//\)[^/]' \| \
X$search_header : 'X\(//\)$' \| \
X$search_header : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X$search_header |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
if test "$BASE_TK_DIR" != "/usr/include"; then
CPPFLAGS="-I$BASE_TK_DIR $CPPFLAGS"
fi
break
fi
done
fi
fi
fi
# Checks for typedefs, structures, and compiler characteristics.
echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6
if test "${ac_cv_header_stdbool_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#ifndef bool
# error bool is not defined
#endif
#ifndef false
# error false is not defined
#endif
#if false
# error false is not 0
#endif
#ifndef true
# error true is not defined
#endif
#if true != 1
# error true is not 1
#endif
#ifndef __bool_true_false_are_defined
# error __bool_true_false_are_defined is not defined
#endif
struct s { _Bool s: 1; _Bool t; } s;
char a[true == 1 ? 1 : -1];
char b[false == 0 ? 1 : -1];
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
char d[(bool) -0.5 == true ? 1 : -1];
bool e = &s;
char f[(_Bool) -0.0 == false ? 1 : -1];
char g[true];
char h[sizeof (_Bool)];
char i[sizeof s.t];
int
main ()
{
return !a + !b + !c + !d + !e + !f + !g + !h + !i;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_header_stdbool_h=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_header_stdbool_h=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6
echo "$as_me:$LINENO: checking for _Bool" >&5
echo $ECHO_N "checking for _Bool... $ECHO_C" >&6
if test "${ac_cv_type__Bool+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
if ((_Bool *) 0)
return 0;
if (sizeof (_Bool))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type__Bool=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type__Bool=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
echo "${ECHO_T}$ac_cv_type__Bool" >&6
if test $ac_cv_type__Bool = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BOOL 1
_ACEOF
fi
if test $ac_cv_header_stdbool_h = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_STDBOOL_H 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
if test "${ac_cv_c_const+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
/* FIXME: Include the comments suggested by Paul. */
#ifndef __cplusplus
/* Ultrix mips cc rejects this. */
typedef int charset[2];
const charset x;
/* SunOS 4.1.1 cc rejects this. */
char const *const *ccp;
char **p;
/* NEC SVR4.0.2 mips cc rejects this. */
struct point {int x, y;};
static struct point const zero = {0,0};
/* AIX XL C 1.02.0.0 rejects this.
It does not let you subtract one const X* pointer from another in
an arm of an if-expression whose if-part is not a constant
expression */
const char *g = "string";
ccp = &g + (g ? g-g : 0);
/* HPUX 7.0 cc rejects these. */
++ccp;
p = (char**) ccp;
ccp = (char const *const *) p;
{ /* SCO 3.2v4 cc rejects this. */
char *t;
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
}
{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
int x[] = {25, 17};
const int *foo = &x[0];
++foo;
}
{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
typedef const int *iptr;
iptr p = 0;
++p;
}
{ /* AIX XL C 1.02.0.0 rejects this saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
struct s { int j; const int *ap[3]; };
struct s *b; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
}
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_c_const=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_c_const=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
echo "${ECHO_T}$ac_cv_c_const" >&6
if test $ac_cv_c_const = no; then
cat >>confdefs.h <<\_ACEOF
#define const
_ACEOF
fi
echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6
if test "${ac_cv_struct_tm+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include
#include
int
main ()
{
struct tm *tp; tp->tm_sec;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_struct_tm=time.h
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_struct_tm=sys/time.h
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
echo "${ECHO_T}$ac_cv_struct_tm" >&6
if test $ac_cv_struct_tm = sys/time.h; then
cat >>confdefs.h <<\_ACEOF
#define TM_IN_SYS_TIME 1
_ACEOF
fi
# Checks for library functions.
echo "$as_me:$LINENO: checking for pid_t" >&5
echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
if test "${ac_cv_type_pid_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
if ((pid_t *) 0)
return 0;
if (sizeof (pid_t))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_pid_t=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_pid_t=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
echo "${ECHO_T}$ac_cv_type_pid_t" >&6
if test $ac_cv_type_pid_t = yes; then
:
else
cat >>confdefs.h <<_ACEOF
#define pid_t int
_ACEOF
fi
for ac_header in unistd.h vfork.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ----------------------------- ##
## Report this to pg4i@amsat.org ##
## ----------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_func in fork vfork
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case declares $ac_func.
For example, HP-UX 11i declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer to if __STDC__ is defined, since
exists even on freestanding compilers. */
#ifdef __STDC__
# include
#else
# include
#endif
#undef $ac_func
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
char (*f) () = $ac_func;
#endif
#ifdef __cplusplus
}
#endif
int
main ()
{
return f != $ac_func;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
if test "x$ac_cv_func_fork" = xyes; then
echo "$as_me:$LINENO: checking for working fork" >&5
echo $ECHO_N "checking for working fork... $ECHO_C" >&6
if test "${ac_cv_func_fork_works+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_func_fork_works=cross
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
/* By Ruediger Kuhlmann. */
if (fork() < 0)
exit (1);
exit (0);
;
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_func_fork_works=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_func_fork_works=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
echo "${ECHO_T}$ac_cv_func_fork_works" >&6
else
ac_cv_func_fork_works=$ac_cv_func_fork
fi
if test "x$ac_cv_func_fork_works" = xcross; then
case $host in
*-*-amigaos* | *-*-msdosdjgpp*)
# Override, as these systems have only a dummy fork() stub
ac_cv_func_fork_works=no
;;
*)
ac_cv_func_fork_works=yes
;;
esac
{ echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
fi
ac_cv_func_vfork_works=$ac_cv_func_vfork
if test "x$ac_cv_func_vfork" = xyes; then
echo "$as_me:$LINENO: checking for working vfork" >&5
echo $ECHO_N "checking for working vfork... $ECHO_C" >&6
if test "${ac_cv_func_vfork_works+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_func_vfork_works=cross
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Thanks to Paul Eggert for this test. */
#include
#include
#include
#include
#include
#if HAVE_UNISTD_H
# include
#endif
#if HAVE_VFORK_H
# include
#endif
/* On some sparc systems, changes by the child to local and incoming
argument registers are propagated back to the parent. The compiler
is told about this with #include , but some compilers
(e.g. gcc -O) don't grok . Test for this by using a
static variable whose address is put into a register that is
clobbered by the vfork. */
static void
#ifdef __cplusplus
sparc_address_test (int arg)
# else
sparc_address_test (arg) int arg;
#endif
{
static pid_t child;
if (!child) {
child = vfork ();
if (child < 0) {
perror ("vfork");
_exit(2);
}
if (!child) {
arg = getpid();
write(-1, "", 0);
_exit (arg);
}
}
}
int
main ()
{
pid_t parent = getpid ();
pid_t child;
sparc_address_test (0);
child = vfork ();
if (child == 0) {
/* Here is another test for sparc vfork register problems. This
test uses lots of local variables, at least as many local
variables as main has allocated so far including compiler
temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
reuse the register of parent for one of the local variables,
since it will think that parent can't possibly be used any more
in this routine. Assigning to the local variable will thus
munge parent in the parent process. */
pid_t
p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
/* Convince the compiler that p..p7 are live; otherwise, it might
use the same hardware register for all 8 local variables. */
if (p != p1 || p != p2 || p != p3 || p != p4
|| p != p5 || p != p6 || p != p7)
_exit(1);
/* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
from child file descriptors. If the child closes a descriptor
before it execs or exits, this munges the parent's descriptor
as well. Test for this by closing stdout in the child. */
_exit(close(fileno(stdout)) != 0);
} else {
int status;
struct stat st;
while (wait(&status) != child)
;
exit(
/* Was there some problem with vforking? */
child < 0
/* Did the child fail? (This shouldn't happen.) */
|| status
/* Did the vfork/compiler bug occur? */
|| parent != getpid()
/* Did the file descriptor bug occur? */
|| fstat(fileno(stdout), &st) != 0
);
}
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_func_vfork_works=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_func_vfork_works=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
echo "${ECHO_T}$ac_cv_func_vfork_works" >&6
fi;
if test "x$ac_cv_func_fork_works" = xcross; then
ac_cv_func_vfork_works=$ac_cv_func_vfork
{ echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
fi
if test "x$ac_cv_func_vfork_works" = xyes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_WORKING_VFORK 1
_ACEOF
else
cat >>confdefs.h <<\_ACEOF
#define vfork fork
_ACEOF
fi
if test "x$ac_cv_func_fork_works" = xyes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_WORKING_FORK 1
_ACEOF
fi
for ac_header in stdlib.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ----------------------------- ##
## Report this to pg4i@amsat.org ##
## ----------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6
if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_func_malloc_0_nonnull=no
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#if STDC_HEADERS || HAVE_STDLIB_H
# include
#else
char *malloc ();
#endif
int
main ()
{
exit (malloc (0) ? 0 : 1);
;
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_func_malloc_0_nonnull=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_func_malloc_0_nonnull=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6
if test $ac_cv_func_malloc_0_nonnull = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_MALLOC 1
_ACEOF
else
cat >>confdefs.h <<\_ACEOF
#define HAVE_MALLOC 0
_ACEOF
case $LIBOBJS in
"malloc.$ac_objext" | \
*" malloc.$ac_objext" | \
"malloc.$ac_objext "* | \
*" malloc.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;;
esac
cat >>confdefs.h <<\_ACEOF
#define malloc rpl_malloc
_ACEOF
fi
for ac_header in stdlib.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ----------------------------- ##
## Report this to pg4i@amsat.org ##
## ----------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5
echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6
if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_func_realloc_0_nonnull=no
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#if STDC_HEADERS || HAVE_STDLIB_H
# include
#else
char *realloc ();
#endif
int
main ()
{
exit (realloc (0, 0) ? 0 : 1);
;
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_func_realloc_0_nonnull=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_func_realloc_0_nonnull=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5
echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6
if test $ac_cv_func_realloc_0_nonnull = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_REALLOC 1
_ACEOF
else
cat >>confdefs.h <<\_ACEOF
#define HAVE_REALLOC 0
_ACEOF
case $LIBOBJS in
"realloc.$ac_objext" | \
*" realloc.$ac_objext" | \
"realloc.$ac_objext "* | \
*" realloc.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;;
esac
cat >>confdefs.h <<\_ACEOF
#define realloc rpl_realloc
_ACEOF
fi
for ac_func in sqrt strdup strstr
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case declares $ac_func.
For example, HP-UX 11i declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer to if __STDC__ is defined, since
exists even on freestanding compilers. */
#ifdef __STDC__
# include
#else
# include
#endif
#undef $ac_func
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
char (*f) () = $ac_func;
#endif
#ifdef __cplusplus
}
#endif
int
main ()
{
return f != $ac_func;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
{
(set) 2>&1 |
case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
} |
sed '
t clear
: clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
/^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
: end' >>confcache
if diff $cache_file confcache >/dev/null 2>&1; then :; else
if test -w $cache_file; then
test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
cat confcache >$cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# VPATH may cause trouble with some makes, so we remove $(srcdir),
# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=/{
s/:*\$(srcdir):*/:/;
s/:*\${srcdir}:*/:/;
s/:*@srcdir@:*/:/;
s/^\([^=]*=[ ]*\):*/\1/;
s/:*$//;
s/^[^=]*=[ ]*$//;
}'
fi
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
#
# If the first sed substitution is executed (which looks for macros that
# take arguments), then we branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
cat >confdef2opt.sed <<\_ACEOF
t clear
: clear
s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
t quote
s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
t quote
d
: quote
s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
s,\[,\\&,g
s,\],\\&,g
s,\$,$$,g
p
_ACEOF
# We use echo to avoid assuming a particular line-breaking character.
# The extra dot is to prevent the shell from consuming trailing
# line-breaks from the sub-command output. A line-break within
# single-quotes doesn't work because, if this script is created in a
# platform that uses two characters for line-breaks (e.g., DOS), tr
# would break.
ac_LF_and_DOT=`echo; echo .`
DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
rm -f confdef2opt.sed
ac_libobjs=
ac_ltlibobjs=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_i=`echo "$ac_i" |
sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
# 2. Add them.
ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
echo "$as_me: creating $CONFIG_STATUS" >&6;}
cat >$CONFIG_STATUS <<_ACEOF
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
DUALCASE=1; export DUALCASE # for MKS sh
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# Work around bugs in pre-3.0 UWIN ksh.
$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
$as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)$' \| \
. : '\(.\)' 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
/^X\/\(\/\/\)$/{ s//\1/; q; }
/^X\/\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" || {
# Find who we are. Look in the path if we contain no path at all
# relative or not.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
{ { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
{ (exit 1); exit 1; }; }
fi
case $CONFIG_SHELL in
'')
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for as_base in sh bash ksh sh5; do
case $as_dir in
/*)
if ("$as_dir/$as_base" -c '
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
$as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
$as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
CONFIG_SHELL=$as_dir/$as_base
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$0" ${1+"$@"}
fi;;
esac
done
done
;;
esac
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line before each line; the second 'sed' does the real
# work. The second script uses 'N' to pair each line-number line
# with the numbered line, and appends trailing '-' during
# substitution so that $LINENO is not a special case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
sed '=' <$as_myself |
sed '
N
s,$,-,
: loop
s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
t loop
s,-$,,
s,^['$as_cr_digits']*\n,,
' >$as_me.lineno &&
chmod +x $as_me.lineno ||
{ { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensible to this).
. ./$as_me.lineno
# Exit status is that of the last command.
exit
}
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
*c*,-n*) ECHO_N= ECHO_C='
' ECHO_T=' ' ;;
*c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
*) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
# We could just check for DJGPP; but this test a) works b) is more generic
# and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
if test -f conf$$.exe; then
# Don't use ln at all; we don't have any links
as_ln_s='cp -p'
else
as_ln_s='ln -s'
fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
'
IFS=" $as_nl"
# CDPATH.
$as_unset CDPATH
exec 6>&1
# Open the log real soon, to keep \$[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. Logging --version etc. is OK.
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by antennavis $as_me 0.3, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
_CSEOF
echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
echo >&5
_ACEOF
# Files that config.status was made for.
if test -n "$ac_config_files"; then
echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
fi
if test -n "$ac_config_headers"; then
echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
fi
if test -n "$ac_config_links"; then
echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
fi
if test -n "$ac_config_commands"; then
echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
fi
cat >>$CONFIG_STATUS <<\_ACEOF
ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.
Usage: $0 [OPTIONS] [FILE]...
-h, --help print this help, then exit
-V, --version print version number, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
Configuration files:
$config_files
Report bugs to ."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
antennavis config.status 0.3
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
Copyright (C) 2003 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
srcdir=$srcdir
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# If no file are specified by the user, then we need to provide default
# value. By we need to know if files were specified by the user.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=*)
ac_option=`expr "x$1" : 'x\([^=]*\)='`
ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
ac_shift=:
;;
-*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
*) # This is not an option, so the user has probably given explicit
# arguments.
ac_option=$1
ac_need_defaults=false;;
esac
case $ac_option in
# Handling of the options.
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --vers* | -V )
echo "$ac_cs_version"; exit 0 ;;
--he | --h)
# Conflict between --help and --header
{ { echo "$as_me:$LINENO: error: ambiguous option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: ambiguous option: $1
Try \`$0 --help' for more information." >&2;}
{ (exit 1); exit 1; }; };;
--help | --hel | -h )
echo "$ac_cs_usage"; exit 0 ;;
--debug | --d* | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
CONFIG_FILES="$CONFIG_FILES $ac_optarg"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
ac_need_defaults=false;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: unrecognized option: $1
Try \`$0 --help' for more information." >&2;}
{ (exit 1); exit 1; }; } ;;
*) ac_config_targets="$ac_config_targets $1" ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
if \$ac_cs_recheck; then
echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
for ac_config_target in $ac_config_targets
do
case "$ac_config_target" in
# Handling of arguments.
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason to put it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Create a temporary directory, and hook for its removal unless debugging.
$debug ||
{
trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
trap '{ (exit 1); exit 1; }' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
tmp=./confstat$$-$RANDOM
(umask 077 && mkdir $tmp)
} ||
{
echo "$me: cannot create a temporary directory in ." >&2
{ (exit 1); exit 1; }
}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
#
# CONFIG_FILES section.
#
# No need to generate the scripts if there are no CONFIG_FILES.
# This happens for instance when ./config.status config.h
if test -n "\$CONFIG_FILES"; then
# Protect against being on the right side of a sed subst in config.status.
sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
s,@SHELL@,$SHELL,;t t
s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
s,@exec_prefix@,$exec_prefix,;t t
s,@prefix@,$prefix,;t t
s,@program_transform_name@,$program_transform_name,;t t
s,@bindir@,$bindir,;t t
s,@sbindir@,$sbindir,;t t
s,@libexecdir@,$libexecdir,;t t
s,@datadir@,$datadir,;t t
s,@sysconfdir@,$sysconfdir,;t t
s,@sharedstatedir@,$sharedstatedir,;t t
s,@localstatedir@,$localstatedir,;t t
s,@libdir@,$libdir,;t t
s,@includedir@,$includedir,;t t
s,@oldincludedir@,$oldincludedir,;t t
s,@infodir@,$infodir,;t t
s,@mandir@,$mandir,;t t
s,@build_alias@,$build_alias,;t t
s,@host_alias@,$host_alias,;t t
s,@target_alias@,$target_alias,;t t
s,@DEFS@,$DEFS,;t t
s,@ECHO_C@,$ECHO_C,;t t
s,@ECHO_N@,$ECHO_N,;t t
s,@ECHO_T@,$ECHO_T,;t t
s,@LIBS@,$LIBS,;t t
s,@CC@,$CC,;t t
s,@CFLAGS@,$CFLAGS,;t t
s,@LDFLAGS@,$LDFLAGS,;t t
s,@CPPFLAGS@,$CPPFLAGS,;t t
s,@ac_ct_CC@,$ac_ct_CC,;t t
s,@EXEEXT@,$EXEEXT,;t t
s,@OBJEXT@,$OBJEXT,;t t
s,@CPP@,$CPP,;t t
s,@EGREP@,$EGREP,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
ac_max_sed_lines=48
ac_sed_frag=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_lines # Line after last line for current file.
ac_more_lines=:
ac_sed_cmds=
while $ac_more_lines; do
if test $ac_beg -gt 1; then
sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
else
sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
fi
if test ! -s $tmp/subs.frag; then
ac_more_lines=false
else
# The purpose of the label and of the branching condition is to
# speed up the sed processing (if there are no `@' at all, there
# is no need to browse any of the substitutions).
# These are the two extra sed commands mentioned above.
(echo ':t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
if test -z "$ac_sed_cmds"; then
ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
else
ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
fi
ac_sed_frag=`expr $ac_sed_frag + 1`
ac_beg=$ac_end
ac_end=`expr $ac_end + $ac_max_sed_lines`
fi
done
if test -z "$ac_sed_cmds"; then
ac_sed_cmds=cat
fi
fi # test -n "$CONFIG_FILES"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case $ac_file in
- | *:- | *:-:* ) # input from stdin
cat >$tmp/stdin
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
* ) ac_file_in=$ac_file.in ;;
esac
# Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
as_dir="$ac_dir"
as_dirs=
while test ! -d "$as_dir"; do
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
ac_builddir=.
if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A "../" for each directory in $ac_dir_suffix.
ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
else
ac_dir_suffix= ac_top_builddir=
fi
case $srcdir in
.) # No --srcdir option. We are building in place.
ac_srcdir=.
if test -z "$ac_top_builddir"; then
ac_top_srcdir=.
else
ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
fi ;;
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
case "$ac_dir" in
.) ac_abs_builddir=`pwd`;;
[\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
*) ac_abs_builddir=`pwd`/"$ac_dir";;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
case ${ac_top_builddir}. in
.) ac_abs_top_builddir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
*) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
case $ac_srcdir in
.) ac_abs_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
*) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
case $ac_top_srcdir in
.) ac_abs_top_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
*) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
esac;;
esac
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
if test x"$ac_file" = x-; then
configure_input=
else
configure_input="$ac_file. "
fi
configure_input=$configure_input"Generated from `echo $ac_file_in |
sed 's,.*/,,'` by configure."
# First look for the input files in the build tree, otherwise in the
# src tree.
ac_file_inputs=`IFS=:
for f in $ac_file_in; do
case $f in
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo "$f";;
*) # Relative
if test -f "$f"; then
# Build tree
echo "$f"
elif test -f "$srcdir/$f"; then
# Source tree
echo "$srcdir/$f"
else
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
esac
done` || { (exit 1); exit 1; }
if test x"$ac_file" != x-; then
{ echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
rm -f "$ac_file"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s,@configure_input@,$configure_input,;t t
s,@srcdir@,$ac_srcdir,;t t
s,@abs_srcdir@,$ac_abs_srcdir,;t t
s,@top_srcdir@,$ac_top_srcdir,;t t
s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
s,@builddir@,$ac_builddir,;t t
s,@abs_builddir@,$ac_abs_builddir,;t t
s,@top_builddir@,$ac_top_builddir,;t t
s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
rm -f $tmp/stdin
if test x"$ac_file" != x-; then
mv $tmp/out $ac_file
else
cat $tmp/out
rm -f $tmp/out
fi
done
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
{ (exit 0); exit 0; }
_ACEOF
chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded. So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status. When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
ac_config_status_args=
test "$silent" = yes &&
ac_config_status_args="$ac_config_status_args --quiet"
exec 5>/dev/null
$SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
$ac_cs_success || { (exit 1); exit 1; }
fi
antennavis-0.3.1.orig/togl_ws.h 0000644 0001750 0001750 00000000164 10401332551 015204 0 ustar tomy tomy #ifndef TOGL_WS_H
# define TOGL_WS_H
/* define windowing system togl is compiled with */
# define TOGL_X11
#endif
antennavis-0.3.1.orig/togl.c 0000644 0001750 0001750 00000357111 10401332713 014475 0 ustar tomy tomy /* $Id: togl.c,v 1.2 2006/03/01 14:55:07 pa4tu Exp $ */
/* vi:set sw=4: */
/*
* Togl - a Tk OpenGL widget
*
* Copyright (C) 1996-2002 Brian Paul and Ben Bederson
* See the LICENSE file for copyright details.
*/
/*
* Currently we support X11, Win32 and Macintosh only
*/
#include "togl.h"
/* Use TCL_STUPID to cast (const char *) to (char *) where the Tcl function
* prototype argument should really be const */
#define TCL_STUPID (char *)
/* Use WIDGREC to cast widgRec arguments */
#define WIDGREC (char *)
/*** Windows headers ***/
#if defined(TOGL_WGL)
# define WIN32_LEAN_AND_MEAN
# include
# undef WIN32_LEAN_AND_MEAN
# include
/*** X Window System headers ***/
#elif defined(TOGL_X11)
# include
# include
# include /* for XA_RGB_DEFAULT_MAP atom */
# if defined(__vms)
# include /* for XmuLookupStandardColormap */
# else
# include /* for XmuLookupStandardColormap */
# endif
# include
/*** Mac headers ***/
#elif defined(TOGL_AGL_CLASSIC)
# include
# include
# include
# include
#elif defined(TOGL_AGL)
# define Cursor QDCursor
# include
# undef Cursor
# include "tkMacOSX.h"
# include /* usa MacDrawable */
# include
#else /* make sure only one platform defined */
# error Unsupported platform, or confused platform defines...
#endif
/*** Standard C headers ***/
#include
#include
#include
#ifdef TOGL_WGL
# include
#endif
#if TK_MAJOR_VERSION < 8
# error Sorry Togl requires Tcl/Tk ver 8.0 or higher.
#endif
#if defined(TOGL_AGL_CLASSIC)
# if TK_MAJOR_VERSION < 8 || (TK_MAJOR_VERSION == 8 && TK_MINOR_VERSION < 3)
# error Sorry Mac classic version requires Tcl/Tk ver 8.3.0 or higher.
# endif
#endif /* TOGL_AGL_CLASSIC */
#if defined(TOGL_AGL)
# if TK_MAJOR_VERSION < 8 || (TK_MAJOR_VERSION == 8 && TK_MINOR_VERSION < 4)
# error Sorry Mac Aqua version requires Tcl/Tk ver 8.4.0 or higher.
# endif
#endif /* TOGL_AGL */
/* workaround for bug #123153 in tcl ver8.4a2 (tcl.h) */
#if defined(Tcl_InitHashTable) && defined(USE_TCL_STUBS)
# undef Tcl_InitHashTable
# define Tcl_InitHashTable (tclStubsPtr->tcl_InitHashTable)
#endif
#if TK_MAJOR_VERSION > 8 || (TK_MAJOR_VERSION == 8 && TK_MINOR_VERSION >= 4)
# define HAVE_TK_SETCLASSPROCS
/* pointer to Tk_SetClassProcs function in the stub table */
static void (*SetClassProcsPtr)
_ANSI_ARGS_((Tk_Window, Tk_ClassProcs *, ClientData));
#endif
/*
* Copy of TkClassProcs declarations form tkInt.h
* (this is needed for Tcl ver =< 8.4a3)
*/
typedef Window (TkClassCreateProc) _ANSI_ARGS_((Tk_Window tkwin,
Window parent, ClientData instanceData));
typedef void (TkClassGeometryProc) _ANSI_ARGS_((ClientData instanceData));
typedef void (TkClassModalProc) _ANSI_ARGS_((Tk_Window tkwin,
XEvent *eventPtr));
typedef struct TkClassProcs
{
TkClassCreateProc *createProc;
TkClassGeometryProc *geometryProc;
TkClassModalProc *modalProc;
} TkClassProcs;
/* Defaults */
#define DEFAULT_WIDTH "400"
#define DEFAULT_HEIGHT "400"
#define DEFAULT_IDENT ""
#define DEFAULT_FONTNAME "fixed"
#define DEFAULT_TIME "1"
#ifdef TOGL_WGL
/* Maximum size of a logical palette corresponding to a colormap in color index
* mode. */
# define MAX_CI_COLORMAP_SIZE 4096
# if TOGL_USE_FONTS != 1
/*
* copy of TkWinColormap from tkWinInt.h
*/
typedef struct
{
HPALETTE palette; /* Palette handle used when drawing. */
UINT size; /* Number of entries in the palette. */
int stale; /* 1 if palette needs to be realized, otherwise
* 0. If the palette is stale, then an idle
* handler is scheduled to realize the palette. */
Tcl_HashTable refCounts; /* Hash table of palette entry reference counts
* indexed by pixel value. */
} TkWinColormap;
# else
# include "tkWinInt.h"
# endif
static LRESULT(CALLBACK *tkWinChildProc) (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam) = NULL;
# define TK_WIN_CHILD_CLASS_NAME "TkChild"
#endif /* TOGL_WGL */
#define MAX(a,b) (((a)>(b))?(a):(b))
#define TCL_ERR(interp, string) \
do { \
Tcl_ResetResult(interp); \
Tcl_AppendResult(interp, string, NULL); \
return TCL_ERROR; \
} while (0)
/* The constant DUMMY_WINDOW is used to signal window creation failure from the
* Togl_CreateWindow() */
#define DUMMY_WINDOW ((Window) -1)
#define ALL_EVENTS_MASK \
(KeyPressMask | \
KeyReleaseMask | \
ButtonPressMask | \
ButtonReleaseMask | \
EnterWindowMask | \
LeaveWindowMask | \
PointerMotionMask | \
ExposureMask | \
VisibilityChangeMask | \
FocusChangeMask | \
PropertyChangeMask | \
ColormapChangeMask)
struct Togl
{
Togl *Next; /* next in linked list */
#if defined(TOGL_WGL)
HDC tglGLHdc; /* Device context of device that OpenGL calls
* will be drawn on */
HGLRC tglGLHglrc; /* OpenGL rendering context to be made current */
int CiColormapSize; /* (Maximum) size of colormap in color index
* mode */
#elif defined(TOGL_X11)
GLXContext GlCtx; /* Normal planes GLX context */
#elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
AGLContext aglCtx;
#endif /* TOGL_WGL */
Display *display; /* X's token for the window's display. */
Tk_Window TkWin; /* Tk window structure */
Tcl_Interp *Interp; /* Tcl interpreter */
Tcl_Command widgetCmd; /* Token for togl's widget command */
#ifndef NO_TK_CURSOR
Tk_Cursor Cursor; /* The widget's cursor */
#endif
int Width, Height; /* Dimensions of window */
int SetGrid; /* positive is grid size for window manager */
int TimerInterval; /* Time interval for timer in milliseconds */
#if (TCL_MAJOR_VERSION * 100 + TCL_MINOR_VERSION) >= 705
Tcl_TimerToken timerHandler; /* Token for togl's timer handler */
#else
Tk_TimerToken timerHandler; /* Token for togl's timer handler */
#endif
Bool RgbaFlag; /* configuration flags (ala GLX parameters) */
int RgbaRed;
int RgbaGreen;
int RgbaBlue;
Bool DoubleFlag;
Bool DepthFlag;
int DepthSize;
Bool AccumFlag;
int AccumRed;
int AccumGreen;
int AccumBlue;
int AccumAlpha;
Bool AlphaFlag;
int AlphaSize;
Bool StencilFlag;
int StencilSize;
Bool PrivateCmapFlag;
Bool OverlayFlag;
Bool StereoFlag;
#ifdef __sgi
Bool OldStereoFlag;
#endif
int AuxNumber;
Bool Indirect;
int PixelFormat;
const char *ShareList; /* name (ident) of Togl to share dlists with */
const char *ShareContext; /* name (ident) to share OpenGL context with */
const char *Ident; /* User's identification string */
ClientData Client_Data; /* Pointer to user data */
Bool UpdatePending; /* Should normal planes be redrawn? */
Togl_Callback *CreateProc; /* Callback when widget is created */
Togl_Callback *DisplayProc; /* Callback when widget is rendered */
Togl_Callback *ReshapeProc; /* Callback when window size changes */
Togl_Callback *DestroyProc; /* Callback when widget is destroyed */
Togl_Callback *TimerProc; /* Callback when widget is idle */
/* Overlay stuff */
#if defined(TOGL_X11)
GLXContext OverlayCtx; /* Overlay planes OpenGL context */
#elif defined(TOGL_WGL)
HGLRC tglGLOverlayHglrc;
#endif /* TOGL_X11 */
Window OverlayWindow; /* The overlay window, or 0 */
Togl_Callback *OverlayDisplayProc; /* Overlay redraw proc */
Bool OverlayUpdatePending; /* Should overlay be redrawn? */
Colormap OverlayCmap; /* colormap for overlay is created */
int OverlayTransparentPixel; /* transparent pixel */
Bool OverlayIsMapped;
/* for DumpToEpsFile: Added by Miguel A. de Riera Pasenau 10.01.1997 */
XVisualInfo *VisInfo; /* Visual info of the current */
/* context needed for DumpToEpsFile */
GLfloat *EpsRedMap; /* Index2RGB Maps for Color index modes */
GLfloat *EpsGreenMap;
GLfloat *EpsBlueMap;
GLint EpsMapSize; /* = Number of indices in our Togl */
};
/* NTNTNT need to change to handle Windows Data Types */
/*
* Prototypes for functions local to this file
*/
static int Togl_Cmd(ClientData clientData, Tcl_Interp *interp,
int argc, CONST84 char **argv);
static void Togl_EventProc(ClientData clientData, XEvent *eventPtr);
static Window Togl_CreateWindow(Tk_Window, Window, ClientData);
static void Togl_WorldChanged(ClientData);
#ifdef MESA_COLOR_HACK
static int get_free_color_cells(Display *display, int screen,
Colormap colormap);
static void free_default_color_cells(Display *display, Colormap colormap);
#endif
static void ToglCmdDeletedProc(ClientData);
#if defined(__sgi)
/* SGI-only stereo */
static void oldStereoMakeCurrent(Display *dpy, Window win, GLXContext ctx);
static void oldStereoInit(Togl *togl, int stereoEnabled);
#endif
#if defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
static void SetMacBufRect(Togl *togl);
#endif
/*
* Setup Togl widget configuration options:
*/
static Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_PIXELS, TCL_STUPID "-height", "height", "Height",
DEFAULT_HEIGHT, Tk_Offset(Togl, Height), 0, NULL},
{TK_CONFIG_PIXELS, TCL_STUPID "-width", "width", "Width",
DEFAULT_WIDTH, Tk_Offset(Togl, Width), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-setgrid", "setGrid", "SetGrid",
"0", Tk_Offset(Togl, SetGrid), 0},
{TK_CONFIG_BOOLEAN, TCL_STUPID "-rgba", "rgba", "Rgba",
"true", Tk_Offset(Togl, RgbaFlag), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-redsize", "redsize", "RedSize",
"1", Tk_Offset(Togl, RgbaRed), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-greensize", "greensize", "GreenSize",
"1", Tk_Offset(Togl, RgbaGreen), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-bluesize", "bluesize", "BlueSize",
"1", Tk_Offset(Togl, RgbaBlue), 0, NULL},
{TK_CONFIG_BOOLEAN, TCL_STUPID "-double", "double", "Double",
"false", Tk_Offset(Togl, DoubleFlag), 0, NULL},
{TK_CONFIG_BOOLEAN, TCL_STUPID "-depth", "depth", "Depth",
"false", Tk_Offset(Togl, DepthFlag), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-depthsize", "depthsize", "DepthSize",
"1", Tk_Offset(Togl, DepthSize), 0, NULL},
{TK_CONFIG_BOOLEAN, TCL_STUPID "-accum", "accum", "Accum",
"false", Tk_Offset(Togl, AccumFlag), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-accumredsize", "accumredsize", "AccumRedSize",
"1", Tk_Offset(Togl, AccumRed), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-accumgreensize", "accumgreensize",
"AccumGreenSize",
"1", Tk_Offset(Togl, AccumGreen), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-accumbluesize", "accumbluesize",
"AccumBlueSize",
"1", Tk_Offset(Togl, AccumBlue), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-accumalphasize", "accumalphasize",
"AccumAlphaSize",
"1", Tk_Offset(Togl, AccumAlpha), 0, NULL},
{TK_CONFIG_BOOLEAN, TCL_STUPID "-alpha", "alpha", "Alpha",
"false", Tk_Offset(Togl, AlphaFlag), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-alphasize", "alphasize", "AlphaSize",
"1", Tk_Offset(Togl, AlphaSize), 0, NULL},
{TK_CONFIG_BOOLEAN, TCL_STUPID "-stencil", "stencil", "Stencil",
"false", Tk_Offset(Togl, StencilFlag), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-stencilsize", "stencilsize", "StencilSize",
"1", Tk_Offset(Togl, StencilSize), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-auxbuffers", "auxbuffers", "AuxBuffers",
"0", Tk_Offset(Togl, AuxNumber), 0, NULL},
{TK_CONFIG_BOOLEAN, TCL_STUPID "-privatecmap", "privateCmap", "PrivateCmap",
"false", Tk_Offset(Togl, PrivateCmapFlag), 0, NULL},
{TK_CONFIG_BOOLEAN, TCL_STUPID "-overlay", "overlay", "Overlay",
"false", Tk_Offset(Togl, OverlayFlag), 0, NULL},
{TK_CONFIG_BOOLEAN, TCL_STUPID "-stereo", "stereo", "Stereo",
"false", Tk_Offset(Togl, StereoFlag), 0, NULL},
#ifdef __sgi
{TK_CONFIG_BOOLEAN, TCL_STUPID "-oldstereo", "oldstereo", "OldStereo",
"false", Tk_Offset(Togl, OldStereoFlag), 0, NULL},
#endif
#ifndef NO_TK_CURSOR
{TK_CONFIG_ACTIVE_CURSOR, TCL_STUPID "-cursor", "cursor", "Cursor",
"", Tk_Offset(Togl, Cursor), TK_CONFIG_NULL_OK},
#endif
{TK_CONFIG_INT, TCL_STUPID "-time", "time", "Time",
DEFAULT_TIME, Tk_Offset(Togl, TimerInterval), 0, NULL},
{TK_CONFIG_STRING, TCL_STUPID "-sharelist", "sharelist", "ShareList",
NULL, Tk_Offset(Togl, ShareList), 0, NULL},
{TK_CONFIG_STRING, TCL_STUPID "-sharecontext", "sharecontext",
"ShareContext", NULL, Tk_Offset(Togl, ShareContext), 0, NULL},
{TK_CONFIG_STRING, TCL_STUPID "-ident", "ident", "Ident",
DEFAULT_IDENT, Tk_Offset(Togl, Ident), 0, NULL},
{TK_CONFIG_BOOLEAN, TCL_STUPID "-indirect", "indirect", "Indirect",
"false", Tk_Offset(Togl, Indirect), 0, NULL},
{TK_CONFIG_INT, TCL_STUPID "-pixelformat", "pixelFormat", "PixelFormat",
"0", Tk_Offset(Togl, PixelFormat), 0, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
/*
* Default callback pointers. When a new Togl widget is created it
* will be assigned these initial callbacks.
*/
static Togl_Callback *DefaultCreateProc = NULL;
static Togl_Callback *DefaultDisplayProc = NULL;
static Togl_Callback *DefaultReshapeProc = NULL;
static Togl_Callback *DefaultDestroyProc = NULL;
static Togl_Callback *DefaultOverlayDisplayProc = NULL;
static Togl_Callback *DefaultTimerProc = NULL;
static ClientData DefaultClientData = NULL;
static Tcl_HashTable CommandTable;
/*
* Head of linked list of all Togl widgets
*/
static Togl *ToglHead = NULL;
/*
* Add given togl widget to linked list.
*/
static void
AddToList(Togl *t)
{
t->Next = ToglHead;
ToglHead = t;
}
/*
* Remove given togl widget from linked list.
*/
static void
RemoveFromList(Togl *t)
{
Togl *prev = NULL;
Togl *pos = ToglHead;
while (pos) {
if (pos == t) {
if (prev) {
prev->Next = pos->Next;
} else {
ToglHead = pos->Next;
}
return;
}
prev = pos;
pos = pos->Next;
}
}
/*
* Return pointer to togl widget given a user identifier string.
*/
static Togl *
FindTogl(const char *ident)
{
Togl *t = ToglHead;
while (t) {
if (strcmp(t->Ident, ident) == 0)
return t;
t = t->Next;
}
return NULL;
}
#if defined(TOGL_X11)
/*
* Return pointer to another togl widget with same OpenGL context.
*/
static Togl *
FindToglWithSameContext(Togl *togl)
{
Togl *t;
for (t = ToglHead; t != NULL; t = t->Next) {
if (t == togl)
continue;
# if defined(TOGL_WGL)
if (t->tglGLHglrc == togl->tglGLHglrc)
# elif defined(TOGL_X11)
if (t->GlCtx == togl->GlCtx)
# elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
if (t->aglCtx == togl->aglCtx)
# endif
return t;
}
return NULL;
}
#endif
#ifdef USE_OVERLAY
/*
* Return pointer to another togl widget with same OpenGL overlay context.
*/
static Togl *
FindToglWithSameOverlayContext(Togl *togl)
{
Togl *t;
for (t = ToglHead; t != NULL; t = t->Next) {
if (t == togl)
continue;
# if defined(TOGL_X11)
if (t->OverlayCtx == togl->OverlayCtx)
# elif defined(TOGL_WGL)
if (t->tglGLOverlayHglrc == togl->tglGLOverlayHglrc)
# endif
return t;
}
return NULL;
}
#endif
#if defined(TOGL_X11)
/*
* Return an X colormap to use for OpenGL RGB-mode rendering.
* Input: dpy - the X display
* scrnum - the X screen number
* visinfo - the XVisualInfo as returned by glXChooseVisual()
* Return: an X Colormap or 0 if there's a _serious_ error.
*/
static Colormap
get_rgb_colormap(Display *dpy,
int scrnum, const XVisualInfo *visinfo, Tk_Window tkwin)
{
Atom hp_cr_maps;
Status status;
int numCmaps;
int i;
XStandardColormap *standardCmaps;
Window root = XRootWindow(dpy, scrnum);
Bool using_mesa;
/*
* First check if visinfo's visual matches the default/root visual.
*/
if (visinfo->visual == Tk_Visual(tkwin)) {
/* use the default/root colormap */
Colormap cmap;
cmap = Tk_Colormap(tkwin);
# ifdef MESA_COLOR_HACK
(void) get_free_color_cells(dpy, scrnum, cmap);
# endif
return cmap;
}
/*
* Check if we're using Mesa.
*/
if (strstr(glXQueryServerString(dpy, scrnum, GLX_VERSION), "Mesa")) {
using_mesa = True;
} else {
using_mesa = False;
}
/*
* Next, if we're using Mesa and displaying on an HP with the "Color
* Recovery" feature and the visual is 8-bit TrueColor, search for a
* special colormap initialized for dithering. Mesa will know how to
* dither using this colormap.
*/
if (using_mesa) {
hp_cr_maps = XInternAtom(dpy, "_HP_RGB_SMOOTH_MAP_LIST", True);
if (hp_cr_maps
# ifdef __cplusplus
&& visinfo->visual->c_class == TrueColor
# else
&& visinfo->visual->class == TrueColor
# endif
&& visinfo->depth == 8) {
status = XGetRGBColormaps(dpy, root, &standardCmaps,
&numCmaps, hp_cr_maps);
if (status) {
for (i = 0; i < numCmaps; i++) {
if (standardCmaps[i].visualid == visinfo->visual->visualid) {
Colormap cmap = standardCmaps[i].colormap;
(void) XFree(standardCmaps);
return cmap;
}
}
(void) XFree(standardCmaps);
}
}
}
/*
* Next, try to find a standard X colormap.
*/
# if !HP && !SUN
# ifndef SOLARIS_BUG
status = XmuLookupStandardColormap(dpy, visinfo->screen,
visinfo->visualid, visinfo->depth, XA_RGB_DEFAULT_MAP,
/* replace */ False, /* retain */ True);
if (status == 1) {
status = XGetRGBColormaps(dpy, root, &standardCmaps,
&numCmaps, XA_RGB_DEFAULT_MAP);
if (status == 1) {
for (i = 0; i < numCmaps; i++) {
if (standardCmaps[i].visualid == visinfo->visualid) {
Colormap cmap = standardCmaps[i].colormap;
(void) XFree(standardCmaps);
return cmap;
}
}
(void) XFree(standardCmaps);
}
}
# endif
# endif
/*
* If we get here, give up and just allocate a new colormap.
*/
return XCreateColormap(dpy, root, visinfo->visual, AllocNone);
}
#elif defined(TOGL_WGL)
/* Code to create RGB palette is taken from the GENGL sample program of Win32
* SDK */
static unsigned char threeto8[8] = {
0, 0111 >> 1, 0222 >> 1, 0333 >> 1, 0444 >> 1, 0555 >> 1, 0666 >> 1, 0377
};
static unsigned char twoto8[4] = {
0, 0x55, 0xaa, 0xff
};
static unsigned char oneto8[2] = {
0, 255
};
static int defaultOverride[13] = {
0, 3, 24, 27, 64, 67, 88, 173, 181, 236, 247, 164, 91
};
static PALETTEENTRY defaultPalEntry[20] = {
{0, 0, 0, 0},
{0x80, 0, 0, 0},
{0, 0x80, 0, 0},
{0x80, 0x80, 0, 0},
{0, 0, 0x80, 0},
{0x80, 0, 0x80, 0},
{0, 0x80, 0x80, 0},
{0xC0, 0xC0, 0xC0, 0},
{192, 220, 192, 0},
{166, 202, 240, 0},
{255, 251, 240, 0},
{160, 160, 164, 0},
{0x80, 0x80, 0x80, 0},
{0xFF, 0, 0, 0},
{0, 0xFF, 0, 0},
{0xFF, 0xFF, 0, 0},
{0, 0, 0xFF, 0},
{0xFF, 0, 0xFF, 0},
{0, 0xFF, 0xFF, 0},
{0xFF, 0xFF, 0xFF, 0}
};
static unsigned char
ComponentFromIndex(int i, UINT nbits, UINT shift)
{
unsigned char val;
val = (unsigned char) (i >> shift);
switch (nbits) {
case 1:
val &= 0x1;
return oneto8[val];
case 2:
val &= 0x3;
return twoto8[val];
case 3:
val &= 0x7;
return threeto8[val];
default:
return 0;
}
}
static Colormap
Win32CreateRgbColormap(PIXELFORMATDESCRIPTOR pfd)
{
TkWinColormap *cmap = (TkWinColormap *) ckalloc(sizeof (TkWinColormap));
LOGPALETTE *pPal;
int n, i;
n = 1 << pfd.cColorBits;
pPal = (PLOGPALETTE) LocalAlloc(LMEM_FIXED, sizeof (LOGPALETTE)
+ n * sizeof (PALETTEENTRY));
pPal->palVersion = 0x300;
pPal->palNumEntries = n;
for (i = 0; i < n; i++) {
pPal->palPalEntry[i].peRed =
ComponentFromIndex(i, pfd.cRedBits, pfd.cRedShift);
pPal->palPalEntry[i].peGreen =
ComponentFromIndex(i, pfd.cGreenBits, pfd.cGreenShift);
pPal->palPalEntry[i].peBlue =
ComponentFromIndex(i, pfd.cBlueBits, pfd.cBlueShift);
pPal->palPalEntry[i].peFlags = 0;
}
/* fix up the palette to include the default GDI palette */
if ((pfd.cColorBits == 8)
&& (pfd.cRedBits == 3) && (pfd.cRedShift == 0)
&& (pfd.cGreenBits == 3) && (pfd.cGreenShift == 3)
&& (pfd.cBlueBits == 2) && (pfd.cBlueShift == 6)) {
for (i = 1; i <= 12; i++)
pPal->palPalEntry[defaultOverride[i]] = defaultPalEntry[i];
}
cmap->palette = CreatePalette(pPal);
LocalFree(pPal);
cmap->size = n;
cmap->stale = 0;
/* Since this is a private colormap of a fix size, we do not need a valid
* hash table, but a dummy one */
Tcl_InitHashTable(&cmap->refCounts, TCL_ONE_WORD_KEYS);
return (Colormap) cmap;
}
static Colormap
Win32CreateCiColormap(Togl *togl)
{
/* Create a colormap with size of togl->CiColormapSize and set all entries
* to black */
LOGPALETTE logPalette;
TkWinColormap *cmap = (TkWinColormap *) ckalloc(sizeof (TkWinColormap));
logPalette.palVersion = 0x300;
logPalette.palNumEntries = 1;
logPalette.palPalEntry[0].peRed = 0;
logPalette.palPalEntry[0].peGreen = 0;
logPalette.palPalEntry[0].peBlue = 0;
logPalette.palPalEntry[0].peFlags = 0;
cmap->palette = CreatePalette(&logPalette);
cmap->size = togl->CiColormapSize;
ResizePalette(cmap->palette, cmap->size); /* sets new entries to black */
cmap->stale = 0;
/* Since this is a private colormap of a fix size, we do not need a valid
* hash table, but a dummy one */
Tcl_InitHashTable(&cmap->refCounts, TCL_ONE_WORD_KEYS);
return (Colormap) cmap;
}
#endif /* TOGL_X11 */
/*
* Togl_Init
*
* Called upon system startup to create Togl command.
*/
int
Togl_Init(Tcl_Interp *interp)
{
int major, minor, patchLevel, releaseType;
#ifdef USE_TCL_STUBS
if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
return TCL_ERROR;
}
#endif
#ifdef USE_TK_STUBS
if (Tk_InitStubs(interp, TCL_STUPID "8.1", 0) == NULL) {
return TCL_ERROR;
}
#endif
/* Skip all this on Tcl/Tk 8.0 or older. Seems to work */
#if TCL_MAJOR_VERSION * 100 + TCL_MINOR_VERSION > 800
Tcl_GetVersion(&major, &minor, &patchLevel, &releaseType);
# ifdef HAVE_TK_SETCLASSPROCS
if (major > 8
|| (major == 8
&& (minor > 4
|| (minor == 4 && (releaseType > 0
|| patchLevel >= 2))))) {
# ifdef USE_TK_STUBS
SetClassProcsPtr = tkStubsPtr->tk_SetClassProcs;
# else
SetClassProcsPtr = Tk_SetClassProcs;
# endif
} else {
SetClassProcsPtr = NULL;
}
# else
if (major > 8
|| (major == 8
&& (minor > 4
|| (minor == 4 && (releaseType > 0
|| patchLevel >= 2))))) {
TCL_ERR(interp,
"Sorry, this instance of Togl was not compiled to work with Tcl/Tk 8.4a2 or higher.");
}
# endif
#endif
if (Tcl_PkgProvide(interp, "Togl", TOGL_VERSION) != TCL_OK) {
return TCL_ERROR;
}
if (Tcl_CreateCommand(interp, "togl", Togl_Cmd,
(ClientData) Tk_MainWindow(interp), NULL) == NULL)
return TCL_ERROR;
Tcl_InitHashTable(&CommandTable, TCL_STRING_KEYS);
return TCL_OK;
}
/*
* Register a C function to be called when an Togl widget is realized.
*/
void
Togl_CreateFunc(Togl_Callback *proc)
{
DefaultCreateProc = proc;
}
/*
* Register a C function to be called when an Togl widget must be redrawn.
*/
void
Togl_DisplayFunc(Togl_Callback *proc)
{
DefaultDisplayProc = proc;
}
/*
* Register a C function to be called when an Togl widget is resized.
*/
void
Togl_ReshapeFunc(Togl_Callback *proc)
{
DefaultReshapeProc = proc;
}
/*
* Register a C function to be called when an Togl widget is destroyed.
*/
void
Togl_DestroyFunc(Togl_Callback *proc)
{
DefaultDestroyProc = proc;
}
/*
* Register a C function to be called from TimerEventHandler.
*/
void
Togl_TimerFunc(Togl_Callback *proc)
{
DefaultTimerProc = proc;
}
/*
* Reset default callback pointers to NULL.
*/
void
Togl_ResetDefaultCallbacks(void)
{
DefaultCreateProc = NULL;
DefaultDisplayProc = NULL;
DefaultReshapeProc = NULL;
DefaultDestroyProc = NULL;
DefaultOverlayDisplayProc = NULL;
DefaultTimerProc = NULL;
DefaultClientData = NULL;
}
/*
* Chnage the create callback for a specific Togl widget.
*/
void
Togl_SetCreateFunc(Togl *togl, Togl_Callback *proc)
{
togl->CreateProc = proc;
}
/*
* Change the display/redraw callback for a specific Togl widget.
*/
void
Togl_SetDisplayFunc(Togl *togl, Togl_Callback *proc)
{
togl->DisplayProc = proc;
}
/*
* Change the reshape callback for a specific Togl widget.
*/
void
Togl_SetReshapeFunc(Togl *togl, Togl_Callback *proc)
{
togl->ReshapeProc = proc;
}
/*
* Change the destroy callback for a specific Togl widget.
*/
void
Togl_SetDestroyFunc(Togl *togl, Togl_Callback *proc)
{
togl->DestroyProc = proc;
}
/*
* Togl_Timer
*
* Gets called from Tk_CreateTimerHandler.
*/
static void
Togl_Timer(ClientData clientData)
{
Togl *togl = (Togl *) clientData;
if (togl->TimerProc) {
togl->TimerProc(togl);
/* Re-register this callback since Tcl/Tk timers are "one-shot". That
* is, after the timer callback is called it not normally called again.
* * * * * * * * * That's not the behavior we want for Togl. */
#if (TK_MAJOR_VERSION * 100 + TK_MINOR_VERSION) >= 401
togl->timerHandler =
Tcl_CreateTimerHandler(togl->TimerInterval, Togl_Timer,
(ClientData) togl);
#else
togl->timerHandler =
Tk_CreateTimerHandler(togl->TimeInterval, Togl_Timer,
(ClientData) togl);
#endif
}
}
/*
* Change the timer callback for a specific Togl widget.
* Pass NULL to disable the callback.
*/
void
Togl_SetTimerFunc(Togl *togl, Togl_Callback *proc)
{
togl->TimerProc = proc;
if (proc) {
#if (TK_MAJOR_VERSION * 100 + TK_MINOR_VERSION) >= 401
togl->timerHandler =
Tcl_CreateTimerHandler(togl->TimerInterval, Togl_Timer,
(ClientData) togl);
#else
togl->timerHandler =
Tk_CreateTimerHandler(togl->TimeInterval, Togl_Timer,
(ClientData) togl);
#endif
}
}
/*
* Togl_CreateCommand
*
* Declares a new C sub-command of Togl callable from Tcl.
* Every time the sub-command is called from Tcl, the
* C routine will be called with all the arguments from Tcl.
*/
void
Togl_CreateCommand(char *cmd_name, Togl_CmdProc *cmd_proc)
{
int new_item;
Tcl_HashEntry *entry;
entry = Tcl_CreateHashEntry(&CommandTable, cmd_name, &new_item);
Tcl_SetHashValue(entry, cmd_proc);
}
/*
* Togl_MakeCurrent
*
* Bind the OpenGL rendering context to the specified
* Togl widget.
*/
void
Togl_MakeCurrent(const Togl *togl)
{
#if defined(TOGL_WGL)
int res = wglMakeCurrent(togl->tglGLHdc, togl->tglGLHglrc);
assert(res == TRUE);
#elif defined(TOGL_X11)
if (!togl->GlCtx)
return;
(void) glXMakeCurrent(togl->display,
togl->TkWin ? Tk_WindowId(togl->TkWin) : None, togl->GlCtx);
# if defined(__sgi)
if (togl->OldStereoFlag)
oldStereoMakeCurrent(togl->display,
togl->TkWin ? Tk_WindowId(togl->TkWin) : None, togl->GlCtx);
# endif /*__sgi STEREO */
#elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
if (!togl->aglCtx)
return;
aglSetCurrentContext(togl->aglCtx);
#endif
}
#ifdef TOGL_AGL_CLASSIC
/* tell OpenGL which part of the Mac window to render to */
static void
SetMacBufRect(Togl *togl)
{
GLint wrect[4];
/* set wrect[0,1] to lower left corner of widget */
wrect[2] = ((TkWindow *) (togl->TkWin))->changes.width;
wrect[3] = ((TkWindow *) (togl->TkWin))->changes.height;
wrect[0] = ((TkWindow *) (togl->TkWin))->privatePtr->xOff;
wrect[1] =
((TkWindow *) (togl->TkWin))->privatePtr->toplevel->portPtr->
portRect.bottom - wrect[3] -
((TkWindow *) (togl->TkWin))->privatePtr->yOff;
aglSetInteger(togl->aglCtx, AGL_BUFFER_RECT, wrect);
aglEnable(togl->aglCtx, AGL_BUFFER_RECT);
aglUpdateContext(togl->aglCtx);
}
#elif defined(TOGL_AGL)
/* tell OpenGL which part of the Mac window to render to */
static void
SetMacBufRect(Togl *togl)
{
GLint wrect[4];
/* set wrect[0,1] to lower left corner of widget */
wrect[2] = Tk_Width(togl->TkWin);
wrect[3] = Tk_Height(togl->TkWin);
wrect[0] = ((TkWindow *) (togl->TkWin))->privatePtr->xOff;
Rect r;
GetPortBounds(((TkWindow *) (togl->TkWin))->privatePtr->toplevel->grafPtr,
&r);
wrect[1] = r.bottom -
wrect[3] - ((TkWindow *) (togl->TkWin))->privatePtr->yOff;
aglSetInteger(togl->aglCtx, AGL_BUFFER_RECT, wrect);
aglEnable(togl->aglCtx, AGL_BUFFER_RECT);
aglUpdateContext(togl->aglCtx);
}
#endif
/*
* Called when the widget's contents must be redrawn. Basically, we
* just call the user's render callback function.
*
* Note that the parameter type is ClientData so this function can be
* passed to Tk_DoWhenIdle().
*/
static void
Togl_Render(ClientData clientData)
{
Togl *togl = (Togl *) clientData;
if (togl->DisplayProc) {
#ifdef TOGL_AGL_CLASSIC
/* Mac is complicated here because OpenGL needs to know what part of
* the parent window to render into, and it seems that region need to
* be invalidated before drawing, so that QuickDraw will allow OpenGL
* to transfer pixels into that part of the window. I'm not even
* totally sure how or why this works as it does, since this aspect of
* Mac OpenGL seems to be totally undocumented. This was put together
* by trial and error! (thiessen) */
MacRegion r;
RgnPtr rp = &r;
GrafPtr curPort, parentWin;
parentWin = (GrafPtr)
(((MacDrawable *) (Tk_WindowId(togl->TkWin)))->toplevel->
portPtr);
if (!parentWin)
return;
#endif
Togl_MakeCurrent(togl);
#ifdef TOGL_AGL_CLASSIC
/* Set QuickDraw port and clipping region */
GetPort(&curPort);
SetPort(parentWin);
r.rgnBBox.left = ((TkWindow *) (togl->TkWin))->privatePtr->xOff;
r.rgnBBox.right =
r.rgnBBox.left + ((TkWindow *) (togl->TkWin))->changes.width -
1;
r.rgnBBox.top = ((TkWindow *) (togl->TkWin))->privatePtr->yOff;
r.rgnBBox.bottom =
r.rgnBBox.top + ((TkWindow *) (togl->TkWin))->changes.height -
1;
r.rgnSize = sizeof (Region);
InvalRgn(&rp);
SetClip(&rp);
/* this may seem an odd place to put this, with possibly redundant
* calls to aglSetInteger(AGL_BUFFER_RECT...), but for some reason
* performance is actually a lot better if this is called before every
* render... */
SetMacBufRect(togl);
#endif
#ifdef TOGL_AGL
SetMacBufRect(togl);
#endif
togl->DisplayProc(togl);
#ifdef TOGL_AGL_CLASSIC
SetPort(curPort); /* restore previous port */
#endif
}
#if defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
else {
/* Always need to update on resize */
SetMacBufRect(togl);
}
#endif
togl->UpdatePending = False;
}
static void
RenderOverlay(ClientData clientData)
{
Togl *togl = (Togl *) clientData;
if (togl->OverlayFlag && togl->OverlayDisplayProc) {
#if defined(TOGL_WGL)
int res = wglMakeCurrent(togl->tglGLHdc, togl->tglGLHglrc);
assert(res == TRUE);
#elif defined(TOGL_X11)
(void) glXMakeCurrent(Tk_Display(togl->TkWin),
togl->OverlayWindow, togl->OverlayCtx);
# if defined(__sgi)
if (togl->OldStereoFlag)
oldStereoMakeCurrent(Tk_Display(togl->TkWin),
togl->OverlayWindow, togl->OverlayCtx);
# endif /*__sgi STEREO */
#endif /* TOGL_WGL */
togl->OverlayDisplayProc(togl);
}
togl->OverlayUpdatePending = False;
}
/*
* It's possible to change with this function or in a script some
* options like RGBA - ColorIndex ; Z-buffer and so on
*/
int
Togl_Configure(Tcl_Interp *interp, Togl *togl,
int argc, const char *argv[], int flags)
{
Bool oldRgbaFlag = togl->RgbaFlag;
int oldRgbaRed = togl->RgbaRed;
int oldRgbaGreen = togl->RgbaGreen;
int oldRgbaBlue = togl->RgbaBlue;
Bool oldDoubleFlag = togl->DoubleFlag;
Bool oldDepthFlag = togl->DepthFlag;
int oldDepthSize = togl->DepthSize;
Bool oldAccumFlag = togl->AccumFlag;
int oldAccumRed = togl->AccumRed;
int oldAccumGreen = togl->AccumGreen;
int oldAccumBlue = togl->AccumBlue;
int oldAccumAlpha = togl->AccumAlpha;
Bool oldAlphaFlag = togl->AlphaFlag;
int oldAlphaSize = togl->AlphaSize;
Bool oldStencilFlag = togl->StencilFlag;
int oldStencilSize = togl->StencilSize;
int oldAuxNumber = togl->AuxNumber;
int oldWidth = togl->Width;
int oldHeight = togl->Height;
int oldSetGrid = togl->SetGrid;
if (Tk_ConfigureWidget(interp, togl->TkWin, configSpecs,
argc, argv, WIDGREC togl, flags) == TCL_ERROR) {
return (TCL_ERROR);
}
#ifndef USE_OVERLAY
if (togl->OverlayFlag) {
TCL_ERR(interp, "Sorry, overlay was disabled");
}
#endif
if (togl->Width != oldWidth || togl->Height != oldHeight
|| togl->SetGrid != oldSetGrid) {
Togl_WorldChanged((ClientData) togl);
/* this added per Lou Arata */
Tk_ResizeWindow(togl->TkWin, togl->Width, togl->Height);
if (togl->ReshapeProc &&
#if defined(TOGL_WGL)
togl->tglGLHglrc
#elif defined(TOGL_X11)
togl->GlCtx
#elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
togl->aglCtx
#endif
) {
Togl_MakeCurrent(togl);
togl->ReshapeProc(togl);
}
}
if (togl->RgbaFlag != oldRgbaFlag
|| togl->RgbaRed != oldRgbaRed
|| togl->RgbaGreen != oldRgbaGreen
|| togl->RgbaBlue != oldRgbaBlue
|| togl->DoubleFlag != oldDoubleFlag
|| togl->DepthFlag != oldDepthFlag
|| togl->DepthSize != oldDepthSize
|| togl->AccumFlag != oldAccumFlag
|| togl->AccumRed != oldAccumRed
|| togl->AccumGreen != oldAccumGreen
|| togl->AccumBlue != oldAccumBlue
|| togl->AccumAlpha != oldAccumAlpha
|| togl->AlphaFlag != oldAlphaFlag
|| togl->AlphaSize != oldAlphaSize
|| togl->StencilFlag != oldStencilFlag
|| togl->StencilSize != oldStencilSize
|| togl->AuxNumber != oldAuxNumber) {
#ifdef MESA_COLOR_HACK
free_default_color_cells(Tk_Display(togl->TkWin),
Tk_Colormap(togl->TkWin));
#endif
}
#if defined(__sgi)
oldStereoInit(togl, togl->OldStereoFlag);
#endif
return TCL_OK;
}
static int
Togl_Widget(ClientData clientData, Tcl_Interp *interp, int argc,
CONST84 char *argv[])
{
Togl *togl = (Togl *) clientData;
int result = TCL_OK;
Tcl_HashEntry *entry;
Tcl_HashSearch search;
Togl_CmdProc *cmd_proc;
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], " ?options?\"", NULL);
return TCL_ERROR;
}
Tk_Preserve((ClientData) togl);
if (!strncmp(argv[1], "configure", MAX(1, strlen(argv[1])))) {
if (argc == 2) {
/* Return list of all configuration parameters */
result = Tk_ConfigureInfo(interp, togl->TkWin, configSpecs,
WIDGREC togl, (char *) NULL, 0);
} else if (argc == 3) {
if (strcmp(argv[2], "-extensions") == 0) {
/* Return a list of OpenGL extensions available */
const char *extensions;
extensions = (const char *) glGetString(GL_EXTENSIONS);
Tcl_SetResult(interp, TCL_STUPID extensions, TCL_STATIC);
result = TCL_OK;
} else {
/* Return a specific configuration parameter */
result = Tk_ConfigureInfo(interp, togl->TkWin, configSpecs,
WIDGREC togl, argv[2], 0);
}
} else {
/* Execute a configuration change */
result = Togl_Configure(interp, togl, argc - 2, argv + 2,
TK_CONFIG_ARGV_ONLY);
}
} else if (!strncmp(argv[1], "render", MAX(1, strlen(argv[1])))) {
/* force the widget to be redrawn */
Togl_Render((ClientData) togl);
} else if (!strncmp(argv[1], "swapbuffers", MAX(1, strlen(argv[1])))) {
/* force the widget to be redrawn */
Togl_SwapBuffers(togl);
} else if (!strncmp(argv[1], "makecurrent", MAX(1, strlen(argv[1])))) {
/* force the widget to be redrawn */
Togl_MakeCurrent(togl);
}
#if TOGL_USE_FONTS == 1
else if (!strncmp(argv[1], "loadbitmapfont", MAX(1, strlen(argv[1])))) {
if (argc == 3) {
GLuint fontbase;
Tcl_Obj *fontbaseAsTclObject;
fontbase = Togl_LoadBitmapFont(togl, argv[2]);
if (fontbase) {
fontbaseAsTclObject = Tcl_NewIntObj(fontbase);
Tcl_SetObjResult(interp, fontbaseAsTclObject);
result = TCL_OK;
} else {
Tcl_AppendResult(interp, "Could not allocate font", NULL);
result = TCL_ERROR;
}
} else {
Tcl_AppendResult(interp, "wrong # args", NULL);
result = TCL_ERROR;
}
} else if (!strncmp(argv[1], "unloadbitmapfont", MAX(1, strlen(argv[1])))) {
if (argc == 3) {
Togl_UnloadBitmapFont(togl, atoi(argv[2]));
result = TCL_OK;
} else {
Tcl_AppendResult(interp, "wrong # args", NULL);
result = TCL_ERROR;
}
}
#endif /* TOGL_USE_FONTS */
else {
/* Probably a user-defined function */
entry = Tcl_FindHashEntry(&CommandTable, argv[1]);
if (entry != NULL) {
cmd_proc = (Togl_CmdProc *) Tcl_GetHashValue(entry);
result = cmd_proc(togl, argc, argv);
} else {
Tcl_AppendResult(interp, "Togl: Unknown option: ", argv[1], "\n",
"Try: configure or render\n",
"or one of the user-defined commands:\n", NULL);
entry = Tcl_FirstHashEntry(&CommandTable, &search);
while (entry) {
Tcl_AppendResult(interp, " ",
Tcl_GetHashKey(&CommandTable, entry), "\n", NULL);
entry = Tcl_NextHashEntry(&search);
}
result = TCL_ERROR;
}
}
Tk_Release((ClientData) togl);
return result;
}
/*
* Togl_Cmd
*
* Called when Togl is executed - creation of a Togl widget.
* * Creates a new window
* * Creates an 'Togl' data structure
* * Creates an event handler for this window
* * Creates a command that handles this object
* * Configures this Togl for the given arguments
*/
static int
Togl_Cmd(ClientData clientData, Tcl_Interp *interp, int argc,
CONST84 char **argv)
{
const char *name;
Tk_Window mainwin = (Tk_Window) clientData;
Tk_Window tkwin;
Togl *togl;
if (argc <= 1) {
TCL_ERR(interp, "wrong # args: should be \"pathName read filename\"");
}
/* Create the window. */
name = argv[1];
tkwin = Tk_CreateWindowFromPath(interp, mainwin, name, (char *) NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
Tk_SetClass(tkwin, "Togl");
/* Create Togl data structure */
togl = (Togl *) malloc(sizeof (Togl));
if (!togl) {
return TCL_ERROR;
}
togl->Next = NULL;
#if defined(TOGL_WGL)
togl->tglGLHdc = NULL;
togl->tglGLHglrc = NULL;
#elif defined(TOGL_X11)
togl->GlCtx = NULL;
togl->OverlayCtx = NULL;
#elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
togl->aglCtx = NULL;
#endif /* TOGL_WGL */
togl->display = Tk_Display(tkwin);
togl->TkWin = tkwin;
togl->Interp = interp;
#ifndef NO_TK_CURSOR
togl->Cursor = None;
#endif
togl->Width = 0;
togl->Height = 0;
togl->SetGrid = 0;
togl->TimerInterval = 0;
togl->RgbaFlag = True;
togl->RgbaRed = 1;
togl->RgbaGreen = 1;
togl->RgbaBlue = 1;
togl->DoubleFlag = False;
togl->DepthFlag = False;
togl->DepthSize = 1;
togl->AccumFlag = False;
togl->AccumRed = 1;
togl->AccumGreen = 1;
togl->AccumBlue = 1;
togl->AccumAlpha = 1;
togl->AlphaFlag = False;
togl->AlphaSize = 1;
togl->StencilFlag = False;
togl->StencilSize = 1;
togl->OverlayFlag = False;
togl->StereoFlag = False;
#ifdef __sgi
togl->OldStereoFlag = False;
#endif
togl->AuxNumber = 0;
togl->Indirect = False;
togl->PixelFormat = 0;
togl->UpdatePending = False;
togl->OverlayUpdatePending = False;
togl->CreateProc = DefaultCreateProc;
togl->DisplayProc = DefaultDisplayProc;
togl->ReshapeProc = DefaultReshapeProc;
togl->DestroyProc = DefaultDestroyProc;
togl->TimerProc = DefaultTimerProc;
togl->OverlayDisplayProc = DefaultOverlayDisplayProc;
togl->ShareList = NULL;
togl->ShareContext = NULL;
togl->Ident = NULL;
togl->Client_Data = DefaultClientData;
/* for EPS Output */
togl->EpsRedMap = togl->EpsGreenMap = togl->EpsBlueMap = NULL;
togl->EpsMapSize = 0;
/* Create command event handler */
togl->widgetCmd = Tcl_CreateCommand(interp, Tk_PathName(tkwin),
Togl_Widget, (ClientData) togl,
(Tcl_CmdDeleteProc *) ToglCmdDeletedProc);
/*
* Setup the Tk_ClassProcs callbacks to point at our own window creation
* function
*
* We need to check at runtime if we should use the new Tk_SetClassProcs()
* API or if we need to modify the window structure directly */
#ifdef HAVE_TK_SETCLASSPROCS
if (SetClassProcsPtr != NULL) { /* use public API (Tk 8.4+) */
Tk_ClassProcs *procsPtr;
procsPtr = (Tk_ClassProcs *) Tcl_Alloc(sizeof (Tk_ClassProcs));
procsPtr->size = sizeof (Tk_ClassProcs);
procsPtr->createProc = Togl_CreateWindow;
procsPtr->worldChangedProc = Togl_WorldChanged;
procsPtr->modalProc = NULL;
/* Tk_SetClassProcs(togl->TkWin,procsPtr,(ClientData)togl); */
(SetClassProcsPtr) (togl->TkWin, procsPtr, (ClientData) togl);
} else
#endif
{ /* use private API */
/*
* We need to set these fields in the Tk_FakeWin structure: dummy17 =
* classProcsPtr dummy18 = instanceData */
TkClassProcs *procsPtr;
Tk_FakeWin *winPtr = (Tk_FakeWin *) (togl->TkWin);
procsPtr = (TkClassProcs *) Tcl_Alloc(sizeof (TkClassProcs));
procsPtr->createProc = Togl_CreateWindow;
procsPtr->geometryProc = Togl_WorldChanged;
procsPtr->modalProc = NULL;
winPtr->dummy17 = (char *) procsPtr;
winPtr->dummy18 = (ClientData) togl;
}
Tk_CreateEventHandler(tkwin,
ExposureMask | StructureNotifyMask, Togl_EventProc,
(ClientData) togl);
/* Configure Togl widget */
if (Togl_Configure(interp, togl, argc - 2, argv + 2, 0) == TCL_ERROR) {
Tk_DestroyWindow(tkwin);
Tcl_AppendResult(interp, "Couldn't configure togl widget\n", NULL);
goto error;
}
/*
* If OpenGL window wasn't already created by Togl_Configure() we
* create it now. We can tell by checking if the GLX context has
* been initialized.
*/
if (!
#if defined(TOGL_WGL)
togl->tglGLHdc
#elif defined(TOGL_X11)
togl->GlCtx
#elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
togl->aglCtx
#endif
) {
Tk_MakeWindowExist(togl->TkWin);
if (Tk_WindowId(togl->TkWin) == DUMMY_WINDOW) {
return TCL_ERROR;
}
Togl_MakeCurrent(togl);
}
/* If defined, call create callback */
if (togl->CreateProc) {
togl->CreateProc(togl);
}
/* If defined, call reshape proc */
if (togl->ReshapeProc) {
togl->ReshapeProc(togl);
}
/* If defined, setup timer */
if (togl->TimerProc) {
(void) Tk_CreateTimerHandler(togl->TimerInterval, Togl_Timer,
(ClientData) togl);
}
Tcl_AppendResult(interp, Tk_PathName(tkwin), NULL);
/* Add to linked list */
AddToList(togl);
return TCL_OK;
error:
(void) Tcl_DeleteCommand(interp, "togl");
/* free(togl); Don't free it, if we do a crash occurs later... */
return TCL_ERROR;
}
#ifdef USE_OVERLAY
/*
* Do all the setup for overlay planes
* Return: TCL_OK or TCL_ERROR
*/
static int
SetupOverlay(Togl *togl)
{
# if defined(TOGL_X11)
# ifdef GLX_TRANSPARENT_TYPE_EXT
static int ovAttributeList[] = {
GLX_BUFFER_SIZE, 2,
GLX_LEVEL, 1,
GLX_TRANSPARENT_TYPE_EXT, GLX_TRANSPARENT_INDEX_EXT,
None
};
# else
static int ovAttributeList[] = {
GLX_BUFFER_SIZE, 2,
GLX_LEVEL, 1,
None
};
# endif
Display *dpy;
XVisualInfo *visinfo;
TkWindow *winPtr = (TkWindow *) togl->TkWin;
XSetWindowAttributes swa;
Tcl_HashEntry *hPtr;
int new_flag;
dpy = Tk_Display(togl->TkWin);
visinfo = glXChooseVisual(dpy, Tk_ScreenNumber(winPtr), ovAttributeList);
if (!visinfo) {
Tcl_AppendResult(togl->Interp, Tk_PathName(winPtr),
": No suitable overlay index visual available", (char *) NULL);
togl->OverlayCtx = 0;
togl->OverlayWindow = 0;
togl->OverlayCmap = 0;
return TCL_ERROR;
}
# ifdef GLX_TRANSPARENT_INDEX_EXT
{
int fail =
glXGetConfig(dpy, visinfo, GLX_TRANSPARENT_INDEX_VALUE_EXT,
&togl->OverlayTransparentPixel);
if (fail)
togl->OverlayTransparentPixel = 0; /* maybe, maybe ... */
}
# else
togl->OverlayTransparentPixel = 0; /* maybe, maybe ... */
# endif
/* share display lists with normal layer context */
togl->OverlayCtx =
glXCreateContext(dpy, visinfo, togl->GlCtx, !togl->Indirect);
swa.colormap = XCreateColormap(dpy, XRootWindow(dpy, visinfo->screen),
visinfo->visual, AllocNone);
togl->OverlayCmap = swa.colormap;
swa.border_pixel = 0;
swa.event_mask = ALL_EVENTS_MASK;
togl->OverlayWindow = XCreateWindow(dpy, Tk_WindowId(togl->TkWin), 0, 0,
togl->Width, togl->Height, 0,
visinfo->depth, InputOutput,
visinfo->visual, CWBorderPixel | CWColormap | CWEventMask, &swa);
hPtr = Tcl_CreateHashEntry(&winPtr->dispPtr->winTable,
(char *) togl->OverlayWindow, &new_flag);
Tcl_SetHashValue(hPtr, winPtr);
/* XMapWindow( dpy, togl->OverlayWindow ); */
togl->OverlayIsMapped = False;
/* Make sure window manager installs our colormap */
XSetWMColormapWindows(dpy, togl->OverlayWindow, &togl->OverlayWindow, 1);
return TCL_OK;
# elif defined(TOGL_WGL) || defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
/* not yet implemented on these */
return TCL_ERROR;
# endif
}
#endif /* USE_OVERLAY */
#ifdef TOGL_WGL
# define TOGL_CLASS_NAME "Togl Class"
static Bool ToglClassInitialized = False;
static LRESULT CALLBACK
Win32WinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LONG result;
Togl *togl = (Togl *) GetWindowLong(hwnd, 0);
WNDCLASS childClass;
switch (message) {
case WM_WINDOWPOSCHANGED:
/* Should be processed by DefWindowProc, otherwise a double buffered
* context is not properly resized when the corresponding window is
* resized. */
break;
case WM_DESTROY:
if (togl->tglGLHglrc) {
wglDeleteContext(togl->tglGLHglrc);
}
if (togl->tglGLHdc) {
ReleaseDC(hwnd, togl->tglGLHdc);
}
free(togl);
break;
default:
# if USE_STATIC_LIB
return TkWinChildProc(hwnd, message, wParam, lParam);
# else
/*
* OK, since TkWinChildProc is not explicitly exported in the
* dynamic libraries, we have to retrieve it from the class info
* registered with windows.
*
*/
if (tkWinChildProc == NULL) {
GetClassInfo(Tk_GetHINSTANCE(), TK_WIN_CHILD_CLASS_NAME,
&childClass);
tkWinChildProc = childClass.lpfnWndProc;
}
return tkWinChildProc(hwnd, message, wParam, lParam);
# endif
}
result = DefWindowProc(hwnd, message, wParam, lParam);
Tcl_ServiceAll();
return result;
}
#endif /* TOGL_WGL */
/*
* Togl_CreateWindow
*
* Window creation function, invoked as a callback from Tk_MakeWindowExist.
* Creates an OpenGL window for the Togl widget.
*/
static Window
Togl_CreateWindow(Tk_Window tkwin, Window parent, ClientData instanceData)
{
Togl *togl = (Togl *) instanceData;
XVisualInfo *visinfo = NULL;
Display *dpy;
Colormap cmap;
int scrnum;
Window window;
#if defined(TOGL_X11)
Bool directCtx = True;
int attrib_list[1000];
int attrib_count;
int dummy;
XSetWindowAttributes swa;
# define MAX_ATTEMPTS 12
static int ci_depths[MAX_ATTEMPTS] = {
8, 4, 2, 1, 12, 16, 8, 4, 2, 1, 12, 16
};
static int dbl_flags[MAX_ATTEMPTS] = {
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
};
#elif defined(TOGL_WGL)
HWND hwnd, parentWin;
int pixelformat;
HANDLE hInstance;
WNDCLASS ToglClass;
PIXELFORMATDESCRIPTOR pfd;
XVisualInfo VisInf;
#elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
GLint attribs[20];
int na;
AGLPixelFormat fmt;
XVisualInfo VisInf;
#endif /* TOGL_X11 */
dpy = Tk_Display(togl->TkWin);
#if defined(TOGL_X11)
/* Make sure OpenGL's GLX extension supported */
if (!glXQueryExtension(dpy, &dummy, &dummy)) {
Tcl_SetResult(togl->Interp,
TCL_STUPID "Togl: X server has no OpenGL GLX extension",
TCL_STATIC);
return DUMMY_WINDOW;
}
if (togl->ShareContext && FindTogl(togl->ShareContext)) {
/* share OpenGL context with existing Togl widget */
Togl *shareWith = FindTogl(togl->ShareContext);
assert(shareWith != NULL);
assert(shareWith->GlCtx != NULL);
togl->GlCtx = shareWith->GlCtx;
togl->VisInfo = shareWith->VisInfo;
visinfo = togl->VisInfo;
} else {
if (togl->PixelFormat) {
XVisualInfo template;
int count = 1;
template.visualid = togl->PixelFormat;
visinfo = XGetVisualInfo(dpy, VisualIDMask, &template, &count);
if (visinfo == NULL) {
Tcl_SetResult(togl->Interp,
TCL_STUPID "Togl: couldn't choose pixel format",
TCL_STATIC);
return DUMMY_WINDOW;
}
/* fill in flags normally passed in that affect behavior */
(void) glXGetConfig(dpy, visinfo, GLX_RGBA, &togl->RgbaFlag);
(void) glXGetConfig(dpy, visinfo, GLX_DOUBLEBUFFER,
&togl->DoubleFlag);
(void) glXGetConfig(dpy, visinfo, GLX_STEREO, &togl->StereoFlag);
} else {
int attempt;
/* It may take a few tries to get a visual */
for (attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
attrib_count = 0;
attrib_list[attrib_count++] = GLX_USE_GL;
if (togl->RgbaFlag) {
/* RGB[A] mode */
attrib_list[attrib_count++] = GLX_RGBA;
attrib_list[attrib_count++] = GLX_RED_SIZE;
attrib_list[attrib_count++] = togl->RgbaRed;
attrib_list[attrib_count++] = GLX_GREEN_SIZE;
attrib_list[attrib_count++] = togl->RgbaGreen;
attrib_list[attrib_count++] = GLX_BLUE_SIZE;
attrib_list[attrib_count++] = togl->RgbaBlue;
if (togl->AlphaFlag) {
attrib_list[attrib_count++] = GLX_ALPHA_SIZE;
attrib_list[attrib_count++] = togl->AlphaSize;
}
/* for EPS Output */
if (togl->EpsRedMap)
free(togl->EpsRedMap);
if (togl->EpsGreenMap)
free(togl->EpsGreenMap);
if (togl->EpsBlueMap)
free(togl->EpsBlueMap);
togl->EpsRedMap = togl->EpsGreenMap = togl->EpsBlueMap =
NULL;
togl->EpsMapSize = 0;
} else {
/* Color index mode */
int depth;
attrib_list[attrib_count++] = GLX_BUFFER_SIZE;
depth = ci_depths[attempt];
attrib_list[attrib_count++] = depth;
}
if (togl->DepthFlag) {
attrib_list[attrib_count++] = GLX_DEPTH_SIZE;
attrib_list[attrib_count++] = togl->DepthSize;
}
if (togl->DoubleFlag || dbl_flags[attempt]) {
attrib_list[attrib_count++] = GLX_DOUBLEBUFFER;
}
if (togl->StencilFlag) {
attrib_list[attrib_count++] = GLX_STENCIL_SIZE;
attrib_list[attrib_count++] = togl->StencilSize;
}
if (togl->AccumFlag) {
attrib_list[attrib_count++] = GLX_ACCUM_RED_SIZE;
attrib_list[attrib_count++] = togl->AccumRed;
attrib_list[attrib_count++] = GLX_ACCUM_GREEN_SIZE;
attrib_list[attrib_count++] = togl->AccumGreen;
attrib_list[attrib_count++] = GLX_ACCUM_BLUE_SIZE;
attrib_list[attrib_count++] = togl->AccumBlue;
if (togl->AlphaFlag) {
attrib_list[attrib_count++] = GLX_ACCUM_ALPHA_SIZE;
attrib_list[attrib_count++] = togl->AccumAlpha;
}
}
if (togl->AuxNumber != 0) {
attrib_list[attrib_count++] = GLX_AUX_BUFFERS;
attrib_list[attrib_count++] = togl->AuxNumber;
}
if (togl->Indirect) {
directCtx = False;
}
if (togl->StereoFlag) {
attrib_list[attrib_count++] = GLX_STEREO;
}
attrib_list[attrib_count++] = None;
visinfo = glXChooseVisual(dpy, Tk_ScreenNumber(togl->TkWin),
attrib_list);
if (visinfo) {
/* found a GLX visual! */
break;
}
}
togl->VisInfo = visinfo;
if (visinfo == NULL) {
Tcl_SetResult(togl->Interp,
TCL_STUPID "Togl: couldn't get visual", TCL_STATIC);
return DUMMY_WINDOW;
}
/*
* Create a new OpenGL rendering context.
*/
if (togl->ShareList) {
/* share display lists with existing togl widget */
Togl *shareWith = FindTogl(togl->ShareList);
GLXContext shareCtx;
if (shareWith)
shareCtx = shareWith->GlCtx;
else
shareCtx = None;
togl->GlCtx =
glXCreateContext(dpy, visinfo, shareCtx, directCtx);
} else {
/* don't share display lists */
togl->GlCtx = glXCreateContext(dpy, visinfo, None, directCtx);
}
if (togl->GlCtx == NULL) {
Tcl_SetResult(togl->Interp,
TCL_STUPID "could not create rendering context",
TCL_STATIC);
return DUMMY_WINDOW;
}
}
}
#endif /* TOGL_X11 */
#ifdef TOGL_WGL
parentWin = Tk_GetHWND(parent);
hInstance = Tk_GetHINSTANCE();
if (!ToglClassInitialized) {
ToglClassInitialized = True;
ToglClass.style = CS_HREDRAW | CS_VREDRAW;
ToglClass.cbClsExtra = 0;
ToglClass.cbWndExtra = 4; /* to save struct Togl* */
ToglClass.hInstance = hInstance;
ToglClass.hbrBackground = NULL;
ToglClass.lpszMenuName = NULL;
ToglClass.lpszClassName = TOGL_CLASS_NAME;
ToglClass.lpfnWndProc = Win32WinProc;
ToglClass.hIcon = NULL;
ToglClass.hCursor = NULL;
if (!RegisterClass(&ToglClass)) {
Tcl_SetResult(togl->Interp,
TCL_STUPID "unable register Togl window class", TCL_STATIC);
return DUMMY_WINDOW;
}
}
hwnd = CreateWindow(TOGL_CLASS_NAME, NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0,
togl->Width, togl->Height, parentWin, NULL, hInstance, NULL);
SetWindowLong(hwnd, 0, (LONG) togl);
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
togl->tglGLHdc = GetDC(hwnd);
pfd.nSize = sizeof (PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
if (togl->DoubleFlag) {
pfd.dwFlags |= PFD_DOUBLEBUFFER;
}
/* The stereo flag is not supported in the current generic OpenGL
* implementation, but may be supported by specific hardware devices. */
if (togl->StereoFlag) {
pfd.dwFlags |= PFD_STEREO;
}
if (togl->PixelFormat) {
pixelformat = togl->PixelFormat;
} else {
pfd.cColorBits = togl->RgbaRed + togl->RgbaGreen + togl->RgbaBlue;
pfd.iPixelType = togl->RgbaFlag ? PFD_TYPE_RGBA : PFD_TYPE_COLORINDEX;
/* Alpha bitplanes are not supported in the current generic OpenGL
* implementation, but may be supported by specific hardware devices. */
pfd.cAlphaBits = togl->AlphaFlag ? togl->AlphaSize : 0;
pfd.cAccumBits = togl->AccumFlag ? (togl->AccumRed + togl->AccumGreen +
togl->AccumBlue + togl->AccumAlpha) : 0;
pfd.cDepthBits = togl->DepthFlag ? togl->DepthSize : 0;
pfd.cStencilBits = togl->StencilFlag ? togl->StencilSize : 0;
/* Auxiliary buffers are not supported in the current generic OpenGL
* implementation, but may be supported by specific hardware devices. */
pfd.cAuxBuffers = togl->AuxNumber;
pfd.iLayerType = PFD_MAIN_PLANE;
if ((pixelformat = ChoosePixelFormat(togl->tglGLHdc, &pfd)) == 0) {
Tcl_SetResult(togl->Interp,
TCL_STUPID "Togl: couldn't choose pixel format",
TCL_STATIC);
return DUMMY_WINDOW;
}
}
if (SetPixelFormat(togl->tglGLHdc, pixelformat, &pfd) == FALSE) {
Tcl_SetResult(togl->Interp,
TCL_STUPID "Togl: couldn't choose pixel format", TCL_STATIC);
return DUMMY_WINDOW;
}
/* Get the actual pixel format */
DescribePixelFormat(togl->tglGLHdc, pixelformat, sizeof (pfd), &pfd);
if (togl->PixelFormat) {
/* fill in flags normally passed in that affect behavior */
togl->RgbaFlag = pfd.iPixelType == PFD_TYPE_RGBA;
togl->DoubleFlag = pfd.cDepthBits > 0;
togl->StereoFlag = (pfd.dwFlags & PFD_STEREO) != 0;
// TODO: set depth flag, and more
} else if (togl->StereoFlag && (pfd.dwFlags & PFD_STEREO) == 0) {
Tcl_SetResult(togl->Interp,
TCL_STUPID "Togl: couldn't choose stereo pixel format",
TCL_STATIC);
return DUMMY_WINDOW;
}
if (togl->ShareContext && FindTogl(togl->ShareContext)) {
/* share OpenGL context with existing Togl widget */
Togl *shareWith = FindTogl(togl->ShareContext);
assert(shareWith);
assert(shareWith->tglGLHglrc);
togl->tglGLHglrc = shareWith->tglGLHglrc;
togl->VisInfo = shareWith->VisInfo;
visinfo = togl->VisInfo;
} else {
/*
* Create a new OpenGL rendering context. And check to share lists.
*/
togl->tglGLHglrc = wglCreateContext(togl->tglGLHdc);
if (togl->ShareList) {
/* share display lists with existing togl widget */
Togl *shareWith = FindTogl(togl->ShareList);
if (shareWith)
wglShareLists(shareWith->tglGLHglrc, togl->tglGLHglrc);
}
if (!togl->tglGLHglrc) {
Tcl_SetResult(togl->Interp,
TCL_STUPID "could not create rendering context",
TCL_STATIC);
return DUMMY_WINDOW;
}
/* Just for portability, define the simplest visinfo */
visinfo = &VisInf;
visinfo->visual = DefaultVisual(dpy, DefaultScreen(dpy));
visinfo->depth = visinfo->visual->bits_per_rgb;
togl->VisInfo = visinfo;
}
#endif /* TOGL_WGL */
/*
* find a colormap
*/
scrnum = Tk_ScreenNumber(togl->TkWin);
if (togl->RgbaFlag) {
/* Colormap for RGB mode */
#if defined(TOGL_X11)
cmap = get_rgb_colormap(dpy, scrnum, visinfo, togl->TkWin);
#elif defined(TOGL_WGL)
if (pfd.dwFlags & PFD_NEED_PALETTE) {
cmap = Win32CreateRgbColormap(pfd);
} else {
cmap = DefaultColormap(dpy, scrnum);
}
/* for EPS Output */
if (togl->EpsRedMap)
free(togl->EpsRedMap);
if (togl->EpsGreenMap)
free(togl->EpsGreenMap);
if (togl->EpsBlueMap)
free(togl->EpsBlueMap);
togl->EpsRedMap = togl->EpsGreenMap = togl->EpsBlueMap = NULL;
togl->EpsMapSize = 0;
#elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
cmap = DefaultColormap(dpy, scrnum);
/* for EPS Output */
if (togl->EpsRedMap)
free(togl->EpsRedMap);
if (togl->EpsGreenMap)
free(togl->EpsGreenMap);
if (togl->EpsBlueMap)
free(togl->EpsBlueMap);
togl->EpsRedMap = togl->EpsGreenMap = togl->EpsBlueMap = NULL;
togl->EpsMapSize = 0;
#endif /* TOGL_X11 */
} else {
/* Colormap for CI mode */
#ifdef TOGL_WGL
togl->CiColormapSize = 1 << pfd.cColorBits;
togl->CiColormapSize = togl->CiColormapSize < MAX_CI_COLORMAP_SIZE ?
togl->CiColormapSize : MAX_CI_COLORMAP_SIZE;
#endif /* TOGL_WGL */
if (togl->PrivateCmapFlag) {
/* need read/write colormap so user can store own color entries */
#if defined(TOGL_X11)
cmap = XCreateColormap(dpy, XRootWindow(dpy, visinfo->screen),
visinfo->visual, AllocAll);
#elif defined(TOGL_WGL)
cmap = Win32CreateCiColormap(togl);
#elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
/* need to figure out how to do this correctly on Mac... */
cmap = DefaultColormap(dpy, scrnum);
#endif /* TOGL_X11 */
} else {
if (visinfo->visual == DefaultVisual(dpy, scrnum)) {
/* share default/root colormap */
cmap = Tk_Colormap(togl->TkWin);
} else {
/* make a new read-only colormap */
cmap = XCreateColormap(dpy, XRootWindow(dpy, visinfo->screen),
visinfo->visual, AllocNone);
}
}
}
#if !defined(TOGL_AGL)
/* Make sure Tk knows to switch to the new colormap when the cursor is over
* this window when running in color index mode. */
(void) Tk_SetWindowVisual(togl->TkWin, visinfo->visual, visinfo->depth,
cmap);
#endif
#ifdef TOGL_WGL
/* Install the colormap */
SelectPalette(togl->tglGLHdc, ((TkWinColormap *) cmap)->palette, TRUE);
RealizePalette(togl->tglGLHdc);
#endif /* TOGL_WGL */
#if defined(TOGL_X11)
swa.colormap = cmap;
swa.border_pixel = 0;
swa.event_mask = ALL_EVENTS_MASK;
window = XCreateWindow(dpy, parent,
0, 0, togl->Width, togl->Height,
0, visinfo->depth,
InputOutput, visinfo->visual,
CWBorderPixel | CWColormap | CWEventMask, &swa);
/* Make sure window manager installs our colormap */
(void) XSetWMColormapWindows(dpy, window, &window, 1);
#elif defined(TOGL_WGL)
window = Tk_AttachHWND(togl->TkWin, hwnd);
#elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
{
TkWindow *winPtr = (TkWindow *) togl->TkWin;
window = TkpMakeWindow(winPtr, parent);
}
#endif /* TOGL_X11 */
#ifdef USE_OVERLAY
if (togl->OverlayFlag) {
if (SetupOverlay(togl) == TCL_ERROR) {
fprintf(stderr, "Warning: couldn't setup overlay.\n");
togl->OverlayFlag = False;
}
}
#endif /* USE_OVERLAY */
/* Request the X window to be displayed */
(void) XMapWindow(dpy, window);
#if defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
if (togl->ShareContext && FindTogl(togl->ShareContext)) {
/* share OpenGL context with existing Togl widget */
Togl *shareWith = FindTogl(togl->ShareContext);
assert(shareWith);
assert(shareWith->aglCtx);
togl->aglCtx = shareWith->aglCtx;
togl->VisInfo = shareWith->VisInfo;
visinfo = togl->VisInfo;
} else {
AGLContext shareCtx = NULL;
if (togl->PixelFormat) {
/* fill in RgbaFlag, DoubleFlag, and StereoFlag */
fmt = (AGLPixelFormat) togl->PixelFormat;
GLint has_rgba, has_doublebuf, has_stereo;
if (aglDescribePixelFormat(fmt, AGL_RGBA, &has_rgba) &&
aglDescribePixelFormat(fmt, AGL_DOUBLEBUFFER,
&has_doublebuf)
&& aglDescribePixelFormat(fmt, AGL_STEREO, &has_stereo)) {
togl->RgbaFlag = (has_rgba ? True : False);
togl->DoubleFlag = (has_doublebuf ? True : False);
togl->StereoFlag = (has_stereo ? True : False);
} else {
Tcl_SetResult(togl->Interp,
TCL_STUPID
"Togl: failed querying pixel format attributes",
TCL_STATIC);
return DUMMY_WINDOW;
}
} else {
/* Need to do this after mapping window, so MacDrawable structure
* is more completely filled in */
na = 0;
attribs[na++] = AGL_MINIMUM_POLICY;
attribs[na++] = AGL_ROBUST;
if (togl->RgbaFlag) {
/* RGB[A] mode */
attribs[na++] = AGL_RGBA;
attribs[na++] = AGL_RED_SIZE;
attribs[na++] = togl->RgbaRed;
attribs[na++] = AGL_GREEN_SIZE;
attribs[na++] = togl->RgbaGreen;
attribs[na++] = AGL_BLUE_SIZE;
attribs[na++] = togl->RgbaBlue;
if (togl->AlphaFlag) {
attribs[na++] = AGL_ALPHA_SIZE;
attribs[na++] = togl->AlphaSize;
}
} else {
/* Color index mode */
attribs[na++] = AGL_BUFFER_SIZE;
attribs[na++] = 8;
}
if (togl->DepthFlag) {
attribs[na++] = AGL_DEPTH_SIZE;
attribs[na++] = togl->DepthSize;
}
if (togl->DoubleFlag) {
attribs[na++] = AGL_DOUBLEBUFFER;
}
if (togl->StencilFlag) {
attribs[na++] = AGL_STENCIL_SIZE;
attribs[na++] = togl->StencilSize;
}
if (togl->AccumFlag) {
attribs[na++] = AGL_ACCUM_RED_SIZE;
attribs[na++] = togl->AccumRed;
attribs[na++] = AGL_ACCUM_GREEN_SIZE;
attribs[na++] = togl->AccumGreen;
attribs[na++] = AGL_ACCUM_BLUE_SIZE;
attribs[na++] = togl->AccumBlue;
if (togl->AlphaFlag) {
attribs[na++] = AGL_ACCUM_ALPHA_SIZE;
attribs[na++] = togl->AccumAlpha;
}
}
if (togl->AuxNumber != 0) {
attribs[na++] = AGL_AUX_BUFFERS;
attribs[na++] = togl->AuxNumber;
}
attribs[na++] = AGL_NONE;
if ((fmt = aglChoosePixelFormat(NULL, 0, attribs)) == NULL) {
Tcl_SetResult(togl->Interp,
TCL_STUPID "Togl: couldn't choose pixel format",
TCL_STATIC);
return DUMMY_WINDOW;
}
}
/*
* Check whether to share lists.
*/
if (togl->ShareList) {
/* share display lists with existing togl widget */
Togl *shareWith = FindTogl(togl->ShareList);
if (shareWith)
shareCtx = shareWith->aglCtx;
}
if ((togl->aglCtx = aglCreateContext(fmt, shareCtx)) == NULL) {
GLenum err = aglGetError();
aglDestroyPixelFormat(fmt);
if (err == AGL_BAD_MATCH)
Tcl_SetResult(togl->Interp,
TCL_STUPID
"Togl: couldn't create context, shared context doesn't match",
TCL_STATIC);
else if (err == AGL_BAD_CONTEXT)
Tcl_SetResult(togl->Interp,
TCL_STUPID
"Togl: couldn't create context, bad shared context",
TCL_STATIC);
else if (err == AGL_BAD_PIXELFMT)
Tcl_SetResult(togl->Interp,
TCL_STUPID
"Togl: couldn't create context, bad pixel format",
TCL_STATIC);
else
Tcl_SetResult(togl->Interp,
TCL_STUPID
"Togl: couldn't create context, unknown reason",
TCL_STATIC);
return DUMMY_WINDOW;
}
aglDestroyPixelFormat(fmt);
if (!aglSetDrawable(togl->aglCtx,
# if defined(TOGL_AGL)
((MacDrawable *) (window))->toplevel->grafPtr
# else
((MacDrawable *) (window))->toplevel->portPtr
# endif
)) {
aglDestroyContext(togl->aglCtx);
Tcl_SetResult(togl->Interp,
TCL_STUPID "Togl: couldn't set drawable", TCL_STATIC);
return DUMMY_WINDOW;
}
/* Just for portability, define the simplest visinfo */
visinfo = &VisInf;
visinfo->visual = DefaultVisual(dpy, DefaultScreen(dpy));
visinfo->depth = visinfo->visual->bits_per_rgb;
Tk_SetWindowVisual(togl->TkWin, visinfo->visual, visinfo->depth, cmap);
}
#endif /* TOGL_AGL_CLASSIC || TOGL_AGL */
#if defined(TOGL_X11)
/* Check for a single/double buffering snafu */
{
int dbl_flag;
if (glXGetConfig(dpy, visinfo, GLX_DOUBLEBUFFER, &dbl_flag)) {
if (!togl->DoubleFlag && dbl_flag) {
/* We requested single buffering but had to accept a */
/* double buffered visual. Set the GL draw buffer to */
/* be the front buffer to simulate single buffering. */
glDrawBuffer(GL_FRONT);
}
}
}
#endif /* TOGL_X11 */
/* for EPS Output */
if (!togl->RgbaFlag) {
int index_size;
#if defined(TOGL_X11) || defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
GLint index_bits;
glGetIntegerv(GL_INDEX_BITS, &index_bits);
index_size = 1 << index_bits;
#elif defined(TOGL_WGL)
index_size = togl->CiColormapSize;
#endif /* TOGL_X11 */
if (togl->EpsMapSize != index_size) {
if (togl->EpsRedMap)
free(togl->EpsRedMap);
if (togl->EpsGreenMap)
free(togl->EpsGreenMap);
if (togl->EpsBlueMap)
free(togl->EpsBlueMap);
togl->EpsMapSize = index_size;
togl->EpsRedMap = (GLfloat *) calloc(index_size, sizeof (GLfloat));
togl->EpsGreenMap =
(GLfloat *) calloc(index_size, sizeof (GLfloat));
togl->EpsBlueMap = (GLfloat *) calloc(index_size, sizeof (GLfloat));
}
}
return window;
}
/*
* Togl_WorldChanged
*
* Add support for setgrid option.
*/
static void
Togl_WorldChanged(ClientData instanceData)
{
Togl *togl = (Togl *) instanceData;
Tk_GeometryRequest(togl->TkWin, togl->Width, togl->Height);
Tk_SetInternalBorder(togl->TkWin, 0);
if (togl->SetGrid > 0) {
Tk_SetGrid(togl->TkWin, togl->Width / togl->SetGrid,
togl->Height / togl->SetGrid, togl->SetGrid, togl->SetGrid);
} else {
Tk_UnsetGrid(togl->TkWin);
}
}
/*
* ToglCmdDeletedProc
*
* This procedure is invoked when a widget command is deleted. If
* the widget isn't already in the process of being destroyed,
* this command destroys it.
*
* Results:
* None.
*
* Side effects:
* The widget is destroyed.
*
*----------------------------------------------------------------------
*/
static void
ToglCmdDeletedProc(ClientData clientData)
{
Togl *togl = (Togl *) clientData;
Tk_Window tkwin = togl->TkWin;
/*
* This procedure could be invoked either because the window was
* destroyed and the command was then deleted (in which case tkwin
* is NULL) or because the command was deleted, and then this procedure
* destroys the widget.
*/
if (togl && tkwin) {
Tk_DeleteEventHandler(tkwin,
ExposureMask | StructureNotifyMask,
Togl_EventProc, (ClientData) togl);
}
#if defined(TOGL_X11)
if (togl->GlCtx) {
if (FindToglWithSameContext(togl) == NULL)
glXDestroyContext(togl->display, togl->GlCtx);
togl->GlCtx = NULL;
}
# ifdef USE_OVERLAY
if (togl->OverlayCtx) {
Tcl_HashEntry *entryPtr;
TkWindow *winPtr = (TkWindow *) togl->TkWin;
if (winPtr) {
entryPtr = Tcl_FindHashEntry(&winPtr->dispPtr->winTable,
(char *) togl->OverlayWindow);
Tcl_DeleteHashEntry(entryPtr);
}
if (FindToglWithSameOverlayContext(togl) == NULL)
glXDestroyContext(togl->display, togl->OverlayCtx);
togl->OverlayCtx = NULL;
}
# endif /* USE_OVERLAY */
#endif
/* TODO: delete contexts on other platforms */
if (tkwin != NULL) {
if (togl->SetGrid > 0) {
Tk_UnsetGrid(tkwin);
}
togl->TkWin = NULL;
Tk_DestroyWindow(tkwin);
}
}
/*
* Togl_Destroy
*
* Gets called when an Togl widget is destroyed.
*/
static void
Togl_Destroy(
#if (TK_MAJOR_VERSION * 100 + TK_MINOR_VERSION) >= 401
char *
#else
ClientData
#endif
clientData)
{
Togl *togl = (Togl *) clientData;
Tk_FreeOptions(configSpecs, WIDGREC togl, togl->display, 0);
#ifndef NO_TK_CURSOR
if (togl->Cursor != None) {
Tk_FreeCursor(togl->display, togl->Cursor);
}
#endif
if (togl->DestroyProc) {
togl->DestroyProc(togl);
}
/* remove from linked list */
RemoveFromList(togl);
#if !defined(TOGL_WGL)
/* TODO: why not on Windows? */
free(togl);
#endif
}
/*
* This gets called to handle Togl window configuration events
*/
static void
Togl_EventProc(ClientData clientData, XEvent *eventPtr)
{
Togl *togl = (Togl *) clientData;
switch (eventPtr->type) {
case Expose:
if (eventPtr->xexpose.count == 0) {
if (!togl->UpdatePending
&& eventPtr->xexpose.window == Tk_WindowId(togl->TkWin)) {
Togl_PostRedisplay(togl);
}
#if defined(TOGL_X11)
if (!togl->OverlayUpdatePending && togl->OverlayFlag
&& togl->OverlayIsMapped
&& eventPtr->xexpose.window == togl->OverlayWindow) {
Togl_PostOverlayRedisplay(togl);
}
#endif /* TOGL_X11 */
}
break;
case ConfigureNotify:
if (togl->Width != Tk_Width(togl->TkWin)
|| togl->Height != Tk_Height(togl->TkWin)) {
togl->Width = Tk_Width(togl->TkWin);
togl->Height = Tk_Height(togl->TkWin);
(void) XResizeWindow(Tk_Display(togl->TkWin),
Tk_WindowId(togl->TkWin), togl->Width, togl->Height);
#if defined(TOGL_X11)
if (togl->OverlayFlag) {
(void) XResizeWindow(Tk_Display(togl->TkWin),
togl->OverlayWindow, togl->Width, togl->Height);
(void) XRaiseWindow(Tk_Display(togl->TkWin),
togl->OverlayWindow);
}
#endif /* TOGL_X11 */
Togl_MakeCurrent(togl);
if (togl->ReshapeProc) {
togl->ReshapeProc(togl);
} else {
glViewport(0, 0, togl->Width, togl->Height);
#if defined(TOGL_X11)
if (togl->OverlayFlag) {
Togl_UseLayer(togl, TOGL_OVERLAY);
glViewport(0, 0, togl->Width, togl->Height);
Togl_UseLayer(togl, TOGL_NORMAL);
}
#endif /* TOGL_X11 */
}
#ifndef TOGL_WGL /* causes double redisplay on Win32 platform */
Togl_PostRedisplay(togl);
#endif /* TOGL_WGL */
}
break;
case MapNotify:
#if defined(TOGL_AGL)
{
/*
* See comment for the UnmapNotify case below.
*/
AGLDrawable d = TkMacOSXGetDrawablePort(Tk_WindowId(togl->TkWin));
aglSetDrawable(togl->aglCtx, d);
}
#endif /* TOGL_AGL */
break;
case UnmapNotify:
#if defined(TOGL_AGL)
{
/*
* For Mac OS X Aqua, Tk subwindows are not implemented as
* separate Aqua windows. They are just different regions of
* a single Aqua window. To unmap them they are just not drawn.
* Have to disconnect the AGL context otherwise they will continue
* to be displayed directly by Aqua.
*/
aglSetDrawable(togl->aglCtx, NULL);
}
#endif /* TOGL_AGL */
break;
case DestroyNotify:
if (togl->TkWin != NULL) {
if (togl->SetGrid > 0) {
Tk_UnsetGrid(togl->TkWin);
}
togl->TkWin = NULL;
#if (TCL_MAJOR_VERSION * 100 + TCL_MINOR_VERSION) >= 800
/* This function new in Tcl/Tk 8.0 */
(void) Tcl_DeleteCommandFromToken(togl->Interp, togl->widgetCmd);
#endif
}
if (togl->TimerProc != NULL) {
#if (TK_MAJOR_VERSION * 100 + TK_MINOR_VERSION) >= 401
Tcl_DeleteTimerHandler(togl->timerHandler);
#else
Tk_DeleteTimerHandler(togl->timerHandler);
#endif
}
if (togl->UpdatePending) {
#if (TCL_MAJOR_VERSION * 100 + TCL_MINOR_VERSION) >= 705
Tcl_CancelIdleCall(Togl_Render, (ClientData) togl);
#else
Tk_CancelIdleCall(Togl_Render, (ClientData) togl);
#endif
}
#if (TK_MAJOR_VERSION * 100 + TK_MINOR_VERSION) >= 401
Tcl_EventuallyFree((ClientData) togl, Togl_Destroy);
#else
Tk_EventuallyFree((ClientData) togl, Togl_Destroy);
#endif
break;
default:
/* nothing */
;
}
}
void
Togl_PostRedisplay(Togl *togl)
{
if (!togl->UpdatePending) {
togl->UpdatePending = True;
Tk_DoWhenIdle(Togl_Render, (ClientData) togl);
}
}
void
Togl_SwapBuffers(const Togl *togl)
{
if (togl->DoubleFlag) {
#if defined(TOGL_WGL)
int res = SwapBuffers(togl->tglGLHdc);
assert(res == TRUE);
#elif defined(TOGL_X11)
glXSwapBuffers(Tk_Display(togl->TkWin), Tk_WindowId(togl->TkWin));
#elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
aglSwapBuffers(togl->aglCtx);
#endif /* TOGL_WGL */
} else {
glFlush();
}
}
const char *
Togl_Ident(const Togl *togl)
{
return togl->Ident;
}
int
Togl_Width(const Togl *togl)
{
return togl->Width;
}
int
Togl_Height(const Togl *togl)
{
return togl->Height;
}
Tcl_Interp *
Togl_Interp(const Togl *togl)
{
return togl->Interp;
}
Tk_Window
Togl_TkWin(const Togl *togl)
{
return togl->TkWin;
}
#if defined(TOGL_X11)
/*
* A replacement for XAllocColor. This function should never
* fail to allocate a color. When XAllocColor fails, we return
* the nearest matching color. If we have to allocate many colors
* this function isn't too efficient; the XQueryColors() could be
* done just once.
* Written by Michael Pichler, Brian Paul, Mark Kilgard
* Input: dpy - X display
* cmap - X colormap
* cmapSize - size of colormap
* In/Out: color - the XColor struct
* Output: exact - 1=exact color match, 0=closest match
*/
static void
noFaultXAllocColor(Display *dpy, Colormap cmap, int cmapSize,
XColor *color, int *exact)
{
XColor *ctable, subColor;
int i, bestmatch;
double mindist; /* 3*2^16^2 exceeds long int precision. */
/* First try just using XAllocColor. */
if (XAllocColor(dpy, cmap, color)) {
*exact = 1;
return;
}
/* Retrieve color table entries. */
/* XXX alloca candidate. */
ctable = (XColor *) malloc(cmapSize * sizeof (XColor));
for (i = 0; i < cmapSize; i++) {
ctable[i].pixel = i;
}
(void) XQueryColors(dpy, cmap, ctable, cmapSize);
/* Find best match. */
bestmatch = -1;
mindist = 0;
for (i = 0; i < cmapSize; i++) {
double dr = (double) color->red - (double) ctable[i].red;
double dg = (double) color->green - (double) ctable[i].green;
double db = (double) color->blue - (double) ctable[i].blue;
double dist = dr * dr + dg * dg + db * db;
if (bestmatch < 0 || dist < mindist) {
bestmatch = i;
mindist = dist;
}
}
/* Return result. */
subColor.red = ctable[bestmatch].red;
subColor.green = ctable[bestmatch].green;
subColor.blue = ctable[bestmatch].blue;
free(ctable);
/* Try to allocate the closest match color. This should only fail if the
* cell is read/write. Otherwise, we're incrementing the cell's reference
* count. */
if (!XAllocColor(dpy, cmap, &subColor)) {
/* do this to work around a problem reported by Frank Ortega */
subColor.pixel = (unsigned long) bestmatch;
subColor.red = ctable[bestmatch].red;
subColor.green = ctable[bestmatch].green;
subColor.blue = ctable[bestmatch].blue;
subColor.flags = DoRed | DoGreen | DoBlue;
}
*color = subColor;
}
#elif defined(TOGL_WGL)
static UINT
Win32AllocColor(const Togl *togl, float red, float green, float blue)
{
/* Modified version of XAllocColor emulation of Tk. - returns index,
* instead of color itself - allocates logical palette entry even for
* non-palette devices */
TkWinColormap *cmap = (TkWinColormap *) Tk_Colormap(togl->TkWin);
UINT index;
COLORREF newColor, closeColor;
PALETTEENTRY entry, closeEntry;
int new, refCount;
Tcl_HashEntry *entryPtr;
entry.peRed = (unsigned char) (red * 255 + .5);
entry.peGreen = (unsigned char) (green * 255 + .5);
entry.peBlue = (unsigned char) (blue * 255 + .5);
entry.peFlags = 0;
/*
* Find the nearest existing palette entry.
*/
newColor = RGB(entry.peRed, entry.peGreen, entry.peBlue);
index = GetNearestPaletteIndex(cmap->palette, newColor);
GetPaletteEntries(cmap->palette, index, 1, &closeEntry);
closeColor = RGB(closeEntry.peRed, closeEntry.peGreen, closeEntry.peBlue);
/*
* If this is not a duplicate and colormap is not full, allocate a new entry.
*/
if (newColor != closeColor) {
if (cmap->size == (unsigned int) togl->CiColormapSize) {
entry = closeEntry;
} else {
cmap->size++;
ResizePalette(cmap->palette, cmap->size);
index = cmap->size - 1;
SetPaletteEntries(cmap->palette, index, 1, &entry);
SelectPalette(togl->tglGLHdc, cmap->palette, TRUE);
RealizePalette(togl->tglGLHdc);
}
}
newColor = PALETTERGB(entry.peRed, entry.peGreen, entry.peBlue);
entryPtr = Tcl_CreateHashEntry(&cmap->refCounts, (char *) newColor, &new);
if (new) {
refCount = 1;
} else {
refCount = ((int) Tcl_GetHashValue(entryPtr)) + 1;
}
Tcl_SetHashValue(entryPtr, (ClientData) refCount);
/* for EPS output */
togl->EpsRedMap[index] = (GLfloat) (entry.peRed / 255.0);
togl->EpsGreenMap[index] = (GLfloat) (entry.peGreen / 255.0);
togl->EpsBlueMap[index] = (GLfloat) (entry.peBlue / 255.0);
return index;
}
static void
Win32FreeColor(const Togl *togl, unsigned long index)
{
TkWinColormap *cmap = (TkWinColormap *) Tk_Colormap(togl->TkWin);
COLORREF cref;
UINT count, refCount;
PALETTEENTRY entry, *entries;
Tcl_HashEntry *entryPtr;
if (index >= cmap->size) {
panic("Tried to free a color that isn't allocated.");
}
GetPaletteEntries(cmap->palette, index, 1, &entry);
cref = PALETTERGB(entry.peRed, entry.peGreen, entry.peBlue);
entryPtr = Tcl_FindHashEntry(&cmap->refCounts, (char *) cref);
if (!entryPtr) {
panic("Tried to free a color that isn't allocated.");
}
refCount = (int) Tcl_GetHashValue(entryPtr) - 1;
if (refCount == 0) {
count = cmap->size - index;
entries = (PALETTEENTRY *) ckalloc(sizeof (PALETTEENTRY) * count);
GetPaletteEntries(cmap->palette, index + 1, count, entries);
SetPaletteEntries(cmap->palette, index, count, entries);
SelectPalette(togl->tglGLHdc, cmap->palette, TRUE);
RealizePalette(togl->tglGLHdc);
ckfree((char *) entries);
cmap->size--;
Tcl_DeleteHashEntry(entryPtr);
} else {
Tcl_SetHashValue(entryPtr, (ClientData) refCount);
}
}
static void
Win32SetColor(const Togl *togl,
unsigned long index, float red, float green, float blue)
{
TkWinColormap *cmap = (TkWinColormap *) Tk_Colormap(togl->TkWin);
PALETTEENTRY entry;
entry.peRed = (unsigned char) (red * 255 + .5);
entry.peGreen = (unsigned char) (green * 255 + .5);
entry.peBlue = (unsigned char) (blue * 255 + .5);
entry.peFlags = 0;
SetPaletteEntries(cmap->palette, index, 1, &entry);
SelectPalette(togl->tglGLHdc, cmap->palette, TRUE);
RealizePalette(togl->tglGLHdc);
/* for EPS output */
togl->EpsRedMap[index] = (GLfloat) (entry.peRed / 255.0);
togl->EpsGreenMap[index] = (GLfloat) (entry.peGreen / 255.0);
togl->EpsBlueMap[index] = (GLfloat) (entry.peBlue / 255.0);
}
#endif /* TOGL_X11 */
unsigned long
Togl_AllocColor(const Togl *togl, float red, float green, float blue)
{
if (togl->RgbaFlag) {
(void) fprintf(stderr,
"Error: Togl_AllocColor illegal in RGBA mode.\n");
return 0;
}
/* TODO: maybe not... */
if (togl->PrivateCmapFlag) {
(void) fprintf(stderr,
"Error: Togl_FreeColor illegal with private colormap\n");
return 0;
}
#if defined(TOGL_X11)
{
XColor xcol;
int exact;
xcol.red = (short) (red * 65535.0);
xcol.green = (short) (green * 65535.0);
xcol.blue = (short) (blue * 65535.0);
noFaultXAllocColor(Tk_Display(togl->TkWin), Tk_Colormap(togl->TkWin),
Tk_Visual(togl->TkWin)->map_entries, &xcol, &exact);
/* for EPS output */
togl->EpsRedMap[xcol.pixel] = (float) xcol.red / 65535.0;
togl->EpsGreenMap[xcol.pixel] = (float) xcol.green / 65535.0;
togl->EpsBlueMap[xcol.pixel] = (float) xcol.blue / 65535.0;
return xcol.pixel;
}
#elif defined(TOGL_WGL)
return Win32AllocColor(togl, red, green, blue);
#elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
/* still need to implement this on Mac... */
return 0;
#endif /* TOGL_X11 */
}
void
Togl_FreeColor(const Togl *togl, unsigned long pixel)
{
if (togl->RgbaFlag) {
(void) fprintf(stderr,
"Error: Togl_AllocColor illegal in RGBA mode.\n");
return;
}
/* TODO: maybe not... */
if (togl->PrivateCmapFlag) {
(void) fprintf(stderr,
"Error: Togl_FreeColor illegal with private colormap\n");
return;
}
#if defined(TOGL_X11)
(void) XFreeColors(Tk_Display(togl->TkWin), Tk_Colormap(togl->TkWin),
&pixel, 1, 0);
#elif defined(TOGL_WGL)
Win32FreeColor(togl, pixel);
#endif /* TOGL_X11 */
}
void
Togl_SetColor(const Togl *togl,
unsigned long index, float red, float green, float blue)
{
if (togl->RgbaFlag) {
(void) fprintf(stderr,
"Error: Togl_AllocColor illegal in RGBA mode.\n");
return;
}
if (!togl->PrivateCmapFlag) {
(void) fprintf(stderr,
"Error: Togl_SetColor requires a private colormap\n");
return;
}
#if defined(TOGL_X11)
{
XColor xcol;
xcol.pixel = index;
xcol.red = (short) (red * 65535.0);
xcol.green = (short) (green * 65535.0);
xcol.blue = (short) (blue * 65535.0);
xcol.flags = DoRed | DoGreen | DoBlue;
(void) XStoreColor(Tk_Display(togl->TkWin), Tk_Colormap(togl->TkWin),
&xcol);
/* for EPS output */
togl->EpsRedMap[xcol.pixel] = (float) xcol.red / 65535.0;
togl->EpsGreenMap[xcol.pixel] = (float) xcol.green / 65535.0;
togl->EpsBlueMap[xcol.pixel] = (float) xcol.blue / 65535.0;
}
#elif defined(TOGL_WGL)
Win32SetColor(togl, index, red, green, blue);
#endif /* TOGL_X11 */
}
#if TOGL_USE_FONTS == 1
# if defined(TOGL_WGL)
# include "tkWinInt.h"
# include "tkFont.h"
/*
* The following structure represents Windows' implementation of a font.
*/
typedef struct WinFont
{
TkFont font; /* Stuff used by generic font package. Must be
* first in structure. */
HFONT hFont; /* Windows information about font. */
HWND hwnd; /* Toplevel window of application that owns
* this font, used for getting HDC. */
int widths[256]; /* Widths of first 256 chars in this font. */
} WinFont;
# endif /* TOGL_WGL */
# define MAX_FONTS 1000
static GLuint ListBase[MAX_FONTS];
static GLuint ListCount[MAX_FONTS];
/*
* Load the named bitmap font as a sequence of bitmaps in a display list.
* fontname may be one of the predefined fonts like TOGL_BITMAP_8_BY_13
* or an X font name, or a Windows font name, etc.
*/
GLuint
Togl_LoadBitmapFont(const Togl *togl, const char *fontname)
{
static Bool FirstTime = True;
# if defined(TOGL_X11)
XFontStruct *fontinfo;
# elif defined(TOGL_WGL)
WinFont *winfont;
HFONT oldFont;
TEXTMETRIC tm;
# endif
/* TOGL_X11 */
int first, last, count;
GLuint fontbase;
const char *name;
/* Initialize the ListBase and ListCount arrays */
if (FirstTime) {
int i;
for (i = 0; i < MAX_FONTS; i++) {
ListBase[i] = ListCount[i] = 0;
}
FirstTime = False;
}
/*
* This method of selecting X fonts according to a TOGL_ font name
* is a kludge. To be fixed when I find time...
*/
if (fontname == TOGL_BITMAP_8_BY_13) {
name = "8x13";
} else if (fontname == TOGL_BITMAP_9_BY_15) {
name = "9x15";
} else if (fontname == TOGL_BITMAP_TIMES_ROMAN_10) {
name = "-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1";
} else if (fontname == TOGL_BITMAP_TIMES_ROMAN_24) {
name = "-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1";
} else if (fontname == TOGL_BITMAP_HELVETICA_10) {
name = "-adobe-helvetica-medium-r-normal--10-100-75-75-p-57-iso8859-1";
} else if (fontname == TOGL_BITMAP_HELVETICA_12) {
name = "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1";
} else if (fontname == TOGL_BITMAP_HELVETICA_18) {
name = "-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1";
} else if (!fontname) {
name = DEFAULT_FONTNAME;
} else {
name = (const char *) fontname;
}
assert(name);
# if defined(TOGL_X11)
fontinfo = (XFontStruct *) XLoadQueryFont(Tk_Display(togl->TkWin), name);
if (!fontinfo) {
return 0;
}
first = fontinfo->min_char_or_byte2;
last = fontinfo->max_char_or_byte2;
# elif defined(TOGL_WGL)
winfont = (WinFont *) Tk_GetFont(togl->Interp, togl->TkWin, name);
if (!winfont) {
return 0;
}
oldFont = SelectObject(togl->tglGLHdc, winfont->hFont);
GetTextMetrics(togl->tglGLHdc, &tm);
first = tm.tmFirstChar;
last = tm.tmLastChar;
# elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
first = 10; /* don't know how to determine font range on
* Mac... */
last = 127;
# endif
/* TOGL_X11 */
count = last - first + 1;
fontbase = glGenLists((GLuint) (last + 1));
if (fontbase == 0) {
# ifdef TOGL_WGL
SelectObject(togl->tglGLHdc, oldFont);
Tk_FreeFont((Tk_Font) winfont);
# endif
/* TOGL_WGL */
return 0;
}
# if defined(TOGL_WGL)
wglUseFontBitmaps(togl->tglGLHdc, first, count, (int) fontbase + first);
SelectObject(togl->tglGLHdc, oldFont);
Tk_FreeFont((Tk_Font) winfont);
# elif defined(TOGL_X11)
glXUseXFont(fontinfo->fid, first, count, (int) fontbase + first);
# elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
aglUseFont(togl->aglCtx, 1, 0, 14, /* for now, only app font, regular
* 14-point */
10, 118, fontbase + first);
# endif
/* Record the list base and number of display lists for
* Togl_UnloadBitmapFont(). */
{
int i;
for (i = 0; i < MAX_FONTS; i++) {
if (ListBase[i] == 0) {
ListBase[i] = fontbase;
ListCount[i] = last + 1;
break;
}
}
}
return fontbase;
}
/*
* Release the display lists which were generated by Togl_LoadBitmapFont().
*/
void
Togl_UnloadBitmapFont(const Togl *togl, GLuint fontbase)
{
int i;
(void) togl;
for (i = 0; i < MAX_FONTS; i++) {
if (ListBase[i] == fontbase) {
glDeleteLists(ListBase[i], ListCount[i]);
ListBase[i] = ListCount[i] = 0;
return;
}
}
}
#endif /* TOGL_USE_FONTS */
/*
* Overlay functions
*/
void
Togl_UseLayer(Togl *togl, int layer)
{
if (!togl->OverlayWindow)
return;
if (layer == TOGL_OVERLAY) {
#if defined(TOGL_WGL)
int res = wglMakeCurrent(togl->tglGLHdc, togl->tglGLOverlayHglrc);
assert(res == TRUE);
#elif defined(TOGL_X11)
(void) glXMakeCurrent(Tk_Display(togl->TkWin),
togl->OverlayWindow, togl->OverlayCtx);
# if defined(__sgi)
if (togl->OldStereoFlag)
oldStereoMakeCurrent(Tk_Display(togl->TkWin),
togl->OverlayWindow, togl->OverlayCtx);
# endif
/* __sgi STEREO */
#endif /* TOGL_WGL */
} else if (layer == TOGL_NORMAL) {
#if defined(TOGL_WGL)
int res = wglMakeCurrent(togl->tglGLHdc, togl->tglGLHglrc);
assert(res == TRUE);
#elif defined(TOGL_X11)
(void) glXMakeCurrent(Tk_Display(togl->TkWin),
Tk_WindowId(togl->TkWin), togl->GlCtx);
# if defined(__sgi)
if (togl->OldStereoFlag)
oldStereoMakeCurrent(Tk_Display(togl->TkWin),
Tk_WindowId(togl->TkWin), togl->GlCtx);
# endif
/* __sgi STEREO */
#endif /* TOGL_WGL */
} else {
/* error */
}
}
void
Togl_ShowOverlay(Togl *togl)
{
#if defined(TOGL_X11) /* not yet implemented on Windows */
if (togl->OverlayWindow) {
(void) XMapWindow(Tk_Display(togl->TkWin), togl->OverlayWindow);
(void) XInstallColormap(Tk_Display(togl->TkWin), togl->OverlayCmap);
togl->OverlayIsMapped = True;
}
#endif /* TOGL_X11 */
}
void
Togl_HideOverlay(Togl *togl)
{
if (togl->OverlayWindow && togl->OverlayIsMapped) {
(void) XUnmapWindow(Tk_Display(togl->TkWin), togl->OverlayWindow);
togl->OverlayIsMapped = False;
}
}
void
Togl_PostOverlayRedisplay(Togl *togl)
{
if (!togl->OverlayUpdatePending
&& togl->OverlayWindow && togl->OverlayDisplayProc) {
Tk_DoWhenIdle(RenderOverlay, (ClientData) togl);
togl->OverlayUpdatePending = True;
}
}
void
Togl_OverlayDisplayFunc(Togl_Callback *proc)
{
DefaultOverlayDisplayProc = proc;
}
int
Togl_ExistsOverlay(const Togl *togl)
{
return togl->OverlayFlag;
}
int
Togl_GetOverlayTransparentValue(const Togl *togl)
{
return togl->OverlayTransparentPixel;
}
int
Togl_IsMappedOverlay(const Togl *togl)
{
return togl->OverlayFlag && togl->OverlayIsMapped;
}
unsigned long
Togl_AllocColorOverlay(const Togl *togl, float red, float green, float blue)
{
#if defined(TOGL_X11) /* not yet implemented on Windows */
if (togl->OverlayFlag && togl->OverlayCmap) {
XColor xcol;
xcol.red = (short) (red * 65535.0);
xcol.green = (short) (green * 65535.0);
xcol.blue = (short) (blue * 65535.0);
if (!XAllocColor(Tk_Display(togl->TkWin), togl->OverlayCmap, &xcol))
return (unsigned long) -1;
return xcol.pixel;
}
#endif /* TOGL_X11 */
return (unsigned long) -1;
}
void
Togl_FreeColorOverlay(const Togl *togl, unsigned long pixel)
{
#if defined(TOGL_X11) /* not yet implemented on Windows */
if (togl->OverlayFlag && togl->OverlayCmap) {
(void) XFreeColors(Tk_Display(togl->TkWin), togl->OverlayCmap, &pixel,
1, 0);
}
#endif /* TOGL_X11 */
}
/*
* User client data
*/
void
Togl_ClientData(ClientData clientData)
{
DefaultClientData = clientData;
}
ClientData
Togl_GetClientData(const Togl *togl)
{
return togl->Client_Data;
}
void
Togl_SetClientData(Togl *togl, ClientData clientData)
{
togl->Client_Data = clientData;
}
/*
* X11-only functions
* Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES)
*/
Display *
Togl_Display(const Togl *togl)
{
return Tk_Display(togl->TkWin);
}
Screen *
Togl_Screen(const Togl *togl)
{
return Tk_Screen(togl->TkWin);
}
int
Togl_ScreenNumber(const Togl *togl)
{
return Tk_ScreenNumber(togl->TkWin);
}
Colormap
Togl_Colormap(const Togl *togl)
{
return Tk_Colormap(togl->TkWin);
}
#ifdef MESA_COLOR_HACK
/*
* Let's know how many free colors do we have
*/
# if 0
static unsigned char rojo[] = { 4, 39, 74, 110, 145, 181, 216, 251 }, verde[] = {
4, 39, 74, 110, 145, 181, 216, 251}, azul[] = {
4, 39, 74, 110, 145, 181, 216, 251};
unsigned char rojo[] = { 4, 36, 72, 109, 145, 182, 218, 251 }, verde[] = {
4, 36, 72, 109, 145, 182, 218, 251}, azul[] = {
4, 36, 72, 109, 145, 182, 218, 251};
azul[] = {
0, 85, 170, 255};
# endif
# define RLEVELS 5
# define GLEVELS 9
# define BLEVELS 5
/* to free dithered_rgb_colormap pixels allocated by Mesa */
static unsigned long *ToglMesaUsedPixelCells = NULL;
static int ToglMesaUsedFreeCells = 0;
static int
get_free_color_cells(Display *display, int screen, Colormap colormap)
{
if (!ToglMesaUsedPixelCells) {
XColor xcol;
int i;
int colorsfailed, ncolors = XDisplayCells(display, screen);
long r, g, b;
ToglMesaUsedPixelCells =
(unsigned long *) calloc(ncolors, sizeof (unsigned long));
/* Allocate X colors and initialize color_table[], red_table[], etc */
/* de Mesa 2.1: xmesa1.c setup_dithered_(...) */
i = colorsfailed = 0;
for (r = 0; r < RLEVELS; r++)
for (g = 0; g < GLEVELS; g++)
for (b = 0; b < BLEVELS; b++) {
int exact;
xcol.red = (r * 65535) / (RLEVELS - 1);
xcol.green = (g * 65535) / (GLEVELS - 1);
xcol.blue = (b * 65535) / (BLEVELS - 1);
noFaultXAllocColor(display, colormap, ncolors,
&xcol, &exact);
ToglMesaUsedPixelCells[i++] = xcol.pixel;
if (!exact) {
colorsfailed++;
}
}
ToglMesaUsedFreeCells = i;
XFreeColors(display, colormap, ToglMesaUsedPixelCells,
ToglMesaUsedFreeCells, 0x00000000);
}
return ToglMesaUsedFreeCells;
}
static void
free_default_color_cells(Display *display, Colormap colormap)
{
if (ToglMesaUsedPixelCells) {
XFreeColors(display, colormap, ToglMesaUsedPixelCells,
ToglMesaUsedFreeCells, 0x00000000);
free(ToglMesaUsedPixelCells);
ToglMesaUsedPixelCells = NULL;
ToglMesaUsedFreeCells = 0;
}
}
#endif
/*
* Generate EPS file.
* Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES)
*/
/* Function that creates a EPS File from a created pixmap on the current
* context. Based on the code from Copyright (c) Mark J. Kilgard, 1996.
* Parameters: name_file, b&w / Color flag, redraw function. The redraw
* function is needed in order to draw things into the new created pixmap. */
/* Copyright (c) Mark J. Kilgard, 1996. */
static GLvoid *
grabPixels(int inColor, unsigned int width, unsigned int height)
{
GLvoid *buffer;
GLint swapbytes, lsbfirst, rowlength;
GLint skiprows, skippixels, alignment;
GLenum format;
unsigned int size;
if (inColor) {
format = GL_RGB;
size = width * height * 3;
} else {
format = GL_LUMINANCE;
size = width * height * 1;
}
buffer = (GLvoid *) malloc(size);
if (buffer == NULL)
return NULL;
/* Save current modes. */
glGetIntegerv(GL_PACK_SWAP_BYTES, &swapbytes);
glGetIntegerv(GL_PACK_LSB_FIRST, &lsbfirst);
glGetIntegerv(GL_PACK_ROW_LENGTH, &rowlength);
glGetIntegerv(GL_PACK_SKIP_ROWS, &skiprows);
glGetIntegerv(GL_PACK_SKIP_PIXELS, &skippixels);
glGetIntegerv(GL_PACK_ALIGNMENT, &alignment);
/* Little endian machines (DEC Alpha for example) could benefit from
* setting GL_PACK_LSB_FIRST to GL_TRUE instead of GL_FALSE, but this would
* * * * * * * * * require changing the generated bitmaps too. */
glPixelStorei(GL_PACK_SWAP_BYTES, GL_FALSE);
glPixelStorei(GL_PACK_LSB_FIRST, GL_FALSE);
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
/* Actually read the pixels. */
glReadPixels(0, 0, width, height, format,
GL_UNSIGNED_BYTE, (GLvoid *) buffer);
/* Restore saved modes. */
glPixelStorei(GL_PACK_SWAP_BYTES, swapbytes);
glPixelStorei(GL_PACK_LSB_FIRST, lsbfirst);
glPixelStorei(GL_PACK_ROW_LENGTH, rowlength);
glPixelStorei(GL_PACK_SKIP_ROWS, skiprows);
glPixelStorei(GL_PACK_SKIP_PIXELS, skippixels);
glPixelStorei(GL_PACK_ALIGNMENT, alignment);
return buffer;
}
static int
generateEPS(const char *filename, int inColor,
unsigned int width, unsigned int height)
{
FILE *fp;
GLvoid *pixels;
unsigned char *curpix;
unsigned int components, i;
int pos;
unsigned int bitpixel;
pixels = grabPixels(inColor, width, height);
if (pixels == NULL)
return 1;
if (inColor)
components = 3; /* Red, green, blue. */
else
components = 1; /* Luminance. */
fp = fopen(filename, "w");
if (fp == NULL) {
return 2;
}
(void) fprintf(fp, "%%!PS-Adobe-2.0 EPSF-1.2\n");
(void) fprintf(fp, "%%%%Creator: OpenGL pixmap render output\n");
(void) fprintf(fp, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
(void) fprintf(fp, "%%%%EndComments\n");
i = (((width * height) + 7) / 8) / 40; /* # of lines, 40 bytes per
* line */
(void) fprintf(fp, "%%%%BeginPreview: %d %d %d %d\n%%", width, height, 1,
i);
pos = 0;
curpix = (unsigned char *) pixels;
for (i = 0; i < width * height * components;) {
bitpixel = 0;
if (inColor) {
double pix = 0;
pix = 0.30 * (double) curpix[i] + 0.59 * (double) curpix[i + 1] +
0.11 * (double) curpix[i + 2];
i += 3;
if (pix > 127.0)
bitpixel |= 0x80;
pix = 0.30 * (double) curpix[i] + 0.59 * (double) curpix[i + 1] +
0.11 * (double) curpix[i + 2];
i += 3;
if (pix > 127.0)
bitpixel |= 0x40;
pix = 0.30 * (double) curpix[i] + 0.59 * (double) curpix[i + 1] +
0.11 * (double) curpix[i + 2];
i += 3;
if (pix > 127.0)
bitpixel |= 0x20;
pix = 0.30 * (double) curpix[i] + 0.59 * (double) curpix[i + 1] +
0.11 * (double) curpix[i + 2];
i += 3;
if (pix > 127.0)
bitpixel |= 0x10;
pix = 0.30 * (double) curpix[i] + 0.59 * (double) curpix[i + 1] +
0.11 * (double) curpix[i + 2];
i += 3;
if (pix > 127.0)
bitpixel |= 0x08;
pix = 0.30 * (double) curpix[i] + 0.59 * (double) curpix[i + 1] +
0.11 * (double) curpix[i + 2];
i += 3;
if (pix > 127.0)
bitpixel |= 0x04;
pix = 0.30 * (double) curpix[i] + 0.59 * (double) curpix[i + 1] +
0.11 * (double) curpix[i + 2];
i += 3;
if (pix > 127.0)
bitpixel |= 0x02;
pix = 0.30 * (double) curpix[i] + 0.59 * (double) curpix[i + 1] +
0.11 * (double) curpix[i + 2];
i += 3;
if (pix > 127.0)
bitpixel |= 0x01;
} else {
if (curpix[i++] > 0x7f)
bitpixel |= 0x80;
if (curpix[i++] > 0x7f)
bitpixel |= 0x40;
if (curpix[i++] > 0x7f)
bitpixel |= 0x20;
if (curpix[i++] > 0x7f)
bitpixel |= 0x10;
if (curpix[i++] > 0x7f)
bitpixel |= 0x08;
if (curpix[i++] > 0x7f)
bitpixel |= 0x04;
if (curpix[i++] > 0x7f)
bitpixel |= 0x02;
if (curpix[i++] > 0x7f)
bitpixel |= 0x01;
}
(void) fprintf(fp, "%02x", bitpixel);
if (++pos >= 40) {
(void) fprintf(fp, "\n%%");
pos = 0;
}
}
if (pos)
(void) fprintf(fp, "\n%%%%EndPreview\n");
else
(void) fprintf(fp, "%%EndPreview\n");
(void) fprintf(fp, "gsave\n");
(void) fprintf(fp, "/bwproc {\n");
(void) fprintf(fp, " rgbproc\n");
(void) fprintf(fp, " dup length 3 idiv string 0 3 0\n");
(void) fprintf(fp, " 5 -1 roll {\n");
(void) fprintf(fp, " add 2 1 roll 1 sub dup 0 eq\n");
(void) fprintf(fp, " { pop 3 idiv 3 -1 roll dup 4 -1 roll dup\n");
(void) fprintf(fp, " 3 1 roll 5 -1 roll put 1 add 3 0 }\n");
(void) fprintf(fp, " { 2 1 roll } ifelse\n");
(void) fprintf(fp, " } forall\n");
(void) fprintf(fp, " pop pop pop\n");
(void) fprintf(fp, "} def\n");
(void) fprintf(fp, "systemdict /colorimage known not {\n");
(void) fprintf(fp, " /colorimage {\n");
(void) fprintf(fp, " pop\n");
(void) fprintf(fp, " pop\n");
(void) fprintf(fp, " /rgbproc exch def\n");
(void) fprintf(fp, " { bwproc } image\n");
(void) fprintf(fp, " } def\n");
(void) fprintf(fp, "} if\n");
(void) fprintf(fp, "/picstr %d string def\n", width * components);
(void) fprintf(fp, "%d %d scale\n", width, height);
(void) fprintf(fp, "%d %d %d\n", width, height, 8);
(void) fprintf(fp, "[%d 0 0 %d 0 0]\n", width, height);
(void) fprintf(fp, "{currentfile picstr readhexstring pop}\n");
(void) fprintf(fp, "false %d\n", components);
(void) fprintf(fp, "colorimage\n");
curpix = (unsigned char *) pixels;
pos = 0;
for (i = width * height * components; i != 0; i--) {
(void) fprintf(fp, "%02hx", *curpix++);
if (++pos >= 40) {
(void) fprintf(fp, "\n");
pos = 0;
}
}
if (pos)
(void) fprintf(fp, "\n");
(void) fprintf(fp, "grestore\n");
free(pixels);
if (fclose(fp) != 0)
return 1;
return 0;
}
/* int Togl_DumpToEpsFile( const Togl *togl, const char *filename, int inColor,
* void (*user_redraw)(void)) */
/* changed by GG */
int
Togl_DumpToEpsFile(const Togl *togl, const char *filename,
int inColor, void (*user_redraw) (const Togl *))
{
Bool using_mesa = False;
#if 0
Pixmap eps_pixmap;
GLXPixmap eps_glxpixmap;
XVisualInfo *vi = togl->VisInfo;
Window win = Tk_WindowId(togl->TkWin);
#endif
int retval;
unsigned int width = togl->Width, height = togl->Height;
#if defined(TOGL_X11)
Display *dpy = Tk_Display(togl->TkWin);
int scrnum = Tk_ScreenNumber(togl->TkWin);
if (strstr(glXQueryServerString(dpy, scrnum, GLX_VERSION), "Mesa"))
using_mesa = True;
else
#endif /* TOGL_X11 */
using_mesa = False;
/* I don't use Pixmap do drawn into, because the code should link with Mesa
* libraries and OpenGL libraries, and the which library we use at run time
* should not matter, but the name of the calls differs one from another:
* MesaGl: glXCreateGLXPixmapMESA( dpy, vi, eps_pixmap,
* Tk_Colormap(togl->TkWin)) OpenGl: glXCreateGLXPixmap( dpy, vi,
* eps_pixmap); instead of this I read direct from back buffer of the
* screeen. */
#if 0
eps_pixmap = XCreatePixmap(dpy, win, width, height, vi->depth);
if (using_mesa)
eps_glxpixmap =
glXCreateGLXPixmapMESA(dpy, vi, eps_pixmap,
Tk_Colormap(togl->TkWin));
else
eps_glxpixmap = glXCreateGLXPixmap(dpy, vi, eps_pixmap);
glXMakeCurrent(dpy, eps_glxpixmap, togl->GlCtx);
user_redraw();
#endif
if (!togl->RgbaFlag) {
#if defined(TOGL_WGL)
/* Due to the lack of a unique inverse mapping from the frame buffer to
* the logical palette we need a translation map from the complete
* logical palette. */
{
int n, i;
TkWinColormap *cmap = (TkWinColormap *) Tk_Colormap(togl->TkWin);
LPPALETTEENTRY entry =
malloc(togl->EpsMapSize * sizeof (PALETTEENTRY));
n = GetPaletteEntries(cmap->palette, 0, togl->EpsMapSize, entry);
for (i = 0; i < n; i++) {
togl->EpsRedMap[i] = (GLfloat) (entry[i].peRed / 255.0);
togl->EpsGreenMap[i] = (GLfloat) (entry[i].peGreen / 255.0);
togl->EpsBlueMap[i] = (GLfloat) (entry[i].peBlue / 255.0);
}
free(entry);
}
#endif /* TOGL_WGL */
glPixelMapfv(GL_PIXEL_MAP_I_TO_R, togl->EpsMapSize, togl->EpsRedMap);
glPixelMapfv(GL_PIXEL_MAP_I_TO_G, togl->EpsMapSize, togl->EpsGreenMap);
glPixelMapfv(GL_PIXEL_MAP_I_TO_B, togl->EpsMapSize, togl->EpsBlueMap);
}
/* user_redraw(); */
user_redraw(togl); /* changed by GG */
/* glReadBuffer( GL_FRONT); */
/* by default it read GL_BACK in double buffer mode */
glFlush();
retval = generateEPS(filename, inColor, width, height);
#if 0
glXMakeCurrent(dpy, win, togl->GlCtx);
glXDestroyGLXPixmap(dpy, eps_glxpixmap);
XFreePixmap(dpy, eps_pixmap);
#endif
return retval;
}
/*
* Full screen stereo for SGI graphics
* Contributed by Ben Evans (Ben.Evans@anusf.anu.edu.au)
* This code was based on SGI's /usr/share/src/OpenGL/teach/stereo
*/
#if defined(__sgi)
static struct stereoStateRec
{
Bool useSGIStereo;
Display *currentDisplay;
Window currentWindow;
GLXContext currentContext;
GLenum currentDrawBuffer;
int currentStereoBuffer;
Bool enabled;
char *stereoCommand;
char *restoreCommand;
} stereo;
/* call instead of glDrawBuffer */
void
Togl_OldStereoDrawBuffer(GLenum mode)
{
if (stereo.useSGIStereo) {
stereo.currentDrawBuffer = mode;
switch (mode) {
case GL_FRONT:
case GL_BACK:
case GL_FRONT_AND_BACK:
/*
** Simultaneous drawing to both left and right buffers isn't
** really possible if we don't have a stereo capable visual.
** For now just fall through and use the left buffer.
*/
case GL_LEFT:
case GL_FRONT_LEFT:
case GL_BACK_LEFT:
stereo.currentStereoBuffer = STEREO_BUFFER_LEFT;
break;
case GL_RIGHT:
case GL_FRONT_RIGHT:
stereo.currentStereoBuffer = STEREO_BUFFER_RIGHT;
mode = GL_FRONT;
break;
case GL_BACK_RIGHT:
stereo.currentStereoBuffer = STEREO_BUFFER_RIGHT;
mode = GL_BACK;
break;
default:
break;
}
if (stereo.currentDisplay && stereo.currentWindow) {
glXWaitGL(); /* sync with GL command stream before calling X
*/
XSGISetStereoBuffer(stereo.currentDisplay,
stereo.currentWindow, stereo.currentStereoBuffer);
glXWaitX(); /* sync with X command stream before calling GL
*/
}
}
glDrawBuffer(mode);
}
/* call instead of glClear */
void
Togl_OldStereoClear(GLbitfield mask)
{
GLenum drawBuffer;
if (stereo.useSGIStereo) {
drawBuffer = stereo.currentDrawBuffer;
switch (drawBuffer) {
case GL_FRONT:
Togl_OldStereoDrawBuffer(GL_FRONT_RIGHT);
glClear(mask);
Togl_OldStereoDrawBuffer(drawBuffer);
break;
case GL_BACK:
Togl_OldStereoDrawBuffer(GL_BACK_RIGHT);
glClear(mask);
Togl_OldStereoDrawBuffer(drawBuffer);
break;
case GL_FRONT_AND_BACK:
Togl_OldStereoDrawBuffer(GL_RIGHT);
glClear(mask);
Togl_OldStereoDrawBuffer(drawBuffer);
break;
case GL_LEFT:
case GL_FRONT_LEFT:
case GL_BACK_LEFT:
case GL_RIGHT:
case GL_FRONT_RIGHT:
case GL_BACK_RIGHT:
default:
break;
}
}
glClear(mask);
}
static void
oldStereoMakeCurrent(Display *dpy, Window win, GLXContext ctx)
{
if (dpy && (dpy != stereo.currentDisplay)) {
int event, error;
/* Make sure new Display supports SGIStereo */
if (XSGIStereoQueryExtension(dpy, &event, &error) == False) {
dpy = NULL;
}
}
if (dpy && win && (win != stereo.currentWindow)) {
/* Make sure new Window supports SGIStereo */
if (XSGIQueryStereoMode(dpy, win) == X_STEREO_UNSUPPORTED) {
win = None;
}
}
if (ctx && (ctx != stereo.currentContext)) {
GLint drawBuffer;
glGetIntegerv(GL_DRAW_BUFFER, &drawBuffer);
Togl_OldStereoDrawBuffer((GLenum) drawBuffer);
}
stereo.currentDisplay = dpy;
stereo.currentWindow = win;
stereo.currentContext = ctx;
}
/* call before using stereo */
static void
oldStereoInit(Togl *togl, int stereoEnabled)
{
stereo.useSGIStereo = stereoEnabled;
stereo.currentDisplay = NULL;
stereo.currentWindow = None;
stereo.currentContext = NULL;
stereo.currentDrawBuffer = GL_NONE;
stereo.currentStereoBuffer = STEREO_BUFFER_NONE;
stereo.enabled = False;
}
#endif /* __sgi STEREO */
void
Togl_StereoFrustum(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
GLfloat zNear, GLfloat zFar, GLfloat eyeDist, GLfloat eyeOffset)
{
GLfloat eyeShift = (eyeDist - zNear) * (eyeOffset / eyeDist);
glFrustum(left + eyeShift, right + eyeShift, bottom, top, zNear, zFar);
glTranslatef(-eyeShift, 0, 0);
}
#ifdef TOGL_AGL_CLASSIC
/* needed to make shared library on Mac with CodeWarrior; should be overridden
* by user app */
/*
* int main(int argc, char *argv[]) { return -1; } */
/* the following code is borrowed from tkMacAppInit.c */
/*
*----------------------------------------------------------------------
*
* MacintoshInit --
*
* This procedure calls Mac specific initilization calls. Most of
* these calls must be made as soon as possible in the startup
* process.
*
* Results:
* Returns TCL_OK if everything went fine. If it didn't the
* application should probably fail.
*
* Side effects:
* Inits the application.
*
*----------------------------------------------------------------------
*/
int
Togl_MacInit(void)
{
int i;
long result, mask = 0x0700; /* mask = system 7.x */
# if GENERATING68K && !GENERATINGCFM
SetApplLimit(GetApplLimit() - (TK_MAC_68K_STACK_GROWTH));
# endif
MaxApplZone();
for (i = 0; i < 4; i++) {
(void) MoreMasters();
}
/*
* Tk needs us to set the qd pointer it uses. This is needed
* so Tk doesn't have to assume the availablity of the qd global
* variable. Which in turn allows Tk to be used in code resources.
*/
tcl_macQdPtr = &qd;
/*
* If appearance is present, then register Tk as an Appearance client
* This means that the mapping from non-Appearance to Appearance cdefs
* will be done for Tk regardless of the setting in the Appearance
* control panel.
*/
if (TkMacHaveAppearance()) {
RegisterAppearanceClient();
}
InitGraf(&tcl_macQdPtr->thePort);
InitFonts();
InitWindows();
InitMenus();
InitDialogs((long) NULL);
InitCursor();
/*
* Make sure we are running on system 7 or higher
*/
if ((NGetTrapAddress(_Gestalt, ToolTrap) ==
NGetTrapAddress(_Unimplemented, ToolTrap))
|| (((Gestalt(gestaltSystemVersion, &result) != noErr)
|| (result < mask)))) {
panic("Tcl/Tk requires System 7 or higher.");
}
/*
* Make sure we have color quick draw
* (this means we can't run on 68000 macs)
*/
if (((Gestalt(gestaltQuickdrawVersion, &result) != noErr)
|| (result < gestalt32BitQD13))) {
panic("Tk requires Color QuickDraw.");
}
FlushEvents(everyEvent, 0);
SetEventMask(everyEvent);
Tcl_MacSetEventProc(TkMacConvertEvent);
return TCL_OK;
}
int
Togl_MacSetupMainInterp(Tcl_Interp *interp)
{
TkMacInitAppleEvents(interp);
TkMacInitMenus(interp);
return TCL_OK;
}
#endif /* TOGL_AGL_CLASSIC */
antennavis-0.3.1.orig/MyTypes.h 0000644 0001750 0001750 00000006603 10350336103 015144 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef MYTYPES_H
#define MYTYPES_H
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Typedefs **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
typedef int bool;
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Global Defines **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
#define true 1
#define false 0
#define local static
#define PI 3.141592654
#define degree(x) ( 180.0 / PI * ( x ) )
#define radian(x) ( PI / 180.0 * ( x ) )
#endif
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of MyTypes.h **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/Models/ 0000755 0001750 0001750 00000000000 10401372216 014601 5 ustar tomy tomy antennavis-0.3.1.orig/Models/yg_4el_20.nec 0000644 0001750 0001750 00000001330 10350336103 016747 0 ustar tomy tomy CM Copyright (C) 1998,2005 Adrian Agogino, Ken Harker, Joop Stakenborg
CM 100% F/B su tutta la banda
CM Free Space
CM 14.170 MHz
CM 4 wires, millimeters
CM 1 source
CM 35 1 0
CMPP 1, 1, 0, 0, 0
CE 0 loads
GW 1 24 -3886.200000 -5314.869600 0.000000 -3886.200000 5314.869600 0.000000 50.000000
GW 2 25 -2748.618700 -5002.600100 0.000000 -2748.618700 5002.600100 0.000000 50.000000
GW 3 24 -1098.668800 -4873.630900 0.000000 -1098.668800 4873.630900 0.000000 50.000000
GW 4 24 3886.200000 -4404.001000 0.000000 3886.200000 4404.001000 0.000000 50.000000
GS 0 0 .001
GE 0,
FR 0 1 0 0 14.170 .0000 .0000 .0000 .0000 .0000
EX 0, 2, 13,0,1., 0.,
RP 0 72 72 1001 0 0 5 5 0 0
EN
antennavis-0.3.1.orig/Models/ant.nec 0000644 0001750 0001750 00000003251 10350336103 016051 0 ustar tomy tomy CM Copyright (C) 1998,2005 Adrian Agogino, Ken Harker, Joop Stakenborg
CM 6 elements Irradia verso X -->
CMPP 1, 0, 0, 0, 0
CE
GW 1 5 0.000000 -494.949000 0.000000 0.000000 494.949000 0.000000 5.000000
GW 2 5 669.467000 -463.206000 0.000000 669.467000 463.206000 0.000000 5.000000
GW 3 5 1406.145000 -455.733000 0.000000 1406.145000 455.733000 0.000000 5.000000
GW 4 5 2024.465000 -450.898000 0.000000 2024.465000 450.898000 0.000000 5.000000
GW 5 5 2952.863000 -437.193000 0.000000 2952.863000 437.193000 0.000000 5.000000
GW 6 5 3649.681000 -456.451000 0.000000 3649.681000 456.451000 0.000000 5.000000
GM 0 0 .000 .000 .000 1695.745 2040.843 .000 .000
GS 0 0 .001 .000 .000 .000 .000 .000 .000
GE 0 0 .000 .000 .000 .000 .000 .000 .000
FR 0 1 0 0 .1441E+03 .0000 .0000 .0000 .0000 .0000
EK 0 0 0 0 .0000E+00 .0000 .0000 .0000 .0000 .0000
LD 5 1 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 2 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 3 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 4 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 5 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 6 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
KH 0 0 0 0 .1500E+01 .0000 .0000 .0000 .0000 .0000
EX 0 2 3 0 .1000E+01 .0000 .0000 .0000 .0000 .0000
RP 0, 72, 72, 1001, 0, 0, 5, 5
EN
antennavis-0.3.1.orig/Models/EX1.nec 0000644 0001750 0001750 00000000367 10350336103 015671 0 ustar tomy tomy CM EXAMPLE 1. CENTER FED LINEAR ANTENNA
CE
GW 0,7,0.,0.,-.25,0.,0.,.25,.001
GE
EX 0 0 4 0 1.
XQ
LD 0 0 4 4 10. 3.000E-09 5.300E-11
PQ
NE 0 1 1 15 .001 0 0 0. 0. .01786
EN
antennavis-0.3.1.orig/Models/spaceship.nec 0000644 0001750 0001750 00000003300 10350336103 017241 0 ustar tomy tomy CM Copyright (C) 1998,2005 Adrian Agogino, Ken Harker, Joop Stakenborg
CM 6 elements Irradia verso X -->
CMPP 1, 0, 0, 0, 0
CE
GW 1 5 0.000000 -494.949000 0.000000 0.000000 494.949000 0.000000 5.000000
GW 2 5 669.467000 16.110906 -462.925736 669.467000 -16.110906 462.925736 5.000000
GW 3 5 1406.145000 -455.733000 0.000000 1406.145000 455.733000 0.000000 5.000000
GW 4 5 2024.465000 -0.052168 -450.897997 2024.465000 0.052168 450.897997 5.000000
GW 5 5 2952.863000 -437.193000 0.000000 2952.863000 437.193000 0.000000 5.000000
GW 6 5 3649.681000 -0.052811 -456.450997 3649.681000 0.052811 456.450997 5.000000
GM 0 0 .000 .000 .000 1695.745 2040.843 .000 .000
GS 0 0 .001 .000 .000 .000 .000 .000 .000
GE 0 0 .000 .000 .000 .000 .000 .000 .000
FR 0 1 0 0 144.100000 .0000 .0000 .0000 .0000 .0000
EK 0 0 0 0 .0000E+00 .0000 .0000 .0000 .0000 .0000
LD 5 1 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 2 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 3 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 4 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 5 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 6 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
KH 0 0 0 0 .1500E+01 .0000 .0000 .0000 .0000 .0000
EX 0 2 3 0 .1000E+01 .0000 .0000 .0000 .0000 .0000
RP 0 72 72 1001 0 0 5 5 0 0
EN
antennavis-0.3.1.orig/Models/yagi.nec 0000644 0001750 0001750 00000003212 10350336103 016215 0 ustar tomy tomy CM Copyright (C) 1998,2005 Adrian Agogino, Ken Harker, Joop Stakenborg
CM YAGI
CE
GW 1 21 .000 -494.949 .000 .000 494.949 .000 5.000
GW 2 21 669.467 -463.206 .000 669.467 463.206 .000 5.000
GW 3 21 1406.145 -455.733 .000 1406.145 455.733 .000 5.000
GW 4 21 2024.465 -450.898 .000 2024.465 450.898 .000 5.000
GW 5 21 2952.863 -437.193 .000 2952.863 437.193 .000 5.000
GW 6 21 3649.681 -456.451 .000 3649.681 456.451 .000 5.000
GM 0 0 .000 .000 .000 1695.745 2040.843 .000 .000
GS 0 0 .001 .000 .000 .000 .000 .000 .000
GE 0 0 .000 .000 .000 .000 .000 .000 .000
FR 0 1 0 0 .1441E+03 .0000 .0000 .0000 .0000 .0000
EK 0 0 0 0 .0000E+00 .0000 .0000 .0000 .0000 .0000
LD 5 1 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 2 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 3 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 4 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 5 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 6 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
KH 0 0 0 0 .1500E+01 .0000 .0000 .0000 .0000 .0000
EX 0 2 3 0 .1000E+01 .0000 .0000 .0000 .0000 .0000
RP 0 72 72 1001 0 1 5 5
PQ 0
EN
antennavis-0.3.1.orig/Models/LICENSE-NEC.FILES 0000644 0001750 0001750 00000002770 10350336103 017056 0 ustar tomy tomy ###############################################################################
###############################################################################
## ##
## Antenna Visualization Toolkit ##
## ##
## Copyright (C) 1998 Adrian Agogino, Ken Harker ##
## Copyright (C) 2005 Joop Stakenborg ##
## ##
###############################################################################
###############################################################################
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program 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 General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
antennavis-0.3.1.orig/Models/EX5.nec 0000644 0001750 0001750 00000003120 10350336103 015663 0 ustar tomy tomy CM 12 ELEMENT LOG PERIODIC ANTENNA IN FREE SPACE
CM 78 SEGMENTS. SIGMA=O/L RECEIVING AND TRANS. PATTERNS.
CM DIPOLE LENGTH TO DIAMETER RATIO=150.
CE TAU=0.93. SIGMA=0.70. BOOM IMPEDANCE=50. OHMS.
GW 1 5 0.0000 -1.0000 0.0000000 0.00000 1.0000 0.000 .00667
GW 2 5 -.7527 -1.0753 0. -.7527 1.0753 0. .00717
GW 3 5 -1.562 -1.1562 0. -1.562 1.1562 0. .00771
GW 4 5 -2.4323 -1.2432 0. -2.4323 1.2432 0. .00829
GW 5 5 -3.368 -1.3368 0. -3.368 1.3368 0. .00891
GW 6 7 -4.3742 -1.4374 0. -4.3742 1.4374 0. .00958
GW 7 7 -5.4562 -1.5456 0. -5.4562 1.5456 0. .0103
GW 8 7 -6.6195 -1.6619 0. -6.6195 1.6619 0. .01108
GW 9 7 -7.8705 -1.787 0. -7.8705 1.787 0. .01191
GW 10 7 -9.2156 -1.9215 0. -9.2156 1.9215 0. .01281
GW 11 9 -10.6619 -2.0662 0. -10.6619 2.0662 0. .01377
GW 12 9 -12.2171 -2.2217 0. -12.2171 2.2217 0. .01481
GE
FR 0 0 0 0 46.29 0.
TL 1 3 2 3 -50.
TL 2 3 3 3 -50.
TL 3 3 4 3 -50.
TL 4 3 5 3 -50.
TL 5 3 6 4 -50.
TL 6 4 7 4 -50.
TL 7 4 8 4 -50.
TL 8 4 9 4 -50.
TL 9 4 10 4 -50.
TL 10 4 11 5 -50.
TL 11 5 12 5 -50. ,0.,0.,0.,.02
EX 0 1 3 10 1
RP 0 37 1 1110 90. 0. -5. 0.
EN
antennavis-0.3.1.orig/Models/EX2.nec 0000644 0001750 0001750 00000000664 10350336103 015672 0 ustar tomy tomy CM EXAMPLE 2. CENTER FED LINEAR ANTENNA.
CM CURRENT SLOPE DISCONTINUITY SOURCE.
CM 1. THIN PERFECTLY CONDUCTING WIRE
CE 2. THIN ALUMINUM WIRE
GW 0 8 0. 0. -.25 0. 0. .25 .00001
GE
FR 0 3 0 0 200. 50.
EX 5 0 5 1 1. 0. 50.
XQ
LD 5 0 0 0 3.720E+07
FR 0 1 0 0 300.
EX 5 0 5 0 1.
XQ
EN
antennavis-0.3.1.orig/Models/EX4.nec 0000644 0001750 0001750 00000001126 10350336103 015666 0 ustar tomy tomy CE EXAMPLE 4. T ANTENNA ON A BOX OVER PERFECT GROUND
SP 0 0 .1 .05 .05 0. 0. .01
SP 0 0 .05 .1 .05 0. 90. .01
GX 0 110
SP 0 0 0. 0. .1 90. 0. .04
GW 1 4 0. 0. .1 0. 0. .3 .001
GW 2 2 0. 0. .3 .15 0. .3 .001
GW 3 2 0. 0. .3 -.15 0. .3 .001
GE 1
GN 1
EX 0 1 1 0 1.
RP 0 10 4 1001 0. 0. 10. 30.
EN
antennavis-0.3.1.orig/Models/adrian.nec 0000644 0001750 0001750 00000007314 10350336103 016531 0 ustar tomy tomy CM Copyright (C) 1998,2005 Adrian Agogino, Ken Harker, Joop Stakenborg
CM YAGI
CE
GW 1 5 0.000000 -494.949000 0.000000 0.000000 494.949000 0.000000 5.000000
GW 2 5 669.467000 -463.206000 0.000000 669.467000 463.206000 0.000000 5.000000
GW 3 5 1406.145000 -455.733000 0.000000 1406.145000 455.733000 0.000000 5.000000
GW 4 5 2024.465000 -450.898000 0.000000 2024.465000 450.898000 0.000000 5.000000
GW 5 5 2952.863000 -437.193000 0.000000 2952.863000 437.193000 0.000000 5.000000
GW 6 5 3649.681000 -456.451000 0.000000 3649.681000 456.451000 0.000000 5.000000
GW 7 5 3920.000000 -1430.000000 -1410.000000 3920.000000 -1430.000000 1428.000000 5.000000
GW 9 5 3920.000000 1332.000000 1428.000000 3920.000000 1332.000000 -1410.000000 5.000000
GW 7 5 3920.000000 -1430.000000 -1410.000000 3920.000000 1332.000000 -1410.000000 4.450000
GW 7 5 3920.000000 -1430.000000 -1410.000000 3920.000000 -1430.000000 1428.000000 4.450000
GW 7 5 3920.000000 -1430.000000 -1126.200000 3920.000000 1332.000000 -1126.200000 4.550000
GW 7 5 3920.000000 -1153.800000 -1410.000000 3920.000000 -1153.800000 1428.000000 4.550000
GW 7 5 3920.000000 -1430.000000 -842.400000 3920.000000 1332.000000 -842.400000 4.550000
GW 7 5 3920.000000 -877.600000 -1410.000000 3920.000000 -877.600000 1428.000000 4.550000
GW 7 5 3920.000000 -1430.000000 -558.600000 3920.000000 1332.000000 -558.600000 4.450000
GW 7 5 3920.000000 -601.400000 -1410.000000 3920.000000 -601.400000 1428.000000 4.450000
GW 7 5 3920.000000 -1430.000000 -274.800000 3920.000000 1332.000000 -274.800000 4.450000
GW 7 5 3920.000000 -325.200000 -1410.000000 3920.000000 -325.200000 1428.000000 4.450000
GW 7 5 3920.000000 -1430.000000 9.000000 3920.000000 1332.000000 9.000000 4.450000
GW 7 5 3920.000000 -49.000000 -1410.000000 3920.000000 -49.000000 1428.000000 4.450000
GW 7 5 3920.000000 -1430.000000 292.800000 3920.000000 1332.000000 292.800000 4.350000
GW 7 5 3920.000000 227.200000 -1410.000000 3920.000000 227.200000 1428.000000 4.350000
GW 7 5 3920.000000 -1430.000000 576.600000 3920.000000 1332.000000 576.600000 4.350000
GW 7 5 3920.000000 503.400000 -1410.000000 3920.000000 503.400000 1428.000000 4.350000
GW 7 5 3920.000000 -1430.000000 860.400000 3920.000000 1332.000000 860.400000 4.350000
GW 7 5 3920.000000 779.600000 -1410.000000 3920.000000 779.600000 1428.000000 4.350000
GW 7 5 3920.000000 -1430.000000 1144.200000 3920.000000 1332.000000 1144.200000 4.350000
GW 7 5 3920.000000 1055.800000 -1410.000000 3920.000000 1055.800000 1428.000000 4.350000
GW 7 5 3920.000000 -1430.000000 1428.000000 3920.000000 1332.000000 1428.000000 4.450000
GW 7 5 3920.000000 1332.000000 -1410.000000 3920.000000 1332.000000 1428.000000 4.450000
GM 0 0 .000 .000 .000 1695.745 2040.843 .000 .000
GS 0 0 .001 .000 .000 .000 .000 .000 .000
GE 0 0 .000 .000 .000 .000 .000 .000 .000
FR 0 1 0 0 144.100000 .0000 .0000 .0000 .0000 .0000
EK 0 0 0 0 .0000E+00 .0000 .0000 .0000 .0000 .0000
LD 5 1 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 2 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 3 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 4 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 5 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 6 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
KH 0 0 0 0 .1500E+01 .0000 .0000 .0000 .0000 .0000
EX 0 2 3 0 .1000E+01 .0000 .0000 .0000 .0000 .0000
RP 0 72 72 1001 0 0 5 5 0 0
PQ 0
EN
antennavis-0.3.1.orig/Models/EX6.nec 0000644 0001750 0001750 00000001555 10350336103 015676 0 ustar tomy tomy CE CYLINDER WITH ATTACHED WIRES
SP 0 0 10 0 7.3333 0. 0. 38.4
SP 0 0 10 0 0. 0. 0. 38.4
SP 0 0 10 0 -7.3333 0. 0. 38.4
GM 0 1 0. 0. 30.
SP 0 0 6.89 0. 11. 90. 0. 44.88
SP 0 0 6.89 0. -11. -90. 0. 44.88
GR 0 6
SP 0 0 0. 0. 11. 90. 0. 44.89
SP 0 0 0. 0. -11. -90. 0. 44.89
GW 1 4 0. 0. 11. 0. 0. 23. .1
GW 2 5 10. 0. 0. 27.6 0. 0. .2
GS,0,0,.01
GE
FR,0,1,0,0,465.84
CP 1 1 2 1
EX 0 1 1 1.
RP 0 73 1 1000 0. 0. 5. 0.
EX 0 2 1 0 1.
XQ
EN
antennavis-0.3.1.orig/Models/EX3.nec 0000644 0001750 0001750 00000001272 10350336103 015667 0 ustar tomy tomy CM EXAMPLE 3. VERTICAL HALF WAVELENGTH ANTENNA OVER GROUND
CM EXTENDED THIN WIRE KERNEL USED
CM 1. PERFECT GROUND
CM 2. IMPERFECT GROUND INCLUDING GROUND WAVE AND RECEIVING
CE PATTERN CALCULATIONS
GW 0 9 0. 0. 2. 0. 0. 7. .3
GE 1
EK
FR 0 1 0 0 30.
EX 0 0 5 0 1.
GN 1
RP 0 10 2 1301 0. 0. 10. 90.
GN 0 0 0 0 6. 1.000E-03
RP 0 10 2 1301 0. 0. 10. 90.
RP 1 10 1 0 1. 0. 2. 0. 1.000E+05
EX 1 10 1 0 0. 0. 0. 10.
PT 2 0 5 5
XQ
EN
antennavis-0.3.1.orig/Models/yg2_5el_50.nec 0000644 0001750 0001750 00000002117 10350336103 017041 0 ustar tomy tomy CM 5 element Yagi da ARRL Handbook p.226 Max corretto per 50.157 ( i2kfx )
CM 2 yagi sovrapposte spaziate 10m ...1.8 lambda
CM 50.157 MHz
CM 6 wires, millimeters
CM 1 source
CM 5,100,0
CM 0 loads
CMPP 1, 3, 0, 0, 0
CE
GW 1 17 0, -1399, 18000 0, 1399, 18000 50
GW 2 17 -878, -1506, 18000 -878, 1506, 18000 20
GW 3 17 878, -1362, 18000 878, 1362, 18000 20
GW 4 17 1756, -1338, 18000 1756, 1338, 18000 20
GW 5 17 2634, -1311, 18000 2634, 1311, 18000 20
GW 6 17 0, -1399, 28000 0, 1399, 28000 50
GW 7 17 -878, -1506, 28000 -878, 1506, 28000 20
GW 8 17 878, -1362, 28000 878, 1362, 28000 20
GW 9 17 1756, -1338, 28000 1756, 1338, 28000 20
GW 10 17 2634, -1311, 28000 2634, 1311, 28000 20
GS 0 0 .001
GE 0
FR 0 0 0 0 50.157
EX 0 1 9 0 1.0 0.0
EX 0 6 9 0 1.0 0.0
PT -1
RP 0, 1, 1, 1001, 90, 0, 0, 0
RP 0, 1, 1, 1001, 90,180, 0, 0
RP 0, 1, 361, 1001, 90, 0, 1, 1
RP 0, 361, 1, 1001, 0, 0, 1, 1
EN
antennavis-0.3.1.orig/Models/EX7.nec 0000644 0001750 0001750 00000001540 10350336103 015671 0 ustar tomy tomy CM SAMPLE PROBLEM FOR NEC
CE STICK MODEL OF AIRCRAFT - FREE SPACE
GW 1, 1, 0., 0., 0., 6., 0., 0., 1.,
GW 2 6 6. 0. 0. 44. 0. 0. 1.
GW 3 4 44. 0. 0. 68. 0. 0. 1.
GW 4 6 44. 0. 0. 24. 29.9 0. 1.
GW 5 6 44. 0. 0. 24. -29.9 0. 1.
GW 6 2 6. 0. 0. 2. 11.3 0. 1.
GW 7 2 6. 0. 0. 2. -11.3 0. 1.
GW 8 2 6. 0. 0. 2. 0. 10. 1.
GE
FR 0 1 0 0 3.
EX 1 1 1 0 0.
RP 0 1 1 1000 0. 0. 0.
EX 1 1 1 0 90. 30. -90.
RP 0 1 1 1000 90. 30.
EN
antennavis-0.3.1.orig/Models/quad17m-1.nec 0000644 0001750 0001750 00000002471 10350336103 016707 0 ustar tomy tomy CM NEC Input File 2 element W7GQ 15m QUAD
CM ARRL Antenna Handbook 12-2,Freq stepped .05, 3 times, starting at 18.068
CM Scaled to 17 meters by GS=1.176, RP vertical pattern 0 to 90 deg, 0 is up
CM GW is wire spec,tag#,#of segments,x,y,z end 1;x,y,z end 2
CM EX is excitation,0 is voltage source,tag#and source segment
CM a 11 m di altezza
CM Guadagno massimo a 18 gradi di elevazione 12.98 dBi !!
CE
GW 1 20 1.51400 1.79100 10.00000 1.51400 -1.79100 10.00000 0.00200
GW 2 20 1.51400 -1.79100 10.00000 1.51400 -1.79100 13.58200 0.00200
GW 3 20 1.51400 -1.79100 13.58200 1.51400 1.79100 13.58200 0.00200
GW 4 20 1.51400 1.79100 13.58200 1.51400 1.79100 10.00000 0.00200
GW 5 20 -1.51400 1.86000 10.00000 -1.51400 -1.86000 10.00000 0.00200
GW 6 20 -1.51400 -1.86000 10.00000 -1.51400 -1.86000 13.72000 0.00200
GW 7 20 -1.51400 -1.86000 13.72000 -1.51400 1.86000 13.72000 0.00200
GW 8 20 -1.51400 1.86000 13.72000 -1.51400 1.86000 10.00000 0.00200
GS 0 0 1.17600
GE 0
GN 1 0 0 0 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00
FR 0 1 0 0 18.068000 .0000 .0000 .0000 .0000 .0000
EX 0 1 10 0 1.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00
PT -1
RP 0, 72, 72, 1001, 0, 0, 5, 5, 1.00E+04, 0
EN
antennavis-0.3.1.orig/Models/yg_16el_220.nec 0000644 0001750 0001750 00000003060 10350336103 017116 0 ustar tomy tomy CM NEC Input File of a 16 element Yagi
CMPP 1, 0, 0, 0, 0
CE
GW 15 7 0.00000 -0.34000 0.00000 0.00000 0.34000 0.00000 0.00250
GW 16 7 0.27300 -0.31750 0.00000 0.27300 0.31750 0.00000 0.00250
GW 1 7 0.69300 -0.30500 0.00000 0.69300 0.30500 0.00000 0.00250
GW 2 7 1.11300 -0.30500 0.00000 1.11300 0.30500 0.00000 0.00250
GW 3 7 1.53300 -0.30500 0.00000 1.53300 0.30500 0.00000 0.00250
GW 4 7 1.95300 -0.30500 0.00000 1.95300 0.30500 0.00000 0.00250
GW 5 7 2.37300 -0.30500 0.00000 2.37300 0.30500 0.00000 0.00250
GW 6 7 2.79300 -0.30500 0.00000 2.79300 0.30500 0.00000 0.00250
GW 7 7 3.21300 -0.30500 0.00000 3.21300 0.30500 0.00000 0.00250
GW 8 7 3.63300 -0.30500 0.00000 3.63300 0.30500 0.00000 0.00250
GW 9 7 4.05300 -0.30500 0.00000 4.05300 0.30500 0.00000 0.00250
GW 10 7 4.47300 -0.30500 0.00000 4.47300 0.30500 0.00000 0.00250
GW 11 7 4.89300 -0.30500 0.00000 4.89300 0.30500 0.00000 0.00250
GW 12 7 5.31300 -0.30500 0.00000 5.31300 0.30500 0.00000 0.00250
GW 13 7 5.73300 -0.30500 0.00000 5.73300 0.30500 0.00000 0.00250
GE 0
FR 0 1 0 0 2.20E+02 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00
EX 0 16 4 0 1.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00
PT -1
RP 0, 1, 1, 1001, 90, 0, 0, 0
RP 0, 1, 1, 1001, 90,180, 0, 0
RP 0, 1, 361, 1001, 90, 0, 1, 1
RP 0, 361, 1, 1001, 0, 0, 1, 1
EN
antennavis-0.3.1.orig/Models/yg_6el.nec 0000644 0001750 0001750 00000003255 10350336103 016460 0 ustar tomy tomy CM Copyright (C) 1998,2005 Adrian Agogino, Ken Harker, Joop Stakenborg
CM 6 elements Irradia verso X -->
CMPP 1, 0, 0, 0, 0
CE
GW 1 5 .000 -494.949 .000 .000 494.949 .000 5.000
GW 2 5 669.467 -463.206 .000 669.467 463.206 .000 5.000
GW 3 5 1406.145 -455.733 .000 1406.145 455.733 .000 5.000
GW 4 5 2024.465 -450.898 .000 2024.465 450.898 .000 5.000
GW 5 5 2952.863 -437.193 .000 2952.863 437.193 .000 5.000
GW 6 5 3649.681 -456.451 .000 3649.681 456.451 .000 5.000
GM 0 0 .000 .000 .000 1695.745 2040.843 .000 .000
GS 0 0 .001 .000 .000 .000 .000 .000 .000
GE 0 0 .000 .000 .000 .000 .000 .000 .000
FR 0 1 0 0 .1441E+03 .0000 .0000 .0000 .0000 .0000
EK 0 0 0 0 .0000E+00 .0000 .0000 .0000 .0000 .0000
LD 5 1 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 2 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 3 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 4 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 5 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 6 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
KH 0 0 0 0 .1500E+01 .0000 .0000 .0000 .0000 .0000
EX 0 2 3 0 .1000E+01 .0000 .0000 .0000 .0000 .0000
RP 0, 361, 361, 1001, 0, 1, 1, 1
EN
antennavis-0.3.1.orig/Models/tri_7.nec 0000644 0001750 0001750 00000000722 10350336103 016313 0 ustar tomy tomy CM Triangolo per i 40m ( i2kfx )
CM Dal libro di w3fqj
CM
CMPP 1, 0, 0, 0, 0
CE
GW 1 21 0, -7.09 0, 0, +7.09, 0, 0.004
GW 2 21 0, -7.09 0, 0, 0, 12.28, 0.004
GW 3 21 0, 0, 12.28, 0, +7.09, 0, 0.004
GE 0
FR 0 0 0 0 7.05
EX 0 1 11 0 1.0 0.0
PT -1
RP 0, 1, 1, 1001, 90, 0, 0, 0
RP 0, 1, 1, 1001, 90,180, 0, 0
RP 0, 1, 361, 1001, 90, 0, 1, 1
RP 0, 361, 1, 1001, 0, 0, 1, 1
EN
antennavis-0.3.1.orig/Models/centfeed.nec 0000644 0001750 0001750 00000000441 10350336103 017042 0 ustar tomy tomy CE EXAMPLE 1. CENTER FED LINEAR ANTENNA
GW 0 7 0. 0. -.25 0. 0. .25 .001
GE
EX 0 0 4 0 1.
XQ
LD 0 0 4 4 10. 3.000E-09 5.300E-11
PQ
NE 0 1 1 15 .001 0. 0. 0. 0. .01786
EN
antennavis-0.3.1.orig/Models/19el_432_tonna.nec 0000644 0001750 0001750 00000006362 10350336103 017636 0 ustar tomy tomy CM 19 Elementi Tonna per i 70 cm con dipolo semplice
CM free space
CM 435.0 MHz ill file !! or ill antenna ?
CM 19 wires, millimeters increasing pulses per element
CM 1 source gain gets worst ( at 435 MHz)
CM 5,100,0 Max gain 15.97 dBi at 410 MHz
CM 0 loads
CMPP 1, 0, 0, 0, 0
CE
GW 1 10 -82, -175, 0 -82, 175, 0 4
GW 2 11 0, -160, 0 0, 160, 0 10
GW 3 10 56, -165, 0 56, 165, 0 4
GW 4 10 171, -157.5, 0 171, 157.5, 0 4
GW 5 10 342, -152.5, 0 342, 152.5, 0 4
GW 6 10 514, -150, 0 514, 150, 0 4
GW 7 10 686, -148.5, 0 686, 148.5, 0 4
GW 8 10 838, -147.5, 0 838, 147.5, 0 4
GW 9 10 1029, -147.5, 0 1029, 147.5, 0 4
GW 10 10 1201, -145, 0 1201, 145, 0 4
GW 11 10 1374, -142.5, 0 1374, 142.5, 0 4
GW 12 10 1547, -142.5, 0 1547, 142.5, 0 4
GW 13 10 1718, -140, 0 1718, 140, 0 4
GW 14 10 1890, -140, 0 1890, 140, 0 4
GW 15 10 2062, -137.5, 0 2062, 137.5, 0 4
GW 16 10 2234, -137.5, 0 2234, 137.5, 0 4
GW 17 10 2404, -135, 0 2404, 135, 0 4
GW 18 10 2578, -135, 0 2578, 135, 0 4
GW 19 10 2775, -132.5, 0 2775, 132.5, 0 4
GW 20 170 -82, 0, 0, 2775, 0, 0, 15
GS 0 0 .001
GE 0,
EK 0 0 0 0 .0000E+00 .0000 .0000 .0000 .0000 .0000
LD 5 1 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 2 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 3 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 4 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 5 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 6 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 7 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 8 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 9 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 10 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 11 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 12 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 13 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 14 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 15 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 16 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 17 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 18 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
LD 5 19 0 0 .2701E+08 .0000 .0000 .0000 .0000 .0000
FR 0, 0, 0, 0, 405.0,
EX 0, 2, 5, 0, 1., 0.,
PT -1
RP 0, 1, 1, 1001, 90, 0, 0, 0
RP 0, 1, 1, 1001, 90,180, 0, 0
RP 0, 1, 361, 1001, 90, 0, 1, 1
RP 0, 361, 1, 1001, 0, 0, 1, 1
EN
antennavis-0.3.1.orig/LICENSE_of_togl 0000644 0001750 0001750 00000002705 10401333022 016070 0 ustar tomy tomy This software is copyrighted by Brian Paul (brian@mesa3d.org)
and Benjamin Bederson (bederson@cs.umd.edu). The following
terms apply to all files associated with the software unless explicitly
disclaimed in individual files.
The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
Modifications to this software may be copyrighted by their authors
and need not follow the licensing terms described here, provided that
the new terms are clearly indicated on the first page of each file where
they apply.
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.
antennavis-0.3.1.orig/TkAnt.1 0000644 0001750 0001750 00000000026 10401367171 014463 0 ustar tomy tomy .so man1/antennavis.1
antennavis-0.3.1.orig/ChangeLog 0000644 0001750 0001750 00000003240 11401515353 015131 0 ustar tomy tomy antennavis (0.3.1)
* New public release by new maintainer (Nanakos Chrysostomos).
* Deleted permanent makefile.
* Changed makefile.in to Makefile.in.
* Modified debian/rules to dynamically generate Makefile.
* Changed configure file and added few more checks relevant to required
build libraries.
* Fixed segfault crash when loading a file with no GW lines.
Thanks to Kamal Mostafa for the patch.
antennavis (0.3)
* First public release by new maintainer.
* Uses autoconf which automatically searches for tcl and tk headers and
libraries.
* Copyright notices added to all of the C files, header files and
Makefile.
* License file added to the Models directory.
* Provide a README with kenneth's current e-mail address and explanation
of this effort.
* Removed tkInt.h, it is not needed.
* Remove unused functions associated with isosurfaces: ComputeVolumeData,
GenerateNECVolumeFile in ant.c, WriteVolumeCardFile and ParseVolumeData
in pccard.c.
* Attempt to create a useable package, build against togl-1.7.
* Call nec2 correctly.
* Set height of the top frame to 350, so it fits on a 1024x768 display.
* Rename input_nec to input.nec and output_nec to output.nec.
* Remove help button and window, it is of no use.
* Remove "Load Yagi" optionmenu, it is of no use.
* Fixed a crash when output.nec not present.
* The isosurfaces button has been removed, because it does nothing.
* The buttons have been moved to the display frame, which leaves a bit
more room on the screen.
* Several compilation fixes.
* General font changed to helvetica.
* The main program is now called antennavis instead of antenna.tcl.
antennavis-0.3.1.orig/COPYING 0000644 0001750 0001750 00000044063 10350336103 014416 0 ustar tomy tomy
NOTE! This copyright does *not* cover user programs that use kernel
services by normal system calls - this is merely considered normal use
of the kernel, and does *not* fall under the heading of "derived work".
Also note that the GPL below is copyrighted by the Free Software
Foundation, but the instance of code that it refers to (the Linux
kernel) is copyrighted by me and others who actually wrote it.
Linus Torvalds
----------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C) 19yy
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
antennavis-0.3.1.orig/TODO 0000644 0001750 0001750 00000003563 10350336103 014053 0 ustar tomy tomy Antennavis 0.2 - This is the old TODO list written by Kenneth
These are the to-do notes for Antennavis version 0.2. These are features
that may some day be added, or bugs that may some day be fixed. The WWW
home page for Antennavis is (http://n5xu.ae.utexas.edu/antennavis/).
FEATURE REQUESTS:
- User should be able to turn artifical, cosmetic ground and antenna
supports off. They were originally included for purely cosmetic
reasons, and are not used in calculations.
- The isocontouring support should be removed. It was based upon code
that is now unavailable, and it never really showed anything
interesting anyway.
* Done, march 2005 Joop Stakenborg
- The software should be made to run on Intel Linux systems, then maybe
Microsoft Windows systems.
* Done Linux, march 2005 Joop Stakenborg
- The interface should allow for changing of colors.
- Adding new visualization methods and items to visualize is presently
an NxN process. There should be a common intermediate state that can
make adding new visualization methods and targets easier.
- This is still only an analysis tool, and not a design tool.
- The interface takes up too much space compared to the vis window.
KNOWN BUGS:
- The software only runs on a few .nec input files. MANY files cause the
software to crash.
- A lot of the directives in the .nec file are not presently being
consumed. For instance, scaling is not considered at all.
- The software is generally very flaky.
- I think the axes are screwed up; in trying to do multiple .nec input
files, something got changed, and all RF patterns are 90 degrees CW or CCW
(I forget) from where they should be.
- There are a lot of bugs associated with the "solid objects" feature.
It might also be removed if it proves to be of little utility.
antennavis-0.3.1.orig/pcard.h 0000644 0001750 0001750 00000006030 10401342742 014620 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef PCARD_H
#define PCARD_H
#include
#include "ant.h"
#include "togl.h"
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Function Prototypes **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void PrintTube(FILE *, Tube *, int);
void PrintTubeOffset(FILE *, Tube *, int, double, double, double);
void WriteCardFile(CONST84 char *, Ant *, int, double);
void WriteMultAntsFile(CONST84 char *, int, double);
bool CardToTube(char *, Tube *);
void ReadCardFile(CONST84 char *, Ant *);
void ParseFieldData(FILE *, Ant *, bool, bool);
#endif
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of pcard.h **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/antennavis.1 0000644 0001750 0001750 00000001514 11324342650 015613 0 ustar tomy tomy .TH ANTENNAVIS 1 "March 1, 2006" "0.3"
.SH NAME
antennavis \- Antenna Radiation Pattern Visualization Software
.SH SYNOPSIS
.B antennavis
.SH DESCRIPTION
\fBAntennavis\fP lets the user fly around and view antenna systems
and their patterns from any angle in 3D. There are several means of
viewing the patterns, through rendered, variable-size cubes, smooth
shaded polygonal surface approximations, and color-mapped spheres.
\fBAntennavis\fP works together with nec2. Nec2 simulates the
electromagnetic response of antennas and metal structures and can be called
from within antennavis. \fBAntennavis\fP then uses the \fBTkAnt\fP
OpenGL widget to render the nec output.
.SH AUTHORS
The program was originally developed by Kenneth Harker WM5R and Adrian Agogino.\fB
It is currently maintained by Nanakos Chrysostomos, nanakos@wired-net.gr.
antennavis-0.3.1.orig/VisWires.h 0000644 0001750 0001750 00000010300 10350336104 015273 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef VIS_WIRES_H
#define VIS_WIRES_H
#include "MyTypes.h"
#include "ant.h"
#include
#include
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Definitions **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
extern double SCALE_FACTOR; /** Scale factor for antenna **/
extern double TUBE_WIDTH_SCALE; /** Tube width scale **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Function Prototypes **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
double GetVerticalHeight(Tube *tube);
void ComputeColor(double, double, double, GLfloat *);
double GetBoomLength(Tube *);
double GetBoomHeight(Tube *);
double GetBoomWidth(Tube *);
double GetBoomShift(Tube *);
void DrawTubeList(Tube *, Tube *, GLint, GLint);
void DrawTube(Tube *, GLint, GLint);
void DrawWireCurrentMagnitudeList(Tube *,
Tube *,
double,
double,
GLint,
GLint);
void DrawWireCurrentMagnitude(Tube *, double, double, GLint, GLint);
void DrawWireCurrentPhaseList(Tube *, Tube *, double, double, GLint, GLint);
void DrawWireCurrentPhase(Tube *, double, double, GLint, GLint);
#endif
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of VisWires.h **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/color.c 0000644 0001750 0001750 00000001101 10350336104 014630 0 ustar tomy tomy void ComputeColor(double val, double min, double max, GLfloat *color)
{
GLfloat cval;
if(min != max)
cval = (val - min) / (max - min);
else
cval = 0.5;
color[0] = 0.0;
color[1] = 0.0;
color[2] = 0.0;
color[3] = 1.0;
if(cval > 0.5)
{
color[0] = (cval - 0.5)*2;
color[1] = (1.0 - cval)*2;
}
else
{
color[1] = (cval)*2;
color[2] = (0.5 - cval)*2;
}
}/*ComputeColor*/
antennavis-0.3.1.orig/README 0000644 0001750 0001750 00000006643 10401372006 014244 0 ustar tomy tomy Beyond Antennavis
_________________
This software was written by Kenneth E. Harker in 1998. I liked the 3D
images of the presented antenna patterns on Kenneth's web-site so much
that I have put some effort into creating a useable software package out
it. So I contacted Kenneth to ask him how he thought about further
development. Here is what he said:
___________________________________________________________________________
On Fri, Mar 25, 2005 at 01:10:54PM +0100, Joop Stakenborg wrote:
> Hi Kenneth,
>
> I have been working on a Debian GNU/Linux package for antennavis and
> have done a lot of cleaning up in the process of creating the package.
> The GUI has had some cleanups, so it fits at least on a 1024x768 display
> and I have removed some of the unused functions. Also did put some time
> into clearing compilation warnings and compiling with the latest togl
> and tcl/tk 8.4.
Wow.
I didn't know anyone even knew about Antennavis anymore.
> I would like to upload this software to the debian archive if okay with
> you.
That's OK with me.
> I am also interested in further development of antennavis if you are
> interested. Did you ever give it a thought to create some kind of
> project page for your software? Putting it on a website at
> sourceforge.net or savannah.nongnu.org would maybe help in further
> development of antennavis. This would encourage other people to join in
> and add features or fix/report bugs....
Antennavis was really just a two or three week project for one of my
grad school classes. We needed to demonstrate data visualization through
computer graphics. We weren't really aiming for anything especially
complex, and it only ever ran on SGI IRIX.
If you would like to put it on sourceforge or wherever, that's fine with me.
--
Kenneth E. Harker WM5R
kenharker@kenharker.com
http://www.kenharker.com/
___________________________________________________________________________
This package provides a tcl script called antennavis which makes
use of the TkAnt binary. Antennavis will expect a nec2 binary
somewhere in your path. The nec2 binary you are using should take
filenames for arguments, e.g. "nec2 input.nec output.nec".
In case you can't meet these requirements, you can download a
statically linked nec2 version from:
http://www.qsl.net/pg4i/download/nec2bin-11.tar.gz
or: http://pg4i.mattsnetwork.co.uk/download/nec2bin-11.tar.gz
Here are some usage notes:
- Load a .nec file by clicking on 'Load Antenna File"
- Next, click on "Compute RF Field"
- nec2 will be started and input.nec and output.nec created
- The antenna pattern will be calculated and loaded
There was only one example in the original package which worked. I have
tried to modify some, so we have more working examples. One of the
problems seems to come from the 'PT' card, which is unknown by the
nec version inside debian.
If you get the following warning at startup:
Xlib: extension "XFree86-DRI" missing on display ":0.0".
This means that Direct Rendering is not working for your setup. It is not
really something to worry about, antennavis will still work.
Antennavis has a project page at
http://savannah.nongnu.org/projects/antennavis.
Feel free to send me an e-mail if you want to join in or if you have
comments. There is also a web page at
http://www.qsl.net/pg4i/linux/antennavis.
The old homepage by Kenneth is still viewable at:
http://n5xu.ae.utexas.edu/antennavis.
Joop Stakenborg march 2006.
antennavis-0.3.1.orig/ParseArgs.c 0000644 0001750 0001750 00000015075 10401342060 015413 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include "ParseArgs.h"
#include "MyTypes.h"
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ParseArgs **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
GLint PA_ParseArgs(Tcl_Interp *interp,
GLint argc,
CONST84 char **argv,
struct PA_Config *cfg,
void *data) {
GLint i; /** Loop counter **/
GLint n; /** Loop counter **/
GLfloat f; /** Floating point number **/
bool b; /** Flow control **/
char buffer[40]; /** Input buffer **/
i = 0;
if(argv[i] != NULL) {
/** Search for an entry with the same name **/
while(cfg->type != PA_END) {
if(strcmp( argv[i], cfg->name) == 0) {
i++;
switch(cfg->type) {
case PA_FLOAT:
if(argv[i] != NULL) {
f = atof(argv[i]);
(*((GLfloat *)((char *) data + cfg->offset))) = f;
i++;
} else {
sprintf(buffer, "%f",
(double) (*((GLfloat *)( (char *) data + cfg->offset))));
Tcl_SetResult( interp, buffer, TCL_VOLATILE);
} /** Floating point **/
break;
case PA_BOOL:
if(argv[i] != NULL) {
if(strcmp(argv[i], "0") == 0
|| strcmp(argv[i], "f") == 0
|| strcmp(argv[i], "false") == 0
|| strcmp(argv[i], "False") == 0
|| strcmp(argv[i], "FALSE") == 0
|| strcmp(argv[i], "F") == 0 )
b = false;
else
b = true;
(*((bool *)((char *) data + cfg->offset))) = b;
i++;
} else {
Tcl_SetResult(interp,
(bool)(*((bool *)((char *)data+cfg->offset))) ?
"true" : "false",TCL_STATIC);
} /** Boolean **/
break;
case PA_INT:
if(argv[i] != NULL) {
n = atoi(argv[i] );
(*((GLint *)((char *)data + cfg->offset))) = n;
i++;
} else {
sprintf(buffer, "%d",
(int) (*((GLint *)((char *) data + cfg->offset))));
Tcl_SetResult(interp, buffer, TCL_VOLATILE);
} /** Integer **/
break;
case PA_RGB:
if(argv[i] != NULL) {
if(argc - i < 3) {
Tcl_SetResult(interp,
"PA_ParseArgs ERROR: need three values for RGB", TCL_STATIC);
return TCL_ERROR;
} /** Error **/
f = atof(argv[i]);
(*((GLfloat *)((char *)data + cfg->offset))) = f;
i++;
f = atof(argv[i]);
(*((GLfloat *)((char *)data + cfg->offset + sizeof(GLfloat))))=f;
i++;
f = atof(argv[i]);
(*((GLfloat *)((char *)data + cfg->offset+2*sizeof(GLfloat))))=f;
i++;
} else {
sprintf(buffer, "%f %f %f",
(double)(*((GLfloat *)((char *)data+cfg->offset))),
(double)(*((GLfloat *)((char *)data+cfg->offset+sizeof(GLfloat)))),
(double)(*((GLfloat *)((char *)data+cfg->offset+2*sizeof(GLfloat)))));
Tcl_SetResult(interp, buffer, TCL_VOLATILE);
} /** RGB **/
break;
default:
Tcl_SetResult(interp,
"PA_ParseArgs ERROR: Illegal type!", TCL_STATIC);
return TCL_ERROR;
} /** Switch **/
if(argv[i] == NULL) {
return PA_CHANGED;
} else {
Tcl_SetResult(interp,
"PA_ParseArgs ERROR: Too many arguments!", TCL_STATIC);
return TCL_ERROR;
} /** Changed **/
} /** Name OK **/
cfg++;
} /** While not done **/
} else {
while(cfg->type != PA_END) {
Tcl_AppendElement(interp, cfg->name);
cfg++;
} /** Try all possible options **/
return TCL_OK;
} /** Try all possible options **/
Tcl_SetResult(interp, "PA_ParseArgs ERROR: No option matches!", TCL_STATIC);
return TCL_ERROR;
} /** End of ParseArgs **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of ParseArgs.c **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/ant.h 0000644 0001750 0001750 00000022757 10401342673 014332 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef ANT_H
#define ANT_H
#include "MyTypes.h"
#include "togl.h"
#include
#include
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Definitions **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
#define MAX_ANTENNAS 5
#define LINEAR 0
#define RIGHT 1
#define LEFT 2
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Typedefs **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
typedef enum {IS_TUBE, IS_WALL} tube_type_enum;
typedef enum {VERTICAL, YAGI, QUAD, DIPOLE, ELEVATED_VERTICAL, UNKNOWN} antenna_type_enum;
typedef struct Point {
double x; /** X coordinate cartesian value **/
double y; /** Y coordinate cartesian value **/
double z; /** Z coordinate cartesian value **/
} Point;
typedef struct {
double posx; /** Position in x **/
double posy; /** Position in y **/
double posz; /** Position in z **/
GLfloat r; /** Red color value **/
GLfloat g; /** Green color value **/
GLfloat b; /** Blue color value **/
GLfloat a; /** Transparency value **/
} MeshPoint;
typedef struct SegmentData {
float currentMagnitude; /** Magnitude of current in amps **/
float currentPhase; /** Phase of the current wave **/
struct SegmentData *next; /** Next pointer **/
} SegmentData;
typedef struct Tube {
Point e1; /** Endpoint 1 of the tube **/
Point e2; /** Endpoint 2 of the tube **/
int type; /** Is it a tube or a wall **/
int segments; /** Number of segment NEC uses **/
double width; /** Thickness of the tube **/
SegmentData *currents; /** Currents **/
struct Tube *next; /** Pointer to next tube in list **/
} Tube;
typedef struct FieldVal {
double theta; /** Degrees azimuth **/
double phi; /** Degrees elevation **/
double vert_gain; /** Vertical component of gain **/
double hor_gain; /** Horizontal component of gain **/
double total_gain; /** Gain in dBi in theta, phi direction **/
double axial_ratio; /** Axial ratio **/
int sense; /** Polarity: linear, right or left circular **/
double tilt; /** Polarization tilt **/
double theta_mag; /** Azimuthal magnitude **/
double theta_phase; /** Azimuthal phase **/
double phi_mag; /** Elevation magnitude **/
double phi_phase; /** Elevation phase **/
} FieldVal;
typedef struct FieldData {
int count; /** Number of lines in field data **/
FieldVal *vals; /** One for each theta, phi direction **/
double maxgain; /** Maximum gain value **/
double mingain; /** Minimum gain value **/
double maxtilt; /** Maximum value of polarization tilt **/
double mintilt; /** Minimum value of polarization tilt **/
double maxaxialratio; /** Maximum axial ratio **/
double minaxialratio; /** Minimum axial ratio **/
} FieldData;
typedef struct Ant {
int tube_count; /** Number of elements in antenna **/
int card_count; /** Number of cards in .nec file **/
int total_segments; /** Total number of segments **/
int type; /** Vertical? Yagi? Quad? **/
Tube *current_tube; /** List traversal tool **/
Tube *first_tube; /** Origin element **/
char *cards[1000]; /** The .nec file **/
bool ground_specified; /** Ground is specified **/
double frequency; /** Antenna Offset **/
double dx; /** Antenna Offset **/
double dy; /** Antenna Offset **/
double dz; /** Antenna Offset **/
double max_current_mag; /** Maximum current magnitude **/
double min_current_mag; /** Minimum current magnitude **/
double max_current_phase; /** Maximum current phase **/
double min_current_phase; /** Minimum current phase **/
MeshPoint surfaceMesh[361][361]; /** Triangular mesh **/
FieldData *fieldData; /** Field data for this antenna **/
bool fieldComputed; /** Field data computed yet **/
double visual_scale; /** Visual scale factor **/
} Ant;
typedef struct AntArray {
int ant_count; /** Number of antennas in scene **/
int curr_ant; /** The current antenna **/
Ant ants[MAX_ANTENNAS]; /** Array of antennas **/
} AntArray;
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Function Prototypes **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void InsertTube(Ant *, Tube *);
void SetPoint(Point *, double, double, double);
double sqr(double);
double PointDist(Point, Point);
void ToggleDrawMode(int);
void ChangeFrequency(double);
void DisplaySelectedAnt(Ant *, GLint, GLint, bool);
void DisplayAnt(GLint, GLint);
void ReadFile(CONST84 char *);
void MoveCurrentTube(double, double, double);
void MoveCurrentWall(double, double, double);
void DoMoveCenter(double, double, double, double, double);
void RotateCurrentTube(double, double, double);
void MoveCurrentAnt(double, double, double);
void ScaleCurrentWall(double, double, double);
void ScaleCurrentTube(double, double);
void ChangeCurrentTube(int);
void ChangeCurrentAnt(int);
void GenerateNECFile(CONST84 char *);
void AddWall(void);
void ComputeField(bool);
void DeleteCurrentAnt(void);
#endif
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of ant.h **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/VisWires.c 0000644 0001750 0001750 00000065707 10401337254 015317 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include "MyTypes.h"
#include "TkAntenna.h"
#include "togl.h"
#include "ant.h"
#include "pcard.h"
#include "VisWires.h"
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Global Variables **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Function Prototypes **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void TKA_Cylinder(GLfloat radius, GLfloat height, GLint slices, GLint rings);
void TKA_Cube(GLfloat size);
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ComputeColor **/
/** **/
/** Computes a color in a three color range - red green blue **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void ComputeColor(double val, double min, double max, GLfloat *color) {
GLfloat cval; /** Range **/
if(min != max)
cval = (val - min) / (max - min);
else
cval = 0.5;
color[0] = 0.0;
color[1] = 0.0;
color[2] = 0.0;
color[3] = 1.0;
if(cval > 0.5) {
color[0] = (cval - 0.5)*2;
color[1] = (1.0 - cval)*2;
} else {
color[1] = (cval)*2;
color[2] = (0.5 - cval)*2;
} /** Left or Right handedness **/
} /** End of ComputeColor **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** GetBoomLength **/
/** **/
/** This function computes the probable length of the boom by determining **/
/** the max and min coordinates in X. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
double GetBoomLength(Tube *tube) {
double max=0; /** Max x **/
double min=0; /** Min x **/
bool first; /** Is first elements? **/
first = true;
while(tube != NULL) {
if (first == true) {
if (tube->e1.x > tube->e2.x)
max = tube->e1.x;
else
max = tube->e2.x;
if (tube->e1.x < tube->e2.x)
min = tube->e2.x;
else
min = tube->e1.x;
first = false;
} else {
if (tube->e1.x > max)
max = tube->e1.x;
if (tube->e2.x > max)
max = tube->e2.x;
if (tube->e1.x < min)
min = tube->e1.x;
if (tube->e2.x < min)
min = tube->e2.x;
} /** Not first element **/
tube = tube->next;
} /** Traverse tube list **/
return (max - min);
} /** End of GetBoomLength **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** GetBoomHeight **/
/** **/
/** This computes the probable height above ground of the boom. It finds **/
/** a median Z value for all GW control points. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
double GetBoomHeight(Tube *tube) {
double median; /** Our best guess so far **/
double max=0; /** Max x **/
double min=0; /** Min x **/
bool first; /** Is first elements? **/
first = true;
while(tube != NULL) {
if (first == true) {
if (tube->e1.z > tube->e2.z)
max = tube->e1.z;
else
max = tube->e2.z;
if (tube->e1.z < tube->e2.z)
min = tube->e2.z;
else
min = tube->e1.z;
first = false;
} else {
if (tube->e1.z > max)
max = tube->e1.z;
if (tube->e2.z > max)
max = tube->e2.z;
if (tube->e1.z < min)
min = tube->e1.z;
if (tube->e2.z < min)
min = tube->e2.z;
} /** Not first element **/
tube = tube->next;
} /** Traverse tube list **/
median = ((max + min) / 2.0);
return median;
} /** End of GetBoomHeight **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** GetVerticalHeight **/
/** **/
/** This computes the probable height above ground for elevated verticals. **/
/** It finds a min Z value for all GW control points. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
double GetVerticalHeight(Tube *tube) {
double min=0; /** Min x **/
bool first; /** Is first elements? **/
first = true;
while(tube != NULL) {
if (first == true) {
if (tube->e1.z < tube->e2.z)
min = tube->e2.z;
else
min = tube->e1.z;
first = false;
} else {
if (tube->e1.z < min)
min = tube->e1.z;
if (tube->e2.z < min)
min = tube->e2.z;
} /** Not first element **/
tube = tube->next;
} /** Traverse tube list **/
return min;
} /** End of GetVerticalHeigth **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** GetBoomWidth **/
/** **/
/** This computes the probable diameter of the boom by finding the median **/
/** diameter of the GW elements involved and multiplying that by a **/
/** constant factor. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
double GetBoomWidth(Tube *tube) {
double sum; /** Sum of widths **/
double mean; /** mean of widths **/
int count; /** Number of elements **/
count = 0;
sum = 0.0;
while(tube != NULL) {
sum = sum + tube->width;
count = count + 1;
tube = tube->next;
} /** Traverse tube list **/
mean = sum / count;
return mean;
} /** End of GetBoomWidth **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** GetBoomShift **/
/** **/
/** This computes the maximum negative or minimum positive X value of the **/
/** antenna and is used in helping to center the antenna visually on the **/
/** screen. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
double GetBoomShift(Tube *tube) {
double min=0; /** Min x **/
bool first; /** Is first elements? **/
first = true;
while(tube != NULL) {
if (first == true) {
if (tube->e1.x < tube->e2.x)
min = tube->e1.x;
else
min = tube->e1.x;
first = false;
} else {
if (tube->e1.x < min)
min = tube->e1.x;
if (tube->e2.x < min)
min = tube->e2.x;
} /** Not first element **/
tube = tube->next;
} /** Traverse tube list **/
return min;
} /** End of GetBoomShift **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawTubeList **/
/** **/
/** Traverses the linked list of antenna elements and draws each one on **/
/** the screen. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawTubeList(Tube *root, Tube *current_tube, GLint s, GLint r) {
GLfloat red_color[] = {0.8, 0.1, 0.1, 1.0}; /** Rouge **/
GLfloat gray_color[] = {0.8, 0.9, 0.9, 0.9}; /** Gris **/
if(root != NULL) {
glPushMatrix();
if(current_tube == root)
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red_color);
else
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray_color);
glRotatef(180,1.0,0.0,0.0);
glRotatef(90.0, 1.0, 0.0, 0.0);
DrawTube(root, s, r);
glPopMatrix();
DrawTubeList(root->next, current_tube, s, r);
} /** While not at end **/
} /** End of DrawTubeList **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawTube **/
/** **/
/** Renders an individual antenna element on the screen. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawTube(Tube *the_tube, GLint s, GLint r) {
double length; /** Length of the element **/
double angle1; /** Angle **/
double angle2; /** Angle **/
double dx; /** Delta in X direction **/
double dy; /** Delta in Y direction **/
double dz; /** Delta in Z direction **/
double p1x; /** Point 1 in X **/
double p1y; /** Point 1 in Y **/
double p1z; /** Point 1 in Z **/
double p2x; /** Point 2 in X **/
double p2y; /** Point 2 in Y **/
double p2z; /** Point 2 in Z **/
p1x = the_tube->e1.x;
p1y = the_tube->e1.y;
p1z = the_tube->e1.z;
if (p1x != 0.0) p1x = p1x / SCALE_FACTOR;
if (p1y != 0.0) p1y = p1y / SCALE_FACTOR;
if (p1z != 0.0) p1z = p1z / SCALE_FACTOR;
p2x = the_tube->e2.x;
p2y = the_tube->e2.y;
p2z = the_tube->e2.z;
if (p2x != 0.0) p2x = p2x / SCALE_FACTOR;
if (p2y != 0.0) p2y = p2y / SCALE_FACTOR;
if (p2z != 0.0) p2z = p2z / SCALE_FACTOR;
dx = p2x - p1x;
dy = p2y - p1y;
dz = p2z - p1z;
if(the_tube->type == IS_TUBE) {
length = PointDist(the_tube->e1, the_tube->e2);
length = length / SCALE_FACTOR;
angle1 = 3.14149/2 - atan2(dz, dx);
angle2 = atan2(dy, -sin(-angle1)*dx + cos(-angle1)*dz);
glTranslatef(p1x, p1y, p1z);
glRotatef(angle1*57.3, 0.0 , 1.0, 0.0 );
glRotatef(angle2*57.3, -1.0 , 0.0, 0.0 );
TKA_Cylinder(the_tube->width*TUBE_WIDTH_SCALE, length, s, r);
} else { /** Walls **/
glTranslatef(p1x, p1y, p1z);
glScalef(dx, dy, dz);
glTranslatef(0.5, 0.5, 0.5);
TKA_Cube(1.0);
} /** Not a tube **/
} /** End of DrawTube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawWireCurrentMagnitudeList **/
/** **/
/** Traverses the linked list of antenna elements and draws each one on **/
/** the screen, visualized the current density of the wire. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawWireCurrentMagnitudeList(Tube *root,
Tube *current_tube,
double max_current_mag,
double min_current_mag,
GLint s,
GLint r) {
GLfloat red_color[] = {0.8, 0.1, 0.1, 1.0}; /** Rouge **/
GLfloat gray_color[] = {0.8, 0.9, 0.9, 0.9}; /** Gris **/
if(root != NULL) {
glPushMatrix();
if(current_tube == root)
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red_color);
else
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray_color);
glRotatef(180,1.0,0.0,0.0);
glRotatef(90.0, 1.0, 0.0, 0.0);
DrawWireCurrentMagnitude(root, max_current_mag, min_current_mag, s, r);
glPopMatrix();
DrawWireCurrentMagnitudeList(root->next,
current_tube,
max_current_mag,
min_current_mag,
s,
r);
} /** While not at end **/
} /** End of DrawWireCurrentMagnitudeList **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawWireCurrentMagnitude **/
/** **/
/** Renders an individual antenna element on the screen, color coded for **/
/** charge density. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawWireCurrentMagnitude(Tube *the_tube,
double max_current_mag,
double min_current_mag,
GLint s,
GLint r) {
double length; /** Length of the element **/
double seg_length; /** Each segment length **/
double angle1; /** Angle **/
double angle2; /** Angle **/
double dx; /** Delta in X direction **/
double dy; /** Delta in Y direction **/
double dz; /** Delta in Z direction **/
double p1x; /** Point 1 in X **/
double p1y; /** Point 1 in Y **/
double p1z; /** Point 1 in Z **/
double p2x; /** Point 2 in X **/
double p2y; /** Point 2 in Y **/
double p2z; /** Point 2 in Z **/
GLfloat wire_color[4]; /** Wire color **/
SegmentData *segptr; /** Segment data **/
int i; /** Loop counter **/
p1x = the_tube->e1.x;
p1y = the_tube->e1.y;
p1z = the_tube->e1.z;
if (p1x != 0.0) p1x = p1x / SCALE_FACTOR;
if (p1y != 0.0) p1y = p1y / SCALE_FACTOR;
if (p1z != 0.0) p1z = p1z / SCALE_FACTOR;
p2x = the_tube->e2.x;
p2y = the_tube->e2.y;
p2z = the_tube->e2.z;
if (p2x != 0.0) p2x = p2x / SCALE_FACTOR;
if (p2y != 0.0) p2y = p2y / SCALE_FACTOR;
if (p2z != 0.0) p2z = p2z / SCALE_FACTOR;
dx = p2x - p1x;
dy = p2y - p1y;
dz = p2z - p1z;
if(the_tube->type == IS_TUBE) {
length = PointDist(the_tube->e1, the_tube->e2);
length = length / SCALE_FACTOR;
seg_length = length / the_tube->segments;
angle1 = 3.14149/2 - atan2(dz, dx);
angle2 = atan2(dy, -sin(-angle1)*dx + cos(-angle1)*dz);
glTranslatef(p1x, p1y, p1z);
glRotatef(angle1*57.3, 0.0 , 1.0, 0.0 );
glRotatef(angle2*57.3, -1.0 , 0.0, 0.0 );
segptr = the_tube->currents;
if (segptr == NULL) {
fprintf(stderr,"Fatal Current Magnitude\n");
exit(3);
} /** Current magnitude not available **/
for (i=0;isegments;i++) {
ComputeColor(segptr->currentMagnitude,
min_current_mag,
max_current_mag,
wire_color);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, wire_color);
TKA_Cylinder(the_tube->width*TUBE_WIDTH_SCALE, seg_length, s, r);
glTranslatef(0.0,0.0,seg_length);
segptr = segptr->next;
} /** For each segment **/
} else { /** Draw wall **/
glTranslatef(p1x, p1y, p1z);
glScalef(dx, dy, dz);
glTranslatef(0.5, 0.5, 0.5);
TKA_Cube(1.0);
} /** Not a tube **/
} /** End of DrawWireCurrentMagnitude **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawWireCurrentPhaseList **/
/** **/
/** Traverses the linked list of antenna elements and draws each one on **/
/** the screen, visualized the current phase of the wire. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawWireCurrentPhaseList(Tube *root,
Tube *current_tube,
double max_current_phase,
double min_current_phase,
GLint s,
GLint r) {
GLfloat red_color[] = {0.8, 0.1, 0.1, 1.0}; /** Rouge **/
GLfloat gray_color[] = {0.8, 0.9, 0.9, 0.9}; /** Gris **/
if(root != NULL) {
glPushMatrix();
if(current_tube == root)
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red_color);
else
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray_color);
glRotatef(180,1.0,0.0,0.0);
glRotatef(90.0, 1.0, 0.0, 0.0);
DrawWireCurrentPhase(root, max_current_phase, min_current_phase, s, r);
glPopMatrix();
DrawWireCurrentPhaseList(root->next,
current_tube,
max_current_phase,
min_current_phase,
s,
r);
} /** While not at end **/
} /** End of DrawWireCurrentPhaseList **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawWireCurrentPhase **/
/** **/
/** Renders an individual antenna element on the screen, color coded for **/
/** charge phase. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void DrawWireCurrentPhase(Tube *the_tube,
double max_current_phase,
double min_current_phase,
GLint s,
GLint r) {
double length; /** Length of the element **/
double seg_length; /** Each segment length **/
double angle1; /** Angle **/
double angle2; /** Angle **/
double dx; /** Delta in X direction **/
double dy; /** Delta in Y direction **/
double dz; /** Delta in Z direction **/
double p1x; /** Point 1 in X **/
double p1y; /** Point 1 in Y **/
double p1z; /** Point 1 in Z **/
double p2x; /** Point 2 in X **/
double p2y; /** Point 2 in Y **/
double p2z; /** Point 2 in Z **/
GLfloat wire_color[4]; /** Wire color **/
SegmentData *segptr; /** Segment data **/
int i; /** Loop counter **/
p1x = the_tube->e1.x;
p1y = the_tube->e1.y;
p1z = the_tube->e1.z;
if (p1x != 0.0) p1x = p1x / SCALE_FACTOR;
if (p1y != 0.0) p1y = p1y / SCALE_FACTOR;
if (p1z != 0.0) p1z = p1z / SCALE_FACTOR;
p2x = the_tube->e2.x;
p2y = the_tube->e2.y;
p2z = the_tube->e2.z;
if (p2x != 0.0) p2x = p2x / SCALE_FACTOR;
if (p2y != 0.0) p2y = p2y / SCALE_FACTOR;
if (p2z != 0.0) p2z = p2z / SCALE_FACTOR;
dx = p2x - p1x;
dy = p2y - p1y;
dz = p2z - p1z;
if(the_tube->type == IS_TUBE) {
length = PointDist(the_tube->e1, the_tube->e2);
length = length / SCALE_FACTOR;
seg_length = length / the_tube->segments;
angle1 = 3.14149/2 - atan2(dz, dx);
angle2 = atan2(dy, -sin(-angle1)*dx + cos(-angle1)*dz);
glTranslatef(p1x, p1y, p1z);
glRotatef(angle1*57.3, 0.0 , 1.0, 0.0 );
glRotatef(angle2*57.3, -1.0 , 0.0, 0.0 );
segptr = the_tube->currents;
if (segptr == NULL) {
fprintf(stderr,"Fatal Current Magnitude\n");
exit(3);
} /** Current magnitude not available **/
for (i=0;isegments;i++) {
ComputeColor(segptr->currentPhase,
min_current_phase,
max_current_phase,
wire_color);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, wire_color);
TKA_Cylinder(the_tube->width*TUBE_WIDTH_SCALE, seg_length, s, r);
glTranslatef(0.0,0.0,seg_length);
segptr = segptr->next;
} /** For each segment **/
} else { /** Draw wall **/
glTranslatef(p1x, p1y, p1z);
glScalef(dx, dy, dz);
glTranslatef(0.5, 0.5, 0.5);
TKA_Cube(1.0);
} /** Not a tube **/
} /** End of DrawWireCurrentPhase **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of VisWires.c **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/pcard.c 0000644 0001750 0001750 00000116226 11401515222 014620 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#define __USE_XOPEN_EXTENDED
#include
#include "ant.h"
#include "pcard.h"
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Global Variables **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
extern double curr_step_size; /** Current step size **/
extern int FreqSteps; /** Frequency steps **/
extern AntArray TheAnts; /** The antennas' geometries **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** PrintTube **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void PrintTube(FILE *f, Tube *tube, int tube_num) {
double y; /** Y coordinate of current segment **/
double z; /** Z coordinate of current segment **/
int i; /** Loop counter **/
double width; /** Width of tubes **/
int segments; /** Number of segments per side **/
segments = 10;
if(tube->type == IS_TUBE) {
fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num,
tube->segments,
tube->e1.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0,
tube->e2.x*100.0, tube->e2.y*100.0,
tube->e2.z*100.0, tube->width*100.0);
} else if(tube->type == IS_WALL) {
#if 0
/*left wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e1.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0,
tube->e1.x*100.0, tube->e2.y*100.0, tube->e2.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e1.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0);
/*right wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e2.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0,
tube->e2.x*100.0, tube->e2.y*100.0, tube->e2.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e2.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0);
/*front wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e1.x*100.0, tube->e2.y*100.0, tube->e2.z*100.0,
tube->e1.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e2.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0);
/*back wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e1.x*100.0, tube->e2.y*100.0, tube->e1.z*100.0,
tube->e1.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e2.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0);
/*top wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e1.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0,
tube->e2.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e2.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0);
/*bottom wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e1.x*100.0, tube->e2.y*100.0, tube->e1.z*100.0,
tube->e2.x*100.0, tube->e2.y*100.0, tube->e1.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e2.x*100.0, tube->e2.y*100.0, tube->e2.z*100.0);
#endif
fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num, 5,
tube->e1.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0,
tube->e1.x*100.0, tube->e1.y*100.0,
tube->e2.z*100.0, 5.0);
/*fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num+1, 5,
tube->e1.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0,
tube->e1.x*100.0, tube->e2.y*100.0,
tube->e2.z*100.0, 5.0);*/
fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num+2, 5,
tube->e1.x*100.0, tube->e2.y*100.0, tube->e2.z*100.0,
tube->e1.x*100.0, tube->e2.y*100.0,
tube->e1.z*100.0, 5.0);
/*fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num+3, 5,
tube->e1.x*100.0, tube->e2.y*100.0, tube->e1.z*100.0,
tube->e1.x*100.0, tube->e1.y*100.0,
tube->e1.z*100.0, 5.0);*/
for(i=0; i <= segments; i++) {
width = 0.5*fabs(tube->e2.z - tube->e1.z)/segments;
z = 100*(tube->e1.z + (tube->e2.z - tube->e1.z)*i/segments);
fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num, 5, tube->e1.x*100.0,tube->e1.y*100, z,
tube->e1.x*100.0, tube->e2.y*100, z, width);
y = 100*(tube->e1.y + (tube->e2.y - tube->e1.y)*i/segments);
fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num, 5, tube->e1.x*100.0, y, tube->e1.z*100,
tube->e1.x*100.0, y, tube->e2.z*100, width);
} /** Put in multiple wires **/
} /** Walls **/
} /** End of PrintTube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** PrintTubeOffset **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void PrintTubeOffset(FILE *f,
Tube *tube,
int tube_num,
double dx,
double dy,
double dz) {
double y; /** Y coordinate of current segment **/
double z; /** Z coordinate of current segment **/
int i; /** Loop counter **/
double width; /** Width of tubes **/
int segments; /** Number of segments per side **/
segments = 10;
if(tube->type == IS_TUBE) {
fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num,
tube->segments,
(tube->e1.x + dx) * 100.0,
(tube->e1.y + dy) * 100.0,
(tube->e1.z + dz) * 100.0,
(tube->e2.x + dx) * 100.0,
(tube->e2.y + dy) * 100.0,
(tube->e2.z + dz) * 100.0,
tube->width * 100.0);
} else if(tube->type == IS_WALL) {
#if 0
/*left wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e1.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0,
tube->e1.x*100.0, tube->e2.y*100.0, tube->e2.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e1.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0);
/*right wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e2.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0,
tube->e2.x*100.0, tube->e2.y*100.0, tube->e2.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e2.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0);
/*front wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e1.x*100.0, tube->e2.y*100.0, tube->e2.z*100.0,
tube->e1.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e2.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0);
/*back wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e1.x*100.0, tube->e2.y*100.0, tube->e1.z*100.0,
tube->e1.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e2.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0);
/*top wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e1.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0,
tube->e2.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e2.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0);
/*bottom wall*/
fprintf(f, "SP 0 1 %lf %lf %lf %lf %lf %lf \n",
tube->e1.x*100.0, tube->e2.y*100.0, tube->e1.z*100.0,
tube->e2.x*100.0, tube->e2.y*100.0, tube->e1.z*100.0);
fprintf(f, "SC 0 1 %lf %lf %lf 0 0 0\n",
tube->e2.x*100.0, tube->e2.y*100.0, tube->e2.z*100.0);
#endif
fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num, 5,
tube->e1.x*100.0, tube->e1.y*100.0, tube->e1.z*100.0,
tube->e1.x*100.0, tube->e1.y*100.0,
tube->e2.z*100.0, 5.0);
/*fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num+1, 5,
tube->e1.x*100.0, tube->e1.y*100.0, tube->e2.z*100.0,
tube->e1.x*100.0, tube->e2.y*100.0,
tube->e2.z*100.0, 5.0);*/
fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num+2, 5,
tube->e1.x*100.0, tube->e2.y*100.0, tube->e2.z*100.0,
tube->e1.x*100.0, tube->e2.y*100.0,
tube->e1.z*100.0, 5.0);
/*fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num+3, 5,
tube->e1.x*100.0, tube->e2.y*100.0, tube->e1.z*100.0,
tube->e1.x*100.0, tube->e1.y*100.0,
tube->e1.z*100.0, 5.0);*/
for(i=0; i <= segments; i++) {
width = 0.5*fabs(tube->e2.z - tube->e1.z)/segments;
z = 100*(tube->e1.z + (tube->e2.z - tube->e1.z)*i/segments);
fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num, 5, tube->e1.x*100.0,tube->e1.y*100, z,
tube->e1.x*100.0, tube->e2.y*100, z, width);
y = 100*(tube->e1.y + (tube->e2.y - tube->e1.y)*i/segments);
fprintf(f, "GW %d %d %lf %lf %lf %lf %lf %lf %lf\n",
tube_num, 5, tube->e1.x*100.0, y, tube->e1.z*100,
tube->e1.x*100.0, y, tube->e2.z*100, width);
} /** Put in multiple wires **/
} /** Walls **/
} /** End of PrintTubeOffset **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** WriteCardFile **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void WriteCardFile(CONST84 char *file_name, Ant *the_ant, int step_size, double freq) {
FILE *fout; /** Output file **/
char *card; /** Ouput buffer **/
Tube *the_tube; /** Current tube **/
int i; /** Loop counter **/
int curr_tube; /** Current tube **/
int increment; /** Increment in theta and phi **/
bool seen_rp; /** Seen the RP card **/
bool finished_tubes; /** Done drawing tubes **/
finished_tubes = false;
curr_tube = 1;
fout = fopen(file_name, "wt");
seen_rp = false;
if(fout == NULL)
fprintf(stderr, "Could not open file %s for writing\n", file_name);
else {
the_tube = the_ant->first_tube;
for(i=0; i < the_ant->card_count; i++) {
card = the_ant->cards[i];
if((card[0] == 'G') && (card[1] == 'W')) {
while((the_tube != NULL) && (!finished_tubes)) {
PrintTube(fout, the_tube, curr_tube++);
the_tube = the_tube->next;
}
finished_tubes = true;
} else if ((card[0] == 'R') && (card[1] == 'P')) {
if (seen_rp == false) {
increment = 361 / step_size;
fprintf(fout,"RP 0 %d %d 1001 0 0 %d %d 0 0\n",
increment, increment, step_size, step_size);
seen_rp = true;
} else {
} /** Have we already output RP? **/
} else if ((card[0] == 'F') && (card[1] == 'R')) {
fprintf(fout,"FR 0 1 0 0 %f .0000 .0000 .0000 .0000 .0000\n",freq);
} else if ((card[0] == 'G') && (card[1] == 'N')) {
/** Do nothing **/
} else {
fprintf(fout, "%s", card);
} /** Just output all other lines **/
} /** For each card **/
fclose(fout);
} /** Antenna exists in memory **/
} /** End of WriteCardFile **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** WriteMultAntsFile **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void WriteMultAntsFile(CONST84 char *file_name, int step_size, double freq) {
FILE *fout; /** Output file **/
char *card; /** Ouput buffer **/
Tube *the_tube; /** Current tube **/
int i; /** Loop counter **/
int k; /** Loop counter **/
int tag; /** Tag number **/
int curr_tube; /** Current tube **/
int increment; /** Increment in theta and phi **/
bool seen_rp; /** Seen the RP card **/
bool finished_tubes; /** Are we done yet **/
Ant *the_ant; /** Current antenna **/
finished_tubes = false;
fout = fopen(file_name, "wt");
seen_rp = false;
tag = 1;
if(fout == NULL)
fprintf(stderr, "Could not open file %s for writing\n", file_name);
else {
for(k=0; k < TheAnts.ant_count-1; k++) {
curr_tube = 1;
the_ant = &TheAnts.ants[k];
the_tube = the_ant->first_tube;
for(i=0; i < the_ant->card_count; i++) {
card = the_ant->cards[i];
if ((card[0] == 'C') && (card[1] == 'M') && (k==0)) {
fprintf(fout, "%s", card);
} else if ((card[0] == 'C') && (card[1] == 'E') && (k==0)) {
fprintf(fout, "%s", card);
} else if ((card[0] == 'G') && (card[1] == 'W')) {
while((the_tube != NULL) && (!finished_tubes)) {
PrintTubeOffset(fout,
the_tube,
tag++,
the_ant->dx,
the_ant->dy,
the_ant->dz);
the_tube = the_tube->next;
}
finished_tubes = true;
} /** Print out only geometry cards **/
} /** For each card **/
finished_tubes = false;
} /** For all but last antenna **/
curr_tube = 1;
the_ant = &TheAnts.ants[TheAnts.ant_count-1];
finished_tubes = false;
the_tube = the_ant->first_tube;
for(i=0; i < the_ant->card_count; i++) {
card = the_ant->cards[i];
if ((card[0] == 'C') && (card[1] == 'M')) {
if (TheAnts.ant_count == 1)
fprintf(fout, "%s", card);
} else if ((card[0] == 'C') && (card[1] == 'E')) {
if (TheAnts.ant_count == 1)
fprintf(fout, "%s", card);
} else if((card[0] == 'G') && (card[1] == 'W')) {
while((the_tube != NULL) && (!finished_tubes)) {
PrintTubeOffset(fout,
the_tube,
tag++,
the_ant->dx,
the_ant->dy,
the_ant->dz);
the_tube = the_tube->next;
} /** Output tubes **/
finished_tubes = true;
} else if ((card[0] == 'R') && (card[1] == 'P')) {
if (seen_rp == false) {
increment = 361 / step_size;
fprintf(fout,"RP 0 %d %d 1001 0 0 %d %d 0 0\n",
increment, increment, step_size, step_size);
seen_rp = true;
} else {
} /** Have we already output RP? **/
} else if ((card[0] == 'F') && (card[1] == 'R')) {
fprintf(fout,"FR 0 1 0 0 %f .0000 .0000 .0000 .0000 .0000\n",freq);
} else if ((card[0] == 'G') && (card[1] == 'N')) {
/** Do nothing **/
} else {
fprintf(fout, "%s", card);
} /** Just output all other lines **/
} /** For each card **/
finished_tubes = false;
} /** Antenna exists in memory **/
fclose(fout);
} /** End of WriteMultAntFile **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** CardToTube **/
/** **/
/** Returns true if the antenna is specified above ground. **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
bool CardToTube(char *card, Tube *tube) {
int card_num; /** Current card number **/
int seg_num; /** Number of segments **/
double x1; /** First X value **/
double y1; /** First Y value **/
double z1; /** First Z value **/
double x2; /** Second X value **/
double y2; /** Second Y value **/
double z2; /** Second Z value **/
bool returnval; /** Did we see positive Z **/
returnval = false;
sscanf(card+2, "%d%d%lf%lf%lf%lf%lf%lf%lf", &card_num, &seg_num,
&x1, &y1, &z1, &x2, &y2, &z2, &tube->width);
SetPoint(&tube->e1, x1/100.0, y1/100.0, z1/100.0);
SetPoint(&tube->e2, x2/100.0, y2/100.0, z2/100.0);
tube->width /= 100.0;
tube->segments = seg_num;
tube->type = IS_TUBE;
tube->currents = NULL;
if ((z1 > 0.0) || (z2 > 0.0))
returnval = true;
return returnval;
} /** End of CardToTube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ReadCardFile **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void ReadCardFile(CONST84 char *file_name, Ant *antData) {
FILE *fin; /** Input file **/
char line[256]; /** Input buffer **/
Tube new_tube; /** Current tube **/
char *result; /** Result of operation **/
bool seen_ground; /** Seen a ground yet **/
int dummy; /** Fields we ignore **/
double max_x; /** Dynamic range of X **/
double max_y; /** Dynamic range of Y **/
double max_z; /** Dynamic range of Z **/
double min_x; /** Dynamic range of X **/
double min_y; /** Dynamic range of Y **/
double min_z; /** Dynamic range of Z **/
double range_x; /** Dynamic range of X **/
double range_y; /** Dynamic range of Y **/
double range_z; /** Dynamic range of Z **/
double max_range; /** Maximum dynamic range **/
Tube *currentTube; /** For traversal **/
seen_ground = false;
fin = fopen(file_name, "rt");
antData->card_count=0;
antData->ground_specified = false;
antData->total_segments = 0;
if(fin == NULL)
fprintf(stderr, "Could not open file %s\n", file_name);
else {
result = fgets(line, 255, fin);
while(result != NULL) {
if((line[0] == 'C') && (line[1] == 'M')) {
if (strncmp(line+3,"ELEVATED_VERTICAL",17) == 0)
antData->type = ELEVATED_VERTICAL;
else if (strncmp(line+3,"VERTICAL",8) == 0)
antData->type = VERTICAL;
else if (strncmp(line+3,"QUAD",4) == 0)
antData->type = QUAD;
else if (strncmp(line+3,"YAGI",4) == 0)
antData->type = YAGI;
else if (strncmp(line+3,"DIPOLE",6) == 0)
antData->type = DIPOLE;
else
antData->type = UNKNOWN;
} /** Geometry cards **/
if((line[0] == 'G') && (line[1] == 'W')) {
seen_ground = CardToTube(line, &new_tube);
if (seen_ground == true)
antData->ground_specified = true;
antData->total_segments = antData->total_segments + new_tube.segments;
InsertTube(antData, &new_tube);
} /** Geometry cards **/
if((line[0] == 'G') && (line[1] == 'N')) {
antData->ground_specified = true;
} /** Ground cards **/
if((line[0] == 'F') && (line[1] == 'R')) {
sscanf(line+2, "%d%d%d%d%lf%d%d%d%d", &dummy, &dummy, &dummy, &dummy,
&antData->frequency, &dummy, &dummy, &dummy, &dummy);
/*
antData->ground_specified = false;
*/
} /** Ground cards **/
antData->cards[antData->card_count++] = strdup(line);
result = fgets(line, 255, fin);
} /** For each card **/
fclose(fin);
/** Check whether we read any tubes at all before proceeding. **/
if( antData->first_tube == NULL) {
fprintf(stderr,"No geometry tubes (GW lines) specified in file %s\n",file_name);
return;
}
/** Traverse list of elements to find dynamic range **/
/** We will need to scale things to accomodate all **/
/** sizes of antennas. **/
currentTube = antData->first_tube;
max_x = currentTube->e1.x;
max_y = currentTube->e1.y;
max_z = currentTube->e1.z;
min_x = currentTube->e1.x;
min_y = currentTube->e1.y;
min_z = currentTube->e1.z;
while (currentTube != NULL) {
if (currentTube->e1.x > max_x)
max_x = currentTube->e1.x;
if (currentTube->e2.x > max_x)
max_x = currentTube->e2.x;
if (currentTube->e1.y > max_y)
max_y = currentTube->e1.x;
if (currentTube->e2.y > max_y)
max_y = currentTube->e2.x;
if (currentTube->e1.z > max_z)
max_z = currentTube->e1.x;
if (currentTube->e2.z > max_z)
max_z = currentTube->e2.x;
if (currentTube->e1.x < min_x)
min_x = currentTube->e1.x;
if (currentTube->e2.x < min_x)
min_x = currentTube->e2.x;
if (currentTube->e1.y < min_y)
min_y = currentTube->e1.x;
if (currentTube->e2.y < min_y)
min_y = currentTube->e2.x;
if (currentTube->e1.z < min_z)
min_z = currentTube->e1.x;
if (currentTube->e2.z < min_z)
min_z = currentTube->e2.x;
currentTube = currentTube->next;
} /** Traverse tube list **/
range_x = max_x - min_x;
range_y = max_y - min_y;
range_z = max_z - min_z;
if (range_x > range_y) {
if (range_x > range_z)
max_range = range_x;
else
max_range = range_z;
} else {
if (range_y > range_z)
max_range = range_y;
else
max_range = range_z;
} /** Checking range **/
antData->visual_scale = 50 / max_range;
} /** File exists **/
} /** End of ReadCardFile **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ParseFieldData **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void ParseFieldData(FILE *fin,
Ant *currAnt,
bool compField,
bool compCurrents) {
char line[256]; /** A line in the nec_out file **/
char *ptr; /** Pointer **/
FieldVal val; /** Value of the radiation **/
char sense[10]; /** Buffer **/
int count; /** Running count **/
int max_data; /** Data limit **/
int i; /** Loop counter **/
bool done_first_line; /** Have we processed the first line? **/
bool end_of_file; /** Checks for end of file **/
SegmentData *segptr; /** Current data **/
int seg_num; /** Segment number **/
int tag_num; /** Wire tag **/
int card_num; /** Current card number **/
double dummyf; /** Data we don't care about **/
double mag; /** Magnitude of the current **/
double phase; /** Phase of the current **/
end_of_file = false;
fprintf(stdout,"Parsing NEC2 output...\n");
if (currAnt->fieldData == NULL)
currAnt->fieldData = calloc(1,sizeof(FieldData));
max_data = 1024;
currAnt->fieldData->count = 0;
currAnt->fieldData->maxgain = 0.0;
currAnt->fieldData->mingain = 0.0;
currAnt->fieldData->maxtilt = 0.0;
currAnt->fieldData->mintilt = 0.0;
currAnt->fieldData->vals = (FieldVal*)malloc(max_data*sizeof(FieldVal));
count = 0;
done_first_line = false;
if (compCurrents == true) {
do { /** Ignore everything up to currents **/
ptr = fgets(line, 256, fin);
if(strstr(line, "CURRENTS AND LOCATION") != NULL)
count++;
if(ptr == NULL) {
end_of_file = true;
} /** End of file **/
} while((count < 1) && (end_of_file == false));
if (end_of_file == false) { /** Advance to first line **/
for(i=0; i < 7; i++) {
ptr = fgets(line, 255, fin);
} /** Skip ahead **/
if (ptr == NULL)
end_of_file = true;
} /** End of file **/
currAnt->current_tube = currAnt->first_tube;
count = 0;
card_num = 1;
segptr = NULL;
while((end_of_file == false) && (count < currAnt->total_segments)) {
sscanf(line, "%d%d%lf%lf%lf%lf%lf%lf%lf%lf",
&seg_num, &tag_num, &dummyf, &dummyf,
&dummyf, &dummyf, &dummyf, &dummyf,
&mag, &phase);
if (tag_num > card_num) {
currAnt->current_tube = currAnt->current_tube->next;
card_num = tag_num;
segptr = NULL;
} /** Advance to next card **/
if (done_first_line == false) {
currAnt->max_current_mag = mag;
currAnt->min_current_mag = mag;
currAnt->max_current_phase = phase;
currAnt->min_current_phase = phase;
done_first_line = true;
} else {
if (mag > currAnt->max_current_mag)
currAnt->max_current_mag = mag;
if (mag < currAnt->min_current_mag)
currAnt->min_current_mag = mag;
if (phase > currAnt->max_current_phase)
currAnt->max_current_phase = phase;
if (phase < currAnt->min_current_phase)
currAnt->min_current_phase = phase;
} /** Updated max min **/
if (segptr == NULL) { /** First segment data **/
currAnt->current_tube->currents =
(SegmentData *)calloc(1,sizeof(SegmentData));
currAnt->current_tube->currents->currentMagnitude = mag;
currAnt->current_tube->currents->currentPhase = phase;
currAnt->current_tube->currents->next = NULL;
segptr = currAnt->current_tube->currents;
} else {
segptr->next =
(SegmentData *)calloc(1,sizeof(SegmentData));
segptr = segptr->next;
segptr->currentMagnitude = mag;
segptr->currentPhase = phase;
segptr->next = NULL;
} /** New segment data **/
fgets(line, 255, fin);
count++;
} /** Processing loop **/
currAnt->current_tube = currAnt->first_tube;
} /** Do we compute currents **/
if (compField == true) {
count = 0;
do { /** Ignore everything but RP **/
ptr = fgets(line, 256, fin);
if(strstr(line, "RADIATION PATTERNS") != NULL)
count++;
if(ptr == NULL) {
end_of_file = true;
} /** End of file **/
} while((count < 1) && (end_of_file == false));
if (end_of_file == false) {
for(i=0; i < 5; i++) {
ptr = fgets(line, 255, fin);
} /** Skip ahead **/
if (ptr == NULL)
end_of_file = true;
} /** End of file **/
count = 0;
while((end_of_file == false) && (strlen(line) > 1)) {
sscanf(line, "%lf%lf%lf%lf%lf%lf%lf%s%lf%lf%lf%lf",
&val.theta, &val.phi, &val.vert_gain, &val.hor_gain,
&val.total_gain, &val.axial_ratio, &val.tilt,
sense, &val.theta_mag, &val.theta_phase, &val.phi_mag,
&val.phi_phase);
if (done_first_line == false) {
currAnt->fieldData->maxgain = val.total_gain;
currAnt->fieldData->mingain = val.total_gain;
currAnt->fieldData->maxtilt = val.tilt;
currAnt->fieldData->mintilt = val.tilt;
currAnt->fieldData->maxaxialratio = val.axial_ratio;
currAnt->fieldData->minaxialratio = val.axial_ratio;
done_first_line = true;
} else {
if (val.total_gain > currAnt->fieldData->maxgain) {
currAnt->fieldData->maxgain = val.total_gain;
} /** Increase max gain **/
if (val.total_gain < currAnt->fieldData->mingain) {
currAnt->fieldData->mingain = val.total_gain;
} /** Increase max gain **/
if (val.tilt > currAnt->fieldData->maxtilt) {
currAnt->fieldData->maxtilt = val.tilt;
} /** Increase max tilt **/
if (val.tilt < currAnt->fieldData->mintilt) {
currAnt->fieldData->mintilt = val.tilt;
} /** Increase Max gain **/
if (val.axial_ratio > currAnt->fieldData->maxaxialratio) {
currAnt->fieldData->maxaxialratio = val.axial_ratio;
} /** Increase max tilt **/
if (val.axial_ratio < currAnt->fieldData->minaxialratio) {
currAnt->fieldData->minaxialratio = val.axial_ratio;
} /** Increase Max gain **/
} /** Updated max min **/
if (strncmp(sense,"LINEAR",6) == 0)
val.sense = LINEAR;
if(strncmp(sense,"RIGHT",5) == 0)
val.sense = RIGHT;
if (strncmp(sense,"LEFT",4) == 0)
val.sense = LEFT;
currAnt->fieldData->vals[count++] = val;
fgets(line, 255, fin);
if(count >= max_data) {
max_data *= 2;
currAnt->fieldData->vals = (FieldVal*)realloc(currAnt->fieldData->vals,
max_data*sizeof(FieldVal));
} /** Store **/
} /** Processing loop **/
currAnt->fieldData->count = count;
currAnt->fieldComputed = true;
} /** Compute field **/
if (end_of_file == true)
printf("NEC RP failed!\n");
} /** End of ParseFieldData **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** GetNextPattern **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void GetNextPattern(FILE *fin, FieldData *field_data) {
char line[256]; /** A line in the nec_out file **/
char *ptr; /** Pointer **/
FieldVal val; /** Value of the radiation **/
char sense[10]; /** Buffer **/
int count; /** Running count **/
int max_data; /** Data limit **/
int i; /** Loop counter **/
bool done_first_line; /** Have we processed the first line? **/
bool end_of_file; /** Checks for end of file **/
end_of_file = false;
fprintf(stdout,"Parsing NEC2 output...\n");
if (field_data == NULL)
field_data = calloc(1,sizeof(FieldData));
max_data = 1024;
field_data->count = 0;
field_data->maxgain = 0.0;
field_data->mingain = 0.0;
field_data->maxtilt = 0.0;
field_data->mintilt = 0.0;
field_data->vals = (FieldVal*)malloc(max_data*sizeof(FieldVal));
count = 0;
done_first_line = false;
do { /** Ignore everything but RP **/
ptr = fgets(line, 256, fin);
if(strstr(line, "RADIATION PATTERNS") != NULL)
count++;
if(ptr == NULL) {
end_of_file = true;
} /** End of file **/
} while((count < 1) && (end_of_file == false));
if (end_of_file == false) {
for(i=0; i < 5; i++) {
ptr = fgets(line, 255, fin);
} /** Skip ahead **/
if (ptr == NULL)
end_of_file = true;
} /** End of file **/
count = 0;
while((end_of_file == false) && (strlen(line) > 1)) {
sscanf(line, "%lf%lf%lf%lf%lf%lf%lf%s%lf%lf%lf%lf",
&val.theta, &val.phi, &val.vert_gain, &val.hor_gain,
&val.total_gain, &val.axial_ratio, &val.tilt,
sense, &val.theta_mag, &val.theta_phase, &val.phi_mag,
&val.phi_phase);
if (done_first_line == false) {
field_data->maxgain = val.total_gain;
field_data->mingain = val.total_gain;
field_data->maxtilt = val.tilt;
field_data->mintilt = val.tilt;
done_first_line = true;
} else {
if (val.total_gain > field_data->maxgain) {
field_data->maxgain = val.total_gain;
} /** Increase max gain **/
if (val.total_gain < field_data->mingain) {
field_data->mingain = val.total_gain;
} /** Increase max gain **/
if (val.tilt > field_data->maxtilt) {
field_data->maxtilt = val.tilt;
} /** Increase max tilt **/
if (val.tilt < field_data->mintilt) {
field_data->mintilt = val.tilt;
} /** Increase Max gain **/
} /** Updated max min **/
if (strncmp(sense,"LINEAR",6) == 0)
val.sense = LINEAR;
if(strncmp(sense,"RIGHT",5) == 0)
val.sense = RIGHT;
if (strncmp(sense,"LEFT",4) == 0)
val.sense = LEFT;
field_data->vals[count++] = val;
fgets(line, 255, fin);
if(count >= max_data) {
max_data *= 2;
field_data->vals = (FieldVal*)realloc(field_data->vals,
max_data*sizeof(FieldVal));
} /** Store **/
} /** Processing loop **/
field_data->count = count;
if (end_of_file == true)
printf("NEC RP failed!\n");
}
void WritePattern(FieldData *field_data, FILE *f) {
int i;
float gain;
fprintf(stderr, "Count = %d\n", field_data->count);
for(i=0; i < field_data->count; i++) {
gain = exp(field_data->vals[i].total_gain / 10.0);
gain = field_data->vals[i].total_gain;
fwrite(&gain, sizeof(float), 1, f);
}
}
void WriteHeader(int xd, int yd, int zd, FILE *f)
{
float xo, yo, zo;
float xs, ys, zs;
float min[3], max[3];
unsigned int nv, nc;
xo = 1.0;
yo = 1.0;
zo = 1.0;
xs = 1.0;
ys = 1.0;
zs = 1.0;
min[0] = xo;
min[1] = yo;
min[2] = zo;
max[0] = xo + xs*(xd-1);
max[1] = yo + ys*(yd-1);
max[2] = zo + zs*(zd-1);
fwrite(min, sizeof(float), 3, f);
fwrite(max, sizeof(float), 3, f);
nv = xd*yd*zd;
nc = (xd-1)*(yd-1)*(zd-1);
fwrite(&nv, sizeof(int), 1, f);
fwrite(&nc, sizeof(int), 1, f);
fwrite(&xd, sizeof(int), 1, f);
fwrite(&yd, sizeof(int), 1, f);
fwrite(&zd, sizeof(int), 1, f);
fwrite(&xo, sizeof(float), 1, f);
fwrite(&yo, sizeof(float), 1, f);
fwrite(&zo, sizeof(float), 1, f);
fwrite(&xs, sizeof(float), 1, f);
fwrite(&ys, sizeof(float), 1, f);
fwrite(&zs, sizeof(float), 1, f);
}
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of pcard.c **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/VisField.h 0000644 0001750 0001750 00000010011 10350336104 015224 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef VIS_FIELD_H
#define VIS_FIELD_H
#include "MyTypes.h"
#include "ant.h"
#include
#include
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Definitions **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
#define MAX_ANTENNAS 5
#define LINEAR 0
#define RIGHT 1
#define LEFT 2
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Function Prototypes **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void PlotPoint(GLfloat, GLfloat, GLfloat);
void DrawRFPowerDensityPoints(Ant *);
void DrawPolarizationSensePoints(Ant *);
void DrawPolarizationTiltPoints(Ant *);
void DrawShowNullsPoints(Ant *);
void DrawAxialRatioPoints(Ant *);
void DrawRFPowerDensitySurface(Ant *);
void DrawPolarizationSenseSurface(Ant *);
void DrawPolarizationTiltSurface(Ant *);
void DrawAxialRatioSurface(Ant *);
void DrawShowNullsSurface(Ant *);
void DrawRFPowerDensitySphere(Ant *);
void DrawPolarizationSenseSphere(Ant *);
void DrawPolarizationTiltSphere(Ant *);
void DrawAxialRatioSphere(Ant *);
void DrawShowNullsSphere(Ant *);
#endif
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of VisField.h **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/TkAntenna.c 0000644 0001750 0001750 00000010535 10350336103 015407 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include "MyTypes.h"
#include "TkAntenna.h"
#include "togl.h"
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Global Variables **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
char *TKA_PrgName; /* Name of the Program (= argv[0]) */
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Init **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local int Init(Tcl_Interp *interp) {
/* Initialize Tcl, Tk, Togl and the TkAntenna widget module. */
if (Tcl_Init(interp) == TCL_ERROR) return TCL_ERROR;
if (Tk_Init(interp) == TCL_ERROR) return TCL_ERROR;
if (Togl_Init(interp) == TCL_ERROR) return TCL_ERROR;
if (TKA_Init(interp) == TCL_ERROR) return TCL_ERROR;
return TCL_OK;
} /** End of Init **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Main **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
int main(int argc, char **argv) {
TKA_PrgName = argv[0];
Tk_Main(argc, argv, Init );
return 0;
} /** End of main **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of TkAntenna.c **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/TkAntenna.h 0000644 0001750 0001750 00000006504 11324333346 015425 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef TKANTENNA_H
#define TKANTENNA_H
#include "MyTypes.h"
#include
#include
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Global Variables **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
extern char *TKA_PrgName;
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Function Prototypes **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
extern int TKA_Init( Tcl_Interp *interp );
#endif
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of TkAntenna.h **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
antennavis-0.3.1.orig/INSTALL 0000644 0001750 0001750 00000000746 10401370607 014420 0 ustar tomy tomy You will need to install the tcl and tk development libraries and headers
to compile antennavis. Version 8.4 is recommended, but it will also work
with version 8.3. I have tried to use autoconf, which will hopefully detect
the needed libraries. You will only have to type: ./configure; make;
make install.
Antennavis also needs the OpenGL libraries and headers for compilation.
Om my Debian system the package needed is called libglu1-xorg-dev or
xlibmesa-glu-dev and xlibmesa-gl-dev.
antennavis-0.3.1.orig/AntennaWidget.c 0000644 0001750 0001750 00000163620 10401341643 016262 0 ustar tomy tomy /*****************************************************************************/
/*****************************************************************************/
/** **/
/** Antenna Visualization Toolkit **/
/** **/
/** Copyright (C) 1998 Adrian Agogino, Ken Harker **/
/** Copyright (C) 2005 Joop Stakenborg **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "togl.h"
#include "MyTypes.h"
#include "TkAntenna.h"
#include "ParseArgs.h"
#include "ant.h"
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Definitions **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
#define PIXEL_PER_MM 3.84 /** Pixels per millimeter **/
#define SCREEN_DISTANCE 500 /** Distance of the user to the screen **/
#define SCREEN_OFFSET 0.1 /** Empty space in front of ground plane **/
#define WINDOW_SIZE 500 /** Initial size of the window in pixels **/
#define WINDOW_OFFSET 200 /** Initial x/y offset of the window **/
#define EYE_LONGITUDE_INIT 0.0 /** Initial location of viewer **/
#define EYE_LATITUDE_INIT 30.0 /** Initial location of viewer **/
#define EYE_DISTANCE_MAX 5 /** Relative max. distance to antenna **/
#define EYE_DISTANCE_MIN 0.2 /** Relative min. distance to antenna **/
#define GPLANE_DISTANCE 2.0 /** Distance to ground plane **/
#define GPLANE_OFFSET 1.0 /** Ground plane offset **/
#define GPLANE_RADIUS 15.0 /** Radius of the ground plane **/
#define LIGHTMAX 8 /** Number of lights **/
#define SLICES_INIT 24 /** Disks and cylinders have many slices **/
#define RINGS_INIT 1 /** Disks and cylinders have many rings **/
typedef void (GLAPIENTRY *callback_t)();
#ifndef CALLBACK
#define CALLBACK
#endif
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Global Variables **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
extern double SCALE_FACTOR; /** Antenna scale factor **/
extern double DEFAULT_BOOMHEIGHT; /** No height above ground specd **/
extern double POINT_DIST_SCALE; /** For point clouds, mult of dBi **/
extern double POINT_SIZE_SCALE; /** ..also in terms of dBi **/
extern double STEP_SIZE; /** Degrees between control points **/
extern double NULL_THRESHOLD; /** As a percentage of max dBi **/
extern double NULL_DISTANCE; /** So null maps float above **/
extern double ALPHA; /** Alpha transparency factor **/
extern int WireDrawMode; /** Mode to draw the wires in **/
extern int MultipleAntMode; /** Current antenna or all in phase **/
extern int ShowRadPat; /** Do we show radiation pattern **/
extern int ShowPolSense; /** Do we show polarization sense? **/
extern int ShowPolTilt; /** Do we show polarization tilt? **/
extern int ShowAxialRatio; /** Show axial ratios? **/
extern int ShowNulls; /** Do we show nulls in pattern? **/
extern int FreqSteps; /** Number of frequencies **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Structs and Types **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
enum MaterialType {Antenna, Gplane, Cube, SizeOfMaterialType};
enum LightType {off, directional, positional, spot};
struct Material {
bool SmoothShade; /** SmoothShade **/
GLfloat Ambient[4]; /** Ambient **/
GLfloat Diffuse[4]; /** Diffuse **/
GLfloat Specular[4]; /** Specular **/
GLfloat Emission[4]; /** Emmission **/
GLfloat Shininess; /** Shininess **/
}; /** End of Material **/
struct Light {
GLenum Number; /** Number of light **/
enum LightType Type; /** Type of Light **/
GLfloat Ambient[4]; /** Ambient **/
GLfloat Diffuse[4]; /** Diffuse **/
GLfloat Specular[4]; /** Specular **/
GLfloat Longitude; /** Longitude **/
GLfloat Latitude; /** Latitude **/
GLfloat Distance; /** Distance **/
GLfloat Position[4]; /** Position **/
GLint Spot_x; /** Spotlight **/
GLint Spot_y; /** Spotlight **/
GLfloat Spot_Pos[4]; /** Spotlight **/
GLfloat Spot_Exponent; /** Spotlight **/
GLfloat Spot_Cutoff; /** Spotlight **/
GLfloat Attenuation_Constant; /** Attenuation **/
GLfloat Attenuation_Linear; /** Attenuation **/
GLfloat Attenuation_Quadratic; /** Attenuation **/
}; /** End of Light **/
struct Antenna {
GLfloat Eye_Longitude; /** Eye position **/
GLfloat Eye_Latitude; /** Eye position **/
GLfloat Eye_Distance; /** Eye position **/
GLfloat Eye_Distance_Min; /** Eye position **/
GLfloat Eye_Distance_Max; /** Eye position **/
GLfloat Global_Ambient[4]; /** Ambient light **/
GLfloat Global_Background[4]; /** Background light **/
bool Global_Viewer; /** Global viewer **/
GLint Global_Slices; /** Global slices **/
GLint Global_Rings; /** Global rings **/
struct Material material[SizeOfMaterialType]; /** Materials **/
struct Light light[LIGHTMAX]; /** Lights **/
}; /** End of Antenna **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Function Prototypes **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local void TKA_Display(struct Togl *togl);
local void TKA_Reshape(struct Togl *togl);
local void TKA_Rotate(GLfloat ax, GLfloat ay, GLfloat az);
local GLfloat TKA_Angle(GLfloat size, GLfloat distance);
local void TKA_Disk(GLfloat radius, GLint slices, GLint rings);
void CALLBACK TKA_ErrorCallback(GLenum errorCode);
void TKA_Cylinder(GLfloat radius,
GLfloat height,
GLint slices,
GLint rings);
void TKA_Cube(GLfloat size);
local void TKA_Create(struct Togl *togl);
local void TKA_Destroy(struct Togl *togl);
local GLint TKA_Reset(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_Eye(struct Togl *togl, GLint argc, CONST84 char **argv);
local void TKA_SetMaterial(struct Material *m);
local void TKA_SetLight(struct Light *l, GLfloat eyemin, GLfloat eyemax);
local GLint TKA_Global(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_Material(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_Light(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_StdAnt(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_LoadAnt(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_DeleteAnt(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_AddElement(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_ControlTube(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_ControlAnt(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_ChangeCurrentTube(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_ChangeCurrentAnt(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_DrawRFPowerDensity(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_SaveFile(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_SaveRGBImage(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_MoveCenter(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_GetVariable(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_ChangeDrawMode(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_ChangeWireDrawMode(struct Togl *togl, GLint argc, CONST84 char **argv);
local GLint TKA_ChangeAntMode(struct Togl *togl, GLint argc, CONST84 char **argv);
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Global Variables **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLUquadricObj *Qobj; /** Quadratic object **/
local struct PA_Config CfgEye[] = {
{PA_FLOAT,"longitude",Tk_Offset(struct Antenna, Eye_Longitude)},
{PA_FLOAT,"latitude",Tk_Offset(struct Antenna, Eye_Latitude)},
{PA_FLOAT,"distance",Tk_Offset(struct Antenna, Eye_Distance)},
{PA_END, NULL, 0}
}; /** Configuration specification for eye position **/
local struct PA_Config CfgGlobal[] = {
{PA_RGB, "ambient", Tk_Offset( struct Antenna, Global_Ambient)},
{PA_RGB, "background", Tk_Offset( struct Antenna, Global_Background)},
{PA_BOOL, "viewer", Tk_Offset( struct Antenna, Global_Viewer)},
{PA_INT, "slices", Tk_Offset( struct Antenna, Global_Slices)},
{PA_INT, "rings", Tk_Offset( struct Antenna, Global_Rings)},
{PA_END, NULL, 0}
}; /** Configuration specification for global **/
local struct PA_Config CfgMaterial[] = {
{PA_BOOL, "smooth", Tk_Offset( struct Material, SmoothShade)},
{PA_RGB, "ambient", Tk_Offset( struct Material, Ambient)},
{PA_RGB, "diffuse", Tk_Offset( struct Material, Diffuse)},
{PA_RGB, "specular", Tk_Offset( struct Material, Specular)},
{PA_RGB, "emission", Tk_Offset( struct Material, Emission)},
{PA_FLOAT, "shininess", Tk_Offset( struct Material, Shininess)},
{PA_END, NULL, 0}
}; /** Configuration specification for material **/
local struct PA_Config CfgLight[] = {
{PA_INT, "type", Tk_Offset( struct Light, Type)},
{PA_RGB, "ambient", Tk_Offset( struct Light, Ambient)},
{PA_RGB, "diffuse", Tk_Offset( struct Light, Diffuse)},
{PA_RGB, "specular", Tk_Offset( struct Light, Specular)},
{PA_FLOAT, "longitude", Tk_Offset( struct Light, Longitude)},
{PA_FLOAT, "latitude", Tk_Offset( struct Light, Latitude)},
{PA_FLOAT, "distance", Tk_Offset( struct Light, Distance)},
{PA_INT, "x", Tk_Offset( struct Light, Spot_x)},
{PA_INT, "y", Tk_Offset( struct Light, Spot_y)},
{PA_FLOAT, "exponent", Tk_Offset( struct Light, Spot_Exponent)},
{PA_FLOAT, "cutoff", Tk_Offset( struct Light, Spot_Cutoff)},
{PA_FLOAT, "constant", Tk_Offset( struct Light, Attenuation_Constant)},
{PA_FLOAT, "linear", Tk_Offset( struct Light, Attenuation_Linear)},
{PA_FLOAT, "quadratic", Tk_Offset( struct Light, Attenuation_Quadratic)},
{PA_END, NULL, 0}
}; /** Configuration specification for light **/
local GLenum LightNum[] = {GL_LIGHT0, GL_LIGHT1, GL_LIGHT2, GL_LIGHT3,
GL_LIGHT4, GL_LIGHT5, GL_LIGHT6, GL_LIGHT7};
local bool antennaChanged = false;
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Init **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
GLint TKA_Init(Tcl_Interp *interp) {
srand(time(NULL));
/** Init quadratics **/
assert(Qobj = gluNewQuadric());
gluQuadricCallback(Qobj, GLU_ERROR, (callback_t)TKA_ErrorCallback);
gluQuadricDrawStyle(Qobj, GLU_FILL);
gluQuadricNormals(Qobj, GLU_FLAT);
/** Setup callback functions **/
Togl_CreateFunc(TKA_Create);
Togl_DestroyFunc(TKA_Destroy);
Togl_DisplayFunc(TKA_Display);
Togl_ReshapeFunc(TKA_Reshape);
/** Setup togl sub-commands **/
Togl_CreateCommand("reset", TKA_Reset);
Togl_CreateCommand("eye", TKA_Eye);
Togl_CreateCommand("add_element", TKA_AddElement);
Togl_CreateCommand("global", TKA_Global);
Togl_CreateCommand("material", TKA_Material);
Togl_CreateCommand("light", TKA_Light);
Togl_CreateCommand("std_ant", TKA_StdAnt);
Togl_CreateCommand("load_ant", TKA_LoadAnt);
Togl_CreateCommand("delete_ant", TKA_DeleteAnt);
Togl_CreateCommand("control_tube", TKA_ControlTube);
Togl_CreateCommand("control_ant", TKA_ControlAnt);
Togl_CreateCommand("change_current_tube", TKA_ChangeCurrentTube);
Togl_CreateCommand("change_current_ant", TKA_ChangeCurrentAnt);
Togl_CreateCommand("draw_RFPowerDensity", TKA_DrawRFPowerDensity);
Togl_CreateCommand("save_file", TKA_SaveFile);
Togl_CreateCommand("save_rgb_image", TKA_SaveRGBImage);
Togl_CreateCommand("move_center", TKA_MoveCenter);
Togl_CreateCommand("get_var", TKA_GetVariable);
Togl_CreateCommand("change_mode", TKA_ChangeDrawMode);
Togl_CreateCommand("change_wire_mode", TKA_ChangeWireDrawMode);
Togl_CreateCommand("change_ant_mode", TKA_ChangeAntMode);
return TCL_OK;
} /** End of Init **/
extern Point Center;
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Display **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local void TKA_Display(struct Togl *togl) {
struct Antenna *antenna = Togl_GetClientData(togl); /** Antenna data **/
GLint s = antenna->Global_Slices; /** Slices **/
GLint r = antenna->Global_Rings; /** Rings **/
glClearColor(antenna->Global_Background[0],
antenna->Global_Background[1],
antenna->Global_Background[2],
antenna->Global_Background[3]);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER,
(antenna->Global_Viewer) ? GL_TRUE : GL_FALSE);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, antenna->Global_Ambient);
glMatrixMode(GL_MODELVIEW);
/** Eye point transformations **/
glLoadIdentity();
glTranslatef(0.0,
0.0,
-(antenna->Eye_Distance *
(antenna->Eye_Distance_Max - antenna->Eye_Distance_Min)
+ antenna->Eye_Distance_Min));
TKA_Rotate(antenna->Eye_Latitude, 0.0, 0.0);
TKA_Rotate(0.0, antenna->Eye_Longitude, 0.0);
/** Ground plane **/
glTranslatef(Center.x, Center.y, Center.z);
TKA_SetMaterial(&(antenna->material[Gplane]));
glPushMatrix();
TKA_Rotate(-90.0, 0.0, 0.0);
TKA_Disk(GPLANE_RADIUS, s, r);
glPopMatrix();
DisplayAnt(s, r);
Togl_SwapBuffers(togl);
} /** End of Display **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Reshape **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local void TKA_Reshape(struct Togl *togl) {
struct Antenna *antenna = Togl_GetClientData(togl); /** Antenna data **/
GLint w = Togl_Width(togl); /** Width window **/
GLint h = Togl_Height(togl); /** Width height **/
glViewport(0,0,(GLsizei)w,(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective((GLdouble)2.0 * TKA_Angle(h/(PIXEL_PER_MM * 2.0),
SCREEN_DISTANCE),(GLdouble) w/(GLdouble) h,
(GLdouble) antenna->Eye_Distance_Min - GPLANE_RADIUS,
(GLdouble) antenna->Eye_Distance_Max + antenna->Eye_Distance_Min);
} /** End of Reshape **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Rotate **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local void TKA_Rotate(GLfloat ax, GLfloat ay, GLfloat az) {
GLfloat m[16]; /** Matrix **/
GLfloat sx = sin(radian(ax)); /** Sin of X **/
GLfloat cx = cos(radian(ax)); /** Cosine of X **/
GLfloat sy = sin(radian(ay)); /** Sin of Y **/
GLfloat cy = cos(radian(ay)); /** Cosine of Y **/
GLfloat sz = sin(radian(az)); /** Sin of Z **/
GLfloat cz = cos(radian(az)); /** Cosine of Z **/
m[ 0] = cy * cz;
m[ 1] = cy * sz;
m[ 2] = -sy;
m[ 3] = 0;
m[ 4] = sx * sy * cz - cx * sz;
m[ 5] = sx * sy * sz + cx * cz;
m[ 6] = sx * cy;
m[ 7] = 0;
m[ 8] = cx * sy * cz + sx * sz;
m[ 9] = cx * sy * sz - sx * cz;
m[10] = cx * cy;
m[11] = 0;
m[12] = 0;
m[13] = 0;
m[14] = 0;
m[15] = 1;
glMultMatrixf(m);
} /** End of Rotate **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Angle **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLfloat TKA_Angle(GLfloat size, GLfloat distance) {
return degree(atan2(size, distance));
} /** End of angle **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Disk **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local void TKA_Disk(GLfloat radius, GLint slices, GLint rings) {
gluDisk(Qobj, 0.0, (GLdouble) radius, slices, rings);
} /** End of Disk **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ErrorCallback **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void CALLBACK TKA_ErrorCallback(GLenum errorCode) {
const GLubyte *estring; /** Error string **/
estring = gluErrorString(errorCode);
fprintf(stderr, "%s FATAL QUADRATIC ERROR: %s\n", TKA_PrgName, estring);
exit(EXIT_FAILURE);
} /** End of ErrorCallBack **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Cylinder **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void TKA_Cylinder(GLfloat radius, GLfloat height, GLint slices, GLint rings) {
glPushMatrix();
glPushMatrix();
glTranslatef(0.0, 0.0, height);
TKA_Disk(radius, slices, rings);
glPopMatrix();
gluCylinder(Qobj, radius, radius, height, slices, rings);
TKA_Rotate(180.0, 0.0, 180.0);
TKA_Disk(radius, slices, rings);
glPopMatrix();
} /** End of Cylinder **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Cube **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
void TKA_Cube(GLfloat size) {
glPushMatrix();
glTranslatef(0.0, 0.0, -size / 2.0);
TKA_Rotate(0.0, 0.0, 45.0);
glPushMatrix();
glTranslatef(0.0, 0.0, size);
gluDisk(Qobj, 0.0, (GLdouble) size / 1.414, 4, 1);
glPopMatrix();
gluCylinder(Qobj, size / 1.414, size / 1.414, size, 4, 1);
TKA_Rotate(180.0, 0.0, 0.0);
gluDisk(Qobj, 0.0, (GLdouble) size / 1.414, 4, 1);
glPopMatrix();
} /** End of cube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Create **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local void TKA_Create(struct Togl *togl) {
struct Antenna *antenna; /** Antenna **/
GLint i; /** Loop counter **/
GLint wm; /** Window size in mm **/
wm = WINDOW_SIZE*(1-SCREEN_OFFSET)/PIXEL_PER_MM;
antenna = Togl_GetClientData( togl );
if(antenna == NULL) {
assert(antenna = calloc(1,sizeof(struct Antenna)));
antenna->Eye_Longitude = EYE_LONGITUDE_INIT;
antenna->Eye_Latitude = EYE_LATITUDE_INIT;
antenna->Eye_Distance = GPLANE_RADIUS * SCREEN_DISTANCE / (wm / 2.0);
antenna->Eye_Distance_Min = antenna->Eye_Distance * EYE_DISTANCE_MIN;
antenna->Eye_Distance_Max = antenna->Eye_Distance * EYE_DISTANCE_MAX;
antenna->Eye_Distance = (antenna->Eye_Distance - antenna->Eye_Distance_Min)
/ (antenna->Eye_Distance_Max - antenna->Eye_Distance_Min);
} /** Set global values **/
/** Color of background **/
/*
antenna->Global_Background[0] = 0.4;
antenna->Global_Background[1] = 0.6;
antenna->Global_Background[2] = 0.8;
*/
antenna->Global_Background[0] = 0.0;
antenna->Global_Background[1] = 0.0;
antenna->Global_Background[2] = 0.05;
antenna->Global_Viewer = true;
antenna->Global_Slices = SLICES_INIT;
antenna->Global_Rings = RINGS_INIT;
antenna->material[Antenna].Ambient[0] = 0.1;
antenna->material[Antenna].Ambient[1] = 0.2;
antenna->material[Antenna].Ambient[2] = 0.3;
antenna->material[Antenna].Diffuse[0] = 0.1;
antenna->material[Antenna].Diffuse[1] = 0.4;
antenna->material[Antenna].Diffuse[2] = 0.7;
antenna->material[Gplane].Ambient[0] = 0.2;
antenna->material[Gplane].Ambient[1] = 0.2;
antenna->material[Gplane].Ambient[2] = 0.2;
antenna->material[Gplane].Diffuse[0] = 0.5;
antenna->material[Gplane].Diffuse[1] = 0.5;
antenna->material[Gplane].Diffuse[2] = 0.5;
/** light **/
for(i = 0; i < LIGHTMAX; i++) {
antenna->light[i].Number = LightNum[i];
if(i == 0) {
antenna->light[i].Type = directional;
antenna->light[i].Ambient[0] = 0.7;
antenna->light[i].Ambient[1] = 0.7;
antenna->light[i].Ambient[2] = 0.7;
antenna->light[i].Diffuse[0] = 1.0;
antenna->light[i].Diffuse[1] = 1.0;
antenna->light[i].Diffuse[2] = 1.0;
antenna->light[i].Longitude = 315.0;
antenna->light[i].Latitude = 45.0;
} else {
antenna->light[i].Type = off;
antenna->light[i].Longitude = 360.0 / LIGHTMAX * i;
antenna->light[i].Latitude = 90.0 / LIGHTMAX * i;
} /** First light **/
antenna->light[i].Distance = 1.0 / LIGHTMAX * i;
antenna->light[i].Spot_Cutoff = 10.0;
antenna->light[i].Attenuation_Constant = 1.0;
TKA_SetLight(&(antenna->light[i]),
antenna->Eye_Distance_Min,
antenna->Eye_Distance_Max );
} /** For each light **/
Togl_SetClientData(togl, antenna);
/** Initialize openGL environment **/
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
} /** End of Create **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Destroy **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local void TKA_Destroy(struct Togl *togl) {
struct Antenna *antenna; /** The antenna **/
antenna = Togl_GetClientData(togl);
free(antenna);
Togl_SetClientData(togl, NULL);
} /** End of Destroy **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Reset **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_Reset(struct Togl *togl, GLint argc, CONST84 char **argv) {
TKA_Create(togl);
Togl_PostRedisplay(togl);
if(argc > 2) {
Tcl_SetResult(Togl_Interp(togl),
"PA_ParseArgs ERROR: Too many arguments for reset!", TCL_STATIC);
return TCL_ERROR;
} /** End of error **/
return TCL_OK;
} /** End of reset **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Eye **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_Eye(struct Togl *togl, GLint argc, CONST84 char **argv) {
struct Antenna *antenna = Togl_GetClientData(togl); /** Antenna data **/
GLint result; /** Result **/
result = PA_ParseArgs(Togl_Interp(togl), argc-2, argv+2, CfgEye, antenna);
if(result == PA_CHANGED) {
Togl_PostRedisplay(togl);
result = TCL_OK;
} /** Result **/
return result;
} /** End of eye **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** AddElement **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_AddElement(struct Togl *togl, GLint argc, CONST84 char **argv) {
struct Antenna *antenna = Togl_GetClientData(togl); /** Set up antenna **/
GLint result; /** Result **/
result = PA_ParseArgs(Togl_Interp(togl), argc-2, argv+2, CfgEye, antenna);
if(result == PA_CHANGED) {
Togl_PostRedisplay(togl);
result = TCL_OK;
} /** If changed **/
return result;
} /** End of AddElement **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** StdAnt **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_StdAnt(struct Togl *togl, GLint argc, CONST84 char **argv) {
char file_name[256]; /** Name of file **/
GLint result; /** Result **/
if(strcmp(argv[2], "Load Yagi") == 0) {
ReadFile("yagi.nec");
} /** Yagi **/
else if(strcmp(argv[2], "FromFile") == 0) {
printf("Enter name of file:");
scanf("%s", file_name);
ReadFile(file_name);
} /** From a file **/
else if(strcmp(argv[2], "Wall") == 0) {
AddWall();
} /** Add a wall **/
Togl_PostRedisplay(togl);
result = TCL_OK;
antennaChanged = true;
return result;
} /** End of StdAnt **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** TKA_LoadAnt **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_LoadAnt(struct Togl *togl, GLint argc, CONST84 char **argv) {
GLint result; /** Result **/
fprintf(stderr, "File Name = %s\n", argv[2]);
ReadFile(argv[2]);
Togl_PostRedisplay(togl);
result = TCL_OK;
antennaChanged = true;
return result;
} /** End of LoadAnt **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** TKA_DeleteAnt **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_DeleteAnt(struct Togl *togl, GLint argc, char CONST84 **argv) {
GLint result; /** Result **/
DeleteCurrentAnt();
Togl_PostRedisplay(togl);
result = TCL_OK;
antennaChanged = true;
return result;
} /** End of LoadAnt **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ControlAnt **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_ControlAnt(struct Togl *togl, GLint argc, CONST84 char **argv) {
GLint result; /** Result **/
int func; /** Function **/
if(argc >= 4) {
func = atoi(argv[2]);
/*printf("func = %d argv[3]=%lf\n", func, argv[3]);*/
if(func == 1)
MoveCurrentAnt(atof(argv[3])/20, 0, 0);
else if(func == 2)
MoveCurrentAnt(0, 0, atof(argv[3])/20);
else if(func == 3)
MoveCurrentAnt(0, atof(argv[3])/20, 0);
} /** Moving tubes around **/
Togl_PostRedisplay(togl);
result = TCL_OK;
antennaChanged = true;
return result;
} /** End of ControlAnt **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ControlTube **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_ControlTube(struct Togl *togl, GLint argc, CONST84 char **argv) {
GLint result; /** Result **/
int func; /** Function **/
if(argc >= 4) {
func = atoi(argv[2]);
/** Element position **/
if(func == 1)
MoveCurrentTube(atof(argv[3])/20, 0, 0);
else if(func == 2)
MoveCurrentTube(0, atof(argv[3])/20, 0);
else if(func == 3)
MoveCurrentTube(0, 0, atof(argv[3])/20);
/** Element Size **/
else if(func == 4)
ScaleCurrentTube(atof(argv[3])/50, 0);
else if(func == 5)
ScaleCurrentTube(0, atof(argv[3])/50);
/** Wall Size **/
else if(func == 7)
ScaleCurrentWall(atof(argv[3])/50, 0, 0);
else if(func == 8)
ScaleCurrentWall(0, atof(argv[3])/50, 0);
else if(func == 9)
ScaleCurrentWall(0, 0, atof(argv[3])/50);
/** Wall Position **/
else if(func == 10)
MoveCurrentWall(atof(argv[3])/20, 0, 0);
else if(func == 11)
MoveCurrentWall(0, atof(argv[3])/20, 0);
else if(func == 12)
MoveCurrentWall(0, 0, atof(argv[3])/20);
/** Rotate Tube **/
else if(func == 13)
RotateCurrentTube(atof(argv[3]), 0, 0);
else if(func == 14)
RotateCurrentTube(0, atof(argv[3]), 0);
else if(func == 15)
RotateCurrentTube(0, 0, atof(argv[3]));
} /** Moving tubes around **/
Togl_PostRedisplay(togl);
result = TCL_OK;
antennaChanged = true;
return result;
} /** End of Control_Tube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ChangeCurrentAnt **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_ChangeCurrentAnt(struct Togl *togl, GLint argc, CONST84 char **argv) {
GLint result; /** Result **/
if(argc >= 3) {
ChangeCurrentAnt(atoi(argv[2]));
} /** Change the tube **/
Togl_PostRedisplay(togl);
result = TCL_OK;
return result;
} /** End of ChangeCurrentTube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ChangeCurrentTube **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_ChangeCurrentTube(struct Togl *togl, GLint argc, CONST84 char **argv) {
GLint result; /** Result **/
if(argc >= 3) {
ChangeCurrentTube(atoi(argv[2]));
} /** Change the tube **/
Togl_PostRedisplay(togl);
result = TCL_OK;
return result;
} /** End of ChangeCurrentTube **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ChangeDrawMode **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_ChangeDrawMode(struct Togl *togl, GLint argc, CONST84 char **argv) {
GLint result; /** Result **/
if (strcmp(argv[2],"DrawMode") == 0) {
if (strcmp(argv[3],"Dots") == 0) {
ToggleDrawMode(0);
} /** Dots **/
if (strcmp(argv[3],"Surface") == 0) {
ToggleDrawMode(1);
} /** Polygons **/
if (strcmp(argv[3],"Sphere") == 0) {
ToggleDrawMode(2);
} /** Polygons **/
} /** DrawMode **/
else if(strcmp(argv[2], "Scale") == 0) {
SCALE_FACTOR = 15.0/atof(argv[3]);
} /** Antenna scale **/
else if(strcmp(argv[2], "StepSize") == 0) {
antennaChanged = true;
STEP_SIZE = atof(argv[3]);
} /** Step size **/
else if(strcmp(argv[2], "DBHeight") == 0) {
DEFAULT_BOOMHEIGHT = atof(argv[3]);
} /** Default boom height **/
else if(strcmp(argv[2], "PDScale") == 0) {
POINT_DIST_SCALE = atof(argv[3]);
} /** Field scale **/
else if(strcmp(argv[2], "PSScale") == 0) {
POINT_SIZE_SCALE = atof(argv[3])/100.0;
} /** Dot size **/
else if(strcmp(argv[2], "NullThreshold") == 0) {
NULL_THRESHOLD = atof(argv[3])/10.0;
} /** Null threshold value **/
else if(strcmp(argv[2], "Alpha") == 0) {
ALPHA = atof(argv[3])/10.0;
} /** Alpha value **/
else if(strcmp(argv[2], "Freq") == 0) {
ChangeFrequency(atof(argv[3]));
antennaChanged = true;
} /** Frequency **/
else if(strcmp(argv[2], "FreqSteps") == 0) {
FreqSteps = atoi(argv[3]) ;
} /** Frequency **/
else if(strcmp(argv[2], "ShowRadPat") == 0) {
ShowRadPat = atoi(argv[3]);
} /** Radiation pattern checkbox **/
else if(strcmp(argv[2], "ShowPolSense") == 0) {
ShowPolSense = atoi(argv[3]);
} /** Polarization sense checkbox **/
else if(strcmp(argv[2], "ShowPolTilt") == 0) {
ShowPolTilt = atoi(argv[3]);
} /** Polarization tilt checkbox **/
else if(strcmp(argv[2], "ShowAxialRatio") == 0) {
ShowAxialRatio = atoi(argv[3]);
} /** Axial ratio checkbox **/
else if(strcmp(argv[2], "ShowNulls") == 0) {
ShowNulls = atoi(argv[3]);
} /** Nulls in pattern checkbox **/
Togl_PostRedisplay(togl);
result = TCL_OK;
return result;
} /** End of ChangeDrawMode **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ChangeWireDrawMode **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_ChangeWireDrawMode(struct Togl *togl, GLint argc, CONST84 char **argv) {
GLint result; /** Result **/
if(strcmp(argv[2], "ShowCurrentMagnitude") == 0) {
WireDrawMode = atoi(argv[3]);
} /** Current magnitude **/
else if(strcmp(argv[2], "ShowCurrentPhase") == 0) {
WireDrawMode = atoi(argv[3]);
} /** Current phase **/
else if(strcmp(argv[2], "ShowGeometry") == 0) {
WireDrawMode = atoi(argv[3]);
} /** No wire visualization **/
Togl_PostRedisplay(togl);
result = TCL_OK;
return result;
} /** End of ChangeWireDrawMode **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** ChangeAntMode **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_ChangeAntMode(struct Togl *togl, GLint argc, CONST84 char **argv) {
GLint result; /** Result **/
if(strcmp(argv[2], "SingleAnt") == 0) {
MultipleAntMode = atoi(argv[3]);
} /** Single antenna **/
else if(strcmp(argv[2], "MultipleAnt") == 0) {
MultipleAntMode = atoi(argv[3]);
} /** All antennas **/
Togl_PostRedisplay(togl);
result = TCL_OK;
return result;
} /** End of ChangeAntMode **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** DrawRFPowerDensity **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_DrawRFPowerDensity(struct Togl *togl, GLint argc, CONST84 char **argv) {
GLint result; /** Result **/
if(argc >= 2) {
ComputeField(antennaChanged);
if (antennaChanged == true)
antennaChanged=false;
} /** Draw the field **/
Togl_PostRedisplay(togl);
result = TCL_OK;
return result;
} /** End of DrawRFPowerDensity **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** SaveFile **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_SaveFile(struct Togl *togl, GLint argc, CONST84 char **argv) {
char file_name[255]; /** File name **/
GLint result; /** Result **/
if(argc >= 2) {
if (argc >= 3)
GenerateNECFile(argv[2]);
else
{
printf("Enter name of file:");
scanf("%s", file_name);
GenerateNECFile(file_name);
}
} /** Generate file **/
Togl_PostRedisplay(togl);
result = TCL_OK;
return result;
} /** End of SaveFile **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** SaveRGBImage **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_SaveRGBImage(struct Togl *togl, GLint argc, CONST84 char **argv) {
char file_name[255]; /** File name **/
GLint result; /** Result **/
if(argc >= 2) {
if (argc >= 3)
Togl_DumpToEpsFile(togl,argv[2],2,(void *)TKA_Display);
else {
printf("Enter name of file:");
scanf("%s", file_name);
Togl_DumpToEpsFile(togl,file_name,2,(void *)TKA_Display);
} /** Generate image **/
} /** Args **/
Togl_PostRedisplay(togl);
result = TCL_OK;
return result;
} /** End of SaveRGBImage **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** MoveCenter **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_MoveCenter(struct Togl *togl, GLint argc, CONST84 char **argv) {
struct Antenna *antenna = Togl_GetClientData(togl); /** Antenna data **/
GLint result; /** Result **/
double dist, elevation, azimuth;
if(argc >= 2) {
if(argc >= 4) {
dist = -(antenna->Eye_Distance *
(antenna->Eye_Distance_Max - antenna->Eye_Distance_Min)
+ antenna->Eye_Distance_Min);
elevation = antenna->Eye_Latitude;
azimuth = antenna->Eye_Longitude;
DoMoveCenter(atof(argv[2]), atof(argv[3]), azimuth, elevation, dist);
}
} /** Args **/
Togl_PostRedisplay(togl);
result = TCL_OK;
return result;
} /** End of SaveRGBImage **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** GetVariable **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_GetVariable(struct Togl *togl, GLint argc, CONST84 char **argv) {
GLint result; /** Result **/
if(argc >= 2) {
#if 0
if(strcmp(argv[2], "SCALE_FACTOR") == 0)
sprintf(togl->Interp->result, "%lf", SCALE_FACTOR);
else
sprintf(togl->Interp->result, "NO_VARIABLE");
#endif
} /** Generate file **/
Togl_PostRedisplay(togl);
result = TCL_OK;
return result;
} /** End of SaveFile **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** SetMaterial **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local void TKA_SetMaterial(struct Material *m) {
glShadeModel(GL_SMOOTH);
glMaterialfv(GL_FRONT, GL_AMBIENT, m->Ambient);
glMaterialfv(GL_FRONT, GL_DIFFUSE, m->Diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, m->Specular);
glMaterialf(GL_FRONT, GL_SHININESS, m->Shininess);
glMaterialfv(GL_FRONT, GL_EMISSION, m->Emission);
} /** End of SetMaterial **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** SetLight **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local void TKA_SetLight(struct Light *l, GLfloat eyemin, GLfloat eyemax) {
GLfloat dist; /** Distance **/
GLfloat la; /** La **/
GLfloat lo; /** Lo **/
if(l->Type == off) {
glDisable( l->Number);
} else {
l->Position[3] = (l->Type == directional) ? 0.0 : 1.0;
dist = l->Distance * (eyemax - eyemin) + eyemin;
l->Position[0] = -dist*sin(radian(l->Longitude))*cos(radian(l->Latitude));
l->Position[1] = dist * sin(radian(l->Latitude));
l->Position[2] = dist * cos(radian(l->Longitude))*cos(radian(l->Latitude));
glLightfv(l->Number, GL_AMBIENT, l->Ambient);
glLightfv(l->Number, GL_DIFFUSE, l->Diffuse);
glLightfv(l->Number, GL_SPECULAR, l->Specular);
glLightf(l->Number, GL_CONSTANT_ATTENUATION, l->Attenuation_Constant);
glLightf(l->Number, GL_LINEAR_ATTENUATION, l->Attenuation_Linear);
glLightf(l->Number, GL_QUADRATIC_ATTENUATION, l->Attenuation_Quadratic);
if(l->Type == spot) {
glLightf(l->Number, GL_SPOT_EXPONENT, l->Spot_Exponent);
glLightf(l->Number, GL_SPOT_CUTOFF, l->Spot_Cutoff);
la = l->Latitude+TKA_Angle(l->Spot_y/PIXEL_PER_MM,SCREEN_DISTANCE)-180;
lo = TKA_Angle(l->Spot_x / PIXEL_PER_MM, SCREEN_DISTANCE);
l->Spot_Pos[0] = -sin(radian(l->Longitude))*cos(radian(la))+
cos(radian(l->Longitude))*sin(radian(lo));
l->Spot_Pos[1] = sin(radian(la));
l->Spot_Pos[2] = cos(radian(l->Longitude))*cos(radian(la))+
sin(radian(l->Longitude))*sin(radian(lo));
l->Spot_Pos[3] = 1.0;
} else {
glLightf(l->Number,GL_SPOT_CUTOFF,(GLfloat) 180.0);
} /** Spotlight off **/
glEnable(l->Number);
} /** Is spotlight on **/
} /** End of setlight **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Global **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_Global(struct Togl *togl, GLint argc, CONST84 char **argv) {
struct Antenna *antenna = Togl_GetClientData(togl); /** Antenna Data **/
GLint result; /** Result **/
result = PA_ParseArgs(Togl_Interp(togl), argc-2, argv+2, CfgGlobal, antenna);
if(result == PA_CHANGED) {
Togl_PostRedisplay(togl);
result = TCL_OK;
} /** Redisplay **/
return result;
} /** End of global **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Material **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_Material(struct Togl *togl, GLint argc, CONST84 char **argv) {
struct Antenna *antenna = Togl_GetClientData(togl); /** Antenna data **/
GLint result; /** Result **/
GLint type; /** Type material **/
if(argv[2] == NULL) {
Tcl_SetResult(Togl_Interp(togl), "0 1 2", TCL_STATIC);
return TCL_OK;
} /** Material OK **/
type = atoi(argv[2]);
if(type < 0 || type >= SizeOfMaterialType) {
Tcl_SetResult( Togl_Interp(togl),
"TKA_Material ERROR: Material type must be 0, 1 or 2!", TCL_STATIC );
return TCL_ERROR;
} /** Bad material **/
result = PA_ParseArgs(Togl_Interp(togl), argc-3, argv+3,
CfgMaterial, &(antenna->material[type]));
if(result == PA_CHANGED) {
Togl_PostRedisplay(togl);
result = TCL_OK;
} /** Redraw **/
return result;
} /** End of Material **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** Light **/
/** **/
/*****************************************************************************/
/*****************************************************************************/
local GLint TKA_Light(struct Togl *togl, GLint argc, CONST84 char **argv) {
struct Antenna *antenna = Togl_GetClientData(togl); /** Antenna data **/
GLint result; /** Result **/
GLint n; /** Number lights **/
if(argv[2] == NULL) {
Tcl_SetResult( Togl_Interp(togl), "0 1 2 3 4 5 6 7", TCL_STATIC);
return TCL_OK;
} /** Lights OK **/
n = atoi(argv[2]);
if(n < 0 || n >= LIGHTMAX) {
Tcl_SetResult(Togl_Interp(togl),
"TKA_Light ERROR: Light number must be 0, 1, 2, 3, 4, 5, 6 or 7!",
TCL_STATIC);
return TCL_ERROR;
} /** Lights error **/
result = PA_ParseArgs(Togl_Interp(togl), argc-3, argv+3,
CfgLight, &(antenna->light[n]));
if(result == PA_CHANGED) {
TKA_SetLight(&(antenna->light[n]),
antenna->Eye_Distance_Min, antenna->Eye_Distance_Max);
Togl_PostRedisplay(togl);
result = TCL_OK;
} /** Redraw **/
return result;
} /** End of lights **/
/*****************************************************************************/
/*****************************************************************************/
/** **/
/** End of AntennaWidget.c **/
/** **/
/*****************************************************************************/
/*****************************************************************************/