Skip to content

Commit d7c57f7

Browse files
committed
Update XS code generation notes
1 parent 88d0906 commit d7c57f7

File tree

4 files changed

+839
-11
lines changed

4 files changed

+839
-11
lines changed

utils/XS_generate_NOTES.txt

+20-11
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ GLEW include file declarations in glew.h.
4040
* Categorize OpenGL bindings as "good" or "bad" according to whether
4141
or not they have pointer arguments.
4242

43-
- The good routines
43+
- The good routines (DONE)
4444
- translate cleanly to XS with default typemaps
4545
- won't require a separate _p perlish version
4646
- There are 1265 good routines that translate directly (yay!)
@@ -62,19 +62,28 @@ GLEW include file declarations in glew.h.
6262
- 2 routines with 6 ptrs
6363
- 1 routines with 7 ptrs
6464

65-
- Still needs to be detemined the best typemap for pointers
65+
- Propose using T_PTRREF or T_PTROBJ for pointers at perl level
6666
- T_PTR is simple but could lead to SEGFAULT with bad values
67-
- Opaque pointers might be better
68-
- If the perl value corresponding to the pointer argument is
69-
some type of reference (blessed or unblessed) we can use
70-
that information to implement simply. For example, a
71-
single argument could be:
72-
- an array ref, [ ]
73-
- a hash ref, { }
74-
- a scalar ref, \$
75-
- a blessed object: PDL, Cpointer, OGA, ...
67+
- T_PTRREF/OBJ protect pointer value from accidental corruption
68+
- Using a reference/object makes for simple typemaps
69+
- Just use ref to identify and then use
70+
- Can be done from Perl or C/XS
71+
- Some examples:
72+
- an array ref, [ ]
73+
- a hash ref, { }
74+
- a scalar ref, \$
75+
- a blessed object: PDL, Cpointer, OGA, ...
7676

7777
* Consider writing generate-XS.pl as a modulino so that it could be
7878
used as either a command or a module to load and use.
7979

80+
* Propose use of roles to generalize implementation
81+
- Basic role provides placeholders for needed functionality
82+
- Use around method modifiers to provide actual function
83+
- Should be able to "compile" the around routine make fast
84+
- could be memoized at the perl level
85+
- could be done from the C/XS level
86+
- First implementation will focus on functionality
87+
- Optimized routines to come or use specific _c routine
88+
8089

0 commit comments

Comments
 (0)