]>
Commit | Line | Data |
---|---|---|
c90f71dd RD |
1 | // |
2 | // SWIG Pointer manipulation library | |
3 | // | |
4 | // This library can be used to manipulate C pointers. | |
5 | %title "SWIG Pointer Library" | |
6 | ||
7 | %module pointer | |
8 | ||
9 | ||
10 | %section "Pointer Handling Library",noinfo,after,pre,nosort,skip=1,chop_left=3,chop_right=0,chop_top=0,chop_bottom=0 | |
11 | ||
12 | %text %{ | |
13 | %include pointer.i | |
14 | ||
15 | The pointer.i library provides run-time support for managing and | |
16 | manipulating a variety of C/C++ pointer values. In particular, | |
17 | you can create various kinds of objects and dereference common | |
18 | pointer types. This is done through a common set of functions: | |
19 | ||
20 | ptrcast - Casts a pointer to a new type | |
21 | ptrvalue - Dereferences a pointer | |
22 | ptrset - Set the value of an object referenced by | |
23 | a pointer. | |
24 | ptrcreate - Create a new object and return a pointer. | |
25 | ptrfree - Free the memory allocated by ptrcreate. | |
26 | ptradd - Increment/decrement a pointer value. | |
27 | ptrmap - Make two datatypes equivalent to each other. | |
28 | (Is a runtime equivalent of typedef). | |
29 | ||
30 | When creating, dereferencing, or setting the value of pointer | |
31 | variable, only the common C datatypes of int, short, long, float, | |
32 | double, char, and char * are currently supported. Other | |
33 | datatypes may generate an error. | |
34 | ||
35 | One of the more interesting aspects of this library is that | |
36 | it operates with a wide range of datatypes. For example, | |
37 | the "ptrvalue" function can dereference "double *", "int *", | |
38 | "long *", "char *", and other datatypes. Since SWIG encodes | |
39 | pointers with type information, this can be done transparently | |
40 | and in most cases, you can dereference a pointer without | |
41 | ever knowing what type it actually is. | |
42 | ||
43 | This library is primarily designed for utility, not high | |
44 | performance (the dynamic determination of pointer types takes | |
45 | more work than most normal wrapper functions). As a result, | |
46 | you may achieve better performance by writing customized | |
47 | "helper" functions if you're making lots of calls to these | |
48 | functions in inner loops or other intensive operations. | |
49 | %} | |
50 | ||
51 | // This library is a pretty hideous mess of language dependent code. | |
52 | // Grab the implementation from the appropriate libray | |
53 | ||
54 | %include ptrlang.i | |
55 | ||
56 | ||
57 | ||
58 |