-
Notifications
You must be signed in to change notification settings - Fork 5
/
pogl_const.xs
71 lines (53 loc) · 1.4 KB
/
pogl_const.xs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* Last saved: Mon 27 Feb 2017 01:28:31 PM */
/* Copyright (c) 1998 Kenneth Albanowski. All rights reserved.
* Copyright (c) 2007 Bob Free. All rights reserved.
* Copyright (c) 2009,2017 Chris Marshall. All rights reserved.
* This program is free software; you can redistribute it and/or
* modify it under the same terms as Perl itself.
*/
/* All OpenGL constants---should split */
#define IN_POGL_CONST_XS
/* This ends up being OpenGL.pm */
/* #define IN_POGL_MAIN_XS */
#include <stdio.h>
#include "pgopogl.h"
#ifdef HAVE_GL
#include "gl_util.h"
#endif
#if defined(HAVE_GLUT) || defined(HAVE_FREEGLUT)
#ifndef GLUT_API_VERSION
#define GLUT_API_VERSION 4
#endif
#include "glut_util.h"
#endif
#ifdef IN_POGL_CONST_XS
/* These macros used in neoconstant */
#define i(test) if (strEQ(name, #test)) return newSViv((int)test);
#define f(test) if (strEQ(name, #test)) return newSVnv((double)test);
#define p(test) if (strEQ(name, #test)) return newSViv(PTR2IV(test));
static SV *
neoconstant(char * name, int arg)
{
#include "glut_const.h"
;
return 0;
}
#undef i
#undef f
#endif /* defined IN_POGL_CONST_XS */
MODULE = OpenGL::GLUT::Const PACKAGE = OpenGL::GLUT
#ifdef IN_POGL_CONST_XS
#// Define a POGL Constant
SV *
constant(name,arg)
char * name
int arg
CODE:
{
RETVAL = neoconstant(name, arg);
if (!RETVAL)
RETVAL = newSVsv(&PL_sv_undef);
}
OUTPUT:
RETVAL
#endif /* End IN_POGL_CONST_XS */