Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/bin/splashscreen_stubs.c
38767 views
/*1* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#include <stdio.h>26#include "splashscreen.h"2728extern void* SplashProcAddress(const char* name); /* in java_md.c */2930/*31* Prototypes of pointers to functions in splashscreen shared lib32*/33typedef int (*SplashLoadMemory_t)(void* pdata, int size);34typedef int (*SplashLoadFile_t)(const char* filename);35typedef void (*SplashInit_t)(void);36typedef void (*SplashClose_t)(void);37typedef void (*SplashSetFileJarName_t)(const char* fileName,38const char* jarName);39typedef void (*SplashSetScaleFactor_t)(float scaleFactor);40typedef char* (*SplashGetScaledImageName_t)(const char* fileName,41const char* jarName, float* scaleFactor);4243/*44* This macro invokes a function from the shared lib.45* it locates a function with SplashProcAddress on demand.46* if SplashProcAddress fails, def value is returned.47*48* it is further wrapped with INVOKEV (works with functions which return49* void and INVOKE (for all other functions). INVOKEV looks a bit ugly,50* that's due being unable to return a value of type void in C. INVOKEV51* works around this by using semicolon instead of return operator.52*/53#define _INVOKE(name,def,ret) \54static void* proc = NULL; \55if (!proc) { proc = SplashProcAddress(#name); } \56if (!proc) { return def; } \57ret ((name##_t)proc)5859#define INVOKE(name,def) _INVOKE(name,def,return)60#define INVOKEV(name) _INVOKE(name, ,;)6162int DoSplashLoadMemory(void* pdata, int size) {63INVOKE(SplashLoadMemory, NULL)(pdata, size);64}6566int DoSplashLoadFile(const char* filename) {67INVOKE(SplashLoadFile, NULL)(filename);68}6970void DoSplashInit(void) {71INVOKEV(SplashInit)();72}7374void DoSplashClose(void) {75INVOKEV(SplashClose)();76}7778void DoSplashSetFileJarName(const char* fileName, const char* jarName) {79INVOKEV(SplashSetFileJarName)(fileName, jarName);80}8182void DoSplashSetScaleFactor(float scaleFactor) {83INVOKEV(SplashSetScaleFactor)(scaleFactor);84}8586char* DoSplashGetScaledImageName(const char* fileName, const char* jarName,87float* scaleFactor) {88INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor);89}9091