ing on.
>
>A recent version of xsubpp generates
>dXSTARG;
>^^^
>sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
> ^^^^^^^^^ ^^^^
>
>I haven't found these in Perl Guts. Are they very recent?
Very, very recent.
--
Nick Ing-Simmons
assName::ISA",1);
av_push(isa,newSVpv("BaseClass"));
}
>
>Paul Moore.
--
Nick Ing-Simmons
Paul Moore <[EMAIL PROTECTED]> writes:
>From: Nick Ing-Simmons [mailto:[EMAIL PROTECTED]]
>>
>> What is un-trivial about the @ISA setting?
>[...]
>>
>> BOOT:
>> {
>> AV *isa = perl_get_av("ClassName::ISA",1);
>> av_push(isa,
Alan Burlison <[EMAIL PROTECTED]> writes:
>Nick Ing-Simmons wrote:
>
>> Ah, oops sorry I missed the PPCODE vs CODE issue.
>> (The machine-level programmer in me distrusts moving the stack back before
>> one is finished with it so for that reason I seldom use PPCODE.)
Alan Burlison <[EMAIL PROTECTED]> writes:
>Nick Ing-Simmons wrote:
>
>>
>> if (mystp = getmystructbyid(id)) {
>> pushret_mystruct(mystp);
>> return;
>> } else {
>> XSRETURN_EMP
PUSHs(sv_2mortal(newSViv(myst->fieldb)));
PUSHs(sv_2mortal(newSVpv(myst->fieldc, 0)));
PUTBACK; /* copy SP to PL_stack_sp which XSRETURN uses */
XSRETURN(3);
}
....
if (mystp = getmystructbyid(id)) {
pushret_mystruct(mystp);
return;
} else {
XSRETURN_EMPTY;
}
--
Nick Ing-Simmons
t of the underlying structure, so
>> "switching" it back on has worked thus far.
>
>Unfortunately I can't do this as I can't predict when a store/fetch is
>going to happen.
You know when you are in one though - so FETCH could turn off magic
before it messed with "self".
>I need perl to figure out that it has a self tie and
>suppress the recursive calls to FETCH. I know it can be done, but I
>can't figure out how!
>
>Thanks anyway,
--
Nick Ing-Simmons <[EMAIL PROTECTED]>
Via, but not speaking for: Texas Instruments Ltd.
Sugalski even samurai
>[EMAIL PROTECTED] have teddy bears and even
> teddy bears get drunk
--
Nick Ing-Simmons
that accessing PL_na involves getting access
to thread-local storage under threads - which is a non-trivial cost for
something you are not using!
(B) is 100% backward compatible.
--
Nick Ing-Simmons
Michael<[EMAIL PROTECTED]>writes:>Hadanxsmoduleworkingfinethendecidedtogetfancywithopque>structs.>>>Can'tlocateauto/BZS/TEST/xx.alin@INCYouhaveinheritedanAUTOLOADwhichistryingtofindaloadable'xx'.Therealerrorisyouhaveno'xx'.>usestrict;>requireBZS::TEST;>>my$p=BZS::TEST->new;>>my$x=$p->xx;Thatisgoin
Nick Ing-Simmons <[EMAIL PROTECTED]> writes:
>Michael<[EMAIL PROTECTED]>writes:>Hadanxsmoduleworkingfinethendecidedtogetfancywithopque>structs.>>>Can'tlocateauto/BZS/TEST/xx.alin@INCYouhaveinheritedanAUTOLOADwhichistryingtofindaloadable'xx'.Therealerro
ave not assigned anything to ST(0) you will return
your 1st arg (typically a mortal ref to the object) and then
if method call is in a void context perl will free it.
--
Nick Ing-Simmons
t and thus cannot produce
>any malfunction whatsoever.
>
>And I wasn't exactly recommending this, I just informed about the possibility
>to do so, and that it works well.
>
>It's still and always the choice and responsibility of each module author
>what he chooses to do or not to do.
>
>Regards,
--
Nick Ing-Simmons
al on the stack. Is there something I'm
>missing?
Probably its easy to do - can we see the C code after xsubpp and typemaps
have had their say?
>
>Randy
--
Nick Ing-Simmons
some XS files
>not need them? Surely not. It just seems odd to me.
Their placement relative to other headers can be absolutely vital.
I can be essential to set things up before "perl.h" includes the known
universe.
--
Nick Ing-Simmons
(a)
> SV *a
> CODE:
>sv_setiv(a, 2 * SvIV(a));
> OUTPUT:
>a
Not when OUTPUT is an SV. If it was IV (say) and got typemap'ed on the
way in it would need typemap'ing on way out as well.
--
Nick Ing-Simmons
ould do:
const wchar_t* T_WCHAR
INPUT:
T_WCHAR
$var = ($type)SvPV_nolen($arg)
OUTPUT:
T_WCHAR
sv_setpv((SV*)$arg, (char *) $var, wcslen($var)*sizeof($type));
But if you want perl to see a sane string you need
(a) perl5.6.0 or later
(b) something to translate wchar_t * into UTF-8 encoded Unicode.
This is still work-in-progress
--
Nick Ing-Simmons
code.pm may help.
>But if you want perl to see a sane string you need
> (a) perl5.6.0 or later
> (b) something to translate wchar_t * into UTF-8 encoded Unicode.
> This is still work-in-progress
--
Nick Ing-Simmons
later
>> (b) something to translate wchar_t * into UTF-8 encoded Unicode.
>> This is still work-in-progress
^^
i.e. making this kind of thing work is what I am spending my time on
when not answering mail ...
--
Nick Ing-Simmons
vChild,...)
void * pvChild
CODE:
{
}
>
>-Original Message-
>From: Soumen Das [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, December 14, 2000 4:06 PM
>To: Nick Ing-Simmons
>Cc: [EMAIL PROTECTED]
>Subject: RE: Return Value : Constants
>
>
>wchar_t **
ill typically
have made the values passed in "mortal". So if you want them to persist
(e.g. store them in an AV) you need to copy them or increment their
refcounts.
--
Nick Ing-Simmons
H is a bad idea in general.
>Also tried using the PERL5LIB
>environment variable.
>
>Regards,
>Soumen
--
Nick Ing-Simmons
ary to get that to work would be necessary
>pre-requisites for getting a Perl xs implementation to work.
xsubpp can do C++ files too - if you ask it to.
--
Nick Ing-Simmons
then how do I get a proper value when I print, and what could be
>done so that the comparison works?
Unicode, perl5.6+
>
>Thanks,
>Manisha
--
Nick Ing-Simmons
u do use EXTEND() then your 'n' should match the number of things
you are going to push - your code has 'n' in one place and
perhaps MAX_IDS in the other.
--
Nick Ing-Simmons
who is looking for a new job see http://www.ni-s.u-net.com/
alloc();
>perl_construct(my_perl);
>
>perl_parse (my_perl, xs_init, 3, args, (char **)NULL);
>{ dTHX; perl_eval_pv ("require 'test.pl';", TRUE); }
>}
FWIW - in threaded land dTHX and my_perl should be same thing (if I recall
correctly) - it is possible that nested dTHX is confusing things.
--
Nick Ing-Simmons
who is looking for a new job see http://www.ni-s.u-net.com/
module, it complains
>that the method call I made is an unresolved symbol.
What is the unresolved symbol?
Does your C code call _another_ library as well?
>
>So in summary, how does one link a .a file that's not made by
>Makefile.PL for the C code?
>
>I apologize for the vagueness o
quot;);
>
>(in which the "<" is deduced from the "r").
>
>This works OK,
Until you want to port to Win32 or some other place where fileno() is
an alien concept which does not work very well.
>but it's not pretty, and what if a wanted a Perl wrapper
>to C's open()? It's not so easy to work out the "(+)<|>|>>" mode for
>Perl's open() from the O_* flag argument to C's open().
It isn't that hard, and you could use sysopen() anyway which takes O_*
type args.
>
>Is there a nice, general way of doing this which I'm missing?
Not really.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
My understanding was things were "Inline" as well.
As compiling Tk takes several minutes on a 1GHz machine, and an hour+
on a slow one it did not seem to be worth looking at.
If it has a way to build .so/.dll file at install time I will take a look.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
hat.
>Is there a SAFE way
>I can reflect an asynchronous callback into Perl? I can't think of any
>ways, but there are people on this list who are far more experienced than
>me at this sort of thing. :-)
>
>Thanks!
>
>- D
>
><[EMAIL PROTECTED]>
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
atfile('somedir','SomeFile.h');
next unless -f $src;
$self->{PM}->{$src} = $self->catfile($ddir,'SomeFile.h');
}
Then your .h file will get installed along with the .pm files.
>
>Thanks...
>
>- D
>
><[EMAIL PROTECTED]>
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
Alan Burlison <[EMAIL PROTECTED]> writes:
>Nick Ing-Simmons wrote:
>
>> >Nope. This code will run on 32-bit systems mostly (I've been running it on
>> >x86 and PPC for testing purposes). Why is it that the Perl build scripts
>> >generate headers with &
;);
}
>
>My test code is :
>$x{a} = undef;
>$_ = 'x';
>@pts = qw ( 0 0 0 10 10 10 10 0 0 0);
>print "not " if Laff::Node->New("BLA-BLA",1,\%x);
>print "ok 5\n";
>print "not " unless Laff::Node->New("BLA-BLA",1,\
rlIO *
>>
>> I also can't find any way to search the perl-xs archives ... I suspect this
>> has been covered many times already. Sorry about the probable repitition.
>>
>> I really appreciate any help I might receive.
>
>That makes two of us. I could
Your perl's standard typemap should have entries for these things
by one name or another.
>
>> >>
>> >> I also can't find any way to search the perl-xs archives ... I suspect
>this
>> >> has been covered many times already. Sorry about the probable
>repitition.
before
> calling openlog(). Is this The Right Thing(tm)?
The perl-ish way is savepvn() rather then the un-portable strdup(),
or incrementing the REFCNT of the SV or saving a private SV.
>
>Best regards,
> Marcus
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
blems that you'll likely run into (usually by patching
>things in ExtUtils).
>
>Tye
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
r*) SvPV(*av_fetch(a,i,0),unused);
"na" is just a global variable that perl provided for this.
With threads etc. and on some machines a global rather than
a local proved to be a bad idea. It was renamed PL_na to avoid
name-space polution.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
SHs( sv_2mortal( node ));
>
>to no great success. I've run about a dozen Google searches in addition
>to the half-dozen or so searches on the archives of this list. Couldn't
>find this kind of information. Can someone please help?
>
>Thanks in advance!
>
>- m.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
- this is
messy.
If it really a "constant" then it is best to #define a "function":
#define ACCESS_XYZ() XYW
and
MODULE ... PREFIX = ACCESS_
int
ACCESS_XYX()
>
>THis seems to be missing something.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
entity)
and have it work without the need for
#define Foo__SubEntity Foo::SubEntity
to "undo" the "helpful" translation.
patch2 does same for bleadperl xsubpp
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
--- /opt/tools/perl5.7.2/ExtUtils/xsubpp.ship Wed Apr 3 07
;< FAILS
> #unless ($cp1->Compare($cp2)) <<<<< WORKS **
> unless ($cp1->Compare($cp2,$ace)) <<<<< FAILS this is line 197
>
>Here's the result :
> LDCINFO : 0,0,0,0 <<<< from the CUIverbose
> CUI0010FATAL : Usage: Laff::Cell::Compare(ci, co) at
>../LaffDiffCell line
> 197.
What does the generated .c file look like?
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
my XS file before MODULE, can I then
>use these
>types for my input parameters without mentioning them in a typemap file.
No. You need to typemap them.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
le till it sees 1st MODULE line, then processes each
"paragraph" according to its own syntax.
There is an h2xs tool which tries to parse .h and generate .xs which
would export that to perl.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
erl5.6.0 shipped by RedHat was NOT 5.6.0 but a 5.6.0 with a
selection of dubious patches.
>
>Steve
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
th what PERL_DL_NONLAZY does, as it's
>hard to imagine why perl's behavior with dlopen() would have anything to do
>with what's happening in the c++ shared library. But that's just a guess.
>
>Anyway, it's obvious that I'm stuck. Any suggestions?
>
>Thanks,
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
Bill Moseley <[EMAIL PROTECTED]> writes:
>At 05:30 PM 05/20/02 +0100, Nick Ing-Simmons wrote:
>>>If I copy the .xs code into a main {} block and build a stand-alone C
>>>program it works fine everyplace.
>>
>>Static linking the extension into perl should a
Bill Moseley <[EMAIL PROTECTED]> writes:
>At 10:03 PM 05/20/02 +0100, Nick Ing-Simmons wrote:
>>It works on linux/solaris and probably elsewhere with modern C++
>>systems.
>
>What "it" are you referring to? My module?
Yes.
>
>>Anything which mi
= (OP*)&pmop_list[49]
>substcont: op = LOGOP (0x2d0a60) pp_substcont, pmop = PMOP (0x2cc640)
>pp_subst
>pmopsym = (OP*)&pmop_list[50]
>substcont: op = LOGOP (0x2d0940) pp_substcont, pmop = PMOP (0x2cc5c0)
>pp_subst
>pmopsym = (OP*)&pmop_list[51]
>
>
>and there's much more that this
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
>
>
>___
>GO.com Mail
>Get Your Free, Private E-mail at http://mail.go.com
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
tring. Am I doing
>something wrong here?
>
>Konstantin
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
ouble v
double h
PPCODE:
double *llc = vh2ll(v, h);
EXTEND(SP, 2);
PUSHs(sv_2mortal(newSVnv(llc[0])));
PUSHs(sv_2mortal(newSVnv(llc[1])));
>
>__
>Do You Yahoo!?
>Yahoo! Health - Feel better, live better
>http://health.yahoo.com
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
template defs--is there a workaround for
>this? I've tried #include'ing math.h before the extern "C", but then I
>get other issues with #include called from#include .
>I'm afraid this email is too long already, but if appropriate I can
>explain in greater detail in a followup message.
>
>Thanks in advance,
>
>-Mike Janson
> mjanson (at) cvcg (dot) net
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
Bill Moseley <[EMAIL PROTECTED]> writes:
>On Fri, 23 Aug 2002, Nick Ing-Simmons wrote:
>> > XPUSHs(sv_2mortal(newSVpv(StopWords[i],0)));
>> > XPUSHs(sv_2mortal(newSViv(pv->value.v_int)));
>>
>> Which is correct. The mortal ness arranges for th
f the char ** array.
The other one being that in many such cases you need to "free" the list
as well.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
i.e. the SV you just created
..
Your other option is not to create a new SV every time it is pushed
but just put the "saved" SV there as-is:
XPUSHs(fh);
The essential thing to grasp here is that things on the stack are
not REFCNT'ed.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
);
>strcpy(c_args[i + 1], arg);
>}
>
>/* now call the proper Initialise */
>RETVAL = Initialise(config, &c_args, &argc);
>
>/* put the arguments back */
>for(i = 0; i < argc; i++) {
> av_unshi
not against other loadables.
For some reason your C++ "root" is not exporting those symbols.
Please show us exactly how the C++ application was "linked".
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
;BEGIN {
> $SIG{__DIE__} = \¬_loaded;
>}
>use lib '/tmp_user/kkrangan/build/external/lib';
>require Foo;
"
If you remove the __DIE__ handler or print the $_[0] passed to it
you will get a more explicit message.
At first glance I cannot see anything glaringly wrong.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
need to back-convert the SW_HANDLE to an SV.
Things like
call_method("ElseWhere::new",G_SCALAR);
for
$object->ElseWhere::new(...)
work too - but (in general) SUPER:: as a prefix does not work
as the "current package" of XSUB is seldom what is required
(So you have to use the underlying Foo::Bar::Baz::SUPER scheme.)
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
query) = @_;
return SWISH::API::Search->new($handle,$query);
}
The modified XS code above is doing the same - calling the inner
method but just using/returning SVs without looking inside.
>
>BTW, in my previous message I had a typemap of:
>
>TYPEMAP
>SW_HANDLE * O_OBJECT
>SW_SEARCH * O_OBJECT
>SW_RESULTS * O_OBJECT
>SW_RESULT * O_OBJECT
>
>But SW_* are already pointers to a structure so I can just use this. Correct?
>
>TYPEMAP
>SW_HANDLE O_OBJECT
>SW_SEARCH O_OBJECT
>SW_RESULTS O_OBJECT
>SW_RESULT O_OBJECT
>
>I apologize for being so lame at this stuff! ;) XS sometimes makes me feel
>like that guy on the cover of Extending and Embedding Perl...
>
>Thanks,
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
y )
OUTPUT:
RETVAL
The INIT:/CLASS is just there so it is in scope (I hope) when typemap for
OUTPUT does its thing to bless the object.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
SULTS
>SwishExecute( search, query, ... )
>
>Is there a clean way to do this?
Yes:
SW_RESULTS
SwishExecute( search, query = NULL)
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
no avail.
The 'U' magic set call is mainly there so that C code can notice
that a set has happened (e.g. to update a Tk widget to display
new value - Malcolm put that in back in perl5.000 before I took on perl/Tk!).
If it wants to 'veto' the set it has two choices:
A. cr
probably makes sense (it often does IMHO) to make the typemap call
a function - that function can be in C++ part of the .xs file and
so be overloaded or templated in C++ way - but we need to find a way to
get $elemtype in this fragment:
T_VECTOR
$elemtype dummy;
sv_to_vector($arg,$var,dummy)
By looking at the xsubpp code we _may_ be able to find a way to fish
$elemtype out of vector
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
t; decision betwen char * and string for SvPV.
I have a (currently owned by day-job) script which exports the public:
methods and inheritance tree of a collection nested of C++ classes
(with namespaces).
It turned out to be easier to start again and nearly-parse the C++
rather than try and re-use xsupp and typemaps.
I would like to shake loose this script (which I call findclass but could
be called xsub++) - if there is enough interest.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
for ( i = 0; i <= iLength; ++i )
> {
>VariantClear ( &s_VariantValue );
>(ppElementValue) = av_fetch( pArrayVal, i, 0 );
>
>iIsOk = PerlProcessReturnValue ( my_perl,
>*ppElementValue, &s_VariantValue );
>
>if ( iIsOk )
>{
>SafeArrayPutElement( pSafeArray, &i, (void*)
>&s_VariantValue );
>}
>else
>{
>break;
>}
>}
>
>VariantClear ( &s_VariantValue );
>
>if ( iIsOk )
>{
>V_VT(ps_Result)= VT_ARRAY | VT_VARIANT;
>V_ARRAY(ps_Result) = pSafeArray;
>}
>else
>{
>SafeArrayDestroy( pSafeArray );
>}
>}
>}
>break;
>
>case SVt_RV:
>
>{
>SV *pDerefVal = SvRV( pVal );
>iIsOk = PerlProcessReturnValue ( my_perl, pDerefVal,
>ps_Result );
>}
>break;
>
>default:
>iIsOk = 0;
>}
>
>return iIsOk;
>}
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
+1;
EXTEND(sp,count);
for (i=0; i < count; i++)
{
SV **svp = av_fetch(av,i,0);
if (svp)
XPUSHs(*svp);
}
>
>--Anders
>
>
>> --Zac
>> [EMAIL PROTECTED]
>>
>>
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
PerlIO_stdout(pTHX)
>{
>if (!PL_perlio) { <== 4359
> PerlIO_stdstreams(aTHX);
>}
>return &PL_perlio[2];
>}
>
>and perlio.c 4519 is
>int
>PerlIO_stdoutf(const char *fmt, ...)
>{
>dTHX;
>va_list ap;
>int result;
>va_start(ap, fmt);
>result = PerlIO_vprintf(PerlIO_stdout(), fmt, ap); <== 4519
>va_end(ap);
>return result;
>}
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
ng my subroutine readdirent. (Apologies in advance for my
>ignorance; I found an entry in the archives from Nick Ing-Simmons
>regarding re-implementing functions that use the FILE* type, but
>nothing on DIR* type).
>
>Here is what I have so far (this is the latest try):
>
>
> D
works on older perl's but can give better
code on modern ones.
(The PERL_NO_GET_CONTEXT mentioned in another thread turns off the
magical fetching and requires you to have dTHX / pTHX but still
supplies the aTHX as required.)
dTHX - declare THread conteXt.
pTHX - prototype THread conteX
global vars
just so dXSARGS can pop it is much messier than just passing the SV **
and count.
>
> Another (vaguely related) question:- as far as I can tell from
> pp.h and friends, "dXSARGS;" will actually change some internal
> state, by calling POPMARK. Is this the case?
Yes.
>
>
> -jc, who does not grok the perl stack.
It is a tad tricky - the thing that always gets me is that top of stack
points just past where args are.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
Aldo Calpini <[EMAIL PROTECTED]> writes:
>Nick Ing-Simmons wrote:
>> It is better IMHO to have
>>
>> void peekstack(SV **stack,int items)
>>
>> and pass the values in.
>
>this is how I actually do it:
>
> void peekstack( regi
XPUSHs(sv_2mortal(newSVpvf()))
PUTBACK;
}
...
/* Now the XS part */
MODULE
void
cli_print_queue(struct cli_state *cli)
PPCODE:
{
SV **start = SP;
int ret;
PUTBACK; /* so global variable is up-to-date */
ret = cli_print_queue(cli,server_fn);
SPAGAIN; /* Get SP after the XPUSHs */
/* Do whatever is necessary for return value in 'ret' */
XSRETURN(SP-start); /* Count of number pushed */
}
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
n) (f)
You probably need to #define something else _before_ including perl.h
and hence perlio.h and perlstdio.h to get FILE * visible.
I don't have an perl5.6 source base to hand to check what that is
but from memory it was something like:
#define PERLIO_NOT_STDIO 0
#include
>
>Thanks for any insight,
>Tassilo
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
n) dodges this issue by working in offsets
from _the_ global variable which holds bottom-of-stack. But dSP / PUTBACK
and PUSH are working with a "cached" local copy of top-of-stack pointer.
I know the .h files are not as clear as we would like, but it is worth
taking a look at them when you are unclear. I believe all this is
covered in Simon's book ...
>
>Thanks in advance for any explanations,
>Tassilo
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
Nicholas Clark <[EMAIL PROTECTED]> writes:
>On Fri, Jan 17, 2003 at 12:40:49PM +0000, Nick Ing-Simmons wrote:
>> The other main thing you need to keep in mind is that EXTEND (or the
>> implied one in XPUSHs) can re-allocate stack and so it may move wholesale
>> in memo
SIO_fx() for Standard IO under
PERL_IMPLICIT_SYS.
But it sounds as though something is #define-ing fclose() etc. incorrectly
under there too.
>
>Can anybody explain what is going on and how to resolve it?
>
>BTW, my XS file specifies "#define PERLIO_NOT_STDIO 0" before including
>the Perl headers, as described in "perlapio" manpage.
>I'm working on Windows XP SP1 with MS VC/C++ 6 SP5.
>
>Thanks
>
>Steve Hay
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
;
>error LNK2001: unresolved external symbol _PerlIO_importFILE
>
>Where is this "extern" PerlIO_importFILE() supposed to come from?
Under perl5.6 a PerlIO * _is_ a FILE * so PerlIO_importFILE
can be a no-op macro (I think this is still true under
PERL_IMPLICIT_SYS).
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
to always use PerlLIO_close() - perlio.c does ;-)
You may be escaping trouble due to #define in XSUB.h
Now I have spotted those #define-s I think they need fixing for stdio
case under perl5.8
>
>Thanks,
>
>Steve
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
are problems
with that in general - which is why PerlIO normally avoids stdio on
CRLF platforms, and starts all FILE * in binmode when forced to use it.
The main snag is that (typically) once a single octet is sent to the stream
it is locked into a mode ...
It would seem that PerlStdio_binmode should not just be the
"base" binmode but replicate that (or call it) - will look at it for 5.8.1
It seems that ActivePerl (or any 5.8.0 Win32 PERL_IMPLICIT_SYS perl) is not
really ready for stdio/PerlIO co-existance from XS code yet.
This is not a complete surprise - it is very new and has a few rough
edges even in the much simpler UNIX world.
>
>Thanks,
>
>Steve
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
;setmode(PerlSIO_fileno(f), O_BINARY)
>
>and this does work, but, as outlined above, it is not really what I'm after.
Why not just insert that in your wrapper before calling importFILE?
(That is likely to be how I "fix" this in 5.8.1 - do a setmode() inside
importFILE and then push a CRLF layer above stdio if stream was in text mode.)
However that is way PerlIO is architected in 5.8.0 - low level files
are binary ON ALL PLATFORMS and any CRLF, Encoding etc. translations
are done in extra layers on top of that.
This helps portability in that a script on any platform can
read/write any kind of file.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
not do CRLF.
>or a
>teething problem with stdio/PerlIO co-existence in ActivePerl that I
>can't do anything about in my code?
I think that is it - it seems that PERL_IMPLICIT_SYS parts of XSUB.h
need some work.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
: ERRSV so you get what you want with:
if (SvTRUE(ERRSV))
{
char *error_message = SvPV_nolen(ERRSV);
}
>
>I've looked through perlguts, perlapi and perlcall - any other ideas
>
ERRSV is meantioned in perlcall.pod and perlembed.pod as the equivalent
of testing $@ - perhaps what is not clear is that eval_pv() is like eval "".
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
he perlapi though all the Perl_ and PL_
>macros so that perl stays in its own namespace.
The only thing I can suggest at present is to create a "noembed.h"
and ask SWIG to include that before .
It would contain
#undef do_open
etc.
>
>John
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
Thanks,
> STH
>
>--------------
>E-Mail: [EMAIL PROTECTED]
>Date: 30-Jan-2003
>Time: 09:16:44
>--
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
ine ENUM_one() one
#define ENUM_two() two
MODULE .... PREFIX ENUM_
PROTOTYPES : ENABLE
IV
ENUM_one()
IV
ENUM_two()
Here ENUM_
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
the names of lexicals are only "about" at compile time.
or local and glob tricks
local *retVal = \$realRet;
XSUB_CALL($retVal);
it is hard to "name" that SV in a meaningful way.
>
>Any pointers would be greatly appreciated!
>
>Rich
--
Nick Ing-Simmons http://www.ni-s.u-net.com/
involved then you are probably better
off making copies:
SV *temp_val = newSVsv(*temp_loop1);
hv_store(param_map[0],"some_key",strlen("some_key"),temp_val,0);
>
>
> Thanks for any informations
>
> Roman Porizka
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
(but may not be a string, but SvPV will
force that for us). In perl5.6+ you may need to consider case
of string being in UTF-8
*/
return SvPV_nolen(*svp);
}
else
{
/* undef value */
return "";
}
}
else {
/* No such member */
return NULL;
}
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
this case - as you blindly store into returned SV (without testing
if there is one), and don't do an hv_store() yourself.
> if(!SvOK(*sv)) {
> printf("Error - hv_fetch %s returned bad sv\n", fieldName);
> }
> sv_setnv(*sv, val);
>}
>
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
o make XSUB
just like that use those.
In quasi-numeric contexts 1/0 (aka TRUE/FALSE) returned as SvIV may
make more sense.
>
>Steve
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
he same
> problem, any help would much appreciated.
>
> Thanks,
> STH
>
>----------
>E-Mail: [EMAIL PROTECTED]
>Date: 11-Mar-2003
>Time: 16:25:27
>--
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
t;> of string being in UTF-8
>> */
>> return SvPV_nolen(*svp);
>> }
>> else
>> {
>> /* undef value */
>> return "";
>> }
>> }
>> else {
>>/* No such member */
>>return NULL;
>> }
>>
>>
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
t;so the current xs code is:
>
>SW_RESULTS
>SwishQuery( swish_handle, query = NULL )
>SW_HANDLE swish_handle
>char *query
>
>PREINIT:
>char * CLASS = "SWISH::API::Results";
>
>
>Where SW_RESULTS is a O_OBJECT typemap.
>
>O_OBJECT
>sv_setref_pv( $arg, CLASS, (void*)$var );
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
Double(hv_geo,"latitude",geo.latitude);
>setDouble(hv_geo,"longitude",geo.longitude);
>
>rv_geo = newRV_inc((SV*)hv_geo);
If this is a newHV() above then you probably want newRV_noinc()
> }
> else croak("arg not a hash ref\n");
>OUTPUT:
> rv_geo
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
sv_2mortal(somesv);
XSRETURN(1);
}
>
>MODULE = Util PACKAGE = Util
>
>void
>StereoToGeoCoordinates(rv_stereo,rv_geo)
>SV *rv_stereo
>SV *rv_geo = NO_INIT
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
he UTF-EBCDIC stuff. The snag being that perl's 'utf8' encoding
uses core's SvUTF8 scheme - which is just fine if it _IS_ UTF-8
What we need for Encode::* to have its _own_ UTF-8 and UTF-EBCDIC
encode/decode independant of what core is using...
>
>Thanks
>Brian
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
n and debugging but the library has
>similar problems on Linux (I'm not sure the problem is exactly the same on
>Linux as I haven't debugged it, but the symptoms are the same).
>
>I did quite long search on the net about this issue but I haven't found any
>similar (but found this list :-).
>
>Any thoughts?
>
>TIA
>
>Zoltan Magyar
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
5/site_perl/5.8.0
>/usr/lib/perl5/site_perl/5.6.1
>/usr/lib/perl5/site_perl
>/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
>/usr/lib/perl5/vendor_perl/5.8.0
>/usr/lib/perl5/vendor_perl
>.
>[EMAIL PROTECTED] new2_mini_epn]$
>
>Yours sincerely.
>
>--
>
>Stanley Hopcroft
>
>
>'...No man is an island, entire of itself; every man is a piece of the
>continent, a part of the main. If a clod be washed away by the sea,
>Europe is the less, as well as if a promontory were, as well as if a
>manor of thy friend's or of thine own were. Any man's death diminishes
>me, because I am involved in mankind; and therefore never send to know
>for whom the bell tolls; it tolls for thee...'
>
>from Meditation 17, J Donne.
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/
1 - 100 of 351 matches
Mail list logo