c2nim: new features & bugfixes

This commit is contained in:
Andreas Rumpf 2010-08-11 23:13:11 +02:00
commit afbff2d504
12 changed files with 1262 additions and 171 deletions

View file

@ -9,32 +9,64 @@ extern "C" {
# endif
#endif
#private expatDll
#if !defined(expatDll)
# if defined(windows)
# define expatDll "expat.dll"
# elif defined(macosx)
# define expatDll "libexpat.dynlib"
# else
# define expatDll "libexpat.so(.1|)"
# endif
#endif
#mangle "'XML_'{.*}" "$1"
#private "'XML_ParserStruct'"
#mangle cunsignedint cint
unsigned int uiVar;
#private "@('_'!.)"
unsigned int myPrivateVar__;
struct XML_ParserStruct;
#def XMLCALL __cdecl
typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData,
const XML_Char *name,
XML_Content *model);
void* x;
void* fn(void);
void (*fn)(void);
void* (*fn)(void);
void* (*fn)(void*);
/*
* Very ugly real world code ahead:
*/
/*
* Very ugly real world code ahead:
*/
#def JMETHOD(rettype, name, params) rettype (*name) params
typedef struct cjpeg_source_struct * cjpeg_source_ptr;
struct cjpeg_source_struct {
JMETHOD(void, start_input, (j_compress_ptr cinfo,
cjpeg_source_ptr sinfo));
JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
cjpeg_source_ptr sinfo));
JMETHOD(void, finish_input, (j_compress_ptr cinfo,
cjpeg_source_ptr sinfo));
FILE *input_file;
JSAMPARRAY buffer;
JDIMENSION buffer_height;
typedef struct cjpeg_source_struct * cjpeg_source_ptr;
struct cjpeg_source_struct {
JMETHOD(void, start_input, (j_compress_ptr cinfo,
cjpeg_source_ptr sinfo));
JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
cjpeg_source_ptr sinfo));
JMETHOD(void, finish_input, (j_compress_ptr cinfo,
cjpeg_source_ptr sinfo));
FILE *input_file;
JSAMPARRAY buffer;
JDIMENSION buffer_height;
};
// Test standalone structs: