Back to index

python3.2  3.2.2
Classes | Defines | Typedefs | Functions | Variables
_ctypes_test.c File Reference
#include <Python.h>

Go to the source code of this file.

Classes

struct  SPAM
struct  EGG
struct  tagpoint
struct  xxx_library
struct  RECT
struct  S2H
struct  S8I

Defines

#define EXPORT(x)   x
#define __stdcall   /* */
#define S   last_tf_arg_s = (PY_LONG_LONG)c
#define U   last_tf_arg_u = (unsigned PY_LONG_LONG)c

Typedefs

typedef struct tagpoint point

Functions

 _testfunc_cbk_reg_int (int a, int b, int c, int d, int e, int(*func)(int, int, int, int, int))
 _testfunc_cbk_reg_double (double a, double b, double c, double d, double e, double(*func)(double, double, double, double, double))
 EXPORT (void)
 EXPORT (long double) testfunc_Ddd(double a
 EXPORT (int)
 integrate (double a, double b, double(*f)(double), long nstep)
static void _xxx_init (void *(*Xalloc)(int), void(*Xfree)(void *))
 EXPORT (xxx_library)
PyObjectpy_func_si (PyObject *self, PyObject *args)
PyObjectpy_func (PyObject *self, PyObject *args)
 EXPORT (PY_LONG_LONG)
 EXPORT (signed char) tf_b(signed char c)
 EXPORT (unsigned char) tf_B(unsigned char c)
 EXPORT (short)
 EXPORT (float)
 EXPORT (double)
 EXPORT (S2H)
 EXPORT (S8I)
PyMODINIT_FUNC PyInit__ctypes_test (void)

Variables

SPAM my_spams [2]
EGG my_eggs [1]
xxx_library _xxx_lib
static PyMethodDef module_methods []
static struct PyModuleDef

Class Documentation

struct SPAM

Definition at line 254 of file _ctypes_test.c.

Class Members
char * name
char * value
struct EGG

Definition at line 259 of file _ctypes_test.c.

Collaboration diagram for EGG:
Class Members
char * name
int num_spams
SPAM * spams
struct tagpoint

Definition at line 280 of file _ctypes_test.c.

Class Members
int x
int y
struct RECT

Definition at line 508 of file _ctypes_test.c.

Class Members
long bottom
long left
long right
long top
struct S2H

Definition at line 530 of file _ctypes_test.c.

Class Members
short x
short y
struct S8I

Definition at line 542 of file _ctypes_test.c.

Class Members
int a
int b
int c
int d
int e
int f
int g
int h

Define Documentation

#define __stdcall   /* */
#define EXPORT (   x)    x

Definition at line 10 of file _ctypes_test.c.

#define S   last_tf_arg_s = (PY_LONG_LONG)c

Definition at line 433 of file _ctypes_test.c.

#define U   last_tf_arg_u = (unsigned PY_LONG_LONG)c

Definition at line 434 of file _ctypes_test.c.


Typedef Documentation

typedef struct tagpoint point

Function Documentation

_testfunc_cbk_reg_double ( double  a,
double  b,
double  c,
double  d,
double  e,
double(*)(double, double, double, double, double)  func 
)

Definition at line 23 of file _ctypes_test.c.

{
    return func(a*a, b*b, c*c, d*d, e*e);
}
_testfunc_cbk_reg_int ( int  a,
int  b,
int  c,
int  d,
int  e,
int(*)(int, int, int, int, int func 
)

Definition at line 16 of file _ctypes_test.c.

{
    return func(a*a, b*b, c*c, d*d, e*e);
}
static void _xxx_init ( void *(*)(int Xalloc,
void(*)(void *)  Xfree 
) [static]

Definition at line 314 of file _ctypes_test.c.

{
    void *ptr;

    printf("_xxx_init got %p %p\n", Xalloc, Xfree);
    printf("calling\n");
    ptr = Xalloc(32);
    Xfree(ptr);
    printf("calls done, ptr was %p\n", ptr);
}
EXPORT ( void  )

Definition at line 29 of file _ctypes_test.c.

{
    printf("testfunc_array %d %d %d %d\n",
           values[0],
           values[1],
           values[2],
           values[3]);
}
EXPORT ( long  double)

Definition at line 442 of file _ctypes_test.c.

{ S; return c/3; }
EXPORT ( int  )

Definition at line 191 of file _ctypes_test.c.

{
    fp->c(1, 2);
    fp->s(3, 4);
    return 0;
}

Definition at line 329 of file _ctypes_test.c.

{
    return &_xxx_lib;
}

Definition at line 369 of file _ctypes_test.c.

            {
    int A: 1, B:2, C:3, D:4, E: 5, F: 6, G: 7, H: 8, I: 9;
    short M: 1, N: 2, O: 3, P: 4, Q: 5, R: 6, S: 7;
};
EXPORT ( signed  char)

Definition at line 436 of file _ctypes_test.c.

{ S; return c/3; }
EXPORT ( unsigned  char)

Definition at line 437 of file _ctypes_test.c.

{ U; return c/3; }
EXPORT ( short  )

Definition at line 438 of file _ctypes_test.c.

{ S; return c/3; }
EXPORT ( float  )

Definition at line 446 of file _ctypes_test.c.

{ S; return c/3; }
EXPORT ( double  )

Definition at line 447 of file _ctypes_test.c.

{ S; return c/3; }
EXPORT ( S2H  )

Definition at line 535 of file _ctypes_test.c.

{
    inp.x *= 2;
    inp.y *= 3;
    return inp;
}
EXPORT ( S8I  )

Definition at line 546 of file _ctypes_test.c.

{
    inp.a *= 2;
    inp.b *= 3;
    inp.c *= 4;
    inp.d *= 5;
    inp.e *= 6;
    inp.f *= 7;
    inp.g *= 8;
    inp.h *= 9;
    return inp;
}
integrate ( double  a,
double  b,
double(*)(double)  f,
long  nstep 
)

Definition at line 302 of file _ctypes_test.c.

{
    double x, sum=0.0, dx=(b-a)/(double)nstep;
    for(x=a+0.5*dx; (b-x)*(x-a)>0.0; x+=dx)
        sum += f(x);
    return sum/(double)nstep;
}

Here is the caller graph for this function:

PyObject* py_func ( PyObject self,
PyObject args 
)

Definition at line 359 of file _ctypes_test.c.

{
    Py_INCREF(Py_None);
    return Py_None;
}

Here is the caller graph for this function:

PyObject* py_func_si ( PyObject self,
PyObject args 
)

Definition at line 345 of file _ctypes_test.c.

{
    char *name;
    int i;
    if (!PyArg_ParseTuple(args, "si", &name, &i))
        return NULL;
    Py_INCREF(Py_None);
    return Py_None;
}

Here is the call graph for this function:

Definition at line 613 of file _ctypes_test.c.

{
    return PyModule_Create(&_ctypes_testmodule);
}

Variable Documentation

Initial value:
 {
    _xxx_init
}

Definition at line 325 of file _ctypes_test.c.

Initial value:
 {

    {"func_si", py_func_si, METH_VARARGS},
    {"func", py_func, METH_NOARGS},
    { NULL, NULL, 0, NULL},
}

Definition at line 424 of file _ctypes_test.c.

Initial value:
 {
    { "first egg", 1, my_spams }
}

Definition at line 270 of file _ctypes_test.c.

Initial value:
 {
    { "name1", "value1" },
    { "name2", "value2" },
}

Definition at line 265 of file _ctypes_test.c.

struct PyModuleDef [static]
Initial value:
 {
    PyModuleDef_HEAD_INIT,
    "_ctypes_test",
    NULL,
    -1,
    module_methods,
    NULL,
    NULL,
    NULL,
    NULL
}

Definition at line 600 of file _ctypes_test.c.