[Xastir-Dev] Short list, stable release, then Xastir-2 development?
Curt Mills, WE7U
hacker at tc.fluke.com
Fri Mar 21 13:16:34 EST 2003
On Thu, 20 Mar 2003, J. Lance Cotton wrote:
> default:
> fprintf(stderr,"Illegal parameter (%d) passed to
> GPS_operations function!\n", input_param);
> gps_operation_pending = 0; // We're done
> return(NULL);
> break;
> } // End of switch
>
> tells me that input_param is 0 when this function is called. This is
> coming from the XtPointer clientData. Beyond that, it appears that the
> callback function is being called with the right data (between 1 and 3,
> inclusive).
So the printf to STDERR is showing you a '0' I presume. Actually
the parameter has to be between 1 and 6 inclusive in order to avoid
the switch's default clause. The other three clauses are for
possible GPS upload functions that I/we might add later.
The string value should have been set by the callback functions from
the code that created the menus, so perhaps there's a difference
with how your menus are sending the values to the code and how mine
are? Are you using LessTif, Motif, or OpenMotif? I'm using
OpenMotif here.
> I see that clientData is of type XtPointer, but you do a strcmp() on it.
> I don't know much about this X programming, but is there some need to
> dereference a pointer before you use it? or does clientData actually
> point to the start of the C string?
The line "input_param = *((int *) arg);" is what dereferences the
pointer into an int. We then use input_param for all later access,
including the switch.
Ah wait! Wrong routine, but still in the area we're talking about.
Ok, strings are different. When we do a strcmp(), we need pointers
to the strings, so the code as it stands appears to be correct, and
in fact it works properly on my system.
--
Curt Mills, WE7U hacker_NO_SPAM_ at tc.fluke.com
Senior Methods Engineer/SysAdmin
"Lotto: A tax on people who are bad at math!"
"Windows: Microsoft's tax on computer illiterates!" -- WE7U
"The world DOES revolve around me: I picked the coordinate system!"
More information about the Xastir-dev
mailing list