[lua] added %luacode feature, documentation & examples

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10312 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mark Gossage 2008-03-17 08:50:59 +00:00
commit e543cd9040
12 changed files with 279 additions and 25 deletions

View file

@ -0,0 +1,25 @@
/* File : example.c */
#include <stdlib.h>
/* we are using the qsort function, which needs a helper function to sort */
int compare_int(const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
void sort_int(int* arr, int len)
{
qsort(arr, len, sizeof(int), compare_int);
}
// ditto doubles
int compare_double(const void * a, const void * b)
{
return ( *(double*)a - *(double*)b );
}
void sort_double(double* arr, int len)
{
qsort(arr, len, sizeof(double), compare_double);
}