Revision: 76612
http://sourceforge.net/p/brlcad/code/76612
Author: starseeker
Date: 2020-07-31 16:00:56 +0000 (Fri, 31 Jul 2020)
Log Message:
-----------
Stash the gedp within the ged_subprocess struct
Modified Paths:
--------------
brlcad/branches/bioh/include/ged/defines.h
brlcad/branches/bioh/src/libged/ged.c
brlcad/branches/bioh/src/libged/ged_util.c
brlcad/branches/bioh/src/libged/rtcheck/rtcheck.c
brlcad/branches/bioh/src/libged/rtwizard/rtwizard.c
Modified: brlcad/branches/bioh/include/ged/defines.h
===================================================================
--- brlcad/branches/bioh/include/ged/defines.h 2020-07-31 15:01:23 UTC (rev
76611)
+++ brlcad/branches/bioh/include/ged/defines.h 2020-07-31 16:00:56 UTC (rev
76612)
@@ -128,6 +128,7 @@
struct bu_process *p;
void *chan;
int aborted;
+ struct ged *gedp;
};
/* FIXME: should be private */
@@ -250,10 +251,10 @@
void (*ged_free_vlist_callback)(unsigned int, int);
/**< @brief function to call after freeing a vlist */
/* Handler functions for I/O communication with asynchronous subprocess
commands */
+ void *ged_io_data; /**< brief caller supplied data */
int io_mode;
void (*ged_create_io_handler)(void **chan, struct bu_process *p, int fd,
int mode, void *data, ged_io_handler_callback_t callback);
void (*ged_delete_io_handler)(void *interp, void *chan, struct bu_process
*p, int fd);
- int ged_io_handler_callback_cnt;
// Other callbacks...
// Tcl command strings - these are libtclcad level callbacks that execute
user supplied Tcl commands if set:
Modified: brlcad/branches/bioh/src/libged/ged.c
===================================================================
--- brlcad/branches/bioh/src/libged/ged.c 2020-07-31 15:01:23 UTC (rev
76611)
+++ brlcad/branches/bioh/src/libged/ged.c 2020-07-31 16:00:56 UTC (rev
76612)
@@ -268,6 +268,7 @@
gedp->ged_free_vlist_callback = NULL;
gedp->ged_create_io_handler = NULL;
gedp->ged_delete_io_handler = NULL;
+ gedp->ged_io_data = NULL;
/* Out of the gate we don't have display managers or views */
gedp->ged_gvp = NULL;
Modified: brlcad/branches/bioh/src/libged/ged_util.c
===================================================================
--- brlcad/branches/bioh/src/libged/ged_util.c 2020-07-31 15:01:23 UTC (rev
76611)
+++ brlcad/branches/bioh/src/libged/ged_util.c 2020-07-31 16:00:56 UTC (rev
76612)
@@ -1299,7 +1299,7 @@
struct _ged_rt_client_data {
struct ged_subprocess *rrtp;
- struct ged *gedp;
+ void *u_data;
};
void
@@ -1306,21 +1306,21 @@
_ged_rt_output_handler(void *clientData, int UNUSED(mask))
{
struct _ged_rt_client_data *drcdp = (struct _ged_rt_client_data
*)clientData;
- struct ged_subprocess *run_rtp;
int count = 0;
int retcode = 0;
int read_failed = 0;
char line[RT_MAXLINE+1] = {0};
- if (drcdp == (struct _ged_rt_client_data *)NULL ||
- drcdp->gedp == (struct ged *)NULL ||
- drcdp->rrtp == (struct ged_subprocess *)NULL)
+ if ((drcdp == (struct _ged_rt_client_data *)NULL) ||
+ (drcdp->rrtp == (struct ged_subprocess *)NULL) ||
+ (drcdp->rrtp->gedp == (struct ged *)NULL))
return;
- run_rtp = drcdp->rrtp;
+ struct ged *gedp = drcdp->rrtp->gedp;
+ struct ged_subprocess *rrtp = drcdp->rrtp;
/* Get data from rt */
- if (bu_process_read((char *)line, &count, run_rtp->p, BU_PROCESS_STDERR,
RT_MAXLINE) <= 0) {
+ if (bu_process_read((char *)line, &count, rrtp->p, BU_PROCESS_STDERR,
RT_MAXLINE) <= 0) {
read_failed = 1;
}
@@ -1328,14 +1328,14 @@
int aborted;
/* Done watching for output, undo subprocess I/O hooks. */
- if (drcdp->gedp->ged_delete_io_handler) {
- (*drcdp->gedp->ged_delete_io_handler)(drcdp->gedp->ged_interp,
run_rtp->chan, run_rtp->p, BU_PROCESS_STDERR);
+ if (gedp->ged_delete_io_handler) {
+ (*gedp->ged_delete_io_handler)(gedp->ged_interp, rrtp->chan,
rrtp->p, BU_PROCESS_STDERR);
}
/* Either EOF has been sent or there was a read error.
* there is no need to block indefinitely */
- retcode = bu_process_wait(&aborted, run_rtp->p, 120);
+ retcode = bu_process_wait(&aborted, rrtp->p, 120);
if (aborted)
bu_log("Raytrace aborted.\n");
@@ -1344,12 +1344,12 @@
else
bu_log("Raytrace complete.\n");
- if (drcdp->gedp->ged_gdp->gd_rtCmdNotify != (void (*)(int))0)
- drcdp->gedp->ged_gdp->gd_rtCmdNotify(aborted);
+ if (gedp->ged_gdp->gd_rtCmdNotify != (void (*)(int))0)
+ gedp->ged_gdp->gd_rtCmdNotify(aborted);
- /* free run_rtp */
- BU_LIST_DEQUEUE(&run_rtp->l);
- BU_PUT(run_rtp, struct ged_subprocess);
+ /* free rrtp */
+ BU_LIST_DEQUEUE(&rrtp->l);
+ BU_PUT(rrtp, struct ged_subprocess);
BU_PUT(drcdp, struct _ged_rt_client_data);
return;
@@ -1359,10 +1359,10 @@
line[count] = '\0';
/* handle (i.e., probably log to stderr) the resulting line */
- if (drcdp->gedp->ged_output_handler != (void (*)(struct ged *, char *))0)
- ged_output_handler_cb(drcdp->gedp, line);
+ if (gedp->ged_output_handler != (void (*)(struct ged *, char *))0)
+ ged_output_handler_cb(gedp, line);
else
- bu_vls_printf(drcdp->gedp->ged_result_str, "%s", line);
+ bu_vls_printf(gedp->ged_result_str, "%s", line);
}
@@ -1458,10 +1458,11 @@
run_rtp->p = p;
run_rtp->aborted = 0;
+ run_rtp->gedp = gedp;
BU_GET(drcdp, struct _ged_rt_client_data);
- drcdp->gedp = gedp;
drcdp->rrtp = run_rtp;
+ drcdp->u_data = gedp->ged_io_data;
/* If we know how, set up hooks so the parent process knows to watch for
output. */
if (gedp->ged_create_io_handler) {
Modified: brlcad/branches/bioh/src/libged/rtcheck/rtcheck.c
===================================================================
--- brlcad/branches/bioh/src/libged/rtcheck/rtcheck.c 2020-07-31 15:01:23 UTC
(rev 76611)
+++ brlcad/branches/bioh/src/libged/rtcheck/rtcheck.c 2020-07-31 16:00:56 UTC
(rev 76612)
@@ -268,6 +268,7 @@
BU_GET(rtcp->rrtp, struct ged_subprocess);
rtcp->rrtp->p = p;
rtcp->rrtp->aborted = 0;
+ rtcp->rrtp->gedp = gedp;
if (gedp->ged_create_io_handler) {
(*gedp->ged_create_io_handler)(&(rtcp->rrtp->chan), p,
BU_PROCESS_STDOUT, gedp->io_mode, (void *)rtcp, rtcheck_vector_handler);
}
Modified: brlcad/branches/bioh/src/libged/rtwizard/rtwizard.c
===================================================================
--- brlcad/branches/bioh/src/libged/rtwizard/rtwizard.c 2020-07-31 15:01:23 UTC
(rev 76611)
+++ brlcad/branches/bioh/src/libged/rtwizard/rtwizard.c 2020-07-31 16:00:56 UTC
(rev 76612)
@@ -40,7 +40,7 @@
struct _ged_rt_client_data {
struct ged_subprocess *rrtp;
- struct ged *gedp;
+ void *u_data;
};
@@ -67,11 +67,13 @@
BU_LIST_APPEND(&gedp->gd_headSubprocess.l, &run_rtp->l);
run_rtp->p = p;
+ run_rtp->aborted = 0;
+ run_rtp->gedp = gedp;
/* must be BU_GET() to match release in _ged_rt_output_handler */
BU_GET(drcdp, struct _ged_rt_client_data);
- drcdp->gedp = gedp;
drcdp->rrtp = run_rtp;
+ drcdp->u_data = gedp->ged_io_data;
if (gedp->ged_create_io_handler) {
(*gedp->ged_create_io_handler)(&(run_rtp->chan), p, BU_PROCESS_STDERR,
gedp->io_mode, (void *)drcdp, _ged_rt_output_handler);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits