I am working on an API Test and I have opted to use the h2xs for changing the header files in to xs code.
What I have I think will suffice but I am having the trouble of converting the C code into usable XS code for 2 functions:
I32 enr_CreateChart (const CHAR* data_path, enr_Chart** chart)
{
I32 app_stat = ENR_NOERR;
I32 chart_stat = ENR_NOERR;
if (g_app == NULL)
{
app_stat = AppCreate (data_path, &g_app);
}
*chart = ChartCreate();
(*chart)->app = g_app;
g_app->chart_cnt++;
chart_stat = ChartInit (*chart);
return (app_stat != ENR_NOERR) ? app_stat : chart_stat;
}
and
I32 enr_GetThemeName (const enr_Chart* chart, I32 idx, CHAR** name)
{
enr_App* app = chart ? chart->app : NULL;
JCLArray* themes = app ? &app->themes : NULL;
ChartTheme** theme = themes ? (ChartTheme**) ArrayGet (themes, id
+x) : NULL;
if (theme == NULL)
{
return ENR_ERR_BADARG;
}
*name = (*theme)->name;
return ENR_NOERR;
}
All I want to do is send a call from Perl to the C API and get back the theme name using the enr_GetThemeName call.
Any help would be appreciated.
Thanks, Mike
20041115 Edit by ysth: code and p tags
20041116 Edit by ysth: retitle from: XS newbie
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.