Hello Honored Geschwistern,
I am working on a perl XS project and would like to use unpack in the XS/C portion of the code. (Using pack in the perl portion seems to do what I want).
I'm reading the API documents for unpackstring and have some questions questions
- What are the flags that are allowed? I've been searching in vain
- The documentation says that the results are put on the perl stack automatically. I don't see much explaining the perl stack in detail
- How to get the return values from the unpacklist to the perl caller, possibly using the perl stack as a middleman.
unpackstring
The engine implementing the unpack() Perl function.
Using the template pat..patend, this function unpacks the string s..strend into a number of mortal SVs, which it pushes onto
the perl argument (@_) stack (so you will need to issue a "PUTBACK" before and "SPAGAIN" after the call to this function).
It returns the number of pushed elements.
The strend and patend pointers should point to the byte following the last character of each string.
Although this function returns its values on the perl argument stack, it doesn't take any parameters from that stack (and
thus in particular there's no need to do a PUSHMARK before calling it, unlike "call_pv" for example).
I32 unpackstring(const char *pat,
const char *patend, const char *s,
const char *strend, U32 flags)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.