opensubscriber
   Find in this group all groups
 
Unknown more information…

i : info-sather@gnu.org 4 February 2011 • 8:01AM -0500

Interfacing with C questions
by Marek Janukowicz

REPLY TO AUTHOR
 
REPLY TO GROUP




Hello

1. How is C_SIZE_T type useful? It doesn't contain any methods to convert
to/from Sather types, so when I need to create a size_t variable with some
specific value from Sather side I can't use C_SIZE_T anyway.

2. Why does STR::create_from_c_string take EXT_OB and not C_CHAR_PTR as the
argument? This makes me use EXT_OB as return type for my external class
methods, which feels somewhat too generic when I know I'm returning "char *"
everywhere.

3. I saw some code in base library (eg. in SOCKET class) that just declares
external methods with Sather-typed arguments (STR, INT) and then those methods
just have int or char * on C side. Is this the right approach to take instead
of using eg. C_INT and other wrapped C types?

4. I'm implementing a wrapper for libpcre (because builtin REGEXP class only
handles POSIX regular expressions, which is way too little for my needs) and I
encountered a situation where my fresh Sather skills are lacking. There is a C
function:

  int pcre_get_substring_list(const char *subject, int *ovector, int
stringcount, const char ***listptr);

where listptr returns an array of strings. How can I wrap it to get ARRAY{STR}
on Sather side? I guess I can't just convert it directly. Is there any well-
defined way to call Sather methods on C side (this way I could create STRs and
ARRAY in my C code, which would be convenient due to some cleanup I need to
perform there)?

Even if you don't know full answers, but could shed some light on the subject,
please do not hesitate to do that.

Thanks
--
Marek Janukowicz


Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.