0N/A/*
2362N/A * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A#include <stdio.h>
0N/A#include "splashscreen.h"
0N/A
0N/Aextern void* SplashProcAddress(const char* name); /* in java_md.c */
0N/A
0N/A/*
0N/A * Prototypes of pointers to functions in splashscreen shared lib
0N/A */
0N/Atypedef int (*SplashLoadMemory_t)(void* pdata, int size);
0N/Atypedef int (*SplashLoadFile_t)(const char* filename);
0N/Atypedef void (*SplashInit_t)(void);
0N/Atypedef void (*SplashClose_t)(void);
0N/Atypedef void (*SplashSetFileJarName_t)(const char* fileName,
0N/A const char* jarName);
0N/A
0N/A/*
0N/A * This macro invokes a function from the shared lib.
0N/A * it locates a function with SplashProcAddress on demand.
0N/A * if SplashProcAddress fails, def value is returned.
0N/A *
0N/A * it is further wrapped with INVOKEV (works with functions which return
0N/A * void and INVOKE (for all other functions). INVOKEV looks a bit ugly,
0N/A * that's due being unable to return a value of type void in C. INVOKEV
0N/A * works around this by using semicolon instead of return operator.
0N/A */
0N/A#define _INVOKE(name,def,ret) \
0N/A static void* proc = NULL; \
0N/A if (!proc) { proc = SplashProcAddress(#name); } \
0N/A if (!proc) { return def; } \
0N/A ret ((name##_t)proc)
0N/A
0N/A#define INVOKE(name,def) _INVOKE(name,def,return)
0N/A#define INVOKEV(name) _INVOKE(name, ,;)
0N/A
0N/Aint DoSplashLoadMemory(void* pdata, int size) {
0N/A INVOKE(SplashLoadMemory,0)(pdata, size);
0N/A}
0N/A
0N/Aint DoSplashLoadFile(const char* filename) {
0N/A INVOKE(SplashLoadFile,0)(filename);
0N/A}
0N/A
0N/Avoid DoSplashInit(void) {
0N/A INVOKEV(SplashInit)();
0N/A}
0N/A
0N/Avoid DoSplashClose(void) {
0N/A INVOKEV(SplashClose)();
0N/A}
0N/A
0N/Avoid DoSplashSetFileJarName(const char* fileName, const char* jarName) {
0N/A INVOKEV(SplashSetFileJarName)(fileName, jarName);
0N/A}