1/*
2 * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26#ifndef HEADLESS
27
28#include "OGLFuncs.h"
29
30OGL_EXPRESS_ALL_FUNCS(DECLARE)
31
32OGL_DECLARE_LIB_HANDLE();
33
34jboolean
35OGLFuncs_OpenLibrary()
36{
37    J2dRlsTraceLn(J2D_TRACE_INFO, "OGLFuncs_OpenLibrary");
38
39    OGL_OPEN_LIB();
40    if (OGL_LIB_IS_UNINITIALIZED()) {
41        J2dRlsTraceLn(J2D_TRACE_ERROR,
42                      "OGLFuncs_OpenLibrary: could not open library");
43        return JNI_FALSE;
44    }
45
46    return JNI_TRUE;
47}
48
49void
50OGLFuncs_CloseLibrary()
51{
52    J2dRlsTraceLn(J2D_TRACE_INFO, "OGLFuncs_CloseLibrary");
53
54    if (OGL_LIB_IS_UNINITIALIZED()) {
55        J2dRlsTraceLn(J2D_TRACE_ERROR,
56                      "OGLFuncs_CloseLibrary: library not yet initialized");
57        return;
58    }
59
60    if (OGL_CLOSE_LIB()) {
61        J2dRlsTraceLn(J2D_TRACE_ERROR,
62                      "OGLFuncs_CloseLibrary: could not close library");
63    }
64}
65
66jboolean
67OGLFuncs_InitPlatformFuncs()
68{
69    J2dRlsTraceLn(J2D_TRACE_INFO, "OGLFuncs_InitPlatformFuncs");
70
71    if (OGL_LIB_IS_UNINITIALIZED()) {
72        J2dRlsTraceLn(J2D_TRACE_ERROR,
73            "OGLFuncs_InitPlatformFuncs: library not yet initialized");
74        return JNI_FALSE;
75    }
76
77    OGL_EXPRESS_PLATFORM_FUNCS(INIT_AND_CHECK)
78
79    J2dTraceLn(J2D_TRACE_VERBOSE,
80        "OGLFuncs_InitPlatformFuncs: successfully loaded platform symbols");
81
82    return JNI_TRUE;
83}
84
85jboolean
86OGLFuncs_InitBaseFuncs()
87{
88    J2dRlsTraceLn(J2D_TRACE_INFO, "OGLFuncs_InitBaseFuncs");
89
90    if (OGL_LIB_IS_UNINITIALIZED()) {
91        J2dRlsTraceLn(J2D_TRACE_ERROR,
92                      "OGLFuncs_InitBaseFuncs: library not yet initialized");
93        return JNI_FALSE;
94    }
95
96    OGL_EXPRESS_BASE_FUNCS(INIT_AND_CHECK)
97
98    J2dTraceLn(J2D_TRACE_VERBOSE,
99        "OGLFuncs_InitBaseFuncs: successfully loaded base symbols");
100
101    return JNI_TRUE;
102}
103
104jboolean
105OGLFuncs_InitExtFuncs()
106{
107    J2dRlsTraceLn(J2D_TRACE_INFO, "OGLFuncs_InitExtFuncs");
108
109    if (OGL_LIB_IS_UNINITIALIZED()) {
110        J2dRlsTraceLn(J2D_TRACE_ERROR,
111                      "OGLFuncs_InitExtFuncs: library not yet initialized");
112        return JNI_FALSE;
113    }
114
115    OGL_EXPRESS_EXT_FUNCS(INIT)
116    OGL_EXPRESS_PLATFORM_EXT_FUNCS(INIT_AND_CHECK)
117
118    J2dTraceLn(J2D_TRACE_VERBOSE,
119        "OGLFuncs_InitExtFuncs: successfully loaded ext symbols");
120
121    return JNI_TRUE;
122}
123
124#endif /* !HEADLESS */
125