Dear all,
If I execute the program below, a lot of harddisk activity results, and nothing appears in the newly opened graph window. It is then not possible to get a text window on top, and GiveWin cannot be closed in the normal way. This is even the case after the Ox-program has been aborted. Apparently under come conditions "DrawXMatrix" will cause the computer to run out of memory, and disturbs the functioning of GiveWin.
Two minor other problems:
If I print a graph from GiveWin in "landscape", the label on the vertical axis is rotated 180 degrees. I didn't succeed in getting a "landscape" print preview.
And the function "scan" skips white space, so that I didn't succeed in constructing a "Press any key to continue..." function.
I use Ox 3.00 and GiveWin 2.02.
Note that if you run the program below, you will probably to have to restart your computer afterwards. Any unsaved windows in GiveWin can be lost. Before entering the fatal stage, the program asks for input (of any non-space string). If you do not want to continue, abort the program then.
Regards,
Jaap
-----------------------------------------------------------------
Jacob J. de Vries
Department of Spatial Economics
Free University
De Boelelaan 1105
NL 1081 HV Amsterdam
Phone +31 20 44 46142
Fax +31 20 44 46004
[log in to unmask]
http://staff.feweb.vu.nl/jjvries/
-----------------------------------------------------------------
====================================================================
#include <oxstd.h>
#include <oxdraw.h>
// This program demonstrates a problem in GiveWin and Ox.
// Under certain conditions DrawXMatrix will cause the computer to run out
// of (virtual) memory.
// Also it is impossible afterwards to activate another GiveWin window.
correctGraph(const x, const xName, const y, const yName)
{
// As values of Y are small we multiply by 1e6 to get simpler values
// on the axis.
// This is the correct version.
SetDrawWindow("Graph will appear");
DrawXMatrix(0, y + log(1e6), yName + " ( * 1e6)", x, xName, 1);
DrawAxisAuto(0, 0); // y axis
DrawAdjust(ADJ_AXISSCALE, AXIS_LOG);// choose logarithmic scale
ShowDrawWindow();
}
wrongGraph(const x, const xName, const y, const yName)
{
// As values of Y are small we multiply by 1e6 to get simpler values
// on the axis.
// This is an easily made mistake:
// multiply the logs instead of the original variable.
SetDrawWindow("Graph will not appear");
DrawXMatrix(0, y * 1e6, yName + " ( * 1e6)", x, xName, 1);
DrawAxisAuto(0, 0); // y axis
DrawAdjust(ADJ_AXISSCALE, AXIS_LOG);// choose logarithmic scale
ShowDrawWindow();
}
warning()
{
decl s;
println("The continuation of this program might cause problems");
println("that require restarting of the computer.");
println("Please save your work or abort this program.");
println("Enter any letter to continue...");
scan("%s", &s);
}
problemWithDrawXMatrix()
{
decl A = <1, 2, 3, 4, 5, 6, 7>;
decl B = exp( A - 15 );
decl logB = log(B);
correctGraph(A, "A", logB, "log B");
warning();
wrongGraph(A, "A", logB, "log B"); // Will run out of memory.
}
main()
{
problemWithDrawXMatrix();
println("end");
}
|