Debian Codegraph @

tools/swig/test/Flat.cxx

raw
1 #include <stdlib.h>
2 #include <math.h>
3 #include <iostream>
4 #include "Flat.h"
5
6 // The following macro defines a family of functions that work with 1D
7 // arrays with the forms
8 //
9 // void SNAMEProcess(TYPE * array, int size);
10 //
11 // for any specified type TYPE (for example: short, unsigned int, long
12 // long, etc.) with given short name SNAME (for example: short, uint,
13 // longLong, etc.). The macro is then expanded for the given
14 // TYPE/SNAME pairs. The resulting functions are for testing numpy
15 // interfaces for:
16 //
17 // * in-place arrays (arbitrary number of dimensions) with a fixed number of elements
18 //
19 #define TEST_FUNCS(TYPE, SNAME) \
20 \
21 void SNAME ## Process(TYPE * array, int size) { \
22 for (int i=0; i<size; ++i) array[i] += 1; \
23 }
24
25 TEST_FUNCS(signed char , schar )
26 TEST_FUNCS(unsigned char , uchar )
27 TEST_FUNCS(short , short )
28 TEST_FUNCS(unsigned short , ushort )
29 TEST_FUNCS(int , int )
30 TEST_FUNCS(unsigned int , uint )
31 TEST_FUNCS(long , long )
32 TEST_FUNCS(unsigned long , ulong )
33 TEST_FUNCS(long long , longLong )
34 TEST_FUNCS(unsigned long long, ulongLong)
35 TEST_FUNCS(float , float )
36 TEST_FUNCS(double , double )