Commit 554147b6 authored by Sam Lantinga's avatar Sam Lantinga

make indent

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402345
parent 25541b23
...@@ -1300,9 +1300,9 @@ extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID); ...@@ -1300,9 +1300,9 @@ extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID);
/* /*
* Maps an RGB triple to an opaque pixel value for a given pixel format * Maps an RGB triple to an opaque pixel value for a given pixel format
*/ */
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * const format, extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat *
const Uint8 r, const Uint8 g, const format, const Uint8 r,
const Uint8 b); const Uint8 g, const Uint8 b);
/* /*
* Maps an RGBA quadruple to a pixel value for a given pixel format * Maps an RGBA quadruple to a pixel value for a given pixel format
......
/* *INDENT-OFF* */
/* /*
* *
* @APPLE_LICENSE_HEADER_START@ * @APPLE_LICENSE_HEADER_START@
......
...@@ -693,10 +693,10 @@ SDL_SYS_JoystickInit(void) ...@@ -693,10 +693,10 @@ SDL_SYS_JoystickInit(void)
*/ */
/* Filter device list to non-keyboard/mouse stuff */ /* Filter device list to non-keyboard/mouse stuff */
if ( (device->usagePage != kHIDPage_GenericDesktop) || if ((device->usagePage != kHIDPage_GenericDesktop) ||
((device->usage != kHIDUsage_GD_Joystick && ((device->usage != kHIDUsage_GD_Joystick &&
device->usage != kHIDUsage_GD_GamePad && device->usage != kHIDUsage_GD_GamePad &&
device->usage != kHIDUsage_GD_MultiAxisController)) ) { device->usage != kHIDUsage_GD_MultiAxisController))) {
/* release memory for the device */ /* release memory for the device */
HIDDisposeDevice(&device); HIDDisposeDevice(&device);
......
...@@ -53,7 +53,7 @@ static struct ...@@ -53,7 +53,7 @@ static struct
"SideWinder Precision Pro", 4, 1, 0}, { "SideWinder Precision Pro", 4, 1, 0}, {
"SideWinder 3D Pro", 4, 1, 0}, { "SideWinder 3D Pro", 4, 1, 0}, {
"Microsoft SideWinder 3D Pro", 4, 1, 0}, { "Microsoft SideWinder 3D Pro", 4, 1, 0}, {
"Microsoft SideWinder Precision Pro", 4, 1, 0 }, { "Microsoft SideWinder Precision Pro", 4, 1, 0}, {
"Microsoft SideWinder Dual Strike USB version 1.0", 2, 1, 0}, { "Microsoft SideWinder Dual Strike USB version 1.0", 2, 1, 0}, {
"WingMan Interceptor", 3, 3, 0}, { "WingMan Interceptor", 3, 3, 0}, {
"WingMan Extreme Digital 3D", 4, 1, 0}, { "WingMan Extreme Digital 3D", 4, 1, 0}, {
......
...@@ -49,7 +49,8 @@ SDL_LoadFunction(void *handle, const char *name) ...@@ -49,7 +49,8 @@ SDL_LoadFunction(void *handle, const char *name)
{ {
void *sym = NULL; void *sym = NULL;
image_id library_id = (image_id) handle; image_id library_id = (image_id) handle;
status_t rc = get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym); status_t rc =
get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym);
if (rc != B_NO_ERROR) { if (rc != B_NO_ERROR) {
SDL_SetError(strerror(rc)); SDL_SetError(strerror(rc));
} }
...@@ -69,4 +70,3 @@ SDL_UnloadObject(void *handle) ...@@ -69,4 +70,3 @@ SDL_UnloadObject(void *handle)
#endif /* SDL_LOADSO_BEOS */ #endif /* SDL_LOADSO_BEOS */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -298,8 +298,8 @@ SDL_revcpy(void *dst, const void *src, size_t len) ...@@ -298,8 +298,8 @@ SDL_revcpy(void *dst, const void *src, size_t len)
{ {
char *srcp = (char *) src; char *srcp = (char *) src;
char *dstp = (char *) dst; char *dstp = (char *) dst;
srcp += len-1; srcp += len - 1;
dstp += len-1; dstp += len - 1;
while (len--) { while (len--) {
*dstp-- = *srcp--; *dstp-- = *srcp--;
} }
...@@ -872,7 +872,8 @@ SDL_sscanf(const char *text, const char *fmt, ...) ...@@ -872,7 +872,8 @@ SDL_sscanf(const char *text, const char *fmt, ...)
++index; ++index;
} }
if (text[index] == '0') { if (text[index] == '0') {
if (SDL_tolower((unsigned char) text[index + 1]) == 'x') { if (SDL_tolower((unsigned char) text[index + 1])
== 'x') {
radix = 16; radix = 16;
} else { } else {
radix = 8; radix = 8;
......
...@@ -80,8 +80,8 @@ SDL_GetTicks(void) ...@@ -80,8 +80,8 @@ SDL_GetTicks(void)
if (read_hz200_from_vbl) { if (read_hz200_from_vbl) {
now = SDL_Atari_hz200; now = SDL_Atari_hz200;
} else { } else {
void *old_stack = (void *)Super(0); void *old_stack = (void *) Super(0);
now = *((volatile long *)_hz_200); now = *((volatile long *) _hz_200);
Super(old_stack); Super(old_stack);
} }
......
...@@ -387,9 +387,11 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info) ...@@ -387,9 +387,11 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info)
packsswb_r2r(mm6, mm3); /* 0000FFFF -> mm3 */ packsswb_r2r(mm6, mm3); /* 0000FFFF -> mm3 */
pxor_r2r(mm0, mm3); /* 0000F000 -> mm3 (~channel mask) */ pxor_r2r(mm0, mm3); /* 0000F000 -> mm3 (~channel mask) */
/* get alpha channel shift */ /* get alpha channel shift */
/* *INDENT-OFF* */
__asm__ __volatile__ ( __asm__ __volatile__ (
"movd %0, %%mm5" "movd %0, %%mm5"
: : "rm" ((Uint32) sf->Ashift) ); /* Ashift -> mm5 */ : : "rm" ((Uint32) sf->Ashift) ); /* Ashift -> mm5 */
/* *INDENT-ON* */
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
......
...@@ -551,8 +551,8 @@ SDL_MapRGB(const SDL_PixelFormat * const format, const Uint8 r, const Uint8 g, ...@@ -551,8 +551,8 @@ SDL_MapRGB(const SDL_PixelFormat * const format, const Uint8 r, const Uint8 g,
/* Find the pixel value corresponding to an RGBA quadruple */ /* Find the pixel value corresponding to an RGBA quadruple */
Uint32 Uint32
SDL_MapRGBA(const SDL_PixelFormat * const format, const Uint8 r, const Uint8 g, SDL_MapRGBA(const SDL_PixelFormat * const format, const Uint8 r,
const Uint8 b, const Uint8 a) const Uint8 g, const Uint8 b, const Uint8 a)
{ {
if (format->palette == NULL) { if (format->palette == NULL) {
return (r >> format->Rloss) << format->Rshift return (r >> format->Rloss) << format->Rshift
......
...@@ -372,7 +372,7 @@ extern "C" ...@@ -372,7 +372,7 @@ extern "C"
modes = SDL_modelist[((bpp + 7) / 8) - 1]; modes = SDL_modelist[((bpp + 7) / 8) - 1];
bool exactmatch = false; bool exactmatch = false;
for ( uint32 x = 0; modes[x]; x++ ) { for (uint32 x = 0; modes[x]; x++) {
if (modes[x]->w == width && modes[x]->h == height) { if (modes[x]->w == width && modes[x]->h == height) {
exactmatch = true; exactmatch = true;
i = x; i = x;
...@@ -385,7 +385,8 @@ extern "C" ...@@ -385,7 +385,8 @@ extern "C"
/* still looking */ /* still looking */
} }
if (!modes[i] || (modes[i]->w < width) || (modes[i]->h < height)) { if (!modes[i] || (modes[i]->w < width) || (modes[i]->h < height)) {
--i; /* We went too far */ /* We went too far */
--i;
} }
} }
width = modes[i]->w; width = modes[i]->w;
......
...@@ -119,7 +119,8 @@ CreateYUVSurface(_THIS, struct private_yuvhwdata *hwdata, ...@@ -119,7 +119,8 @@ CreateYUVSurface(_THIS, struct private_yuvhwdata *hwdata,
/* Need to set coop level or newer DirectFB versions will fail here. */ /* Need to set coop level or newer DirectFB versions will fail here. */
ret = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); ret = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
if (ret) { if (ret) {
SetDirectFBError("IDirectFBDisplayLayer::SetCooperativeLevel() failed", ret); SetDirectFBError
("IDirectFBDisplayLayer::SetCooperativeLevel() failed", ret);
layer->Release(layer); layer->Release(layer);
return ret; return ret;
} }
......
...@@ -181,7 +181,8 @@ static void FB_SavePalette(_THIS, struct fb_fix_screeninfo *finfo, ...@@ -181,7 +181,8 @@ static void FB_SavePalette(_THIS, struct fb_fix_screeninfo *finfo,
struct fb_var_screeninfo *vinfo); struct fb_var_screeninfo *vinfo);
static void FB_RestorePalette(_THIS); static void FB_RestorePalette(_THIS);
static int SDL_getpagesize(void) static int
SDL_getpagesize(void)
{ {
#ifdef HAVE_GETPAGESIZE #ifdef HAVE_GETPAGESIZE
return getpagesize(); return getpagesize();
...@@ -189,7 +190,8 @@ static int SDL_getpagesize(void) ...@@ -189,7 +190,8 @@ static int SDL_getpagesize(void)
return PAGE_SIZE; return PAGE_SIZE;
#else #else
#error Can not determine system page size. #error Can not determine system page size.
return 4096; /* this is what it USED to be in Linux... */ /* this is what it USED to be in Linux... */
return 4096;
#endif #endif
} }
......
...@@ -650,7 +650,7 @@ GEM_SetVideoMode(_THIS, SDL_Surface * current, ...@@ -650,7 +650,7 @@ GEM_SetVideoMode(_THIS, SDL_Surface * current,
/*--- Verify if asked mode can be used ---*/ /*--- Verify if asked mode can be used ---*/
if (VDI_bpp != bpp) { if (VDI_bpp != bpp) {
SDL_SetError("%d bpp mode not supported", bpp); SDL_SetError("%d bpp mode not supported", bpp);
return(NULL); return (NULL);
} }
if (flags & SDL_FULLSCREEN) { if (flags & SDL_FULLSCREEN) {
...@@ -774,10 +774,10 @@ GEM_SetVideoMode(_THIS, SDL_Surface * current, ...@@ -774,10 +774,10 @@ GEM_SetVideoMode(_THIS, SDL_Surface * current,
/* Center window */ /* Center window */
x2 = (GEM_desk_w - w2) >> 1; x2 = (GEM_desk_w - w2) >> 1;
y2 = (GEM_desk_h - h2) >> 1; y2 = (GEM_desk_h - h2) >> 1;
if (x2<0) { if (x2 < 0) {
x2 = 0; x2 = 0;
} }
if (y2<0) { if (y2 < 0) {
y2 = 0; y2 = 0;
} }
x2 += GEM_desk_x; x2 += GEM_desk_x;
...@@ -811,9 +811,11 @@ GEM_SetVideoMode(_THIS, SDL_Surface * current, ...@@ -811,9 +811,11 @@ GEM_SetVideoMode(_THIS, SDL_Surface * current,
wind_open(GEM_handle, x2, y2, w2, h2); wind_open(GEM_handle, x2, y2, w2, h2);
} else { } else {
/* Resize window to fit asked video mode */ /* Resize window to fit asked video mode */
wind_get (GEM_handle, WF_WORKXYWH, &x2,&y2,&w2,&h2); wind_get(GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2);
if (wind_calc(WC_BORDER, GEM_win_type, x2,y2,width,height, &x2,&y2,&w2,&h2)) { if (wind_calc
wind_set (GEM_handle, WF_CURRXYWH, x2,y2,w2,h2); (WC_BORDER, GEM_win_type, x2, y2, width, height, &x2, &y2,
&w2, &h2)) {
wind_set(GEM_handle, WF_CURRXYWH, x2, y2, w2, h2);
} }
} }
......
...@@ -167,10 +167,12 @@ SDL_X11_LoadSymbols(void) ...@@ -167,10 +167,12 @@ SDL_X11_LoadSymbols(void)
X11_GetSym("XCreateIC", &SDL_X11_HAVE_UTF8, (void **) &pXCreateIC); X11_GetSym("XCreateIC", &SDL_X11_HAVE_UTF8, (void **) &pXCreateIC);
#endif #endif
if (SDL_X11_HAVE_BASEXLIB) { /* all required symbols loaded. */ if (SDL_X11_HAVE_BASEXLIB) {
/* all required symbols loaded. */
SDL_ClearError(); SDL_ClearError();
} else { } else {
SDL_X11_UnloadSymbols(); /* in case something got loaded... */ /* in case something got loaded... */
SDL_X11_UnloadSymbols();
rc = 0; rc = 0;
} }
} }
......
...@@ -97,10 +97,10 @@ XBIOS_Available(void) ...@@ -97,10 +97,10 @@ XBIOS_Available(void)
if (VgetMonitor() == MONITOR_MONO) if (VgetMonitor() == MONITOR_MONO)
return 0; return 0;
/*if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) { /*if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) {
if (!SDL_XBIOS_SB3Usable((scpn_cookie_t *) cookie_scpn)) { if (!SDL_XBIOS_SB3Usable((scpn_cookie_t *) cookie_scpn)) {
return 0; return 0;
} }
}*/ } */
break; break;
default: default:
return 0; return 0;
......
...@@ -29,12 +29,12 @@ ...@@ -29,12 +29,12 @@
typedef struct SDL_VideoData typedef struct SDL_VideoData
{ {
long cookie_vdo; /* _VDO cookie */ long cookie_vdo; /* _VDO cookie */
Uint16 old_modecode; /* Current video mode */ Uint16 old_modecode; /* Current video mode */
void *old_vbase; /* Current pointer to video RAM */ void *old_vbase; /* Current pointer to video RAM */
int old_numcol; /* Number of colors in saved palette */ int old_numcol; /* Number of colors in saved palette */
Uint32 old_palette[256]; /* Buffer to save current palette */ Uint32 old_palette[256]; /* Buffer to save current palette */
#if 0 #if 0
int old_video_mode; /* Old video mode before entering SDL */ int old_video_mode; /* Old video mode before entering SDL */
......
...@@ -28,13 +28,14 @@ ...@@ -28,13 +28,14 @@
#include "SDL_xbiosmodes.h" #include "SDL_xbiosmodes.h"
typedef struct { typedef struct
int width,height,bpp; {
int width, height, bpp;
int modecode; int modecode;
int doubleline; int doubleline;
} xbios_mode_t; } xbios_mode_t;
static xbios_mode_t falcon_rgb_modes[]={ static xbios_mode_t falcon_rgb_modes[] = {
{768, 480, 16, BPS16 | COL80 | OVERSCAN | VERTFLAG}, {768, 480, 16, BPS16 | COL80 | OVERSCAN | VERTFLAG},
{768, 240, 16, BPS16 | COL80 | OVERSCAN}, {768, 240, 16, BPS16 | COL80 | OVERSCAN},
{640, 400, 16, BPS16 | COL80 | VERTFLAG}, {640, 400, 16, BPS16 | COL80 | VERTFLAG},
...@@ -52,19 +53,19 @@ static xbios_mode_t falcon_rgb_modes[]={ ...@@ -52,19 +53,19 @@ static xbios_mode_t falcon_rgb_modes[]={
{320, 400, 8, BPS8 | VERTFLAG}, {320, 400, 8, BPS8 | VERTFLAG},
{320, 200, 8, BPS8} {320, 200, 8, BPS8}
}; };
static xbios_mode_t falcon_vga_modes[]={ static xbios_mode_t falcon_vga_modes[] = {
{320, 480, 16, BPS16 }, {320, 480, 16, BPS16},
{320, 240, 16, BPS16 | VERTFLAG}, {320, 240, 16, BPS16 | VERTFLAG},
{640, 480, 8, BPS8 | COL80}, {640, 480, 8, BPS8 | COL80},
{640, 240, 8, BPS8 | COL80 | VERTFLAG}, {640, 240, 8, BPS8 | COL80 | VERTFLAG},
{320, 480, 8, BPS8 }, {320, 480, 8, BPS8},
{320, 240, 8, BPS8 | VERTFLAG} {320, 240, 8, BPS8 | VERTFLAG}
}; };
static void static void
SDL_XBIOS_AddMode(_THIS, int width, int height, int bpp, Uint16 modecode, SDL_XBIOS_AddMode(_THIS, int width, int height, int bpp, Uint16 modecode,
SDL_bool doubleline) SDL_bool doubleline)
{ {
SDL_VideoDisplay display; SDL_VideoDisplay display;
SDL_DisplayData *displaydata; SDL_DisplayData *displaydata;
...@@ -74,9 +75,9 @@ SDL_XBIOS_AddMode(_THIS, int width, int height, int bpp, Uint16 modecode, ...@@ -74,9 +75,9 @@ SDL_XBIOS_AddMode(_THIS, int width, int height, int bpp, Uint16 modecode,
Rmask = Gmask = Bmask = Amask = 0; Rmask = Gmask = Bmask = Amask = 0;
if (bpp == 16) { if (bpp == 16) {
Rmask = 31<<11; Rmask = 31 << 11;
Gmask = 63<<5; Gmask = 63 << 5;
Bmask = 31; Bmask = 31;
} }
/* Memorize for c2p4 operation */ /* Memorize for c2p4 operation */
orig_bpp = bpp; orig_bpp = bpp;
...@@ -92,7 +93,7 @@ SDL_XBIOS_AddMode(_THIS, int width, int height, int bpp, Uint16 modecode, ...@@ -92,7 +93,7 @@ SDL_XBIOS_AddMode(_THIS, int width, int height, int bpp, Uint16 modecode,
displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata)); displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata));
if (!displaydata) { if (!displaydata) {
return; return;
} }
displaydata->modecode = modecode; displaydata->modecode = modecode;
displaydata->doubleline = doubleline; displaydata->doubleline = doubleline;
...@@ -140,7 +141,7 @@ SDL_XBIOS_ModeRestore(_THIS) ...@@ -140,7 +141,7 @@ SDL_XBIOS_ModeRestore(_THIS)
break; break;
case VDO_TT: case VDO_TT:
Setscreen(-1, data->old_vbase, -1); Setscreen(-1, data->old_vbase, -1);
EsetShift(data->old_modecode); EsetShift(data->old_modecode);
break; break;
case VDO_F30: case VDO_F30:
Setscreen(-1, data->old_vbase, -1); Setscreen(-1, data->old_vbase, -1);
...@@ -204,8 +205,8 @@ SDL_XBIOS_PaletteSave(_THIS) ...@@ -204,8 +205,8 @@ SDL_XBIOS_PaletteSave(_THIS)
case VDO_F30: case VDO_F30:
data->old_numcol = 1 << (1 << (data->old_modecode & NUMCOLS)); data->old_numcol = 1 << (1 << (data->old_modecode & NUMCOLS));
if (data->old_numcol > 256) { if (data->old_numcol > 256) {
data->old_numcol = 0; data->old_numcol = 0;
} else { } else {
VgetRGB(0, data->old_numcol, data->old_palette); VgetRGB(0, data->old_numcol, data->old_palette);
} }
break; break;
...@@ -261,7 +262,7 @@ SDL_XBIOS_InitModes(_THIS) ...@@ -261,7 +262,7 @@ SDL_XBIOS_InitModes(_THIS)
break; break;
case VDO_F30: case VDO_F30:
{ {
Uint16 modecodemask = data->old_modecode & (VGA | PAL); Uint16 modecodemask = data->old_modecode & (VGA | PAL);
int i; int i;
switch (VgetMonitor()) { switch (VgetMonitor()) {
...@@ -270,19 +271,27 @@ SDL_XBIOS_InitModes(_THIS) ...@@ -270,19 +271,27 @@ SDL_XBIOS_InitModes(_THIS)
break; break;
case MONITOR_RGB: case MONITOR_RGB:
case MONITOR_TV: case MONITOR_TV:
for (i=0; i<sizeof(falcon_rgb_modes)/sizeof(xbios_mode_t); i++) { for (i = 0;
SDL_XBIOS_AddMode(_this, falcon_rgb_modes[i].width, i < sizeof(falcon_rgb_modes) / sizeof(xbios_mode_t);
falcon_rgb_modes[i].height, falcon_rgb_modes[i].bpp, i++) {
falcon_rgb_modes[i].modecode & modecodemask, SDL_FALSE); SDL_XBIOS_AddMode(_this, falcon_rgb_modes[i].width,
} falcon_rgb_modes[i].height,
break; falcon_rgb_modes[i].bpp,
falcon_rgb_modes[i].
modecode & modecodemask, SDL_FALSE);
}
break;
case MONITOR_VGA: case MONITOR_VGA:
for (i=0; i<sizeof(falcon_vga_modes)/sizeof(xbios_mode_t); i++) { for (i = 0;
SDL_XBIOS_AddMode(_this, falcon_vga_modes[i].width, i < sizeof(falcon_vga_modes) / sizeof(xbios_mode_t);
falcon_vga_modes[i].height, falcon_vga_modes[i].bpp, i++) {
falcon_vga_modes[i].modecode & modecodemask, SDL_FALSE); SDL_XBIOS_AddMode(_this, falcon_vga_modes[i].width,
} falcon_vga_modes[i].height,
break; falcon_vga_modes[i].bpp,
falcon_vga_modes[i].
modecode & modecodemask, SDL_FALSE);
}
break;
} }
} }
break; break;
......
...@@ -7,65 +7,64 @@ ...@@ -7,65 +7,64 @@
#include "SDL.h" #include "SDL.h"
typedef int (*fntype)(const char *); typedef int (*fntype) (const char *);
int main(int argc, char *argv[]) int
main(int argc, char *argv[])
{ {
int retval = 0; int retval = 0;
int hello = 0; int hello = 0;
const char *libname = NULL; const char *libname = NULL;
const char *symname = NULL; const char *symname = NULL;
void *lib = NULL; void *lib = NULL;
fntype fn = NULL; fntype fn = NULL;
if (argc != 3) { if (argc != 3) {
const char *app = argv[0]; const char *app = argv[0];
fprintf(stderr, "USAGE: %s <library> <functionname>\n", app); fprintf(stderr, "USAGE: %s <library> <functionname>\n", app);
fprintf(stderr, " %s --hello <lib with puts()>\n", app); fprintf(stderr, " %s --hello <lib with puts()>\n", app);
return 1; return 1;
} }
/* Initialize SDL */ /* Initialize SDL */
if ( SDL_Init(0) < 0 ) { if (SDL_Init(0) < 0) {
fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
return 2; return 2;
} }
if (strcmp(argv[1], "--hello") == 0) { if (strcmp(argv[1], "--hello") == 0) {
hello = 1; hello = 1;
libname = argv[2]; libname = argv[2];
symname = "puts"; symname = "puts";
} else { } else {
libname = argv[1]; libname = argv[1];
symname = argv[2]; symname = argv[2];
} }
lib = SDL_LoadObject(libname); lib = SDL_LoadObject(libname);
if (lib == NULL) { if (lib == NULL) {
fprintf(stderr, "SDL_LoadObject('%s') failed: %s\n", fprintf(stderr, "SDL_LoadObject('%s') failed: %s\n",
libname, SDL_GetError()); libname, SDL_GetError());
retval = 3; retval = 3;
} else { } else {
fn = (fntype) SDL_LoadFunction(lib, symname); fn = (fntype) SDL_LoadFunction(lib, symname);
if (fn == NULL) { if (fn == NULL) {
fprintf(stderr, "SDL_LoadFunction('%s') failed: %s\n", fprintf(stderr, "SDL_LoadFunction('%s') failed: %s\n",
symname, SDL_GetError()); symname, SDL_GetError());
retval = 4; retval = 4;
} else { } else {
printf("Found %s in %s at %p\n", symname, libname, fn); printf("Found %s in %s at %p\n", symname, libname, fn);
if (hello) { if (hello) {
printf("Calling function...\n"); printf("Calling function...\n");
fflush(stdout); fflush(stdout);
fn(" HELLO, WORLD!\n"); fn(" HELLO, WORLD!\n");
printf("...apparently, we survived. :)\n"); printf("...apparently, we survived. :)\n");
printf("Unloading library...\n"); printf("Unloading library...\n");
fflush(stdout); fflush(stdout);
} }
} }
SDL_UnloadObject(lib); SDL_UnloadObject(lib);
} }
SDL_Quit(); SDL_Quit();
return(0); return (0);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment