Interfacing with C questions

Marek Janukowicz <[email protected]> Fri, 4 Feb 2011 01:01:53 +0100
Newsgroups gmane.comp.lang.sather.announce
Organization Starware
Message-ID <[email protected]>
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