Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.

Commit 545bc30

Browse files
author
Chris Marshall
committed
Safety snapshot of partial xs file split
By using #ifdef's and #defines such as IN_POGL_GL_XS, I am segmenting the original OpenGL.xs file by the planned final XS file location. Once all the partitioning #ifdef--#endif pairs are in, we'll copy the file to the new .xs names and set only the specific #define for that file. When the split version is debugged and working we will remove the redundant code sections.
1 parent 9561647 commit 545bc30

File tree

1 file changed

+57
-13
lines changed

1 file changed

+57
-13
lines changed

OpenGL.xs

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,38 @@
44
* modify it under the same terms as Perl itself.
55
*/
66

7+
/* OpenGL::Array */
8+
#define IN_POGL_ARRAY_XS
9+
10+
/* All OpenGL constants---should split */
11+
#define IN_POGL_CONST_XS
12+
13+
/* OpenGL OpenGL bindings */
14+
#define IN_POGL_GL_XS
15+
16+
/* OpenGL *GLUT bindings */
17+
#define IN_POGL_GLUT_XS
18+
19+
/* OpenGL GLU bindings */
20+
#define IN_POGL_GLU_XS
21+
22+
/* OpenGL GLX bindings */
23+
#define IN_POGL_GLX_XS
24+
25+
/* This ends up being OpenGL.pm */
26+
#define IN_POGL_MAIN_XS
27+
28+
/* OpenGL RPN code */
29+
#define IN_POGL_RPN_XS
30+
731
#include <stdio.h>
32+
833
#include "pgopogl.h"
9-
#include "ppport.h"
1034

35+
#ifdef IN_POGL_MAIN_XS
1136
=head2 Miscellaneous
1237

13-
Various useful utilities defined in PGOpogl.xs.
38+
Various BOOT utilities defined in pogl_main.xs.
1439

1540
=over
1641

@@ -43,19 +68,27 @@ _pgopogl_call_XS (pTHX_ void (*subaddr) (pTHX_ CV *), CV * cv, SV ** mark)
4368
(*subaddr) (aTHX_ cv);
4469
PUTBACK; /* forget return values */
4570
}
71+
#endif /* End IN_POGL_MAIN_XS */
4672

73+
#ifdef IN_POGL_GL_XS
4774
#ifdef HAVE_GL
4875
#include "gl_util.h"
4976
#endif
77+
#endif /* End IN_POGL_GL_XS */
5078

79+
#ifdef IN_POGL_GLX_XS
5180
#ifdef HAVE_GLX
5281
#include "glx_util.h"
5382
#endif
83+
#endif /* End IN_POGL_GLX_XS */
5484

85+
#ifdef IN_POGL_GLU_XS
5586
#ifdef HAVE_GLU
5687
#include "glu_util.h"
5788
#endif
89+
#endif /* End IN_POGL_GLU_XS */
5890

91+
#ifdef IN_POGL_GLUT_XS
5992
#if defined(HAVE_GLUT) || defined(HAVE_FREEGLUT)
6093
#ifndef GLUT_API_VERSION
6194
#define GLUT_API_VERSION 4
@@ -64,34 +97,40 @@ _pgopogl_call_XS (pTHX_ void (*subaddr) (pTHX_ CV *), CV * cv, SV ** mark)
6497
#endif
6598

6699
static int _done_glutInit = 0;
100+
#endif /* End IN_POGL_GLUT_XS */
67101

102+
#ifdef IN_POGL_RPN_XS
68103
#ifndef M_PI
69104
#ifdef PI
70105
#define M_PI PI
71106
#else
72107
#define M_PI 3.1415926535897932384626433832795
73108
#endif
74109
#endif
110+
#endif /* End IN_POGL_RPN_XS */
75111

112+
#ifdef IN_POGL_GL_XS
76113
GLint FBO_MAX = -1;
114+
#endif /* End IN_POGL_GL_XS */
77115

78-
static char *SWIZZLE[4] = {"x","y","z","w"};
116+
/* This does not seem to be used */
117+
#if 0
118+
static char *SWIZZLE[4] = {"x","y","z","w"}; */
119+
#endif
79120

121+
/* This does not seem to be used */
122+
#if 0
80123
static int
81124
not_here(s)
82125
char *s;
83126
{
84127
croak("%s not implemented on this architecture", s);
85128
return -1;
86129
}
130+
#endif
87131

88132

89-
/* GLUT on OS/2 PM runs callbacks from a secondary thread. This thread
90-
is not instrumented to run EMX CRTL functions. Basically, no Perl
91-
function may be run from this thread.
92-
We create a ternary thread via CRTL _beginthread() call, and communicate
93-
the requests to this thread via inter-thread communication (ITC). */
94-
133+
#ifdef IN_POGL_GLUT_XS
95134
#ifndef __PM__
96135
# define DO_perl_call_sv(handler, flag) perl_call_sv(handler, flag)
97136
# define ENSURE_callback_thread
@@ -101,6 +140,11 @@ char *s;
101140
# define GLUT_EXTEND_STACK(sp,n)
102141
# define GLUT_PUSHMARK(sp) PUSHMARK(sp)
103142
#else
143+
/* GLUT on OS/2 PM runs callbacks from a secondary thread. This thread
144+
is not instrumented to run EMX CRTL functions. Basically, no Perl
145+
function may be run from this thread.
146+
We create a ternary thread via CRTL _beginthread() call, and communicate
147+
the requests to this thread via inter-thread communication (ITC). */
104148

105149
# define GLUT_PUSHMARK(sp)
106150

@@ -248,15 +292,14 @@ start_callback_thread()
248292
croak("Error creating callback thread");
249293
}
250294
}
251-
252295
#endif /* __PM__ */
296+
#endif /* End IN_POGL_GLUT_XS */
253297

298+
#ifdef IN_POGL_CONST_XS
299+
/* These macros used in neoconstant */
254300
#define i(test) if (strEQ(name, #test)) return newSViv((int)test);
255301
#define f(test) if (strEQ(name, #test)) return newSVnv((double)test);
256302

257-
#ifdef __PM__
258-
#endif
259-
260303
static SV *
261304
neoconstant(char * name, int arg)
262305
{
@@ -271,6 +314,7 @@ neoconstant(char * name, int arg)
271314

272315
#undef i
273316
#undef f
317+
#endif /* End IN_POGL_CONST_XS */
274318

275319
/* Note: this is caching procs once for all contexts */
276320
/* !!! This should instead cache per context */

0 commit comments

Comments
 (0)