[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem with glue



Yo self-interest-ers,

	I had hoped for my first posting to the list to be more dignified than
this, but I'll have to go with a plea for help.  The worst thing is that this
is not a newsgroup, so I can't cancel it if I'm proved wrong :-)

	I'm trying to call some InterViews functions from Self (2.0), and I
used the examples provided in "primitiveMaker.self" to write my calls.  I
managed the plain C functions and the C++ constructors, but the "delete" and
member calls elude me.  And badly, may I say.  I have traced down the problem
to the source code for primMaker, and looks like it treats my non-arguments
member calls as 1-argument calls, so it fills the templates (C macros and Self
glue) with a NULL first argument!!

	I thought that this might be just plain unability to follow examples,
so I tried the example in the code itself, doing:
	Self> primitiveMaker reader copy staticLinking test
It generated the file "test.primMaker.h", as expected.  I included this file
into a proper C++ program ("test.cc"), and look at this:

%%%%%%%%%% begin test script %%%%%%%%%%%
% cat test.cc
#include <_glueDefs.c.incl>
#include "test.primMaker.h"
#define WHAT_GLUE FUNCTIONS
   smortlehoffer_glue
#undef WHAT_GLUE
% g++ -I../local/glueDefs/ -c test.cc
test.cc:8: macro `CC_mber_2' used with only 9 args
% fgrep "CC_mber_2" test.primMaker.h
CC_mber_2( proxy,(frob*,frob_seal), proxy,(Pixrect*,Pixrect_seal), bark, Pixrect_bark_Pr_zap__glue, , int,) \
% fgrep "callMember" my_primitiveMaker.self
        Pixrect pr_zap: int = frob {frob xroto} callMember bark
%%%%%%%%%% end test script %%%%%%%%%%%

	Notice that the template definition for member "bark" specifies ONE
parameter (type int), but the generated macro call is "CC_mber_2", which
expects one more argument conversion.  In fact, the corresponding .self file
would has a line like "myFctObj value:  With: t0 IfFail: [...]", with
NOTHING after the "value:" keyword.  And it's not as easy as replacing
CC_mber_2 with CC_mber_1 (too easy, I guess).

	So, it looks like either the example is incomplete (can't compile),
or primMaker is generating wrong code for member calls.  Any enlightenment
will be appreciated, since I guess many people have already used thsi glue
thing successfully.  Probably some very obvious detail is escaping me...

-- hernan
--			|
Hernan Astudillo R.	| "Life is short.  Play hard."
hernan@cc.gatech.edu	|		-- Reebok
College of Computing, Georgia Tech, Atlanta GA 30332 / (404) 853-9390