From d65cfb7067ff51aa0f2dc8ca96a0ed6121d65ebd Mon Sep 17 00:00:00 2001 From: Sylvain Pion Date: Fri, 24 Nov 2000 12:53:26 +0000 Subject: [PATCH] - Added sleep(1), in order to make operator>>(Point) work ! This probably works around an initialization problem in Geomview. --- Packages/Geomview/TODO | 12 +++++++----- Packages/Geomview/changes.txt | 5 +++-- Packages/Geomview/src/Geomview_stream.C | 20 ++++++++++---------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Packages/Geomview/TODO b/Packages/Geomview/TODO index 6505e06e36d..b97a496b2e5 100644 --- a/Packages/Geomview/TODO +++ b/Packages/Geomview/TODO @@ -1,7 +1,9 @@ - Remove the requirement to have a ./.geomview file with (echo "started") inside. Synchronization can probably be done with select() ? -- Reading a Point from Geomview should be possible. It works, but not all the - time, there's some non-deterministic bug somewhere, either geomview or CGAL. -- Write operator<<(Triangulation), 2D and 3D. Use "(progn" ... ")" from GCL - for that ? -- Use the OOGL library coming with Geomview to parse stuff ? + There are other problems (sleep(1) is needed), so maybe don't touch... +- Write operator<<(Triangulation), 2D and 3D. Partly done. +- Why not use the OOGL library coming with Geomview to parse stuff ? +- The remote geomview (with rsh) facility probably doesn't work. + But is it useful ? +- Add operator<< (Sphere), as it's known to geomview, cf : + http://www.geomview.org/docs/html/geomview_44.html#SEC47 diff --git a/Packages/Geomview/changes.txt b/Packages/Geomview/changes.txt index 4098100b57b..e5b08044da6 100644 --- a/Packages/Geomview/changes.txt +++ b/Packages/Geomview/changes.txt @@ -2,8 +2,9 @@ CHANGES to the Geomview package. Ver 3.1 ??? - Removed obsolete constructor. -- Commented code in setup_geomview() (called from the ctor) that blocked on - Linux and whose purpose was unknown to me. +- Added a sleep(1) at initialization, to wait for Geomview to be ready + (internally), because otherwise this prevents operator>>(Point) from working + later (even if display is fine). - Fix non-std compliant names beginning with underscore. - Replaced close()+dup() by dup2() at initialization. diff --git a/Packages/Geomview/src/Geomview_stream.C b/Packages/Geomview/src/Geomview_stream.C index ca8e0d05904..e892c36360d 100644 --- a/Packages/Geomview/src/Geomview_stream.C +++ b/Packages/Geomview/src/Geomview_stream.C @@ -118,12 +118,14 @@ void Geomview_stream::setup_geomview(const char *machine, const char *login) in = pipe_in[0]; out = pipe_out[1]; - // Reads the result of the command (echo "started") that must be - // placed in the file .geomview (cf the doc). It helps for - // synchronizing. Probably not the best method. char inbuf[10]; + // Waits for "started" from the .geomview file. ::read(in, inbuf, ::strlen("started")); + // Necessary to wait a little bit for Geomview, otherwise you won't be + // able to ask for points... + sleep(1); + std::cout << "done." << std::endl; bbox_count = 0; @@ -132,8 +134,6 @@ void Geomview_stream::setup_geomview(const char *machine, const char *login) point_count = 0; tetrahedron_count = 0; (*this) << "(normalization g* none)(bbox-draw g* no)"; - - break; } } @@ -492,11 +492,11 @@ Geomview_stream::frame(const Bbox_3 &bbox) Geomview_stream& Geomview_stream::operator>>(char *expr) { - // skip whitespace - ::read(in, expr, 1); - while(expr[0] != '('){ - ::read(in, expr, 1); - } + // Skip whitespaces + do { + ::read(in, expr, 1); + } while (expr[0] != '('); + int pcount = 1; int i = 1; while (1) {