![]() Home Overview FAQ Documentation Download Mailing List Geomview For Windows? Support Users Development Bug Reporting Contributing Contact Us Sponsors
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Update REQ 6141]: Re: Connecting Geomview with another X-application
I just tried the following program under both geomview 1.5 and 1.6.1
on Solaris, and 1.6.1 on Irix, and it seemed to work fine.
Specifically, I see:
"started geomview" message
(geomview loads slowly over the network, no windows yet)
"opened fromgv", "opened togv", "sent command" nearly simultaneously
(geomview windows appear, and respond to interaction. I don't
even need to wait until reading something from the fromgv pipe.)
"listening"
Clicking the right mouse button in the graphics window yields messages like
(pick World hdodec.off (-0.0031538 -0.18392 0.115354 0.391025) () () (0.224752 -0.462585 0.363661 1 -0.224756 -0.462585 0.363661 1 -0.363661 -0.510647 -0.0611362 1 0 -0.54035 -0.323677 1 0.363663 -0.510643 -0.0611362 1) () -1 () 4)
Here's the program.
#!/bin/sh
# This is a shell archive (shar 3.43)
# made 03/26/1997 22:33 UTC by slevy at hausdorff
# Source directory /usr6/slevy
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 1542 -rw-rw-r-- t.c
#
# ============= t.c ==============
if test -f 't.c' -a X"$1" != X"-c"; then
echo 'x - skipping t.c (File already exists)'
else
echo 'x - extracting t.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 't.c' &&
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
X
main() {
X FILE *togv, *fromgv;
X char line[200];
X
X /* Ensure (more or less) that no one else is using these FIFOs */
X unlink("/tmp/togv");
X unlink("/tmp/fromgv");
X mknod("/tmp/togv", S_IFIFO|0777, 0);
X mknod("/tmp/fromgv", S_IFIFO|0777, 0);
X
X /* Invoke geomview. Use the "command" command, which takes a pair of
X * file names; the first feeds commands to geomview, and the second
X * receives responses from geomview. Note that the FIFOs mentioned here
X * must exist before we start geomview.
X */
X system("geomview -c '(command /tmp/togv /tmp/fromgv)' hdodec.off &");
X printf("started geomview.\n");
X
X /* UNIX FIFO semantics imply that this will block until geomview starts.
X * If you don't entirely trust it to work, you might use
X * open( "/tmp/togv", O_WRONLY|O_NONBLOCK ) and a polling loop
X * that waited a few seconds for geomview to start, gave up if it didn't,
X * and otherwise used fdopen() to get a FILE pointer.
X * But this should work if all's well.
X */
X fromgv = fopen("/tmp/fromgv", "r");
X printf("opened fromgv.\n");
X
X togv = fopen("/tmp/togv", "w");
X printf("opened togv.\n");
X
X fprintf(togv, "(interest (pick world))\n");
X printf("sent command.\n");
X fflush(togv);
X sleep(5); /* I think geomview should start immediately, but
X * let's see whether it waits until we actually
X * read from the fromgv pipe.
X */
X printf("listening.\n");
X while(fgets(line, sizeof(line), fromgv) != NULL) {
X fputs(line, stdout);
X }
}
SHAR_EOF
chmod 0664 t.c ||
echo 'restore of t.c failed'
Wc_c="`wc -c < 't.c'`"
test 1542 -eq "$Wc_c" ||
echo 't.c: original size 1542, current size' "$Wc_c"
fi
exit 0
|
||
|
Home | Overview | FAQ | Documentation | Support | Download | Mailing List Windows? | Development | Bug Reporting | Contributing | Contact Us | Sponsors |
|||
|
site hosted by |
|||