From 429fc0a381d621016ae88c290b12755d5250f063 Mon Sep 17 00:00:00 2001 From: dborth Date: Thu, 23 Apr 2009 17:32:29 +0000 Subject: [PATCH] Initial import. --- SDL/BUGS | 18 + SDL/Borland.html | 139 + SDL/COPYING | 458 + SDL/CREDITS | 92 + SDL/INSTALL | 23 + SDL/MPWmake.sea.bin | Bin 0 -> 22144 bytes SDL/Makefile | 111 + SDL/Makefile.dc | 111 + SDL/Makefile.ds | 63 + SDL/Makefile.in | 182 + SDL/Makefile.minimal | 42 + SDL/README | 49 + SDL/README-SDL.txt | 13 + SDL/README.AmigaOS | 12 + SDL/README.BeOS | 13 + SDL/README.DC | 32 + SDL/README.MacOS | 63 + SDL/README.MacOSX | 186 + SDL/README.MiNT | 248 + SDL/README.NDS | 22 + SDL/README.NanoX | 97 + SDL/README.OS2 | 281 + SDL/README.PicoGUI | 50 + SDL/README.Porting | 56 + SDL/README.QNX | 155 + SDL/README.Qtopia | 84 + SDL/README.RISCOS | 130 + SDL/README.Symbian | 23 + SDL/README.WII | 17 + SDL/README.Watcom | 133 + SDL/README.WinCE | 55 + SDL/README.wscons | 107 + SDL/SDL.qpg.in | 140 + SDL/SDL.spec | 113 + SDL/SDL.spec.in | 113 + SDL/TODO | 25 + SDL/VisualC.html | 171 + SDL/WhatsNew | 716 ++ SDL/acinclude.m4 | 6724 +++++++++++++ SDL/autogen.sh | 19 + SDL/build-scripts/config.guess | 1526 +++ SDL/build-scripts/config.sub | 1657 ++++ SDL/build-scripts/fatbuild.sh | 316 + SDL/build-scripts/install-sh | 323 + SDL/build-scripts/ltmain.sh | 6864 +++++++++++++ SDL/build-scripts/makedep.sh | 93 + SDL/build-scripts/mkinstalldirs | 99 + SDL/build-scripts/strip_fPIC.sh | 21 + SDL/configure.in | 2835 ++++++ SDL/docs.html | 497 + SDL/docs/html/audio.html | 242 + SDL/docs/html/cdrom.html | 260 + SDL/docs/html/event.html | 216 + SDL/docs/html/eventfunctions.html | 481 + SDL/docs/html/eventstructures.html | 233 + SDL/docs/html/general.html | 225 + SDL/docs/html/guide.html | 174 + SDL/docs/html/guideaboutsdldoc.html | 148 + SDL/docs/html/guideaudioexamples.html | 228 + SDL/docs/html/guidebasicsinit.html | 240 + SDL/docs/html/guidecdromexamples.html | 275 + SDL/docs/html/guidecredits.html | 195 + SDL/docs/html/guideeventexamples.html | 247 + SDL/docs/html/guideexamples.html | 188 + SDL/docs/html/guideinput.html | 739 ++ SDL/docs/html/guideinputkeyboard.html | 746 ++ SDL/docs/html/guidepreface.html | 178 + SDL/docs/html/guidethebasics.html | 173 + SDL/docs/html/guidetimeexamples.html | 183 + SDL/docs/html/guidevideo.html | 463 + SDL/docs/html/guidevideoopengl.html | 730 ++ SDL/docs/html/index.html | 1156 +++ SDL/docs/html/joystick.html | 296 + SDL/docs/html/reference.html | 194 + SDL/docs/html/sdlactiveevent.html | 335 + SDL/docs/html/sdladdtimer.html | 296 + SDL/docs/html/sdlaudiocvt.html | 556 ++ SDL/docs/html/sdlaudiospec.html | 589 ++ SDL/docs/html/sdlblitsurface.html | 339 + SDL/docs/html/sdlbuildaudiocvt.html | 291 + SDL/docs/html/sdlcd.html | 359 + SDL/docs/html/sdlcdclose.html | 217 + SDL/docs/html/sdlcdeject.html | 226 + SDL/docs/html/sdlcdname.html | 239 + SDL/docs/html/sdlcdnumdrives.html | 205 + SDL/docs/html/sdlcdopen.html | 275 + SDL/docs/html/sdlcdpause.html | 233 + SDL/docs/html/sdlcdplay.html | 243 + SDL/docs/html/sdlcdplaytracks.html | 325 + SDL/docs/html/sdlcdresume.html | 233 + SDL/docs/html/sdlcdstatus.html | 273 + SDL/docs/html/sdlcdstop.html | 226 + SDL/docs/html/sdlcdtrack.html | 313 + SDL/docs/html/sdlcloseaudio.html | 205 + SDL/docs/html/sdlcolor.html | 300 + SDL/docs/html/sdlcondbroadcast.html | 224 + SDL/docs/html/sdlcondsignal.html | 224 + SDL/docs/html/sdlcondwait.html | 231 + SDL/docs/html/sdlcondwaittimeout.html | 230 + SDL/docs/html/sdlconvertaudio.html | 407 + SDL/docs/html/sdlconvertsurface.html | 271 + SDL/docs/html/sdlcreatecond.html | 240 + SDL/docs/html/sdlcreatecursor.html | 398 + SDL/docs/html/sdlcreatemutex.html | 249 + SDL/docs/html/sdlcreatergbsurface.html | 458 + SDL/docs/html/sdlcreatergbsurfacefrom.html | 256 + SDL/docs/html/sdlcreatesemaphore.html | 303 + SDL/docs/html/sdlcreatethread.html | 223 + SDL/docs/html/sdlcreateyuvoverlay.html | 256 + SDL/docs/html/sdldelay.html | 231 + SDL/docs/html/sdldestroycond.html | 206 + SDL/docs/html/sdldestroymutex.html | 209 + SDL/docs/html/sdldestroysemaphore.html | 278 + SDL/docs/html/sdldisplayformat.html | 262 + SDL/docs/html/sdldisplayformatalpha.html | 250 + SDL/docs/html/sdldisplayyuvoverlay.html | 246 + SDL/docs/html/sdlenablekeyrepeat.html | 238 + SDL/docs/html/sdlenableunicode.html | 252 + SDL/docs/html/sdlenvvars.html | 1212 +++ SDL/docs/html/sdlevent.html | 994 ++ SDL/docs/html/sdleventstate.html | 276 + SDL/docs/html/sdlexposeevent.html | 252 + SDL/docs/html/sdlfillrect.html | 291 + SDL/docs/html/sdlflip.html | 259 + SDL/docs/html/sdlfreecursor.html | 209 + SDL/docs/html/sdlfreesurface.html | 219 + SDL/docs/html/sdlfreewav.html | 222 + SDL/docs/html/sdlfreeyuvoverlay.html | 233 + SDL/docs/html/sdlgetappstate.html | 263 + SDL/docs/html/sdlgetaudiostatus.html | 221 + SDL/docs/html/sdlgetcliprect.html | 229 + SDL/docs/html/sdlgetcursor.html | 219 + SDL/docs/html/sdlgeterror.html | 205 + SDL/docs/html/sdlgeteventfilter.html | 235 + SDL/docs/html/sdlgetgammaramp.html | 219 + SDL/docs/html/sdlgetkeyname.html | 216 + SDL/docs/html/sdlgetkeystate.html | 253 + SDL/docs/html/sdlgetmodstate.html | 257 + SDL/docs/html/sdlgetmousestate.html | 253 + SDL/docs/html/sdlgetrelativemousestate.html | 235 + SDL/docs/html/sdlgetrgb.html | 231 + SDL/docs/html/sdlgetrgba.html | 222 + SDL/docs/html/sdlgetthreadid.html | 209 + SDL/docs/html/sdlgetticks.html | 206 + SDL/docs/html/sdlgetvideoinfo.html | 226 + SDL/docs/html/sdlgetvideosurface.html | 208 + SDL/docs/html/sdlglattr.html | 379 + SDL/docs/html/sdlglgetattribute.html | 247 + SDL/docs/html/sdlglgetprocaddress.html | 262 + SDL/docs/html/sdlglloadlibrary.html | 231 + SDL/docs/html/sdlglsetattribute.html | 286 + SDL/docs/html/sdlglswapbuffers.html | 212 + SDL/docs/html/sdlinit.html | 368 + SDL/docs/html/sdlinitsubsystem.html | 283 + SDL/docs/html/sdljoyaxisevent.html | 330 + SDL/docs/html/sdljoyballevent.html | 340 + SDL/docs/html/sdljoybuttonevent.html | 351 + SDL/docs/html/sdljoyhatevent.html | 413 + SDL/docs/html/sdljoystickclose.html | 223 + SDL/docs/html/sdljoystickeventstate.html | 290 + SDL/docs/html/sdljoystickgetaxis.html | 271 + SDL/docs/html/sdljoystickgetball.html | 262 + SDL/docs/html/sdljoystickgetbutton.html | 231 + SDL/docs/html/sdljoystickgethat.html | 297 + SDL/docs/html/sdljoystickindex.html | 218 + SDL/docs/html/sdljoystickname.html | 238 + SDL/docs/html/sdljoysticknumaxes.html | 225 + SDL/docs/html/sdljoysticknumballs.html | 225 + SDL/docs/html/sdljoysticknumbuttons.html | 225 + SDL/docs/html/sdljoysticknumhats.html | 225 + SDL/docs/html/sdljoystickopen.html | 259 + SDL/docs/html/sdljoystickopened.html | 233 + SDL/docs/html/sdljoystickupdate.html | 211 + SDL/docs/html/sdlkey.html | 2630 +++++ SDL/docs/html/sdlkeyboardevent.html | 375 + SDL/docs/html/sdlkeysym.html | 355 + SDL/docs/html/sdlkillthread.html | 223 + SDL/docs/html/sdllistmodes.html | 310 + SDL/docs/html/sdlloadbmp.html | 219 + SDL/docs/html/sdlloadwav.html | 296 + SDL/docs/html/sdllockaudio.html | 208 + SDL/docs/html/sdllocksurface.html | 306 + SDL/docs/html/sdllockyuvoverlay.html | 252 + SDL/docs/html/sdlmaprgb.html | 254 + SDL/docs/html/sdlmaprgba.html | 242 + SDL/docs/html/sdlmixaudio.html | 237 + SDL/docs/html/sdlmousebuttonevent.html | 346 + SDL/docs/html/sdlmousemotionevent.html | 365 + SDL/docs/html/sdlmutexp.html | 241 + SDL/docs/html/sdlmutexv.html | 235 + SDL/docs/html/sdlnumjoysticks.html | 222 + SDL/docs/html/sdlopenaudio.html | 578 ++ SDL/docs/html/sdloverlay.html | 362 + SDL/docs/html/sdlpalette.html | 301 + SDL/docs/html/sdlpauseaudio.html | 221 + SDL/docs/html/sdlpeepevents.html | 321 + SDL/docs/html/sdlpixelformat.html | 528 + SDL/docs/html/sdlpollevent.html | 269 + SDL/docs/html/sdlpumpevents.html | 244 + SDL/docs/html/sdlpushevent.html | 266 + SDL/docs/html/sdlquit.html | 244 + SDL/docs/html/sdlquitevent.html | 263 + SDL/docs/html/sdlquitsubsystem.html | 248 + SDL/docs/html/sdlrect.html | 258 + SDL/docs/html/sdlremovetimer.html | 236 + SDL/docs/html/sdlresizeevent.html | 307 + SDL/docs/html/sdlsavebmp.html | 236 + SDL/docs/html/sdlsempost.html | 299 + SDL/docs/html/sdlsemtrywait.html | 319 + SDL/docs/html/sdlsemvalue.html | 273 + SDL/docs/html/sdlsemwait.html | 298 + SDL/docs/html/sdlsemwaittimeout.html | 322 + SDL/docs/html/sdlsetalpha.html | 500 + SDL/docs/html/sdlsetcliprect.html | 241 + SDL/docs/html/sdlsetcolorkey.html | 321 + SDL/docs/html/sdlsetcolors.html | 358 + SDL/docs/html/sdlsetcursor.html | 222 + SDL/docs/html/sdlseteventfilter.html | 284 + SDL/docs/html/sdlsetgamma.html | 231 + SDL/docs/html/sdlsetgammaramp.html | 230 + SDL/docs/html/sdlsetmodstate.html | 237 + SDL/docs/html/sdlsetpalette.html | 352 + SDL/docs/html/sdlsettimer.html | 267 + SDL/docs/html/sdlsetvideomode.html | 558 ++ SDL/docs/html/sdlshowcursor.html | 239 + SDL/docs/html/sdlsurface.html | 597 ++ SDL/docs/html/sdlsyswmevent.html | 233 + SDL/docs/html/sdlthreadid.html | 190 + SDL/docs/html/sdlunlockaudio.html | 211 + SDL/docs/html/sdlunlocksurface.html | 219 + SDL/docs/html/sdlunlockyuvoverlay.html | 225 + SDL/docs/html/sdlupdaterect.html | 266 + SDL/docs/html/sdlupdaterects.html | 255 + SDL/docs/html/sdluserevent.html | 337 + SDL/docs/html/sdlvideodrivername.html | 243 + SDL/docs/html/sdlvideoinfo.html | 408 + SDL/docs/html/sdlvideomodeok.html | 270 + SDL/docs/html/sdlwaitevent.html | 231 + SDL/docs/html/sdlwaitthread.html | 231 + SDL/docs/html/sdlwarpmouse.html | 205 + SDL/docs/html/sdlwasinit.html | 284 + SDL/docs/html/sdlwmgetcaption.html | 222 + SDL/docs/html/sdlwmgrabinput.html | 224 + SDL/docs/html/sdlwmiconifywindow.html | 211 + SDL/docs/html/sdlwmsetcaption.html | 212 + SDL/docs/html/sdlwmseticon.html | 260 + SDL/docs/html/sdlwmtogglefullscreen.html | 205 + SDL/docs/html/thread.html | 313 + SDL/docs/html/time.html | 206 + SDL/docs/html/video.html | 507 + SDL/docs/html/wm.html | 188 + SDL/docs/images/rainbow.gif | Bin 0 -> 1715 bytes SDL/docs/index.html | 55 + SDL/docs/man3/SDLKey.3 | 161 + SDL/docs/man3/SDL_ActiveEvent.3 | 38 + SDL/docs/man3/SDL_AddTimer.3 | 38 + SDL/docs/man3/SDL_AudioCVT.3 | 68 + SDL/docs/man3/SDL_AudioSpec.3 | 70 + SDL/docs/man3/SDL_BlitSurface.3 | 60 + SDL/docs/man3/SDL_BuildAudioCVT.3 | 23 + SDL/docs/man3/SDL_CD.3 | 57 + SDL/docs/man3/SDL_CDClose.3 | 15 + SDL/docs/man3/SDL_CDEject.3 | 18 + SDL/docs/man3/SDL_CDName.3 | 23 + SDL/docs/man3/SDL_CDNumDrives.3 | 15 + SDL/docs/man3/SDL_CDOpen.3 | 58 + SDL/docs/man3/SDL_CDPause.3 | 18 + SDL/docs/man3/SDL_CDPlay.3 | 18 + SDL/docs/man3/SDL_CDPlayTracks.3 | 47 + SDL/docs/man3/SDL_CDResume.3 | 18 + SDL/docs/man3/SDL_CDStatus.3 | 59 + SDL/docs/man3/SDL_CDStop.3 | 18 + SDL/docs/man3/SDL_CDtrack.3 | 40 + SDL/docs/man3/SDL_CloseAudio.3 | 15 + SDL/docs/man3/SDL_Color.3 | 34 + SDL/docs/man3/SDL_CondBroadcast.3 | 16 + SDL/docs/man3/SDL_CondSignal.3 | 16 + SDL/docs/man3/SDL_CondWait.3 | 16 + SDL/docs/man3/SDL_CondWaitTimeout.3 | 16 + SDL/docs/man3/SDL_ConvertAudio.3 | 95 + SDL/docs/man3/SDL_ConvertSurface.3 | 24 + SDL/docs/man3/SDL_CreateCond.3 | 31 + SDL/docs/man3/SDL_CreateCursor.3 | 120 + SDL/docs/man3/SDL_CreateMutex.3 | 43 + SDL/docs/man3/SDL_CreateRGBSurface.3 | 69 + SDL/docs/man3/SDL_CreateRGBSurfaceFrom.3 | 22 + SDL/docs/man3/SDL_CreateSemaphore.3 | 32 + SDL/docs/man3/SDL_CreateThread.3 | 16 + SDL/docs/man3/SDL_CreateYUVOverlay.3 | 17 + SDL/docs/man3/SDL_Delay.3 | 21 + SDL/docs/man3/SDL_DestroyCond.3 | 16 + SDL/docs/man3/SDL_DestroyMutex.3 | 16 + SDL/docs/man3/SDL_DestroySemaphore.3 | 26 + SDL/docs/man3/SDL_DisplayFormat.3 | 22 + SDL/docs/man3/SDL_DisplayFormatAlpha.3 | 22 + SDL/docs/man3/SDL_DisplayYUVOverlay.3 | 18 + SDL/docs/man3/SDL_EnableKeyRepeat.3 | 17 + SDL/docs/man3/SDL_EnableUNICODE.3 | 24 + SDL/docs/man3/SDL_Event.3 | 182 + SDL/docs/man3/SDL_EventState.3 | 23 + SDL/docs/man3/SDL_ExposeEvent.3 | 24 + SDL/docs/man3/SDL_FillRect.3 | 22 + SDL/docs/man3/SDL_Flip.3 | 20 + SDL/docs/man3/SDL_FreeCursor.3 | 15 + SDL/docs/man3/SDL_FreeSurface.3 | 15 + SDL/docs/man3/SDL_FreeWAV.3 | 15 + SDL/docs/man3/SDL_FreeYUVOverlay.3 | 15 + SDL/docs/man3/SDL_GL_GetAttribute.3 | 18 + SDL/docs/man3/SDL_GL_GetProcAddress.3 | 48 + SDL/docs/man3/SDL_GL_LoadLibrary.3 | 15 + SDL/docs/man3/SDL_GL_SetAttribute.3 | 40 + SDL/docs/man3/SDL_GL_SwapBuffers.3 | 15 + SDL/docs/man3/SDL_GLattr.3 | 47 + SDL/docs/man3/SDL_GetAppState.3 | 24 + SDL/docs/man3/SDL_GetAudioStatus.3 | 24 + SDL/docs/man3/SDL_GetClipRect.3 | 17 + SDL/docs/man3/SDL_GetCursor.3 | 15 + SDL/docs/man3/SDL_GetError.3 | 15 + SDL/docs/man3/SDL_GetEventFilter.3 | 23 + SDL/docs/man3/SDL_GetGamma.3 | 21 + SDL/docs/man3/SDL_GetGammaRamp.3 | 20 + SDL/docs/man3/SDL_GetKeyName.3 | 15 + SDL/docs/man3/SDL_GetKeyState.3 | 30 + SDL/docs/man3/SDL_GetModState.3 | 54 + SDL/docs/man3/SDL_GetMouseState.3 | 24 + SDL/docs/man3/SDL_GetRGB.3 | 17 + SDL/docs/man3/SDL_GetRGBA.3 | 19 + SDL/docs/man3/SDL_GetRelativeMouseState.3 | 15 + SDL/docs/man3/SDL_GetThreadID.3 | 16 + SDL/docs/man3/SDL_GetTicks.3 | 15 + SDL/docs/man3/SDL_GetVideoInfo.3 | 15 + SDL/docs/man3/SDL_GetVideoSurface.3 | 15 + SDL/docs/man3/SDL_Init.3 | 41 + SDL/docs/man3/SDL_InitSubSystem.3 | 41 + SDL/docs/man3/SDL_JoyAxisEvent.3 | 36 + SDL/docs/man3/SDL_JoyBallEvent.3 | 36 + SDL/docs/man3/SDL_JoyButtonEvent.3 | 36 + SDL/docs/man3/SDL_JoyHatEvent.3 | 56 + SDL/docs/man3/SDL_JoystickClose.3 | 15 + SDL/docs/man3/SDL_JoystickEventState.3 | 24 + SDL/docs/man3/SDL_JoystickGetAxis.3 | 32 + SDL/docs/man3/SDL_JoystickGetBall.3 | 37 + SDL/docs/man3/SDL_JoystickGetButton.3 | 18 + SDL/docs/man3/SDL_JoystickGetHat.3 | 36 + SDL/docs/man3/SDL_JoystickIndex.3 | 18 + SDL/docs/man3/SDL_JoystickName.3 | 32 + SDL/docs/man3/SDL_JoystickNumAxes.3 | 18 + SDL/docs/man3/SDL_JoystickNumBalls.3 | 18 + SDL/docs/man3/SDL_JoystickNumButtons.3 | 18 + SDL/docs/man3/SDL_JoystickNumHats.3 | 18 + SDL/docs/man3/SDL_JoystickOpen.3 | 51 + SDL/docs/man3/SDL_JoystickOpened.3 | 18 + SDL/docs/man3/SDL_JoystickUpdate.3 | 15 + SDL/docs/man3/SDL_KeyboardEvent.3 | 38 + SDL/docs/man3/SDL_KillThread.3 | 16 + SDL/docs/man3/SDL_ListModes.3 | 53 + SDL/docs/man3/SDL_LoadBMP.3 | 18 + SDL/docs/man3/SDL_LoadWAV.3 | 42 + SDL/docs/man3/SDL_LockAudio.3 | 15 + SDL/docs/man3/SDL_LockSurface.3 | 48 + SDL/docs/man3/SDL_LockYUVOverlay.3 | 18 + SDL/docs/man3/SDL_MapRGB.3 | 22 + SDL/docs/man3/SDL_MapRGBA.3 | 22 + SDL/docs/man3/SDL_MixAudio.3 | 21 + SDL/docs/man3/SDL_MouseButtonEvent.3 | 36 + SDL/docs/man3/SDL_MouseMotionEvent.3 | 38 + SDL/docs/man3/SDL_NumJoysticks.3 | 18 + SDL/docs/man3/SDL_OpenAudio.3 | 97 + SDL/docs/man3/SDL_Overlay.3 | 52 + SDL/docs/man3/SDL_Palette.3 | 26 + SDL/docs/man3/SDL_PauseAudio.3 | 15 + SDL/docs/man3/SDL_PeepEvents.3 | 26 + SDL/docs/man3/SDL_PixelFormat.3 | 140 + SDL/docs/man3/SDL_PollEvent.3 | 44 + SDL/docs/man3/SDL_PumpEvents.3 | 23 + SDL/docs/man3/SDL_PushEvent.3 | 27 + SDL/docs/man3/SDL_Quit.3 | 29 + SDL/docs/man3/SDL_QuitEvent.3 | 30 + SDL/docs/man3/SDL_QuitSubSystem.3 | 15 + SDL/docs/man3/SDL_RWFromFile.3 | 18 + SDL/docs/man3/SDL_Rect.3 | 26 + SDL/docs/man3/SDL_RemoveTimer.3 | 25 + SDL/docs/man3/SDL_ResizeEvent.3 | 28 + SDL/docs/man3/SDL_SaveBMP.3 | 18 + SDL/docs/man3/SDL_SemPost.3 | 28 + SDL/docs/man3/SDL_SemTryWait.3 | 41 + SDL/docs/man3/SDL_SemValue.3 | 26 + SDL/docs/man3/SDL_SemWait.3 | 34 + SDL/docs/man3/SDL_SemWaitTimeout.3 | 41 + SDL/docs/man3/SDL_SetAlpha.3 | 66 + SDL/docs/man3/SDL_SetClipRect.3 | 19 + SDL/docs/man3/SDL_SetColorKey.3 | 26 + SDL/docs/man3/SDL_SetColors.3 | 57 + SDL/docs/man3/SDL_SetCursor.3 | 15 + SDL/docs/man3/SDL_SetEventFilter.3 | 35 + SDL/docs/man3/SDL_SetGamma.3 | 22 + SDL/docs/man3/SDL_SetGammaRamp.3 | 22 + SDL/docs/man3/SDL_SetModState.3 | 35 + SDL/docs/man3/SDL_SetPalette.3 | 59 + SDL/docs/man3/SDL_SetTimer.3 | 39 + SDL/docs/man3/SDL_SetVideoMode.3 | 67 + SDL/docs/man3/SDL_ShowCursor.3 | 20 + SDL/docs/man3/SDL_Surface.3 | 96 + SDL/docs/man3/SDL_SysWMEvent.3 | 21 + SDL/docs/man3/SDL_ThreadID.3 | 13 + SDL/docs/man3/SDL_UnlockAudio.3 | 15 + SDL/docs/man3/SDL_UnlockSurface.3 | 17 + SDL/docs/man3/SDL_UnlockYUVOverlay.3 | 15 + SDL/docs/man3/SDL_UpdateRect.3 | 19 + SDL/docs/man3/SDL_UpdateRects.3 | 25 + SDL/docs/man3/SDL_UserEvent.3 | 47 + SDL/docs/man3/SDL_VideoDriverName.3 | 18 + SDL/docs/man3/SDL_VideoInfo.3 | 62 + SDL/docs/man3/SDL_VideoModeOK.3 | 44 + SDL/docs/man3/SDL_WM_GetCaption.3 | 15 + SDL/docs/man3/SDL_WM_GrabInput.3 | 28 + SDL/docs/man3/SDL_WM_IconifyWindow.3 | 15 + SDL/docs/man3/SDL_WM_SetCaption.3 | 15 + SDL/docs/man3/SDL_WM_SetIcon.3 | 27 + SDL/docs/man3/SDL_WM_ToggleFullScreen.3 | 15 + SDL/docs/man3/SDL_WaitEvent.3 | 17 + SDL/docs/man3/SDL_WaitThread.3 | 19 + SDL/docs/man3/SDL_WarpMouse.3 | 15 + SDL/docs/man3/SDL_WasInit.3 | 63 + SDL/docs/man3/SDL_keysym.3 | 69 + SDL/docs/man3/SDL_mutexP.3 | 18 + SDL/docs/man3/SDL_mutexV.3 | 18 + SDL/sdl-config.in | 60 + SDL/sdl.m4 | 183 + SDL/sdl.pc.in | 15 + SDL/src/SDL.c | 350 + SDL/src/SDL_error.c | 238 + SDL/src/SDL_error_c.h | 58 + SDL/src/SDL_fatal.c | 134 + SDL/src/SDL_fatal.h | 28 + SDL/src/audio/SDL_audio.c | 698 ++ SDL/src/audio/SDL_audio_c.h | 34 + SDL/src/audio/SDL_audiocvt.c | 1510 +++ SDL/src/audio/SDL_audiodev.c | 179 + SDL/src/audio/SDL_audiodev_c.h | 26 + SDL/src/audio/SDL_audiomem.h | 25 + SDL/src/audio/SDL_mixer.c | 258 + SDL/src/audio/SDL_mixer_MMX.c | 206 + SDL/src/audio/SDL_mixer_MMX.h | 15 + SDL/src/audio/SDL_mixer_MMX_VC.c | 181 + SDL/src/audio/SDL_mixer_MMX_VC.h | 36 + SDL/src/audio/SDL_mixer_m68k.c | 211 + SDL/src/audio/SDL_mixer_m68k.h | 36 + SDL/src/audio/SDL_sysaudio.h | 187 + SDL/src/audio/SDL_wave.c | 600 ++ SDL/src/audio/SDL_wave.h | 62 + SDL/src/audio/alsa/SDL_alsa_audio.c | 538 + SDL/src/audio/alsa/SDL_alsa_audio.h | 54 + SDL/src/audio/arts/SDL_artsaudio.c | 348 + SDL/src/audio/arts/SDL_artsaudio.h | 60 + SDL/src/audio/baudio/SDL_beaudio.cc | 225 + SDL/src/audio/baudio/SDL_beaudio.h | 39 + SDL/src/audio/bsd/SDL_bsdaudio.c | 404 + SDL/src/audio/bsd/SDL_bsdaudio.h | 58 + SDL/src/audio/dart/SDL_dart.c | 441 + SDL/src/audio/dart/SDL_dart.h | 63 + SDL/src/audio/dc/SDL_dcaudio.c | 246 + SDL/src/audio/dc/SDL_dcaudio.h | 41 + SDL/src/audio/dc/aica.c | 271 + SDL/src/audio/dc/aica.h | 40 + SDL/src/audio/disk/SDL_diskaudio.c | 186 + SDL/src/audio/disk/SDL_diskaudio.h | 41 + SDL/src/audio/dma/SDL_dmaaudio.c | 455 + SDL/src/audio/dma/SDL_dmaaudio.h | 59 + SDL/src/audio/dmedia/SDL_irixaudio.c | 242 + SDL/src/audio/dmedia/SDL_irixaudio.h | 45 + SDL/src/audio/dsp/SDL_dspaudio.c | 340 + SDL/src/audio/dsp/SDL_dspaudio.h | 53 + SDL/src/audio/dummy/SDL_dummyaudio.c | 156 + SDL/src/audio/dummy/SDL_dummyaudio.h | 40 + SDL/src/audio/esd/SDL_esdaudio.c | 323 + SDL/src/audio/esd/SDL_esdaudio.h | 57 + SDL/src/audio/macosx/SDL_coreaudio.c | 280 + SDL/src/audio/macosx/SDL_coreaudio.h | 45 + SDL/src/audio/macrom/SDL_romaudio.c | 496 + SDL/src/audio/macrom/SDL_romaudio.h | 50 + SDL/src/audio/mint/SDL_mintaudio.c | 215 + SDL/src/audio/mint/SDL_mintaudio.h | 153 + SDL/src/audio/mint/SDL_mintaudio_dma8.c | 361 + SDL/src/audio/mint/SDL_mintaudio_dma8.h | 85 + SDL/src/audio/mint/SDL_mintaudio_gsxb.c | 436 + SDL/src/audio/mint/SDL_mintaudio_gsxb.h | 108 + SDL/src/audio/mint/SDL_mintaudio_it.S | 281 + SDL/src/audio/mint/SDL_mintaudio_mcsn.c | 404 + SDL/src/audio/mint/SDL_mintaudio_mcsn.h | 59 + SDL/src/audio/mint/SDL_mintaudio_stfa.c | 323 + SDL/src/audio/mint/SDL_mintaudio_stfa.h | 100 + SDL/src/audio/mint/SDL_mintaudio_xbios.c | 495 + SDL/src/audio/mme/SDL_mmeaudio.c | 264 + SDL/src/audio/mme/SDL_mmeaudio.h | 51 + SDL/src/audio/nas/SDL_nasaudio.c | 299 + SDL/src/audio/nas/SDL_nasaudio.h | 62 + SDL/src/audio/nds/SDL_ndsaudio.c | 335 + SDL/src/audio/nds/SDL_ndsaudio.h | 40 + SDL/src/audio/nds/sound9.c | 61 + SDL/src/audio/nds/soundcommon.h | 80 + SDL/src/audio/nto/SDL_nto_audio.c | 507 + SDL/src/audio/nto/SDL_nto_audio.h | 68 + SDL/src/audio/paudio/SDL_paudio.c | 511 + SDL/src/audio/paudio/SDL_paudio.h | 57 + SDL/src/audio/pulse/SDL_pulseaudio.c | 377 + SDL/src/audio/pulse/SDL_pulseaudio.h | 53 + SDL/src/audio/sun/SDL_sunaudio.c | 432 + SDL/src/audio/sun/SDL_sunaudio.h | 55 + SDL/src/audio/symbian/SDL_epocaudio.cpp | 614 ++ SDL/src/audio/symbian/SDL_epocaudio.h | 37 + SDL/src/audio/symbian/streamplayer.cpp | 279 + SDL/src/audio/symbian/streamplayer.h | 89 + SDL/src/audio/ums/SDL_umsaudio.c | 547 ++ SDL/src/audio/ums/SDL_umsaudio.h | 50 + SDL/src/audio/wii/SDL_wiiaudio.c | 207 + SDL/src/audio/wii/SDL_wiiaudio.h | 40 + SDL/src/audio/windib/SDL_dibaudio.c | 322 + SDL/src/audio/windib/SDL_dibaudio.h | 49 + SDL/src/audio/windx5/SDL_dx5audio.c | 705 ++ SDL/src/audio/windx5/SDL_dx5audio.h | 55 + SDL/src/audio/windx5/directx.h | 84 + SDL/src/cdrom/SDL_cdrom.c | 341 + SDL/src/cdrom/SDL_syscdrom.h | 76 + SDL/src/cdrom/aix/SDL_syscdrom.c | 660 ++ SDL/src/cdrom/beos/SDL_syscdrom.cc | 412 + SDL/src/cdrom/bsdi/SDL_syscdrom.c | 542 + SDL/src/cdrom/dc/SDL_syscdrom.c | 167 + SDL/src/cdrom/dummy/SDL_syscdrom.c | 41 + SDL/src/cdrom/freebsd/SDL_syscdrom.c | 406 + SDL/src/cdrom/linux/SDL_syscdrom.c | 564 ++ SDL/src/cdrom/macos/SDL_syscdrom.c | 525 + SDL/src/cdrom/macos/SDL_syscdrom_c.h | 140 + SDL/src/cdrom/macosx/AudioFilePlayer.c | 354 + SDL/src/cdrom/macosx/AudioFilePlayer.h | 173 + SDL/src/cdrom/macosx/AudioFileReaderThread.c | 605 ++ SDL/src/cdrom/macosx/CDPlayer.c | 628 ++ SDL/src/cdrom/macosx/CDPlayer.h | 69 + SDL/src/cdrom/macosx/SDLOSXCAGuard.c | 199 + SDL/src/cdrom/macosx/SDLOSXCAGuard.h | 116 + SDL/src/cdrom/macosx/SDL_syscdrom.c | 505 + SDL/src/cdrom/macosx/SDL_syscdrom_c.h | 136 + SDL/src/cdrom/mint/SDL_syscdrom.c | 317 + SDL/src/cdrom/openbsd/SDL_syscdrom.c | 415 + SDL/src/cdrom/os2/SDL_syscdrom.c | 393 + SDL/src/cdrom/osf/SDL_syscdrom.c | 444 + SDL/src/cdrom/qnx/SDL_syscdrom.c | 551 ++ SDL/src/cdrom/win32/SDL_syscdrom.c | 385 + SDL/src/cpuinfo/SDL_cpuinfo.c | 446 + SDL/src/events/SDL_active.c | 91 + SDL/src/events/SDL_events.c | 502 + SDL/src/events/SDL_events_c.h | 80 + SDL/src/events/SDL_expose.c | 51 + SDL/src/events/SDL_keyboard.c | 614 ++ SDL/src/events/SDL_mouse.c | 263 + SDL/src/events/SDL_quit.c | 92 + SDL/src/events/SDL_resize.c | 75 + SDL/src/events/SDL_sysevents.h | 46 + SDL/src/file/SDL_rwops.c | 616 ++ SDL/src/file/wii/SDL_wiirwops.c | 157 + SDL/src/file/wii/diskio.c | 0 SDL/src/file/wii/diskio.h | 65 + SDL/src/file/wii/integer.h | 25 + SDL/src/hermes/COPYING.LIB | 438 + SDL/src/hermes/HeadMMX.h | 100 + SDL/src/hermes/HeadX86.h | 186 + SDL/src/hermes/README | 13 + SDL/src/hermes/common.inc | 9 + SDL/src/hermes/mmx_main.asm | 74 + SDL/src/hermes/mmxp2_32.asm | 405 + SDL/src/hermes/x86_main.asm | 75 + SDL/src/hermes/x86p_16.asm | 490 + SDL/src/hermes/x86p_32.asm | 1045 ++ SDL/src/joystick/SDL_joystick.c | 582 ++ SDL/src/joystick/SDL_joystick_c.h | 38 + SDL/src/joystick/SDL_sysjoystick.h | 82 + SDL/src/joystick/beos/SDL_bejoystick.cc | 237 + SDL/src/joystick/bsd/SDL_sysjoystick.c | 591 ++ SDL/src/joystick/darwin/10.3.9-FIX/IOHIDLib.h | 874 ++ SDL/src/joystick/darwin/SDL_sysjoystick.c | 846 ++ SDL/src/joystick/dc/SDL_sysjoystick.c | 193 + SDL/src/joystick/dummy/SDL_sysjoystick.c | 83 + SDL/src/joystick/linux/SDL_sysjoystick.c | 1198 +++ SDL/src/joystick/macos/SDL_sysjoystick.c | 320 + SDL/src/joystick/mint/SDL_sysjoystick.c | 683 ++ SDL/src/joystick/nds/SDL_sysjoystick.c | 150 + SDL/src/joystick/os2/SDL_sysjoystick.c | 668 ++ SDL/src/joystick/os2/joyos2.h | 177 + SDL/src/joystick/riscos/SDL_sysjoystick.c | 176 + SDL/src/joystick/wii/SDL_sysjoystick.c | 206 + SDL/src/joystick/win32/SDL_mmjoystick.c | 405 + SDL/src/loadso/beos/SDL_sysloadso.c | 72 + SDL/src/loadso/dlopen/SDL_sysloadso.c | 69 + SDL/src/loadso/dummy/SDL_sysloadso.c | 50 + SDL/src/loadso/macos/SDL_sysloadso.c | 106 + SDL/src/loadso/macosx/SDL_dlcompat.c | 1407 +++ SDL/src/loadso/mint/SDL_sysloadso.c | 62 + SDL/src/loadso/os2/SDL_sysloadso.c | 71 + SDL/src/loadso/win32/SDL_sysloadso.c | 139 + SDL/src/main/beos/SDL_BeApp.cc | 109 + SDL/src/main/beos/SDL_BeApp.h | 33 + SDL/src/main/dummy/SDL_dummy_main.c | 13 + SDL/src/main/macos/SDL.r | 58 + SDL/src/main/macos/SDL.shlib.r | 66 + SDL/src/main/macos/SDL_main.c | 610 ++ SDL/src/main/macos/SIZE.r | 24 + SDL/src/main/macos/exports/Makefile | 34 + SDL/src/main/macos/exports/SDL.x | 209 + SDL/src/main/macos/exports/gendef.pl | 43 + SDL/src/main/macosx/Info.plist.in | 24 + SDL/src/main/macosx/SDLMain.h | 11 + SDL/src/main/macosx/SDLMain.m | 384 + SDL/src/main/macosx/SDLMain.nib/classes.nib | 12 + SDL/src/main/macosx/SDLMain.nib/info.nib | 12 + SDL/src/main/macosx/SDLMain.nib/objects.nib | Bin 0 -> 1701 bytes SDL/src/main/macosx/info.nib | 1 + SDL/src/main/qtopia/SDL_qtopia_main.cc | 47 + SDL/src/main/symbian/EKA1/SDL_main.cpp | 152 + SDL/src/main/symbian/EKA2/SDL_main.cpp | 1035 ++ SDL/src/main/symbian/EKA2/sdlexe.cpp | 809 ++ SDL/src/main/symbian/EKA2/sdllib.cpp | 12 + SDL/src/main/symbian/EKA2/vectorbuffer.cpp | 62 + SDL/src/main/symbian/EKA2/vectorbuffer.h | 240 + SDL/src/main/wii/SDL_wii_main.c | 91 + SDL/src/main/win32/SDL_win32_main.c | 386 + SDL/src/main/win32/version.rc | 38 + SDL/src/stdlib/SDL_getenv.c | 247 + SDL/src/stdlib/SDL_iconv.c | 881 ++ SDL/src/stdlib/SDL_malloc.c | 5111 ++++++++++ SDL/src/stdlib/SDL_qsort.c | 425 + SDL/src/stdlib/SDL_stdlib.c | 620 ++ SDL/src/stdlib/SDL_string.c | 1248 +++ SDL/src/thread/SDL_systhread.h | 52 + SDL/src/thread/SDL_thread.c | 298 + SDL/src/thread/SDL_thread_c.h | 66 + SDL/src/thread/beos/SDL_syssem.c | 142 + SDL/src/thread/beos/SDL_systhread.c | 96 + SDL/src/thread/beos/SDL_systhread_c.h | 31 + SDL/src/thread/dc/SDL_syscond.c | 215 + SDL/src/thread/dc/SDL_syscond_c.h | 23 + SDL/src/thread/dc/SDL_sysmutex.c | 122 + SDL/src/thread/dc/SDL_sysmutex_c.h | 23 + SDL/src/thread/dc/SDL_syssem.c | 173 + SDL/src/thread/dc/SDL_syssem_c.h | 23 + SDL/src/thread/dc/SDL_systhread.c | 60 + SDL/src/thread/dc/SDL_systhread_c.h | 24 + SDL/src/thread/generic/SDL_syscond.c | 215 + SDL/src/thread/generic/SDL_sysmutex.c | 129 + SDL/src/thread/generic/SDL_sysmutex_c.h | 23 + SDL/src/thread/generic/SDL_syssem.c | 209 + SDL/src/thread/generic/SDL_systhread.c | 54 + SDL/src/thread/generic/SDL_systhread_c.h | 25 + SDL/src/thread/irix/SDL_syssem.c | 219 + SDL/src/thread/irix/SDL_systhread.c | 85 + SDL/src/thread/irix/SDL_systhread_c.h | 27 + SDL/src/thread/os2/SDL_syscond.c | 215 + SDL/src/thread/os2/SDL_syscond_c.h | 23 + SDL/src/thread/os2/SDL_sysmutex.c | 108 + SDL/src/thread/os2/SDL_syssem.c | 192 + SDL/src/thread/os2/SDL_systhread.c | 108 + SDL/src/thread/os2/SDL_systhread_c.h | 28 + SDL/src/thread/pth/SDL_syscond.c | 164 + SDL/src/thread/pth/SDL_sysmutex.c | 87 + SDL/src/thread/pth/SDL_sysmutex_c.h | 31 + SDL/src/thread/pth/SDL_systhread.c | 103 + SDL/src/thread/pth/SDL_systhread_c.h | 31 + SDL/src/thread/pthread/SDL_syscond.c | 155 + SDL/src/thread/pthread/SDL_sysmutex.c | 153 + SDL/src/thread/pthread/SDL_sysmutex_c.h | 31 + SDL/src/thread/pthread/SDL_syssem.c | 156 + SDL/src/thread/pthread/SDL_systhread.c | 120 + SDL/src/thread/pthread/SDL_systhread_c.h | 26 + SDL/src/thread/riscos/SDL_syscond.c | 160 + SDL/src/thread/riscos/SDL_sysmutex.c | 153 + SDL/src/thread/riscos/SDL_sysmutex_c.h | 34 + SDL/src/thread/riscos/SDL_syssem.c | 203 + SDL/src/thread/riscos/SDL_systhread.c | 144 + SDL/src/thread/riscos/SDL_systhread_c.h | 34 + SDL/src/thread/symbian/SDL_sysmutex.cpp | 130 + SDL/src/thread/symbian/SDL_syssem.cpp | 214 + SDL/src/thread/symbian/SDL_systhread.cpp | 146 + SDL/src/thread/symbian/SDL_systhread_c.h | 30 + SDL/src/thread/wii/SDL_syscond.c | 142 + SDL/src/thread/wii/SDL_sysmutex.c | 89 + SDL/src/thread/wii/SDL_sysmutex_c.h | 26 + SDL/src/thread/wii/SDL_syssem.c | 166 + SDL/src/thread/wii/SDL_systhread.c | 77 + SDL/src/thread/wii/SDL_systhread_c.h | 26 + SDL/src/thread/win32/SDL_sysmutex.c | 95 + SDL/src/thread/win32/SDL_syssem.c | 164 + SDL/src/thread/win32/SDL_systhread.c | 150 + SDL/src/thread/win32/SDL_systhread_c.h | 28 + SDL/src/thread/win32/win_ce_semaphore.c | 216 + SDL/src/thread/win32/win_ce_semaphore.h | 22 + SDL/src/timer/SDL_systimer.h | 40 + SDL/src/timer/SDL_timer.c | 285 + SDL/src/timer/SDL_timer_c.h | 46 + SDL/src/timer/beos/SDL_systimer.c | 95 + SDL/src/timer/dc/SDL_systimer.c | 100 + SDL/src/timer/dummy/SDL_systimer.c | 91 + SDL/src/timer/macos/FastTimes.c | 352 + SDL/src/timer/macos/FastTimes.h | 27 + SDL/src/timer/macos/SDL_MPWtimer.c | 152 + SDL/src/timer/macos/SDL_systimer.c | 186 + SDL/src/timer/mint/SDL_systimer.c | 147 + SDL/src/timer/mint/SDL_vbltimer.S | 159 + SDL/src/timer/mint/SDL_vbltimer_s.h | 35 + SDL/src/timer/nds/SDL_systimer.c | 73 + SDL/src/timer/os2/SDL_systimer.c | 227 + SDL/src/timer/riscos/SDL_systimer.c | 233 + SDL/src/timer/symbian/SDL_systimer.cpp | 114 + SDL/src/timer/unix/SDL_systimer.c | 240 + SDL/src/timer/wii/SDL_systimer.c | 102 + SDL/src/timer/win32/SDL_systimer.c | 160 + SDL/src/timer/wince/SDL_systimer.c | 198 + SDL/src/video/SDL_RLEaccel.c | 1943 ++++ SDL/src/video/SDL_RLEaccel_c.h | 31 + SDL/src/video/SDL_blit.c | 360 + SDL/src/video/SDL_blit.h | 541 + SDL/src/video/SDL_blit_0.c | 471 + SDL/src/video/SDL_blit_1.c | 523 + SDL/src/video/SDL_blit_A.c | 2872 ++++++ SDL/src/video/SDL_blit_N.c | 2490 +++++ SDL/src/video/SDL_bmp.c | 520 + SDL/src/video/SDL_cursor.c | 758 ++ SDL/src/video/SDL_cursor_c.h | 73 + SDL/src/video/SDL_gamma.c | 233 + SDL/src/video/SDL_glfuncs.h | 341 + SDL/src/video/SDL_leaks.h | 31 + SDL/src/video/SDL_pixels.c | 625 ++ SDL/src/video/SDL_pixels_c.h | 46 + SDL/src/video/SDL_stretch.c | 349 + SDL/src/video/SDL_stretch_c.h | 29 + SDL/src/video/SDL_surface.c | 941 ++ SDL/src/video/SDL_sysvideo.h | 421 + SDL/src/video/SDL_video.c | 1954 ++++ SDL/src/video/SDL_yuv.c | 150 + SDL/src/video/SDL_yuv_mmx.c | 428 + SDL/src/video/SDL_yuv_sw.c | 1299 +++ SDL/src/video/SDL_yuv_sw_c.h | 37 + SDL/src/video/SDL_yuvfuncs.h | 37 + SDL/src/video/Xext/README | 10 + SDL/src/video/Xext/XME/xme.c | 410 + SDL/src/video/Xext/Xinerama/Xinerama.c | 324 + SDL/src/video/Xext/Xv/Xv.c | 1151 +++ SDL/src/video/Xext/Xv/Xvlibint.h | 81 + SDL/src/video/Xext/Xxf86dga/XF86DGA.c | 721 ++ SDL/src/video/Xext/Xxf86dga/XF86DGA2.c | 993 ++ SDL/src/video/Xext/Xxf86vm/XF86VMode.c | 1226 +++ SDL/src/video/Xext/extensions/Xext.h | 50 + SDL/src/video/Xext/extensions/Xinerama.h | 46 + SDL/src/video/Xext/extensions/Xv.h | 129 + SDL/src/video/Xext/extensions/Xvlib.h | 433 + SDL/src/video/Xext/extensions/Xvproto.h | 604 ++ SDL/src/video/Xext/extensions/extutil.h | 226 + SDL/src/video/Xext/extensions/panoramiXext.h | 52 + .../video/Xext/extensions/panoramiXproto.h | 192 + SDL/src/video/Xext/extensions/xf86dga.h | 265 + SDL/src/video/Xext/extensions/xf86dga1.h | 169 + SDL/src/video/Xext/extensions/xf86dga1str.h | 194 + SDL/src/video/Xext/extensions/xf86dgastr.h | 344 + SDL/src/video/Xext/extensions/xf86vmode.h | 314 + SDL/src/video/Xext/extensions/xf86vmstr.h | 546 ++ SDL/src/video/Xext/extensions/xme.h | 45 + SDL/src/video/aalib/SDL_aaevents.c | 202 + SDL/src/video/aalib/SDL_aaevents_c.h | 35 + SDL/src/video/aalib/SDL_aamouse.c | 35 + SDL/src/video/aalib/SDL_aamouse_c.h | 26 + SDL/src/video/aalib/SDL_aavideo.c | 388 + SDL/src/video/aalib/SDL_aavideo.h | 66 + SDL/src/video/ataricommon/SDL_ataric2p.S | 447 + SDL/src/video/ataricommon/SDL_ataric2p_s.h | 75 + SDL/src/video/ataricommon/SDL_ataridevmouse.c | 159 + .../video/ataricommon/SDL_ataridevmouse_c.h | 42 + SDL/src/video/ataricommon/SDL_atarieddi.S | 42 + SDL/src/video/ataricommon/SDL_atarieddi_s.h | 54 + SDL/src/video/ataricommon/SDL_atarievents.c | 239 + SDL/src/video/ataricommon/SDL_atarievents_c.h | 65 + SDL/src/video/ataricommon/SDL_atarigl.c | 1088 +++ SDL/src/video/ataricommon/SDL_atarigl_c.h | 109 + SDL/src/video/ataricommon/SDL_atarikeys.h | 140 + SDL/src/video/ataricommon/SDL_atarimxalloc.c | 52 + .../video/ataricommon/SDL_atarimxalloc_c.h | 45 + SDL/src/video/ataricommon/SDL_biosevents.c | 131 + SDL/src/video/ataricommon/SDL_biosevents_c.h | 42 + SDL/src/video/ataricommon/SDL_gemdosevents.c | 137 + .../video/ataricommon/SDL_gemdosevents_c.h | 42 + SDL/src/video/ataricommon/SDL_ikbdevents.c | 126 + SDL/src/video/ataricommon/SDL_ikbdevents_c.h | 42 + SDL/src/video/ataricommon/SDL_ikbdinterrupt.S | 260 + .../video/ataricommon/SDL_ikbdinterrupt_s.h | 61 + SDL/src/video/ataricommon/SDL_xbiosevents.c | 154 + SDL/src/video/ataricommon/SDL_xbiosevents_c.h | 48 + .../video/ataricommon/SDL_xbiosinterrupt.S | 172 + .../video/ataricommon/SDL_xbiosinterrupt_s.h | 52 + SDL/src/video/blank_cursor.h | 33 + SDL/src/video/bwindow/SDL_BView.h | 116 + SDL/src/video/bwindow/SDL_BWin.h | 282 + SDL/src/video/bwindow/SDL_lowvideo.h | 58 + SDL/src/video/bwindow/SDL_sysevents.cc | 381 + SDL/src/video/bwindow/SDL_sysevents_c.h | 31 + SDL/src/video/bwindow/SDL_sysmouse.cc | 153 + SDL/src/video/bwindow/SDL_sysmouse_c.h | 33 + SDL/src/video/bwindow/SDL_sysvideo.cc | 829 ++ SDL/src/video/bwindow/SDL_syswm.cc | 92 + SDL/src/video/bwindow/SDL_syswm_c.h | 32 + SDL/src/video/bwindow/SDL_sysyuv.cc | 314 + SDL/src/video/bwindow/SDL_sysyuv.h | 73 + SDL/src/video/dc/SDL_dcevents.c | 152 + SDL/src/video/dc/SDL_dcevents_c.h | 33 + SDL/src/video/dc/SDL_dcmouse.c | 35 + SDL/src/video/dc/SDL_dcmouse_c.h | 26 + SDL/src/video/dc/SDL_dcvideo.c | 445 + SDL/src/video/dc/SDL_dcvideo.h | 42 + SDL/src/video/default_cursor.h | 116 + SDL/src/video/dga/SDL_dgaevents.c | 161 + SDL/src/video/dga/SDL_dgaevents_c.h | 28 + SDL/src/video/dga/SDL_dgamouse.c | 35 + SDL/src/video/dga/SDL_dgamouse_c.h | 26 + SDL/src/video/dga/SDL_dgavideo.c | 1101 +++ SDL/src/video/dga/SDL_dgavideo.h | 124 + SDL/src/video/directfb/SDL_DirectFB_events.c | 210 + SDL/src/video/directfb/SDL_DirectFB_events.h | 29 + SDL/src/video/directfb/SDL_DirectFB_keys.h | 135 + SDL/src/video/directfb/SDL_DirectFB_video.c | 1171 +++ SDL/src/video/directfb/SDL_DirectFB_video.h | 62 + SDL/src/video/directfb/SDL_DirectFB_yuv.c | 290 + SDL/src/video/directfb/SDL_DirectFB_yuv.h | 38 + SDL/src/video/dummy/SDL_nullevents.c | 45 + SDL/src/video/dummy/SDL_nullevents_c.h | 33 + SDL/src/video/dummy/SDL_nullmouse.c | 33 + SDL/src/video/dummy/SDL_nullmouse_c.h | 26 + SDL/src/video/dummy/SDL_nullvideo.c | 239 + SDL/src/video/dummy/SDL_nullvideo.h | 40 + SDL/src/video/e_log.h | 140 + SDL/src/video/e_pow.h | 302 + SDL/src/video/e_sqrt.h | 493 + SDL/src/video/fbcon/3dfx_mmio.h | 56 + SDL/src/video/fbcon/3dfx_regs.h | 83 + SDL/src/video/fbcon/SDL_fb3dfx.c | 217 + SDL/src/video/fbcon/SDL_fb3dfx.h | 29 + SDL/src/video/fbcon/SDL_fbelo.c | 442 + SDL/src/video/fbcon/SDL_fbelo.h | 55 + SDL/src/video/fbcon/SDL_fbevents.c | 1245 +++ SDL/src/video/fbcon/SDL_fbevents_c.h | 38 + SDL/src/video/fbcon/SDL_fbkeys.h | 139 + SDL/src/video/fbcon/SDL_fbmatrox.c | 280 + SDL/src/video/fbcon/SDL_fbmatrox.h | 29 + SDL/src/video/fbcon/SDL_fbmouse.c | 33 + SDL/src/video/fbcon/SDL_fbmouse_c.h | 26 + SDL/src/video/fbcon/SDL_fbriva.c | 222 + SDL/src/video/fbcon/SDL_fbriva.h | 36 + SDL/src/video/fbcon/SDL_fbvideo.c | 1701 ++++ SDL/src/video/fbcon/SDL_fbvideo.h | 182 + SDL/src/video/fbcon/matrox_mmio.h | 51 + SDL/src/video/fbcon/matrox_regs.h | 376 + SDL/src/video/fbcon/riva_mmio.h | 449 + SDL/src/video/fbcon/riva_regs.h | 43 + SDL/src/video/gapi/SDL_gapivideo.c | 1240 +++ SDL/src/video/gapi/SDL_gapivideo.h | 162 + SDL/src/video/gem/SDL_gemevents.c | 370 + SDL/src/video/gem/SDL_gemevents_c.h | 33 + SDL/src/video/gem/SDL_gemmouse.c | 204 + SDL/src/video/gem/SDL_gemmouse_c.h | 34 + SDL/src/video/gem/SDL_gemvideo.c | 1340 +++ SDL/src/video/gem/SDL_gemvideo.h | 191 + SDL/src/video/gem/SDL_gemwm.c | 116 + SDL/src/video/gem/SDL_gemwm_c.h | 37 + SDL/src/video/ggi/SDL_ggievents.c | 264 + SDL/src/video/ggi/SDL_ggievents_c.h | 29 + SDL/src/video/ggi/SDL_ggikeys.h | 135 + SDL/src/video/ggi/SDL_ggimouse.c | 32 + SDL/src/video/ggi/SDL_ggimouse_c.h | 26 + SDL/src/video/ggi/SDL_ggivideo.c | 378 + SDL/src/video/ggi/SDL_ggivideo.h | 48 + SDL/src/video/ipod/SDL_ipodvideo.c | 733 ++ SDL/src/video/ipod/SDL_ipodvideo.h | 38 + SDL/src/video/maccommon/SDL_lowvideo.h | 102 + SDL/src/video/maccommon/SDL_macevents.c | 746 ++ SDL/src/video/maccommon/SDL_macevents_c.h | 32 + SDL/src/video/maccommon/SDL_macgl.c | 197 + SDL/src/video/maccommon/SDL_macgl_c.h | 47 + SDL/src/video/maccommon/SDL_mackeys.h | 140 + SDL/src/video/maccommon/SDL_macmouse.c | 129 + SDL/src/video/maccommon/SDL_macmouse_c.h | 34 + SDL/src/video/maccommon/SDL_macwm.c | 442 + SDL/src/video/maccommon/SDL_macwm_c.h | 41 + SDL/src/video/macdsp/SDL_dspvideo.c | 1422 +++ SDL/src/video/macdsp/SDL_dspvideo.h | 54 + SDL/src/video/macrom/SDL_romvideo.c | 745 ++ SDL/src/video/macrom/SDL_romvideo.h | 29 + SDL/src/video/math_private.h | 173 + SDL/src/video/mmx.h | 704 ++ SDL/src/video/nanox/SDL_nxevents.c | 382 + SDL/src/video/nanox/SDL_nxevents_c.h | 32 + SDL/src/video/nanox/SDL_nximage.c | 230 + SDL/src/video/nanox/SDL_nximage_c.h | 35 + SDL/src/video/nanox/SDL_nxmodes.c | 84 + SDL/src/video/nanox/SDL_nxmodes_c.h | 34 + SDL/src/video/nanox/SDL_nxmouse.c | 79 + SDL/src/video/nanox/SDL_nxmouse_c.h | 29 + SDL/src/video/nanox/SDL_nxvideo.c | 544 ++ SDL/src/video/nanox/SDL_nxvideo.h | 96 + SDL/src/video/nanox/SDL_nxwm.c | 61 + SDL/src/video/nanox/SDL_nxwm_c.h | 32 + SDL/src/video/nds/SDL_ndsevents.c | 83 + SDL/src/video/nds/SDL_ndsevents_c.h | 51 + SDL/src/video/nds/SDL_ndsmouse.c | 34 + SDL/src/video/nds/SDL_ndsmouse_c.h | 26 + SDL/src/video/nds/SDL_ndsvideo.c | 500 + SDL/src/video/nds/SDL_ndsvideo.h | 61 + SDL/src/video/os2fslib/SDL_os2fslib.c | 3018 ++++++ SDL/src/video/os2fslib/SDL_os2fslib.h | 71 + SDL/src/video/os2fslib/SDL_vkeys.h | 74 + SDL/src/video/photon/SDL_ph_events.c | 624 ++ SDL/src/video/photon/SDL_ph_events_c.h | 37 + SDL/src/video/photon/SDL_ph_gl.c | 406 + SDL/src/video/photon/SDL_ph_gl.h | 41 + SDL/src/video/photon/SDL_ph_image.c | 1059 ++ SDL/src/video/photon/SDL_ph_image_c.h | 59 + SDL/src/video/photon/SDL_ph_modes.c | 390 + SDL/src/video/photon/SDL_ph_modes_c.h | 43 + SDL/src/video/photon/SDL_ph_mouse.c | 220 + SDL/src/video/photon/SDL_ph_mouse_c.h | 39 + SDL/src/video/photon/SDL_ph_video.c | 648 ++ SDL/src/video/photon/SDL_ph_video.h | 157 + SDL/src/video/photon/SDL_ph_wm.c | 118 + SDL/src/video/photon/SDL_ph_wm_c.h | 37 + SDL/src/video/photon/SDL_phyuv.c | 504 + SDL/src/video/photon/SDL_phyuv_c.h | 62 + SDL/src/video/picogui/SDL_pgevents.c | 117 + SDL/src/video/picogui/SDL_pgevents_c.h | 37 + SDL/src/video/picogui/SDL_pgvideo.c | 364 + SDL/src/video/picogui/SDL_pgvideo.h | 50 + SDL/src/video/ps2gs/SDL_gsevents.c | 977 ++ SDL/src/video/ps2gs/SDL_gsevents_c.h | 38 + SDL/src/video/ps2gs/SDL_gskeys.h | 139 + SDL/src/video/ps2gs/SDL_gsmouse.c | 146 + SDL/src/video/ps2gs/SDL_gsmouse_c.h | 37 + SDL/src/video/ps2gs/SDL_gsvideo.c | 689 ++ SDL/src/video/ps2gs/SDL_gsvideo.h | 95 + SDL/src/video/ps2gs/SDL_gsyuv.c | 461 + SDL/src/video/ps2gs/SDL_gsyuv_c.h | 37 + SDL/src/video/qtopia/SDL_QPEApp.cc | 63 + SDL/src/video/qtopia/SDL_QPEApp.h | 33 + SDL/src/video/qtopia/SDL_QWin.cc | 527 + SDL/src/video/qtopia/SDL_QWin.h | 110 + SDL/src/video/qtopia/SDL_lowvideo.h | 65 + SDL/src/video/qtopia/SDL_sysevents.cc | 269 + SDL/src/video/qtopia/SDL_sysevents_c.h | 31 + SDL/src/video/qtopia/SDL_sysmouse.cc | 56 + SDL/src/video/qtopia/SDL_sysmouse_c.h | 32 + SDL/src/video/qtopia/SDL_sysvideo.cc | 403 + SDL/src/video/qtopia/SDL_syswm.cc | 35 + SDL/src/video/qtopia/SDL_syswm_c.h | 28 + SDL/src/video/quartz/CGS.h | 84 + SDL/src/video/quartz/SDL_QuartzEvents.m | 983 ++ SDL/src/video/quartz/SDL_QuartzGL.m | 281 + SDL/src/video/quartz/SDL_QuartzKeys.h | 146 + SDL/src/video/quartz/SDL_QuartzVideo.h | 231 + SDL/src/video/quartz/SDL_QuartzVideo.m | 1683 ++++ SDL/src/video/quartz/SDL_QuartzWM.h | 27 + SDL/src/video/quartz/SDL_QuartzWM.m | 448 + SDL/src/video/quartz/SDL_QuartzWindow.h | 43 + SDL/src/video/quartz/SDL_QuartzWindow.m | 232 + SDL/src/video/quartz/SDL_QuartzYUV.m | 330 + SDL/src/video/riscos/SDL_riscosASM.S | 116 + .../video/riscos/SDL_riscosFullScreenVideo.c | 777 ++ SDL/src/video/riscos/SDL_riscosevents.c | 549 ++ SDL/src/video/riscos/SDL_riscosevents_c.h | 34 + SDL/src/video/riscos/SDL_riscosmouse.c | 371 + SDL/src/video/riscos/SDL_riscosmouse_c.h | 44 + SDL/src/video/riscos/SDL_riscossprite.c | 265 + SDL/src/video/riscos/SDL_riscostask.c | 350 + SDL/src/video/riscos/SDL_riscostask.h | 39 + SDL/src/video/riscos/SDL_riscosvideo.c | 316 + SDL/src/video/riscos/SDL_riscosvideo.h | 62 + SDL/src/video/riscos/SDL_wimppoll.c | 330 + SDL/src/video/riscos/SDL_wimpvideo.c | 501 + SDL/src/video/svga/SDL_svgaevents.c | 412 + SDL/src/video/svga/SDL_svgaevents_c.h | 35 + SDL/src/video/svga/SDL_svgamouse.c | 33 + SDL/src/video/svga/SDL_svgamouse_c.h | 26 + SDL/src/video/svga/SDL_svgavideo.c | 584 ++ SDL/src/video/svga/SDL_svgavideo.h | 58 + SDL/src/video/symbian/EKA1/SDL_epocevents.cpp | 626 ++ SDL/src/video/symbian/EKA1/SDL_epocvideo.cpp | 1356 +++ SDL/src/video/symbian/EKA1/SDL_epocvideo.h | 34 + SDL/src/video/symbian/EKA2/SDL_epocevents.cpp | 521 + SDL/src/video/symbian/EKA2/SDL_epocvideo.cpp | 594 ++ SDL/src/video/symbian/EKA2/SDL_epocvideo.h | 51 + SDL/src/video/symbian/EKA2/dsa.cpp | 1505 +++ SDL/src/video/symbian/EKA2/dsa_new.cpp | 1443 +++ SDL/src/video/symbian/EKA2/dsa_old.cpp | 1075 ++ SDL/src/video/symbian/SDL_epocevents_c.h | 60 + SDL/src/video/vgl/SDL_vglevents.c | 299 + SDL/src/video/vgl/SDL_vglevents_c.h | 155 + SDL/src/video/vgl/SDL_vglmouse.c | 56 + SDL/src/video/vgl/SDL_vglmouse_c.h | 32 + SDL/src/video/vgl/SDL_vglvideo.c | 640 ++ SDL/src/video/vgl/SDL_vglvideo.h | 65 + SDL/src/video/wii/SDL_wiievents.c | 650 ++ SDL/src/video/wii/SDL_wiievents_c.h | 33 + SDL/src/video/wii/SDL_wiimouse.c | 33 + SDL/src/video/wii/SDL_wiimouse_c.h | 26 + SDL/src/video/wii/SDL_wiivideo.c | 608 ++ SDL/src/video/wii/SDL_wiivideo.h | 69 + SDL/src/video/wincommon/SDL_lowvideo.h | 139 + SDL/src/video/wincommon/SDL_sysevents.c | 924 ++ SDL/src/video/wincommon/SDL_sysmouse.c | 260 + SDL/src/video/wincommon/SDL_sysmouse_c.h | 33 + SDL/src/video/wincommon/SDL_syswm.c | 297 + SDL/src/video/wincommon/SDL_syswm_c.h | 35 + SDL/src/video/wincommon/SDL_wingl.c | 647 ++ SDL/src/video/wincommon/SDL_wingl_c.h | 135 + SDL/src/video/wincommon/wmmsg.h | 1030 ++ SDL/src/video/windib/SDL_dibevents.c | 591 ++ SDL/src/video/windib/SDL_dibevents_c.h | 35 + SDL/src/video/windib/SDL_dibvideo.c | 1307 +++ SDL/src/video/windib/SDL_dibvideo.h | 70 + SDL/src/video/windib/SDL_vkeys.h | 75 + SDL/src/video/windx5/SDL_dx5events.c | 923 ++ SDL/src/video/windx5/SDL_dx5events_c.h | 37 + SDL/src/video/windx5/SDL_dx5video.c | 2518 +++++ SDL/src/video/windx5/SDL_dx5video.h | 61 + SDL/src/video/windx5/SDL_dx5yuv.c | 295 + SDL/src/video/windx5/SDL_dx5yuv_c.h | 38 + SDL/src/video/windx5/directx.h | 84 + SDL/src/video/wscons/SDL_wsconsevents.c | 233 + SDL/src/video/wscons/SDL_wsconsevents_c.h | 36 + SDL/src/video/wscons/SDL_wsconsmouse.c | 33 + SDL/src/video/wscons/SDL_wsconsmouse_c.h | 26 + SDL/src/video/wscons/SDL_wsconsvideo.c | 609 ++ SDL/src/video/wscons/SDL_wsconsvideo.h | 76 + SDL/src/video/x11/SDL_x11dga.c | 90 + SDL/src/video/x11/SDL_x11dga_c.h | 33 + SDL/src/video/x11/SDL_x11dyn.c | 192 + SDL/src/video/x11/SDL_x11dyn.h | 93 + SDL/src/video/x11/SDL_x11events.c | 1401 +++ SDL/src/video/x11/SDL_x11events_c.h | 29 + SDL/src/video/x11/SDL_x11gamma.c | 142 + SDL/src/video/x11/SDL_x11gamma_c.h | 32 + SDL/src/video/x11/SDL_x11gl.c | 557 ++ SDL/src/video/x11/SDL_x11gl_c.h | 99 + SDL/src/video/x11/SDL_x11image.c | 318 + SDL/src/video/x11/SDL_x11image_c.h | 38 + SDL/src/video/x11/SDL_x11modes.c | 1110 +++ SDL/src/video/x11/SDL_x11modes_c.h | 43 + SDL/src/video/x11/SDL_x11mouse.c | 284 + SDL/src/video/x11/SDL_x11mouse_c.h | 33 + SDL/src/video/x11/SDL_x11sym.h | 195 + SDL/src/video/x11/SDL_x11video.c | 1549 +++ SDL/src/video/x11/SDL_x11video.h | 214 + SDL/src/video/x11/SDL_x11wm.c | 433 + SDL/src/video/x11/SDL_x11wm_c.h | 34 + SDL/src/video/x11/SDL_x11yuv.c | 538 + SDL/src/video/x11/SDL_x11yuv_c.h | 41 + SDL/src/video/xbios/SDL_xbios.c | 953 ++ SDL/src/video/xbios/SDL_xbios.h | 131 + SDL/src/video/xbios/SDL_xbios_blowup.c | 70 + SDL/src/video/xbios/SDL_xbios_blowup.h | 86 + SDL/src/video/xbios/SDL_xbios_centscreen.c | 105 + SDL/src/video/xbios/SDL_xbios_centscreen.h | 118 + SDL/src/video/xbios/SDL_xbios_sb3.c | 86 + SDL/src/video/xbios/SDL_xbios_sb3.h | 82 + SDL/src/video/xbios/SDL_xbios_tveille.c | 52 + SDL/src/video/xbios/SDL_xbios_tveille.h | 70 + SDL/test/COPYING | 8 + SDL/test/Makefile.in | 117 + SDL/test/README | 35 + SDL/test/acinclude.m4 | 181 + SDL/test/aclocal.m4 | 181 + SDL/test/autogen.sh | 12 + SDL/test/checkkeys.c | 146 + SDL/test/configure | 4779 +++++++++ SDL/test/configure.in | 105 + SDL/test/gcc-fat.sh | 134 + SDL/test/graywin.c | 259 + SDL/test/icon.bmp | Bin 0 -> 578 bytes SDL/test/loopwave.c | 115 + SDL/test/moose.dat | Bin 0 -> 56320 bytes SDL/test/picture.xbm | 14 + SDL/test/sail.bmp | Bin 0 -> 15858 bytes SDL/test/sample.bmp | Bin 0 -> 69202 bytes SDL/test/sample.wav | Bin 0 -> 121946 bytes SDL/test/testalpha.c | 537 + SDL/test/testbitmap.c | 184 + SDL/test/testblitspeed.c | 420 + SDL/test/testcdrom.c | 209 + SDL/test/testcursor.c | 217 + SDL/test/testdyngl.c | 209 + SDL/test/testerror.c | 61 + SDL/test/testfile.c | 182 + SDL/test/testgamma.c | 197 + SDL/test/testgl.c | 856 ++ SDL/test/testhread.c | 82 + SDL/test/testiconv.c | 73 + SDL/test/testjoystick.c | 188 + SDL/test/testkeys.c | 46 + SDL/test/testloadso.c | 71 + SDL/test/testlock.c | 102 + SDL/test/testoverlay.c | 594 ++ SDL/test/testoverlay2.c | 600 ++ SDL/test/testpalette.c | 342 + SDL/test/testplatform.c | 207 + SDL/test/testsem.c | 80 + SDL/test/testsprite.c | 323 + SDL/test/testtimer.c | 87 + SDL/test/testver.c | 37 + SDL/test/testvidinfo.c | 465 + SDL/test/testwin.c | 377 + SDL/test/testwm.c | 376 + SDL/test/threadwin.c | 338 + SDL/test/torturethread.c | 91 + SDL/test/utf8.txt | 287 + SDL_gfx/Makefile | 50 + SDL_gfx/src/AUTHORS | 1 + SDL_gfx/src/COPYING | 1 + SDL_gfx/src/ChangeLog | 255 + .../Screenshots/SDL_gfxPrimitives-thumb.jpg | Bin 0 -> 2245 bytes .../Docs/Screenshots/SDL_gfxPrimitives.jpg | Bin 0 -> 58089 bytes .../Docs/Screenshots/SDL_rotozoom-thumb.jpg | Bin 0 -> 1100 bytes SDL_gfx/src/Docs/Screenshots/SDL_rotozoom.jpg | Bin 0 -> 14490 bytes SDL_gfx/src/Docs/blank.gif | Bin 0 -> 48 bytes SDL_gfx/src/Docs/framerate-thumb.png | Bin 0 -> 1196 bytes SDL_gfx/src/Docs/framerate.fig | 59 + SDL_gfx/src/Docs/framerate.png | Bin 0 -> 5896 bytes SDL_gfx/src/Docs/index.html | 3 + SDL_gfx/src/Fonts/10x20.fnt | Bin 0 -> 10240 bytes SDL_gfx/src/Fonts/5x7.fnt | Bin 0 -> 1792 bytes SDL_gfx/src/Fonts/5x8.fnt | Bin 0 -> 2048 bytes SDL_gfx/src/Fonts/6x10.fnt | Bin 0 -> 2560 bytes SDL_gfx/src/Fonts/6x12.fnt | Bin 0 -> 3072 bytes SDL_gfx/src/Fonts/6x13.fnt | Bin 0 -> 3328 bytes SDL_gfx/src/Fonts/6x13B.fnt | Bin 0 -> 3328 bytes SDL_gfx/src/Fonts/6x13O.fnt | Bin 0 -> 3328 bytes SDL_gfx/src/Fonts/6x9.fnt | Bin 0 -> 2304 bytes SDL_gfx/src/Fonts/7x13.fnt | Bin 0 -> 3328 bytes SDL_gfx/src/Fonts/7x13B.fnt | Bin 0 -> 3328 bytes SDL_gfx/src/Fonts/7x13O.fnt | Bin 0 -> 3328 bytes SDL_gfx/src/Fonts/7x14.fnt | Bin 0 -> 3584 bytes SDL_gfx/src/Fonts/7x14B.fnt | Bin 0 -> 3584 bytes SDL_gfx/src/Fonts/8x13.fnt | Bin 0 -> 3328 bytes SDL_gfx/src/Fonts/8x13B.fnt | Bin 0 -> 3328 bytes SDL_gfx/src/Fonts/8x13O.fnt | Bin 0 -> 3328 bytes SDL_gfx/src/Fonts/9x15.fnt | Bin 0 -> 7680 bytes SDL_gfx/src/Fonts/9x15B.fnt | Bin 0 -> 7680 bytes SDL_gfx/src/Fonts/9x18.fnt | Bin 0 -> 9216 bytes SDL_gfx/src/Fonts/9x18B.fnt | Bin 0 -> 9216 bytes SDL_gfx/src/INSTALL | 41 + SDL_gfx/src/LICENSE | 456 + SDL_gfx/src/Makefile.am | 29 + SDL_gfx/src/Makefile.in | 663 ++ SDL_gfx/src/Makefile.mingw | 67 + SDL_gfx/src/Makefile.new | 663 ++ SDL_gfx/src/NEWS | 1 + SDL_gfx/src/README | 404 + SDL_gfx/src/README-rpm | 14 + SDL_gfx/src/SDL_framerate.c | 84 + SDL_gfx/src/SDL_framerate.h | 65 + SDL_gfx/src/SDL_gfx.spec | 108 + SDL_gfx/src/SDL_gfxBlitFunc.c | 217 + SDL_gfx/src/SDL_gfxBlitFunc.h | 385 + SDL_gfx/src/SDL_gfxPrimitives.c | 4617 +++++++++ SDL_gfx/src/SDL_gfxPrimitives.h | 207 + SDL_gfx/src/SDL_gfxPrimitives_font.h | 3082 ++++++ SDL_gfx/src/SDL_imageFilter.c | 4067 ++++++++ SDL_gfx/src/SDL_imageFilter.h | 192 + SDL_gfx/src/SDL_rotozoom.c | 1379 +++ SDL_gfx/src/SDL_rotozoom.h | 125 + SDL_gfx/src/Scripts/clean-c++.pl | 9 + SDL_gfx/src/Test/Makefile.am | 27 + SDL_gfx/src/Test/Makefile.in | 642 ++ SDL_gfx/src/Test/Makefile.new | 642 ++ SDL_gfx/src/Test/TestABGR.c | 147 + SDL_gfx/src/Test/TestFonts.c | 265 + SDL_gfx/src/Test/TestFramerate.c | 245 + SDL_gfx/src/Test/TestGfxBlit.c | 317 + SDL_gfx/src/Test/TestGfxPrimitives.c | 2266 +++++ SDL_gfx/src/Test/TestGfxTexture.c | 276 + SDL_gfx/src/Test/TestImageFilter.c | 516 + SDL_gfx/src/Test/TestRotozoom.c | 618 ++ SDL_gfx/src/Test/TestShrink.c | 396 + SDL_gfx/src/Test/acinclude.m4 | 602 ++ SDL_gfx/src/Test/aclocal.m4 | 869 ++ SDL_gfx/src/Test/autogen.sh | 8 + SDL_gfx/src/Test/config.guess | 1402 +++ SDL_gfx/src/Test/config.sub | 1549 +++ SDL_gfx/src/Test/configure | 7135 ++++++++++++++ SDL_gfx/src/Test/configure.in | 88 + SDL_gfx/src/Test/install-sh | 251 + SDL_gfx/src/Test/ltconfig | 3122 ++++++ SDL_gfx/src/Test/ltmain.sh | 4024 ++++++++ SDL_gfx/src/Test/missing | 336 + SDL_gfx/src/Test/mkinstalldirs | 40 + SDL_gfx/src/Test/sample24-box.bmp | Bin 0 -> 786486 bytes SDL_gfx/src/Test/sample24.bmp | Bin 0 -> 135054 bytes SDL_gfx/src/Test/sample8-box.bmp | Bin 0 -> 263222 bytes SDL_gfx/src/Test/sample8.bmp | Bin 0 -> 46078 bytes SDL_gfx/src/Test/texture.bmp | Bin 0 -> 49206 bytes SDL_gfx/src/Test/texture_alpha.bmp | Bin 0 -> 4150 bytes SDL_gfx/src/VisualC/SDL_gfx.vcproj | 235 + SDL_gfx/src/VisualC/VisualC Note.txt | 11 + SDL_gfx/src/acinclude.m4 | 602 ++ SDL_gfx/src/aclocal.m4 | 869 ++ SDL_gfx/src/autogen.sh | 8 + SDL_gfx/src/buildrpm.sh | 6 + SDL_gfx/src/config.guess | 1402 +++ SDL_gfx/src/config.sub | 1549 +++ SDL_gfx/src/configure | 8689 +++++++++++++++++ SDL_gfx/src/configure.in | 121 + SDL_gfx/src/depcomp | 479 + SDL_gfx/src/install-sh | 251 + SDL_gfx/src/ltconfig | 3122 ++++++ SDL_gfx/src/ltmain.sh | 4024 ++++++++ SDL_gfx/src/missing | 336 + SDL_gfx/src/mkinstalldirs | 40 + SDL_gfx/src/nodebug.sh | 23 + SDL_image/Makefile | 94 + SDL_image/src/CHANGES | 164 + SDL_image/src/COPYING | 458 + SDL_image/src/IMG.c | 154 + SDL_image/src/IMG_ImageIO.c | 503 + SDL_image/src/IMG_UIImage.m | 444 + SDL_image/src/IMG_bmp.c | 823 ++ SDL_image/src/IMG_gif.c | 622 ++ SDL_image/src/IMG_jpg.c | 480 + SDL_image/src/IMG_lbm.c | 502 + SDL_image/src/IMG_pcx.c | 265 + SDL_image/src/IMG_png.c | 522 + SDL_image/src/IMG_pnm.c | 259 + SDL_image/src/IMG_tga.c | 331 + SDL_image/src/IMG_tif.c | 287 + SDL_image/src/IMG_xcf.c | 825 ++ SDL_image/src/IMG_xpm.c | 507 + SDL_image/src/IMG_xv.c | 166 + SDL_image/src/IMG_xxx.c | 88 + SDL_image/src/MPWmake.sea.bin | Bin 0 -> 20992 bytes SDL_image/src/Makefile.am | 65 + SDL_image/src/README | 42 + SDL_image/src/SDL_image.h | 120 + SDL_image/src/SDL_image.qpg.in | 128 + SDL_image/src/SDL_image.spec.in | 68 + SDL_image/src/acinclude/libtool.m4 | 6409 ++++++++++++ SDL_image/src/acinclude/sdl.m4 | 181 + SDL_image/src/autogen.sh | 8 + SDL_image/src/config.guess | 1526 +++ SDL_image/src/config.sub | 1654 ++++ SDL_image/src/configure.in | 296 + SDL_image/src/gcc-fat.sh | 110 + SDL_image/src/ltmain.sh | 6864 +++++++++++++ SDL_image/src/showimage.c | 215 + SDL_image/src/version.rc | 38 + SDL_mixer/Makefile | 98 + SDL_mixer/src/CHANGES | 268 + SDL_mixer/src/COPYING | 458 + SDL_mixer/src/CWProjects.sea.bin | Bin 0 -> 125312 bytes SDL_mixer/src/MPWmake.sea.bin | Bin 0 -> 22784 bytes SDL_mixer/src/Makefile.in | 136 + SDL_mixer/src/README | 44 + SDL_mixer/src/SDL_mixer.h | 584 ++ SDL_mixer/src/SDL_mixer.qpg.in | 127 + SDL_mixer/src/SDL_mixer.spec.in | 63 + SDL_mixer/src/acinclude/libtool.m4 | 6409 ++++++++++++ SDL_mixer/src/acinclude/sdl.m4 | 181 + SDL_mixer/src/acinclude/smpeg.m4 | 171 + SDL_mixer/src/autogen.sh | 18 + SDL_mixer/src/build-scripts/config.guess | 1526 +++ SDL_mixer/src/build-scripts/config.sub | 1654 ++++ SDL_mixer/src/build-scripts/install-sh | 323 + SDL_mixer/src/build-scripts/ltmain.sh | 6864 +++++++++++++ SDL_mixer/src/build-scripts/makedep.sh | 93 + SDL_mixer/src/build-scripts/mkinstalldirs | 99 + SDL_mixer/src/configure.in | 431 + SDL_mixer/src/dynamic_flac.c | 176 + SDL_mixer/src/dynamic_flac.h | 68 + SDL_mixer/src/dynamic_mp3.c | 180 + SDL_mixer/src/dynamic_mp3.h | 49 + SDL_mixer/src/dynamic_ogg.c | 128 + SDL_mixer/src/dynamic_ogg.h | 50 + SDL_mixer/src/effect_position.c | 1596 +++ SDL_mixer/src/effect_stereoreverse.c | 118 + SDL_mixer/src/effects_internal.c | 122 + SDL_mixer/src/effects_internal.h | 55 + SDL_mixer/src/gcc-fat.sh | 110 + SDL_mixer/src/load_aiff.c | 248 + SDL_mixer/src/load_aiff.h | 31 + SDL_mixer/src/load_flac.c | 332 + SDL_mixer/src/load_flac.h | 29 + SDL_mixer/src/load_ogg.c | 163 + SDL_mixer/src/load_ogg.h | 29 + SDL_mixer/src/load_voc.c | 460 + SDL_mixer/src/load_voc.h | 34 + SDL_mixer/src/mikmod/AUTHORS | 115 + SDL_mixer/src/mikmod/COPYING.LESSER | 504 + SDL_mixer/src/mikmod/README | 13 + SDL_mixer/src/mikmod/drv_nos.c | 116 + SDL_mixer/src/mikmod/load_it.c | 977 ++ SDL_mixer/src/mikmod/load_mod.c | 456 + SDL_mixer/src/mikmod/load_s3m.c | 451 + SDL_mixer/src/mikmod/load_xm.c | 738 ++ SDL_mixer/src/mikmod/mdreg.c | 54 + SDL_mixer/src/mikmod/mdriver.c | 930 ++ SDL_mixer/src/mikmod/mikmod.h | 708 ++ SDL_mixer/src/mikmod/mikmod_build.h | 9 + SDL_mixer/src/mikmod/mikmod_internals.h | 717 ++ SDL_mixer/src/mikmod/mloader.c | 558 ++ SDL_mixer/src/mikmod/mlreg.c | 78 + SDL_mixer/src/mikmod/mlutil.c | 305 + SDL_mixer/src/mikmod/mmalloc.c | 59 + SDL_mixer/src/mikmod/mmerror.c | 197 + SDL_mixer/src/mikmod/mmio.c | 437 + SDL_mixer/src/mikmod/mplayer.c | 2917 ++++++ SDL_mixer/src/mikmod/munitrk.c | 301 + SDL_mixer/src/mikmod/mwav.c | 190 + SDL_mixer/src/mikmod/npertab.c | 47 + SDL_mixer/src/mikmod/sloader.c | 515 + SDL_mixer/src/mikmod/virtch.c | 832 ++ SDL_mixer/src/mikmod/virtch2.c | 903 ++ SDL_mixer/src/mikmod/virtch_common.c | 455 + SDL_mixer/src/mixer.c | 1304 +++ SDL_mixer/src/music.c | 1631 ++++ SDL_mixer/src/music_cmd.c | 231 + SDL_mixer/src/music_cmd.h | 63 + SDL_mixer/src/music_flac.c | 591 ++ SDL_mixer/src/music_flac.h | 93 + SDL_mixer/src/music_mad.c | 344 + SDL_mixer/src/music_mad.h | 74 + SDL_mixer/src/music_ogg.c | 237 + SDL_mixer/src/music_ogg.h | 77 + SDL_mixer/src/native_midi/native_midi.h | 40 + .../src/native_midi/native_midi_common.c | 410 + .../src/native_midi/native_midi_common.h | 67 + SDL_mixer/src/native_midi/native_midi_mac.c | 704 ++ SDL_mixer/src/native_midi/native_midi_win32.c | 322 + SDL_mixer/src/native_midi_gpl/README | 30 + SDL_mixer/src/native_midi_gpl/awe_voice.h | 490 + SDL_mixer/src/native_midi_gpl/emumidi.c | 390 + SDL_mixer/src/native_midi_gpl/emumidi.h | 63 + SDL_mixer/src/native_midi_gpl/gmvoices.h | 106 + SDL_mixer/src/native_midi_gpl/gsvoices.h | 39 + .../src/native_midi_gpl/native_midi_gpl.c | 512 + SDL_mixer/src/native_midi_gpl/patchload.c | 412 + SDL_mixer/src/native_midi_gpl/playevents.c | 217 + SDL_mixer/src/native_midi_gpl/playmidi.h | 107 + .../src/native_midi_gpl/readmidi_native.c | 188 + SDL_mixer/src/playmus.c | 229 + SDL_mixer/src/playwave.c | 471 + SDL_mixer/src/timidity/FAQ | 112 + SDL_mixer/src/timidity/README | 60 + SDL_mixer/src/timidity/common.c | 246 + SDL_mixer/src/timidity/common.h | 48 + SDL_mixer/src/timidity/config.h | 232 + SDL_mixer/src/timidity/ctrlmode.c | 41 + SDL_mixer/src/timidity/ctrlmode.h | 88 + SDL_mixer/src/timidity/filter.c | 203 + SDL_mixer/src/timidity/filter.h | 35 + SDL_mixer/src/timidity/instrum.c | 1026 ++ SDL_mixer/src/timidity/instrum.h | 183 + SDL_mixer/src/timidity/mix.c | 866 ++ SDL_mixer/src/timidity/mix.h | 27 + SDL_mixer/src/timidity/output.c | 138 + SDL_mixer/src/timidity/output.h | 75 + SDL_mixer/src/timidity/playmidi.c | 1796 ++++ SDL_mixer/src/timidity/playmidi.h | 175 + SDL_mixer/src/timidity/readmidi.c | 1080 ++ SDL_mixer/src/timidity/readmidi.h | 33 + SDL_mixer/src/timidity/resample.c | 748 ++ SDL_mixer/src/timidity/resample.h | 24 + SDL_mixer/src/timidity/sdl_a.c | 36 + SDL_mixer/src/timidity/sdl_c.c | 148 + SDL_mixer/src/timidity/tables.c | 1136 +++ SDL_mixer/src/timidity/tables.h | 50 + SDL_mixer/src/timidity/timidity.c | 373 + SDL_mixer/src/timidity/timidity.h | 34 + SDL_mixer/src/version.rc | 38 + SDL_mixer/src/wavestream.c | 525 + SDL_mixer/src/wavestream.h | 64 + SDL_ttf/Makefile | 90 + SDL_ttf/src/CHANGES | 126 + SDL_ttf/src/COPYING | 458 + SDL_ttf/src/MPWmake.sea.bin | Bin 0 -> 21632 bytes SDL_ttf/src/Makefile.am | 51 + SDL_ttf/src/README | 24 + SDL_ttf/src/SDL_ttf.c | 1819 ++++ SDL_ttf/src/SDL_ttf.h | 237 + SDL_ttf/src/SDL_ttf.spec.in | 65 + SDL_ttf/src/acinclude/libtool.m4 | 6409 ++++++++++++ SDL_ttf/src/acinclude/sdl.m4 | 181 + SDL_ttf/src/autogen.sh | 11 + SDL_ttf/src/config.guess | 1526 +++ SDL_ttf/src/config.sub | 1654 ++++ SDL_ttf/src/configure.in | 192 + SDL_ttf/src/gcc-fat.sh | 110 + SDL_ttf/src/glfont.c | 537 + SDL_ttf/src/ltmain.sh | 6864 +++++++++++++ SDL_ttf/src/showfont.c | 375 + SDL_ttf/src/version.rc | 38 + 1398 files changed, 449159 insertions(+) create mode 100644 SDL/BUGS create mode 100644 SDL/Borland.html create mode 100644 SDL/COPYING create mode 100644 SDL/CREDITS create mode 100644 SDL/INSTALL create mode 100644 SDL/MPWmake.sea.bin create mode 100644 SDL/Makefile create mode 100644 SDL/Makefile.dc create mode 100644 SDL/Makefile.ds create mode 100644 SDL/Makefile.in create mode 100644 SDL/Makefile.minimal create mode 100644 SDL/README create mode 100644 SDL/README-SDL.txt create mode 100644 SDL/README.AmigaOS create mode 100644 SDL/README.BeOS create mode 100644 SDL/README.DC create mode 100644 SDL/README.MacOS create mode 100644 SDL/README.MacOSX create mode 100644 SDL/README.MiNT create mode 100644 SDL/README.NDS create mode 100644 SDL/README.NanoX create mode 100644 SDL/README.OS2 create mode 100644 SDL/README.PicoGUI create mode 100644 SDL/README.Porting create mode 100644 SDL/README.QNX create mode 100644 SDL/README.Qtopia create mode 100644 SDL/README.RISCOS create mode 100644 SDL/README.Symbian create mode 100644 SDL/README.WII create mode 100644 SDL/README.Watcom create mode 100644 SDL/README.WinCE create mode 100644 SDL/README.wscons create mode 100644 SDL/SDL.qpg.in create mode 100644 SDL/SDL.spec create mode 100644 SDL/SDL.spec.in create mode 100644 SDL/TODO create mode 100644 SDL/VisualC.html create mode 100644 SDL/WhatsNew create mode 100644 SDL/acinclude.m4 create mode 100644 SDL/autogen.sh create mode 100644 SDL/build-scripts/config.guess create mode 100644 SDL/build-scripts/config.sub create mode 100644 SDL/build-scripts/fatbuild.sh create mode 100644 SDL/build-scripts/install-sh create mode 100644 SDL/build-scripts/ltmain.sh create mode 100644 SDL/build-scripts/makedep.sh create mode 100644 SDL/build-scripts/mkinstalldirs create mode 100644 SDL/build-scripts/strip_fPIC.sh create mode 100644 SDL/configure.in create mode 100644 SDL/docs.html create mode 100644 SDL/docs/html/audio.html create mode 100644 SDL/docs/html/cdrom.html create mode 100644 SDL/docs/html/event.html create mode 100644 SDL/docs/html/eventfunctions.html create mode 100644 SDL/docs/html/eventstructures.html create mode 100644 SDL/docs/html/general.html create mode 100644 SDL/docs/html/guide.html create mode 100644 SDL/docs/html/guideaboutsdldoc.html create mode 100644 SDL/docs/html/guideaudioexamples.html create mode 100644 SDL/docs/html/guidebasicsinit.html create mode 100644 SDL/docs/html/guidecdromexamples.html create mode 100644 SDL/docs/html/guidecredits.html create mode 100644 SDL/docs/html/guideeventexamples.html create mode 100644 SDL/docs/html/guideexamples.html create mode 100644 SDL/docs/html/guideinput.html create mode 100644 SDL/docs/html/guideinputkeyboard.html create mode 100644 SDL/docs/html/guidepreface.html create mode 100644 SDL/docs/html/guidethebasics.html create mode 100644 SDL/docs/html/guidetimeexamples.html create mode 100644 SDL/docs/html/guidevideo.html create mode 100644 SDL/docs/html/guidevideoopengl.html create mode 100644 SDL/docs/html/index.html create mode 100644 SDL/docs/html/joystick.html create mode 100644 SDL/docs/html/reference.html create mode 100644 SDL/docs/html/sdlactiveevent.html create mode 100644 SDL/docs/html/sdladdtimer.html create mode 100644 SDL/docs/html/sdlaudiocvt.html create mode 100644 SDL/docs/html/sdlaudiospec.html create mode 100644 SDL/docs/html/sdlblitsurface.html create mode 100644 SDL/docs/html/sdlbuildaudiocvt.html create mode 100644 SDL/docs/html/sdlcd.html create mode 100644 SDL/docs/html/sdlcdclose.html create mode 100644 SDL/docs/html/sdlcdeject.html create mode 100644 SDL/docs/html/sdlcdname.html create mode 100644 SDL/docs/html/sdlcdnumdrives.html create mode 100644 SDL/docs/html/sdlcdopen.html create mode 100644 SDL/docs/html/sdlcdpause.html create mode 100644 SDL/docs/html/sdlcdplay.html create mode 100644 SDL/docs/html/sdlcdplaytracks.html create mode 100644 SDL/docs/html/sdlcdresume.html create mode 100644 SDL/docs/html/sdlcdstatus.html create mode 100644 SDL/docs/html/sdlcdstop.html create mode 100644 SDL/docs/html/sdlcdtrack.html create mode 100644 SDL/docs/html/sdlcloseaudio.html create mode 100644 SDL/docs/html/sdlcolor.html create mode 100644 SDL/docs/html/sdlcondbroadcast.html create mode 100644 SDL/docs/html/sdlcondsignal.html create mode 100644 SDL/docs/html/sdlcondwait.html create mode 100644 SDL/docs/html/sdlcondwaittimeout.html create mode 100644 SDL/docs/html/sdlconvertaudio.html create mode 100644 SDL/docs/html/sdlconvertsurface.html create mode 100644 SDL/docs/html/sdlcreatecond.html create mode 100644 SDL/docs/html/sdlcreatecursor.html create mode 100644 SDL/docs/html/sdlcreatemutex.html create mode 100644 SDL/docs/html/sdlcreatergbsurface.html create mode 100644 SDL/docs/html/sdlcreatergbsurfacefrom.html create mode 100644 SDL/docs/html/sdlcreatesemaphore.html create mode 100644 SDL/docs/html/sdlcreatethread.html create mode 100644 SDL/docs/html/sdlcreateyuvoverlay.html create mode 100644 SDL/docs/html/sdldelay.html create mode 100644 SDL/docs/html/sdldestroycond.html create mode 100644 SDL/docs/html/sdldestroymutex.html create mode 100644 SDL/docs/html/sdldestroysemaphore.html create mode 100644 SDL/docs/html/sdldisplayformat.html create mode 100644 SDL/docs/html/sdldisplayformatalpha.html create mode 100644 SDL/docs/html/sdldisplayyuvoverlay.html create mode 100644 SDL/docs/html/sdlenablekeyrepeat.html create mode 100644 SDL/docs/html/sdlenableunicode.html create mode 100644 SDL/docs/html/sdlenvvars.html create mode 100644 SDL/docs/html/sdlevent.html create mode 100644 SDL/docs/html/sdleventstate.html create mode 100644 SDL/docs/html/sdlexposeevent.html create mode 100644 SDL/docs/html/sdlfillrect.html create mode 100644 SDL/docs/html/sdlflip.html create mode 100644 SDL/docs/html/sdlfreecursor.html create mode 100644 SDL/docs/html/sdlfreesurface.html create mode 100644 SDL/docs/html/sdlfreewav.html create mode 100644 SDL/docs/html/sdlfreeyuvoverlay.html create mode 100644 SDL/docs/html/sdlgetappstate.html create mode 100644 SDL/docs/html/sdlgetaudiostatus.html create mode 100644 SDL/docs/html/sdlgetcliprect.html create mode 100644 SDL/docs/html/sdlgetcursor.html create mode 100644 SDL/docs/html/sdlgeterror.html create mode 100644 SDL/docs/html/sdlgeteventfilter.html create mode 100644 SDL/docs/html/sdlgetgammaramp.html create mode 100644 SDL/docs/html/sdlgetkeyname.html create mode 100644 SDL/docs/html/sdlgetkeystate.html create mode 100644 SDL/docs/html/sdlgetmodstate.html create mode 100644 SDL/docs/html/sdlgetmousestate.html create mode 100644 SDL/docs/html/sdlgetrelativemousestate.html create mode 100644 SDL/docs/html/sdlgetrgb.html create mode 100644 SDL/docs/html/sdlgetrgba.html create mode 100644 SDL/docs/html/sdlgetthreadid.html create mode 100644 SDL/docs/html/sdlgetticks.html create mode 100644 SDL/docs/html/sdlgetvideoinfo.html create mode 100644 SDL/docs/html/sdlgetvideosurface.html create mode 100644 SDL/docs/html/sdlglattr.html create mode 100644 SDL/docs/html/sdlglgetattribute.html create mode 100644 SDL/docs/html/sdlglgetprocaddress.html create mode 100644 SDL/docs/html/sdlglloadlibrary.html create mode 100644 SDL/docs/html/sdlglsetattribute.html create mode 100644 SDL/docs/html/sdlglswapbuffers.html create mode 100644 SDL/docs/html/sdlinit.html create mode 100644 SDL/docs/html/sdlinitsubsystem.html create mode 100644 SDL/docs/html/sdljoyaxisevent.html create mode 100644 SDL/docs/html/sdljoyballevent.html create mode 100644 SDL/docs/html/sdljoybuttonevent.html create mode 100644 SDL/docs/html/sdljoyhatevent.html create mode 100644 SDL/docs/html/sdljoystickclose.html create mode 100644 SDL/docs/html/sdljoystickeventstate.html create mode 100644 SDL/docs/html/sdljoystickgetaxis.html create mode 100644 SDL/docs/html/sdljoystickgetball.html create mode 100644 SDL/docs/html/sdljoystickgetbutton.html create mode 100644 SDL/docs/html/sdljoystickgethat.html create mode 100644 SDL/docs/html/sdljoystickindex.html create mode 100644 SDL/docs/html/sdljoystickname.html create mode 100644 SDL/docs/html/sdljoysticknumaxes.html create mode 100644 SDL/docs/html/sdljoysticknumballs.html create mode 100644 SDL/docs/html/sdljoysticknumbuttons.html create mode 100644 SDL/docs/html/sdljoysticknumhats.html create mode 100644 SDL/docs/html/sdljoystickopen.html create mode 100644 SDL/docs/html/sdljoystickopened.html create mode 100644 SDL/docs/html/sdljoystickupdate.html create mode 100644 SDL/docs/html/sdlkey.html create mode 100644 SDL/docs/html/sdlkeyboardevent.html create mode 100644 SDL/docs/html/sdlkeysym.html create mode 100644 SDL/docs/html/sdlkillthread.html create mode 100644 SDL/docs/html/sdllistmodes.html create mode 100644 SDL/docs/html/sdlloadbmp.html create mode 100644 SDL/docs/html/sdlloadwav.html create mode 100644 SDL/docs/html/sdllockaudio.html create mode 100644 SDL/docs/html/sdllocksurface.html create mode 100644 SDL/docs/html/sdllockyuvoverlay.html create mode 100644 SDL/docs/html/sdlmaprgb.html create mode 100644 SDL/docs/html/sdlmaprgba.html create mode 100644 SDL/docs/html/sdlmixaudio.html create mode 100644 SDL/docs/html/sdlmousebuttonevent.html create mode 100644 SDL/docs/html/sdlmousemotionevent.html create mode 100644 SDL/docs/html/sdlmutexp.html create mode 100644 SDL/docs/html/sdlmutexv.html create mode 100644 SDL/docs/html/sdlnumjoysticks.html create mode 100644 SDL/docs/html/sdlopenaudio.html create mode 100644 SDL/docs/html/sdloverlay.html create mode 100644 SDL/docs/html/sdlpalette.html create mode 100644 SDL/docs/html/sdlpauseaudio.html create mode 100644 SDL/docs/html/sdlpeepevents.html create mode 100644 SDL/docs/html/sdlpixelformat.html create mode 100644 SDL/docs/html/sdlpollevent.html create mode 100644 SDL/docs/html/sdlpumpevents.html create mode 100644 SDL/docs/html/sdlpushevent.html create mode 100644 SDL/docs/html/sdlquit.html create mode 100644 SDL/docs/html/sdlquitevent.html create mode 100644 SDL/docs/html/sdlquitsubsystem.html create mode 100644 SDL/docs/html/sdlrect.html create mode 100644 SDL/docs/html/sdlremovetimer.html create mode 100644 SDL/docs/html/sdlresizeevent.html create mode 100644 SDL/docs/html/sdlsavebmp.html create mode 100644 SDL/docs/html/sdlsempost.html create mode 100644 SDL/docs/html/sdlsemtrywait.html create mode 100644 SDL/docs/html/sdlsemvalue.html create mode 100644 SDL/docs/html/sdlsemwait.html create mode 100644 SDL/docs/html/sdlsemwaittimeout.html create mode 100644 SDL/docs/html/sdlsetalpha.html create mode 100644 SDL/docs/html/sdlsetcliprect.html create mode 100644 SDL/docs/html/sdlsetcolorkey.html create mode 100644 SDL/docs/html/sdlsetcolors.html create mode 100644 SDL/docs/html/sdlsetcursor.html create mode 100644 SDL/docs/html/sdlseteventfilter.html create mode 100644 SDL/docs/html/sdlsetgamma.html create mode 100644 SDL/docs/html/sdlsetgammaramp.html create mode 100644 SDL/docs/html/sdlsetmodstate.html create mode 100644 SDL/docs/html/sdlsetpalette.html create mode 100644 SDL/docs/html/sdlsettimer.html create mode 100644 SDL/docs/html/sdlsetvideomode.html create mode 100644 SDL/docs/html/sdlshowcursor.html create mode 100644 SDL/docs/html/sdlsurface.html create mode 100644 SDL/docs/html/sdlsyswmevent.html create mode 100644 SDL/docs/html/sdlthreadid.html create mode 100644 SDL/docs/html/sdlunlockaudio.html create mode 100644 SDL/docs/html/sdlunlocksurface.html create mode 100644 SDL/docs/html/sdlunlockyuvoverlay.html create mode 100644 SDL/docs/html/sdlupdaterect.html create mode 100644 SDL/docs/html/sdlupdaterects.html create mode 100644 SDL/docs/html/sdluserevent.html create mode 100644 SDL/docs/html/sdlvideodrivername.html create mode 100644 SDL/docs/html/sdlvideoinfo.html create mode 100644 SDL/docs/html/sdlvideomodeok.html create mode 100644 SDL/docs/html/sdlwaitevent.html create mode 100644 SDL/docs/html/sdlwaitthread.html create mode 100644 SDL/docs/html/sdlwarpmouse.html create mode 100644 SDL/docs/html/sdlwasinit.html create mode 100644 SDL/docs/html/sdlwmgetcaption.html create mode 100644 SDL/docs/html/sdlwmgrabinput.html create mode 100644 SDL/docs/html/sdlwmiconifywindow.html create mode 100644 SDL/docs/html/sdlwmsetcaption.html create mode 100644 SDL/docs/html/sdlwmseticon.html create mode 100644 SDL/docs/html/sdlwmtogglefullscreen.html create mode 100644 SDL/docs/html/thread.html create mode 100644 SDL/docs/html/time.html create mode 100644 SDL/docs/html/video.html create mode 100644 SDL/docs/html/wm.html create mode 100644 SDL/docs/images/rainbow.gif create mode 100644 SDL/docs/index.html create mode 100644 SDL/docs/man3/SDLKey.3 create mode 100644 SDL/docs/man3/SDL_ActiveEvent.3 create mode 100644 SDL/docs/man3/SDL_AddTimer.3 create mode 100644 SDL/docs/man3/SDL_AudioCVT.3 create mode 100644 SDL/docs/man3/SDL_AudioSpec.3 create mode 100644 SDL/docs/man3/SDL_BlitSurface.3 create mode 100644 SDL/docs/man3/SDL_BuildAudioCVT.3 create mode 100644 SDL/docs/man3/SDL_CD.3 create mode 100644 SDL/docs/man3/SDL_CDClose.3 create mode 100644 SDL/docs/man3/SDL_CDEject.3 create mode 100644 SDL/docs/man3/SDL_CDName.3 create mode 100644 SDL/docs/man3/SDL_CDNumDrives.3 create mode 100644 SDL/docs/man3/SDL_CDOpen.3 create mode 100644 SDL/docs/man3/SDL_CDPause.3 create mode 100644 SDL/docs/man3/SDL_CDPlay.3 create mode 100644 SDL/docs/man3/SDL_CDPlayTracks.3 create mode 100644 SDL/docs/man3/SDL_CDResume.3 create mode 100644 SDL/docs/man3/SDL_CDStatus.3 create mode 100644 SDL/docs/man3/SDL_CDStop.3 create mode 100644 SDL/docs/man3/SDL_CDtrack.3 create mode 100644 SDL/docs/man3/SDL_CloseAudio.3 create mode 100644 SDL/docs/man3/SDL_Color.3 create mode 100644 SDL/docs/man3/SDL_CondBroadcast.3 create mode 100644 SDL/docs/man3/SDL_CondSignal.3 create mode 100644 SDL/docs/man3/SDL_CondWait.3 create mode 100644 SDL/docs/man3/SDL_CondWaitTimeout.3 create mode 100644 SDL/docs/man3/SDL_ConvertAudio.3 create mode 100644 SDL/docs/man3/SDL_ConvertSurface.3 create mode 100644 SDL/docs/man3/SDL_CreateCond.3 create mode 100644 SDL/docs/man3/SDL_CreateCursor.3 create mode 100644 SDL/docs/man3/SDL_CreateMutex.3 create mode 100644 SDL/docs/man3/SDL_CreateRGBSurface.3 create mode 100644 SDL/docs/man3/SDL_CreateRGBSurfaceFrom.3 create mode 100644 SDL/docs/man3/SDL_CreateSemaphore.3 create mode 100644 SDL/docs/man3/SDL_CreateThread.3 create mode 100644 SDL/docs/man3/SDL_CreateYUVOverlay.3 create mode 100644 SDL/docs/man3/SDL_Delay.3 create mode 100644 SDL/docs/man3/SDL_DestroyCond.3 create mode 100644 SDL/docs/man3/SDL_DestroyMutex.3 create mode 100644 SDL/docs/man3/SDL_DestroySemaphore.3 create mode 100644 SDL/docs/man3/SDL_DisplayFormat.3 create mode 100644 SDL/docs/man3/SDL_DisplayFormatAlpha.3 create mode 100644 SDL/docs/man3/SDL_DisplayYUVOverlay.3 create mode 100644 SDL/docs/man3/SDL_EnableKeyRepeat.3 create mode 100644 SDL/docs/man3/SDL_EnableUNICODE.3 create mode 100644 SDL/docs/man3/SDL_Event.3 create mode 100644 SDL/docs/man3/SDL_EventState.3 create mode 100644 SDL/docs/man3/SDL_ExposeEvent.3 create mode 100644 SDL/docs/man3/SDL_FillRect.3 create mode 100644 SDL/docs/man3/SDL_Flip.3 create mode 100644 SDL/docs/man3/SDL_FreeCursor.3 create mode 100644 SDL/docs/man3/SDL_FreeSurface.3 create mode 100644 SDL/docs/man3/SDL_FreeWAV.3 create mode 100644 SDL/docs/man3/SDL_FreeYUVOverlay.3 create mode 100644 SDL/docs/man3/SDL_GL_GetAttribute.3 create mode 100644 SDL/docs/man3/SDL_GL_GetProcAddress.3 create mode 100644 SDL/docs/man3/SDL_GL_LoadLibrary.3 create mode 100644 SDL/docs/man3/SDL_GL_SetAttribute.3 create mode 100644 SDL/docs/man3/SDL_GL_SwapBuffers.3 create mode 100644 SDL/docs/man3/SDL_GLattr.3 create mode 100644 SDL/docs/man3/SDL_GetAppState.3 create mode 100644 SDL/docs/man3/SDL_GetAudioStatus.3 create mode 100644 SDL/docs/man3/SDL_GetClipRect.3 create mode 100644 SDL/docs/man3/SDL_GetCursor.3 create mode 100644 SDL/docs/man3/SDL_GetError.3 create mode 100644 SDL/docs/man3/SDL_GetEventFilter.3 create mode 100644 SDL/docs/man3/SDL_GetGamma.3 create mode 100644 SDL/docs/man3/SDL_GetGammaRamp.3 create mode 100644 SDL/docs/man3/SDL_GetKeyName.3 create mode 100644 SDL/docs/man3/SDL_GetKeyState.3 create mode 100644 SDL/docs/man3/SDL_GetModState.3 create mode 100644 SDL/docs/man3/SDL_GetMouseState.3 create mode 100644 SDL/docs/man3/SDL_GetRGB.3 create mode 100644 SDL/docs/man3/SDL_GetRGBA.3 create mode 100644 SDL/docs/man3/SDL_GetRelativeMouseState.3 create mode 100644 SDL/docs/man3/SDL_GetThreadID.3 create mode 100644 SDL/docs/man3/SDL_GetTicks.3 create mode 100644 SDL/docs/man3/SDL_GetVideoInfo.3 create mode 100644 SDL/docs/man3/SDL_GetVideoSurface.3 create mode 100644 SDL/docs/man3/SDL_Init.3 create mode 100644 SDL/docs/man3/SDL_InitSubSystem.3 create mode 100644 SDL/docs/man3/SDL_JoyAxisEvent.3 create mode 100644 SDL/docs/man3/SDL_JoyBallEvent.3 create mode 100644 SDL/docs/man3/SDL_JoyButtonEvent.3 create mode 100644 SDL/docs/man3/SDL_JoyHatEvent.3 create mode 100644 SDL/docs/man3/SDL_JoystickClose.3 create mode 100644 SDL/docs/man3/SDL_JoystickEventState.3 create mode 100644 SDL/docs/man3/SDL_JoystickGetAxis.3 create mode 100644 SDL/docs/man3/SDL_JoystickGetBall.3 create mode 100644 SDL/docs/man3/SDL_JoystickGetButton.3 create mode 100644 SDL/docs/man3/SDL_JoystickGetHat.3 create mode 100644 SDL/docs/man3/SDL_JoystickIndex.3 create mode 100644 SDL/docs/man3/SDL_JoystickName.3 create mode 100644 SDL/docs/man3/SDL_JoystickNumAxes.3 create mode 100644 SDL/docs/man3/SDL_JoystickNumBalls.3 create mode 100644 SDL/docs/man3/SDL_JoystickNumButtons.3 create mode 100644 SDL/docs/man3/SDL_JoystickNumHats.3 create mode 100644 SDL/docs/man3/SDL_JoystickOpen.3 create mode 100644 SDL/docs/man3/SDL_JoystickOpened.3 create mode 100644 SDL/docs/man3/SDL_JoystickUpdate.3 create mode 100644 SDL/docs/man3/SDL_KeyboardEvent.3 create mode 100644 SDL/docs/man3/SDL_KillThread.3 create mode 100644 SDL/docs/man3/SDL_ListModes.3 create mode 100644 SDL/docs/man3/SDL_LoadBMP.3 create mode 100644 SDL/docs/man3/SDL_LoadWAV.3 create mode 100644 SDL/docs/man3/SDL_LockAudio.3 create mode 100644 SDL/docs/man3/SDL_LockSurface.3 create mode 100644 SDL/docs/man3/SDL_LockYUVOverlay.3 create mode 100644 SDL/docs/man3/SDL_MapRGB.3 create mode 100644 SDL/docs/man3/SDL_MapRGBA.3 create mode 100644 SDL/docs/man3/SDL_MixAudio.3 create mode 100644 SDL/docs/man3/SDL_MouseButtonEvent.3 create mode 100644 SDL/docs/man3/SDL_MouseMotionEvent.3 create mode 100644 SDL/docs/man3/SDL_NumJoysticks.3 create mode 100644 SDL/docs/man3/SDL_OpenAudio.3 create mode 100644 SDL/docs/man3/SDL_Overlay.3 create mode 100644 SDL/docs/man3/SDL_Palette.3 create mode 100644 SDL/docs/man3/SDL_PauseAudio.3 create mode 100644 SDL/docs/man3/SDL_PeepEvents.3 create mode 100644 SDL/docs/man3/SDL_PixelFormat.3 create mode 100644 SDL/docs/man3/SDL_PollEvent.3 create mode 100644 SDL/docs/man3/SDL_PumpEvents.3 create mode 100644 SDL/docs/man3/SDL_PushEvent.3 create mode 100644 SDL/docs/man3/SDL_Quit.3 create mode 100644 SDL/docs/man3/SDL_QuitEvent.3 create mode 100644 SDL/docs/man3/SDL_QuitSubSystem.3 create mode 100644 SDL/docs/man3/SDL_RWFromFile.3 create mode 100644 SDL/docs/man3/SDL_Rect.3 create mode 100644 SDL/docs/man3/SDL_RemoveTimer.3 create mode 100644 SDL/docs/man3/SDL_ResizeEvent.3 create mode 100644 SDL/docs/man3/SDL_SaveBMP.3 create mode 100644 SDL/docs/man3/SDL_SemPost.3 create mode 100644 SDL/docs/man3/SDL_SemTryWait.3 create mode 100644 SDL/docs/man3/SDL_SemValue.3 create mode 100644 SDL/docs/man3/SDL_SemWait.3 create mode 100644 SDL/docs/man3/SDL_SemWaitTimeout.3 create mode 100644 SDL/docs/man3/SDL_SetAlpha.3 create mode 100644 SDL/docs/man3/SDL_SetClipRect.3 create mode 100644 SDL/docs/man3/SDL_SetColorKey.3 create mode 100644 SDL/docs/man3/SDL_SetColors.3 create mode 100644 SDL/docs/man3/SDL_SetCursor.3 create mode 100644 SDL/docs/man3/SDL_SetEventFilter.3 create mode 100644 SDL/docs/man3/SDL_SetGamma.3 create mode 100644 SDL/docs/man3/SDL_SetGammaRamp.3 create mode 100644 SDL/docs/man3/SDL_SetModState.3 create mode 100644 SDL/docs/man3/SDL_SetPalette.3 create mode 100644 SDL/docs/man3/SDL_SetTimer.3 create mode 100644 SDL/docs/man3/SDL_SetVideoMode.3 create mode 100644 SDL/docs/man3/SDL_ShowCursor.3 create mode 100644 SDL/docs/man3/SDL_Surface.3 create mode 100644 SDL/docs/man3/SDL_SysWMEvent.3 create mode 100644 SDL/docs/man3/SDL_ThreadID.3 create mode 100644 SDL/docs/man3/SDL_UnlockAudio.3 create mode 100644 SDL/docs/man3/SDL_UnlockSurface.3 create mode 100644 SDL/docs/man3/SDL_UnlockYUVOverlay.3 create mode 100644 SDL/docs/man3/SDL_UpdateRect.3 create mode 100644 SDL/docs/man3/SDL_UpdateRects.3 create mode 100644 SDL/docs/man3/SDL_UserEvent.3 create mode 100644 SDL/docs/man3/SDL_VideoDriverName.3 create mode 100644 SDL/docs/man3/SDL_VideoInfo.3 create mode 100644 SDL/docs/man3/SDL_VideoModeOK.3 create mode 100644 SDL/docs/man3/SDL_WM_GetCaption.3 create mode 100644 SDL/docs/man3/SDL_WM_GrabInput.3 create mode 100644 SDL/docs/man3/SDL_WM_IconifyWindow.3 create mode 100644 SDL/docs/man3/SDL_WM_SetCaption.3 create mode 100644 SDL/docs/man3/SDL_WM_SetIcon.3 create mode 100644 SDL/docs/man3/SDL_WM_ToggleFullScreen.3 create mode 100644 SDL/docs/man3/SDL_WaitEvent.3 create mode 100644 SDL/docs/man3/SDL_WaitThread.3 create mode 100644 SDL/docs/man3/SDL_WarpMouse.3 create mode 100644 SDL/docs/man3/SDL_WasInit.3 create mode 100644 SDL/docs/man3/SDL_keysym.3 create mode 100644 SDL/docs/man3/SDL_mutexP.3 create mode 100644 SDL/docs/man3/SDL_mutexV.3 create mode 100644 SDL/sdl-config.in create mode 100644 SDL/sdl.m4 create mode 100644 SDL/sdl.pc.in create mode 100644 SDL/src/SDL.c create mode 100644 SDL/src/SDL_error.c create mode 100644 SDL/src/SDL_error_c.h create mode 100644 SDL/src/SDL_fatal.c create mode 100644 SDL/src/SDL_fatal.h create mode 100644 SDL/src/audio/SDL_audio.c create mode 100644 SDL/src/audio/SDL_audio_c.h create mode 100644 SDL/src/audio/SDL_audiocvt.c create mode 100644 SDL/src/audio/SDL_audiodev.c create mode 100644 SDL/src/audio/SDL_audiodev_c.h create mode 100644 SDL/src/audio/SDL_audiomem.h create mode 100644 SDL/src/audio/SDL_mixer.c create mode 100644 SDL/src/audio/SDL_mixer_MMX.c create mode 100644 SDL/src/audio/SDL_mixer_MMX.h create mode 100644 SDL/src/audio/SDL_mixer_MMX_VC.c create mode 100644 SDL/src/audio/SDL_mixer_MMX_VC.h create mode 100644 SDL/src/audio/SDL_mixer_m68k.c create mode 100644 SDL/src/audio/SDL_mixer_m68k.h create mode 100644 SDL/src/audio/SDL_sysaudio.h create mode 100644 SDL/src/audio/SDL_wave.c create mode 100644 SDL/src/audio/SDL_wave.h create mode 100644 SDL/src/audio/alsa/SDL_alsa_audio.c create mode 100644 SDL/src/audio/alsa/SDL_alsa_audio.h create mode 100644 SDL/src/audio/arts/SDL_artsaudio.c create mode 100644 SDL/src/audio/arts/SDL_artsaudio.h create mode 100644 SDL/src/audio/baudio/SDL_beaudio.cc create mode 100644 SDL/src/audio/baudio/SDL_beaudio.h create mode 100644 SDL/src/audio/bsd/SDL_bsdaudio.c create mode 100644 SDL/src/audio/bsd/SDL_bsdaudio.h create mode 100644 SDL/src/audio/dart/SDL_dart.c create mode 100644 SDL/src/audio/dart/SDL_dart.h create mode 100644 SDL/src/audio/dc/SDL_dcaudio.c create mode 100644 SDL/src/audio/dc/SDL_dcaudio.h create mode 100644 SDL/src/audio/dc/aica.c create mode 100644 SDL/src/audio/dc/aica.h create mode 100644 SDL/src/audio/disk/SDL_diskaudio.c create mode 100644 SDL/src/audio/disk/SDL_diskaudio.h create mode 100644 SDL/src/audio/dma/SDL_dmaaudio.c create mode 100644 SDL/src/audio/dma/SDL_dmaaudio.h create mode 100644 SDL/src/audio/dmedia/SDL_irixaudio.c create mode 100644 SDL/src/audio/dmedia/SDL_irixaudio.h create mode 100644 SDL/src/audio/dsp/SDL_dspaudio.c create mode 100644 SDL/src/audio/dsp/SDL_dspaudio.h create mode 100644 SDL/src/audio/dummy/SDL_dummyaudio.c create mode 100644 SDL/src/audio/dummy/SDL_dummyaudio.h create mode 100644 SDL/src/audio/esd/SDL_esdaudio.c create mode 100644 SDL/src/audio/esd/SDL_esdaudio.h create mode 100644 SDL/src/audio/macosx/SDL_coreaudio.c create mode 100644 SDL/src/audio/macosx/SDL_coreaudio.h create mode 100644 SDL/src/audio/macrom/SDL_romaudio.c create mode 100644 SDL/src/audio/macrom/SDL_romaudio.h create mode 100644 SDL/src/audio/mint/SDL_mintaudio.c create mode 100644 SDL/src/audio/mint/SDL_mintaudio.h create mode 100644 SDL/src/audio/mint/SDL_mintaudio_dma8.c create mode 100644 SDL/src/audio/mint/SDL_mintaudio_dma8.h create mode 100644 SDL/src/audio/mint/SDL_mintaudio_gsxb.c create mode 100644 SDL/src/audio/mint/SDL_mintaudio_gsxb.h create mode 100644 SDL/src/audio/mint/SDL_mintaudio_it.S create mode 100644 SDL/src/audio/mint/SDL_mintaudio_mcsn.c create mode 100644 SDL/src/audio/mint/SDL_mintaudio_mcsn.h create mode 100644 SDL/src/audio/mint/SDL_mintaudio_stfa.c create mode 100644 SDL/src/audio/mint/SDL_mintaudio_stfa.h create mode 100644 SDL/src/audio/mint/SDL_mintaudio_xbios.c create mode 100644 SDL/src/audio/mme/SDL_mmeaudio.c create mode 100644 SDL/src/audio/mme/SDL_mmeaudio.h create mode 100644 SDL/src/audio/nas/SDL_nasaudio.c create mode 100644 SDL/src/audio/nas/SDL_nasaudio.h create mode 100644 SDL/src/audio/nds/SDL_ndsaudio.c create mode 100644 SDL/src/audio/nds/SDL_ndsaudio.h create mode 100644 SDL/src/audio/nds/sound9.c create mode 100644 SDL/src/audio/nds/soundcommon.h create mode 100644 SDL/src/audio/nto/SDL_nto_audio.c create mode 100644 SDL/src/audio/nto/SDL_nto_audio.h create mode 100644 SDL/src/audio/paudio/SDL_paudio.c create mode 100644 SDL/src/audio/paudio/SDL_paudio.h create mode 100644 SDL/src/audio/pulse/SDL_pulseaudio.c create mode 100644 SDL/src/audio/pulse/SDL_pulseaudio.h create mode 100644 SDL/src/audio/sun/SDL_sunaudio.c create mode 100644 SDL/src/audio/sun/SDL_sunaudio.h create mode 100644 SDL/src/audio/symbian/SDL_epocaudio.cpp create mode 100644 SDL/src/audio/symbian/SDL_epocaudio.h create mode 100644 SDL/src/audio/symbian/streamplayer.cpp create mode 100644 SDL/src/audio/symbian/streamplayer.h create mode 100644 SDL/src/audio/ums/SDL_umsaudio.c create mode 100644 SDL/src/audio/ums/SDL_umsaudio.h create mode 100644 SDL/src/audio/wii/SDL_wiiaudio.c create mode 100644 SDL/src/audio/wii/SDL_wiiaudio.h create mode 100644 SDL/src/audio/windib/SDL_dibaudio.c create mode 100644 SDL/src/audio/windib/SDL_dibaudio.h create mode 100644 SDL/src/audio/windx5/SDL_dx5audio.c create mode 100644 SDL/src/audio/windx5/SDL_dx5audio.h create mode 100644 SDL/src/audio/windx5/directx.h create mode 100644 SDL/src/cdrom/SDL_cdrom.c create mode 100644 SDL/src/cdrom/SDL_syscdrom.h create mode 100644 SDL/src/cdrom/aix/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/beos/SDL_syscdrom.cc create mode 100644 SDL/src/cdrom/bsdi/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/dc/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/dummy/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/freebsd/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/linux/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/macos/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/macos/SDL_syscdrom_c.h create mode 100644 SDL/src/cdrom/macosx/AudioFilePlayer.c create mode 100644 SDL/src/cdrom/macosx/AudioFilePlayer.h create mode 100644 SDL/src/cdrom/macosx/AudioFileReaderThread.c create mode 100644 SDL/src/cdrom/macosx/CDPlayer.c create mode 100644 SDL/src/cdrom/macosx/CDPlayer.h create mode 100644 SDL/src/cdrom/macosx/SDLOSXCAGuard.c create mode 100644 SDL/src/cdrom/macosx/SDLOSXCAGuard.h create mode 100644 SDL/src/cdrom/macosx/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/macosx/SDL_syscdrom_c.h create mode 100644 SDL/src/cdrom/mint/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/openbsd/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/os2/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/osf/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/qnx/SDL_syscdrom.c create mode 100644 SDL/src/cdrom/win32/SDL_syscdrom.c create mode 100644 SDL/src/cpuinfo/SDL_cpuinfo.c create mode 100644 SDL/src/events/SDL_active.c create mode 100644 SDL/src/events/SDL_events.c create mode 100644 SDL/src/events/SDL_events_c.h create mode 100644 SDL/src/events/SDL_expose.c create mode 100644 SDL/src/events/SDL_keyboard.c create mode 100644 SDL/src/events/SDL_mouse.c create mode 100644 SDL/src/events/SDL_quit.c create mode 100644 SDL/src/events/SDL_resize.c create mode 100644 SDL/src/events/SDL_sysevents.h create mode 100644 SDL/src/file/SDL_rwops.c create mode 100644 SDL/src/file/wii/SDL_wiirwops.c create mode 100644 SDL/src/file/wii/diskio.c create mode 100644 SDL/src/file/wii/diskio.h create mode 100644 SDL/src/file/wii/integer.h create mode 100644 SDL/src/hermes/COPYING.LIB create mode 100644 SDL/src/hermes/HeadMMX.h create mode 100644 SDL/src/hermes/HeadX86.h create mode 100644 SDL/src/hermes/README create mode 100644 SDL/src/hermes/common.inc create mode 100644 SDL/src/hermes/mmx_main.asm create mode 100644 SDL/src/hermes/mmxp2_32.asm create mode 100644 SDL/src/hermes/x86_main.asm create mode 100644 SDL/src/hermes/x86p_16.asm create mode 100644 SDL/src/hermes/x86p_32.asm create mode 100644 SDL/src/joystick/SDL_joystick.c create mode 100644 SDL/src/joystick/SDL_joystick_c.h create mode 100644 SDL/src/joystick/SDL_sysjoystick.h create mode 100644 SDL/src/joystick/beos/SDL_bejoystick.cc create mode 100644 SDL/src/joystick/bsd/SDL_sysjoystick.c create mode 100644 SDL/src/joystick/darwin/10.3.9-FIX/IOHIDLib.h create mode 100644 SDL/src/joystick/darwin/SDL_sysjoystick.c create mode 100644 SDL/src/joystick/dc/SDL_sysjoystick.c create mode 100644 SDL/src/joystick/dummy/SDL_sysjoystick.c create mode 100644 SDL/src/joystick/linux/SDL_sysjoystick.c create mode 100644 SDL/src/joystick/macos/SDL_sysjoystick.c create mode 100644 SDL/src/joystick/mint/SDL_sysjoystick.c create mode 100644 SDL/src/joystick/nds/SDL_sysjoystick.c create mode 100644 SDL/src/joystick/os2/SDL_sysjoystick.c create mode 100644 SDL/src/joystick/os2/joyos2.h create mode 100644 SDL/src/joystick/riscos/SDL_sysjoystick.c create mode 100644 SDL/src/joystick/wii/SDL_sysjoystick.c create mode 100644 SDL/src/joystick/win32/SDL_mmjoystick.c create mode 100644 SDL/src/loadso/beos/SDL_sysloadso.c create mode 100644 SDL/src/loadso/dlopen/SDL_sysloadso.c create mode 100644 SDL/src/loadso/dummy/SDL_sysloadso.c create mode 100644 SDL/src/loadso/macos/SDL_sysloadso.c create mode 100644 SDL/src/loadso/macosx/SDL_dlcompat.c create mode 100644 SDL/src/loadso/mint/SDL_sysloadso.c create mode 100644 SDL/src/loadso/os2/SDL_sysloadso.c create mode 100644 SDL/src/loadso/win32/SDL_sysloadso.c create mode 100644 SDL/src/main/beos/SDL_BeApp.cc create mode 100644 SDL/src/main/beos/SDL_BeApp.h create mode 100644 SDL/src/main/dummy/SDL_dummy_main.c create mode 100644 SDL/src/main/macos/SDL.r create mode 100644 SDL/src/main/macos/SDL.shlib.r create mode 100644 SDL/src/main/macos/SDL_main.c create mode 100644 SDL/src/main/macos/SIZE.r create mode 100644 SDL/src/main/macos/exports/Makefile create mode 100644 SDL/src/main/macos/exports/SDL.x create mode 100644 SDL/src/main/macos/exports/gendef.pl create mode 100644 SDL/src/main/macosx/Info.plist.in create mode 100644 SDL/src/main/macosx/SDLMain.h create mode 100644 SDL/src/main/macosx/SDLMain.m create mode 100644 SDL/src/main/macosx/SDLMain.nib/classes.nib create mode 100644 SDL/src/main/macosx/SDLMain.nib/info.nib create mode 100644 SDL/src/main/macosx/SDLMain.nib/objects.nib create mode 100644 SDL/src/main/macosx/info.nib create mode 100644 SDL/src/main/qtopia/SDL_qtopia_main.cc create mode 100644 SDL/src/main/symbian/EKA1/SDL_main.cpp create mode 100644 SDL/src/main/symbian/EKA2/SDL_main.cpp create mode 100644 SDL/src/main/symbian/EKA2/sdlexe.cpp create mode 100644 SDL/src/main/symbian/EKA2/sdllib.cpp create mode 100644 SDL/src/main/symbian/EKA2/vectorbuffer.cpp create mode 100644 SDL/src/main/symbian/EKA2/vectorbuffer.h create mode 100644 SDL/src/main/wii/SDL_wii_main.c create mode 100644 SDL/src/main/win32/SDL_win32_main.c create mode 100644 SDL/src/main/win32/version.rc create mode 100644 SDL/src/stdlib/SDL_getenv.c create mode 100644 SDL/src/stdlib/SDL_iconv.c create mode 100644 SDL/src/stdlib/SDL_malloc.c create mode 100644 SDL/src/stdlib/SDL_qsort.c create mode 100644 SDL/src/stdlib/SDL_stdlib.c create mode 100644 SDL/src/stdlib/SDL_string.c create mode 100644 SDL/src/thread/SDL_systhread.h create mode 100644 SDL/src/thread/SDL_thread.c create mode 100644 SDL/src/thread/SDL_thread_c.h create mode 100644 SDL/src/thread/beos/SDL_syssem.c create mode 100644 SDL/src/thread/beos/SDL_systhread.c create mode 100644 SDL/src/thread/beos/SDL_systhread_c.h create mode 100644 SDL/src/thread/dc/SDL_syscond.c create mode 100644 SDL/src/thread/dc/SDL_syscond_c.h create mode 100644 SDL/src/thread/dc/SDL_sysmutex.c create mode 100644 SDL/src/thread/dc/SDL_sysmutex_c.h create mode 100644 SDL/src/thread/dc/SDL_syssem.c create mode 100644 SDL/src/thread/dc/SDL_syssem_c.h create mode 100644 SDL/src/thread/dc/SDL_systhread.c create mode 100644 SDL/src/thread/dc/SDL_systhread_c.h create mode 100644 SDL/src/thread/generic/SDL_syscond.c create mode 100644 SDL/src/thread/generic/SDL_sysmutex.c create mode 100644 SDL/src/thread/generic/SDL_sysmutex_c.h create mode 100644 SDL/src/thread/generic/SDL_syssem.c create mode 100644 SDL/src/thread/generic/SDL_systhread.c create mode 100644 SDL/src/thread/generic/SDL_systhread_c.h create mode 100644 SDL/src/thread/irix/SDL_syssem.c create mode 100644 SDL/src/thread/irix/SDL_systhread.c create mode 100644 SDL/src/thread/irix/SDL_systhread_c.h create mode 100644 SDL/src/thread/os2/SDL_syscond.c create mode 100644 SDL/src/thread/os2/SDL_syscond_c.h create mode 100644 SDL/src/thread/os2/SDL_sysmutex.c create mode 100644 SDL/src/thread/os2/SDL_syssem.c create mode 100644 SDL/src/thread/os2/SDL_systhread.c create mode 100644 SDL/src/thread/os2/SDL_systhread_c.h create mode 100644 SDL/src/thread/pth/SDL_syscond.c create mode 100644 SDL/src/thread/pth/SDL_sysmutex.c create mode 100644 SDL/src/thread/pth/SDL_sysmutex_c.h create mode 100644 SDL/src/thread/pth/SDL_systhread.c create mode 100644 SDL/src/thread/pth/SDL_systhread_c.h create mode 100644 SDL/src/thread/pthread/SDL_syscond.c create mode 100644 SDL/src/thread/pthread/SDL_sysmutex.c create mode 100644 SDL/src/thread/pthread/SDL_sysmutex_c.h create mode 100644 SDL/src/thread/pthread/SDL_syssem.c create mode 100644 SDL/src/thread/pthread/SDL_systhread.c create mode 100644 SDL/src/thread/pthread/SDL_systhread_c.h create mode 100644 SDL/src/thread/riscos/SDL_syscond.c create mode 100644 SDL/src/thread/riscos/SDL_sysmutex.c create mode 100644 SDL/src/thread/riscos/SDL_sysmutex_c.h create mode 100644 SDL/src/thread/riscos/SDL_syssem.c create mode 100644 SDL/src/thread/riscos/SDL_systhread.c create mode 100644 SDL/src/thread/riscos/SDL_systhread_c.h create mode 100644 SDL/src/thread/symbian/SDL_sysmutex.cpp create mode 100644 SDL/src/thread/symbian/SDL_syssem.cpp create mode 100644 SDL/src/thread/symbian/SDL_systhread.cpp create mode 100644 SDL/src/thread/symbian/SDL_systhread_c.h create mode 100644 SDL/src/thread/wii/SDL_syscond.c create mode 100644 SDL/src/thread/wii/SDL_sysmutex.c create mode 100644 SDL/src/thread/wii/SDL_sysmutex_c.h create mode 100644 SDL/src/thread/wii/SDL_syssem.c create mode 100644 SDL/src/thread/wii/SDL_systhread.c create mode 100644 SDL/src/thread/wii/SDL_systhread_c.h create mode 100644 SDL/src/thread/win32/SDL_sysmutex.c create mode 100644 SDL/src/thread/win32/SDL_syssem.c create mode 100644 SDL/src/thread/win32/SDL_systhread.c create mode 100644 SDL/src/thread/win32/SDL_systhread_c.h create mode 100644 SDL/src/thread/win32/win_ce_semaphore.c create mode 100644 SDL/src/thread/win32/win_ce_semaphore.h create mode 100644 SDL/src/timer/SDL_systimer.h create mode 100644 SDL/src/timer/SDL_timer.c create mode 100644 SDL/src/timer/SDL_timer_c.h create mode 100644 SDL/src/timer/beos/SDL_systimer.c create mode 100644 SDL/src/timer/dc/SDL_systimer.c create mode 100644 SDL/src/timer/dummy/SDL_systimer.c create mode 100644 SDL/src/timer/macos/FastTimes.c create mode 100644 SDL/src/timer/macos/FastTimes.h create mode 100644 SDL/src/timer/macos/SDL_MPWtimer.c create mode 100644 SDL/src/timer/macos/SDL_systimer.c create mode 100644 SDL/src/timer/mint/SDL_systimer.c create mode 100644 SDL/src/timer/mint/SDL_vbltimer.S create mode 100644 SDL/src/timer/mint/SDL_vbltimer_s.h create mode 100644 SDL/src/timer/nds/SDL_systimer.c create mode 100644 SDL/src/timer/os2/SDL_systimer.c create mode 100644 SDL/src/timer/riscos/SDL_systimer.c create mode 100644 SDL/src/timer/symbian/SDL_systimer.cpp create mode 100644 SDL/src/timer/unix/SDL_systimer.c create mode 100644 SDL/src/timer/wii/SDL_systimer.c create mode 100644 SDL/src/timer/win32/SDL_systimer.c create mode 100644 SDL/src/timer/wince/SDL_systimer.c create mode 100644 SDL/src/video/SDL_RLEaccel.c create mode 100644 SDL/src/video/SDL_RLEaccel_c.h create mode 100644 SDL/src/video/SDL_blit.c create mode 100644 SDL/src/video/SDL_blit.h create mode 100644 SDL/src/video/SDL_blit_0.c create mode 100644 SDL/src/video/SDL_blit_1.c create mode 100644 SDL/src/video/SDL_blit_A.c create mode 100644 SDL/src/video/SDL_blit_N.c create mode 100644 SDL/src/video/SDL_bmp.c create mode 100644 SDL/src/video/SDL_cursor.c create mode 100644 SDL/src/video/SDL_cursor_c.h create mode 100644 SDL/src/video/SDL_gamma.c create mode 100644 SDL/src/video/SDL_glfuncs.h create mode 100644 SDL/src/video/SDL_leaks.h create mode 100644 SDL/src/video/SDL_pixels.c create mode 100644 SDL/src/video/SDL_pixels_c.h create mode 100644 SDL/src/video/SDL_stretch.c create mode 100644 SDL/src/video/SDL_stretch_c.h create mode 100644 SDL/src/video/SDL_surface.c create mode 100644 SDL/src/video/SDL_sysvideo.h create mode 100644 SDL/src/video/SDL_video.c create mode 100644 SDL/src/video/SDL_yuv.c create mode 100644 SDL/src/video/SDL_yuv_mmx.c create mode 100644 SDL/src/video/SDL_yuv_sw.c create mode 100644 SDL/src/video/SDL_yuv_sw_c.h create mode 100644 SDL/src/video/SDL_yuvfuncs.h create mode 100644 SDL/src/video/Xext/README create mode 100644 SDL/src/video/Xext/XME/xme.c create mode 100644 SDL/src/video/Xext/Xinerama/Xinerama.c create mode 100644 SDL/src/video/Xext/Xv/Xv.c create mode 100644 SDL/src/video/Xext/Xv/Xvlibint.h create mode 100644 SDL/src/video/Xext/Xxf86dga/XF86DGA.c create mode 100644 SDL/src/video/Xext/Xxf86dga/XF86DGA2.c create mode 100644 SDL/src/video/Xext/Xxf86vm/XF86VMode.c create mode 100644 SDL/src/video/Xext/extensions/Xext.h create mode 100644 SDL/src/video/Xext/extensions/Xinerama.h create mode 100644 SDL/src/video/Xext/extensions/Xv.h create mode 100644 SDL/src/video/Xext/extensions/Xvlib.h create mode 100644 SDL/src/video/Xext/extensions/Xvproto.h create mode 100644 SDL/src/video/Xext/extensions/extutil.h create mode 100644 SDL/src/video/Xext/extensions/panoramiXext.h create mode 100644 SDL/src/video/Xext/extensions/panoramiXproto.h create mode 100644 SDL/src/video/Xext/extensions/xf86dga.h create mode 100644 SDL/src/video/Xext/extensions/xf86dga1.h create mode 100644 SDL/src/video/Xext/extensions/xf86dga1str.h create mode 100644 SDL/src/video/Xext/extensions/xf86dgastr.h create mode 100644 SDL/src/video/Xext/extensions/xf86vmode.h create mode 100644 SDL/src/video/Xext/extensions/xf86vmstr.h create mode 100644 SDL/src/video/Xext/extensions/xme.h create mode 100644 SDL/src/video/aalib/SDL_aaevents.c create mode 100644 SDL/src/video/aalib/SDL_aaevents_c.h create mode 100644 SDL/src/video/aalib/SDL_aamouse.c create mode 100644 SDL/src/video/aalib/SDL_aamouse_c.h create mode 100644 SDL/src/video/aalib/SDL_aavideo.c create mode 100644 SDL/src/video/aalib/SDL_aavideo.h create mode 100644 SDL/src/video/ataricommon/SDL_ataric2p.S create mode 100644 SDL/src/video/ataricommon/SDL_ataric2p_s.h create mode 100644 SDL/src/video/ataricommon/SDL_ataridevmouse.c create mode 100644 SDL/src/video/ataricommon/SDL_ataridevmouse_c.h create mode 100644 SDL/src/video/ataricommon/SDL_atarieddi.S create mode 100644 SDL/src/video/ataricommon/SDL_atarieddi_s.h create mode 100644 SDL/src/video/ataricommon/SDL_atarievents.c create mode 100644 SDL/src/video/ataricommon/SDL_atarievents_c.h create mode 100644 SDL/src/video/ataricommon/SDL_atarigl.c create mode 100644 SDL/src/video/ataricommon/SDL_atarigl_c.h create mode 100644 SDL/src/video/ataricommon/SDL_atarikeys.h create mode 100644 SDL/src/video/ataricommon/SDL_atarimxalloc.c create mode 100644 SDL/src/video/ataricommon/SDL_atarimxalloc_c.h create mode 100644 SDL/src/video/ataricommon/SDL_biosevents.c create mode 100644 SDL/src/video/ataricommon/SDL_biosevents_c.h create mode 100644 SDL/src/video/ataricommon/SDL_gemdosevents.c create mode 100644 SDL/src/video/ataricommon/SDL_gemdosevents_c.h create mode 100644 SDL/src/video/ataricommon/SDL_ikbdevents.c create mode 100644 SDL/src/video/ataricommon/SDL_ikbdevents_c.h create mode 100644 SDL/src/video/ataricommon/SDL_ikbdinterrupt.S create mode 100644 SDL/src/video/ataricommon/SDL_ikbdinterrupt_s.h create mode 100644 SDL/src/video/ataricommon/SDL_xbiosevents.c create mode 100644 SDL/src/video/ataricommon/SDL_xbiosevents_c.h create mode 100644 SDL/src/video/ataricommon/SDL_xbiosinterrupt.S create mode 100644 SDL/src/video/ataricommon/SDL_xbiosinterrupt_s.h create mode 100644 SDL/src/video/blank_cursor.h create mode 100644 SDL/src/video/bwindow/SDL_BView.h create mode 100644 SDL/src/video/bwindow/SDL_BWin.h create mode 100644 SDL/src/video/bwindow/SDL_lowvideo.h create mode 100644 SDL/src/video/bwindow/SDL_sysevents.cc create mode 100644 SDL/src/video/bwindow/SDL_sysevents_c.h create mode 100644 SDL/src/video/bwindow/SDL_sysmouse.cc create mode 100644 SDL/src/video/bwindow/SDL_sysmouse_c.h create mode 100644 SDL/src/video/bwindow/SDL_sysvideo.cc create mode 100644 SDL/src/video/bwindow/SDL_syswm.cc create mode 100644 SDL/src/video/bwindow/SDL_syswm_c.h create mode 100644 SDL/src/video/bwindow/SDL_sysyuv.cc create mode 100644 SDL/src/video/bwindow/SDL_sysyuv.h create mode 100644 SDL/src/video/dc/SDL_dcevents.c create mode 100644 SDL/src/video/dc/SDL_dcevents_c.h create mode 100644 SDL/src/video/dc/SDL_dcmouse.c create mode 100644 SDL/src/video/dc/SDL_dcmouse_c.h create mode 100644 SDL/src/video/dc/SDL_dcvideo.c create mode 100644 SDL/src/video/dc/SDL_dcvideo.h create mode 100644 SDL/src/video/default_cursor.h create mode 100644 SDL/src/video/dga/SDL_dgaevents.c create mode 100644 SDL/src/video/dga/SDL_dgaevents_c.h create mode 100644 SDL/src/video/dga/SDL_dgamouse.c create mode 100644 SDL/src/video/dga/SDL_dgamouse_c.h create mode 100644 SDL/src/video/dga/SDL_dgavideo.c create mode 100644 SDL/src/video/dga/SDL_dgavideo.h create mode 100644 SDL/src/video/directfb/SDL_DirectFB_events.c create mode 100644 SDL/src/video/directfb/SDL_DirectFB_events.h create mode 100644 SDL/src/video/directfb/SDL_DirectFB_keys.h create mode 100644 SDL/src/video/directfb/SDL_DirectFB_video.c create mode 100644 SDL/src/video/directfb/SDL_DirectFB_video.h create mode 100644 SDL/src/video/directfb/SDL_DirectFB_yuv.c create mode 100644 SDL/src/video/directfb/SDL_DirectFB_yuv.h create mode 100644 SDL/src/video/dummy/SDL_nullevents.c create mode 100644 SDL/src/video/dummy/SDL_nullevents_c.h create mode 100644 SDL/src/video/dummy/SDL_nullmouse.c create mode 100644 SDL/src/video/dummy/SDL_nullmouse_c.h create mode 100644 SDL/src/video/dummy/SDL_nullvideo.c create mode 100644 SDL/src/video/dummy/SDL_nullvideo.h create mode 100644 SDL/src/video/e_log.h create mode 100644 SDL/src/video/e_pow.h create mode 100644 SDL/src/video/e_sqrt.h create mode 100644 SDL/src/video/fbcon/3dfx_mmio.h create mode 100644 SDL/src/video/fbcon/3dfx_regs.h create mode 100644 SDL/src/video/fbcon/SDL_fb3dfx.c create mode 100644 SDL/src/video/fbcon/SDL_fb3dfx.h create mode 100644 SDL/src/video/fbcon/SDL_fbelo.c create mode 100644 SDL/src/video/fbcon/SDL_fbelo.h create mode 100644 SDL/src/video/fbcon/SDL_fbevents.c create mode 100644 SDL/src/video/fbcon/SDL_fbevents_c.h create mode 100644 SDL/src/video/fbcon/SDL_fbkeys.h create mode 100644 SDL/src/video/fbcon/SDL_fbmatrox.c create mode 100644 SDL/src/video/fbcon/SDL_fbmatrox.h create mode 100644 SDL/src/video/fbcon/SDL_fbmouse.c create mode 100644 SDL/src/video/fbcon/SDL_fbmouse_c.h create mode 100644 SDL/src/video/fbcon/SDL_fbriva.c create mode 100644 SDL/src/video/fbcon/SDL_fbriva.h create mode 100644 SDL/src/video/fbcon/SDL_fbvideo.c create mode 100644 SDL/src/video/fbcon/SDL_fbvideo.h create mode 100644 SDL/src/video/fbcon/matrox_mmio.h create mode 100644 SDL/src/video/fbcon/matrox_regs.h create mode 100644 SDL/src/video/fbcon/riva_mmio.h create mode 100644 SDL/src/video/fbcon/riva_regs.h create mode 100644 SDL/src/video/gapi/SDL_gapivideo.c create mode 100644 SDL/src/video/gapi/SDL_gapivideo.h create mode 100644 SDL/src/video/gem/SDL_gemevents.c create mode 100644 SDL/src/video/gem/SDL_gemevents_c.h create mode 100644 SDL/src/video/gem/SDL_gemmouse.c create mode 100644 SDL/src/video/gem/SDL_gemmouse_c.h create mode 100644 SDL/src/video/gem/SDL_gemvideo.c create mode 100644 SDL/src/video/gem/SDL_gemvideo.h create mode 100644 SDL/src/video/gem/SDL_gemwm.c create mode 100644 SDL/src/video/gem/SDL_gemwm_c.h create mode 100644 SDL/src/video/ggi/SDL_ggievents.c create mode 100644 SDL/src/video/ggi/SDL_ggievents_c.h create mode 100644 SDL/src/video/ggi/SDL_ggikeys.h create mode 100644 SDL/src/video/ggi/SDL_ggimouse.c create mode 100644 SDL/src/video/ggi/SDL_ggimouse_c.h create mode 100644 SDL/src/video/ggi/SDL_ggivideo.c create mode 100644 SDL/src/video/ggi/SDL_ggivideo.h create mode 100644 SDL/src/video/ipod/SDL_ipodvideo.c create mode 100644 SDL/src/video/ipod/SDL_ipodvideo.h create mode 100644 SDL/src/video/maccommon/SDL_lowvideo.h create mode 100644 SDL/src/video/maccommon/SDL_macevents.c create mode 100644 SDL/src/video/maccommon/SDL_macevents_c.h create mode 100644 SDL/src/video/maccommon/SDL_macgl.c create mode 100644 SDL/src/video/maccommon/SDL_macgl_c.h create mode 100644 SDL/src/video/maccommon/SDL_mackeys.h create mode 100644 SDL/src/video/maccommon/SDL_macmouse.c create mode 100644 SDL/src/video/maccommon/SDL_macmouse_c.h create mode 100644 SDL/src/video/maccommon/SDL_macwm.c create mode 100644 SDL/src/video/maccommon/SDL_macwm_c.h create mode 100644 SDL/src/video/macdsp/SDL_dspvideo.c create mode 100644 SDL/src/video/macdsp/SDL_dspvideo.h create mode 100644 SDL/src/video/macrom/SDL_romvideo.c create mode 100644 SDL/src/video/macrom/SDL_romvideo.h create mode 100644 SDL/src/video/math_private.h create mode 100644 SDL/src/video/mmx.h create mode 100644 SDL/src/video/nanox/SDL_nxevents.c create mode 100644 SDL/src/video/nanox/SDL_nxevents_c.h create mode 100644 SDL/src/video/nanox/SDL_nximage.c create mode 100644 SDL/src/video/nanox/SDL_nximage_c.h create mode 100644 SDL/src/video/nanox/SDL_nxmodes.c create mode 100644 SDL/src/video/nanox/SDL_nxmodes_c.h create mode 100644 SDL/src/video/nanox/SDL_nxmouse.c create mode 100644 SDL/src/video/nanox/SDL_nxmouse_c.h create mode 100644 SDL/src/video/nanox/SDL_nxvideo.c create mode 100644 SDL/src/video/nanox/SDL_nxvideo.h create mode 100644 SDL/src/video/nanox/SDL_nxwm.c create mode 100644 SDL/src/video/nanox/SDL_nxwm_c.h create mode 100644 SDL/src/video/nds/SDL_ndsevents.c create mode 100644 SDL/src/video/nds/SDL_ndsevents_c.h create mode 100644 SDL/src/video/nds/SDL_ndsmouse.c create mode 100644 SDL/src/video/nds/SDL_ndsmouse_c.h create mode 100644 SDL/src/video/nds/SDL_ndsvideo.c create mode 100644 SDL/src/video/nds/SDL_ndsvideo.h create mode 100644 SDL/src/video/os2fslib/SDL_os2fslib.c create mode 100644 SDL/src/video/os2fslib/SDL_os2fslib.h create mode 100644 SDL/src/video/os2fslib/SDL_vkeys.h create mode 100644 SDL/src/video/photon/SDL_ph_events.c create mode 100644 SDL/src/video/photon/SDL_ph_events_c.h create mode 100644 SDL/src/video/photon/SDL_ph_gl.c create mode 100644 SDL/src/video/photon/SDL_ph_gl.h create mode 100644 SDL/src/video/photon/SDL_ph_image.c create mode 100644 SDL/src/video/photon/SDL_ph_image_c.h create mode 100644 SDL/src/video/photon/SDL_ph_modes.c create mode 100644 SDL/src/video/photon/SDL_ph_modes_c.h create mode 100644 SDL/src/video/photon/SDL_ph_mouse.c create mode 100644 SDL/src/video/photon/SDL_ph_mouse_c.h create mode 100644 SDL/src/video/photon/SDL_ph_video.c create mode 100644 SDL/src/video/photon/SDL_ph_video.h create mode 100644 SDL/src/video/photon/SDL_ph_wm.c create mode 100644 SDL/src/video/photon/SDL_ph_wm_c.h create mode 100644 SDL/src/video/photon/SDL_phyuv.c create mode 100644 SDL/src/video/photon/SDL_phyuv_c.h create mode 100644 SDL/src/video/picogui/SDL_pgevents.c create mode 100644 SDL/src/video/picogui/SDL_pgevents_c.h create mode 100644 SDL/src/video/picogui/SDL_pgvideo.c create mode 100644 SDL/src/video/picogui/SDL_pgvideo.h create mode 100644 SDL/src/video/ps2gs/SDL_gsevents.c create mode 100644 SDL/src/video/ps2gs/SDL_gsevents_c.h create mode 100644 SDL/src/video/ps2gs/SDL_gskeys.h create mode 100644 SDL/src/video/ps2gs/SDL_gsmouse.c create mode 100644 SDL/src/video/ps2gs/SDL_gsmouse_c.h create mode 100644 SDL/src/video/ps2gs/SDL_gsvideo.c create mode 100644 SDL/src/video/ps2gs/SDL_gsvideo.h create mode 100644 SDL/src/video/ps2gs/SDL_gsyuv.c create mode 100644 SDL/src/video/ps2gs/SDL_gsyuv_c.h create mode 100644 SDL/src/video/qtopia/SDL_QPEApp.cc create mode 100644 SDL/src/video/qtopia/SDL_QPEApp.h create mode 100644 SDL/src/video/qtopia/SDL_QWin.cc create mode 100644 SDL/src/video/qtopia/SDL_QWin.h create mode 100644 SDL/src/video/qtopia/SDL_lowvideo.h create mode 100644 SDL/src/video/qtopia/SDL_sysevents.cc create mode 100644 SDL/src/video/qtopia/SDL_sysevents_c.h create mode 100644 SDL/src/video/qtopia/SDL_sysmouse.cc create mode 100644 SDL/src/video/qtopia/SDL_sysmouse_c.h create mode 100644 SDL/src/video/qtopia/SDL_sysvideo.cc create mode 100644 SDL/src/video/qtopia/SDL_syswm.cc create mode 100644 SDL/src/video/qtopia/SDL_syswm_c.h create mode 100644 SDL/src/video/quartz/CGS.h create mode 100644 SDL/src/video/quartz/SDL_QuartzEvents.m create mode 100644 SDL/src/video/quartz/SDL_QuartzGL.m create mode 100644 SDL/src/video/quartz/SDL_QuartzKeys.h create mode 100644 SDL/src/video/quartz/SDL_QuartzVideo.h create mode 100644 SDL/src/video/quartz/SDL_QuartzVideo.m create mode 100644 SDL/src/video/quartz/SDL_QuartzWM.h create mode 100644 SDL/src/video/quartz/SDL_QuartzWM.m create mode 100644 SDL/src/video/quartz/SDL_QuartzWindow.h create mode 100644 SDL/src/video/quartz/SDL_QuartzWindow.m create mode 100644 SDL/src/video/quartz/SDL_QuartzYUV.m create mode 100644 SDL/src/video/riscos/SDL_riscosASM.S create mode 100644 SDL/src/video/riscos/SDL_riscosFullScreenVideo.c create mode 100644 SDL/src/video/riscos/SDL_riscosevents.c create mode 100644 SDL/src/video/riscos/SDL_riscosevents_c.h create mode 100644 SDL/src/video/riscos/SDL_riscosmouse.c create mode 100644 SDL/src/video/riscos/SDL_riscosmouse_c.h create mode 100644 SDL/src/video/riscos/SDL_riscossprite.c create mode 100644 SDL/src/video/riscos/SDL_riscostask.c create mode 100644 SDL/src/video/riscos/SDL_riscostask.h create mode 100644 SDL/src/video/riscos/SDL_riscosvideo.c create mode 100644 SDL/src/video/riscos/SDL_riscosvideo.h create mode 100644 SDL/src/video/riscos/SDL_wimppoll.c create mode 100644 SDL/src/video/riscos/SDL_wimpvideo.c create mode 100644 SDL/src/video/svga/SDL_svgaevents.c create mode 100644 SDL/src/video/svga/SDL_svgaevents_c.h create mode 100644 SDL/src/video/svga/SDL_svgamouse.c create mode 100644 SDL/src/video/svga/SDL_svgamouse_c.h create mode 100644 SDL/src/video/svga/SDL_svgavideo.c create mode 100644 SDL/src/video/svga/SDL_svgavideo.h create mode 100644 SDL/src/video/symbian/EKA1/SDL_epocevents.cpp create mode 100644 SDL/src/video/symbian/EKA1/SDL_epocvideo.cpp create mode 100644 SDL/src/video/symbian/EKA1/SDL_epocvideo.h create mode 100644 SDL/src/video/symbian/EKA2/SDL_epocevents.cpp create mode 100644 SDL/src/video/symbian/EKA2/SDL_epocvideo.cpp create mode 100644 SDL/src/video/symbian/EKA2/SDL_epocvideo.h create mode 100644 SDL/src/video/symbian/EKA2/dsa.cpp create mode 100644 SDL/src/video/symbian/EKA2/dsa_new.cpp create mode 100644 SDL/src/video/symbian/EKA2/dsa_old.cpp create mode 100644 SDL/src/video/symbian/SDL_epocevents_c.h create mode 100644 SDL/src/video/vgl/SDL_vglevents.c create mode 100644 SDL/src/video/vgl/SDL_vglevents_c.h create mode 100644 SDL/src/video/vgl/SDL_vglmouse.c create mode 100644 SDL/src/video/vgl/SDL_vglmouse_c.h create mode 100644 SDL/src/video/vgl/SDL_vglvideo.c create mode 100644 SDL/src/video/vgl/SDL_vglvideo.h create mode 100644 SDL/src/video/wii/SDL_wiievents.c create mode 100644 SDL/src/video/wii/SDL_wiievents_c.h create mode 100644 SDL/src/video/wii/SDL_wiimouse.c create mode 100644 SDL/src/video/wii/SDL_wiimouse_c.h create mode 100644 SDL/src/video/wii/SDL_wiivideo.c create mode 100644 SDL/src/video/wii/SDL_wiivideo.h create mode 100644 SDL/src/video/wincommon/SDL_lowvideo.h create mode 100644 SDL/src/video/wincommon/SDL_sysevents.c create mode 100644 SDL/src/video/wincommon/SDL_sysmouse.c create mode 100644 SDL/src/video/wincommon/SDL_sysmouse_c.h create mode 100644 SDL/src/video/wincommon/SDL_syswm.c create mode 100644 SDL/src/video/wincommon/SDL_syswm_c.h create mode 100644 SDL/src/video/wincommon/SDL_wingl.c create mode 100644 SDL/src/video/wincommon/SDL_wingl_c.h create mode 100644 SDL/src/video/wincommon/wmmsg.h create mode 100644 SDL/src/video/windib/SDL_dibevents.c create mode 100644 SDL/src/video/windib/SDL_dibevents_c.h create mode 100644 SDL/src/video/windib/SDL_dibvideo.c create mode 100644 SDL/src/video/windib/SDL_dibvideo.h create mode 100644 SDL/src/video/windib/SDL_vkeys.h create mode 100644 SDL/src/video/windx5/SDL_dx5events.c create mode 100644 SDL/src/video/windx5/SDL_dx5events_c.h create mode 100644 SDL/src/video/windx5/SDL_dx5video.c create mode 100644 SDL/src/video/windx5/SDL_dx5video.h create mode 100644 SDL/src/video/windx5/SDL_dx5yuv.c create mode 100644 SDL/src/video/windx5/SDL_dx5yuv_c.h create mode 100644 SDL/src/video/windx5/directx.h create mode 100644 SDL/src/video/wscons/SDL_wsconsevents.c create mode 100644 SDL/src/video/wscons/SDL_wsconsevents_c.h create mode 100644 SDL/src/video/wscons/SDL_wsconsmouse.c create mode 100644 SDL/src/video/wscons/SDL_wsconsmouse_c.h create mode 100644 SDL/src/video/wscons/SDL_wsconsvideo.c create mode 100644 SDL/src/video/wscons/SDL_wsconsvideo.h create mode 100644 SDL/src/video/x11/SDL_x11dga.c create mode 100644 SDL/src/video/x11/SDL_x11dga_c.h create mode 100644 SDL/src/video/x11/SDL_x11dyn.c create mode 100644 SDL/src/video/x11/SDL_x11dyn.h create mode 100644 SDL/src/video/x11/SDL_x11events.c create mode 100644 SDL/src/video/x11/SDL_x11events_c.h create mode 100644 SDL/src/video/x11/SDL_x11gamma.c create mode 100644 SDL/src/video/x11/SDL_x11gamma_c.h create mode 100644 SDL/src/video/x11/SDL_x11gl.c create mode 100644 SDL/src/video/x11/SDL_x11gl_c.h create mode 100644 SDL/src/video/x11/SDL_x11image.c create mode 100644 SDL/src/video/x11/SDL_x11image_c.h create mode 100644 SDL/src/video/x11/SDL_x11modes.c create mode 100644 SDL/src/video/x11/SDL_x11modes_c.h create mode 100644 SDL/src/video/x11/SDL_x11mouse.c create mode 100644 SDL/src/video/x11/SDL_x11mouse_c.h create mode 100644 SDL/src/video/x11/SDL_x11sym.h create mode 100644 SDL/src/video/x11/SDL_x11video.c create mode 100644 SDL/src/video/x11/SDL_x11video.h create mode 100644 SDL/src/video/x11/SDL_x11wm.c create mode 100644 SDL/src/video/x11/SDL_x11wm_c.h create mode 100644 SDL/src/video/x11/SDL_x11yuv.c create mode 100644 SDL/src/video/x11/SDL_x11yuv_c.h create mode 100644 SDL/src/video/xbios/SDL_xbios.c create mode 100644 SDL/src/video/xbios/SDL_xbios.h create mode 100644 SDL/src/video/xbios/SDL_xbios_blowup.c create mode 100644 SDL/src/video/xbios/SDL_xbios_blowup.h create mode 100644 SDL/src/video/xbios/SDL_xbios_centscreen.c create mode 100644 SDL/src/video/xbios/SDL_xbios_centscreen.h create mode 100644 SDL/src/video/xbios/SDL_xbios_sb3.c create mode 100644 SDL/src/video/xbios/SDL_xbios_sb3.h create mode 100644 SDL/src/video/xbios/SDL_xbios_tveille.c create mode 100644 SDL/src/video/xbios/SDL_xbios_tveille.h create mode 100644 SDL/test/COPYING create mode 100644 SDL/test/Makefile.in create mode 100644 SDL/test/README create mode 100644 SDL/test/acinclude.m4 create mode 100644 SDL/test/aclocal.m4 create mode 100644 SDL/test/autogen.sh create mode 100644 SDL/test/checkkeys.c create mode 100644 SDL/test/configure create mode 100644 SDL/test/configure.in create mode 100644 SDL/test/gcc-fat.sh create mode 100644 SDL/test/graywin.c create mode 100644 SDL/test/icon.bmp create mode 100644 SDL/test/loopwave.c create mode 100644 SDL/test/moose.dat create mode 100644 SDL/test/picture.xbm create mode 100644 SDL/test/sail.bmp create mode 100644 SDL/test/sample.bmp create mode 100644 SDL/test/sample.wav create mode 100644 SDL/test/testalpha.c create mode 100644 SDL/test/testbitmap.c create mode 100644 SDL/test/testblitspeed.c create mode 100644 SDL/test/testcdrom.c create mode 100644 SDL/test/testcursor.c create mode 100644 SDL/test/testdyngl.c create mode 100644 SDL/test/testerror.c create mode 100644 SDL/test/testfile.c create mode 100644 SDL/test/testgamma.c create mode 100644 SDL/test/testgl.c create mode 100644 SDL/test/testhread.c create mode 100644 SDL/test/testiconv.c create mode 100644 SDL/test/testjoystick.c create mode 100644 SDL/test/testkeys.c create mode 100644 SDL/test/testloadso.c create mode 100644 SDL/test/testlock.c create mode 100644 SDL/test/testoverlay.c create mode 100644 SDL/test/testoverlay2.c create mode 100644 SDL/test/testpalette.c create mode 100644 SDL/test/testplatform.c create mode 100644 SDL/test/testsem.c create mode 100644 SDL/test/testsprite.c create mode 100644 SDL/test/testtimer.c create mode 100644 SDL/test/testver.c create mode 100644 SDL/test/testvidinfo.c create mode 100644 SDL/test/testwin.c create mode 100644 SDL/test/testwm.c create mode 100644 SDL/test/threadwin.c create mode 100644 SDL/test/torturethread.c create mode 100644 SDL/test/utf8.txt create mode 100644 SDL_gfx/Makefile create mode 100644 SDL_gfx/src/AUTHORS create mode 100644 SDL_gfx/src/COPYING create mode 100644 SDL_gfx/src/ChangeLog create mode 100644 SDL_gfx/src/Docs/Screenshots/SDL_gfxPrimitives-thumb.jpg create mode 100644 SDL_gfx/src/Docs/Screenshots/SDL_gfxPrimitives.jpg create mode 100644 SDL_gfx/src/Docs/Screenshots/SDL_rotozoom-thumb.jpg create mode 100644 SDL_gfx/src/Docs/Screenshots/SDL_rotozoom.jpg create mode 100644 SDL_gfx/src/Docs/blank.gif create mode 100644 SDL_gfx/src/Docs/framerate-thumb.png create mode 100644 SDL_gfx/src/Docs/framerate.fig create mode 100644 SDL_gfx/src/Docs/framerate.png create mode 100644 SDL_gfx/src/Docs/index.html create mode 100644 SDL_gfx/src/Fonts/10x20.fnt create mode 100644 SDL_gfx/src/Fonts/5x7.fnt create mode 100644 SDL_gfx/src/Fonts/5x8.fnt create mode 100644 SDL_gfx/src/Fonts/6x10.fnt create mode 100644 SDL_gfx/src/Fonts/6x12.fnt create mode 100644 SDL_gfx/src/Fonts/6x13.fnt create mode 100644 SDL_gfx/src/Fonts/6x13B.fnt create mode 100644 SDL_gfx/src/Fonts/6x13O.fnt create mode 100644 SDL_gfx/src/Fonts/6x9.fnt create mode 100644 SDL_gfx/src/Fonts/7x13.fnt create mode 100644 SDL_gfx/src/Fonts/7x13B.fnt create mode 100644 SDL_gfx/src/Fonts/7x13O.fnt create mode 100644 SDL_gfx/src/Fonts/7x14.fnt create mode 100644 SDL_gfx/src/Fonts/7x14B.fnt create mode 100644 SDL_gfx/src/Fonts/8x13.fnt create mode 100644 SDL_gfx/src/Fonts/8x13B.fnt create mode 100644 SDL_gfx/src/Fonts/8x13O.fnt create mode 100644 SDL_gfx/src/Fonts/9x15.fnt create mode 100644 SDL_gfx/src/Fonts/9x15B.fnt create mode 100644 SDL_gfx/src/Fonts/9x18.fnt create mode 100644 SDL_gfx/src/Fonts/9x18B.fnt create mode 100644 SDL_gfx/src/INSTALL create mode 100644 SDL_gfx/src/LICENSE create mode 100644 SDL_gfx/src/Makefile.am create mode 100644 SDL_gfx/src/Makefile.in create mode 100644 SDL_gfx/src/Makefile.mingw create mode 100644 SDL_gfx/src/Makefile.new create mode 100644 SDL_gfx/src/NEWS create mode 100644 SDL_gfx/src/README create mode 100644 SDL_gfx/src/README-rpm create mode 100644 SDL_gfx/src/SDL_framerate.c create mode 100644 SDL_gfx/src/SDL_framerate.h create mode 100644 SDL_gfx/src/SDL_gfx.spec create mode 100644 SDL_gfx/src/SDL_gfxBlitFunc.c create mode 100644 SDL_gfx/src/SDL_gfxBlitFunc.h create mode 100644 SDL_gfx/src/SDL_gfxPrimitives.c create mode 100644 SDL_gfx/src/SDL_gfxPrimitives.h create mode 100644 SDL_gfx/src/SDL_gfxPrimitives_font.h create mode 100644 SDL_gfx/src/SDL_imageFilter.c create mode 100644 SDL_gfx/src/SDL_imageFilter.h create mode 100644 SDL_gfx/src/SDL_rotozoom.c create mode 100644 SDL_gfx/src/SDL_rotozoom.h create mode 100644 SDL_gfx/src/Scripts/clean-c++.pl create mode 100644 SDL_gfx/src/Test/Makefile.am create mode 100644 SDL_gfx/src/Test/Makefile.in create mode 100644 SDL_gfx/src/Test/Makefile.new create mode 100644 SDL_gfx/src/Test/TestABGR.c create mode 100644 SDL_gfx/src/Test/TestFonts.c create mode 100644 SDL_gfx/src/Test/TestFramerate.c create mode 100644 SDL_gfx/src/Test/TestGfxBlit.c create mode 100644 SDL_gfx/src/Test/TestGfxPrimitives.c create mode 100644 SDL_gfx/src/Test/TestGfxTexture.c create mode 100644 SDL_gfx/src/Test/TestImageFilter.c create mode 100644 SDL_gfx/src/Test/TestRotozoom.c create mode 100644 SDL_gfx/src/Test/TestShrink.c create mode 100644 SDL_gfx/src/Test/acinclude.m4 create mode 100644 SDL_gfx/src/Test/aclocal.m4 create mode 100644 SDL_gfx/src/Test/autogen.sh create mode 100644 SDL_gfx/src/Test/config.guess create mode 100644 SDL_gfx/src/Test/config.sub create mode 100644 SDL_gfx/src/Test/configure create mode 100644 SDL_gfx/src/Test/configure.in create mode 100644 SDL_gfx/src/Test/install-sh create mode 100644 SDL_gfx/src/Test/ltconfig create mode 100644 SDL_gfx/src/Test/ltmain.sh create mode 100644 SDL_gfx/src/Test/missing create mode 100644 SDL_gfx/src/Test/mkinstalldirs create mode 100644 SDL_gfx/src/Test/sample24-box.bmp create mode 100644 SDL_gfx/src/Test/sample24.bmp create mode 100644 SDL_gfx/src/Test/sample8-box.bmp create mode 100644 SDL_gfx/src/Test/sample8.bmp create mode 100644 SDL_gfx/src/Test/texture.bmp create mode 100644 SDL_gfx/src/Test/texture_alpha.bmp create mode 100644 SDL_gfx/src/VisualC/SDL_gfx.vcproj create mode 100644 SDL_gfx/src/VisualC/VisualC Note.txt create mode 100644 SDL_gfx/src/acinclude.m4 create mode 100644 SDL_gfx/src/aclocal.m4 create mode 100644 SDL_gfx/src/autogen.sh create mode 100644 SDL_gfx/src/buildrpm.sh create mode 100644 SDL_gfx/src/config.guess create mode 100644 SDL_gfx/src/config.sub create mode 100644 SDL_gfx/src/configure create mode 100644 SDL_gfx/src/configure.in create mode 100644 SDL_gfx/src/depcomp create mode 100644 SDL_gfx/src/install-sh create mode 100644 SDL_gfx/src/ltconfig create mode 100644 SDL_gfx/src/ltmain.sh create mode 100644 SDL_gfx/src/missing create mode 100644 SDL_gfx/src/mkinstalldirs create mode 100644 SDL_gfx/src/nodebug.sh create mode 100644 SDL_image/Makefile create mode 100644 SDL_image/src/CHANGES create mode 100644 SDL_image/src/COPYING create mode 100644 SDL_image/src/IMG.c create mode 100644 SDL_image/src/IMG_ImageIO.c create mode 100644 SDL_image/src/IMG_UIImage.m create mode 100644 SDL_image/src/IMG_bmp.c create mode 100644 SDL_image/src/IMG_gif.c create mode 100644 SDL_image/src/IMG_jpg.c create mode 100644 SDL_image/src/IMG_lbm.c create mode 100644 SDL_image/src/IMG_pcx.c create mode 100644 SDL_image/src/IMG_png.c create mode 100644 SDL_image/src/IMG_pnm.c create mode 100644 SDL_image/src/IMG_tga.c create mode 100644 SDL_image/src/IMG_tif.c create mode 100644 SDL_image/src/IMG_xcf.c create mode 100644 SDL_image/src/IMG_xpm.c create mode 100644 SDL_image/src/IMG_xv.c create mode 100644 SDL_image/src/IMG_xxx.c create mode 100644 SDL_image/src/MPWmake.sea.bin create mode 100644 SDL_image/src/Makefile.am create mode 100644 SDL_image/src/README create mode 100644 SDL_image/src/SDL_image.h create mode 100644 SDL_image/src/SDL_image.qpg.in create mode 100644 SDL_image/src/SDL_image.spec.in create mode 100644 SDL_image/src/acinclude/libtool.m4 create mode 100644 SDL_image/src/acinclude/sdl.m4 create mode 100644 SDL_image/src/autogen.sh create mode 100644 SDL_image/src/config.guess create mode 100644 SDL_image/src/config.sub create mode 100644 SDL_image/src/configure.in create mode 100644 SDL_image/src/gcc-fat.sh create mode 100644 SDL_image/src/ltmain.sh create mode 100644 SDL_image/src/showimage.c create mode 100644 SDL_image/src/version.rc create mode 100644 SDL_mixer/Makefile create mode 100644 SDL_mixer/src/CHANGES create mode 100644 SDL_mixer/src/COPYING create mode 100644 SDL_mixer/src/CWProjects.sea.bin create mode 100644 SDL_mixer/src/MPWmake.sea.bin create mode 100644 SDL_mixer/src/Makefile.in create mode 100644 SDL_mixer/src/README create mode 100644 SDL_mixer/src/SDL_mixer.h create mode 100644 SDL_mixer/src/SDL_mixer.qpg.in create mode 100644 SDL_mixer/src/SDL_mixer.spec.in create mode 100644 SDL_mixer/src/acinclude/libtool.m4 create mode 100644 SDL_mixer/src/acinclude/sdl.m4 create mode 100644 SDL_mixer/src/acinclude/smpeg.m4 create mode 100644 SDL_mixer/src/autogen.sh create mode 100644 SDL_mixer/src/build-scripts/config.guess create mode 100644 SDL_mixer/src/build-scripts/config.sub create mode 100644 SDL_mixer/src/build-scripts/install-sh create mode 100644 SDL_mixer/src/build-scripts/ltmain.sh create mode 100644 SDL_mixer/src/build-scripts/makedep.sh create mode 100644 SDL_mixer/src/build-scripts/mkinstalldirs create mode 100644 SDL_mixer/src/configure.in create mode 100644 SDL_mixer/src/dynamic_flac.c create mode 100644 SDL_mixer/src/dynamic_flac.h create mode 100644 SDL_mixer/src/dynamic_mp3.c create mode 100644 SDL_mixer/src/dynamic_mp3.h create mode 100644 SDL_mixer/src/dynamic_ogg.c create mode 100644 SDL_mixer/src/dynamic_ogg.h create mode 100644 SDL_mixer/src/effect_position.c create mode 100644 SDL_mixer/src/effect_stereoreverse.c create mode 100644 SDL_mixer/src/effects_internal.c create mode 100644 SDL_mixer/src/effects_internal.h create mode 100644 SDL_mixer/src/gcc-fat.sh create mode 100644 SDL_mixer/src/load_aiff.c create mode 100644 SDL_mixer/src/load_aiff.h create mode 100644 SDL_mixer/src/load_flac.c create mode 100644 SDL_mixer/src/load_flac.h create mode 100644 SDL_mixer/src/load_ogg.c create mode 100644 SDL_mixer/src/load_ogg.h create mode 100644 SDL_mixer/src/load_voc.c create mode 100644 SDL_mixer/src/load_voc.h create mode 100644 SDL_mixer/src/mikmod/AUTHORS create mode 100644 SDL_mixer/src/mikmod/COPYING.LESSER create mode 100644 SDL_mixer/src/mikmod/README create mode 100644 SDL_mixer/src/mikmod/drv_nos.c create mode 100644 SDL_mixer/src/mikmod/load_it.c create mode 100644 SDL_mixer/src/mikmod/load_mod.c create mode 100644 SDL_mixer/src/mikmod/load_s3m.c create mode 100644 SDL_mixer/src/mikmod/load_xm.c create mode 100644 SDL_mixer/src/mikmod/mdreg.c create mode 100644 SDL_mixer/src/mikmod/mdriver.c create mode 100644 SDL_mixer/src/mikmod/mikmod.h create mode 100644 SDL_mixer/src/mikmod/mikmod_build.h create mode 100644 SDL_mixer/src/mikmod/mikmod_internals.h create mode 100644 SDL_mixer/src/mikmod/mloader.c create mode 100644 SDL_mixer/src/mikmod/mlreg.c create mode 100644 SDL_mixer/src/mikmod/mlutil.c create mode 100644 SDL_mixer/src/mikmod/mmalloc.c create mode 100644 SDL_mixer/src/mikmod/mmerror.c create mode 100644 SDL_mixer/src/mikmod/mmio.c create mode 100644 SDL_mixer/src/mikmod/mplayer.c create mode 100644 SDL_mixer/src/mikmod/munitrk.c create mode 100644 SDL_mixer/src/mikmod/mwav.c create mode 100644 SDL_mixer/src/mikmod/npertab.c create mode 100644 SDL_mixer/src/mikmod/sloader.c create mode 100644 SDL_mixer/src/mikmod/virtch.c create mode 100644 SDL_mixer/src/mikmod/virtch2.c create mode 100644 SDL_mixer/src/mikmod/virtch_common.c create mode 100644 SDL_mixer/src/mixer.c create mode 100644 SDL_mixer/src/music.c create mode 100644 SDL_mixer/src/music_cmd.c create mode 100644 SDL_mixer/src/music_cmd.h create mode 100644 SDL_mixer/src/music_flac.c create mode 100644 SDL_mixer/src/music_flac.h create mode 100644 SDL_mixer/src/music_mad.c create mode 100644 SDL_mixer/src/music_mad.h create mode 100644 SDL_mixer/src/music_ogg.c create mode 100644 SDL_mixer/src/music_ogg.h create mode 100644 SDL_mixer/src/native_midi/native_midi.h create mode 100644 SDL_mixer/src/native_midi/native_midi_common.c create mode 100644 SDL_mixer/src/native_midi/native_midi_common.h create mode 100644 SDL_mixer/src/native_midi/native_midi_mac.c create mode 100644 SDL_mixer/src/native_midi/native_midi_win32.c create mode 100644 SDL_mixer/src/native_midi_gpl/README create mode 100644 SDL_mixer/src/native_midi_gpl/awe_voice.h create mode 100644 SDL_mixer/src/native_midi_gpl/emumidi.c create mode 100644 SDL_mixer/src/native_midi_gpl/emumidi.h create mode 100644 SDL_mixer/src/native_midi_gpl/gmvoices.h create mode 100644 SDL_mixer/src/native_midi_gpl/gsvoices.h create mode 100644 SDL_mixer/src/native_midi_gpl/native_midi_gpl.c create mode 100644 SDL_mixer/src/native_midi_gpl/patchload.c create mode 100644 SDL_mixer/src/native_midi_gpl/playevents.c create mode 100644 SDL_mixer/src/native_midi_gpl/playmidi.h create mode 100644 SDL_mixer/src/native_midi_gpl/readmidi_native.c create mode 100644 SDL_mixer/src/playmus.c create mode 100644 SDL_mixer/src/playwave.c create mode 100644 SDL_mixer/src/timidity/FAQ create mode 100644 SDL_mixer/src/timidity/README create mode 100644 SDL_mixer/src/timidity/common.c create mode 100644 SDL_mixer/src/timidity/common.h create mode 100644 SDL_mixer/src/timidity/config.h create mode 100644 SDL_mixer/src/timidity/ctrlmode.c create mode 100644 SDL_mixer/src/timidity/ctrlmode.h create mode 100644 SDL_mixer/src/timidity/filter.c create mode 100644 SDL_mixer/src/timidity/filter.h create mode 100644 SDL_mixer/src/timidity/instrum.c create mode 100644 SDL_mixer/src/timidity/instrum.h create mode 100644 SDL_mixer/src/timidity/mix.c create mode 100644 SDL_mixer/src/timidity/mix.h create mode 100644 SDL_mixer/src/timidity/output.c create mode 100644 SDL_mixer/src/timidity/output.h create mode 100644 SDL_mixer/src/timidity/playmidi.c create mode 100644 SDL_mixer/src/timidity/playmidi.h create mode 100644 SDL_mixer/src/timidity/readmidi.c create mode 100644 SDL_mixer/src/timidity/readmidi.h create mode 100644 SDL_mixer/src/timidity/resample.c create mode 100644 SDL_mixer/src/timidity/resample.h create mode 100644 SDL_mixer/src/timidity/sdl_a.c create mode 100644 SDL_mixer/src/timidity/sdl_c.c create mode 100644 SDL_mixer/src/timidity/tables.c create mode 100644 SDL_mixer/src/timidity/tables.h create mode 100644 SDL_mixer/src/timidity/timidity.c create mode 100644 SDL_mixer/src/timidity/timidity.h create mode 100644 SDL_mixer/src/version.rc create mode 100644 SDL_mixer/src/wavestream.c create mode 100644 SDL_mixer/src/wavestream.h create mode 100644 SDL_ttf/Makefile create mode 100644 SDL_ttf/src/CHANGES create mode 100644 SDL_ttf/src/COPYING create mode 100644 SDL_ttf/src/MPWmake.sea.bin create mode 100644 SDL_ttf/src/Makefile.am create mode 100644 SDL_ttf/src/README create mode 100644 SDL_ttf/src/SDL_ttf.c create mode 100644 SDL_ttf/src/SDL_ttf.h create mode 100644 SDL_ttf/src/SDL_ttf.spec.in create mode 100644 SDL_ttf/src/acinclude/libtool.m4 create mode 100644 SDL_ttf/src/acinclude/sdl.m4 create mode 100644 SDL_ttf/src/autogen.sh create mode 100644 SDL_ttf/src/config.guess create mode 100644 SDL_ttf/src/config.sub create mode 100644 SDL_ttf/src/configure.in create mode 100644 SDL_ttf/src/gcc-fat.sh create mode 100644 SDL_ttf/src/glfont.c create mode 100644 SDL_ttf/src/ltmain.sh create mode 100644 SDL_ttf/src/showfont.c create mode 100644 SDL_ttf/src/version.rc diff --git a/SDL/BUGS b/SDL/BUGS new file mode 100644 index 0000000..d7058f6 --- /dev/null +++ b/SDL/BUGS @@ -0,0 +1,18 @@ + +Bugs are now managed in the SDL bug tracker, here: + + http://bugzilla.libsdl.org/ + +You may report bugs there, and search to see if a given issue has already + been reported, discussed, and maybe even fixed. + + + +You may also find help at the SDL mailing list. Subscription information: + + http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org + +Bug reports are welcome here, but we really appreciate if you use Bugzilla, as + bugs discussed on the mailing list may be forgotten or missed. + + diff --git a/SDL/Borland.html b/SDL/Borland.html new file mode 100644 index 0000000..3421dd7 --- /dev/null +++ b/SDL/Borland.html @@ -0,0 +1,139 @@ + + + + Building SDL with Borland's C++ compilers + + + + + +

Building SDL with Borland's C++ compilers.

+ by David Snopek + and updated by Dominique + Louis ( Last updated : 30th June 2003 ).
+
+ These instructions cover how to compile SDL and its included test +programs using either Borland C++ Builder 5, 6 for Windows, + C++ Builder for Linux ( AKA Kylix 3 ) or the free Borland C++ command-line compiler.
+ +

Extract the files

+ +

Unzip the Borland.zip archive into this directory. Do not unzip + it into any other directory because the makefiles ( *.mak ) and project + files ( *.bpr ) use relative paths to refer to the SDL sources. This should + create a directory named "Borland" inside of the top level SDL source directory. +

+ +

Using Borland C++ Builder 5, 6 for Windows +

+ +

Inside of the "Borland" directory there is a "bcb6" directory that contains + a number of Builder project files. Double-click on the "libSDL.bpg" file + icon. Once Builder has started click on the "Projects" menu on +the menu-bar and go down to "Build All Projects" option.
+ This will proceed to build SDL ( with Borland's calling convention ), +SDLmain, and all the test programs. Currently, all +the test programs are dynamically linked to Sam Lantinga's +SDL.dll.

+ +

NOTE : Borland's "lib" format and Microsoft's "lib" format are incompatible. + 
+ If you wish to dynamically link to the SDL library supplied by Sam Lantinga + in each release, I have created the correct *.libs for SDL 1.2.4 and they + exist in the "/lib" directory.
+ If you would like to create the *.lib files yourself, you will need to +make use of Borland's "implib.exe" utility.
+

+ +

IMPLIB works like this:

+ +
    IMPLIB (destination lib name) (source dll)
+ +

For example,

+ +
    IMPLIB SDL.lib SDL.dll
+ +

This assumes that SDL.dll was compiled with Visual C++ or similar.
+

+ +

To learn more about the difference between Borland's and Microsoft's *.lib + format please read the article here.
+

+ +


+ NOTE :
The C++ Builder for Windows project format, is not compatible + with the Kylix 3 project format, hence the reason why they are in separate + directories.

+ +

Using the free Borland C++ command-line compiler +

+ +

The free Borland compiler can be downloaded at no charge from the Borland website + . Make sure that it is installed and properly configured.

+ +

Open an MS-DOS Prompt. Change to the "Borland\freebcc" directory under + the SDL source directory. Type "make -f SDL.mak" to build SDL and "make + -f SDLmain.mak". There are also makefiles for all of the test programs, if you wish to build them. All .exes and +DLLs are created in the "test" SDL directory. Ify ou would like to create +the DLL and all the test applications, I have thrown together a basic batchfile +called "makeall.bat" which should create everything in the right order.

+ +

Output files

+ No matter which compiler you used, three important files should have + been produced: + + Both of the *.lib files will need to be added to all the projects +that use SDL and SDL.dll must be placed some where the Windows dynamic +linker can find it (either in your project directory or on the system +path, C:\WINDOWS\SYSTEM). +

Using Borland C++ Builder for Linux ( AKA Kylix + 3 )

+ +

Inside of the "Borland" directory there is a "k3" directory that contains + a number of Builder project files. Double-click on the "libSDL.bpg" file + icon. Once Builder has started click on the "Projects" menu on +the menu-bar and go down to "Build All Projects" option. This will +proceed to build all the test programs
+ Linux users do not need *.lib files as the Shared Object is linked right + into the project ( very neat actually, Windows should do this sort of thing + as it is a lot easier for the developer ).
+ NOTE : The C++ Builder for Windows project format, is not + compatible with the Kylix 3 project format, hence the reason why they are + in separate directories.

+ +

On Mandrake 8.1 the shared objects for SDL are located in the /usr/lib + directory as libSDL_*.so and the Mesa OpenGL shared objects are located +in /usr/X11R6/lib as libGL*.so
+
+ So if your setup is different you may need to change the project file + so that they re-link to the ones on your system.
+
+ On Mandrake 8.1 the headers files are located at /usr/include/SDL/. + So if you you have not installed the development RPMs ( usually named libSDL-devel* + ) for SDL ( not included ) you may have to change the include directory + within some of the projects.
+

+ +

Known Problems

+ The only known problem is that I ( Dominique Louis ), was unable to +create the projects that rebuilt the SDL shared objects under Linux, due +to time constraints and my lack of intimate knowledge of Linux. +

Test programs

+ Some of the test programs require included media files ( *.wav; *.bmp +etc ). All the test programs are now created in the "test" directory, where +the media files are ( usually ) so they should be ready to go.
+
+
+
+ + diff --git a/SDL/COPYING b/SDL/COPYING new file mode 100644 index 0000000..8904ea4 --- /dev/null +++ b/SDL/COPYING @@ -0,0 +1,458 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/SDL/CREDITS b/SDL/CREDITS new file mode 100644 index 0000000..162e90b --- /dev/null +++ b/SDL/CREDITS @@ -0,0 +1,92 @@ + +Simple DirectMedia Layer CREDITS +Thanks to everyone who made this possible, including: + +* Cliff Matthews, for giving me a reason to start this project. :) + -- Executor rocks! *grin* + +* Scott Call, for making a home for SDL on the 'Net... Thanks! :) + +* The Linux Fund, C Magazine, Educational Technology Resources Inc., + Gareth Noyce, Jesse Pavel, Keith Kitchin, Jeremy Horvath, Thomas Nicholson, + Hans-Peter Gygax, the Eternal Lands Development Team, Lars Brubaker, + and Phoenix Kokido for financial contributions + +* Gaëtan de Menten for writing the PHP and SQL behind the SDL website + +* Tim Jones for the new look of the SDL website + +* Marco Kraus for setting up SDL merchandise + +* Martin Donlon for his work on the SDL Documentation Project + +* Ryan Gordon for helping everybody out and keeping the dream alive. :) + +* Mattias Engdegård, for help with the Solaris port and lots of other help + +* Max Watson, Matt Slot, and Kyle for help with the MacOS Classic port + +* Stan Shebs, for the initial Mac OS X port + +* Eric Wing, Max Horn, and Darrell Walisser for unflagging work on the Mac OS X port + +* Patrick Trainor, Jim Boucher, and Mike Gorchak for the QNX Neutrino port + +* Carsten Griwodz for the AIX port + +* Gabriele Greco, for the Amiga port + +* Patrice Mandin, for the Atari port + +* Hannu Viitala for the EPOC port + +* Marcus Mertama for the S60 port. + +* Peter Valchev for nagging me about the OpenBSD port until I got it right. :) + +* Kent B Mein, for a place to do the IRIX port + +* Ash, for a place to do the OSF/1 Alpha port + +* David Sowsy, for help with the BeOS port + +* Eugenia Loli, for endless work on porting SDL games to BeOS + +* Jon Taylor for the GGI front-end + +* Paulus Esterhazy, for the Visual C++ testing and libraries + +* Brenda Tantzen, for Metrowerks CodeWarrior on MacOS + +* Chris Nentwich, for the Hermes assembly blitters + +* Michael Vance and Jim Kutter for the X11 OpenGL support + +* Stephane Peter, for the AAlib front-end and multi-threaded timer idea. + +* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation + +* Peter Wiklund, for the 1998 winning SDL logo, + and Arto Hamara, Steven Wong, and Kent Mein for other logo entries. + +* Arne Claus, for the 2004 winning SDL logo, + and Shandy Brown, Jac, Alex Lyman, Mikkel Gjoel, #Guy, Jonas Hartmann, + Daniel Liljeberg, Ronald Sowa, DocD, Pekka Jaervinen, Patrick Avella, + Erkki Kontilla, Levon Gavalian, Hal Emerich, David Wiktorsson, + S. Schury and F. Hufsky, Ciska de Ruyver, Shredweat, Tyler Montbriand, + Martin Andersson, Merlyn Wysard, Fernando Ibanez, David Miller, + Andre Bommele, lovesby.com, Francisco Camenforte Torres, and David Igreja + for other logo entries. + +* Bob Pendleton and David Olofson for being long time contributors to + the SDL mailing list. + +* Everybody at Loki Software, Inc. for their great contributions! + + And a big hand to everyone else who gave me appreciation, advice, + and suggestions, especially the good folks on the SDL mailing list. + +THANKS! :) + + -- Sam Lantinga + diff --git a/SDL/INSTALL b/SDL/INSTALL new file mode 100644 index 0000000..08ae122 --- /dev/null +++ b/SDL/INSTALL @@ -0,0 +1,23 @@ + +To compile and install SDL: + + 1. Run './configure; make; make install' + + If you are compiling for Windows using gcc, read the FAQ at: + http://www.libsdl.org/faq.php?action=listentries&category=4#42 + + If you are compiling using Visual C++ on Win32, you should read + the file VisualC.html + + 2. Look at the example programs in ./test, and check out the HTML + documentation in ./docs to see how to use the SDL library. + + 3. Join the SDL developer mailing list by sending E-mail to + sdl-request@libsdl.org + and put "subscribe" in the subject of the message. + + Or alternatively you can use the web interface: + http://www.libsdl.org/mailing-list.php + +That's it! +Sam Lantinga diff --git a/SDL/MPWmake.sea.bin b/SDL/MPWmake.sea.bin new file mode 100644 index 0000000000000000000000000000000000000000..b345e086651a4648752459f8ca4fb2009d817cbf GIT binary patch literal 22144 zcmcG#c~lcw_cnSegd~Ij1q4JyDFPy62&jmFPzh6vbPR(CjzJ{}N-#1cptM#55*&#W z;vB#Mu(c!3wA~%lc5V$gw(YAyQE_NH(6kML)GhRVzwi64@4f%rwQjO%pGws^rz-oL zeQNJ#KLu>R5zUroFUw&U=46Ba42$SmXu3Jd*fp2ll=IB(1)*Z};s>`}QRK zzjUfr=kx%OHa*=7kN~jvEg-rfJtiuGg64TJ9 zS5LMV(@2N*hW|7$wfmcUr$79f6{>Tc`+G{`Pd{oj0?Q)ME3U4sudTni(ghauAcO>_je5sozGmcnK02k=FViOyYtzO&OaKj z`vh{wcvqRp)*JPs&fTG;pIP7>bs=4IWZaa;jzcL?Lbp<(WQaCluah#6lR;WIZndL) z_o{OV9vkP}OA6d)Kh!eteD*!Yy2ak_|8PFAlKqj?x5MRA%#gXyv|-fIs+Gb&mtA@^ zZ=m#Z&)rSMm+^5|ayOpcbMNFE@BPn%?*)$w5P5oycAq@!mF6^;k_rW-4dPM zG_5NjxWa4a7t&E;QzW?^}$-Sm4fA4O8^y%f6@8)4Q&Y5I=PtMNE zSR!4q?(caVY4q|B#~ot>zO8zD>ipa(@fYr29TPay{X#cK@Vj>5l8rHQE-vV1k^W`4 zm+)*g)qP2-hF9&uw@V?7Ls|-I(97QrcTd>z_mstT%3A)LxHm1Q%S2JZPp}mJN)`Yje zRCc%ixQvp$%9^)*?%WA@! z&w>;@uj5UG;qgk*uH(zzmgP?f(Hx=Qs=M%$)sJsD!4vxC9zHZ!c;Hdylp~`e?VoC| zZoPeNG}~^M@Va9{$AU)fWajddAMSI`9uJ1xO-#gdakF19^teC`?XyE;r!l@0@-Nivon=YXPPnl8;H4$31r>AR=gKoP zjIo@+yq_NGqL|LVO}kUHuG0MS-JaDB?XINoHF$&SPgC}pfH&TI`XA97XNsEu*-^JX zhy0HzX@liv*ko6uk)r-=lbMxSZ?IDr{e3C;?z1-!JHE9FnQ10{^p5E^dXLrJI{P*n z8M<2k9s6D8z6sm^b;7{ZQ@{ITlIOLB!F^_G|Ay7m6pqe6-?JYhzkBtg24=kaH1kKW zVFGjeHJ_^+6UF5hZ}xsOQFi3zMU`gt=#>}l?tC*ETD{ltj9;-H+hlX}xyyOYKkF)g zbDogA&13LG1-Icv+A;^~oVUA|D`OW`y)lhFY;z~-(W(}&HGfWCYsi}Dy5RW~+4cB_ zT+Y&>r)JZALsid&@(tF$7x=N^L}ew8T-rDEe%Pp7ETOunDl4oi>y~&$KX>Z zmQpA`Dmxt8_r~mhy~x(@)~2!}tx0EG`X21C4mkpBv$B@0bo(8c2j^$sy|(_@XxoF8 z!~ZP(j2SSm%!;3Q&l;rX25Te3KbAs6o2RWZLWNfL%y^Gn%3oLbpAMe4UAHTH@A9ch z-*```Y1D?cMY+3s2R@Huf7n|h|2@{eRzBme+Vura;p|}VBV#hhPOaaYm~kklEAMF3 z?V#D;vkuhTojkx2P~W^NIgG5$wOTKtUsK+lXtn;Z%jK#LZY#duze@ZVV{Iq3*bUyo z>T|6_pFiNX{DOC*9lrLg_?KdZKj#7Bc>QF=CHrraGY{1keIHxHqOr0syYG&mZ12(j z@?(=`14R{!A_iIql|&;FzDNBN%j*d?gSJP%p>y_m4m z|8Aet4sG?@oA1ki*g1W5?IqMX)cNiC^@ZuVIf`Wy&#;6Z@mI)G?yb1uH_d0%v^1*I zj@Q+1|7hv<}p?vkfFFZ zBtP&({*BA!Q%|^S8z0QSE`OBHy?n#k54~Uc_G8|IwR;Z^&fLDU?c@(!!hPJ4tlo~0sqh64%1l~Y!tfDe`)aI&trXN>FOb88)Hl3 zyVQ_5KV0o9^q!i3{Pkbg+<%!B_a^c7PRHoxlg{^TY}&a`mI>KJ22(-4V56`?`=-%=8WIptm}KUZg1VlIM3h9YM$}kZ_5z7 zk{(h-!ghPgk*5=FZDy|Gd)?R7#>8|~yr5pSsdIn*rv1~`k*+V|oGbO5D}o)vyzIZ3 zCw?^{PQ}|SRIi>=*mm^x&F3@0tvMMjMVAt>rJrldP_f5CxGO)UMblFa{WUz4XKuXf z8*rO{XxsZj>&4zqUaWw}qF?-<9}ju%FtJQ$D4+J;xirUp@zwC#S%txGUL&s-us&>Z zv);33U2I(FKdiHGF#ORkQkFSFe}P=-y+8N*bn^Mt7x>_kJw5 zS$!iUW&#qsL09I`nK$Zi%xz9bQSYqvv{5r|I3}&%dgu6xq$_Le?C3=~g++y5e2M?+ zNjQD`)eHDPr0ak7|EDK$^7QNhW2D;|!jpIc!05w7ITir&)F&~Uc7JWrI(NjAxbVQM z%4>rm{WbP5P!kNBwb?k;pzi@ans&gApEYo;@3V zdhR0WU(tmmVD0rRdHlzW@`rauPw%v3Y`pR2x2fh`_ABfqrB5|w_L4|HG-y&KeSiM` zG18vJn`Z2_GN1PuBh9Zw{f}%~zS@4JbMdhmc^{rk-oALboAn`mAhHJO=J@UP*B*|_ zUvrCj*MH&b-n30;#$OG5{ZC~|;>4#ugoYTx*}Z@~+UPO!I_5brxp(`m48nQYeQfMP zn}y#`$lGM`zIq)SYkYg&7fc%}4TQQ^YF-Cs**x~+k|+4-$v=W}%JiI+mV)SC?!M4S z$95+5J5Ev*?7fBAEW93I@XP>ffcMIqhohHpcF;G!E}S-c{%VJ9)(%$UMb~#Q9i45; z-h^!LDCbn(yy>iCCI8G?QZyvTi#YGg2Yw9b(EYH5sVvNusB z3H{CY+Am$N>}K!ka_Q^pI-GRv`Ws7sULN^f(65Oz_x??3O%7t2S?xX76qc3WeH-a} z^r7v*!6Re6Z~Ri%SJazq{%wBAyPk~!u8e{BlwYzgjIOF^^8b5RP4udb+ss|t%Hp^E zmT`Q_sgtXJfNiR4v#vhnI^ad;wuaqXn;8XfHAJlI93DqHUVDJQm^8d`;OyC;O`UVv zi+-`LNWDF~=(@4LT@llud`=Z4DxD5Kk36+)nR|k8pUt_DUpj>OOO{?~1$`p+E_&{q zUpK#32;*ve*l(i`u4DV}4Ba2N|IIDUj(sxeKfhYB4|m+Yb>+P({u(sz*P;X6KPTKG zrA_;3(Y?#HC$xubuaM;8fc6@vrpx~vymZ9!%iu6Izoh3u&fUBV|5zsPJ$b*0VfEw2 zeHk-$(N<@bFPnSP`iHqZ!P`lj-!&&sXnXLu`pb zx#OJI*tzztTjl57?*=v>|NHTc)kWib{WrWx-q#g8=-7JCM>V={!J?P{B$vK*Sa{{| zREHf;e_tpp_xyBaeb?u|c<~a$>$>!q4iVoGxGJYBtenNWdT7j&nmv*yTG}7AxN;>%PmmIA>CF*W=ymk~fk$DLHKpwF>Fo z8k=S9oGr_i`G&3dg#LEPCGR^BT2a?O9}e_fo40?! z@8wL4xiSdT&G#4rTi#FR*;f4}v-n+}>~Y@R27TehSPe9*_Ousd2fGIq$iGSOO(f|X zTg=qt+SviYj*s=7ZT`#Lzhl~n>yp)L0!e0cdfNKv;Liu9&AxL)7+7`@I7H;Saz$3OVd{St)Vnoo^O&MhorFaB>AbehQKAZa;ylHi1rqJr$jMav7)i0~C~XQdT=iDmzfz5mu8 zfW}QfUHW<^DdT_CSTmmZ*_v+`w_H&gBFZi-$`Stedmvr^TGKi%HSWLH_)ov2U%%F* z#HHmFv1R``{69*o004|_ZE6U;1X&qL*hTIYh+?E-SGm^Um$u7lGI|SQ811lMxenk? z+ikTyN(VREZmMn3>yV9+hF#-6g4~RwvER63!0&C3)$Zsx@U-oj+7ta3G}h>WJ>fFJ zy|(*m7xW=C%IJzc;C4VxMrZ6U*AcY0nba_9fjGuctcN=h{MFX04nxDi$F_geQ_#Pm z$;L@oA2%8dwS87kLvbk97=sOSKS7bkC~S~B6%4fXt0Pc9(B1Y%?T@~L0*wLKTkZ#l zZ4ANw!&@RZwI39b+od909y;A$4EbzSTh1whKguILhX6EW4u`wH~<1Pjb zZT0F!s018tJEE4NhoBte66_#14}8~lOf5&hhn5@jvE$rkXsK}-c9fe7n%WxGGPDGo zYdfzlMSp-+8CPPh+@GM;#x>Z_+;72;Z5PyK=qaekSd5+Ks=(Q{GioJT09x8ksteH* z&_|&H_8ywyV?8z0f@4d~6?gAvn;sU%ddG z19rFVQO`wpL0QI3td?5^@r~25b=(a$w+eZvSLKvNp6l~;rR$rt8HgcT$MUuZ90beBP zYn?Bx9KJ~E7isggpDz-Szg!U-v0*^^BB@p*`&Q%;NgFw9#b&cdwvhv1A~!xRl~7RT zmtO#QgZ03Jqy!^PAqoj5lK|Pt)&cjXhrl5)8z$9*jbE$!UjEv2;>v&jJ_S%90wjf7 z-MB#h#~Vnrj)X!;3T5a?`w*dj5Xc|8CUyo`9czo5iQA2Cak~}Ix@TqpYjO%@aH%8H z%z)N(r&4ZnyVvxiw2t`j2f|_igcc?gg;%@;0E#{j^8?dj&1KQeT_`G66_j1B^%$RI$D2qJEr z5^i0S6hq#hD98t})CquS=g2@n-kr$*Wy27lJWd1*v3s;LV#PPAhs;%~2GVZyF`y+z zTRlmL2m~aA8h0i<5Ks_M6VJb-wVba(AH+vcAH_vf0x&g^aHrz{X=*&6BtLWOhp@Ya z_z?fKgB$NiNOXMi%p@@%@MukXzlBJ$eu>!H-#0x*(XihKON+*S-Mh?O75q7RxBPR& z?xc&2#CTE?06il3b4;!Lb7XBIpA0Uqvz$lLIh7o1QxcLMiUJayj6}r)5{GO`WJOUf z{xdy28374O*ILr6Y8q^AJ^Pg*Auwt8d;g8O^ZtEIkVly}59gUOeFe2%1h z`T;s8g=R$gB{Ns14hs>6tI-dg_plJEOQH!|@e6(^Z+3QrIUYgiO_~@_v2_54n*0pL zp0(hc=TD#0s{Qj4SDAQHJg2qt&rA5*&iKZ{?)Y9Vs2AnqeNCJ6$$cTw_z*tS*aXxe z(S%7`HSTG61z-R-8blVv4+2o*o_m&F{%b2YJw`K>F`@yD4VW=ZMiQV%?R73R$v7H7 zMn>L2>U#D)AW7i%gRvB{V~8#1%t}$UI9=yrC8g+GtR;LWz*cBUTHu8%>Lw{KL!}}yf81D z7{H;j(|_kFiB%@TkPyHI^wm%q6qPvO7YKY32BM?l2Uy%cKIz;B#)Wz*Y=BL@SU^0O zz}AD53}4tG#445ysX1Zi1n9hK>E-fyz|5C_0_F3fkzl8Uq_#M2Y@`<^Y-M!_PzzzF zn2jbiaWxQQGYh78#{!Y6UVx?pq*@B_%+(+@Q4DaA<5kc_1LlW)yknPU)ce3p z1a>eS$4IW6;DI26;adqKie^)W{LZ^ZS>?=F{IJiHq#8>;s)Mv{1i+MPRGv~3mC#y*Zrc|7slp;F?@jk5^VIq zZ<$#3xQY7#uT`*sb-g%*(bV9#@L{1tI46h=>|=@n5@|Lg`2(=v zuXgiaLlXKWri&Zx9NW{#)P=enN2sO)Vrw5k35kXw64vGNTGqn5_Yf+Qu4i8^2NVtB z$x27k^lW(7lJABe5DP3t6d{i7Vb}*JRO%tubkHhD_>tJ0mo@!JuT7vUoFl@$eC<1B}! z6*SW}9~wXzTid5gT!ZLHA}cZO4e@*ek$!;8|K;VT$Lqw*06LPu1gwPYjnUa#uDsm* zWZi18BJVr*C@O#yidDx`!df^$6f@OxhV@M9z%5lsU?2FSyYIPBra zeB;ZiV00MJy2WfHf4G}#kx_JMeH_>T{PKq%Nu0)(0ciNW_(dObhcpbkJrFZfIoC3e z4|gMpo%f9mSRxJSO8+60tQ|fs4l}7!8|`7X%!8rXNdbc}C~S z`-h^+0Hc3ch@q{0slry5n50`#@`0d1GS(VR<_%J~Q(_`W%=o1C4?OvRU)Thy4XCqM z0K>z`5Fk7Tcnl2q0StioSK=vrO~;21`1?TqK#&4i!VE+QIOr5NL81h#7+^S_#ZsLx zAUKYHlrloiOcGN;@-kZ076Wvhujs1re#DCH*dqpEfNp#g9xVd;=rr`6^;X3(niBAW z2SH#Nr~tqQ9vBxTA0&sK8>9?Gqf^K>eq+oZ2PW|41A3S7hqK$pToIsz8(A#@Ru>WZ z#~Yku13n6pDA{z3a0OQcp@Im7tJjLq33^iYx-k@+nx0K)N4~JtP3ic6Ap|$fL~$*E9kBaj0&ti0a5jG9vlq2Dl`M1 zO~$wnD2hK+ko9b14jF&Imk%z`XFPz$bHeBXR8%c-!XlS6#0>Yh^Q2@-L>6a48#66E z6^V@|L29TjM%_5xU_(CX>%=xksEa(eb5B{~^5_arU6Tl2GzNuT^E)Fxq3fCFMAg?) zK?UTG01n}Z@t>cipm+um%k@ty16x2C{!!R!mu}Ad7{Xj(%{zick{X$&KcJ?!g5W`> zgnpuJ5PBgXj`}gMNP2AWpu4cuN3V}LgGG)Lf;p|@;XwHyV-VKI)YSbTK0B;nKJbRc z%R*1n2Utl0hMX5akZkdHm%2^{ymy#6#Qx+_(I@~tRf6!~0YN|=fE`Le5E=BbK%b8Q zTP_H(MnF|C{={?)e`Kmm!=BF)Ji^2{%dg99WqyJg$02y7#2)nNve&t;hJ(_p#TWIN z6#TZNwY|>bx)er^3rLs-Ei5`ykr#=Ob>$%-#JYX5Q{!e^+F;jrO}d7l2P&E}isLQ0m3k zY1v~()BoxLPuIriuZ;=_Q8c@l*vC+SyEU;wf&u0&Y-RcgTSvJj0P%^f#sL5fx&_~?oGVf?AEAR5$ zt=PDuseLWki`_CV&-GI%Ovmx9osQSj4QM`IyU-1@_#51vTP(X0Ev^wF7oR#S#|KfO z0iUpU(AFCLpeaBrZ0(&l&lRmUUH3a+)x)5z2IH6>Od3@@ibf_gf-H;kB;f+;vM|LE zSrWvcAS6JQ`qFgO0FqkaOC_#?AR+*Rmce=^89)+fG?gPwU`#f^xNtKP>uMzvo|E<%njo3AZK6megpuzZbKKwqGqYLuJ2N} zV9Q}L96}G-5}Kd%7LYBleF&AmbmS(^BJ29!Q<3pA0LBS0N@x9P3=yUP*&1zB#B8Y0T+;x z0F{yibeUv+Y&6_yb1emM?AOLzXrbNW*eiMRAv5pT&?7PsB=($=CMulTu1x>q^C{Ct zKLSMvVa7&7Tq7NuNsD2B2gsd;7>dY;uJL6ks-gwN1ObL=6>U1I_X{4<&!V|m{9VQA zf&{70>q1IJAz)$ZxHl;1^aqD9wVo|{Y09W9wnm(v#9V;5NtpGmo<)ar);}4Ut$_YF z*>v4}uk6!`V_b~O(jWcgi>b@Nw6Zk_M7Swp&gd~?Wy>b;jZVQsoiE5xBL?ONqC<~F zXcj{b+=k3@K))6dJoK0p?|_38vN>Uc4}swT;t>o;jCjDvcM5kxf`|MZA9d?PU+hA& z#F<>X0><-HCo;ht0gNGYgcFO*Z+pG2nM?{d21O8W(6 zAPCN^UU8kUtZg-almvQHVc*XF15P_xQ`-5n{UX69`oEBQpQQfI1HIZUfd0L$8;>; z6MRZJ0f4NZDkfc@<|9u^Wz7V@sRRh(q>B`|DJ}+- zKz|m1ybWjEhez5sR3qP*u9~iL{07q@g%LhlwJ7OBs?!0~B{iNCf1xT5gY9b*Iq|;H zJ<^&gF~wv>si~p?PJ-WaN^RA-^5x`nn*2z_iZMO4{L;c-=CV*H-L4!)P+dNwyjMyB z1|>*KkP!afXF5V@VFSMBh(c{b+M~&^20xd?(t|~86b<7lfp0HcxsYpBO{3_n?{y*!GB?DS6)bj z!Ok9}nBpx_des1tu38Psz)Da8cHXqW{HGcu8G!bit}wscXU6?ot#MLjB!L$(5^!8X zE(2m;1){SqgD_g>aY4dz_gFD0);dJd4Onci4h4b9^fPw&y zd<+TPKL&M9r0%sOE^sh$mSn-;<*PSn^@k6=Jjb_hu!;{M|2SM4ARUBx;NoWl{A;G4 zDL#e`VBHu-z8^r#pg;3h0!+flSmfrU$38YY7R!#qlrYq#=;!TPn1|TtkrxbR(06aq%q{;{LCuw1ZSQ6tT zIzxbAQg-1Y6uTGAp^-3h;iBml8d;DiC37fZI>)e3O>dtQfyDrE(8{GGjfr=6%v7@5o^?9r3K1=foI=#BdXP3qvH zP)838gzX@XY96=I7fnrc)y$HC&@Sq$H0M7$sIOcv5WqvIQJ;BYl085<)YPN`5C&eZ z8?A8zw2zv&w=?)4bYlti8r+*6&$WA%Dwxf63Bo7oc#Usu?8U;8ShWi!9?-dV?^DOj zpE=eQ2C<&z4=~kU0h!3ImX6O{Q z4rLH9M?c=xZaw@7Bo99r?#3B7ikD%ToWI3>ko{|fR5ksNLA{qemI`AV_*g6mVfy=C zqJM^a?A0mIxrN$DH{A`;L4B-B0l+e~RZ zaD;{=hR{0w^~V|#Pdt;_BPMFyF%rfye9Nj5`*J^la8C5w6qbpAXj^Kf6hW=jN&GSH z6F}~o$ixV&HDf$<8VX?H0%W16noJg&3~y7#ACx%-g&;$UPgZEy`O)K&(8uyp97cDae*X(eFW39!Lgp zRluDz3q#kkN=U~QWMT&Af?`0EIx%vMAv6g&6%}Lk6gYx$avo+W6a)JRXpW^Y1BB2( z1Qeo^16;s}0Awgc8bN~~bCoSiItiKC3(oyDfisHDXMify(@pBiKx5scu;@^P)LwMJ z&ln-4VbAR`l&&C&38YJ`6Icp~5Q9+?i<36zdvKyx{OZH%IBG=>Jd)Vy4}nuv5^NQA zlG5o<0@~r*Fn}XS<4mtyS$roqDH!f(0Vt4s+;SbE^~|<%wk1InD%qM0Xf~LgAcC}I znX6L-G)RH~P2|9ULdPQ|q$jW+pju{EAX*Y^1BJ+4p*4&X3=k(}h$mRd$!S7>Zu?Qu z;dZ03T5O7dXs4>A^sH(xUvwVe!&EbaW>jTA#fKSq{iZ z2%zcQKPVV8g{FcNFd}N|Wa(O1Rk0|6NFFG!%$hk5ghU(Du$8(6dd$q=IU=4?7J?!G z5pmqY45?Dr7Icx50;F+)QA&Z`+Ku9mFr13&**SDrM&sQIp_*tg{&ZHgKIWDJc%oWd z15ooNlbVQUpRagEM8!kXk^qwf*lhe-Hod1@XwveN64EnfCU2|)z!5iD+2c<|GzR|M zWJSY=a;a#-@DlYiYnS-IUcNI$3BuIGLeAD?CjMNp`f%2(=VEutuC_cEm_55+Z!^Sc?uEg;hQ7M%92(z?0|VDt)gk7cvA~nublG$kd))Lrfy{X- zNQUEhzr^I&^HKcCLZm0SKJA~G5uRfBAcKutkTi1y_D(`VK@2(cDqSopcn_G#A7Bf9 z&xS1Z*~n)VC8Q-zPfh^t1f~`djlt23#|VXQOrd->`0?9PMTI#eP-F_gn)GZ>-{h45 zN%9d9z8)mb6Og4e*olvIqhc})hz>BN!xbPP&%PW_7FbE>YUEfsNpXHRaQ(%5r%TX)p|*weCWwA8faKP9B;5ih5<;9 zlH;z!5xir=LEJxvk%MB`ibxXmcg7p(PlTh@?mg|lm96;c$gz>wXW*jMCQS~ z2iE+Ta@^y^0XT?&!B>omakQmK6m}4Xp5$-c7!nL=#BMr(ixopAIld?sG;WIt#+RVzemPD+k@{MX#*IHM%nMk1YAI}L z+_-;X)hS9^FzzA#ps&rZJHu)AYrH6`u0K;@3N9A5LaCgv8gxyx+KGwapH|4EPBWTE z6CewvnW;Oxz0v8=J|ZbnuRFZAabLl6O5KTO=DmZ%?dn;;sU{DGXbQ3dhXO%VYWj*I^J68Mq1%HP``8|)L4P8 z*(xM*CuU*KcEK^6x4bM6Sue+h{cjDisr?^B-=&KTBE~UnfRzBSC=Msd;#dN8PDwPy z&ItkSu|Z=LVAR^#yt{K?0-~A|1jO#4X(lz4#iOG^ol|%&OE|&(?@ftOXun0A^477O z(|kFzn!uoh#dq-zwF?1@z2$7EXT0ZdW&IyGTuFIZV}nUZlf@$%eW40p!+fn|-$|19b*ZTu(Fzl9yvt&^@YK6I#=uWzuR86pUYV6ygTw%^V_cEe?Z&@ycZ$WB|ORPD}NAW-3?)8?Ux+6Zfi74&m@*Sz?8ZZi9DL)S%4R?TQG?eptlD!UBgiO^Zk%WO7Tl4yi=Ow zq5|A+z%9DOV#L$DvTO;=Ly!rv(P{$bwlu8}5V66QBt`zI4ATM8zOsZcILyMEnOHYV z;oohlCbA(EUIWMA$2-y}#S(0DQx}i;>n{ub@#sQ=f9@vOToM)v>>DZi7K5&bMPE3gaLcGW_opqLti&z zI;YJ}VtfRVGtX=Nyp>3kJcqqV{)w>H`@m!Zc7^{8Og!aD%l;8hwk7v28*G^a|Ii%5 z2%*F(x@}m2WdvrMT~IU-6j(Mw*%{zuT(>h!&0s$2Sp)}OLwSCNouq*Yn=jF`e;j@u z*-Q%-KLO^u6*|^OL#!F^Gf*Gl{XEb(+bI}-&sWDn1;FCivwhUb?W0&*EZav_#6q*~ zlbHHUYrLYTMoKYION`BU|CY6udQ2piO6FBZB@FmXe5o%&Gy4p3yjyAr90U^g&f_V8 zO^4q;TED&kFxMJ4w0?>)Onn0P_HLaBz}uO96TVNmu6V6)qQ1&rJWPRbmqRC8j8mNs zo{tBfwvE`m?bcnrHc#;Wm0`kwmKo<-9yWUeob520B`Hs8x*%$<9~Bn^x3ax5pb;02a7`=bwmO- z3EkN6kV+=W@nQTnfx@lrUBpZPhTU*)$wev6K)pB+E~b#=!+5+Sew)L+Jut~Yy@I`v z<2Us0h%EPI+CaL2dT$_e_8;|rx23LnBK>kNiYw3zHh^CKcvJ;fYiD{Q5b zEjN}N@}_)5tr%=D1~)5M6l1t)BFx6kd<>g8_5xso&Qx&}7xXCf6xgB1pa}Tg3%rPo z`v^MCk&pQp->7FZlB^mtUoR(PlY%;DwP#1=W-)*`F1c~*j|S%BPit8Nk&2EpQ-1igyYDs0xV063+R*f1KMhtW*eKG! zUyw+oCMbrTUU;RW40?KNvKeCuHk-rF9~8E=kfnB!q#>pi~XiHiz*Da{y8EP5Q6;4?@?aM-YVDd9&( zTXl=a)&17N^g}}!gg?S}lY^CYYn!$pVdbew=@(b^4pJLEMMA*=Nk>Qg0<{y~rmhnz3w<6Q9|Wv#lDB+2#%H)_MD5@HA+vB{0C0&`&sm>ocpx<2sjFy-W!t)@dTk)ZTKs zE6SYO-zTbI9oTYti=FEj05pcFefj#`fT1ydV;F_^-iJ_#+*jL+r^42c=>QgJ^IaKo{I>xQ zDc!sCANO=RT&>vR=6LgO!WsR`KC>FmC9v$12d#qB`!a~fx53Uykz;QF9r^SX)GdH+ z3y7$LKGoy|+<4ys1}_f;`RBthuqW`g5lRb^e2`==dK410(F*vOL-gBvoBfdV2g|Ki zIZb~@TpswO=MTj&c}D?bg5g_$=%+IPcDf!q;H)Mu#CU+Mm*C{(VFdWr?8;0lT$l4arEIs_ahXtzohgPqZID&GRlfk^>4D5I0ImuYOnjn zAej7Hf3?-SoA{D<4&@O&*JhDcSuvkj|Hz((r z8^L`LE*Lou6vRe2dp6-jDJC|A6c9@|%1suq_21>;f0wQQE+2d?A;!PUpnsRbf0y}R zOOoH$(l(4JNlg~^y{{#44LUFaDvj`#hz(f1{K}*w|C@wob)TRxW&#@VI>ryARlt#i zGXP8;d3nP^I8{UoGqL>uz*-W3#*HI9A$lT-N*ZUwnO+rn8tmR{nF?6M+p7o|XVVFH z!oVAh10V?404qvTPJWIuo46#PsjYw=%4GwhOK*ZfbrM=oPo(DjfG;#ZjGLFeWJzv5 zl2!@;LEM!WPC(L%iY1ciMF>GI%gHM)$!SKG7lbR5bBl7C*~EV!8jgk}>~vXf;Rv4? zfd9oP&drx1*#(OU-a@W22T^4gB8v-hvWs$-RMC*)LQ4~&1mFz;P9n(N) z$^rs(0iYA;0*0V|a4__jFp_sQQekfo72E#Z2Gl89r)kOiY z0ISai5w%SKpjv``Hrv6@!L7f4V2`?d;+_5ZuZfxE0F4kFgoO3oBf_u}mTrrvTdGp@~$2oOw%p>k_88G;z3)82E`+ z6F1(H-1-f3u)8$z#0daSPJ~`itD|q-0hCWfB5!cCHR(EI5RkHb5U>xKy3g>BA83ZW z0dNitpNz~VUK}dOT_Vjv;z^(YIROF~F0-?X3YX_AbMx{5Ehh+x<04ZhbEbrIb-(!$pD0K6^gu^gPAx>Bf>Fw%n3&&bQ(_QFU2%ttXaTUS>0Yr35R2aeukRCu;Ukx2127TlM zO((W|V*b-XK19G(|J%?-WMVuC_6cF=MBRG&S3?((Dd}Xw(rF^{h_M4%I?N*dT-kM)dndyD4fCAdz_g(eGF766Cf2rQfgG1>k?{_p5e^74CoP7u7>w^s8&= zLJy$L|55JHf7CmoTopt z1AKc(Q>opOtdatnQnI`F(Dt3m8s!ecohUw36Hl$wze#f~Tr=nhsOv~{CYtBz>2D&qqh zCM{9v=cts0XS6jEt+G)jkdT-rJY@()F^AYG#*6OOyoVB~!XG(J)pfla!RmWLdIY8jxj4(Qk9J zq%vu4?(9-oRu+$$WmIOCNVD3?N-~w`ZW;GrZdMk3ZD#wAb5Lzorc9E=30G;AT5Vlo z5RlgB=NKj_;S*J=O3el(eSjK4@|bN{soJ7?s9GtF<`fvq3{zxERib0=#S%_|Rwd;u z&om&i5@`$Z|5fBcrF6^gote_o+4|4=;Ve$riMyd;b<7i!;(jo!@SaADj!ZvVb>h9Z zqmpA=XMX}#hJJG6`KzipDQBVuDnXH9)WMZWNBr+!7fykK-*Zm6c{?XlrGL&4w!EUJ2q}g31nK->V~%PIRuLmY&t^)xxocREdo< z+){KH@zto5Dm@LMX>&L|#Z{HWq}J|GX|$S}N@ebOW@SxIEfzyeT#ZUA*|Jv!BZ#lw ze(N`2vo`0W%}zLW1jX^z&DHY|D$=gfAb~Z-J2KRe{@0Q!saBhbOw`}4$*P*NE;kp@ zDr%&v*)uZFVw(v#L@O(uZo@*{=SbTu0$Hv!m!Li7ss#ut(vWpNlTT=T3NBIDpNZLz_UxGStZjmRi)EqSq3$~R0`Fhdu3V0OJ&Mr!^*7O zj2fd-Wz3{INzu8Ps3CW{Dobk2%;6*CnyO+LXlt}PLg%SeH8PE=a*q1`4#FSWRaC38 z8KBRRWU91VRH`ua4a=o?rx(pAmqul&RI`bxlDZQzbDCAE;vK5e;+?ZqrJ066gr?gF z2DOVom0Fh1$xH?}8>9<;sYi(o+9v6Yuyq zB9ww(G@4p{oJS>_uv5N9qyKR_3U*5PReV`pXo=*ow!E@xWVJYwpJ_V#w)+k5x!d+&Dds6?3``|2ZY+wN)a8QYQ^j}OgkF*UOuMc*Kea^uS;} z6ld@)61|Yjx?Tn1P9Z!4f+q$H%K^PQ%7E37jt+Pq5(A-7cc|M5z(P&ATJ$4OZ-fpl z)Iw}GhLe4(RY@a&yp5b` zOq@`*~BgPejHT1deZ-BEazFHvuB zpt~=`&8IE78r+Ks>-}_mu?9pwx?8$&yi)ZlF4C90&=rJ@fxZVsXK3NVqE;|0uWuIH zqkYN#klKY2)2_C<7r{Y0=*1=4W$KV_8}~Oy`_Ub^$BQBELxcB4Vlk-d40YjqNg-~< z1KEy%Y7Zu3v1ptxD8Rhh-Y++h8}yCsL0=VN0Mcy7><_AK=nnP=d(a_-XzU9GVV7-3 z5?Mc^CfqeyJFkdHxgJx*A9Mmw;@En%l_}1f$Wqw5oC^a*`B#n;n1x(BOc?k(QK|yC zjXkGHo2uZ6bDTAV9mMhAP1?vdw6lLyV1*uesFvKsiAeAc?lyQ6x za^8SO~d|^Hr>s%31#lW)l6>=ihtm(mi`zRaZ!mA@a(D=!Rayf<%tQ<;DD&G2W(4j((LN;lOuWTn%$iN^Ep;%^7^+bTaj;Mo2e#MgWzHk*e7f7?w3}ooFtCrsYmqSCY@D$wN9kE z^i~Wo{^aCXrzv$(c9)aaExY~66Jwo)PL*b^T(_3wy2nnI8sxfigFne0IX`~>QAo|D zPG-i+wWl&ptz7p`My@+E7BcP|?bNaTW_RF%Kk2{U`c z)Uno=LPnjbM+a`E6!BU!Zj&1yYBM6}tZ?-k+Ny^nftLyCTg(Q;(Tyt?cxlq#%DJl& ze6gUJzOcE42`z1KA#sda)K{(ZJ zbO3ov+|y5R>6wMn)50=&Fsv`F(hvfQs}N0>YoAM7ig51?@(DR;(Kpfrzb-7&mhiP* z^n-;EAetxt!G#nt<@G}JQS){1q13)9Y}V8n6mWM;)(z+omSk6JaxhmDo6Ulyluxg;239Pi*B7vLgs8KUC*OFj!1NzxWe|z;K|I z{iAw@$Ke0F$rl5&iSmP|Tr!?Yo2)Hm5z426)ov;-+kw&Bapv*W9!4eSPBolcuJ z!+9M&CSga=pGmldxkvA+RMP$=f`as(%gUjc$%=^PQ!i@^gHHpkUyvVE_TgR2ZuOox zHBsm^8ttSf-NK#YfV3Uj5D~81KmFvis8l*8R^iM;4jFWlRnNNGJwZ}hQTAm}^6d=k zCaeLSs7-%2oUqHVvBqV_(c;Z17l~z!*rQgtsP=g1-4*2a||@ZaWllz9hgfjG_TXoK)Se%dPI%z~+cDKpMn^|?G% zyKs(pw5j&3U3XW9txff!{_CZXv_FPNIi214@t(76u}(b3XCo6h0Do4l{IIFoRE=(H z7aQ8-ueYh$$@SZ=!MVjq;k&Z`bE<#`tHduF&h5Z861*M5qU~2BCTDi+S{O%SRGM!} zVZpT~TmssGyabf0o5BTFye#v2WY0`}^T-n;O(Q0NrEA9))Wl5RqwAys=?l=dH3Z;kcUEl~6Y z!s>tzrDdEEhACB{8qq6BP(S*y~jo;3lck-N@(yobOxs?v|B^iD-7rZrEXZch>VA7l=z{9P*ldGL=T zO@#TURsM)dzsoe&8T^l!&gq|LnpB;4j^fr$jq{SB%Z4> z^aAU=i(lrc^~6^gj;b^S$@|4pdlZ-%6D&5X;r>@8g^Us Ti1F@^C5*3O!V?ZhhKc?QZkous literal 0 HcmV?d00001 diff --git a/SDL/Makefile b/SDL/Makefile new file mode 100644 index 0000000..3c8055a --- /dev/null +++ b/SDL/Makefile @@ -0,0 +1,111 @@ +# Directories. +OBJ_DIR := obj/wii +LIB_DIR := lib +BIN_DIR := bin/wii +SDL_OBJ_DIR := $(OBJ_DIR)/sdl +SDL_SRC_DIR := src +TEST_OBJ_DIR := $(OBJ_DIR)/test +TEST_SRC_DIR := test + +# Tools. +PIPE_TO_SED := 2>&1 | sed "s/:\([0-9]*\):/\(\1\) :/" + +# Library source files. +SDL_SRCS := \ + $(wildcard $(SDL_SRC_DIR)/*.c) \ + $(wildcard $(SDL_SRC_DIR)/audio/*.c) \ + $(wildcard $(SDL_SRC_DIR)/audio/dummy/*.c) \ + $(wildcard $(SDL_SRC_DIR)/audio/wii/*.c) \ + $(wildcard $(SDL_SRC_DIR)/cdrom/*.c) \ + $(wildcard $(SDL_SRC_DIR)/cdrom/dummy/*.c) \ + $(wildcard $(SDL_SRC_DIR)/cpuinfo/*.c) \ + $(wildcard $(SDL_SRC_DIR)/events/*.c) \ + $(wildcard $(SDL_SRC_DIR)/file/*.c) \ + $(wildcard $(SDL_SRC_DIR)/file/wii/*.c) \ + $(wildcard $(SDL_SRC_DIR)/joystick/*.c) \ + $(wildcard $(SDL_SRC_DIR)/joystick/wii/*.c) \ + $(wildcard $(SDL_SRC_DIR)/loadso/dummy/*.c) \ + $(wildcard $(SDL_SRC_DIR)/main/wii/*.c) \ + $(wildcard $(SDL_SRC_DIR)/stdlib/*.c) \ + $(wildcard $(SDL_SRC_DIR)/thread/*.c) \ + $(wildcard $(SDL_SRC_DIR)/thread/wii/*.c) \ + $(wildcard $(SDL_SRC_DIR)/timer/*.c) \ + $(wildcard $(SDL_SRC_DIR)/timer/wii/*.c) \ + $(wildcard $(SDL_SRC_DIR)/video/*.c) \ + $(wildcard $(SDL_SRC_DIR)/video/dummy/*.c) \ + $(wildcard $(SDL_SRC_DIR)/video/wii/*.c) + +# Library object files. +SDL_OBJS := $(subst $(SDL_SRC_DIR),$(SDL_OBJ_DIR),$(SDL_SRCS:.c=.o)) + +# Test source files. +# It can be useful to switch this variable around to select individual tests which are problematic. +TEST_SRCS := $(wildcard $(TEST_SRC_DIR)/*.c) +#TEST_SRCS := $(TEST_SRC_DIR)/testsprite.c + +# Test object files. +TEST_OBJS := $(subst $(TEST_SRC_DIR)/,$(TEST_OBJ_DIR)/,$(TEST_SRCS:.c=.o)) + +# Test .DOL files. +TEST_DOLS := $(subst $(TEST_OBJ_DIR),$(BIN_DIR),$(TEST_OBJS:.o=.dol)) + +# What's a full build? +all: $(LIB_DIR)/libSDL.a install + +# How to delete the intermediate files. +clean: + @echo Cleaning $(TEST_DOLS) $(LIB_DIR)/libSDL.a $(SDL_OBJS) $(TEST_OBJS) + @rm -f $(TEST_DOLS) $(LIB_DIR)/libSDL.a $(SDL_OBJS) $(TEST_OBJS) + +# How to install to SD card ready for running. +install: $(TEST_DOLS) + @-mkdir -p dols + cp $(TEST_DOLS) dols + +# How to build a library. +$(LIB_DIR)/libSDL.a: $(SDL_OBJS) + @echo Archiving $@ + @-mkdir -p $(dir $@) + powerpc-gekko-ar crs $@ $(SDL_OBJS) + @echo ---- + +# How to build a DOL. +$(BIN_DIR)/%.dol: $(TEST_OBJ_DIR)/%.elf + @echo Creating DOL $@ + @-mkdir -p $(dir $@) + #powerpc-gekko-objcopy -O binary $< $@ + elf2dol $< $@ + @echo ---- + +# Compilation flags. +#COMMON_FLAGS := -g -O2 -mrvl -Wall -mcpu=750 -meabi -mhard-float $(MACHDEP) +COMMON_FLAGS := -g -O2 -mrvl -Wall -mcpu=750 -meabi -mhard-float $(MACHDEP) +INCLUDES := -Iinclude -I$(DEVKITPRO)/libogc/include +#DEFINES := -DGEKKO -DDEBUG_ERROR -DDEBUG_TIMERS -DDEBUG_THREADS -DDEBUG_BUILD -DDEBUG_CONVERT -DSDL_AUDIO_DRIVER_WII +DEFINES := -DGEKKO -DSDL_AUDIO_DRIVER_WII +CFLAGS := $(COMMON_FLAGS) $(INCLUDES) $(DEFINES) + +# Test link flags. +LDFLAGS := $(COMMON_FLAGS) -L$(LIB_DIR) -L$(DEVKITPRO)/libogc/lib/wii -lSDL -lfat -lwiiuse -lbte -logc -lm +#LDFLAGS := $(COMMON_FLAGS) -L$(LIB_DIR) -L$(DEVKITPRO)/libogc/lib/wii -lSDL -lfat -lwiiuse -lbte -logc -lm +# -lsdcard + +# How to link an ELF. +$(TEST_OBJ_DIR)/%.elf: $(TEST_OBJ_DIR)/%.o $(LIB_DIR)/libSDL.a + @echo Linking $@ + @-mkdir -p $(dir $@) + powerpc-gekko-g++ -o $@ $< $(LDFLAGS) + #keep elf for debugging + #cp $@ /tmp/elf + +# How to compile C file (Tests). +$(TEST_OBJ_DIR)/%.o: $(TEST_SRC_DIR)/%.c + @echo Compiling $< + @-mkdir -p $(dir $@) + powerpc-gekko-gcc $(CFLAGS) -c $< -o $@ $(PIPE_TO_SsED) + +# How to compile C file (SDL library). +$(SDL_OBJ_DIR)/%.o: $(SDL_SRC_DIR)/%.c + @echo Compiling $< + @-mkdir -p $(dir $@) + powerpc-gekko-gcc $(CFLAGS) -c $< -o $@ $(PIPE_TO_SED) diff --git a/SDL/Makefile.dc b/SDL/Makefile.dc new file mode 100644 index 0000000..16c0f32 --- /dev/null +++ b/SDL/Makefile.dc @@ -0,0 +1,111 @@ +#GL=1 + +CC = sh-elf-gcc +AR = sh-elf-ar + +ifdef GL +DEFS += -DSDL_VIDEO_OPENGL=1 +TARGET = libSDL_gl.a +else +TARGET = libSDL.a +endif + +CFLAGS=$(KOS_CFLAGS) $(DEFS) -Iinclude + +SRCS = \ + src/audio/dc/SDL_dcaudio.c \ + src/audio/dc/aica.c \ + src/audio/dummy/SDL_dummyaudio.c \ + src/audio/SDL_audio.c \ + src/audio/SDL_audiocvt.c \ + src/audio/SDL_audiodev.c \ + src/audio/SDL_mixer.c \ + src/audio/SDL_wave.c \ + src/cdrom/dc/SDL_syscdrom.c \ + src/cdrom/SDL_cdrom.c \ + src/events/SDL_active.c \ + src/events/SDL_events.c \ + src/events/SDL_expose.c \ + src/events/SDL_keyboard.c \ + src/events/SDL_mouse.c \ + src/events/SDL_quit.c \ + src/events/SDL_resize.c \ + src/file/SDL_rwops.c \ + src/joystick/dc/SDL_sysjoystick.c \ + src/joystick/SDL_joystick.c \ + src/loadso/dummy/SDL_sysloadso.c \ + src/SDL.c \ + src/SDL_error.c \ + src/SDL_fatal.c \ + src/stdlib/SDL_getenv.c \ + src/stdlib/SDL_iconv.c \ + src/stdlib/SDL_malloc.c \ + src/stdlib/SDL_qsort.c \ + src/stdlib/SDL_stdlib.c \ + src/stdlib/SDL_string.c \ + src/thread/dc/SDL_syscond.c \ + src/thread/dc/SDL_sysmutex.c \ + src/thread/dc/SDL_syssem.c \ + src/thread/dc/SDL_systhread.c \ + src/thread/SDL_thread.c \ + src/timer/dc/SDL_systimer.c \ + src/timer/SDL_timer.c \ + src/video/dc/SDL_dcevents.c \ + src/video/dc/SDL_dcvideo.c \ + src/video/dummy/SDL_nullevents.c \ + src/video/dummy/SDL_nullmouse.c \ + src/video/dummy/SDL_nullvideo.c \ + src/video/SDL_blit.c \ + src/video/SDL_blit_0.c \ + src/video/SDL_blit_1.c \ + src/video/SDL_blit_A.c \ + src/video/SDL_blit_N.c \ + src/video/SDL_bmp.c \ + src/video/SDL_cursor.c \ + src/video/SDL_gamma.c \ + src/video/SDL_pixels.c \ + src/video/SDL_RLEaccel.c \ + src/video/SDL_stretch.c \ + src/video/SDL_surface.c \ + src/video/SDL_video.c \ + src/video/SDL_yuv.c \ + src/video/SDL_yuv_sw.c \ + +OBJS = $(SRCS:.c=.o) + +TEST = \ + test/checkkeys.c \ + test/graywin.c \ + test/loopwave.c \ + test/testalpha.c \ + test/testbitmap.c \ + test/testcdrom.c \ + test/testerror.c \ + test/testgamma.c \ + test/testgl.c \ + test/testhread.c \ + test/testjoystick.c \ + test/testkeys.c \ + test/testlock.c \ + test/testoverlay.c \ + test/testpalette.c \ + test/testsem.c \ + test/testsprite.c \ + test/testtimer.c \ + test/testtypes.c \ + test/testver.c \ + test/testvidinfo.c \ + test/testwin.c \ + test/testwm.c \ + test/threadwin.c \ + test/torturethread.c \ + +$(TARGET): copy_config \ + $(OBJS) + $(AR) rcs $(TARGET) $(OBJS) + +copy_config: + @cp include/SDL_config.h.default include/SDL_config.h + +clean: + rm -f include/SDL_config.h $(OBJS) diff --git a/SDL/Makefile.ds b/SDL/Makefile.ds new file mode 100644 index 0000000..df3d146 --- /dev/null +++ b/SDL/Makefile.ds @@ -0,0 +1,63 @@ +#LibSDL 1.2.12 +#DS porting by Troy Davis(GPF) + + +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro) +endif +ifeq ($(strip $(DEVKITARM)),) +DEVKITARM := $(DEVKITPRO)/devkitARM +endif + + +SRCS = $(shell echo ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/events/*.c ./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c ./src/joystick/*.c ./src/joystick/nds/*.c ./src/cdrom/dummy/*.c ./src/thread/generic/*.c ./src/timer/nds/*.c ./src/loadso/dummy/*.c ./src/audio/dummy/*.c ./src/audio/nds/*.c ./src/video/dummy/*.c ./src/video/nds/*.c) + +OBJS = $(SRCS:.c=.o) + + +SUBDIRS= + +CC=arm-eabi-gcc +CXX=arm-eabi-g++ +LDSHARED=$(CXX) +AR=arm-eabi-ar rc +RANLIB=arm-eabi-ranlib + +CFLAGS = -mthumb -mthumb-interwork \ + -march=armv5te -mtune=arm946e-s \ + -O2 -Wall -Wwrite-strings -Wpointer-arith \ + -DARM9 -D__NDS__ -I$(DEVKITPRO)/libnds/include -Iinclude + +CXXFLAGS += $(CFLAGS) + +all: $(DEVKITPRO)/libnds/lib/libSDL.a + + +$(DEVKITPRO)/libnds/lib/libSDL.a: $(OBJS) + $(AR) $@ $(OBJS) + -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 + +clean: + find . -name "*.o" |xargs rm -f + find . -name "*.d" |xargs rm -f + -rm -f *.elf + -rm -f *.nds + -rm -f *.gba + -rm -f *.arm9 + -rm -f *.map + -rm -f *.img + -rm -Rf *.d + + +subdirs: $(patsubst %, _dir_%, $(SUBDIRS)) + +$(patsubst %, _dir_%, $(SUBDIRS)): + $(MAKE) -C $(patsubst _dir_%, %, $@) + +clean_subdirs: $(patsubst %, _clean_dir_%, $(SUBDIRS)) + +$(patsubst %, _clean_dir_%, $(SUBDIRS)): + $(MAKE) -C $(patsubst _clean_dir_%, %, $@) clean + +#include $(DEVKITARM)/ds_rules + diff --git a/SDL/Makefile.in b/SDL/Makefile.in new file mode 100644 index 0000000..19c28e8 --- /dev/null +++ b/SDL/Makefile.in @@ -0,0 +1,182 @@ +# Makefile to build and install the SDL library + +top_builddir = . +srcdir = @srcdir@ +objects = build +depend = build-deps +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +includedir = @includedir@ +datarootdir = @datarootdir@ +datadir = @datadir@ +mandir = @mandir@ +auxdir = @ac_aux_dir@ +distpath = $(srcdir)/.. +distdir = SDL-@SDL_VERSION@ +distfile = $(distdir).tar.gz + +@SET_MAKE@ +SHELL = @SHELL@ +CC = @CC@ +INCLUDE = @INCLUDE@ +CFLAGS = @BUILD_CFLAGS@ +EXTRA_CFLAGS = @EXTRA_CFLAGS@ +LDFLAGS = @BUILD_LDFLAGS@ +EXTRA_LDFLAGS = @EXTRA_LDFLAGS@ +LIBTOOL = @LIBTOOL@ +INSTALL = @INSTALL@ +NASM = @NASM@ @NASMFLAGS@ +AR = @AR@ +RANLIB = @RANLIB@ +WINDRES = @WINDRES@ + +TARGET = libSDL.la +SOURCES = @SOURCES@ +OBJECTS = @OBJECTS@ + +SDLMAIN_TARGET = libSDLmain.a +SDLMAIN_SOURCES = @SDLMAIN_SOURCES@ +SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@ + +DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in MPWmake.sea.bin README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom-OS2.zip Watcom-Win32.zip symbian.zip WhatsNew Xcode.tar.gz + +HDRS = SDL.h SDL_active.h SDL_audio.h SDL_byteorder.h SDL_cdrom.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_getenv.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_platform.h SDL_quit.h SDL_rwops.h SDL_stdinc.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h + +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) + +all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) + +$(srcdir)/configure: $(srcdir)/configure.in + @echo "Warning, configure.in is out of date" + #(cd $(srcdir) && sh autogen.sh && sh configure) + @sleep 3 + +Makefile: $(srcdir)/Makefile.in + $(SHELL) config.status $@ + +$(objects): + $(SHELL) $(auxdir)/mkinstalldirs $@ + +.PHONY: all depend install install-bin install-hdrs install-lib install-data install-man uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man clean distclean dist +depend: + @SOURCES="$(SOURCES)" INCLUDE="$(INCLUDE)" output="$(depend)" \ + $(SHELL) $(auxdir)/makedep.sh + @for src in $(SDLMAIN_SOURCES); do \ + obj=`echo $$src | sed -e 's|.*/||' -e 's|\.[^\.]*$$|.o|'`; \ + echo "\$$(objects)/$$obj: $$src" >>$(depend); \ + echo " \$$(CC) \$$(CFLAGS) \$$(EXTRA_CFLAGS) -c $$src -o \$$@" >>$(depend); \ + done + +include $(depend) + +$(objects)/$(TARGET): $(OBJECTS) + $(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) + +$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS) + $(AR) cru $@ $(SDLMAIN_OBJECTS) + $(RANLIB) $@ + +install: all install-bin install-hdrs install-lib install-data install-man +install-bin: + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir) + $(INSTALL) -m 755 sdl-config $(DESTDIR)$(bindir)/sdl-config +install-hdrs: + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL + for file in $(HDRS); do \ + $(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL/$$file; \ + done + $(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL/SDL_config.h +install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir) + $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET) + $(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) + $(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) +install-data: + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal + $(INSTALL) -m 644 $(srcdir)/sdl.m4 $(DESTDIR)$(datadir)/aclocal/sdl.m4 + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig + $(INSTALL) -m 644 sdl.pc $(DESTDIR)$(libdir)/pkgconfig +install-man: + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(mandir)/man3 + for src in $(srcdir)/docs/man3/*.3; do \ + file=`echo $$src | sed -e 's|^.*/||'`; \ + $(INSTALL) -m 644 $$src $(DESTDIR)$(mandir)/man3/$$file; \ + done + +uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man +uninstall-bin: + rm -f $(DESTDIR)$(bindir)/sdl-config +uninstall-hdrs: + for file in $(HDRS); do \ + rm -f $(DESTDIR)$(includedir)/SDL/$$file; \ + done + rm -f $(DESTDIR)$(includedir)/SDL/SDL_config.h + -rmdir $(DESTDIR)$(includedir)/SDL +uninstall-lib: + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET) + rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) +uninstall-data: + rm -f $(DESTDIR)$(datadir)/aclocal/sdl.m4 +uninstall-man: + for src in $(srcdir)/docs/man3/*.3; do \ + file=`echo $$src | sed -e 's|^.*/||'`; \ + rm -f $(DESTDIR)$(mandir)/man3/$$file; \ + done + +clean: + rm -rf $(objects) + if test -f test/Makefile; then (cd test; $(MAKE) $@); fi + +distclean: clean + rm -f Makefile include/SDL_config.h sdl-config + rm -f SDL.qpg + rm -f config.status config.cache config.log libtool $(depend) + rm -rf $(srcdir)/autom4te* + rm -rf $(srcdir)/test/autom4te* + find $(srcdir) \( \ + -name '*~' -o \ + -name '*.bak' -o \ + -name '*.old' -o \ + -name '*.rej' -o \ + -name '*.orig' -o \ + -name '.#*' \) \ + -exec rm -f {} \; + cp $(srcdir)/include/SDL_config.h.default $(srcdir)/include/SDL_config.h + if test -f test/Makefile; then (cd test; $(MAKE) $@); fi + +dist $(distfile): + $(SHELL) $(auxdir)/mkinstalldirs $(distdir) + tar cf - $(DIST) | (cd $(distdir); tar xf -) + cp $(distdir)/include/SDL_config.h.default $(distdir)/include/SDL_config.h + rm -rf `find $(distdir) -name .svn` + rm -rf $(distdir)/test/autom4te* + find $(distdir) \( \ + -name '*~' -o \ + -name '*.bak' -o \ + -name '*.old' -o \ + -name '*.rej' -o \ + -name '*.orig' -o \ + -name '.#*' \) \ + -exec rm -f {} \; + if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi + tar cvf - $(distdir) | gzip --best >$(distfile) + rm -rf $(distdir) + +rpm: $(distfile) + rpmbuild -ta $? + +# Create a SVN snapshot that people can run update on +snapshot: + svn co http://svn.libsdl.org/branches/SDL-1.2 + (cd SDL-1.2 && ./autogen.sh && rm -rf autom4te.cache) + cp SDL-1.2/include/SDL_config.h.default SDL-1.2/include/SDL_config.h + tar zcf $(HOME)/SDL-1.2.tar.gz SDL-1.2 + rm -f $(HOME)/SDL-1.2.zip + zip -r $(HOME)/SDL-1.2.zip SDL-1.2 + rm -rf SDL-1.2 diff --git a/SDL/Makefile.minimal b/SDL/Makefile.minimal new file mode 100644 index 0000000..ef8bc91 --- /dev/null +++ b/SDL/Makefile.minimal @@ -0,0 +1,42 @@ +# Makefile to build the SDL library + +INCLUDE = -I./include +CFLAGS = -g -O2 $(INCLUDE) +AR = ar +RANLIB = ranlib + +CONFIG_H = include/SDL_config.h +TARGET = libSDL.a +SOURCES = \ + src/*.c \ + src/audio/*.c \ + src/cdrom/*.c \ + src/cpuinfo/*.c \ + src/events/*.c \ + src/file/*.c \ + src/joystick/*.c \ + src/stdlib/*.c \ + src/thread/*.c \ + src/timer/*.c \ + src/video/*.c \ + src/audio/dummy/*.c \ + src/video/dummy/*.c \ + src/joystick/dummy/*.c \ + src/cdrom/dummy/*.c \ + src/thread/generic/*.c \ + src/timer/dummy/*.c \ + src/loadso/dummy/*.c \ + +OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') + +all: $(TARGET) + +$(TARGET): $(CONFIG_H) $(OBJECTS) + $(AR) crv $@ $^ + $(RANLIB) $@ + +$(CONFIG_H): + cp $(CONFIG_H).default $(CONFIG_H) + +clean: + rm -f $(TARGET) $(OBJECTS) diff --git a/SDL/README b/SDL/README new file mode 100644 index 0000000..e9e1d1a --- /dev/null +++ b/SDL/README @@ -0,0 +1,49 @@ + + Simple DirectMedia Layer + + (SDL) + + Version 1.2 + +--- +http://www.libsdl.org/ + +This is the Simple DirectMedia Layer, a general API that provides low +level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, +and 2D framebuffer across multiple platforms. + +The current version supports Linux, Windows CE/95/98/ME/XP/Vista, BeOS, +MacOS Classic, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, +and QNX. The code contains support for Dreamcast, Atari, AIX, OSF/Tru64, +RISC OS, SymbianOS, Nintendo DS, and OS/2, but these are not officially +supported. + +SDL is written in C, but works with C++ natively, and has bindings to +several other languages, including Ada, C#, Eiffel, Erlang, Euphoria, +Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP, +Pike, Pliant, Python, Ruby, and Smalltalk. + +This library is distributed under GNU LGPL version 2, which can be +found in the file "COPYING". This license allows you to use SDL +freely in commercial programs as long as you link with the dynamic +library. + +The best way to learn how to use SDL is to check out the header files in +the "include" subdirectory and the programs in the "test" subdirectory. +The header files and test programs are well commented and always up to date. +More documentation is available in HTML format in "docs/index.html", and +a documentation wiki is available online at: + http://www.libsdl.org/cgi/docwiki.cgi + +The test programs in the "test" subdirectory are in the public domain. + +Frequently asked questions are answered online: + http://www.libsdl.org/faq.php + +If you need help with the library, or just want to discuss SDL related +issues, you can join the developers mailing list: + http://www.libsdl.org/mailing-list.php + +Enjoy! + Sam Lantinga (slouken@libsdl.org) + diff --git a/SDL/README-SDL.txt b/SDL/README-SDL.txt new file mode 100644 index 0000000..1669736 --- /dev/null +++ b/SDL/README-SDL.txt @@ -0,0 +1,13 @@ + +Please distribute this file with the SDL runtime environment: + +The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library +designed to make it easy to write multi-media software, such as games and +emulators. + +The Simple DirectMedia Layer library source code is available from: +http://www.libsdl.org/ + +This library is distributed under the terms of the GNU LGPL license: +http://www.gnu.org/copyleft/lesser.html + diff --git a/SDL/README.AmigaOS b/SDL/README.AmigaOS new file mode 100644 index 0000000..f544578 --- /dev/null +++ b/SDL/README.AmigaOS @@ -0,0 +1,12 @@ +The AmigaOS code has been removed from SDL, since it had been broken for a + long time and had a few bits of fairly invasive code #ifdef'd into the + SDL core. + +However, there is an OS4 version of SDL here: + http://www.rcdrummond.net/amiga/index.html + +And a MorphOS version here: + http://www.lehtoranta.net/powersdl/ + +--ryan. + diff --git a/SDL/README.BeOS b/SDL/README.BeOS new file mode 100644 index 0000000..db50f36 --- /dev/null +++ b/SDL/README.BeOS @@ -0,0 +1,13 @@ + +SDL on BeOS R5 +============== + +You can build SDL on BeOS like any other GNU style package. +e.g. ./configure && make && make install +By default it is installed in /boot/develop/tools/gnupro/{bin,lib,etc.} + +Once you install SDL, you need to copy libSDL.so to /boot/home/config/lib, +so it can be found by the dynamic linker. + +Enjoy! + Sam Lantinga (slouken@libsdl.org) diff --git a/SDL/README.DC b/SDL/README.DC new file mode 100644 index 0000000..6b94424 --- /dev/null +++ b/SDL/README.DC @@ -0,0 +1,32 @@ +SDL for Dreamcast (beta2) + + BERO + berobero@users.sourceforge.net + + http://www.geocities.co.jp/Playtown/2004/ + +this work with kos-newlib +http://sourceforge.net/projects/dcquake/ + +compile +- source environ.sh (from the KOS distribution) +- make -f Makefile.dc + +compile with gl support +- install latest libgl from http://sourceforge.net/projects/dcquake/ +- uncomment GL=1 in Makefile.dc +- make -f Makefile.dc clean +- make -f Makefile.dc + +install +- copy include/*.h and libSDL.a or libSDL_gl.a for your enviroment + +changelog: + +beta2 +- OpenGL support +- Hardware page flip support + +beta +- thread, timer don't tested so much. +- not support OpenGL diff --git a/SDL/README.MacOS b/SDL/README.MacOS new file mode 100644 index 0000000..5c56be0 --- /dev/null +++ b/SDL/README.MacOS @@ -0,0 +1,63 @@ + +============================================================================== +Using the Simple DirectMedia Layer with MacOS 7,8,9 on PPC +============================================================================== + +These instructions are for people using the Apple MPW environment: +http://developer.apple.com/tools/mpw-tools/ + +CodeWarrior projects are available in the CWprojects directory. + +============================================================================== +I. Building the Simple DirectMedia Layer libraries: + (This step isn't necessary if you have the SDL binary distribution) + + First, unpack the MPWmake.sea.hqx archive and move SDL.make into the + SDL directory. + + Start MPW + + Set the current directory within MPW to the SDL toplevel directory. + + Build "SDL" (Type Command-B and enter "SDL" in the dialog) + + If everything compiles successfully, you now have the PPC libraries + "SDL" and "SDLmain.o" in the 'lib' subdirectory. + +============================================================================== +II. Building the Simple DirectMedia Layer test programs: + + First, unpack the MPWmake.sea.hqx archive, move the new rsrc directory to + the main SDL directory, and move the makefiles in the new test subdirectory + to the SDL 'test' subdirectory. + + Start MPW + + Set the current directory within MPW to the SDL 'test' subdirectory. + + Build the programs that have an associated MPW makefile (file ending + with .make), including "testwin", "testalpha", and "graywin". + + Copy the SDL library file into the test directory, and run! + +============================================================================== +III. Building the Simple DirectMedia Layer demo programs: + + Copy one of the test program Makefiles to the demo directory + and modify it to match the sources in the demo. + +============================================================================== +IV. Enjoy! :) + + If you have a project you'd like me to know about, or want to ask questions, + go ahead and join the SDL developer's mailing list by sending e-mail to: + + sdl-request@libsdl.org + + and put "subscribe" into the subject of the message. Or alternatively you + can use the web interface: + + http://www.libsdl.org/mailman/listinfo/sdl + +============================================================================== + diff --git a/SDL/README.MacOSX b/SDL/README.MacOSX new file mode 100644 index 0000000..2fbb081 --- /dev/null +++ b/SDL/README.MacOSX @@ -0,0 +1,186 @@ +============================================================================== +Using the Simple DirectMedia Layer with Mac OS X +============================================================================== + +These instructions are for people using Apple's Mac OS X (pronounced +"ten"). + +From the developer's point of view, OS X is a sort of hybrid Mac and +Unix system, and you have the option of using either traditional +command line tools or Apple's IDE Xcode. + +To build SDL using the command line, use the standard configure and make +process: + + ./configure + make + sudo make install + +You can also build SDL as a Universal library (a single binary for both +PowerPC and Intel architectures), on Mac OS X 10.4 and newer, by using +the fatbuild.sh script in build-scripts: + sh build-scripts/fatbuild.sh + sudo build-scripts/fatbuild.sh install +This script builds SDL with 10.2 ABI compatibility on PowerPC and 10.4 +ABI compatibility on Intel architectures. For best compatibility you +should compile your application the same way. A script which wraps +gcc to make this easy is provided in test/gcc-fat.sh + +To use the library once it's built, you essential have two possibilities: +use the traditional autoconf/automake/make method, or use Xcode. + +============================================================================== +Using the Simple DirectMedia Layer with a traditional Makefile +============================================================================== + +An existing autoconf/automake build system for your SDL app has good chances +to work almost unchanged on OS X. However, to produce a "real" Mac OS X binary +that you can distribute to users, you need to put the generated binary into a +so called "bundle", which basically is a fancy folder with a name like +"MyCoolGame.app". + +To get this build automatically, add something like the following rule to +your Makefile.am: + +bundle_contents = APP_NAME.app/Contents +APP_NAME_bundle: EXE_NAME + mkdir -p $(bundle_contents)/MacOS + mkdir -p $(bundle_contents)/Resources + echo "APPL????" > $(bundle_contents)/PkgInfo + $(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/ + +You should replace EXE_NAME with the name of the executable. APP_NAME is what +will be visible to the user in the Finder. Usually it will be the same +as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME +usually is "TestGame". You might also want to use @PACKAGE@ to use the package +name as specified in your configure.in file. + +If your project builds more than one application, you will have to do a bit +more. For each of your target applications, you need a seperate rule. + +If you want the created bundles to be installed, you may want to add this +rule to your Makefile.am: + +install-exec-hook: APP_NAME_bundle + rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app + mkdir -p $(DESTDIR)$(prefix)/Applications/ + cp -r $< /$(DESTDIR)$(prefix)Applications/ + +This rule takes the Bundle created by the rule from step 3 and installs them +into $(DESTDIR)$(prefix)/Applications/. + +Again, if you want to install multiple applications, you will have to augment +the make rule accordingly. + + +But beware! That is only part of the story! With the above, you end up with +a bare bone .app bundle, which is double clickable from the Finder. But +there are some more things you should do before shipping yor product... + +1) The bundle right now probably is dynamically linked against SDL. That + means that when you copy it to another computer, *it will not run*, + unless you also install SDL on that other computer. A good solution + for this dilemma is to static link against SDL. On OS X, you can + achieve that by linkinag against the libraries listed by + sdl-config --static-libs + instead of those listed by + sdl-config --libs + Depending on how exactly SDL is integrated into your build systems, the + way to achieve that varies, so I won't describe it here in detail +2) Add an 'Info.plist' to your application. That is a special XML file which + contains some meta-information about your application (like some copyright + information, the version of your app, the name of an optional icon file, + and other things). Part of that information is displayed by the Finder + when you click on the .app, or if you look at the "Get Info" window. + More information about Info.plist files can be found on Apple's homepage. + + +As a final remark, let me add that I use some of the techniques (and some +variations of them) in Exult and ScummVM; both are available in source on +the net, so feel free to take a peek at them for inspiration! + + +============================================================================== +Using the Simple DirectMedia Layer with Xcode +============================================================================== + +These instructions are for using Apple's Xcode IDE to build SDL applications. + +- First steps + +The first thing to do is to unpack the Xcode.tar.gz archive in the +top level SDL directory (where the Xcode.tar.gz archive resides). +Because Stuffit Expander will unpack the archive into a subdirectory, +you should unpack the archive manually from the command line: + cd [path_to_SDL_source] + tar zxf Xcode.tar.gz +This will create a new folder called Xcode, which you can browse +normally from the Finder. + +- Building the Framework + +The SDL Library is packaged as a framework bundle, an organized +relocatable folder heirarchy of executible code, interface headers, +and additional resources. For practical purposes, you can think of a +framework as a more user and system-friendly shared library, whose library +file behaves more or less like a standard UNIX shared library. + +To build the framework, simply open the framework project and build it. +By default, the framework bundle "SDL.framework" is installed in +/Library/Frameworks. Therefore, the testers and project stationary expect +it to be located there. However, it will function the same in any of the +following locations: + + ~/Library/Frameworks + /Local/Library/Frameworks + /System/Library/Frameworks + +- Build Options + There are two "Build Styles" (See the "Targets" tab) for SDL. + "Deployment" should be used if you aren't tweaking the SDL library. + "Development" should be used to debug SDL apps or the library itself. + +- Building the Testers + Open the SDLTest project and build away! + +- Using the Project Stationary + Copy the stationary to the indicated folders to access it from + the "New Project" and "Add target" menus. What could be easier? + +- Setting up a new project by hand + Some of you won't want to use the Stationary so I'll give some tips: + * Create a new "Cocoa Application" + * Add src/main/macosx/SDLMain.m , .h and .nib to your project + * Remove "main.c" from your project + * Remove "MainMenu.nib" from your project + * Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path + * Add "$(HOME)/Library/Frameworks" to the frameworks search path + * Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS" + * Set the "Main Nib File" under "Application Settings" to "SDLMain.nib" + * Add your files + * Clean and build + +- Building from command line + Use pbxbuild in the same directory as your .pbproj file + +- Running your app + You can send command line args to your app by either invoking it from + the command line (in *.app/Contents/MacOS) or by entering them in the + "Executibles" panel of the target settings. + +- Implementation Notes + Some things that may be of interest about how it all works... + * Working directory + As defined in the SDL_main.m file, the working directory of your SDL app + is by default set to its parent. You may wish to change this to better + suit your needs. + * You have a Cocoa App! + Your SDL app is essentially a Cocoa application. When your app + starts up and the libraries finish loading, a Cocoa procedure is called, + which sets up the working directory and calls your main() method. + You are free to modify your Cocoa app with generally no consequence + to SDL. You cannot, however, easily change the SDL window itself. + Functionality may be added in the future to help this. + + +Known bugs are listed in the file "BUGS" diff --git a/SDL/README.MiNT b/SDL/README.MiNT new file mode 100644 index 0000000..8b374a1 --- /dev/null +++ b/SDL/README.MiNT @@ -0,0 +1,248 @@ +============================================================================== +Using the Simple DirectMedia Layer on Atari +============================================================================== + + + If you want to build SDL from sources to create SDL programs on Atari: + see sections I - II. + + If you want to create SDL programs on Atari using SDL binary build, + download it from my web site (URL at end of this file). + + If you want to configure a program using SDL on Atari, + see sections IV - VI. + + +============================================================================== +I. Building the Simple DirectMedia Layer libraries: + (This step isn't necessary if you have the SDL binary distribution) + + Do the classic configure, with --disable-shared --enable-static and: + + Tos version (should run everywhere): + --disable-threads + Tos does not support threads. + + MiNT version (maybe Magic, only for multitasking OS): + --disable-pthreads --enable-pth + Mint and Magic may supports threads, so audio can be used with current + devices, like Sun audio, or disk-writing support. Like Tos, interrupt + audio without threads is more suited for Atari machines. + + Then you can make ; make install it. + +============================================================================== +II. Building the Simple DirectMedia Layer test programs: + + Do the classic configure, then make. + + Run them ! + +============================================================================== +III. Enjoy! :) + + If you have a project you'd like me to know about, or want to ask questions, + go ahead and join the SDL developer's mailing list by sending e-mail to: + + sdl-request@libsdl.org + + and put "subscribe" into the subject of the message. Or alternatively you + can use the web interface: + + http://www.libsdl.org/mailman/listinfo/sdl + +============================================================================== +IV. What is supported: + +Keyboard (GEMDOS, BIOS, GEM, Ikbd) +Mouse (XBIOS, GEM, Ikbd, /dev/mouse (non working atm, disabled)) +Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen)) +Timer (VBL vector, GNU pth library) +Joysticks and joypads (Ikbd, Hardware) +Audio (Hardware, XBIOS, GSXB, MCSN, STFA, /dev/audio if threads enabled) +Threads (Multitasking OS only via GNU pth library) +Shared object loader (using LDG library from http://ldg.atari.org/) +Audio CD (MetaDOS) +OpenGL (using Mesa offscreen rendering driver) + +- Dependent driver combinations: +Video Kbd Mouse Timer Joysticks +xbios ikbd ikbd vbl(2) ikbd +xbios gemdos xbios vbl(2) xbios +xbios bios xbios vbl(2) xbios +gem gem gem(1) vbl(2) xbios + +Audio O/S Misc +dma8 All Uses MFP Timer A interrupt +xbios TOS Uses MFP Timer A interrupt +xbios MiNT Uses MFP Timer A interrupt +xbios Magic Disabled +stfa All Uses MFP interrupt +mcsn TOS Uses MFP Timer A interrupt +mcsn MiNT Uses MiNT thread +mcsn Magic Disabled +gsxb All Uses GSXB callback + +Joypad driver always uses hardware access. +OpenGL driver always uses OSMesa. + +(1) GEM does not report relative mouse motion, so xbios mouse driver is used +to report this type event. +A preliminary driver for /dev/mouse device driver is present, but is disabled +till it can be used with other applications simultaneously. + +(2) If you build SDL with threads using the GNU pth library, timers are +supported via the pth library. + +============================================================================== +V. Environment variables: + +SDL_VIDEODRIVER: + Set to 'xbios' to force xbios video driver + Set to 'gem' to force gem video driver + +SDL_VIDEO_GL_DRIVER: + Set to filename to load as OpenGL library, if you use SDL_GL_LoadLibrary() + +SDL_AUDIODRIVER: + Set to 'mint_gsxb' to force Atari GSXB audio driver + Set to 'mint_mcsn' to force Atari MCSN audio driver + Set to 'mint_stfa' to force Atari STFA audio driver + Set to 'mint_xbios' to force Atari Xbios audio driver + Set to 'mint_dma8' to force Atari 8 bits DMA audio driver + Set to 'audio' to force Sun /dev/audio audio driver + Set to 'disk' to force disk-writing audio driver + +SDL_ATARI_EVENTSDRIVER + Set to 'ikbd' to force IKBD 6301 keyboard driver + Set to 'gemdos' to force gemdos keyboard driver + Set to 'bios' to force bios keyboard driver + +SDL_JOYSTICK_ATARI: + Use any of these strings in the environment variable to enable or + disable a joystick: + + 'ikbd-joy1-[on|off]' for IKBD joystick on port 1 (hardware access) + 'xbios-joy1-[on|off]' for IKBD joystick on port 1 (xbios access) + 'porta-pad-[on|off]' for joypad and/or teamtap on port A + 'porta-joy0-[on|off]' for joystick 0 on port A + 'porta-joy1-[on|off]' for joystick 1 on port A + 'porta-lp-[on|off]' for lightpen on port A + 'porta-anpad-[on|off]' for analog paddle on port A + 'portb-pad-[on|off]' for joypad and/or teamtap on port B + 'portb-joy0-[on|off]' for joystick 0 on port B + 'portb-joy1-[on|off]' for joystick 1 on port B + 'portb-anpad-[on|off]' for analog paddle on port B + + Default configuration is: + 'ikbd-joy1-on' (if IKBD events driver enabled) + 'xbios-joy1-on' (if gemdos/bios/gem events driver enabled) + 'porta-pad-on portb-pad-on' (if available on the machine) + + port[a|b]-[pad|joy?|lp|anpad]-* strings are mutually exclusives. + On such a port, you can only use a joypad OR 1 or 2 joysticks OR + a lightpen OR an analog paddle. You must disable joypad before + setting another controller. + + The second joystick port on IKBD is used by the mouse, so not usable. + Another problem with the IKBD: mouse buttons and joystick fire buttons + are wired together at the hardware level, it means: + port 0 port 0 port 1 + mouse left button = joystick fire 0 = joystick fire 1 + mouse right button = joystick fire 1 = joystick fire 0 + + Descriptions of joysticks/joypads: + - Joypads: 1 hat, 17 buttons (Atari Jaguar console-like). + - Joysticks: 1 hat, 1 button. + - Lightpen, analog paddles: 2 axis, 2 buttons. The 2 buttons are those + affected to 1 button joysticks on the same port. + +============================================================================== +VI. More informations about drivers: + +OpenGL: + The default is to use the Mesa offscreen driver (osmesa.ldg). If you want + to use an older OpenGL implementation, like mesa_gl.ldg or tiny_gl.ldg, + your program must use SDL_GL_LoadLibrary() to do so, and retrieve the + needed function pointers with SDL_LoadFunction(). In all cases, the OpenGL + context is taken care of by SDL itself, you just have to use gl* functions. + + However, there is one OpenGL call that has a different prototype in the old + implementations: glOrtho(). In the old implementations, it has 6 float as + parameters, in the standard one, it has 6 double parameters. If you want + to compile testdyngl, or any other SDL program that loads its OpenGL + library, you must change the glOrtho() prototype used in this program. In + osmesa.ldg, you can retrieve a glOrtho() with double parameters, by + searching for the function "glOrtho6d". + +Xbios video: + Video chip is detected using the _VDO cookie. + Screen enhancers are not supported, but could be if you know how to + use them. + + ST, STE, Mega ST, Mega STE: + 320x200x4 bits, shades of grey, available only for the purpose + of testing SDL. + TT: + 320x480x8 and 320x240x8 (software double-lined mode). + Falcon: + All modes supported by the current monitor (RVB or VGA). + BlowUp and Centscreen extended modes, ScreenBlaster 3 current mode. + Clones and any machine with monochrome monitor: + Not supported. + +Gem video: + Automatically used if xbios not available. + + All machines: + Only the current resolution, if 8 bits or higher depth. + +IKBD keyboard, mouse and joystick driver: + Available if _MCH cookie is ST, Mega ST, STE, Mega STE, TT or Falcon. + + Hades has an IKBD, but xbios is not available for video, so IKBD + driver is disabled. + +Gemdos and bios keyboard driver: + Available on all machines. + +Mouse and joystick xbios driver: + Available on all machines (I think). + +Joypad driver: + Available if _MCH cookie is STE or Falcon. Supports teamtap. + +PTH timer driver: + Available with multitasking OS. + +VBL timer driver: + Available on all machines (I think). + +Audio drivers: + Cookies _SND, MCSN, STFA and GSXB used to detect supported audio + capabilities. + + STE, Mega STE, TT: + 8 bits DMA (hardware access) + STFA, MCSN or GSXB driver if installed + Falcon: + 8 bits DMA (hardware access) + Xbios functions + STFA, MCSN or GSXB driver if installed + Other machines: + STFA, MCSN or GSXB driver if installed + + STFA driver: + http://removers.free.fr/softs/stfa.html + GSXB driver: + http://assemsoft.atari.org/gsxb/ + MacSound driver: + http://jf.omnis.ch/software/tos/ + MagicSound driver (MCSN,GSXB compatible): + http://perso.wanadoo.fr/didierm/ + X-Sound driver (GSXB compatible): + http://www.uni-ulm.de/~s_thuth/atari/xsound_e.html + +-- +Patrice Mandin +http://pmandin.atari.org/ diff --git a/SDL/README.NDS b/SDL/README.NDS new file mode 100644 index 0000000..b251e30 --- /dev/null +++ b/SDL/README.NDS @@ -0,0 +1,22 @@ +The SDL port to the Nintendo DS + +This port uses the devKitPro toolchain, available from: +http://www.devkitpro.org + +Precompiled tools for cross-compiling on Linux are available from: +http://www.libsdl.org/extras/nds/devkitPro-20070503-linux.tar.gz + +todo: +add ds console specific features/optimizations +mouse/keyboard support +dual screen support + +build with: +cp include/SDL_config_nds.h include/SDL_config.h +make -f Makefile.ds + +included is an arm9/arm7 template to allow for sound streaming support. + +Enjoy, fix the source and share :) +Troy Davis(GPF) +http://gpf.dcemu.co.uk/ diff --git a/SDL/README.NanoX b/SDL/README.NanoX new file mode 100644 index 0000000..f02466a --- /dev/null +++ b/SDL/README.NanoX @@ -0,0 +1,97 @@ + ================================================================= + Patch version 0.9 of SDL(Simple DirectMedia Layer) for Nano-X API + ================================================================= + + Authors: Hsieh-Fu Tsai, clare@setabox.com + Greg Haerr, greg@censoft.com + + This patch is against SDL version 1.2.4. + It enhances previous patch 0.8 by providing direct framebuffer + access as well as dynamic hardware pixel type support, not + requiring a compile-time option setting for different framebuffer + modes. + Tested against Microwindows version 0.89pre9. + + Older Microwindows versions + =========================== + If running on a version older than Microwindows 0.89pre9, + the following items might need to be patched in Microwindows. + + 1. Patch src/nanox/client.c::GrClose() + It fixes the client side GrClose(). In the original version, + GrOpen() can only be called once. When the GrOpen() is called at + the second time, the program will terminate. In order to prevent + this situation, we need to insert "nxSocket = -1" after + "close(nxSocket)" in GrClose(). If you do not have this problem, + you may skip this step. + + 2. Patch src/nanox/clientfb.c to return absolute x,y coordinates + when using GrGetWindowFBInfo(). Copy the version 0.89pre9 + of src/nanox/clientfb.c to your system, or configure + using --disable-nanox-direct-fb. + + ============= + Quick Install + ============= + + 1. ./configure --disable-video-x11 --disable-video-fbcon \ + --enable-video-nanox \ + --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal] + 2. make clean + 3. make + 4. make install (as root) + + ============ + Nitty-gritty + ============ + + --enable-nanox-direct-fb Use direct framebuffer access + --enable-nanox-debug Show debug messages + --enable-nanox-share-memory Use shared-memory to speed up + + When running multi-threaded applications using SDL, such + as SMPEG, set THREADSAFE=Y in Microwindows' config file, + to enable GrXXX() system call critical section support. + + ============================================= + Some programs can be used to test this patch. + ============================================= + + 1. http://www.cs.berkeley.edu/~weimer/atris (a tetris-like game) + 2. http://www.libsdl.org/projects/newvox/ + 3. http://www.libsdl.org/projects/xflame/ + 4. http://www.libsdl.org/projects/optimum/ + 5. http://www.gnugeneration.com/software/loop/ + 6: http://www.lokigames.com/development/smpeg.php3 (SMPEG version 0.4.4) + + ========= + Todo List + ========= + + 1. Create hardware surface + 2. Create YUVOverlay on hardware + 3. Use OpenGL + 4. Gamma correction + 5. Hide/Change mouse pointer + 6. Better window movement control with direct fb access + 7. Palette handling in 8bpp could be improved + + ===================== + Supporting Institutes + ===================== + + Many thanks to go to Setabox Co., Ltd. and CML (Communication and + Multimedia Laboratory, http://www.cmlab.csie.ntu.edu.tw/) in the + Department of Computer Science and Information Engineering of + National Taiwan University for supporting this porting project. + + Century Embedded Technologies (http://embedded.censoft.com) + for this patch. + + =================== + Contact Information + =================== + + Welcome to give me any suggestion and to report bugs. + My e-mail address : clare@setabox.com or niky@cmlab.csie.ntu.edu.tw + or greg@censoft.com diff --git a/SDL/README.OS2 b/SDL/README.OS2 new file mode 100644 index 0000000..ffdaae4 --- /dev/null +++ b/SDL/README.OS2 @@ -0,0 +1,281 @@ + +=========== +SDL on OS/2 +=========== + +Last updated on May. 17, 2006. + + +1. How to compile? +------------------ + +To compile this, you'll need the followings installed: +- The OS/2 Developer's Toolkit +- The OpenWatcom compiler + (http://www.openwatcom.org) + +First of all, you have to unzip the Watcom-OS2.zip file. This will result in a +file called "makefile" and a file called "setvars.cmd" in this folder (and some +more files...). + +Please edit the second, fourth and fifth lines of setvars.cmd file +to set the folders where the toolkit, the OW compiler and the FSLib are. +You won't need NASM yet (The Netwide Assembler), you can leave that line. +Run setvars.cmd, and you should get a shell in which you can +compile SDL. + +Check the "makefile" file. There is a line in there which determines if the +resulting SDL.DLL will be a 'debug' or a 'release' build. The 'debug' version +is full of printf()'s, so if something goes wrong, its output can help a lot +for debugging. + +Then run "wmake". +This should create the SDL12.DLL and the corresponding SDL12.LIB file here. + +To test applications, it's a good idea to use the 'debug' build of SDL, and +redirect the standard output and standard error output to files, to see what +happens internally in SDL. +(like: testsprite >stdout.txt 2>stderr.txt) + +To rebuild SDL, use the following commands in this folder: +wmake clean +wmake + + + +2. How to compile the testapps? +------------------------------- + +Once you have SDL12.DLL compiled, navigate into the 'test' folder, copy in +there the newly built SDL12.DLL, and copy in there FSLib.DLL. + +Then run "wmake" in there to compile some of the testapps. + + + +3. What is missing? +------------------- + +The following things are missing from this SDL implementation: +- MMX, SSE and 3DNOW! optimized video blitters? +- HW Video surfaces +- OpenGL support + + + +4. Special Keys / Full-Screen support +------------------------------------- + +There are two special hot-keys implemented: +- Alt+Home switches between fullscreen and windowed mode +- Alt+End simulates closing the window (can be used as a Panic key) +Only the LEFT Alt key will work. + + + +5. Joysticks on SDL/2 +--------------------- + +The Joystick detection only works for standard joysticks (2 buttons, 2 axes +and the like). Therefore, if you use a non-standard joystick, you should +specify its features in the SDL_OS2_JOYSTICK environment variable in a batch +file or CONFIG.SYS, so SDL applications can provide full capability to your +device. The syntax is: + +SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS] + +So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls, +the line should be: + +SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0 + +If you want to add spaces in your joystick name, just surround it with +quotes or double-quotes: + +SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0 + +or + +SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0 + + Notive However that Balls and Hats are not supported under OS/2, and the +value will be ignored... but it is wise to define these correctly because +in the future those can be supported. + Also the number of buttons is limited to 2 when using two joysticks, +4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes +and 8 when using a joystick with 2 axes. Notice however these are limitations +of the Joystick Port hardware, not OS/2. + + + +6. Proportional windows +----------------------- + +For some SDL applications it can be handy to have proportional windows, so +the windows will keep their aspect ratio when resized. +This can be achieved in two ways: + +- Before starting the given SDL application, set the + SDL_USE_PROPORTIONAL_WINDOW environment variable to something, e.g.: + + SET SDL_USE_PROPORTIONAL_WINDOW=1 + dosbox.exe + +- If you have a HOME environment variable set, then SDL will look for a file + in there called ".sdl.proportionals". If that file contains the name of the + currently running SDL executable, then that process will have proportional + windows automatically. + + Please note that this file is created automatically with default values + at the first run. + + + +7. Audio in SDL applications +---------------------------- + +Audio effects are one of the most important features in games. Creating audio +effects in sync with the game and without hickups and pauses in the audio are +very important things. + +However there are multithreaded SDL applications that have tight loops as their +main logic loop. This kills performance in OS/2, and takes too much CPU from +other threads in the same process, for example from the thread to create the +sound effects. + +For this reason, the OS/2 port of SDL can be instructed to run the audio thread +in high priority, which makes sure that there will be enough time for the +processing of the audio data. + +At default, SDL/2 runs the audio thread at ForegroundServer+0 priority. Well +written and well behaving SDL applications should work well in this mode. +For other applications, you can tell SDL/2 to run the audio thread at +TimeCritical priority by setting an env.variable before starting the SDL app: + + SET SDL_USE_TIMECRITICAL_AUDIO=1 + +Please note that this is a bit risky, because if the SDL application runs a +tight infinite loop in this thread, this will make the whole system +unresponsive, so use it with care, and only for applications that need it! + + + +8. Next steps... +---------------- + +Things to do: +- Implement missing stuffs (look for 'TODO' string in source code!) +- Finish video driver (the 'wincommon' can be a good example for missing + things like application icon and so on...) +- Enable MMX/SSE/SSE2 acceleration functions +- Rewrite CDROM support using DOS Ioctl for better support. + + + +9. Contacts +----------- + + You can contact the developers for bugs: + + Area Developer email + General (Audio/Video/System) Doodle doodle@scenergy.dfmk.hu + CDROM and Joystick Caetano daniel@caetano.eng.br + + Notice however that SDL/2 is 'in development' stage so ... if you want to help, +please, be our guest and contact us! + + + +10. Changelog of the OS/2 port +------------------------------ + +Version 1.2.10 - 2006-05-17 - Doodle + - Small modifications for v1.2.10 release + - Changed DLL name to include version info (currently SDL12.dll) + +Version 1.2 - 2006-05-01 - Doodle + - Modified makefile system to have only one makefile + - Included FSLib headers, DLL and LIB file + +Version 1.2 - 2006-02-26 - Doodle + - Updated the official SDL version with the OS/2 specific changes. + - Added support for real unicode keycode conversion. + +Version 1.2.7 - 2006-01-20 - Doodle + - Added support for selectively using timecritical priority for + audio threads by SDL_USE_TIMECRITICAL_AUDIO environment variable. + (e.g.: + SET SDL_USE_TIMECRITICAL_AUDIO=1 + dosbox.exe + ) + +Version 1.2.7 - 2005-12-22 - Doodle + - Added support for proportional SDL windows. + There are two ways to have proportional (aspect-keeping) windows for + a given SDL application: Either set the SDL_USE_PROPORTIONAL_WINDOW + environment variable to something before starting the application + (e.g.: + SET SDL_USE_PROPORTIONAL_WINDOW=1 + dosbox.exe + ) + or, if you have the HOME environment variable set, then SDL12.DLL will + create a file in that directory called .sdl.proportionals, and you can + put there the name of executable files that will be automatically made + proportional. + +Version 1.2.7 - 2005-10-14 - Doodle + - Enabled Exception handler code in FSLib to be able to restore original + desktop video mode in case the application crashes. + - Added the missing FSLib_Uninitialize() call into SDL. + (The lack of it did not cause problems, but it's cleaner this way.) + - Fixed a mouse problem in Fullscreen mode where any mouse click + re-centered the mouse. + +Version 1.2.7 - 2005-10-09 - Doodle + - Implemented window icon support + +Version 1.2.7 - 2005-10-03 - Doodle + - Reworked semaphore support again + - Tuned thread priorities + +Version 1.2.7 - 2005-10-02 - Doodle + - Added support for custom mouse pointers + - Fixed WM_CLOSE processing: give a chance to SDL app to ask user... + - Added support for MMX-accelerated audio mixers + - Other small fixes + +Version 1.2.7 - 2005-09-12 - Doodle + - Small fixes for DosBox incorporated into public release + - Fixed semaphore support (SDL_syssem.c) + - Fixed FSLib to have good clipping in scaled window mode, + and to prevent occasional desktop freezes. + +Version 1.2.7 - 2004-09-08a - Caetano + - Improved joystick support (general verifications about hardware). + - Added support up to 8 buttons in 2 axes joysticks and 6 buttons in 3 axes joysticks. + - Added support to environment variable SDL_OS2_JOYSTICK to specify a joystick. + - Improved Joystick test to handle every type of joystick and display only relevant information. + - Merged with Doodle 2004-09-08 + - Little tid up in README.OS2 + - Added explanation about SDL_OS2_JOYSTICK environment variable on README.OS2 + +Version 1.2.7 - 2004-09-07 - Caetano + - Merged with changes in headers for GCC compiling. + - Added Joystick support using basic IBM GAME$ support, allowing it to work with all joystick drivers since OS/2 2.1. + - Improved joystick detection (hacked!). OS/2 do not allow real joystick detection, so... + - Modified makefile in test to compile "testjoystick". Anyway, it's useless, since it seems to cause a lot of trouble in OS/2 (because os video routines, not Joystick support). + - Created separated Joystick test program to test only joystick functions. + - Improved joystick auto-centering. + - Improved the coordinate correction routine to use two scale factors for each axis. + +Version 1.2.7 - 2004-07-05 - Caetano + - Corrected the time returned by status in CDROM support (it was incorrect) + - Added the testcdrom.c and corrected the linking directive (it was causing an error) + +Version 1.2.7 - 2004-07-02a - Caetano + - Corrected a little problem in a comment at SDL-1.2.7\test\torturethread.c, line 18 (missing */, nested comment) + - Added CDROM support to tree (SDL-1.2.7\src\cdrom\os2\SDL_syscdrom.c) + - Modified makefile (SDL-1.2.7\src\makefiles.wat and SDL-1.2.7\watcom.mif) to build with CDROM support + - Added the "extra" SDL_types.h forgotten in 2004-07-02 version. + + diff --git a/SDL/README.PicoGUI b/SDL/README.PicoGUI new file mode 100644 index 0000000..d76b8f0 --- /dev/null +++ b/SDL/README.PicoGUI @@ -0,0 +1,50 @@ + ======================== + Using SDL with PicoGUI + ======================== + +- Originally contributed by Micah Dowty + +PicoGUI is a scalable GUI system with a unique architecture, primarily focused +on scalability to various embedded systems. You can find more information +including a FAQ at http://picogui.org + +To use the patch: + + 1. When compiling, add the "--enable-video-picogui" switch to ./configure + + 2. When running your program, ensure that the picogui driver for SDL + is in use by setting the SDL_VIDEODRIVER environment variable + to "picogui". + + 3. The program must also be linked to the C client library for PicoGUI + (libpgui.so). If the program is being compiled with a patched SDL + installed this should be done automatically. If you want to use an + existing binary with PicoGUI, you can set the LD_PRELOAD environment + variable to the path of your libpgui.so file. + +Capabilities: + + So far only basic functionality is provided on true color (linear16/24/32) + devices. Accessing a memory mapped bitmap, updating the display, and handling + mouse/keyboard input. This functionality has been tested with several + applications, including mplayer, Xine, sldroids, and Abuse. + +TODO list: + + - YUV overlays will be helpful for watching video on set top boxes or other + embedded devices that have some graphics acceleration hardware + + - Account for rotated bitmap storage in pgserver + + - Support for hiding or changing the cursor + + - The display should be centered when the SDL application is smaller + than the PicoGUI panel + + - Fullscreen or any other special modes + + - Support for indexed and grayscale modes + + - Probably much more... + +--- The End --- diff --git a/SDL/README.Porting b/SDL/README.Porting new file mode 100644 index 0000000..6704741 --- /dev/null +++ b/SDL/README.Porting @@ -0,0 +1,56 @@ + +* Porting To A New Platform + + The first thing you have to do when porting to a new platform, is look at +include/SDL_platform.h and create an entry there for your operating system. +The standard format is __PLATFORM__, where PLATFORM is the name of the OS. +Ideally SDL_platform.h will be able to auto-detect the system it's building +on based on C preprocessor symbols. + +There are two basic ways of building SDL at the moment: + +1. The "UNIX" way: ./configure; make; make install + + If you have a GNUish system, then you might try this. Edit configure.in, + take a look at the large section labelled: + "Set up the configuration based on the target platform!" + Add a section for your platform, and then re-run autogen.sh and build! + +2. Using an IDE: + + If you're using an IDE or other non-configure build system, you'll probably + want to create a custom SDL_config.h for your platform. Edit SDL_config.h, + add a section for your platform, and create a custom SDL_config_{platform}.h, + based on SDL_config.h.minimal and SDL_config.h.in + + Add the top level include directory to the header search path, and then add + the following sources to the project: + src/*.c + src/audio/*.c + src/cdrom/*.c + src/cpuinfo/*.c + src/events/*.c + src/file/*.c + src/joystick/*.c + src/stdlib/*.c + src/thread/*.c + src/timer/*.c + src/video/*.c + src/audio/disk/*.c + src/video/dummy/*.c + src/joystick/dummy/*.c + src/cdrom/dummy/*.c + src/thread/generic/*.c + src/timer/dummy/*.c + src/loadso/dummy/*.c + + +Once you have a working library without any drivers, you can go back to each +of the major subsystems and start implementing drivers for your platform. + +If you have any questions, don't hesitate to ask on the SDL mailing list: + http://www.libsdl.org/mailing-list.php + +Enjoy! + Sam Lantinga (slouken@libsdl.org) + diff --git a/SDL/README.QNX b/SDL/README.QNX new file mode 100644 index 0000000..8f3f499 --- /dev/null +++ b/SDL/README.QNX @@ -0,0 +1,155 @@ +README.QNX by Mike Gorchak , +Last changed at 24 Apr 2004. + +====================================================================== +Table of Contents: + +1. OpenGL. +2. Wheel and multi-button mouses. +3. CDROM handling issues. +4. Hardware video overlays. +5. Shared library building. +6. Some building issues. +7. Environment variables. + +====================================================================== +1. OpenGL: + + OpenGL works well and is stable, but fullscreen mode has not been +heavily tested yet. + If you have QNX RtP version 6.1.0 or above you must download the +Photon3D runtime from http://developers.qnx.com or install it from the +public repository or from the public CD, available with QNX. OS versi- +ons below 6.1.0 are not supported. + When creating an OpenGL context, software renderer mode is artifi- +cially selected (QSSL made acceleration only for Voodoo boards in +fullscreen mode, sorry but I don't have this board to test OpenGL - +maybe it works or maybe not :)). If you want acceleration - you can +remove one line in the source code: find the file SDL_ph_image.c and +remove the following + + OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW; + +line in the ph_SetupOpenGLContext() function or change the argument to +PHOGL_ATTRIB_FORCE_HW or PHOGL_ATTRIB_FAVOR_HW. + +====================================================================== +2. Wheel and multi-button mouses: + + Photon emits keyboard events (key up and down) when the mouse +wheel is moved. The key_scan field appears valid, and it contains zero. +That is a basic method of detecting mouse wheel events under Photon. +It looks like a hack, but it works for me :) on various PC configura- +tions. + +I've tested it on: + +1. Genius Optical NetScroll/+ PS/2 (1 wheel) +2. A4Tech Optical GreatEye WheelMouse PS/2, model: WOP-35. (2 wheels + + 2 additional buttons). The wheel for vertical scrolling works as + usual, but the second wheel for horizontal scrolling emits two se- + quential events up or down, so it can provide faster scrolling than + the first wheel. Additional buttons don't emit any events, but it + looks like they're handled by photon in an unusual way - like click + to front, but works not with any window, looks like a fun bug-o-fe- + ature :). + +====================================================================== +3. CDROM handling issues: + + Access to CDROM can only be provided with 'root' privileges. I +can't do anything about that, /dev/cd0 has brw------- permissions and +root:root rights. + +====================================================================== +4. Hardware video overlays: + + Overlays can flicker during window movement, resizing, etc. It +happens because the photon driver updates the real window contents be- +hind the overlay, then draws the temporary chroma key color over the +window contents. It can be done without using the chroma key but that +causes the overlay to always be on top. So flickering during window +movement is preferred instead. + Double buffering code is temporarily disabled in the photon driver +code, because on my GF2-MX it can accidentally cause a buffer switch, +which causes the old frame to show. S3 Savage4 has the same problem, +but ATI Rage 128 doesn't. I think it can be fixed later. Current code +works very well, so maybe double buffering is not needed right now. + Something strange happens when you try to move the window with the +overlay beyond the left border of the screen. The overlay tries to +stay at position x=0, but when attempting to move it a bit more it +jumps to position x=-60 (on GF2-MX, on ATI Rage128 this value a bit +smaller). It's really strange, looks like the overlay doesn't like +negative coordinates. + +======================================================================= +5. Shared library building: + + A shared library can be built, but before running the autogen.sh +script you must manually delete the libtool.m4 stuff from the acinclu- +de.m4 file (it comes after the ESD detection code up to the end of the +file), because the libtool stuff in the acinclude.m4 file was very old +in SDL distribution before the version 1.2.7 and doesn't knew anything +about QNX. SDL 1.2.7 distribution contains the new libtool.m4 script, +but anyway it is broken :), Just remove it, then run "libtoolize +--force --copy", delete the file aclocal.m4 if it is exists and after +that run the autogen.sh script. SDL 1.2.8 contains fixed libtool.m4, +ltmain.sh and config.sub files, so you can just run the autogen.sh +script. + +====================================================================== +6. Some building issues: + + Feel free to not use the --disable-shared configure option if you' +ve read the above comment about 'Shared library building'. Otherwise +this option is strongly recommended, as without it the sdl-config +script will be broken. + + Run the configure script without x11 support, e.g.: + + a) for OpenGL support: + ./configure --prefix=/usr \ + --disable-video-x11 \ + --disable-shared + + b) without OpenGL support: + ./configure --prefix=/usr \ + --disable-video-x11 \ + --disable-shared \ + --disable-video-opengl + + And of course dont forget to specify --disable-debug, which is on +by default, to disable debug and enable the expensive optimizations. + + In the test directory also run the ./configure script without +x11 support, e.g.: + + ./configure --with-sdl-prefix=/usr \ + --with-sdl-exec-prefix=/usr \ + --prefix=/usr --without-x + +====================================================================== +7. Environment variables: + + Please note that the photon driver is sensible to the following +environmental variables: + + * SDL_PHOTON_FULLSCREEN_REFRESH - this environment variable controls +the refresh rate in all fullscreen modes. Be carefull !!! Photon +drivers usually do not checking the maximum refresh rate, which video +adapter or monitor supports. + + * SDL_VIDEO_WINDOW_POS - can be set in the "X,Y" format. If X and Y +coordinates are bigger than the current desktop resolution, then win- +dow positioning across virtual consoles is activated. If X and Y are +smaller than the desktop resolution then window positioning in the +current console is activated. The word "center" can be used instead of +coordinates, it produces the same behavior as SDL_VIDEO_CENTERED +environmental variable. + + * SDL_VIDEO_CENTERED - if this environmental variable exists then the +window centering is perfomed in the current virtual console. + +Notes: The SDL_VIDEO_CENTERED enviromental variable has greater pri- +ority than the SDL_VIDEO_WINDOW_POS in case if both variables are sup- +plied to the application. diff --git a/SDL/README.Qtopia b/SDL/README.Qtopia new file mode 100644 index 0000000..8a2ff06 --- /dev/null +++ b/SDL/README.Qtopia @@ -0,0 +1,84 @@ + +============================================================================== +Using the Simple DirectMedia Layer with Qtopia/OPIE +============================================================================== + +============================================================================== +I. Setting up the Qtopia development environment. + + This document will not explain how to setup the Qtopia development + environment. That is outside the scope of the document. You can read + more on this subject in this excellent howto: + + http://www.zauruszone.com/howtos/linux_compiler_setup_howto.html + +============================================================================== +II. Building the Simple DirectMedia Layer libraries using the arm + cross-compiler + + This is somewhat tricky since the name of the compiler binaries + differ from the standard. Also you should disable features not + needed. The command below works for me. Note that it's all one + line. You can also set the NM, LD etc environment variables + separately. + + NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib AR=arm-linux-ar ./configure --enable-video-qtopia --disable-video-dummy --disable-video-fbcon --disable-video-dga --disable-arts --disable-esd --disable-alsa --disable-cdrom --disable-video-x11 --disable-nasm --prefix=/opt/Qtopia/sharp/ arm-unknown-linux-gnu + + One thing to note is that the above configure will include joystick + support, even though you can't have joysticks on the Zaurus. The + reason for this is to avoid link / compile / runtime errors with + applications that have joystick support. + +============================================================================== +III. Building the Simple DirectMedia Layer test programs: + + After installing, making sure the correct sdl-config is in your + path, run configure like this: + + NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar ./configure arm-unknown-linux-gnu + +============================================================================== +IV. Application porting notes + + One thing I have noticed is that applications sometimes don't exit + correctly. Their icon remains in the taskbar and they tend to + relaunch themselves automatically. I believe this problem doesn't + occur if you exit your application using the exit() method. However, + if you end main() with 'return 0;' or so, this seems to happen. + + Also note that when running in landscape mode - i.e requesting a + window that is HEIGHT pixels wide and WIDTH pixels high, where WIDTH + and HEIGHT normally is 240 and 320 - the image is blitted so that + the hardware buttons are on the left side of the display. This might + not always be desirable but such is the code today. + + +============================================================================== +V. Enjoy! :) + + If you have a project you'd like me to know about, or want to ask questions, + go ahead and join the SDL developer's mailing list by sending e-mail to: + + sdl-request@libsdl.org + + and put "subscribe" into the subject of the message. Or alternatively you + can use the web interface: + + http://www.libsdl.org/mailman/listinfo/sdl + +============================================================================== +VI. What is supported: + +Keyboard (Sharp Zaurus) +Hardware buttons +Stylus input (mouse) +Video. Allows fullscreen both in portrait mode (up to WIDTHxHEIGHT +size window) and in landscape mode (up to HEIGHTxWIDTH). + +All other SDL functionality works like a normal Linux system (threads, +audio etc). + +-- +David Hedbor +http://david.hedbor.org/ http://eongames.com/ + diff --git a/SDL/README.RISCOS b/SDL/README.RISCOS new file mode 100644 index 0000000..9ef5bbb --- /dev/null +++ b/SDL/README.RISCOS @@ -0,0 +1,130 @@ +Readme for RISC OS port of SDL +============================== + +This document last updated on 2nd Februrary 2006 + +This is a RISC OS port of the Simple Direct Media Layer (SDL) by Alan Buckley with contributions from Peter Naulls. + +Details of the SDL can be found at http://www.libsdl.org. + +The source code including the RISC OS version can be obtained from: + +http://www.libsdl.org. + +Pre built libraries and many games and applications compiled for RISC OS using this library can be downloaded from The Unix Porting Project at http://www.riscos.info/unix/. + +This is released under the LGPL see the file COPYING for details. + + +Compiling applications under RISC OS +==================================== + +Add -ISDL: for the C compiler flags if you include the files in the SDL directory. e.g. #include "SDL/SDL.h" +Add -ISDL:SDL for the C compiler flags if you include the files directly. e.g. #include "SDL/SDL.h" + +Add -LSDL: -lSDL to the link stage of compilation. + +For example, to compile the testbitmap.c sample you could use: + +gcc -ISDL:SDL -LSDL: -lSDL testbitmap.c -otestbitmap + + +RISC OS port of SDL runtime information +======================================= + +Runtime requirements +-------------------- + +This library currently needs a minimum of RISC OS 3.6. The source code for the library (and a lot of the programs built with it) also need long file names. + +To use the audio you also need 16 bit sound and to have installed the DigitalRender module by Andreas Dehmel version 0.51 available from his +web site: http://home.t-online.de/~zarquon +This is loaded when needed by UnixLib. + +Note: As most programs ported from other OSes use high resolution graphics and a memory back buffer a machine with a StrongARM processor and 1 or 2MB of VRAM (or a better machine) is recomended. + + +RISC OS runtime parameters +-------------------------- + +Several environmental variables have been defined to make porting programs easier (i.e. By setting these variable you do not need to have source code differences between OSes). + +They are all defined on an application basis. + +The used below is found as follows: +1. Use the name of the program unless it is !RunImage +2. Check the folder specification for the folder !RunImage is run from. If it is a folder name use that name, otherwise if it is an environmental variable of the form use the value of XXX. + +The variables are: + +SDL$$TaskName + +The name of the task for RISC OS. If omitted then is used for the task name, + +SDL$$BackBuffer + +Set to 1 to use a system memory back buffer for the screen in full screen mode. Some programs on other systems assume their is always a back buffer even though the SDL specification specifies this is not the case. The current RISC OS implementation uses direct writes to the screen if a hardware fullscreen is requested. + +Set to 2 to use an ARM code full word copy. This is faster than the standard back buffer, but uses aligned words only so it is possible (but unlikely) for it to corrupt the screen for 8bpp and 16bpp modes. + +Set to 3 to use a RISC OS sprite as the back buffer. This is usually the slowest for most SDL applications, however it may be useful in the future as Sprite acceleration is added to various hardware that runs RISC OS. + +SDL$$CloseAction - set the action for the close icon. Again as programs don't match the specification you can set this to 0 to remove the close icon from the main window for applications where this does not affect the program. + + +RISC OS SDL port API notes +========================== + +Current level of implementation +------------------------------- + +The following list is an overview of how much of the SDL is implemented. The areas match the main areas of the SDL. + +video - Mostly done. Doesn't cover gamma, YUV-overlay or OpenGL. +Window Manager - Mostly done. SetIcon/IconifyWindow not implemented. +Events - Mostly done. Resize and some joystick events missing. +Joystick - Currently assumes a single joystick with 4 buttons. +Audio - Done +CDROM - Not implemented. +Threads - Done +Timers - Done + +Thread support can be removed by defining DISABLE_THREADS and recompiling the library. + +SDL API notes +------------- + +This section contains additional notes on some specific commands. + +SDL_SetVideoMode + On RISC OS a fullscreen mode directly accesses the screen. This can be modified by the environmental variable (SDL$$BackBuffer) or by using the SDL_SWSURFACE flag to write to an offscreen buffer that is updated using SDL_UpdateRects. + Open GL is not supported so SDL_OPENGL and SDL_OPENGLBLIT flags fail. + SDL_RESIZEABLE and SDL_NOFRAME flags are not supported. + +SDL_SetColors + In a wimp mode the screen colours are not changed for a hardware palette instead the RISC OS sprite colour mapping is used to get the best matching colours. + +SDL_CreateCursor + Inverted colour is not supported. + +SDL_WM_ToggleFullScreen + Currently this won't work if the application starts up in Fullscreen mode. + Toggling to fullscreen will only work if the monitor is set up to support the exact screen size requested. + +SDL_EnableUNICODE + Unicode translation used here is only really accurate for 7 bit characters. + +SDL_NumJoysticks/JoystickName etc. + Hardcoded to expect only 1 joystick with 4 buttons if the Joystick module is loaded. + +SDL_GetTicks + Timer used has only a centisecond accuracy. This applies to other time related functions. + +SDL_Delay + Modified to poll keyboard/mouse during the delay on the event thread. + + +Notes on current implementation +------------------------------- + +Keyboard and mouse are polled so if too long a time is spent between a call to SDL_PumpEvents, functions that use it, or SDL_Delay events can be missed. diff --git a/SDL/README.Symbian b/SDL/README.Symbian new file mode 100644 index 0000000..04a37cf --- /dev/null +++ b/SDL/README.Symbian @@ -0,0 +1,23 @@ +============================================================================== +Using the Simple DirectMedia Layer with S60 3.x / Symbian 9.x +============================================================================== + +These instuctions are for people developing for S60 3.x. S60 3.x +uses Symbian OS so you need S60 SDK. + +extract "symbian.zip" into this folder. + +go to symbian folder + +bldmake bldfiles +abld build + +That produces WINSCW and ARMV5 versions of sdl.dll runtime library +and sdl.lib for development. +The sdlexe.dll/sdlexe.lib and sdlmain.lib are for easy SDL S60 +integration, please see http://www.mbnet.fi/~mertama/sdl.html +for further info. + + + + diff --git a/SDL/README.WII b/SDL/README.WII new file mode 100644 index 0000000..7b82bc8 --- /dev/null +++ b/SDL/README.WII @@ -0,0 +1,17 @@ +The SDL port to the Nintendo Wii + +This port uses the devKitPro toolchain, available from: +http://www.devkitpro.org + +todo: +use gx for display +use libfat for file access + +build with: +cp include/SDL_config_wii.h include/SDL_config.h +make -f Makefile.wii + +Original SDL gamecube port - taken from www.devkitpro.org +Port to Wii by mindcry (http://mindcry.cpl.de/wii/) +Many fixes (threading, audio among other stuff) by Yohanes Nugroho (http://tinyhack.com) +Renamed everything from GameCube to Wii. Built against SDL SVN - David Hudson (http://cs-sdl.sourceforge.net) diff --git a/SDL/README.Watcom b/SDL/README.Watcom new file mode 100644 index 0000000..2849a11 --- /dev/null +++ b/SDL/README.Watcom @@ -0,0 +1,133 @@ + +Using SDL under Windows with the OpenWatcom compiler +==================================================== + +Prerequisites +------------- + +I have done the port under Windows XP Home with SP2 installed. Windows +2000 should also be working. I'm not so sure about ancient Windows NT, +since only DirectX 3 is available there. Building should be possible, +but running the compiled applications will probalbly fail with +SDL_VIDEODRIVER=directx. The windib driver should work, though. + +To compile and use the SDL with Open Watcom you will need the following: +- Open Watcom compiler. I used version 1.5. The environment variables + PATH, WATCOM and INCLUDE need to be set appropriately - please consult + the OpenWatcom documentation and instructions given during the + installation of the compiler. + My setup looks like this in owvars.bat: + set WATCOM=C:\watcom + set INCLUDE=%WATCOM%\h;%WATCOM%\h\nt + set PATH=%PATH%;%WATCOM%\binnt;%WATCOM%\binw +- A fairly recent DirectX SDK. The original unmodified DX8 SDK works, as + well as the minimal DirectX 7 SDK from the Allegro download site + (). +- The SDL sources from Subversion +- The file Watcom-Win32.zip (now available in Subversion) + + +Building the Library +-------------------- + +1) In the SDL base directory extract the archive Watcom-Win32.zip. This + creates a subdirectory named 'watcom'. +2) The makefile expects the environment variable DXDIR to be set to the + base directory of a DirectX SDK. I have tried a stock DX8 SDK from + Microsoft as well as the minimal DirectX 7 SDK from the Allegro + download site. + You can also edit the makefile directly and hard code your path to + the SDK on your system. + I have this in my setup: + set DXDIR=D:\devel\DX8_SDK +3) Enter the watcom directory and run + wmake sdl +4) All tests from the test directory are working and can be built by + running + wmake tests + +Notes: + + The makefile offers some options to tweak the way the library is built. + You have at your disposal the option to build a static (default) + library, or a DLL (with tgt=dll). You can also choose whether to build + a Release (default) or a Debug version (with build=debug) of the tests + and library. Please consult the usage comment at the top of the + makefile for usage instructions. + + If you specify a test target (i.e. 'wmake tests' for all tests, or + selected targets like 'wmake testgl testvidinfo testoverlay2'), the + tests are always freshly compiled and linked. This is done to + minimise hassle when switching between library versions (static vs. + DLL), because they require subtly different options. + Also, the test executables are put directly into the test directory, + so they can find their data files. The clean target of the makefile + removes the test executables and the SDL.dll file from the test + directory. + + To use the library in your own projects with Open Watcom, you can use + the way the tests are built as base of your own build environment. + + The library can also be built with the stack calling convention of the + compiler (-6s instead of -6r). + + +Test applications +----------------- + +I've tried to make all tests work. The following table gives an overview +of the current status. + + Testname Status +~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +checkkeys + +graywin + +loopwave + +testalpha + +testbitmap + +testdyngl + +testerror + +testfile + +testgamma + +testgl + +testhread + +testiconv - (all failed) +testkeys + +testlock + +testoverlay + (needs 'set SDL_VIDEODRIVER=directx') +testoverlay2 + (needs 'set SDL_VIDEODRIVER=directx') +testpalette + +testplatform + +testsem + +testsprite + +testtimer + +testver + +testvidinfo + +testwin ? (fading doesn't seem right) +testwm + +torturethread + +testcdrom + +testjoystick not tested +threadwin + +testcursor + + + +TODO +---- + +There is room for further improvement: +- Test joystick functionality. +- Investigate fading issue in 'testwin' test. +- Fix the UTF-8 support. +- Adapt the makefile/object file list to support more target systems +- Use "#pragma aux" syntax for the CPU info functions. + + +Questions and Comments +---------------------- + +Please direct any questions or comments to me: + + Happy Coding! + + Marc Peter diff --git a/SDL/README.WinCE b/SDL/README.WinCE new file mode 100644 index 0000000..56af00a --- /dev/null +++ b/SDL/README.WinCE @@ -0,0 +1,55 @@ + +Project files for embedded Visual C++ 3.0, 4.0 and +Visual Studio 2005 can be found in VisualCE.zip + +SDL supports GAPI and WinDib output for Windows CE. + +GAPI driver supports: + +- all possible WinCE devices (Pocket PC, Smartphones, HPC) + with different orientations of video memory and resolutions. +- 4, 8 and 16 bpp devices +- special handling of 8bpp on 8bpp devices +- VGA mode, you can even switch between VGA and GAPI in runtime + (between 240x320 and 480x640 for example). On VGA devices you can + use either GAPI or VGA. +- Landscape mode and automatic rotation of buttons and stylus coordinates. + To enable landscape mode make width of video screen bigger than height. + For example: + SDL_SetVideoMode(320,240,16,SDL_FULLSCREEN) +- WM2005 +- SDL_ListModes + +NOTE: +There are several SDL features not available in the WinCE port of SDL. + +- DirectX is not yet available +- Semaphores are not available +- Joystick support is not available +- CD-ROM control is not available + +In addition, there are several features that run in "degraded" mode: + +Preprocessor Symbol Effect +=================== ================================= + +SDL_systimer.c: +USE_GETTICKCOUNT Less accurate values for SDL time functions +USE_SETTIMER Use only a single marginally accurate timer + +SDL_syswm.c: +DISABLE_ICON_SUPPORT Can't set the runtime window icon + +SDL_sysmouse.c: +USE_STATIC_CURSOR Only the arrow cursor is available + +SDL_sysevents.c: +NO_GETKEYBOARDSTATE Can't get modifier state on keyboard focus + +SDL_dibevents.c: +NO_GETKEYBOARDSTATE Very limited keycode translation + +SDL_dibvideo.c: +NO_GETDIBITS Can't distinguish between 15 bpp and 16 bpp +NO_CHANGEDISPLAYSETTINGS No fullscreen support +NO_GAMMA_SUPPORT Gamma correction not available diff --git a/SDL/README.wscons b/SDL/README.wscons new file mode 100644 index 0000000..e808af0 --- /dev/null +++ b/SDL/README.wscons @@ -0,0 +1,107 @@ +============================================================================== +Using the Simple DirectMedia Layer with OpenBSD/wscons +============================================================================== + +The wscons SDL driver can be used to run SDL programs on OpenBSD +without running X. So far, the driver only runs on the Sharp Zaurus, +but the driver is written to be easily extended for other machines. +The main missing pieces are blitting routines for anything but 16 bit +displays, and keycode maps for other keyboards. Also, there is no +support for hardware palettes. + +There is currently no mouse support. + +To compile SDL with support for wscons, use the +"--enable-video-wscons" option when running configure. I used the +following command line: + +./configure --disable-oss --disable-ltdl --enable-pthread-sem \ + --disable-esd --disable-arts --disable-video-aalib \ + --enable-openbsdaudio --enable-video-wscons \ + --prefix=/usr/local --sysconfdir=/etc + + +Setting the console device to use +================================= + +When starting an SDL program on a wscons console, the driver uses the +current virtual terminal (usually /dev/ttyC0). To force the driver to +use a specific terminal device, set the environment variable +SDL_WSCONSDEV: + +bash$ SDL_WSCONSDEV=/dev/ttyC1 ./some-sdl-program + +This is especially useful when starting an SDL program from a remote +login prompt (which is great for development). If you do this, and +want to use keyboard input, you should avoid having some other program +reading from the used virtual console (i.e., do not have a getty +running). + + +Rotating the display +==================== + +The display can be rotated by the wscons SDL driver. This is useful +for the Sharp Zaurus, since the display hardware is wired so that it +is correctly rotated only when the display is folded into "PDA mode." +When using the Zaurus in "normal," or "keyboard" mode, the hardware +screen is rotated 90 degrees anti-clockwise. + +To let the wscons SDL driver rotate the screen, set the environment +variable SDL_VIDEO_WSCONS_ROTATION to "CW", "CCW", or "UD", for +clockwise, counter clockwise, and upside-down rotation respectively. +"CW" makes the screen appear correct on a Sharp Zaurus SL-C3100. + +When using rotation in the driver, a "shadow" frame buffer is used to +hold the intermediary display, before blitting it to the actual +hardware frame buffer. This slows down performance a bit. + +For completeness, the rotation "NONE" can be specified to use a shadow +frame buffer without actually rotating. Unsetting +SDL_VIDEO_WSCONS_ROTATION, or setting it to '' turns off the shadow +frame buffer for maximum performance. + + +Running MAME +============ + +Since my main motivation for writing the driver was playing MAME on +the Zaurus, I'll give a few hints: + +XMame compiles just fine under OpenBSD. + +I'm not sure this is strictly necessary, but set + +MY_CPU = arm + +in makefile.unix, and + +CFLAGS.arm = -DLSB_FIRST -DALIGN_INTS -DALIGN_SHORTS + +in src/unix/unix.max + +to be sure. + +The latest XMame (0.101 at this writing) is a very large program. +Either tinker with the make files to compile a version without support +for all drivers, or, get an older version of XMame. My recommendation +would be 0.37b16. + +When running MAME, DO NOT SET SDL_VIDEO_WSCONS_ROTATION! Performace +is MUCH better without this, and it is COMPLETELY UNNECESSARY, since +MAME can rotate the picture itself while drawing, and does so MUCH +FASTER. + +Use the Xmame command line option "-ror" to rotate the picture to the +right. + + +Acknowledgments +=============== + +I studied the wsfb driver for XFree86/Xorg quite a bit before writing +this, so there ought to be some similarities. + + +-- +Staffan Ulfberg diff --git a/SDL/SDL.qpg.in b/SDL/SDL.qpg.in new file mode 100644 index 0000000..550cac1 --- /dev/null +++ b/SDL/SDL.qpg.in @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + QNX.ORG.RU Community + + + QNX.ORG.RU Team + Mike Gorchak + mike@malva.ua + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Library + SDL + 1 + http://qnx.org.ru/repository + 2.6 + + + + Simple DirectMedia Layer (SDL) + SDL + slouken@libsdl.org + Public + public + http://www.libsdl.org + + slouken@libsdl.org + Sam Lantinga + http://www.libsdl.org + + slouken@libsdl.org + + + This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms. + This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms. This is the libraries, include files and other resources you can use to develop and run SDL applications. + http://www.libsdl.org + + + + + @VERSION@ + Medium + Stable + + + 1 + + GNU Lesser General Public License + + + + Software Development/Libraries and Extensions/C Libraries + SDL,audio,graphics,demos,games,emulators,direct,media,layer + qnx6 + none + Photon + Console + Developer + User + + repdata://LicenseUrl/COPYING + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SDL/SDL.spec b/SDL/SDL.spec new file mode 100644 index 0000000..1f82c52 --- /dev/null +++ b/SDL/SDL.spec @@ -0,0 +1,113 @@ +Summary: Simple DirectMedia Layer +Name: SDL +Version: 1.2.13 +Release: 1 +Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz +URL: http://www.libsdl.org/ +License: LGPL +Group: System Environment/Libraries +BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot +Prefix: %{_prefix} +%ifos linux +Provides: libSDL-1.2.so.0 +%endif + +%define __defattr %defattr(-,root,root) +%define __soext so + +%description +This is the Simple DirectMedia Layer, a generic API that provides low +level access to audio, keyboard, mouse, and display framebuffer across +multiple platforms. + +%package devel +Summary: Libraries, includes and more to develop SDL applications. +Group: Development/Libraries +Requires: %{name} = %{version} + +%description devel +This is the Simple DirectMedia Layer, a generic API that provides low +level access to audio, keyboard, mouse, and display framebuffer across +multiple platforms. + +This is the libraries, include files and other resources you can use +to develop SDL applications. + + +%prep +%setup -q + +%build +%ifos linux +CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-aalib --disable-video-directfb --disable-video-ggi --disable-video-svga +%else +%configure +%endif +make + +%install +rm -rf $RPM_BUILD_ROOT +%ifos linux +make install prefix=$RPM_BUILD_ROOT%{prefix} \ + bindir=$RPM_BUILD_ROOT%{_bindir} \ + libdir=$RPM_BUILD_ROOT%{_libdir} \ + includedir=$RPM_BUILD_ROOT%{_includedir} \ + datadir=$RPM_BUILD_ROOT%{_datadir} \ + mandir=$RPM_BUILD_ROOT%{_mandir} +ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT%{_libdir}/libSDL-1.1.so.0 +%else +%makeinstall +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%{__defattr} +%doc README-SDL.txt COPYING CREDITS BUGS +%{_libdir}/lib*.%{__soext}.* + +%files devel +%{__defattr} +%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew docs.html +%doc docs/index.html docs/html +%{_bindir}/*-config +%{_libdir}/lib*.a +%{_libdir}/lib*.la +%{_libdir}/lib*.%{__soext} +%dir %{_includedir}/SDL +%{_includedir}/SDL/*.h +%{_libdir}/pkgconfig/sdl.pc +%{_datadir}/aclocal/* +%{_mandir}/man3/* + +%changelog +* Tue May 16 2006 Sam Lantinga +- Removed support for Darwin, due to build problems on ps2linux + +* Mon Jan 03 2004 Anders Bjorklund +- Added support for Darwin, updated spec file + +* Wed Jan 19 2000 Sam Lantinga +- Re-integrated spec file into SDL distribution +- 'name' and 'version' come from configure +- Some of the documentation is devel specific +- Removed SMP support from %build - it doesn't work with libtool anyway + +* Tue Jan 18 2000 Hakan Tandogan +- Hacked Mandrake sdl spec to build 1.1 + +* Sun Dec 19 1999 John Buswell +- Build Release + +* Sat Dec 18 1999 John Buswell +- Add symlink for libSDL-1.0.so.0 required by sdlbomber +- Added docs + +* Thu Dec 09 1999 Lenny Cartier +- v 1.0.0 + +* Mon Nov 1 1999 Chmouel Boudjnah +- First spec file for Mandrake distribution. + +# end of file diff --git a/SDL/SDL.spec.in b/SDL/SDL.spec.in new file mode 100644 index 0000000..3f0d27d --- /dev/null +++ b/SDL/SDL.spec.in @@ -0,0 +1,113 @@ +Summary: Simple DirectMedia Layer +Name: SDL +Version: @SDL_VERSION@ +Release: 1 +Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz +URL: http://www.libsdl.org/ +License: LGPL +Group: System Environment/Libraries +BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot +Prefix: %{_prefix} +%ifos linux +Provides: libSDL-1.2.so.0 +%endif + +%define __defattr %defattr(-,root,root) +%define __soext so + +%description +This is the Simple DirectMedia Layer, a generic API that provides low +level access to audio, keyboard, mouse, and display framebuffer across +multiple platforms. + +%package devel +Summary: Libraries, includes and more to develop SDL applications. +Group: Development/Libraries +Requires: %{name} = %{version} + +%description devel +This is the Simple DirectMedia Layer, a generic API that provides low +level access to audio, keyboard, mouse, and display framebuffer across +multiple platforms. + +This is the libraries, include files and other resources you can use +to develop SDL applications. + + +%prep +%setup -q + +%build +%ifos linux +CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-aalib --disable-video-directfb --disable-video-ggi --disable-video-svga +%else +%configure +%endif +make + +%install +rm -rf $RPM_BUILD_ROOT +%ifos linux +make install prefix=$RPM_BUILD_ROOT%{prefix} \ + bindir=$RPM_BUILD_ROOT%{_bindir} \ + libdir=$RPM_BUILD_ROOT%{_libdir} \ + includedir=$RPM_BUILD_ROOT%{_includedir} \ + datadir=$RPM_BUILD_ROOT%{_datadir} \ + mandir=$RPM_BUILD_ROOT%{_mandir} +ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT%{_libdir}/libSDL-1.1.so.0 +%else +%makeinstall +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%{__defattr} +%doc README-SDL.txt COPYING CREDITS BUGS +%{_libdir}/lib*.%{__soext}.* + +%files devel +%{__defattr} +%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew docs.html +%doc docs/index.html docs/html +%{_bindir}/*-config +%{_libdir}/lib*.a +%{_libdir}/lib*.la +%{_libdir}/lib*.%{__soext} +%dir %{_includedir}/SDL +%{_includedir}/SDL/*.h +%{_libdir}/pkgconfig/sdl.pc +%{_datadir}/aclocal/* +%{_mandir}/man3/* + +%changelog +* Tue May 16 2006 Sam Lantinga +- Removed support for Darwin, due to build problems on ps2linux + +* Mon Jan 03 2004 Anders Bjorklund +- Added support for Darwin, updated spec file + +* Wed Jan 19 2000 Sam Lantinga +- Re-integrated spec file into SDL distribution +- 'name' and 'version' come from configure +- Some of the documentation is devel specific +- Removed SMP support from %build - it doesn't work with libtool anyway + +* Tue Jan 18 2000 Hakan Tandogan +- Hacked Mandrake sdl spec to build 1.1 + +* Sun Dec 19 1999 John Buswell +- Build Release + +* Sat Dec 18 1999 John Buswell +- Add symlink for libSDL-1.0.so.0 required by sdlbomber +- Added docs + +* Thu Dec 09 1999 Lenny Cartier +- v 1.0.0 + +* Mon Nov 1 1999 Chmouel Boudjnah +- First spec file for Mandrake distribution. + +# end of file diff --git a/SDL/TODO b/SDL/TODO new file mode 100644 index 0000000..3eefc57 --- /dev/null +++ b/SDL/TODO @@ -0,0 +1,25 @@ + +Wish list for the 1.3 development branch: +http://bugzilla.libsdl.org/ + + * Add mousewheel events (new unified event architecture?) + * DirectInput joystick support needs to be implemented + * Be able to enumerate and select available audio and video drivers + * Fullscreen video mode support for Mac OS X + * Explicit vertical retrace wait (maybe separate from SDL_Flip?) + * Shaped windows, windows without borders + * Multiple windows, multiple display support + * SDL_INIT_EVENTTHREAD on Windows and MacOS? + * Add a timestamp to events + * Add audio input API + * Add hardware accelerated scaled blit + * Add hardware accelerated alpha blits + * Redesign blitting architecture to allow blit plugins + +In the jump from 1.2 to 1.3, we should change the SDL_Rect members to +int and evaluate all the rest of the datatypes. This is the only place +we should do it though, since the 1.2 series should not break binary +compatibility in this way. + +Requests: + * PCM and CDROM volume control (deprecated, but possible) diff --git a/SDL/VisualC.html b/SDL/VisualC.html new file mode 100644 index 0000000..374a781 --- /dev/null +++ b/SDL/VisualC.html @@ -0,0 +1,171 @@ + + + Using SDL with Microsoft Visual C++ + + +

+ Using SDL with Microsoft Visual C++ 5,6 and 7 +

+

+ by Lion Kimbro and additions by + James Turk +

+

+ You can either use the precompiled libraries from + the SDL Download web site , or you can build SDL yourself. +

+

+ Building SDL +

+

+ Unzip the VisualC.zip file into the directory that contains this + file (VisualC.html). +

+

+ Be certain that you unzip the zip file for your compiler into this + directory and not any other directory. If you are using WinZip, be careful to + make sure that it extracts to this folder, because it's + convenient feature of unzipping to a folder with the name of the file currently + being unzipped will get you in trouble if you use it right now. And that's all + I have to say about that. +

+

+ Now that it's unzipped, go into the VisualC + directory that is created, and double-click on the VC++ file "SDL.dsw" + ("SDL.sln"). This should open up the IDE. +

+

+ You may be prompted at this point to upgrade the workspace, should you be using + a more recent version of Visual C++. If so, allow the workspace to be upgraded. +

+

+ Build the .dll and .lib files. +

+

+ This is done by right clicking on each project in turn (Projects are listed in + the Workspace panel in the FileView tab), and selecting "Build". +

+

+ If you get an error about SDL_config.h being missing, you should + copy include/SDL_config.h.default to include/SDL_config.h and try again. +

+

+ You may get a few warnings, but you should not get any errors. You do have to + have at least the DirectX 5 SDK installed, however. The latest + version of DirectX can be downloaded or purchased on a cheap CD (my + recommendation) from Microsoft . +

+

+ Later, we will refer to the following .lib and .dll files that have just been + generated: +

+
    +
  • SDL.dll
  • +
  • SDL.lib
  • +
  • SDLmain.lib
  • +
+

+ Search for these using the Windows Find (Windows-F) utility, if you don't + already know where they should be. For those of you with a clue, look inside + the Debug or Release directories of the subdirectories of the Project folder. + (It might be easier to just use Windows Find if this sounds confusing. And + don't worry about needing a clue; we all need visits from the clue fairy + frequently.) +

+

+ Creating a Project with SDL +

+

+ Create a project as a Win32 Application. +

+

+ Create a C++ file for your project. +

+

+ Set the C runtime to "Multi-threaded DLL" in the menu: Project|Settings|C/C++ + tab|Code Generation|Runtime Library . +

+

+ Add the SDL include directory to your list of includes in the + menu: Project|Settings|C/C++ tab|Preprocessor|Additional include directories + . +
+ VC7 Specific: Instead of doing this I find it easier to + add the include and library directories to the list that VC7 keeps. Do this by + selecting Tools|Options|Projects|VC++ Directories and under the "Show + Directories For:" dropbox select "Include Files", and click the "New Directory + Icon" and add the [SDLROOT]\include directory (ex. If you installed to + c:\SDL-1.2.5\ add c:\SDL-1.2.5\include). Proceed to change the + dropbox selection to "Library Files" and add [SDLROOT]\lib. +

+

+ The "include directory" I am referring to is the include folder + within the main SDL directory (the one that this HTML file located within). +

+

+ Now we're going to use the files that we had created earlier in the Build SDL + step. +

+

+ Copy the following files into your Project directory: +

+
    +
  • SDL.dll
  • +
+

+ Add the following files to your project (It is not necessary to copy them to + your project directory): +

+
    +
  • SDL.lib
  • +
  • SDLmain.lib
  • +
+

+ (To add them to your project, right click on your project, and select "Add + files to project") +

+

Instead of adding the files to your project it is more + desireable to add them to the linker options: Project|Properties|Linker|Command + Line and type the names of the libraries to link with in the "Additional + Options:" box.  Note: This must be done for each build + configuration (eg. Release,Debug).

+

+ SDL 101, First Day of Class +

+

+ Now create the basic body of your project. The body of your program should take + the following form: +

+#include "SDL.h"
+
+int main( int argc, char* argv[] )
+{
+  // Body of the program goes here.
+  return 0;
+}
+
+ +

+

+ That's it! +

+

+ I hope that this document has helped you get through the most difficult part of + using the SDL: installing it. Suggestions for improvements to this document + should be sent to the writers of this document. +

+

+ Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port. +

+

+ This document was originally called "VisualC.txt", and was written by + Sam Lantinga. +

+

+ Later, it was converted to HTML and expanded into the document that you see + today by Lion Kimbro. +

+

Minor Fixes and Visual C++ 7 Information (In Green) was added by James Turk +

+ + diff --git a/SDL/WhatsNew b/SDL/WhatsNew new file mode 100644 index 0000000..37a4136 --- /dev/null +++ b/SDL/WhatsNew @@ -0,0 +1,716 @@ + +This is a list of API changes in SDL's version history. + +Version 1.0: + +1.2.13: + Added SDL_BUTTON_X1 and SDL_BUTTON_X2 constants. + +1.2.12: + Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling + of the screensaver on Mac OS X and X11. + +1.2.10: + If SDL_OpenAudio() is passed zero for the desired format + fields, the following environment variables will be used + to fill them in: + SDL_AUDIO_FREQUENCY + SDL_AUDIO_FORMAT + SDL_AUDIO_CHANNELS + SDL_AUDIO_SAMPLES + If an environment variable is not specified, it will be set + to a reasonable default value. + + Added support for the SDL_VIDEO_FULLSCREEN_HEAD environment + variable, currently supported on X11 Xinerama configurations. + + Added SDL_GL_SWAP_CONTROL to wait for vsync in OpenGL applications. + + Added SDL_GL_ACCELERATED_VISUAL to guarantee hardware acceleration. + + Added current_w and current_h to the SDL_VideoInfo structure, + which is set to the desktop resolution during video intialization, + and then set to the current resolution when a video mode is set. + + SDL_SetVideoMode() now accepts 0 for width or height and will use + the current video mode (or the desktop mode if no mode has been set.) + + Added SDL_GetKeyRepeat() + + Added SDL_config.h, with defaults for various build environments. + +1.2.7: + Added CPU feature detection functions to SDL_cpuinfo.h: + SDL_HasRDTSC(), SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE(), + SDL_HasAltiVec() + Added function to create RWops from const memory: SDL_RWFromConstMem() + +1.2.6: + Added SDL_LoadObject(), SDL_LoadFunction(), and SDL_UnloadObject() + + Added SDL_GL_MULTISAMPLEBUFFERS and SDL_GL_MULTISAMPLESAMPLES for FSAA + +1.2.5: + Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5) + + Added SDL_GL_STEREO for stereoscopic OpenGL contexts + +1.2.0: + Added SDL_VIDEOEXPOSE event to signal that the screen needs to + be redrawn. This is currently only delivered to OpenGL windows + on X11, though it may be delivered in the future when the video + memory is lost under DirectX. + +1.1.8: + You can pass SDL_NOFRAME to SDL_VideoMode() to create a window + that has no title bar or frame decoration. Fullscreen video + modes automatically have this flag set. + + Added a function to query the clipping rectangle for a surface: + void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect) + + Added a function to query the current event filter: + SDL_EventFilter SDL_GetEventFilter(void) + + If you pass -1 to SDL_ShowCursor(), it won't change the current + cursor visibility state, but will still return it. + + SDL_LockSurface() and SDL_UnlockSurface() are recursive, meaning + you can nest them as deep as you want, as long as each lock call + has a matching unlock call. The surface remains locked until the + last matching unlock call. + + Note that you may not blit to or from a locked surface. + +1.1.7: + The SDL_SetGammaRamp() and SDL_GetGammaRamp() functions now take + arrays of Uint16 values instead of Uint8 values. For the most part, + you can just take your old values and shift them up 8 bits to get + new correct values for your gamma ramps. + + You can pass SDL_RLEACCEL in flags passed to SDL_ConvertSurface() + and SDL will try to RLE accelerate colorkey and alpha blits in the + resulting surface. + +1.1.6: + Added a function to return the thread ID of a specific thread: + Uint32 SDL_GetThreadID(SDL_Thread *thread) + If 'thread' is NULL, this function returns the id for this thread. + +1.1.5: + The YUV overlay structure has been changed to use an array of + pitches and pixels representing the planes of a YUV image, to + better enable hardware acceleration. The YV12 and IYUV formats + each have three planes, corresponding to the Y, U, and V portions + of the image, while packed pixel YUV formats just have one plane. + + For palettized mode (8bpp), the screen colormap is now split in + a physical and a logical palette. The physical palette determines + what colours the screen pixels will get when displayed, and the + logical palette controls the mapping from blits to/from the screen. + A new function, SDL_SetPalette() has been added to change + logical and physical palettes separately. SDL_SetColors() works + just as before, and is equivalent to calling SDL_SetPalette() with + a flag argument of (SDL_LOGPAL|SDL_PHYSPAL). + + SDL_BlitSurface() no longer modifies the source rectangle, only the + destination rectangle. The width/height members of the destination + rectangle are ignored, only the position is used. + + The old source clipping function SDL_SetClipping() has been replaced + with a more useful function to set the destination clipping rectangle: + SDL_bool SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect) + + Added a function to see what subsystems have been initialized: + Uint32 SDL_WasInit(Uint32 flags) + + The Big Alpha Flip: SDL now treats alpha as opacity like everybody + else, and not as transparency: + + A new cpp symbol: SDL_ALPHA_OPAQUE is defined as 255 + A new cpp symbol: SDL_ALPHA_TRANSPARENT is defined as 0 + Values between 0 and 255 vary from fully transparent to fully opaque. + + New functions: + SDL_DisplayFormatAlpha() + Returns a surface converted to a format with alpha-channel + that can be blit efficiently to the screen. (In other words, + like SDL_DisplayFormat() but the resulting surface has + an alpha channel.) This is useful for surfaces with alpha. + SDL_MapRGBA() + Works as SDL_MapRGB() but takes an additional alpha parameter. + SDL_GetRGBA() + Works as SDL_GetRGB() but also returns the alpha value + (SDL_ALPHA_OPAQUE for formats without an alpha channel) + + Both SDL_GetRGB() and SDL_GetRGBA() now always return values in + the [0..255] interval. Previously, SDL_GetRGB() would return + (0xf8, 0xfc, 0xf8) for a completely white pixel in RGB565 format. + (N.B.: This is broken for bit fields < 3 bits.) + + SDL_MapRGB() returns pixels in which the alpha channel is set opaque. + + SDL_SetAlpha() can now be used for both setting the per-surface + alpha, using the new way of thinking of alpha, and also to enable + and disable per-pixel alpha blending for surfaces with an alpha + channel: + To disable alpha blending: + SDL_SetAlpha(surface, 0, 0); + To re-enable alpha blending: + SDL_SetAlpha(surface, SDL_SRCALPHA, 0); + Surfaces with an alpha channel have blending enabled by default. + + SDL_SetAlpha() now accepts SDL_RLEACCEL as a flag, which requests + RLE acceleration of blits, just as like with SDL_SetColorKey(). + This flag can be set for both surfaces with an alpha channel + and surfaces with an alpha value set by SDL_SetAlpha(). + As always, RLE surfaces must be locked before pixel access is + allowed, and unlocked before any other SDL operations are done + on it. + + The blit semantics for surfaces with and without alpha and colorkey + have now been defined: + + RGBA->RGB: + SDL_SRCALPHA set: + alpha-blend (using alpha-channel). + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy RGB. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value); + set destination alpha to opaque. + SDL_SRCALPHA not set: + copy RGB, set destination alpha to opaque. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + + RGBA->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source alpha channel) the RGB values; + leave destination alpha untouched. [Note: is this correct?] + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy all of RGBA to the destination. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGB: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value). + SDL_SRCALPHA not set: + copy RGB. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + + As a special case, blits from surfaces with per-surface alpha + value of 128 (50% transparency) are optimised and much faster + than other alpha values. This does not apply to surfaces with + alpha channels (per-pixel alpha). + + New functions for manipulating the gamma of the display have + been added: + int SDL_SetGamma(float red, float green, float blue); + int SDL_SetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue); + int SDL_GetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue); + Gamma ramps are tables with 256 entries which map the screen color + components into actually displayed colors. For an example of + implementing gamma correction and gamma fades, see test/testgamma.c + Gamma control is not supported on all hardware. + +1.1.4: + The size of the SDL_CDtrack structure changed from 8 to 12 bytes + as the size of the length member was extended to 32 bits. + + You can now use SDL for 2D blitting with a GL mode by passing the + SDL_OPENGLBLIT flag to SDL_SetVideoMode(). You can specify 16 or + 32 bpp, and the data in the framebuffer is put into the GL scene + when you call SDL_UpdateRects(), and the scene will be visible + when you call SDL_GL_SwapBuffers(). + + Run the "testgl" test program with the -logo command line option + to see an example of this blending of 2D and 3D in SDL. + +1.1.3: + Added SDL_FreeRW() to the API, to complement SDL_AllocRW() + + Added resizable window support - just add SDL_RESIZABLE to the + SDL_SetVideoMode() flags, and then wait for SDL_VIDEORESIZE events. + See SDL_events.h for details on the new SDL_ResizeEvent structure. + + Added condition variable support, based on mutexes and semaphores. + SDL_CreateCond() + SDL_DestroyCond() + SDL_CondSignal() + SDL_CondBroadcast() + SDL_CondWait() + SDL_CondTimedWait() + The new function prototypes are in SDL_mutex.h + + Added counting semaphore support, based on the mutex primitive. + SDL_CreateSemaphore() + SDL_DestroySemaphore() + SDL_SemWait() + SDL_SemTryWait() + SDL_SemWaitTimeout() + SDL_SemPost() + SDL_SemValue() + The new function prototypes are in SDL_mutex.h + + Added support for asynchronous blitting. To take advantage of this, + you must set the SDL_ASYNCBLIT flag when setting the video mode and + creating surfaces that you want accelerated in this way. You must + lock surfaces that have this flag set, and the lock will block until + any queued blits have completed. + + Added YUV video overlay support. + The supported YUV formats are: YV12, IYUV, YUY2, UYVY, and YVYU. + This function creates an overlay surface: + SDL_CreateYUVOverlay() + You must lock and unlock the overlay to get access to the data: + SDL_LockYUVOverlay() SDL_UnlockYUVOverlay() + You can then display the overlay: + SDL_DisplayYUVOverlay() + You must free the overlay when you are done using it: + SDL_FreeYUVOverlay() + See SDL_video.h for the full function prototypes. + + The joystick hat position constants have been changed: + Old constant New constant + ------------ ------------ + 0 SDL_HAT_CENTERED + 1 SDL_HAT_UP + 2 SDL_HAT_RIGHTUP + 3 SDL_HAT_RIGHT + 4 SDL_HAT_RIGHTDOWN + 5 SDL_HAT_DOWN + 6 SDL_HAT_LEFTDOWN + 7 SDL_HAT_LEFT + 8 SDL_HAT_LEFTUP + The new constants are bitmasks, so you can check for the + individual axes like this: + if ( hat_position & SDL_HAT_UP ) { + } + and you'll catch left-up, up, and right-up. + +1.1.2: + Added multiple timer support: + SDL_AddTimer() and SDL_RemoveTimer() + + SDL_WM_SetIcon() now respects the icon colorkey if mask is NULL. + +1.1.0: + Added initial OpenGL support. + First set GL attributes (such as RGB depth, alpha depth, etc.) + SDL_GL_SetAttribute() + Then call SDL_SetVideoMode() with the SDL_OPENGL flag. + Perform all of your normal GL drawing. + Finally swap the buffers with the new SDL function: + SDL_GL_SwapBuffers() + See the new 'testgl' test program for an example of using GL with SDL. + + You can load GL extension functions by using the function: + SDL_GL_LoadProcAddress() + + Added functions to initialize and cleanup specific SDL subsystems: + SDL_InitSubSystem() and SDL_QuitSubSystem() + + Added user-defined event type: + typedef struct { + Uint8 type; + int code; + void *data1; + void *data2; + } SDL_UserEvent; + This structure is in the "user" member of an SDL_Event. + + Added a function to push events into the event queue: + SDL_PushEvent() + + Example of using the new SDL user-defined events: + { + SDL_Event event; + + event.type = SDL_USEREVENT; + event.user.code = my_event_code; + event.user.data1 = significant_data; + event.user.data2 = 0; + SDL_PushEvent(&event); + } + + Added a function to get mouse deltas since last query: + SDL_GetRelativeMouseState() + + Added a boolean datatype to SDL_types.h: + SDL_bool = { SDL_TRUE, SDL_FALSE } + + Added a function to get the current audio status: + SDL_GetAudioState(); + It returns one of: + SDL_AUDIO_STOPPED, + SDL_AUDIO_PLAYING, + SDL_AUDIO_PAUSED + + Added an AAlib driver (ASCII Art) - by Stephane Peter. + +1.0.6: + The input grab state is reset after each call to SDL_SetVideoMode(). + The input is grabbed by default in fullscreen mode, and ungrabbed in + windowed mode. If you want to set input grab to a particular value, + you should set it after each call to SDL_SetVideoMode(). + +1.0.5: + Exposed SDL_AudioInit(), SDL_VideoInit() + Added SDL_AudioDriverName() and SDL_VideoDriverName() + + Added new window manager function: + SDL_WM_ToggleFullScreen() + This is currently implemented only on Linux + + The ALT-ENTER code has been removed - it's not appropriate for a + lib to bind keys when they aren't even emergency escape sequences. + + ALT-ENTER functionality can be implemented with the following code: + + int Handle_AltEnter(const SDL_Event *event) + { + if ( event->type == SDL_KEYDOWN ) { + if ( (event->key.keysym.sym == SDLK_RETURN) && + (event->key.keysym.mod & KMOD_ALT) ) { + SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()); + return(0); + } + } + return(1); + } + SDL_SetEventFilter(Handle_AltEnter); + +1.0.3: + Under X11, if you grab the input and hide the mouse cursor, + the mouse will go into a "relative motion" mode where you + will always get relative motion events no matter how far in + each direction you move the mouse - relative motion is not + bounded by the edges of the window (though the absolute values + of the mouse positions are clamped by the size of the window). + The SVGAlib, framebuffer console, and DirectInput drivers all + have this behavior naturally, and the GDI and BWindow drivers + never go into "relative motion" mode. + +1.0.2: + Added a function to enable keyboard repeat: + SDL_EnableKeyRepeat() + + Added a function to grab the mouse and keyboard input + SDL_WM_GrabInput() + + Added a function to iconify the window. + SDL_WM_IconifyWindow() + If this function succeeds, the application will receive an event + signaling SDL_APPACTIVE event + +1.0.1: + Added constants to SDL_audio.h for 16-bit native byte ordering: + AUDIO_U16SYS, AUDIO_S16SYS + +1.0.0: + New public release + +Version 0.11: + +0.11.5: + A new function SDL_GetVideoSurface() has been added, and returns + a pointer to the current display surface. + + SDL_AllocSurface() has been renamed SDL_CreateRGBSurface(), and + a new function SDL_CreateRGBSurfaceFrom() has been added to allow + creating an SDL surface from an existing pixel data buffer. + + Added SDL_GetRGB() to the headers and documentation. + +0.11.4: + SDL_SetLibraryPath() is no longer meaningful, and has been removed. + +0.11.3: + A new flag for SDL_Init(), SDL_INIT_NOPARACHUTE, prevents SDL from + installing fatal signal handlers on operating systems that support + them. + +Version 0.9: + +0.9.15: + SDL_CreateColorCursor() has been removed. Color cursors should + be implemented as sprites, blitted by the application when the + cursor moves. To get smooth color cursor updates when the app + is busy, pass the SDL_INIT_EVENTTHREAD flag to SDL_Init(). This + allows you to handle the mouse motion in another thread from an + event filter function, but is currently only supported by Linux + and BeOS. Note that you'll have to protect the display surface + from multi-threaded access by using mutexes if you do this. + + Thread-safe surface support has been removed from SDL. + This makes blitting somewhat faster, by removing SDL_MiddleBlit(). + Code that used SDL_MiddleBlit() should use SDL_LowerBlit() instead. + You can make your surfaces thread-safe by allocating your own + mutex and making lock/unlock calls around accesses to your surface. + +0.9.14: + SDL_GetMouseState() now takes pointers to int rather than Uint16. + + If you set the SDL_WINDOWID environment variable under UNIX X11, + SDL will use that as the main window instead of creating it's own. + This is an unsupported extension to SDL, and not portable at all. + +0.9.13: + Added a function SDL_SetLibraryPath() which can be used to specify + the directory containing the SDL dynamic libraries. This is useful + for commercial applications which ship with particular versions + of the libraries, and for security on multi-user systems. + If this function is not used, the default system directories are + searched using the native dynamic object loading mechanism. + + In order to support C linkage under Visual C++, you must declare + main() without any return type: + main(int argc, char *argv[]) { + /* Do the program... */ + return(0); + } + C++ programs should also return a value if compiled under VC++. + + The blit_endian member of the SDL_VideoInfo struct has been removed. + + SDL_SymToASCII() has been replaced with SDL_GetKeyName(), so there + is now no longer any function to translate a keysym to a character. + + The SDL_keysym structure has been extended with a 'scancode' and + 'unicode' member. The 'scancode' is a hardware specific scancode + for the key that was pressed, and may be 0. The 'unicode' member + is a 16-bit UNICODE translation of the key that was pressed along + with any modifiers or compose keys that have been pressed. + If no UNICODE translation exists for the key, 'unicode' will be 0. + + Added a function SDL_EnableUNICODE() to enable/disable UNICODE + translation of character keypresses. Translation defaults off. + + To convert existing code to use the new API, change code which + uses SDL_SymToASCII() to get the keyname to use SDL_GetKeyName(), + and change code which uses it to get the ASCII value of a sym to + use the 'unicode' member of the event keysym. + +0.9.12: + There is partial support for 64-bit datatypes. I don't recommend + you use this if you have a choice, because 64-bit datatypes are not + supported on many platforms. On platforms for which it is supported, + the SDL_HAS_64BIT_TYPE C preprocessor define will be enabled, and + you can use the Uint64 and Sint64 datatypes. + + Added functions to SDL_endian.h to support 64-bit datatypes: + SDL_SwapLE64(), SDL_SwapBE64(), + SDL_ReadLE64(), SDL_ReadBE64(), SDL_WriteLE64(), SDL_WriteBE64() + + A new member "len_ratio" has been added to the SDL_AudioCVT structure, + and allows you to determine either the original buffer length or the + converted buffer length, given the other. + + A new function SDL_FreeWAV() has been added to the API to free data + allocated by SDL_LoadWAV_RW(). This is necessary under Win32 since + the gcc compiled DLL uses a different heap than VC++ compiled apps. + + SDL now has initial support for international keyboards using the + Latin character set. + If a particular mapping is desired, you can set the DEFAULT_KEYBOARD + compile-time variable, or you can set the environment variable + "SDL_KEYBOARD" to a string identifying the keyboard mapping you desire. + The valid values for these variables can be found in SDL_keyboard.c + + Full support for German and French keyboards under X11 is implemented. + +0.9.11: + The THREADED_EVENTS compile-time define has been replaced with the + SDL_INIT_EVENTTHREAD flag. If this flag is passed to SDL_Init(), + SDL will create a separate thread to perform input event handling. + If this flag is passed to SDL_Init(), and the OS doesn't support + event handling in a separate thread, SDL_Init() will fail. + Be sure to add calls to SDL_Delay() in your main thread to allow + the OS to schedule your event thread, or it may starve, leading + to slow event delivery and/or dropped events. + Currently MacOS and Win32 do not support this flag, while BeOS + and Linux do support it. I recommend that your application only + use this flag if absolutely necessary. + + The SDL thread function passed to SDL_CreateThread() now returns a + status. This status can be retrieved by passing a non-NULL pointer + as the 'status' argument to SDL_WaitThread(). + + The volume parameter to SDL_MixAudio() has been increased in range + from (0-8) to (0-128) + + SDL now has a data source abstraction which can encompass a file, + an area of memory, or any custom object you can envision. It uses + these abstractions, SDL_RWops, in the endian read/write functions, + and the built-in WAV and BMP file loaders. This means you can load + WAV chunks from memory mapped files, compressed archives, network + pipes, or anything else that has a data read abstraction. + + There are three built-in data source abstractions: + SDL_RWFromFile(), SDL_RWFromFP(), SDL_RWFromMem() + along with a generic data source allocation function: + SDL_AllocRW() + These data sources can be used like stdio file pointers with the + following convenience functions: + SDL_RWseek(), SDL_RWread(), SDL_RWwrite(), SDL_RWclose() + These functions are defined in the new header file "SDL_rwops.h" + + The endian swapping functions have been turned into macros for speed + and SDL_CalculateEndian() has been removed. SDL_endian.h now defines + SDL_BYTEORDER as either SDL_BIG_ENDIAN or SDL_LIL_ENDIAN depending on + the endianness of the host system. + + The endian read/write functions now take an SDL_RWops pointer + instead of a stdio FILE pointer, to support the new data source + abstraction. + + The SDL_*LoadWAV() functions have been replaced with a single + SDL_LoadWAV_RW() function that takes a SDL_RWops pointer as it's + first parameter, and a flag whether or not to automatically + free it as the second parameter. SDL_LoadWAV() is a macro for + backward compatibility and convenience: + SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + + The SDL_*LoadBMP()/SDL_*SaveBMP() functions have each been replaced + with a single function that takes a SDL_RWops pointer as it's + first parameter, and a flag whether or not to automatically + free it as the second parameter. SDL_LoadBMP() and SDL_SaveBMP() + are macros for backward compatibility and convenience: + SDL_LoadBMP_RW(SDL_RWFromFile("sample.bmp", "rb"), 1, ...); + SDL_SaveBMP_RW(SDL_RWFromFile("sample.bmp", "wb"), 1, ...); + Note that these functions use SDL_RWseek() extensively, and should + not be used on pipes or other non-seekable data sources. + +0.9.10: + The Linux SDL_SysWMInfo and SDL_SysWMMsg structures have been + extended to support multiple types of display drivers, as well as + safe access to the X11 display when THREADED_EVENTS is enabled. + The new structures are documented in the SDL_syswm.h header file. + + Thanks to John Elliott , the UK keyboard + should now work properly, as well as the "Windows" keys on US + keyboards. + + The Linux CD-ROM code now reads the CD-ROM devices from /etc/fstab + instead of trying to open each block device on the system. + The CD must be listed in /etc/fstab as using the iso9660 filesystem. + + On Linux, if you define THREADED_EVENTS at compile time, a separate + thread will be spawned to gather X events asynchronously from the + graphics updates. This hasn't been extensively tested, but it does + provide a means of handling keyboard and mouse input in a separate + thread from the graphics thread. (This is now enabled by default.) + + A special access function SDL_PeepEvents() allows you to manipulate + the event queue in a thread-safe manner, including peeking at events, + removing events of a specified type, and adding new events of arbitrary + type to the queue (use the new 'user' member of the SDL_Event type). + + If you use SDL_PeepEvents() to gather events, then the main graphics + thread needs to call SDL_PumpEvents() periodically to drive the event + loop and generate input events. This is not necessary if SDL has been + compiled with THREADED_EVENTS defined, but doesn't hurt. + + A new function SDL_ThreadID() returns the identifier associated with + the current thread. + +0.9.9: + The AUDIO_STEREO format flag has been replaced with a new 'channels' + member of the SDL_AudioSpec structure. The channels are 1 for mono + audio, and 2 for stereo audio. In the future more channels may be + supported for 3D surround sound. + + The SDL_MixAudio() function now takes an additional volume parameter, + which should be set to SDL_MIX_MAXVOLUME for compatibility with the + original function. + + The CD-ROM functions which take a 'cdrom' parameter can now be + passed NULL, and will act on the last successfully opened CD-ROM. + +0.9.8: + No changes, bugfixes only. + +0.9.7: + No changes, bugfixes only. + +0.9.6: + Added a fast rectangle fill function: SDL_FillRect() + + Addition of a useful function for getting info on the video hardware: + const SDL_VideoInfo *SDL_GetVideoInfo(void) + This function replaces SDL_GetDisplayFormat(). + + Initial support for double-buffering: + Use the SDL_DOUBLEBUF flag in SDL_SetVideoMode() + Update the screen with a new function: SDL_Flip() + + SDL_AllocSurface() takes two new flags: + SDL_SRCCOLORKEY means that the surface will be used for colorkey blits + and if the hardware supports hardware acceleration of colorkey blits + between two surfaces in video memory, to place the surface in video + memory if possible, otherwise it will be placed in system memory. + SDL_SRCALPHA means that the surface will be used for alpha blits and + if the hardware supports hardware acceleration of alpha blits between + two surfaces in video memory, to place the surface in video memory + if possible, otherwise it will be placed in system memory. + SDL_HWSURFACE now means that the surface will be created with the + same format as the display surface, since having surfaces in video + memory is only useful for fast blitting to the screen, and you can't + blit surfaces with different surface formats in video memory. + +0.9.5: + You can now pass a NULL mask to SDL_WM_SetIcon(), and it will assume + that the icon consists of the entire image. + + SDL_LowerBlit() is back -- but don't use it on the display surface. + It is exactly the same as SDL_MiddleBlit(), but doesn't check for + thread safety. + + Added SDL_FPLoadBMP(), SDL_FPSaveBMP(), SDL_FPLoadWAV(), which take + a FILE pointer instead of a file name. + + Added CD-ROM audio control API: + SDL_CDNumDrives() + SDL_CDName() + SDL_CDOpen() + SDL_CDStatus() + SDL_CDPlayTracks() + SDL_CDPlay() + SDL_CDPause() + SDL_CDResume() + SDL_CDStop() + SDL_CDEject() + SDL_CDClose() + +0.9.4: + No changes, bugfixes only. + +0.9.3: + Mouse motion event now includes relative motion information: + Sint16 event->motion.xrel, Sint16 event->motion.yrel + + X11 keyrepeat handling can be disabled by defining IGNORE_X_KEYREPEAT + (Add -DIGNORE_X_KEYREPEAT to CFLAGS line in obj/x11Makefile) + +0.9.2: + No changes, bugfixes only. + +0.9.1: + Removed SDL_MapSurface() and SDL_UnmapSurface() -- surfaces are now + automatically mapped on blit. + +0.8.0: + SDL stable release diff --git a/SDL/acinclude.m4 b/SDL/acinclude.m4 new file mode 100644 index 0000000..080e50d --- /dev/null +++ b/SDL/acinclude.m4 @@ -0,0 +1,6724 @@ +############################################################################## +dnl Configure Paths for Alsa +dnl Some modifications by Richard Boulton +dnl Christopher Lansdown +dnl Jaroslav Kysela +dnl Last modification: alsa.m4,v 1.23 2004/01/16 18:14:22 tiwai Exp +dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate. +dnl enables arguments --with-alsa-prefix= +dnl --with-alsa-enc-prefix= +dnl --disable-alsatest +dnl +dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified, +dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result. +dnl +AC_DEFUN([AM_PATH_ALSA], +[dnl Save the original CFLAGS, LDFLAGS, and LIBS +alsa_save_CFLAGS="$CFLAGS" +alsa_save_LDFLAGS="$LDFLAGS" +alsa_save_LIBS="$LIBS" +alsa_found=yes + +dnl +dnl Get the cflags and libraries for alsa +dnl +AC_ARG_WITH(alsa-prefix, +[ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)], +[alsa_prefix="$withval"], [alsa_prefix=""]) + +AC_ARG_WITH(alsa-inc-prefix, +[ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)], +[alsa_inc_prefix="$withval"], [alsa_inc_prefix=""]) + +dnl FIXME: this is not yet implemented +AC_ARG_ENABLE(alsatest, +[ --disable-alsatest Do not try to compile and run a test Alsa program], +[enable_alsatest="$enableval"], +[enable_alsatest=yes]) + +dnl Add any special include directories +AC_MSG_CHECKING(for ALSA CFLAGS) +if test "$alsa_inc_prefix" != "" ; then + ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" + CFLAGS="$CFLAGS -I$alsa_inc_prefix" +fi +AC_MSG_RESULT($ALSA_CFLAGS) + +dnl add any special lib dirs +AC_MSG_CHECKING(for ALSA LDFLAGS) +if test "$alsa_prefix" != "" ; then + ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" + LDFLAGS="$LDFLAGS $ALSA_LIBS" +fi + +dnl add the alsa library +ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread" +LIBS=`echo $LIBS | sed 's/-lm//'` +LIBS=`echo $LIBS | sed 's/-ldl//'` +LIBS=`echo $LIBS | sed 's/-lpthread//'` +LIBS=`echo $LIBS | sed 's/ //'` +LIBS="$ALSA_LIBS $LIBS" +AC_MSG_RESULT($ALSA_LIBS) + +dnl Check for a working version of libasound that is of the right version. +min_alsa_version=ifelse([$1], ,0.1.1,$1) +AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version) +no_alsa="" + alsa_min_major_version=`echo $min_alsa_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + alsa_min_minor_version=`echo $min_alsa_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + alsa_min_micro_version=`echo $min_alsa_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + +AC_LANG_SAVE +AC_LANG_C +AC_TRY_COMPILE([ +#include +], [ +/* ensure backward compatibility */ +#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR) +#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR +#endif +#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR) +#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR +#endif +#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR) +#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR +#endif + +# if(SND_LIB_MAJOR > $alsa_min_major_version) + exit(0); +# else +# if(SND_LIB_MAJOR < $alsa_min_major_version) +# error not present +# endif + +# if(SND_LIB_MINOR > $alsa_min_minor_version) + exit(0); +# else +# if(SND_LIB_MINOR < $alsa_min_minor_version) +# error not present +# endif + +# if(SND_LIB_SUBMINOR < $alsa_min_micro_version) +# error not present +# endif +# endif +# endif +exit(0); +], + [AC_MSG_RESULT(found.)], + [AC_MSG_RESULT(not present.) + ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)]) + alsa_found=no] +) +AC_LANG_RESTORE + +dnl Now that we know that we have the right version, let's see if we have the library and not just the headers. +if test "x$enable_alsatest" = "xyes"; then +AC_CHECK_LIB([asound], [snd_ctl_open],, + [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)]) + alsa_found=no] +) +fi + +if test "x$alsa_found" = "xyes" ; then + ifelse([$2], , :, [$2]) + LIBS=`echo $LIBS | sed 's/-lasound//g'` + LIBS=`echo $LIBS | sed 's/ //'` + LIBS="-lasound $LIBS" +fi +if test "x$alsa_found" = "xno" ; then + ifelse([$3], , :, [$3]) + CFLAGS="$alsa_save_CFLAGS" + LDFLAGS="$alsa_save_LDFLAGS" + LIBS="$alsa_save_LIBS" + ALSA_CFLAGS="" + ALSA_LIBS="" +fi + +dnl That should be it. Now just export out symbols: +AC_SUBST(ALSA_CFLAGS) +AC_SUBST(ALSA_LIBS) +]) + +############################################################################## +# +# --- esd.m4 --- +# +# Configure paths for ESD +# Manish Singh 98-9-30 +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS +dnl +AC_DEFUN([AM_PATH_ESD], +[dnl +dnl Get the cflags and libraries from the esd-config script +dnl +AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)], + esd_prefix="$withval", esd_prefix="") +AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)], + esd_exec_prefix="$withval", esd_exec_prefix="") +AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program], + , enable_esdtest=yes) + + if test x$esd_exec_prefix != x ; then + esd_args="$esd_args --exec-prefix=$esd_exec_prefix" + if test x${ESD_CONFIG+set} != xset ; then + ESD_CONFIG=$esd_exec_prefix/bin/esd-config + fi + fi + if test x$esd_prefix != x ; then + esd_args="$esd_args --prefix=$esd_prefix" + if test x${ESD_CONFIG+set} != xset ; then + ESD_CONFIG=$esd_prefix/bin/esd-config + fi + fi + + AC_PATH_PROG(ESD_CONFIG, esd-config, no) + min_esd_version=ifelse([$1], ,0.2.7,$1) + AC_MSG_CHECKING(for ESD - version >= $min_esd_version) + no_esd="" + if test "$ESD_CONFIG" = "no" ; then + no_esd=yes + else + ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags` + ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs` + + esd_major_version=`$ESD_CONFIG $esd_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + esd_minor_version=`$ESD_CONFIG $esd_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_esdtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $ESD_CFLAGS" + LIBS="$LIBS $ESD_LIBS" +dnl +dnl Now check if the installed ESD is sufficiently new. (Also sanity +dnl checks the results of esd-config to some extent +dnl + rm -f conf.esdtest + AC_TRY_RUN([ +#include +#include +#include +#include + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.esdtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_esd_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_esd_version"); + exit(1); + } + + if (($esd_major_version > major) || + (($esd_major_version == major) && ($esd_minor_version > minor)) || + (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version); + printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n"); + printf("*** to point to the correct copy of esd-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_esd" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$ESD_CONFIG" = "no" ; then + echo "*** The esd-config script installed by ESD could not be found" + echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the ESD_CONFIG environment variable to the" + echo "*** full path to esd-config." + else + if test -f conf.esdtest ; then + : + else + echo "*** Could not run ESD test program, checking why..." + CFLAGS="$CFLAGS $ESD_CFLAGS" + LIBS="$LIBS $ESD_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding ESD or finding the wrong" + echo "*** version of ESD. If it is not finding ESD, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means ESD was incorrectly installed" + echo "*** or that you have moved ESD since it was installed. In the latter case, you" + echo "*** may want to edit the esd-config script: $ESD_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + ESD_CFLAGS="" + ESD_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(ESD_CFLAGS) + AC_SUBST(ESD_LIBS) + rm -f conf.esdtest +]) + +############################################################################## +# Based on libtool-1.5.22 +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## This file is free software; the Free Software Foundation gives +## unlimited permission to copy and/or distribute it, with or without +## modifications, as long as this notice is preserved. + +# serial 48 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_LINKER_BOILERPLATE + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1 && unset CDPATH + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) LD="${LD-ld} -64" ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + beos*) + # On BeOS, this test takes a really really long time. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# ------------------ +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# --------------------------------------------------------------------- +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ---------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + #soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + soname_spec='`echo ${libname} | sed -e 's/^lib//'`${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + #soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + soname_spec='`echo ${libname} | sed -e 's/^lib//'`${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix3*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + if test -z "$LTCFLAGS"; then + eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 DLLs +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +# set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix3*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# it is assumed to be `libltdl'. LIBLTDL will be prefixed with +# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' +# (note the single quotes!). If your package is not flat and you're not +# using automake, define top_builddir and top_srcdir appropriately in +# the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# and an installed libltdl is not found, it is assumed to be `libltdl'. +# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and top_srcdir +# appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, lt_dlinit, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + +# _LT_AC_PROG_CXXCPP +# ------------------ +AC_DEFUN([_LT_AC_PROG_CXXCPP], +[ +AC_REQUIRE([AC_PROG_CXX]) +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +fi +])# _LT_AC_PROG_CXXCPP + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# ------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF + +# Report which library types will actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + $as_unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + $as_unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[[12]]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + ;; + *) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + interix3*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC*) + # Portland Group C++ compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + # So that behaviour is only enabled if SCOABSPATH is set to a + # non-empty value in the environment. Most likely only useful for + # creating official distributions of packages. + # This is a hack until libtool officially supports absolute path + # names for shared libraries. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDGIRSTW]]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + interix3*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC*) + # Portland Group C++ compiler. + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + interix3*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + interix3*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi[[45]]*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu | dragonfly*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_MSG_RESULT([$SED]) +]) diff --git a/SDL/autogen.sh b/SDL/autogen.sh new file mode 100644 index 0000000..97105d1 --- /dev/null +++ b/SDL/autogen.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# +echo "Generating build information using autoconf" +echo "This may take a while ..." + +# Regenerate configuration files +cp acinclude.m4 aclocal.m4 +found=false +for autoconf in autoconf autoconf259 autoconf-2.59 +do if which $autoconf >/dev/null 2>&1; then $autoconf && found=true; break; fi +done +if test x$found = xfalse; then + echo "Couldn't find autoconf, aborting" + exit 1 +fi +(cd test; sh autogen.sh) + +# Run configure for this platform +echo "Now you are ready to run ./configure" diff --git a/SDL/build-scripts/config.guess b/SDL/build-scripts/config.guess new file mode 100644 index 0000000..b55410d --- /dev/null +++ b/SDL/build-scripts/config.guess @@ -0,0 +1,1526 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2007-12-12' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/SDL/build-scripts/config.sub b/SDL/build-scripts/config.sub new file mode 100644 index 0000000..eb6240d --- /dev/null +++ b/SDL/build-scripts/config.sub @@ -0,0 +1,1657 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2007-12-05' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -cegcc*) + os=-cegcc + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/SDL/build-scripts/fatbuild.sh b/SDL/build-scripts/fatbuild.sh new file mode 100644 index 0000000..cc7cafd --- /dev/null +++ b/SDL/build-scripts/fatbuild.sh @@ -0,0 +1,316 @@ +#!/bin/sh +# +# Build a fat binary on Mac OS X, thanks Ryan! + +# Number of CPUs (for make -j) +NCPU=`sysctl -n hw.ncpu` +NJOB=$NCPU +#NJOB=`expr $NCPU + 1` + +# Generic, cross-platform CFLAGS you always want go here. +CFLAGS="-O3 -g -pipe" + +# Locate Xcode SDK path +SDK_PATH=/Developer/SDKs +if [ ! -d $SDK_PATH ]; then + echo "Couldn't find SDK path" + exit 1 +fi + +# See if we can use 10.2 or 10.3 runtime compatibility +if [ -d "$SDK_PATH/MacOSX10.2.8.sdk" ]; then + # PowerPC configure flags (10.2 runtime compatibility) + # We dynamically load X11, so using the system X11 headers is fine. + CONFIG_PPC="--build=`uname -p`-apple-darwin --host=powerpc-apple-darwin \ +--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib" + + # PowerPC compiler flags + CC_PPC="gcc-3.3 -arch ppc" + CXX_PPC="g++-3.3 -arch ppc" + CFLAGS_PPC="" + CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \ +-nostdinc \ +-F$SDK_PATH/MacOSX10.2.8.sdk/System/Library/Frameworks \ +-I$SDK_PATH/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \ +-isystem $SDK_PATH/MacOSX10.2.8.sdk/usr/include" + + # PowerPC linker flags + LFLAGS_PPC="-arch ppc \ +-L$SDK_PATH/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \ +-F$SDK_PATH/MacOSX10.2.8.sdk/System/Library/Frameworks \ +-Wl,-syslibroot,$SDK_PATH/MacOSX10.2.8.sdk" + +else # 10.2 or 10.3 SDK + + # PowerPC configure flags (10.3 runtime compatibility) + # We dynamically load X11, so using the system X11 headers is fine. + CONFIG_PPC="--build=`uname -p`-apple-darwin --host=powerpc-apple-darwin \ +--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib" + + # PowerPC compiler flags + CC_PPC="gcc-4.0 -arch ppc" + CXX_PPC="g++-4.0 -arch ppc" + CFLAGS_PPC="" + CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1030 \ +-nostdinc \ +-F$SDK_PATH/MacOSX10.3.9.sdk/System/Library/Frameworks \ +-I$SDK_PATH/MacOSX10.3.9.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/include \ +-isystem $SDK_PATH/MacOSX10.3.9.sdk/usr/include" + + # PowerPC linker flags + LFLAGS_PPC="-arch ppc -mmacosx-version-min=10.3 \ +-L$SDK_PATH/MacOSX10.3.9.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1 \ +-F$SDK_PATH/MacOSX10.3.9.sdk/System/Library/Frameworks \ +-Wl,-syslibroot,$SDK_PATH/MacOSX10.3.9.sdk" + +fi # 10.2 or 10.3 SDK + +# Intel configure flags (10.4 runtime compatibility) +# We dynamically load X11, so using the system X11 headers is fine. +CONFIG_X86="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \ +--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib" + +# Intel compiler flags +CC_X86="gcc-4.0 -arch i386" +CXX_X86="g++-4.0 -arch i386" +CFLAGS_X86="-mmacosx-version-min=10.4" +CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \ +-nostdinc \ +-F$SDK_PATH/MacOSX10.4u.sdk/System/Library/Frameworks \ +-I$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include \ +-isystem $SDK_PATH/MacOSX10.4u.sdk/usr/include" + +# Intel linker flags +LFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \ +-L$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1 \ +-Wl,-syslibroot,$SDK_PATH/MacOSX10.4u.sdk" + +# +# Find the configure script +# +srcdir=`dirname $0`/.. +auxdir=$srcdir/build-scripts +cd $srcdir + +# +# Figure out which phase to build: +# all, +# configure, configure-ppc, configure-x86, +# make, make-ppc, make-x86, merge +# install +# clean +if test x"$1" = x; then + phase=all +else + phase="$1" +fi +case $phase in + all) + configure_ppc="yes" + configure_x86="yes" + make_ppc="yes" + make_x86="yes" + merge="yes" + ;; + configure) + configure_ppc="yes" + configure_x86="yes" + ;; + configure-ppc) + configure_ppc="yes" + ;; + configure-x86) + configure_x86="yes" + ;; + make) + make_ppc="yes" + make_x86="yes" + merge="yes" + ;; + make-ppc) + make_ppc="yes" + ;; + make-x86) + make_x86="yes" + ;; + merge) + merge="yes" + ;; + install) + install_bin="yes" + install_hdrs="yes" + install_lib="yes" + install_data="yes" + install_man="yes" + ;; + install-bin) + install_bin="yes" + ;; + install-hdrs) + install_hdrs="yes" + ;; + install-lib) + install_lib="yes" + ;; + install-data) + install_data="yes" + ;; + install-man) + install_man="yes" + ;; + clean) + clean_ppc="yes" + clean_x86="yes" + ;; + clean-ppc) + clean_ppc="yes" + ;; + clean-x86) + clean_x86="yes" + ;; + *) + echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge|install|clean]" + exit 1 + ;; +esac +case `uname -p` in + powerpc) + native_path=ppc + ;; + *86) + native_path=x86 + ;; + *) + echo "Couldn't figure out native architecture path" + exit 1 + ;; +esac + +# +# Create the build directories +# +for dir in build build/ppc build/x86; do + if test -d $dir; then + : + else + mkdir $dir || exit 1 + fi +done + +# +# Build the PowerPC binary +# +if test x$configure_ppc = xyes; then + (cd build/ppc && \ + sh ../../configure $CONFIG_PPC CC="$CC_PPC" CXX="$CXX_PPC" CFLAGS="$CFLAGS $CFLAGS_PPC" CPPFLAGS="$CPPFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2 +fi +if test x$make_ppc = xyes; then + (cd build/ppc && ls include && make -j$NJOB) || exit 3 +fi + +# +# Build the Intel binary +# +if test x$configure_x86 = xyes; then + (cd build/x86 && \ + sh ../../configure $CONFIG_X86 CC="$CC_X86" CXX="$CXX_X86" CFLAGS="$CFLAGS $CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2 +fi +if test x$make_x86 = xyes; then + (cd build/x86 && make -j$NJOB) || exit 3 +fi + +# +# Combine into fat binary +# +if test x$merge = xyes; then + output=.libs + sh $auxdir/mkinstalldirs build/$output + cd build + target=`find . -mindepth 3 -type f -name '*.dylib' | head -1 | sed 's|.*/||'` + (lipo -create -o $output/$target `find . -mindepth 3 -type f -name "*.dylib"` && + ln -sf $target $output/libSDL-1.2.0.dylib && + ln -sf $target $output/libSDL.dylib && + lipo -create -o $output/libSDL.a */build/.libs/libSDL.a && + cp $native_path/build/.libs/libSDL.la $output && + cp $native_path/build/.libs/libSDL.lai $output && + cp $native_path/build/libSDL.la . && + lipo -create -o libSDLmain.a */build/libSDLmain.a && + echo "Build complete!" && + echo "Files can be found in the build directory.") || exit 4 + cd .. +fi + +# +# Install +# +do_install() +{ + echo $* + $* || exit 5 +} +if test x$prefix = x; then + prefix=/usr/local +fi +if test x$exec_prefix = x; then + exec_prefix=$prefix +fi +if test x$bindir = x; then + bindir=$exec_prefix/bin +fi +if test x$libdir = x; then + libdir=$exec_prefix/lib +fi +if test x$includedir = x; then + includedir=$prefix/include +fi +if test x$datadir = x; then + datadir=$prefix/share +fi +if test x$mandir = x; then + mandir=$prefix/man +fi +if test x$install_bin = xyes; then + do_install sh $auxdir/mkinstalldirs $bindir + do_install /usr/bin/install -c -m 755 build/$native_path/sdl-config $bindir/sdl-config +fi +if test x$install_hdrs = xyes; then + do_install sh $auxdir/mkinstalldirs $includedir/SDL + for src in $srcdir/include/*.h; do \ + file=`echo $src | sed -e 's|^.*/||'`; \ + do_install /usr/bin/install -c -m 644 $src $includedir/SDL/$file; \ + done + do_install /usr/bin/install -c -m 644 $srcdir/include/SDL_config_macosx.h $includedir/SDL/SDL_config.h +fi +if test x$install_lib = xyes; then + do_install sh $auxdir/mkinstalldirs $libdir + do_install sh build/$native_path/libtool --mode=install /usr/bin/install -c build/libSDL.la $libdir/libSDL.la + do_install /usr/bin/install -c -m 644 build/libSDLmain.a $libdir/libSDLmain.a + do_install ranlib $libdir/libSDLmain.a +fi +if test x$install_data = xyes; then + do_install sh $auxdir/mkinstalldirs $datadir/aclocal + do_install /usr/bin/install -c -m 644 $srcdir/sdl.m4 $datadir/aclocal/sdl.m4 +fi +if test x$install_man = xyes; then + do_install sh $auxdir/mkinstalldirs $mandir/man3 + for src in $srcdir/docs/man3/*.3; do \ + file=`echo $src | sed -e 's|^.*/||'`; \ + do_install /usr/bin/install -c -m 644 $src $mandir/man3/$file; \ + done +fi + +# +# Clean up +# +do_clean() +{ + echo $* + $* || exit 6 +} +if test x$clean_x86 = xyes; then + do_clean rm -r build/x86 +fi +if test x$clean_ppc = xyes; then + do_clean rm -r build/ppc +fi + diff --git a/SDL/build-scripts/install-sh b/SDL/build-scripts/install-sh new file mode 100644 index 0000000..e8c2704 --- /dev/null +++ b/SDL/build-scripts/install-sh @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2005-02-02.21 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/SDL/build-scripts/ltmain.sh b/SDL/build-scripts/ltmain.sh new file mode 100644 index 0000000..d700522 --- /dev/null +++ b/SDL/build-scripts/ltmain.sh @@ -0,0 +1,6864 @@ +# Based on libtool-1.5.22 +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=1.5.22 +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +duplicate_deps=no +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $mkdir "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || { + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 + exit $EXIT_FAILURE + } + fi + + $echo "X$my_tmpdir" | $Xsed +} + + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then + exit $exit_status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + +disable_libs=no + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2005 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $? + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $? + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + preserve_args="$preserve_args $arg" + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit $? + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) + prevopt="--tag" + prev=tag + preserve_args="$preserve_args --tag" + ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE +fi + +case $disable_libs in +no) + ;; +shared) + build_libtool_libs=no + build_old_libs=yes + ;; +static) + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` + ;; +esac + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qlibobj="\"$qlibobj\"" ;; + esac + test "X$libobj" != "X$qlibobj" \ + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$progpath" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + $echo "$srcfile" > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qsrcfile="\"$qsrcfile\"" ;; + esac + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + fi + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit $EXIT_FAILURE + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + darwin_framework|darwin_framework_skip) + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit $EXIT_FAILURE + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework|-arch|-isysroot) + case " $CC " in + *" ${arg} ${1} "* | *" ${arg} ${1} "*) + prev=darwin_framework_skip ;; + *) compiler_flags="$compiler_flags $arg" + prev=darwin_framework ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + notinst_path="$notinst_path $dir" + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -pg pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ + -t[45]*|-txscale*|@*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then + exit $exit_status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 + exit $EXIT_FAILURE + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit $EXIT_FAILURE + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $absdir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes ; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$extract_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$old_archive_from_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | + $EGREP ": [^:]* bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit $EXIT_FAILURE + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit $EXIT_FAILURE + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + major=`expr $current - $age + 1` + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$output_la-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadable object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit $EXIT_FAILURE + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + else + $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ +const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + else + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + esac + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + exit_status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $exit_status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + output_name=`basename $output` + output_path=`dirname $output` + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +/* -DDEBUG is fairly common in CFLAGS. */ +#undef DEBUG +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +const char * base_name (const char *name); +char * find_executable(const char *wrapper); +int check_executable(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = find_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't find %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; + + for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" + return 127; +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char)name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable(const char * path) +{ + struct stat st; + + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) && + ( + /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ +#if defined (S_IXOTH) + ((st.st_mode & S_IXOTH) == S_IXOTH) || +#endif +#if defined (S_IXGRP) + ((st.st_mode & S_IXGRP) == S_IXGRP) || +#endif + ((st.st_mode & S_IXUSR) == S_IXUSR)) + ) + return 1; + else + return 0; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +find_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit $EXIT_FAILURE + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit $EXIT_FAILURE + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE + fi +fi\ +" + chmod +x $output + fi + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$gentop"; then + exit $exit_status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + eval cmd=\"$cmd\" + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit $EXIT_SUCCESS + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) prev=$arg ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit $EXIT_FAILURE + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + cmds=$postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit $EXIT_FAILURE + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir=`func_mktempdir` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$old_striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + cmds=$old_postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + cmds=$finish_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit $EXIT_SUCCESS + + $echo "X----------------------------------------------------------------------" | $Xsed + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit $EXIT_FAILURE + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit $EXIT_SUCCESS + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + cmds=$postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + cmds=$old_postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit $EXIT_FAILURE +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to ." + exit $EXIT_SUCCESS + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit $? + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +disable_libs=shared +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +disable_libs=static +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/SDL/build-scripts/makedep.sh b/SDL/build-scripts/makedep.sh new file mode 100644 index 0000000..224f9c7 --- /dev/null +++ b/SDL/build-scripts/makedep.sh @@ -0,0 +1,93 @@ +#!/bin/sh +# +# Generate dependencies from a list of source files + +# Check to make sure our environment variables are set +if test x"$INCLUDE" = x -o x"$SOURCES" = x -o x"$output" = x; then + echo "SOURCES, INCLUDE, and output needs to be set" + exit 1 +fi +cache_prefix=".#$$" + +generate_var() +{ + echo $1 | sed -e 's|^.*/||' -e 's|\.|_|g' +} + +search_deps() +{ + base=`echo $1 | sed 's|/[^/]*$||'` + grep '#include "' <$1 | sed -e 's|.*"\([^"]*\)".*|\1|' | \ + while read file + do cache=${cache_prefix}_`generate_var $file` + if test -f $cache; then + : # We already ahve this cached + else + : >$cache + for path in $base `echo $INCLUDE | sed 's|-I||g'` + do dep="$path/$file" + if test -f "$dep"; then + echo " $dep \\" >>$cache + search_deps $dep >>$cache + break + fi + done + fi + cat $cache + done +} + +:>${output}.new +for src in $SOURCES +do echo "Generating dependencies for $src" + ext=`echo $src | sed 's|.*\.\(.*\)|\1|'` + if test x"$ext" = x"rc"; then + obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.o|g"` + else + obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.lo|g"` + fi + echo "\$(objects)/$obj: $src \\" >>${output}.new + search_deps $src | sort | uniq >>${output}.new + case $ext in + c) cat >>${output}.new <<__EOF__ + + \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@ + +__EOF__ + ;; + cc) cat >>${output}.new <<__EOF__ + + \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@ + +__EOF__ + ;; + m) cat >>${output}.new <<__EOF__ + + \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@ + +__EOF__ + ;; + asm) cat >>${output}.new <<__EOF__ + + \$(LIBTOOL) --tag=CC --mode=compile \$(auxdir)/strip_fPIC.sh \$(NASM) $src -o \$@ + +__EOF__ + ;; + S) cat >>${output}.new <<__EOF__ + + \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@ + +__EOF__ + ;; + rc) cat >>${output}.new <<__EOF__ + + \$(WINDRES) $src \$@ + +__EOF__ + ;; + *) echo "Unknown file extension: $ext";; + esac + echo "" >>${output}.new +done +mv ${output}.new ${output} +rm -f ${cache_prefix}* diff --git a/SDL/build-scripts/mkinstalldirs b/SDL/build-scripts/mkinstalldirs new file mode 100644 index 0000000..d3de166 --- /dev/null +++ b/SDL/build-scripts/mkinstalldirs @@ -0,0 +1,99 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) # -h for help + echo "${usage}" 1>&2; exit 0 ;; + -m ) # -m PERM arg + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + dirmode="${1}" + shift ;; + -- ) shift; break ;; # stop option processing + -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option + * ) break ;; # first non-opt arg + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in +0) exit 0 ;; +esac + +case $dirmode in +'') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi ;; +*) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 3 +# End: +# mkinstalldirs ends here diff --git a/SDL/build-scripts/strip_fPIC.sh b/SDL/build-scripts/strip_fPIC.sh new file mode 100644 index 0000000..fc5e15c --- /dev/null +++ b/SDL/build-scripts/strip_fPIC.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +# libtool assumes that the compiler can handle the -fPIC flag +# This isn't always true (for example, nasm can't handle it) +command="" +while [ $# -gt 0 ]; do + case "$1" in + -?PIC) + # Ignore -fPIC and -DPIC options + ;; + -fno-common) + # Ignore -fPIC and -DPIC options + ;; + *) + command="$command $1" + ;; + esac + shift +done +echo $command +exec $command diff --git a/SDL/configure.in b/SDL/configure.in new file mode 100644 index 0000000..9c42b2b --- /dev/null +++ b/SDL/configure.in @@ -0,0 +1,2835 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(README) +AC_CONFIG_HEADER(include/SDL_config.h) +AC_GNU_SOURCE + +dnl Set various version strings - taken gratefully from the GTk sources +# +# Making releases: +# Edit include/SDL/SDL_version.h and change the version, then: +# SDL_MICRO_VERSION += 1; +# SDL_INTERFACE_AGE += 1; +# SDL_BINARY_AGE += 1; +# if any functions have been added, set SDL_INTERFACE_AGE to 0. +# if backwards compatibility has been broken, +# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. +# +SDL_MAJOR_VERSION=1 +SDL_MINOR_VERSION=2 +SDL_MICRO_VERSION=13 +SDL_INTERFACE_AGE=2 +SDL_BINARY_AGE=13 +SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION + +AC_SUBST(SDL_MAJOR_VERSION) +AC_SUBST(SDL_MINOR_VERSION) +AC_SUBST(SDL_MICRO_VERSION) +AC_SUBST(SDL_INTERFACE_AGE) +AC_SUBST(SDL_BINARY_AGE) +AC_SUBST(SDL_VERSION) + +# libtool versioning +LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION +LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE` +LT_REVISION=$SDL_INTERFACE_AGE +LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE` + +AC_SUBST(LT_RELEASE) +AC_SUBST(LT_CURRENT) +AC_SUBST(LT_REVISION) +AC_SUBST(LT_AGE) + +dnl Detect the canonical build and host environments +AC_CONFIG_AUX_DIRS($srcdir/build-scripts) +AC_CANONICAL_HOST +AC_C_BIGENDIAN +if test x$ac_cv_c_bigendian = xyes; then + AC_DEFINE(SDL_BYTEORDER, 4321) +else + AC_DEFINE(SDL_BYTEORDER, 1234) +fi + +dnl Set up the compiler and linker flags +INCLUDE="-I$srcdir/include" +if test x$srcdir != x.; then + # Remove SDL_config.h from the source directory, since it's the + # default one, and we want to include the one that we generate. + if test -f $srcdir/include/SDL_config.h; then + rm $srcdir/include/SDL_config.h + fi + INCLUDE="-Iinclude $INCLUDE" +fi +case "$host" in + *-*-cygwin*) + # We build SDL on cygwin without the UNIX emulation layer + BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin" + BASE_LDFLAGS="-mno-cygwin" + ;; + *) + BASE_CFLAGS="-D_GNU_SOURCE=1" + BASE_LDFLAGS="" + ;; +esac +BUILD_CFLAGS="$CFLAGS $CPPFLAGS" +EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS" +BUILD_LDFLAGS="$LDFLAGS" +EXTRA_LDFLAGS="$BASE_LDFLAGS" +## These are common directories to find software packages +#for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do +# if test -d $path/include; then +# EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include" +# fi +# if test -d $path/lib; then +# EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib" +# fi +#done +SDL_CFLAGS="$BASE_CFLAGS" +SDL_LIBS="-lSDL $BASE_LDFLAGS" +CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS" +CFLAGS="$CFLAGS $EXTRA_CFLAGS" +LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" + +dnl Check for tools +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL +AC_PROG_CC +AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_MAKE_SET +if test -z "$host_alias"; then + hostaliaswindres= +else + hostaliaswindres="$host_alias-windres" +fi +AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres]) + +dnl Check for compiler characteristics +AC_C_CONST +AC_C_INLINE +AC_C_VOLATILE + +dnl See whether we are allowed to use the system C library +AC_ARG_ENABLE(libc, +AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]), + , enable_libc=yes) +if test x$enable_libc = xyes; then + AC_DEFINE(HAVE_LIBC) + + dnl Check for C library headers + AC_HEADER_STDC + AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h) + + dnl Check for typedefs, structures, etc. + AC_TYPE_SIZE_T + if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then + AC_CHECK_TYPE(int64_t) + if test x$ac_cv_type_int64_t = xyes; then + AC_DEFINE(SDL_HAS_64BIT_TYPE) + fi + have_inttypes=yes + fi + + dnl Checks for library functions. + case "$host" in + *-*-cygwin* | *-*-mingw32*) + ;; + *) + AC_FUNC_ALLOCA + ;; + esac + + AC_FUNC_MEMCMP + if test x$ac_cv_func_memcmp_working = xyes; then + AC_DEFINE(HAVE_MEMCMP) + fi + AC_FUNC_STRTOD + if test x$ac_cv_func_strtod = xyes; then + AC_DEFINE(HAVE_STRTOD) + fi + AC_CHECK_FUNC(mprotect, + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + AC_DEFINE(HAVE_MPROTECT) + ]), + ) + AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf iconv sigaction setjmp nanosleep) + + AC_CHECK_LIB(iconv, libiconv_open, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) + AC_CHECK_LIB(m, pow, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) +fi + +if test x$have_inttypes != xyes; then + AC_CHECK_SIZEOF(char, 1) + AC_CHECK_SIZEOF(short, 2) + AC_CHECK_SIZEOF(int, 4) + AC_CHECK_SIZEOF(long, 4) + AC_CHECK_SIZEOF(long long, 8) + if test x$ac_cv_sizeof_char = x1; then + AC_DEFINE(int8_t, signed char) + AC_DEFINE(uint8_t, unsigned char) + fi + if test x$ac_cv_sizeof_short = x2; then + AC_DEFINE(int16_t, signed short) + AC_DEFINE(uint16_t, unsigned short) + else + if test x$ac_cv_sizeof_int = x2; then + AC_DEFINE(int16_t, signed int) + AC_DEFINE(uint16_t, unsigned int) + fi + fi + if test x$ac_cv_sizeof_int = x4; then + AC_DEFINE(int32_t, signed int) + AC_DEFINE(uint32_t, unsigned int) + else + if test x$ac_cv_sizeof_long = x4; then + AC_DEFINE(int32_t, signed long) + AC_DEFINE(uint32_t, unsigned long) + fi + fi + if test x$ac_cv_sizeof_long = x8; then + AC_DEFINE(int64_t, signed long) + AC_DEFINE(uint64_t, unsigned long) + AC_DEFINE(SDL_HAS_64BIT_TYPE) + else + if test x$ac_cv_sizeof_long_long = x8; then + AC_DEFINE(int64_t, signed long long) + AC_DEFINE(uint64_t, unsigned long long) + AC_DEFINE(SDL_HAS_64BIT_TYPE) + fi + fi + AC_DEFINE(size_t, unsigned int) + AC_DEFINE(uintptr_t, unsigned long) +fi + +# Standard C sources +SOURCES="$SOURCES $srcdir/src/*.c" +SOURCES="$SOURCES $srcdir/src/audio/*.c" +SOURCES="$SOURCES $srcdir/src/cdrom/*.c" +SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c" +SOURCES="$SOURCES $srcdir/src/events/*.c" +SOURCES="$SOURCES $srcdir/src/file/*.c" +SOURCES="$SOURCES $srcdir/src/stdlib/*.c" +SOURCES="$SOURCES $srcdir/src/thread/*.c" +SOURCES="$SOURCES $srcdir/src/timer/*.c" +SOURCES="$SOURCES $srcdir/src/video/*.c" + +dnl Enable/disable various subsystems of the SDL library + +AC_ARG_ENABLE(audio, +AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]), + , enable_audio=yes) +if test x$enable_audio != xyes; then + AC_DEFINE(SDL_AUDIO_DISABLED) +fi +AC_ARG_ENABLE(video, +AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]), + , enable_video=yes) +if test x$enable_video != xyes; then + AC_DEFINE(SDL_VIDEO_DISABLED) +fi +AC_ARG_ENABLE(events, +AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]), + , enable_events=yes) +if test x$enable_events != xyes; then + AC_DEFINE(SDL_EVENTS_DISABLED) +fi +AC_ARG_ENABLE(joystick, +AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]), + , enable_joystick=yes) +if test x$enable_joystick != xyes; then + AC_DEFINE(SDL_JOYSTICK_DISABLED) +else + SOURCES="$SOURCES $srcdir/src/joystick/*.c" +fi +AC_ARG_ENABLE(cdrom, +AC_HELP_STRING([--enable-cdrom], [Enable the cdrom subsystem [[default=yes]]]), + , enable_cdrom=yes) +if test x$enable_cdrom != xyes; then + AC_DEFINE(SDL_CDROM_DISABLED) +fi +AC_ARG_ENABLE(threads, +AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]), + , enable_threads=yes) +if test x$enable_threads != xyes; then + AC_DEFINE(SDL_THREADS_DISABLED) +fi +AC_ARG_ENABLE(timers, +AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]), + , enable_timers=yes) +if test x$enable_timers != xyes; then + AC_DEFINE(SDL_TIMERS_DISABLED) +fi +AC_ARG_ENABLE(file, +AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]), + , enable_file=yes) +if test x$enable_file != xyes; then + AC_DEFINE(SDL_FILE_DISABLED) +fi +AC_ARG_ENABLE(loadso, +AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]), + , enable_loadso=yes) +if test x$enable_loadso != xyes; then + AC_DEFINE(SDL_LOADSO_DISABLED) +fi +AC_ARG_ENABLE(cpuinfo, +AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]), + , enable_cpuinfo=yes) +if test x$enable_cpuinfo != xyes; then + AC_DEFINE(SDL_CPUINFO_DISABLED) +fi +AC_ARG_ENABLE(assembly, +AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]), + , enable_assembly=yes) +if test x$enable_assembly = xyes; then + AC_DEFINE(SDL_ASSEMBLY_ROUTINES) +fi + +dnl See if the OSS audio interface is supported +CheckOSS() +{ + AC_ARG_ENABLE(oss, +AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]), + , enable_oss=yes) + if test x$enable_audio = xyes -a x$enable_oss = xyes; then + AC_MSG_CHECKING(for OSS audio support) + have_oss=no + if test x$have_oss != xyes; then + AC_TRY_COMPILE([ + #include + ],[ + int arg = SNDCTL_DSP_SETFRAGMENT; + ],[ + have_oss=yes + ]) + fi + if test x$have_oss != xyes; then + AC_TRY_COMPILE([ + #include + ],[ + int arg = SNDCTL_DSP_SETFRAGMENT; + ],[ + have_oss=yes + AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H) + ]) + fi + AC_MSG_RESULT($have_oss) + if test x$have_oss = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_OSS) + SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c" + SOURCES="$SOURCES $srcdir/src/audio/dma/*.c" + have_audio=yes + + # We may need to link with ossaudio emulation library + case "$host" in + *-*-openbsd*|*-*-netbsd*) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";; + esac + fi + fi +} + +dnl See if the ALSA audio interface is supported +CheckALSA() +{ + AC_ARG_ENABLE(alsa, +AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]), + , enable_alsa=yes) + if test x$enable_audio = xyes -a x$enable_alsa = xyes; then + AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no) + # Restore all flags from before the ALSA detection runs + CFLAGS="$alsa_save_CFLAGS" + LDFLAGS="$alsa_save_LDFLAGS" + LIBS="$alsa_save_LIBS" + if test x$have_alsa = xyes; then + AC_ARG_ENABLE(alsa-shared, +AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]), + , enable_alsa_shared=yes) + if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then + if test "x`ls /lib/libasound.so.* 2> /dev/null`" != "x"; then + ALSA_LIBS="-L/lib $ALSA_LIBS" + elif test "x`ls /usr/lib/libasound.so.* 2> /dev/null`" != "x"; then + ALSA_LIBS="-L/usr/lib $ALSA_LIBS" + elif test "x`ls /usr/local/lib/libasound.so.* 2> /dev/null`" != "x"; then + ALSA_LIBS="-L/usr/local/lib $ALSA_LIBS" + fi + fi + alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'` + alsa_lib=`ls -- $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'` + echo "-- $alsa_lib_spec -> $alsa_lib" + + AC_DEFINE(SDL_AUDIO_DRIVER_ALSA) + SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_alsa_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib") + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS" + fi + have_audio=yes + fi + fi +} + +dnl Check whether we want to use IRIX 6.5+ native audio or not +CheckDMEDIA() +{ + if test x$enable_audio = xyes; then + AC_MSG_CHECKING(for dmedia audio support) + have_dmedia=no + AC_TRY_COMPILE([ + #include + ],[ + ALport audio_port; + ],[ + have_dmedia=yes + ]) + AC_MSG_RESULT($have_dmedia) + # Set up files for the audio library + if test x$have_dmedia = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA) + SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio" + have_audio=yes + fi + fi +} + +dnl Check whether we want to use Tru64 UNIX native audio or not +CheckMME() +{ + dnl Make sure we are running on an Tru64 UNIX + case $ARCH in + osf) + ;; + *) + return + ;; + esac + if test x$enable_audio = xyes; then + AC_MSG_CHECKING(for MME audio support) + MME_CFLAGS="-I/usr/include/mme" + MME_LIBS="-lmme" + have_mme=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $MME_CFLAGS" + AC_TRY_COMPILE([ + #include + ],[ + HWAVEOUT sound; + ],[ + have_mme=yes + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT($have_mme) + # Set up files for the audio library + if test x$have_mme = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO) + SOURCES="$SOURCES $srcdir/src/audio/mme/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $MME_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MME_LIBS" + have_audio=yes + fi + fi +} + +dnl Find the ESD includes and libraries +CheckESD() +{ + AC_ARG_ENABLE(esd, +AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]), + , enable_esd=yes) + if test x$enable_audio = xyes -a x$enable_esd = xyes; then + AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no) + if test x$have_esd = xyes; then + AC_ARG_ENABLE(esd-shared, +AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]), + , enable_esd_shared=yes) + esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'` + esd_lib=`ls -- $esd_lib_spec | sed 's/.*\/\(.*\)/\1/; q'` + echo "-- $esd_lib_spec -> $esd_lib" + + AC_DEFINE(SDL_AUDIO_DRIVER_ESD) + SOURCES="$SOURCES $srcdir/src/audio/esd/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_esd_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_esd_shared = xyes && test x$esd_lib != x; then + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib") + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS" + fi + have_audio=yes + fi + fi +} + +dnl Find PulseAudio +CheckPulseAudio() +{ + AC_ARG_ENABLE(pulseaudio, +AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]), + , enable_pulse=yes) + if test x$enable_audio = xyes -a x$enable_pulse = xyes; then + audio_pulse=no + + PULSE_REQUIRED_VERSION=0.9 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for PulseAudio $PULSE_REQUIRED_VERSION support) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSE_REQUIRED_VERSION libpulse-simple; then + PULSE_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple` + PULSE_LIBS=`$PKG_CONFIG --libs libpulse-simple` + audio_pulse=yes + fi + fi + AC_MSG_RESULT($audio_pulse) + + if test x$audio_pulse = xyes; then + AC_ARG_ENABLE(pulseaudio-shared, +AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]), + , enable_pulse_shared=yes) + if test "x`echo $PULSE_LIBS | grep -- -L`" = "x"; then + if test "x`ls /lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then + PULSE_LIBS="-L/lib $PULSE_LIBS" + elif test "x`ls /usr/lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then + PULSE_LIBS="-L/usr/lib $PULSE_LIBS" + elif test "x`ls /usr/local/lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then + PULSE_LIBS="-L/usr/local/lib $PULSE_LIBS" + fi + fi + pulse_lib_spec=`echo $PULSE_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libpulse-simple.so.*/'` + pulse_lib=`ls -- $pulse_lib_spec | sed 's/.*\/\(.*\)/\1/; q'` + echo "-- $pulse_lib_spec -> $pulse_lib" + + AC_DEFINE(SDL_AUDIO_DRIVER_PULSE) + SOURCES="$SOURCES $srcdir/src/audio/pulse/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSE_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_pulse_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_pulse_shared = xyes && test x$pulse_lib != x; then + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSE_DYNAMIC, "$pulse_lib") + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSE_LIBS" + fi + have_audio=yes + fi + fi +} + +CheckARTSC() +{ + AC_ARG_ENABLE(arts, +AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]), + , enable_arts=yes) + if test x$enable_audio = xyes -a x$enable_arts = xyes; then + AC_PATH_PROG(ARTSCONFIG, artsc-config) + if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then + : # arts isn't installed + else + ARTS_CFLAGS=`$ARTSCONFIG --cflags` + ARTS_LIBS=`$ARTSCONFIG --libs` + ARTS_PREFIX=`$ARTSCONFIG --arts-prefix` + AC_MSG_CHECKING(for aRts development environment) + audio_arts=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $ARTS_CFLAGS" + AC_TRY_COMPILE([ + #include + ],[ + arts_stream_t stream; + ],[ + audio_arts=yes + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT($audio_arts) + if test x$audio_arts = xyes; then + AC_ARG_ENABLE(arts-shared, +AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]), + , enable_arts_shared=yes) + arts_lib_spec="$ARTS_PREFIX/lib/libartsc.so.*" + arts_lib=`ls -- $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'` + echo "-- $arts_lib_spec -> $arts_lib" + + AC_DEFINE(SDL_AUDIO_DRIVER_ARTS) + SOURCES="$SOURCES $srcdir/src/audio/arts/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_arts_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_arts_shared = xyes && test x$arts_lib != x; then + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib") + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS" + fi + have_audio=yes + fi + fi + fi +} + +dnl See if the NAS audio interface is supported +CheckNAS() +{ + AC_ARG_ENABLE(nas, +AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]), + , enable_nas=yes) + if test x$enable_audio = xyes -a x$enable_nas = xyes; then + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -lXt -lm" + AC_CHECK_HEADER(audio/audiolib.h, have_audio_hdr=yes) + AC_CHECK_LIB(audio, AuOpenServer, have_audio_lib=yes) + AC_CHECK_HEADER(nas/audiolib.h, have_nas_hdr=yes) + AC_CHECK_LIB(nas, AuOpenServer, have_nas_lib=yes) + LDFLAGS="$save_LDFLAGS" + + AC_MSG_CHECKING(for NAS audio support) + have_nas=no + if test x$have_audio_hdr = xyes -a x$have_audio_lib = xyes; then + have_nas=yes + NAS_LIBS="-laudio -lXt" + elif test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then + have_nas=yes + NAS_LIBS="-lnas -lXt" + fi + AC_MSG_RESULT($have_nas) + + if test x$have_nas = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_NAS) + SOURCES="$SOURCES $srcdir/src/audio/nas/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS" + have_audio=yes + fi + fi +} + +dnl rcg07142001 See if the user wants the disk writer audio driver... +CheckDiskAudio() +{ + AC_ARG_ENABLE(diskaudio, +AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]), + , enable_diskaudio=yes) + if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_DISK) + SOURCES="$SOURCES $srcdir/src/audio/disk/*.c" + fi +} + +dnl rcg03142006 See if the user wants the dummy audio driver... +CheckDummyAudio() +{ + AC_ARG_ENABLE(dummyaudio, +AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]), + , enable_dummyaudio=yes) + if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY) + SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" + fi +} + +dnl Set up the Atari Audio driver +CheckAtariAudio() +{ + AC_ARG_ENABLE(mintaudio, +AC_HELP_STRING([--enable-mintaudio], [support Atari audio driver [[default=yes]]]), + , enable_mintaudio=yes) + if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then + mintaudio=no + AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes) + if test x$have_mint_falcon_hdr = xyes; then + mintaudio=yes + AC_DEFINE(SDL_AUDIO_DRIVER_MINT) + SOURCES="$SOURCES $srcdir/src/audio/mint/*.c" + SOURCES="$SOURCES $srcdir/src/audio/mint/*.S" + have_audio=yes + fi + fi +} + +dnl See if we can use x86 assembly blitters +# NASM is available from: http://nasm.sourceforge.net +CheckNASM() +{ + dnl Make sure we are running on an x86 platform + case $host in + i?86*) + ;; + *) + # Nope, bail early. + return + ;; + esac + dnl Check for NASM (for assembly blit routines) + AC_ARG_ENABLE(nasm, +AC_HELP_STRING([--enable-nasm], [use nasm assembly blitters on x86 [[default=yes]]]), + , enable_nasm=yes) + if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_nasm = xyes; then + CompileNASM() + { + # Usage: CompileNASM + AC_MSG_CHECKING(to see if $NASM supports $1) + if $NASM $NASMFLAGS $1 -o $1.o >&AS_MESSAGE_LOG_FD 2>&1; then + CompileNASM_ret="yes" + else + CompileNASM_ret="no" + fi + rm -f $1 $1.o + AC_MSG_RESULT($CompileNASM_ret) + test "$CompileNASM_ret" = "yes" + } + + if test x"$NASMFLAGS" = x; then + case $ARCH in + win32) + NASMFLAGS="-f win32" + ;; + openbsd) + NASMFLAGS="-f aoutb" + ;; + macosx) + NASMFLAGS="-f macho" + ;; + *) + NASMFLAGS="-f elf" + ;; + esac + fi + + AC_PATH_PROG(NASM, yasm) + echo "%ifidn __OUTPUT_FORMAT__,elf" > unquoted-sections + echo "section .note.GNU-stack noalloc noexec nowrite progbits" >> unquoted-sections + echo "%endif" >> unquoted-sections + CompileNASM unquoted-sections || NASM="" + + if test "x$NASM" = x -o "x$NASM" = x'"$NASM"'; then + $as_unset ac_cv_path_NASM + AC_PATH_PROG(NASM, nasm) + fi + if test "x$NASM" != x -a "x$NASM" != x'"$NASM"'; then + AC_DEFINE(SDL_HERMES_BLITTERS) + SOURCES="$SOURCES $srcdir/src/hermes/*.asm" + NASMFLAGS="$NASMFLAGS -I $srcdir/src/hermes/" + + dnl See if hidden visibility is supported + echo "GLOBAL _bar:function hidden" > symbol-visibility + echo "_bar:" >> symbol-visibility + CompileNASM symbol-visibility && NASMFLAGS="$NASMFLAGS -DHIDDEN_VISIBILITY" + + AC_SUBST(NASM) + AC_SUBST(NASMFLAGS) + + case "$host" in + # this line is needed for QNX, because it's not defined the __ELF__ + *-*-qnx*) + EXTRA_CFLAGS="$EXTRA_CFLAGS -D__ELF__";; + *-*-solaris*) + EXTRA_CFLAGS="$EXTRA_CFLAGS -D__ELF__";; + esac + fi + fi +} + +dnl Check for altivec instruction support using gas syntax +CheckAltivec() +{ + AC_ARG_ENABLE(altivec, +AC_HELP_STRING([--enable-altivec], [use altivec assembly blitters on PPC [[default=yes]]]), + , enable_altivec=yes) + if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_altivec = xyes; then + have_altivec_h_hdr=no + AC_CHECK_HEADER(altivec.h, have_altivec_h_hdr=yes) + + save_CFLAGS="$CFLAGS" + have_gcc_altivec=no + AC_MSG_CHECKING(for Altivec with GCC -maltivec option) + altivec_CFLAGS="-maltivec" + CFLAGS="$save_CFLAGS $altivec_CFLAGS" + + if test x$have_altivec_h_hdr = xyes; then + AC_TRY_COMPILE([ + #include + vector unsigned int vzero() { + return vec_splat_u32(0); + } + ],[ + ],[ + have_gcc_altivec=yes + ]) + AC_MSG_RESULT($have_gcc_altivec) + else + AC_TRY_COMPILE([ + vector unsigned int vzero() { + return vec_splat_u32(0); + } + ],[ + ],[ + have_gcc_altivec=yes + ]) + AC_MSG_RESULT($have_gcc_altivec) + fi + + if test x$have_gcc_altivec = xno; then + AC_MSG_CHECKING(for Altivec with GCC -faltivec option) + altivec_CFLAGS="-faltivec" + CFLAGS="$save_CFLAGS $altivec_CFLAGS" + if test x$have_altivec_h_hdr = xyes; then + AC_TRY_COMPILE([ + #include + vector unsigned int vzero() { + return vec_splat_u32(0); + } + ],[ + ],[ + have_gcc_altivec=yes + ]) + AC_MSG_RESULT($have_gcc_altivec) + else + AC_TRY_COMPILE([ + vector unsigned int vzero() { + return vec_splat_u32(0); + } + ],[ + ],[ + have_gcc_altivec=yes + ]) + AC_MSG_RESULT($have_gcc_altivec) + fi + fi + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_altivec = xyes; then + AC_DEFINE(SDL_ALTIVEC_BLITTERS) + if test x$have_altivec_h_hdr = xyes; then + AC_DEFINE(HAVE_ALTIVEC_H) + fi + EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS" + fi + fi +} + +dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually). +dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility +CheckVisibilityHidden() +{ + AC_MSG_CHECKING(for GCC -fvisibility=hidden option) + have_gcc_fvisibility=no + + visibility_CFLAGS="-fvisibility=hidden" + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror" + AC_TRY_COMPILE([ + #if !defined(__GNUC__) || __GNUC__ < 4 + #error SDL only uses visibility attributes in GCC 4 or newer + #endif + ],[ + ],[ + have_gcc_fvisibility=yes + ]) + AC_MSG_RESULT($have_gcc_fvisibility) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_fvisibility = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS" + fi +} + + +dnl Do the iPod thing +CheckIPod() +{ + AC_ARG_ENABLE(ipod, +AC_HELP_STRING([--enable-ipod], [configure SDL to work with iPodLinux [default=yes on arm-elf]]), + , enable_ipod=yes) + + if test x$enable_ipod = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DIPOD" + AC_DEFINE(SDL_VIDEO_DRIVER_IPOD) + SOURCES="$SOURCES $srcdir/src/video/ipod/*.c" + fi +} + +dnl Find the nanox include and library directories +CheckNANOX() +{ + AC_ARG_ENABLE(video-nanox, + AC_HELP_STRING([--enable-video-nanox], [use nanox video driver [[default=no]]]), + , enable_video_nanox=no) + + if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then + AC_ARG_ENABLE(nanox-debug, + AC_HELP_STRING([--enable-nanox-debug], [print debug messages [[default=no]]]), + , enable_nanox_debug=no) + if test x$enable_nanox_debug = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DEBUG" + fi + + AC_ARG_ENABLE(nanox-share-memory, + AC_HELP_STRING([--enable-nanox-share-memory], [use share memory [[default=no]]]), + , enable_nanox_share_memory=no) + if test x$enable_nanox_share_memory = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DNANOX_SHARE_MEMORY" + fi + + AC_ARG_ENABLE(nanox_direct_fb, + AC_HELP_STRING([--enable-nanox-direct-fb], [use direct framebuffer access [[default=no]]]), + , enable_nanox_direct_fb=no) + if test x$enable_nanox_direct_fb = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DIRECT_FB" + fi + + AC_DEFINE(SDL_VIDEO_DRIVER_NANOX) + SOURCES="$SOURCES $srcdir/src/video/nanox/*.c" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lnano-X" + have_video=yes + fi +} + +dnl Find the X11 include and library directories +CheckX11() +{ + AC_ARG_ENABLE(video-x11, +AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]), + , enable_video_x11=yes) + if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then + case "$host" in + *-*-darwin*) + # This isn't necessary for X11, but fixes GLX detection + if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then + x_includes="/usr/X11R6/include" + x_libraries="/usr/X11R6/lib" + fi + ;; + esac + AC_PATH_X + AC_PATH_XTRA + if test x$have_x = xyes; then + # Only allow dynamically loaded X11 if the X11 function pointers + # will not end up in the global namespace, which causes problems + # with other libraries calling X11 functions. + x11_symbols_private=$have_gcc_fvisibility + + AC_ARG_ENABLE(x11-shared, +AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]), + , enable_x11_shared=maybe) + + case "$host" in + *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs... + x11_symbols_private=yes + x11_lib='/usr/X11R6/lib/libX11.6.dylib' + x11ext_lib='/usr/X11R6/lib/libXext.6.dylib' + xrender_lib='/usr/X11R6/lib/libXrender.1.dylib' + xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib' + ;; + *-*-osf*) + x11_lib='libX11.so' + x11ext_lib='libXext.so' + ;; + *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32 + x11_lib='libX11.so' + x11ext_lib='libXext.so' + ;; + *) + x11_lib_path=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1/'`] + for path in $x11_lib_path /usr/lib /usr/X11/lib /usr/X11R6/lib; do + if test "x$x11_lib" = "x"; then + x11_lib=[`ls -- $path/libX11.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] + if test "x$x11_lib" = "x"; then + x11_lib=[`ls -- $path/libX11.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] + fi + fi + if test "x$x11ext_lib" = "x"; then + x11ext_lib=[`ls -- $path/libXext.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] + if test "x$x11ext_lib" = "x"; then + x11ext_lib=[`ls -- $path/libXext.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] + fi + fi + if test "x$xrender_lib" = "x"; then + xrender_lib=[`ls -- $path/libXrender.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] + if test "x$xrender_lib" = "x"; then + xrender_lib=[`ls -- $path/libXrender.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] + fi + fi + if test "x$xrandr_lib" = "x"; then + xrandr_lib=[`ls -- $path/libXrandr.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] + if test "x$xrandr_lib" = "x"; then + xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] + fi + fi + done + ;; + esac + + X_CFLAGS="$X_CFLAGS -DXTHREADS" + if test x$ac_cv_func_shmat != xyes; then + X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY" + fi + CFLAGS="$CFLAGS $X_CFLAGS" + LDFLAGS="$LDFLAGS $X_LIBS" + + AC_DEFINE(SDL_VIDEO_DRIVER_X11) + SOURCES="$SOURCES $srcdir/src/video/x11/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS" + + if test x$enable_x11_shared = xmaybe; then + enable_x11_shared=$x11_symbols_private + fi + if test x$have_loadso != xyes && \ + test x$enable_x11_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading]) + enable_x11_shared=no + fi + if test x$x11_symbols_private != xyes && \ + test x$enable_x11_shared = xyes; then + AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading]) + enable_x11_shared=no + fi + + if test x$have_loadso = xyes && \ + test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then + echo "-- dynamic libX11 -> $x11_lib" + echo "-- dynamic libX11ext -> $x11ext_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib") + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib") + else + enable_x11_shared=no + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext" + fi + have_video=yes + + AC_ARG_ENABLE(dga, +AC_HELP_STRING([--enable-dga], [allow use of X11 DGA code [[default=yes]]]), + , enable_dga=yes) + if test x$enable_dga = xyes; then + SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86dga/*.c" + fi + AC_ARG_ENABLE(video-dga, +AC_HELP_STRING([--enable-video-dga], [use DGA 2.0 video driver [[default=yes]]]), + , enable_video_dga=yes) + if test x$enable_dga = xyes -a x$enable_video_dga = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_DGA) + SOURCES="$SOURCES $srcdir/src/video/dga/*.c" + fi + AC_ARG_ENABLE(video-x11-dgamouse, +AC_HELP_STRING([--enable-video-x11-dgamouse], [use X11 DGA for mouse events [[default=yes]]]), + , enable_video_x11_dgamouse=yes) + if test x$enable_dga = xyes -a x$enable_video_x11_dgamouse = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_DGAMOUSE) + fi + AC_ARG_ENABLE(video-x11-vm, +AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]), + , enable_video_x11_vm=yes) + if test x$enable_video_x11_vm = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE) + SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c" + fi + AC_ARG_ENABLE(video-x11-xv, +AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]), + , enable_video_x11_xv=yes) + if test x$enable_video_x11_xv = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV) + SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c" + fi + AC_ARG_ENABLE(video-x11-xinerama, +AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]), + , enable_video_x11_xinerama=yes) + if test x$enable_video_x11_xinerama = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA) + SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c" + fi + AC_ARG_ENABLE(video-x11-xme, +AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [[default=yes]]]), + , enable_video_x11_xme=yes) + if test x$enable_video_x11_xme = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME) + SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c" + fi + AC_ARG_ENABLE(video-x11-xrandr, +AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]), + , enable_video_x11_xrandr=yes) + if test x$enable_video_x11_xrandr = xyes; then + definitely_enable_video_x11_xrandr=no + AC_CHECK_HEADER(X11/extensions/Xrandr.h, + have_xrandr_h_hdr=yes, + have_xrandr_h_hdr=no, + [#include + ]) + if test x$have_xrandr_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then + echo "-- dynamic libXrender -> $xrender_lib" + echo "-- dynamic libXrandr -> $xrandr_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib") + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib") + definitely_enable_video_x11_xrandr=yes + else + AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes) + AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes) + if test x$have_xrender_lib = xyes && test x$have_xrandr_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr -lXrender" + definitely_enable_video_x11_xrandr=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_xrandr = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR) + fi + fi + fi +} + +dnl Check for QNX photon video driver +CheckPHOTON() +{ + AC_ARG_ENABLE(video-photon, +AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [[default=yes]]]), + , enable_video_photon=yes) + if test x$enable_video = xyes -a x$enable_video_photon = xyes; then + AC_MSG_CHECKING(for QNX Photon support) + video_photon=no + AC_TRY_COMPILE([ + #include + #include + #include + #include + ],[ + PgDisplaySettings_t *visual; + ],[ + video_photon=yes + ]) + AC_MSG_RESULT($video_photon) + if test x$video_photon = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON) + SOURCES="$SOURCES $srcdir/src/video/photon/*.c" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph" + have_video=yes + + CheckOpenGLQNX + fi + fi +} + +dnl Set up the BWindow video driver if enabled +CheckBWINDOW() +{ + if test x$enable_video = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW) + SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc" + have_video=yes + fi +} + +dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin) +CheckCARBON() +{ + AC_ARG_ENABLE(video-carbon, +AC_HELP_STRING([--enable-video-carbon], [use Carbon/QuickDraw video driver [[default=no]]]), + , enable_video_carbon=no) + if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then + AC_MSG_CHECKING(for Carbon framework) + have_carbon=no + AC_TRY_COMPILE([ + #include + ],[ + ],[ + have_carbon=yes + ]) + AC_MSG_RESULT($have_carbon) + if test x$have_carbon = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_TOOLBOX) + SOURCES="$SOURCES $srcdir/src/video/maccommon/*.c" + SOURCES="$SOURCES $srcdir/src/video/macrom/*.c" + have_video=yes + fi + fi +} + +dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin) +CheckCOCOA() +{ + AC_ARG_ENABLE(video-cocoa, +AC_HELP_STRING([--enable-video-cocoa], [use Cocoa/Quartz video driver [[default=yes]]]), + , enable_video_cocoa=yes) + if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then + save_CFLAGS="$CFLAGS" + dnl work around that we don't have Objective-C support in autoconf + CFLAGS="$CFLAGS -x objective-c" + AC_MSG_CHECKING(for Cocoa framework) + have_cocoa=no + AC_TRY_COMPILE([ + #import + ],[ + ],[ + have_cocoa=yes + ]) + AC_MSG_RESULT($have_cocoa) + CFLAGS="$save_CFLAGS" + if test x$have_cocoa = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_QUARTZ) + SOURCES="$SOURCES $srcdir/src/video/quartz/*.m" + have_video=yes + fi + fi +} + +dnl Find the framebuffer console includes +CheckFBCON() +{ + AC_ARG_ENABLE(video-fbcon, +AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=yes]]]), + , enable_video_fbcon=yes) + if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then + AC_MSG_CHECKING(for framebuffer console support) + video_fbcon=no + AC_TRY_COMPILE([ + #include + #include + #include + ],[ + ],[ + video_fbcon=yes + ]) + AC_MSG_RESULT($video_fbcon) + if test x$video_fbcon = xyes; then + AC_CHECK_FUNCS(getpagesize) + AC_DEFINE(SDL_VIDEO_DRIVER_FBCON) + SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c" + have_video=yes + fi + fi +} + +dnl Find DirectFB +CheckDirectFB() +{ + AC_ARG_ENABLE(video-directfb, +AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=yes]]]), + , enable_video_directfb=yes) + if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then + video_directfb=no + + DIRECTFB_REQUIRED_VERSION=0.9.15 + + AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no) + if test x$DIRECTFBCONFIG = xno; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then + DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb` + DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb` + video_directfb=yes + fi + fi + AC_MSG_RESULT($video_directfb) + else + AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support) + set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'` + NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` + set -- `directfb-config --version | sed 's/\./ /g'` + HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` + if test $HAVE_VERSION -ge $NEED_VERSION; then + DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags` + DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs` + video_directfb=yes + fi + AC_MSG_RESULT($video_directfb) + fi + + if test x$video_directfb = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB) + SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS" + have_video=yes + fi + fi +} + +dnl See if we're running on PlayStation 2 hardware +CheckPS2GS() +{ + AC_ARG_ENABLE(video-ps2gs, +AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [[default=yes]]]), + , enable_video_ps2gs=yes) + if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then + AC_MSG_CHECKING(for PlayStation 2 GS support) + video_ps2gs=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + video_ps2gs=yes + ]) + AC_MSG_RESULT($video_ps2gs) + if test x$video_ps2gs = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS) + SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c" + have_video=yes + fi + fi +} + +dnl Find the GGI includes +CheckGGI() +{ + AC_ARG_ENABLE(video-ggi, +AC_HELP_STRING([--enable-video-ggi], [use GGI video driver [[default=no]]]), + , enable_video_ggi=no) + if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then + AC_MSG_CHECKING(for GGI support) + video_ggi=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + video_ggi=yes + ]) + AC_MSG_RESULT($video_ggi) + if test x$video_ggi = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_GGI) + SOURCES="$SOURCES $srcdir/src/video/ggi/*.c" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lggi -lgii -lgg" + have_video=yes + fi + fi +} + +dnl Find the SVGAlib includes and libraries +CheckSVGA() +{ + AC_ARG_ENABLE(video-svga, +AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=yes]]]), + , enable_video_svga=yes) + if test x$enable_video = xyes -a x$enable_video_svga = xyes; then + AC_MSG_CHECKING(for SVGAlib (1.4.0+) support) + video_svga=no + AC_TRY_COMPILE([ + #include + #include + #include + ],[ + if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) { + exit(0); + } + ],[ + video_svga=yes + ]) + AC_MSG_RESULT($video_svga) + if test x$video_svga = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB) + SOURCES="$SOURCES $srcdir/src/video/svga/*.c" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga" + have_video=yes + fi + fi +} + +dnl Find the VGL includes and libraries +CheckVGL() +{ + AC_ARG_ENABLE(video-vgl, +AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [[default=yes]]]), + , enable_video_vgl=yes) + if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then + AC_MSG_CHECKING(for libVGL support) + video_vgl=no + AC_TRY_COMPILE([ + #include + #include + #include + #include + ],[ + VGLBitmap bitmap; + bitmap.Type = VIDBUF32; + bitmap.PixelBytes = 4; + exit(bitmap.Bitmap); + ],[ + video_vgl=yes + ]) + AC_MSG_RESULT($video_vgl) + if test x$video_vgl = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_VGL) + SOURCES="$SOURCES $srcdir/src/video/vgl/*.c" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvgl" + have_video=yes + fi + fi +} + +dnl Set up the wscons video driver if enabled +CheckWscons() +{ + AC_ARG_ENABLE(video-wscons, +AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [[default=yes]]]), + , enable_video_wscons=yes) + if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then + AC_MSG_CHECKING(for wscons support) + video_wscons=no + AC_TRY_COMPILE([ + #include + #include + #include + ],[ + int wsmode = WSDISPLAYIO_MODE_DUMBFB; + ],[ + video_wscons=yes + ]) + AC_MSG_RESULT($video_wscons) + if test x$video_wscons = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS) + SOURCES="$SOURCES $srcdir/src/video/wscons/*.c" + have_video=yes + fi + fi +} + + +dnl Find the AAlib includes +CheckAAlib() +{ + AC_ARG_ENABLE(video-aalib, +AC_HELP_STRING([--enable-video-aalib], [use AAlib video driver [[default=no]]]), + , enable_video_aalib=no) + if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then + AC_MSG_CHECKING(for AAlib support) + video_aalib=no + AC_TRY_COMPILE([ + #include + ],[ + ],[ + video_aalib=yes + ]) + AC_MSG_RESULT($video_aalib) + if test x$video_aalib = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_AALIB) + SOURCES="$SOURCES $srcdir/src/video/aalib/*.c" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laa" + have_video=yes + fi + fi +} + +dnl Set up the QTopia video driver if enabled +CheckQtopia() +{ + AC_ARG_ENABLE(video-qtopia, +AC_HELP_STRING([--enable-video-qtopia], [use Qtopia video driver [[default=no]]]), + , enable_video_qtopia=no) + if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then + AC_MSG_CHECKING(for Qtopia support) + video_qtopia=no + QTOPIA_FLAGS="-DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions" + AC_LANG_CPLUSPLUS + OLD_CXX="$CXXFLAGS" + CXXFLAGS="$QTOPIA_FLAGS" + AC_TRY_COMPILE([ + #include + ],[ + ],[ + video_qtopia=yes + ]) + CXXFLAGS="$OLD_CXX" + AC_MSG_RESULT($video_qtopia) + if test x$video_qtopia = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA) + SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc" + SDLMAIN_SOURCES="$srcdir/src/main/qtopia/*.cc" + EXTRA_CFLAGS="$EXTRA_CFLAGS $QTOPIA_FLAGS" + SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main" + SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte" + have_video=yes + fi + AC_LANG_C + fi +} + +dnl Set up the PicoGUI video driver if enabled +CheckPicoGUI() +{ + AC_ARG_ENABLE(video-picogui, +AC_HELP_STRING([--enable-video-picogui], [use PicoGUI video driver [[default=no]]]), + , enable_video_picogui=no) + if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then + AC_MSG_CHECKING(for PicoGUI support) + video_picogui=no + AC_TRY_COMPILE([ + #include + ],[ + ],[ + video_picogui=yes + ]) + AC_MSG_RESULT($video_picogui) + if test x$video_picogui = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_PICOGUI) + SOURCES="$SOURCES $srcdir/src/video/picogui/*.c" + SDL_LIBS="$SDL_LIBS -lpgui" + have_video=yes + fi + fi +} + +dnl Set up the Atari Bios keyboard driver +CheckAtariBiosEvent() +{ + SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c" + SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.S" +} + +dnl Set up the Atari Xbios driver +CheckAtariXbiosVideo() +{ + AC_ARG_ENABLE(xbios, +AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [[default=yes]]]), + , enable_video_xbios=yes) + video_xbios=no + if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then + video_xbios=yes + AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS) + SOURCES="$SOURCES $srcdir/src/video/xbios/*.c" + have_video=yes + fi +} + +dnl Set up the Atari Gem driver +CheckAtariGemVideo() +{ + AC_ARG_ENABLE(gem, +AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [[default=yes]]]), + , enable_video_gem=yes) + if test x$enable_video = xyes -a x$enable_video_gem = xyes; then + video_gem=no + AC_CHECK_HEADER(gem.h, have_gem_hdr=yes) + AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes) + if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then + video_gem=yes + AC_DEFINE(SDL_VIDEO_DRIVER_GEM) + SOURCES="$SOURCES $srcdir/src/video/gem/*.c" + SDL_LIBS="$SDL_LIBS -lgem" + have_video=yes + fi + fi +} + +dnl rcg04172001 Set up the Null video driver. +CheckDummyVideo() +{ + AC_ARG_ENABLE(video-dummy, +AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]), + , enable_video_dummy=yes) + if test x$enable_video_dummy = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY) + SOURCES="$SOURCES $srcdir/src/video/dummy/*.c" + have_video=yes + fi +} + +dnl Check to see if OpenGL support is desired +AC_ARG_ENABLE(video-opengl, +AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [[default=yes]]]), + , enable_video_opengl=yes) + +dnl Find OpenGL +CheckOpenGLX11() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + AC_MSG_CHECKING(for OpenGL (GLX) support) + video_opengl=no + AC_TRY_COMPILE([ + #include + #include + #include + ],[ + ],[ + video_opengl=yes + ]) + AC_MSG_RESULT($video_opengl) + if test x$video_opengl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL) + AC_DEFINE(SDL_VIDEO_OPENGL_GLX) + fi + fi +} + +dnl Find QNX RtP OpenGL +CheckOpenGLQNX() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + AC_MSG_CHECKING(for OpenGL (Photon) support) + video_opengl=no + AC_TRY_COMPILE([ + #include + ],[ + ],[ + video_opengl=yes + ]) + AC_MSG_RESULT($video_opengl) + if test x$video_opengl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL" + fi + fi +} + +dnl Check for Win32 OpenGL +CheckWIN32GL() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL) + AC_DEFINE(SDL_VIDEO_OPENGL_WGL) + fi +} + +dnl Check for BeOS OpenGL +CheckBeGL() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL" + fi +} + +dnl Check for MacOS OpenGL +CheckMacGL() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + AC_DEFINE(SDL_VIDEO_OPENGL) + case "$host" in + *-*-darwin*) + if test x$enable_video_cocoa = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL" + fi + if test x$enable_video_carbon = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AGL" + fi + esac + fi +} + +dnl Check for Mesa offscreen rendering +CheckAtariOSMesa() +{ + if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then + AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes) + AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm) + + # Static linking to -lOSMesa + AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no) + if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then + # -lOSMesa is really the static library + if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then + OSMESA_LIBS="-lOSMesa" + fi + else + # -lOSMesa is a loader for OSMesa.ldg + OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags` + OSMESA_LIBS=`$OSMESA_CONFIG --libs` + fi + AC_DEFINE(SDL_VIDEO_OPENGL) + AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA) + SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS" + SDL_LIBS="$SDL_LIBS $OSMESA_LIBS" + + AC_ARG_ENABLE(osmesa-shared, +AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [[default=yes]]]), + , enable_osmesa_shared=yes) + if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then + # Dynamic linking + if test "x$have_osmesa_hdr" = "xyes"; then + AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC) + fi + fi + fi +} + +AC_ARG_ENABLE(screensaver, +AC_HELP_STRING([--enable-screensaver], [enable screensaver by default while any SDL application is running [[default=no]]]), + , enable_screensaver=no) +if test x$enable_screensaver = xno; then + AC_DEFINE(SDL_VIDEO_DISABLE_SCREENSAVER) +fi + +dnl See if we can use the new unified event interface in Linux 2.4 +CheckInputEvents() +{ + dnl Check for Linux 2.4 unified input event interface support + AC_ARG_ENABLE(input-events, +AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]), + , enable_input_events=yes) + if test x$enable_input_events = xyes; then + AC_MSG_CHECKING(for Linux 2.4 unified input interface) + use_input_events=no + AC_TRY_COMPILE([ + #include + ],[ + #ifndef EVIOCGNAME + #error EVIOCGNAME() ioctl not available + #endif + ],[ + use_input_events=yes + ]) + AC_MSG_RESULT($use_input_events) + if test x$use_input_events = xyes; then + AC_DEFINE(SDL_INPUT_LINUXEV) + fi + fi +} + +dnl See if we can use the Touchscreen input library +CheckTslib() +{ + AC_ARG_ENABLE(input-tslib, +AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]), + , enable_input_tslib=yes) + if test x$enable_input_tslib = xyes; then + AC_MSG_CHECKING(for Touchscreen library support) + enable_input_tslib=no + AC_TRY_COMPILE([ + #include "tslib.h" + ],[ + ],[ + enable_input_tslib=yes + ]) + AC_MSG_RESULT($enable_input_tslib) + if test x$enable_input_tslib = xyes; then + AC_DEFINE(SDL_INPUT_TSLIB) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts" + fi + fi +} + +dnl See if we can use GNU pth library for threads +CheckPTH() +{ + dnl Check for pth support + AC_ARG_ENABLE(pth, +AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [[default=yes]]]), + , enable_pth=yes) + if test x$enable_threads = xyes -a x$enable_pth = xyes; then + AC_PATH_PROG(PTH_CONFIG, pth-config, no) + if test "$PTH_CONFIG" = "no"; then + use_pth=no + else + use_pth=yes + fi + AC_MSG_CHECKING(pth) + AC_MSG_RESULT($use_pth) + if test "x$use_pth" = xyes; then + AC_DEFINE(SDL_THREAD_PTH) + SOURCES="$SOURCES $srcdir/src/thread/pth/*.c" + SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c" + SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`" + SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`" + have_threads=yes + fi + fi +} + +dnl See what type of thread model to use on Linux and Solaris +CheckPTHREAD() +{ + dnl Check for pthread support + AC_ARG_ENABLE(pthreads, +AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]), + , enable_pthreads=yes) + dnl This is used on Linux for glibc binary compatibility (Doh!) + AC_ARG_ENABLE(pthread-sem, +AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]), + , enable_pthread_sem=yes) + case "$host" in + *-*-linux*|*-*-uclinux*) + pthread_cflags="-D_REENTRANT" + pthread_lib="-lpthread" + ;; + *-*-bsdi*) + pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + pthread_lib="" + ;; + *-*-darwin*) + pthread_cflags="-D_THREAD_SAFE" +# causes Carbon.p complaints? +# pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + ;; + *-*-freebsd*|*-*-dragonfly*) + pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + pthread_lib="-pthread" + ;; + *-*-netbsd*) + pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + pthread_lib="-lpthread" + ;; + *-*-openbsd*) + pthread_cflags="-D_REENTRANT" + pthread_lib="-pthread" + ;; + *-*-solaris*) + pthread_cflags="-D_REENTRANT" + pthread_lib="-lpthread -lposix4" + ;; + *-*-sysv5*) + pthread_cflags="-D_REENTRANT -Kthread" + pthread_lib="" + ;; + *-*-irix*) + pthread_cflags="-D_SGI_MP_SOURCE" + pthread_lib="-lpthread" + ;; + *-*-aix*) + pthread_cflags="-D_REENTRANT -mthreads" + pthread_lib="-lpthread" + ;; + *-*-hpux11*) + pthread_cflags="-D_REENTRANT" + pthread_lib="-L/usr/lib -lpthread" + ;; + *-*-qnx*) + pthread_cflags="" + pthread_lib="" + ;; + *-*-osf*) + pthread_cflags="-D_REENTRANT" + if test x$ac_cv_prog_gcc = xyes; then + pthread_lib="-lpthread -lrt" + else + pthread_lib="-lpthread -lexc -lrt" + fi + ;; + *) + pthread_cflags="-D_REENTRANT" + pthread_lib="-lpthread" + ;; + esac + if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then + # Save the original compiler flags and libraries + ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" + # Add the pthread compiler flags and libraries + CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib" + # Check to see if we have pthread support on this system + AC_MSG_CHECKING(for pthreads) + use_pthreads=no + AC_TRY_LINK([ + #include + ],[ + pthread_attr_t type; + pthread_attr_init(&type); + ],[ + use_pthreads=yes + ]) + AC_MSG_RESULT($use_pthreads) + # Restore the compiler flags and libraries + CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" + + # Do futher testing if we have pthread support... + if test x$use_pthreads = xyes; then + AC_DEFINE(SDL_THREAD_PTHREAD) + EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib" + SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags" + SDL_LIBS="$SDL_LIBS $pthread_lib" + + # Save the original compiler flags and libraries + ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" + # Add the pthread compiler flags and libraries + CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib" + + # Check to see if recursive mutexes are available + AC_MSG_CHECKING(for recursive mutexes) + has_recursive_mutexes=no + if test x$has_recursive_mutexes = xno; then + AC_TRY_COMPILE([ + #include + ],[ + pthread_mutexattr_t attr; + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + ],[ + has_recursive_mutexes=yes + AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX) + ]) + fi + if test x$has_recursive_mutexes = xno; then + AC_TRY_COMPILE([ + #include + ],[ + pthread_mutexattr_t attr; + pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP); + ],[ + has_recursive_mutexes=yes + AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP) + ]) + fi + AC_MSG_RESULT($has_recursive_mutexes) + + # Check to see if pthread semaphore support is missing + if test x$enable_pthread_sem = xyes; then + AC_MSG_CHECKING(for pthread semaphores) + have_pthread_sem=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + have_pthread_sem=yes + ]) + AC_MSG_RESULT($have_pthread_sem) + fi + + # Restore the compiler flags and libraries + CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" + + # Basic thread creation functions + SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c" + + # Semaphores + # We can fake these with mutexes and condition variables if necessary + if test x$have_pthread_sem = xyes; then + SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c" + else + SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c" + fi + + # Mutexes + # We can fake these with semaphores if necessary + SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c" + + # Condition variables + # We can fake these with semaphores and mutexes if necessary + SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c" + + have_threads=yes + else + CheckPTH + fi + fi +} + +dnl Determine whether the compiler can produce Win32 executables +CheckWIN32() +{ + AC_MSG_CHECKING(Win32 compiler) + have_win32_gcc=no + AC_TRY_COMPILE([ + #include + ],[ + ],[ + have_win32_gcc=yes + ]) + AC_MSG_RESULT($have_win32_gcc) + if test x$have_win32_gcc != xyes; then + AC_MSG_ERROR([ +*** Your compiler ($CC) does not produce Win32 executables! + ]) + fi + + dnl See if the user wants to redirect standard output to files + AC_ARG_ENABLE(stdio-redirect, +AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]), + , enable_stdio_redirect=yes) + if test x$enable_stdio_redirect != xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT" + fi + + if test x$enable_video = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB) + SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c" + SOURCES="$SOURCES $srcdir/src/video/windib/*.c" + have_video=yes + fi +} + +dnl Find the DirectX includes and libraries +CheckDIRECTX() +{ + AC_ARG_ENABLE(directx, +AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]), + , enable_directx=yes) + if test x$enable_directx = xyes; then + have_directx=no + AC_CHECK_HEADER(ddraw.h, have_ddraw=yes) + AC_CHECK_HEADER(dsound.h, have_dsound=yes) + AC_CHECK_HEADER(dinput.h, use_dinput=yes) + if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then + have_directx=yes + fi + if test x$enable_video = xyes -a x$have_directx = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW) + SOURCES="$SOURCES $srcdir/src/video/windx5/*.c" + have_video=yes + fi + fi +} + +dnl Check for the dlfcn.h interface for dynamically loading objects +CheckDLOPEN() +{ + AC_ARG_ENABLE(sdl-dlopen, +AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]), + , enable_sdl_dlopen=yes) + if test x$enable_sdl_dlopen = xyes; then + AC_MSG_CHECKING(for dlopen) + have_dlopen=no + AC_TRY_COMPILE([ + #include + ],[ + #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020 + #error Use dlcompat for Mac OS X 10.2 compatibility + #endif + ],[ + have_dlopen=yes + ]) + AC_MSG_RESULT($have_dlopen) + + if test x$have_dlopen = xyes; then + AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS", + AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl", + AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl"))) + AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes) + if test x$have_dlvsym = xyes; then + AC_DEFINE(HAVE_DLVSYM) + fi + AC_DEFINE(SDL_LOADSO_DLOPEN) + SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c" + have_loadso=yes + fi + fi +} + +dnl Set up the Atari LDG (shared object loader) +CheckAtariLdg() +{ + AC_ARG_ENABLE(atari-ldg, +AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [[default=yes]]]), + , enable_atari_ldg=yes) + if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then + AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes) + AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem) + if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then + AC_DEFINE(SDL_LOADSO_LDG) + SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c" + SDL_LIBS="$SDL_LIBS -lldg -lgem" + have_loadso=yes + fi + fi +} + +dnl Check for the usbhid(3) library on *BSD +CheckUSBHID() +{ + if test x$enable_joystick = xyes; then + AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes) + if test x$have_libusbhid = xyes; then + AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"]) + AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"]) + USB_LIBS="$USB_LIBS -lusbhid" + else + AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"]) + AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"]) + AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"]) + fi + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $USB_CFLAGS" + + AC_MSG_CHECKING(for usbhid) + have_usbhid=no + AC_TRY_COMPILE([ + #include + #if defined(HAVE_USB_H) + #include + #endif + #ifdef __DragonFly__ + # include + # include + #else + # include + # include + #endif + #if defined(HAVE_USBHID_H) + #include + #elif defined(HAVE_LIBUSB_H) + #include + #elif defined(HAVE_LIBUSBHID_H) + #include + #endif + ],[ + struct report_desc *repdesc; + struct usb_ctl_report *repbuf; + hid_kind_t hidkind; + ],[ + have_usbhid=yes + ]) + AC_MSG_RESULT($have_usbhid) + + if test x$have_usbhid = xyes; then + AC_MSG_CHECKING(for ucr_data member of usb_ctl_report) + have_usbhid_ucr_data=no + AC_TRY_COMPILE([ + #include + #if defined(HAVE_USB_H) + #include + #endif + #ifdef __DragonFly__ + # include + # include + #else + # include + # include + #endif + #if defined(HAVE_USBHID_H) + #include + #elif defined(HAVE_LIBUSB_H) + #include + #elif defined(HAVE_LIBUSBHID_H) + #include + #endif + ],[ + struct usb_ctl_report buf; + if (buf.ucr_data) { } + ],[ + have_usbhid_ucr_data=yes + ]) + if test x$have_usbhid_ucr_data = xyes; then + USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA" + fi + AC_MSG_RESULT($have_usbhid_ucr_data) + + AC_MSG_CHECKING(for new usbhid API) + have_usbhid_new=no + AC_TRY_COMPILE([ + #include + #if defined(HAVE_USB_H) + #include + #endif + #ifdef __DragonFly__ + #include + #include + #else + #include + #include + #endif + #if defined(HAVE_USBHID_H) + #include + #elif defined(HAVE_LIBUSB_H) + #include + #elif defined(HAVE_LIBUSBHID_H) + #include + #endif + ],[ + report_desc_t d; + hid_start_parse(d, 1, 1); + ],[ + have_usbhid_new=yes + ]) + if test x$have_usbhid_new = xyes; then + USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW" + fi + AC_MSG_RESULT($have_usbhid_new) + + AC_MSG_CHECKING(for struct joystick in machine/joystick.h) + have_machine_joystick=no + AC_TRY_COMPILE([ + #include + ],[ + struct joystick t; + ],[ + have_machine_joystick=yes + ]) + if test x$have_machine_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H) + fi + AC_MSG_RESULT($have_machine_joystick) + + AC_DEFINE(SDL_JOYSTICK_USBHID) + SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS" + have_joystick=yes + fi + CFLAGS="$save_CFLAGS" + fi +} + +dnl Check for clock_gettime() +CheckClockGettime() +{ + AC_ARG_ENABLE(clock_gettime, +AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]), + , enable_clock_gettime=no) + if test x$enable_clock_gettime = xyes; then + AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes) + if test x$have_clock_gettime = xyes; then + AC_DEFINE(HAVE_CLOCK_GETTIME) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt" + fi + fi +} + +dnl Check for a valid linux/version.h +CheckLinuxVersion() +{ + AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes) + if test x$have_linux_version_h = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H" + fi +} + +dnl Check if we want to use RPATH +CheckRPATH() +{ + AC_ARG_ENABLE(rpath, +AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]), + , enable_rpath=yes) +} + +dnl Set up the configuration based on the host platform! +case "$host" in + arm-*-elf*) # FIXME: Can we get more specific for iPodLinux? + ARCH=linux + CheckDummyVideo + CheckIPod + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX) + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" + have_timers=yes + fi + ;; + *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*) + case "$host" in + *-*-linux*) ARCH=linux ;; + *-*-uclinux*) ARCH=linux ;; + *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;; + *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;; + *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;; + *-*-gnu*) ARCH=gnu ;; # must be last of the gnu variants + *-*-bsdi*) ARCH=bsdi ;; + *-*-freebsd*) ARCH=freebsd ;; + *-*-dragonfly*) ARCH=freebsd ;; + *-*-netbsd*) ARCH=netbsd ;; + *-*-openbsd*) ARCH=openbsd ;; + *-*-sysv5*) ARCH=sysv5 ;; + *-*-solaris*) ARCH=solaris ;; + *-*-hpux*) ARCH=hpux ;; + *-*-irix*) ARCH=irix ;; + *-*-aix*) ARCH=aix ;; + *-*-osf*) ARCH=osf ;; + esac + CheckVisibilityHidden + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckDLOPEN + CheckNASM + CheckAltivec + CheckOSS + CheckDMEDIA + CheckMME + CheckALSA + CheckARTSC + CheckESD + CheckPulseAudio + CheckNAS + CheckX11 + CheckNANOX + CheckFBCON + CheckDirectFB + CheckPS2GS + CheckGGI + CheckSVGA + CheckVGL + CheckWscons + CheckAAlib + CheckQtopia + CheckPicoGUI + CheckOpenGLX11 + CheckInputEvents + CheckTslib + CheckUSBHID + CheckPTHREAD + CheckClockGettime + CheckLinuxVersion + CheckRPATH + # Set up files for the audio library + if test x$enable_audio = xyes; then + case $ARCH in + sysv5|solaris|hpux) + AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO) + SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" + have_audio=yes + ;; + netbsd|openbsd) + AC_DEFINE(SDL_AUDIO_DRIVER_BSD) + SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c" + have_audio=yes + ;; + aix) + AC_DEFINE(SDL_AUDIO_DRIVER_PAUD) + SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" + have_audio=yes + ;; + esac + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + case $ARCH in + linux) + AC_DEFINE(SDL_JOYSTICK_LINUX) + SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + have_joystick=yes + ;; + esac + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + case $ARCH in + linux|solaris) + AC_DEFINE(SDL_CDROM_LINUX) + SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c" + have_cdrom=yes + ;; + *freebsd*) + AC_DEFINE(SDL_CDROM_FREEBSD) + SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c" + have_cdrom=yes + ;; + *openbsd*|*netbsd*) + AC_DEFINE(SDL_CDROM_OPENBSD) + SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c" + have_cdrom=yes + ;; + bsdi) + AC_DEFINE(SDL_CDROM_BSDI) + SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c" + have_cdrom=yes + ;; + aix) + AC_DEFINE(SDL_CDROM_AIX) + SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c" + have_cdrom=yes + ;; + osf) + AC_DEFINE(SDL_CDROM_OSF) + SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c" + have_cdrom=yes + ;; + esac + fi + # Set up files for the thread library + if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then + AC_DEFINE(SDL_THREAD_SPROC) + SOURCES="$SOURCES $srcdir/src/thread/irix/*.c" + SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c" + SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" + have_threads=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX) + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" + have_timers=yes + fi + ;; + *-*-qnx*) + ARCH=qnx + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + # CheckNASM + CheckDLOPEN + CheckNAS + CheckPHOTON + CheckX11 + CheckOpenGLX11 + CheckPTHREAD + # Set up files for the audio library + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO) + SOURCES="$SOURCES $srcdir/src/audio/nto/*.c" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound" + have_audio=yes + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + AC_DEFINE(SDL_CDROM_QNX) + SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c" + have_cdrom=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX) + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" + have_timers=yes + fi + ;; + *-*-cygwin* | *-*-mingw32*) + ARCH=win32 + if test "$build" != "$host"; then # cross-compiling + # Default cross-compile location + ac_default_prefix=/usr/local/cross-tools/i386-mingw32 + else + # Look for the location of the tools and install there + if test "$BUILD_PREFIX" != ""; then + ac_default_prefix=$BUILD_PREFIX + fi + fi + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckWIN32 + CheckWIN32GL + CheckDIRECTX + CheckNASM + # Set up files for the audio library + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT) + SOURCES="$SOURCES $srcdir/src/audio/windib/*.c" + if test x$have_directx = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND) + SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c" + fi + have_audio=yes + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_WINMM) + SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c" + have_joystick=yes + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + AC_DEFINE(SDL_CDROM_WIN32) + SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c" + have_cdrom=yes + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + AC_DEFINE(SDL_THREAD_WIN32) + SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c" + SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c" + SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c" + SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" + have_threads=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_WIN32) + SOURCES="$SOURCES $srcdir/src/timer/win32/*.c" + have_timers=yes + fi + # Set up files for the shared object loading library + if test x$enable_loadso = xyes; then + AC_DEFINE(SDL_LOADSO_WIN32) + SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c" + have_loadso=yes + fi + # Set up the system libraries we need + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm" + if test x$have_directx = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid" + fi + # The Win32 platform requires special setup + SOURCES="$SOURCES $srcdir/src/main/win32/*.rc" + SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c" + SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main" + SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows" + ;; + *-wince*) + ARCH=win32 + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckWIN32 + CheckNASM + SOURCES="$SOURCES $srcdir/src/video/gapi/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS -D_WIN32_WCE=0x420" + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT) + SOURCES="$SOURCES $srcdir/src/audio/windib/*.c" + have_audio=yes + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + AC_DEFINE(SDL_THREAD_WIN32) + SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c" + SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c" + SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c" + SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" + have_threads=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_WINCE) + SOURCES="$SOURCES $srcdir/src/timer/wince/*.c" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lmmtimer" + have_timers=yes + fi + # Set up files for the shared object loading library + if test x$enable_loadso = xyes; then + AC_DEFINE(SDL_LOADSO_WIN32) + SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c" + have_loadso=yes + fi + # Set up the system libraries we need + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl" + # The Win32 platform requires special setup + SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c" + SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420" + SDL_LIBS="-lSDLmain $SDL_LIBS" + ;; + *-*-beos*) + ARCH=beos + ac_default_prefix=/boot/develop/tools/gnupro + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckNASM + CheckBWINDOW + CheckBeGL + # Set up files for the audio library + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO) + SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc" + have_audio=yes + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_BEOS) + SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc" + have_joystick=yes + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + AC_DEFINE(SDL_CDROM_BEOS) + SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc" + have_cdrom=yes + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + AC_DEFINE(SDL_THREAD_BEOS) + SOURCES="$SOURCES $srcdir/src/thread/beos/*.c" + SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c" + SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" + have_threads=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_BEOS) + SOURCES="$SOURCES $srcdir/src/timer/beos/*.c" + have_timers=yes + fi + # Set up files for the shared object loading library + if test x$enable_loadso = xyes; then + AC_DEFINE(SDL_LOADSO_BEOS) + SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c" + have_loadso=yes + fi + # The BeOS platform requires special setup. + SOURCES="$srcdir/src/main/beos/*.cc $SOURCES" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" + ;; + *-*-darwin* ) + # This could be either full "Mac OS X", or plain "Darwin" which is + # just the OS X kernel sans upper layers like Carbon and Cocoa. + # Next line is broken, and a few files below require Mac OS X (full) + ARCH=macosx + + # Mac OS X builds with both the Carbon and OSX APIs at the moment + EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON" + EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" + + # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point + # is -lm which is not needed under Mac OS X. But for some reasons it + # also tends to contain spurious -L switches, which we don't want to + # use here or in sdl-config. Hence we reset it. + EXTRA_LDFLAGS="" + + CheckVisibilityHidden + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckDLOPEN + CheckNASM + + # Set up files for the shared object loading library + # (this needs to be done before the dynamic X11 check) + if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then + AC_DEFINE(SDL_LOADSO_DLCOMPAT) + SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c" + have_loadso=yes + fi + + CheckCOCOA + CheckCARBON + CheckX11 + CheckMacGL + CheckOpenGLX11 + CheckPTHREAD + CheckAltivec + + # Need this or things might misbuild on a G3. + EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL" + + # Set up files for the audio library + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO) + SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c" + AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR) + SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c" + have_audio=yes + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_IOKIT) + SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c" + have_joystick=yes + need_iokit_framework=yes + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + AC_DEFINE(SDL_CDROM_MACOSX) + SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c" + have_cdrom=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX) + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" + have_timers=yes + fi + # The Mac OS X platform requires special setup. + SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m" + EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" + SDL_LIBS="-lSDLmain $SDL_LIBS" + if test x$enable_video_cocoa = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" + need_iokit_framework=yes + fi + if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then + # The Cocoa backend still needs Carbon, and the YUV code QuickTime + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,ApplicationServices" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" + fi + # If either the audio or CD driver is used, add the AudioUnit framework + if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit" + fi + # Some subsystems reference IOKit... + if test x$need_iokit_framework = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" + fi + ;; + *-*-mint*) + ARCH=mint + CheckDummyVideo + CheckDiskAudio + CheckDummyAudio + CheckAtariBiosEvent + CheckAtariXbiosVideo + CheckAtariGemVideo + CheckAtariAudio + CheckAtariLdg + CheckAtariOSMesa + CheckPTH + # Set up files for the audio library + if test x$enable_threads = xyes -a x$enable_pth = xyes; then + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO) + SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" + have_audio=yes + fi + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_MINT) + SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c" + have_joystick=yes + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + AC_DEFINE(SDL_CDROM_MINT) + SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c" + have_cdrom=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + if test x$enable_threads = xyes -a x$enable_pth = xyes; then + AC_DEFINE(SDL_TIMER_UNIX) + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" + else + AC_DEFINE(SDL_TIMER_MINT) + SOURCES="$SOURCES $srcdir/src/timer/mint/*.c" + SOURCES="$SOURCES $srcdir/src/timer/mint/*.S" + fi + have_timers=yes + fi + ;; + *-riscos) + ARCH=riscos + CheckOSS + CheckPTHREAD + # Set up files for the video library + if test x$enable_video = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS) + SOURCES="$SOURCES $srcdir/src/video/riscos/*.c" + SOURCES="$SOURCES $srcdir/src/video/riscos/*.S" + have_video=yes + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_RISCOS) + SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c" + have_joystick=yes + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_RISCOS) + SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c" + have_timers=yes + fi + # The RISC OS platform requires special setup. + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz" + ;; + *) + AC_MSG_ERROR([ +*** Unsupported host: Please add to configure.in + ]) + ;; +esac + +# Verify that we have all the platform specific files we need + +if test x$enable_joystick = xyes; then + if test x$have_joystick != xyes; then + # Wants joystick subsystem, but doesn't have a platform-specific backend... + AC_DEFINE(SDL_JOYSTICK_DUMMY) + SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c" + fi +fi +if test x$have_cdrom != xyes; then + if test x$enable_cdrom = xyes; then + AC_DEFINE(SDL_CDROM_DISABLED) + fi + SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c" +fi +if test x$have_threads != xyes; then + if test x$enable_threads = xyes; then + AC_DEFINE(SDL_THREADS_DISABLED) + fi + SOURCES="$SOURCES $srcdir/src/thread/generic/*.c" +fi +if test x$have_timers != xyes; then + if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMERS_DISABLED) + fi + SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c" +fi +if test x$have_loadso != xyes; then + if test x$enable_loadso = xyes; then + AC_DEFINE(SDL_LOADSO_DISABLED) + fi + SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c" +fi +if test x$SDLMAIN_SOURCES = x; then + SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c" +fi + +OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'` +OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'` +OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'` +OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` +OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'` +OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'` + +SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'` +SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.o,g'` +SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'` + +# Set runtime shared library paths as needed + +if test "x$enable_rpath" = "xyes"; then + if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then + SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" + fi + if test $ARCH = solaris; then + SDL_RLD_FLAGS="-R\${libdir}" + fi +else + SDL_RLD_FLAGS="" +fi + +case "$ARCH" in + macosx) + if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then + SDL_LIBS="$SDL_LIBS -Wl,-framework,Cocoa" + fi + if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then + SDL_LIBS="$SDL_LIBS -Wl,-framework,Carbon" + fi + # Evil hack to allow static linking on Mac OS X + SDL_STATIC_LIBS="\${libdir}/libSDLmain.a \${libdir}/libSDL.a $EXTRA_LDFLAGS" + ;; + *) + SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS" + ;; +esac + +dnl Expand the cflags and libraries needed by apps using SDL +AC_SUBST(SDL_CFLAGS) +AC_SUBST(SDL_LIBS) +AC_SUBST(SDL_STATIC_LIBS) +AC_SUBST(SDL_RLD_FLAGS) +if test x$enable_shared = xyes; then + ENABLE_SHARED_TRUE= + ENABLE_SHARED_FALSE="#" +else + ENABLE_SHARED_TRUE="#" + ENABLE_SHARED_FALSE= +fi +if test x$enable_static = xyes; then + ENABLE_STATIC_TRUE= + ENABLE_STATIC_FALSE="#" +else + ENABLE_STATIC_TRUE="#" + ENABLE_STATIC_FALSE= +fi +AC_SUBST(ENABLE_SHARED_TRUE) +AC_SUBST(ENABLE_SHARED_FALSE) +AC_SUBST(ENABLE_STATIC_TRUE) +AC_SUBST(ENABLE_STATIC_FALSE) + +dnl Expand the sources and objects needed to build the library +AC_SUBST(ac_aux_dir) +AC_SUBST(INCLUDE) +AC_SUBST(SOURCES) +AC_SUBST(OBJECTS) +AC_SUBST(SDLMAIN_SOURCES) +AC_SUBST(SDLMAIN_OBJECTS) +AC_SUBST(BUILD_CFLAGS) +AC_SUBST(EXTRA_CFLAGS) +AC_SUBST(BUILD_LDFLAGS) +AC_SUBST(EXTRA_LDFLAGS) +AC_SUBST(WINDRES) + +AC_OUTPUT([ + Makefile sdl-config SDL.spec SDL.qpg sdl.pc +], [ + : >build-deps + if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend +]) diff --git a/SDL/docs.html b/SDL/docs.html new file mode 100644 index 0000000..0337bd3 --- /dev/null +++ b/SDL/docs.html @@ -0,0 +1,497 @@ + +SDL Stable Release + + +[separator] +

+This source is stable, and is fully tested on all supported platforms.
+Please send bug reports or questions to the SDL mailing list:
+http://www.libsdl.org/mailing-list.php
+The latest stable release may be found on the + SDL website. +

+ +

API Documentation

+ +

SDL 1.2.14 Release Notes

+

+SDL 1.2.14 is a minor bug fix release. +

+ +

General Notes

+ +
+

+ Fixed flicker when resizing the SDL window +

+
+ +

Unix Notes

+ +
+

+ Added configure option --enable-screensaver, to allow enabling the screensaver by default. +

+

+ Use XResetScreenSaver() instead of disabling screensaver entirely. +

+
+ +

Windows Notes

+ +
+

+

+
+ +

Mac OS X Notes

+ +
+

+

+
+ +[separator] + +

SDL 1.2.13 Release Notes

+

+SDL 1.2.13 is a minor bug fix release. +

+ +

General Notes

+ +
+

+ Fixed link error when building with Intel Compiler 10. +

+

+ Removed stray C++ comment from public headers. +

+
+ +

Unix Notes

+ +
+

+ Fixed crash in SDL_SoftStretch() on secure operating systems. +

+

+ Fixed undefined symbol on X11 implementations without UTF-8 support. +

+

+ Worked around BadAlloc error when using XVideo on the XFree86 Intel Integrated Graphics driver. +

+

+ Scan for all joysticks on Linux instead of stopping at one that was removed. +

+

+ Fixed use of sdl-config arguments in sdl.m4 +

+
+ +

Windows Notes

+ +
+

+ Fixed crash when a video driver reports higher than 32 bpp video modes. +

+

+ Fixed restoring the desktop after setting a 24-bit OpenGL video mode. +

+

+ Fixed window titles on Windows 95/98/ME. +

+

+ Added SDL_BUTTON_X1 and SDL_BUTTON_X2 constants for extended mouse buttons. +

+

+ Added support for quoted command line arguments. +

+
+ +

Mac OS X Notes

+ +
+

+ SDL now builds on Mac OS X 10.5 (Leopard). +

+

+ Fixed high frequency crash involving text input. +

+

+ Fixed beeping when the escape key is pressed and UNICODE translation is enabled. +

+

+ Improved trackpad scrolling support. +

+

+ Fixed joystick hat reporting for certain joysticks. +

+
+ +[separator] + +

SDL 1.2.12 Release Notes

+

+SDL 1.2.12 is a minor bug fix release. +

+ +

General Notes

+ +
+

+ Added support for the PulseAudio sound server: http://www.pulseaudio.org/ +

+

+ Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling of the screensaver on Mac OS X, Windows, and X11. +

+

+ Fixed buffer overrun crash when resampling audio rates. +

+

+ Fixed audio bug where converting to mono was doubling the volume. +

+

+ Fixed off-by-one error in the C implementation of SDL_revcpy() +

+

+ Fixed compiling with Sun Studio. +

+

+ Support for AmigaOS has been removed from the main SDL code. +

+

+ Support for Nokia 9210 "EPOC" driver has been removed from the main SDL code. +

+

+ Unofficial support for the S60/SymbianOS platform has been added. +

+

+ Unofficial support for the Nintendo DS platform has been added. +

+

+ Reenabled MMX assembly for YUV overlay processing (GNU C Compiler only). +

+
+ +

Unix Notes

+ +
+

+ Fixed detection of X11 DGA mouse support. +

+

+ Improved XIM support for asian character sets. +

+

+ The GFX_Display has been added to the X11 window information in SDL_syswm.h. +

+

+ Fixed PAGE_SIZE compile error in the fbcon video driver on newer Linux kernels. +

+

+ Fixed hang or crash at startup if aRts can't access the hardware. +

+

+ Fixed relative mouse mode when the cursor starts outside the X11 window. +

+

+ Fixed accidental free of stack memory in X11 mouse acceleration code. +

+

+ Closed minor memory leak in XME code. +

+

+ Fixed TEXTRELs in the library to resolve some PIC issues. +

+
+ +

Windows Notes

+ +
+

+ The GDI video driver makes better use of the palette in 8-bit modes. +

+

+ The windib driver now supports more mouse buttons with WM_XBUTTON events. +

+

+ On Windows, SDL_SetVideoMode() will re-create the window instead of failing if the multisample settings are changed. +

+

+ Added support for UTF-8 window titles on Windows. +

+

+ Fixed joystick detection on Windows. +

+

+ Improved performance with Win32 file I/O. +

+

+ Fixed HBITMAP leak in GAPI driver. +

+
+ +

Mac OS X Notes

+ +
+

+ Added support for multi-axis controllers like 3Dconnxion's SpaceNavigator on Mac OS X. +

+

+ Fixed YUV overlay crash inside Quicktime on Intel Mac OS X. +

+

+ Fixed blitting alignment in Altivec alpha blit functions. +

+

+ Keys F13, F14, and F15 are now usable on Apple keyboards under Mac OS X. +

+

+ Fixed joystick calibration code on Mac OS X. +

+

+ Fixed mouse jitter when multiple motion events are queued up in Mac OS X. +

+

+ Fixed changing the cursor in fullscreen mode on Mac OS X. +

+
+ +

Mac OS Classic Notes

+ +
+

+ Added support for gamma ramps to both toolbox and DrawSprocket video drivers. +

+
+ +

BeOS Notes

+ +
+

+ Implemented mouse grabbing and mouse relative mode on BeOS. +

+
+ +[separator] + +

SDL 1.2.11 Release Notes

+

+SDL 1.2.11 is a minor bug fix release. +

+ +

Unix Notes

+ +
+

+ Dynamic X11 loading is only enabled with gcc 4 supporting -fvisibility=hidden. This fixes crashes related to symbol collisions, and allows building on Solaris and IRIX. +

+

+ Fixed building SDL with Xinerama disabled. +

+

+ Fixed DRI OpenGL library loading, using RTLD_GLOBAL in dlopen(). +

+

+ Added pkgconfig configuration support. +

+
+ +

Windows Notes

+ +
+

+ Setting SDL_GL_SWAP_CONTROL now works with Windows OpenGL. +

+

+ The Win32 window positioning code works properly for windows with menus. +

+

+ DirectSound audio quality has been improved on certain sound cards. +

+

+ Fixed 5.1 audio channel ordering on Windows and Mac OS X. +

+

+ Plugged a couple of minor memory leaks in the windib video driver. +

+

+ Fixed type collision with stdint.h when building with gcc on Win32. +

+

+ Fixed building with the Digital Mars Compiler on Win32. +

+
+ +

Mac OS X Notes

+ +
+

+ The Quartz video driver supports 32x32 cursors on Mac OS X 10.3 and above. +

+
+ +[separator] + +

SDL 1.2.10 Release Notes

+

+SDL 1.2.10 is a major release, featuring a revamp of the build system and many API improvements and bug fixes. +

+

API enhancements

+
    +
  • + If SDL_OpenAudio() is passed zero for the desired format + fields, the following environment variables will be used + to fill them in: +
    
    +		SDL_AUDIO_FREQUENCY
    +		SDL_AUDIO_FORMAT
    +		SDL_AUDIO_CHANNELS
    +		SDL_AUDIO_SAMPLES
    +
    + If an environment variable is not specified, it will be set + to a reasonable default value. +
  • + SDL_SetVideoMode() now accepts 0 for width or height and will use + the current video mode (or the desktop mode if no mode has been set.) +
  • + Added current_w and current_h to the SDL_VideoInfo structure, + which is set to the desktop resolution during video intialization, + and then set to the current resolution when a video mode is set. +
  • + SDL_GL_LoadLibrary() will load the system default OpenGL library + if it is passed NULL as a parameter. +
  • + Added SDL_GL_SWAP_CONTROL to wait for vsync in OpenGL applications. +
  • + Added SDL_GL_ACCELERATED_VISUAL to guarantee hardware acceleration. +
  • + SDL_WM_SetCaption() now officially takes UTF-8 title and icon strings, and displays international characters on supported platforms. +
  • + Added SDL_GetKeyRepeat() to query the key repeat settings. +
  • + Added the "dummy" audio driver, which can be used to emulate audio + output without a sound card. +
  • + Added SDL_config.h, with defaults for various build environments. +
+ +

General Notes

+ +
+

+ The SDL website now has an RSS feed! +

+ The SDL development source code is now managed with Subversion. +

+ SDL now uses the Bugzilla bug tracking system, hosted by icculus.org. +

+ SDL is licensed under version 2.1 of the GNU Lesser General Public License. +

+ The entire build system has been revamped to make it much more portable, including versions of C library functions to make it possible to run SDL on a minimal embedded environment. See README.Porting in the SDL source distribution for information on how to port SDL to a new platform. +

+ SDL_opengl.h has been updated with the latest glext.h from http://oss.sgi.com/projects/ogl-sample/registry/ +

+ Alex Volkov contributed highly optimized RGB <-> RGBA blitters. +

+ +

Unix Notes

+ +
+

+ The X11 libraries are dynamically loaded at runtime by default. This allows the distributed version of SDL to run on systems without X11 libraries installed. +

+ The XiG XME extension code is now included in the X11 video driver by default. +

+ XRandR support for video mode switching has been added to the X11 driver, but is disabled because of undesired interactions with window managers. You can enable this by setting the environment variable SDL_VIDEO_X11_XRANDR to 1. +

+ Xinerama multi-head displays are properly handled now, and the SDL_VIDEO_FULLSCREEN_HEAD environment variable can be used to select the screen used for fullscreen video modes. Note that changing the video modes only works on screen 0. +

+ XVidMode video modes are now sorted so they maintain the refresh rates specified in the X11 configuration file. +

+ SDL windows are no longer transparent in X11 compositing systems like XGL. +

+ The mouse is properly released by the X11 video driver if the fullscreen window loses focus. +

+ The X11 input driver now uses XIM to handle international input. +

+ The screensaver and DPMS monitor blanking are disabled while SDL games are running under the X11 and DGA video drivers. This behavior will be formalized and selectable in SDL 1.3. +

+ Fixed a bug preventing stereo OpenGL contexts from being selected on the X11 driver. +

+ The DGA video driver now waits for pending blits involving surfaces before they are freed. This prevents display oddities when using SDL_DisplayFormat() to convert many images. +

+ The framebuffer console video driver now has a parser for /etc/fb.modes for improved video mode handling. +

+ The framebuffer console video driver now allows asynchronous VT switching, and restores the full contents of the screen when switched back. +

+ The framebuffer console now uses CTRL-ALT-FN to switch virtual terminals, to avoid collisions with application key bindings. +

+ The framebuffer console input driver correctly sets IMPS/2 mode for wheel mice. It also properly detects when gpm is in IMPS/2 protocol mode, or passing raw protocol from an IMPS/2 mouse. +

+ The SVGAlib video driver now has support for banked (non-linear) video modes. +

+ A video driver for OpenBSD on the Sharp Zaurus has been contributed by Staffan Ulfberg. See the file README.wscons in the SDL source distribution for details. +

+ Many patches have been incorporated from *BSD ports. +

+ +

Windows Notes

+ +
+

+ The "windib" video driver is the default now, to prevent problems with certain laptops, 64-bit Windows, and Windows Vista. The DirectX driver is still available, and can be selected by setting the environment variable SDL_VIDEODRIVER to "directx". +

+ SDL has been ported to 64-bit Windows. +

+ Dmitry Yakimov contributed a GAPI video driver for Windows CE. +

+ The default fullscreen refresh rate has been increased to match the desktop refresh rate, when using equivalent resolutions. A full API for querying and selecting refresh rates is planned for SDL 1.3. +

+ Dialog boxes are now shown when SDL is in windowed OpenGL mode. +

+ The SDL window is recreated when necessary to maintain OpenGL context attributes, when switching between windowed and fullscreen modes. +

+ An SDL_VIDEORESIZE event is properly sent when the SDL window is maximized and restored. +

+ Window positions are retained when switching between fullscreen and windowed modes. +

+ ToUnicode() is used, when available, for improved handling of international keyboard input. +

+ The PrtScrn is now treated normally with both key down and key up events. +

+ Pressing ALT-F4 now delivers an SDL_QUIT event to SDL applications. +

+ Joystick names are now correct for joysticks which have been unplugged and then plugged back in since booting. +

+ An MCI error when playing the last track on a CD-ROM has been fixed. +

+ OpenWatcom projects for building SDL have been provided by Marc Peter. +

+ +

Mac OS X Notes

+ +
+

+ SDL now supports building Universal binaries, both through Xcode projects and when using configure/make. See README.MacOSX in the SDL source archive for details. +

+ The X11 video driver with GLX support can be built on Mac OS X, if the X11 development SDK is installed. +

+ Transitions between fullscreen resolutions and windowed mode now use a much faster asynchronous fade to hide desktop flicker. +

+ Icons set with SDL_WM_SetIcon() now have the proper colors on Intel Macs. +

+ +

OS/2 Notes

+ +
+

+ Projects for building SDL on OS/2 with OpenWatcom have been contributed by Doodle. See the file README.OS2 in the SDL source distribution for details. +

+ +[separator] + + + diff --git a/SDL/docs/html/audio.html b/SDL/docs/html/audio.html new file mode 100644 index 0000000..5f8ccee --- /dev/null +++ b/SDL/docs/html/audio.html @@ -0,0 +1,242 @@ +Audio
SDL Library Documentation
PrevNext

Chapter 10. Audio

Table of Contents
SDL_AudioSpec -- Audio Specification Structure
SDL_OpenAudio -- Opens the audio device with the desired parameters.
SDL_PauseAudio -- Pauses and unpauses the audio callback processing
SDL_GetAudioStatus -- Get the current audio state
SDL_LoadWAV -- Load a WAVE file
SDL_FreeWAV -- Frees previously opened WAV data
SDL_AudioCVT -- Audio Conversion Structure
SDL_BuildAudioCVT -- Initializes a SDL_AudioCVT structure for conversion
SDL_ConvertAudio -- Convert audio data to a desired audio format.
SDL_MixAudio -- Mix audio data
SDL_LockAudio -- Lock out the callback function
SDL_UnlockAudio -- Unlock the callback function
SDL_CloseAudio -- Shuts down audio processing and closes the audio device.

Sound on the computer is translated from waves that you hear into a series of +values, or samples, each representing the amplitude of the wave. When these +samples are sent in a stream to a sound card, an approximation of the original +wave can be recreated. The more bits used to represent the amplitude, and the +greater frequency these samples are gathered, the closer the approximated +sound is to the original, and the better the quality of sound.

This library supports both 8 and 16 bit signed and unsigned sound samples, +at frequencies ranging from 11025 Hz to 44100 Hz, depending on the +underlying hardware. If the hardware doesn't support the desired audio +format or frequency, it can be emulated if desired (See +SDL_OpenAudio())

A commonly supported audio format is 16 bits per sample at 22050 Hz.


PrevHomeNext
SDL_JoystickCloseUpSDL_AudioSpec
\ No newline at end of file diff --git a/SDL/docs/html/cdrom.html b/SDL/docs/html/cdrom.html new file mode 100644 index 0000000..1f0f7ad --- /dev/null +++ b/SDL/docs/html/cdrom.html @@ -0,0 +1,260 @@ +CD-ROM
SDL Library Documentation
PrevNext

Chapter 11. CD-ROM

Table of Contents
SDL_CDNumDrives -- Returns the number of CD-ROM drives on the system.
SDL_CDName -- Returns a human-readable, system-dependent identifier for the CD-ROM.
SDL_CDOpen -- Opens a CD-ROM drive for access.
SDL_CDStatus -- Returns the current status of the given drive.
SDL_CDPlay -- Play a CD
SDL_CDPlayTracks -- Play the given CD track(s)
SDL_CDPause -- Pauses a CDROM
SDL_CDResume -- Resumes a CDROM
SDL_CDStop -- Stops a CDROM
SDL_CDEject -- Ejects a CDROM
SDL_CDClose -- Closes a SDL_CD handle
SDL_CD -- CDROM Drive Information
SDL_CDtrack -- CD Track Information Structure

SDL supports audio control of up to 32 local CD-ROM drives at once.

You use this API to perform all the basic functions of a CD player, +including listing the tracks, playing, stopping, and ejecting the CD-ROM. +(Currently, multi-changer CD drives are not supported.)

Before you call any of the SDL CD-ROM functions, you must first call +"SDL_Init(SDL_INIT_CDROM)", which scans the system for +CD-ROM drives, and sets the program up for audio control. Check the +return code, which should be 0, to see if there +were any errors in starting up.

After you have initialized the library, you can find out how many drives +are available using the SDL_CDNumDrives() function. +The first drive listed is the system default CD-ROM drive. After you have +chosen a drive, and have opened it with SDL_CDOpen(), +you can check the status and start playing if there's a CD in the drive.

A CD-ROM is organized into one or more tracks, each consisting of a certain +number of "frames". Each frame is ~2K in size, and at normal playing speed, +a CD plays 75 frames per second. SDL works with the number of frames on a +CD, but this can easily be converted to the more familiar minutes/seconds +format by using the FRAMES_TO_MSF() macro.


PrevHomeNext
SDL_CloseAudioUpSDL_CDNumDrives
\ No newline at end of file diff --git a/SDL/docs/html/event.html b/SDL/docs/html/event.html new file mode 100644 index 0000000..0a83749 --- /dev/null +++ b/SDL/docs/html/event.html @@ -0,0 +1,216 @@ +Events
SDL Library Documentation
PrevNext

Chapter 8. Events

Introduction

Event handling allows your application to receive input from the user. Event handling is initalised (along with video) with a call to: +

SDL_Init(SDL_INIT_VIDEO);
+Internally, SDL stores all the events waiting to be handled in an event queue. Using functions like SDL_PollEvent and SDL_PeepEvents you can observe and handle waiting input events.

The key to event handling in SDL is the SDL_Event union. The event queue itself is composed of a series of SDL_Event unions, one for each waiting event. SDL_Event unions are read from the queue with the SDL_PollEvent function and it is then up to the application to process the information stored with them.


PrevHomeNext
SDL_WM_GrabInputUpSDL Event Structures.
\ No newline at end of file diff --git a/SDL/docs/html/eventfunctions.html b/SDL/docs/html/eventfunctions.html new file mode 100644 index 0000000..31ee9d1 --- /dev/null +++ b/SDL/docs/html/eventfunctions.html @@ -0,0 +1,481 @@ +Event Functions.
SDL Library Documentation
PrevChapter 8. EventsNext

Event Functions.

Table of Contents
SDL_PumpEvents -- Pumps the event loop, gathering events from the input devices.
SDL_PeepEvents -- Checks the event queue for messages and optionally returns them.
SDL_PollEvent -- Polls for currently pending events.
SDL_WaitEvent -- Waits indefinitely for the next available event.
SDL_PushEvent -- Pushes an event onto the event queue
SDL_SetEventFilter -- Sets up a filter to process all events before they are posted +to the event queue.
SDL_GetEventFilter -- Retrieves a pointer to he event filter
SDL_EventState -- This function allows you to set the state of processing certain events.
SDL_GetKeyState -- Get a snapshot of the current keyboard state
SDL_GetModState -- Get the state of modifier keys.
SDL_SetModState -- Set the current key modifier state
SDL_GetKeyName -- Get the name of an SDL virtual keysym
SDL_EnableUNICODE -- Enable UNICODE translation
SDL_EnableKeyRepeat -- Set keyboard repeat rate.
SDL_GetMouseState -- Retrieve the current state of the mouse
SDL_GetRelativeMouseState -- Retrieve the current state of the mouse
SDL_GetAppState -- Get the state of the application
SDL_JoystickEventState -- Enable/disable joystick event polling

SDL_PumpEventsPumps the event loop, gathering events from the input devices
SDL_PeepEventsChecks the event queue for messages and optionally returns them
SDL_PollEventPolls for currently pending events
SDL_WaitEventWaits indefinitely for the next available event
SDL_PushEventPushes an event onto the event queue
SDL_SetEventFilterSets up a filter to process all events
SDL_EventStateAllows you to set the state of processing certain events
SDL_GetKeyStateGet a snapshot of the current keyboard state
SDL_GetModStateGet the state of modifier keys
SDL_SetModStateSet the state of modifier keys
SDL_GetKeyNameGet the name of an SDL virtual keysym
SDL_EnableUNICODEEnable UNICODE translation
SDL_EnableKeyRepeatSet keyboard repeat rate
SDL_GetMouseStateRetrieve the current state of the mouse
SDL_GetRelativeMouseStateRetrieve the current state of the mouse
SDL_GetAppStateGet the state of the application
SDL_JoystickEventStateEnable/disable joystick event polling


PrevHomeNext
SDLKeyUpSDL_PumpEvents
\ No newline at end of file diff --git a/SDL/docs/html/eventstructures.html b/SDL/docs/html/eventstructures.html new file mode 100644 index 0000000..84d5e36 --- /dev/null +++ b/SDL/docs/html/eventstructures.html @@ -0,0 +1,233 @@ +SDL Event Structures.
SDL Library Documentation
PrevChapter 8. EventsNext

SDL Event Structures.

Table of Contents
SDL_Event -- General event structure
SDL_ActiveEvent -- Application visibility event structure
SDL_KeyboardEvent -- Keyboard event structure
SDL_MouseMotionEvent -- Mouse motion event structure
SDL_MouseButtonEvent -- Mouse button event structure
SDL_JoyAxisEvent -- Joystick axis motion event structure
SDL_JoyButtonEvent -- Joystick button event structure
SDL_JoyHatEvent -- Joystick hat position change event structure
SDL_JoyBallEvent -- Joystick trackball motion event structure
SDL_ResizeEvent -- Window resize event structure
SDL_ExposeEvent -- Quit requested event
SDL_SysWMEvent -- Platform-dependent window manager event.
SDL_UserEvent -- A user-defined event type
SDL_QuitEvent -- Quit requested event
SDL_keysym -- Keysym structure
SDLKey -- Keysym definitions.

PrevHomeNext
EventsUpSDL_Event
\ No newline at end of file diff --git a/SDL/docs/html/general.html b/SDL/docs/html/general.html new file mode 100644 index 0000000..7f424de --- /dev/null +++ b/SDL/docs/html/general.html @@ -0,0 +1,225 @@ +General
SDL Library Documentation
PrevNext

Chapter 5. General

Table of Contents
SDL_Init -- Initializes SDL
SDL_InitSubSystem -- Initialize subsystems
SDL_QuitSubSystem -- Shut down a subsystem
SDL_Quit -- Shut down SDL
SDL_WasInit -- Check which subsystems are initialized
SDL_GetError -- Get SDL error string
SDL_envvars -- SDL environment variables

Before SDL can be used in a program it must be initialized with SDL_Init. SDL_Init initializes all the subsystems that the user requests (video, audio, joystick, timers and/or cdrom). Once SDL is initialized with SDL_Init subsystems can be shut down and initialized as needed using SDL_InitSubSystem and SDL_QuitSubSystem.

SDL must also be shut down before the program exits to make sure it cleans up correctly. Calling SDL_Quit shuts down all subsystems and frees any resources allocated to SDL.


PrevHomeNext
SDL ReferenceUpSDL_Init
\ No newline at end of file diff --git a/SDL/docs/html/guide.html b/SDL/docs/html/guide.html new file mode 100644 index 0000000..24cc975 --- /dev/null +++ b/SDL/docs/html/guide.html @@ -0,0 +1,174 @@ +SDL Guide
SDL Library Documentation
PrevNext

I. SDL Guide


PrevHomeNext
SDL Library Documentation Preface
\ No newline at end of file diff --git a/SDL/docs/html/guideaboutsdldoc.html b/SDL/docs/html/guideaboutsdldoc.html new file mode 100644 index 0000000..e2aca1d --- /dev/null +++ b/SDL/docs/html/guideaboutsdldoc.html @@ -0,0 +1,148 @@ +About SDLdoc
SDL Library Documentation
PrevPrefaceNext

About SDLdoc

SDLdoc (The SDL Documentation Project) was formed to completely rewrite the SDL documentation and to keep it continually up to date. The team consists completely of volunteers ranging from people working with SDL in their spare time to people who use SDL in their everyday working lives.

The latest version of this documentation can always be found here: http://sdldoc.csn.ul.ie Downloadable PS, man pages and html tarballs are available at http://sdldoc.csn.ul.ie/pub/


PrevHomeNext
PrefaceUpCredits
\ No newline at end of file diff --git a/SDL/docs/html/guideaudioexamples.html b/SDL/docs/html/guideaudioexamples.html new file mode 100644 index 0000000..b94cd98 --- /dev/null +++ b/SDL/docs/html/guideaudioexamples.html @@ -0,0 +1,228 @@ +Audio Examples
SDL Library Documentation
PrevChapter 4. ExamplesNext

Audio Examples

Opening the audio device

    SDL_AudioSpec wanted;
+    extern void fill_audio(void *udata, Uint8 *stream, int len);
+
+    /* Set the audio format */
+    wanted.freq = 22050;
+    wanted.format = AUDIO_S16;
+    wanted.channels = 2;    /* 1 = mono, 2 = stereo */
+    wanted.samples = 1024;  /* Good low-latency value for callback */
+    wanted.callback = fill_audio;
+    wanted.userdata = NULL;
+
+    /* Open the audio device, forcing the desired format */
+    if ( SDL_OpenAudio(&wanted, NULL) < 0 ) {
+        fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
+        return(-1);
+    }
+    return(0);

Playing audio

    static Uint8 *audio_chunk;
+    static Uint32 audio_len;
+    static Uint8 *audio_pos;
+
+    /* The audio function callback takes the following parameters:
+       stream:  A pointer to the audio buffer to be filled
+       len:     The length (in bytes) of the audio buffer
+    */
+    void fill_audio(void *udata, Uint8 *stream, int len)
+    {
+        /* Only play if we have data left */
+        if ( audio_len == 0 )
+            return;
+
+        /* Mix as much data as possible */
+        len = ( len > audio_len ? audio_len : len );
+        SDL_MixAudio(stream, audio_pos, len, SDL_MIX_MAXVOLUME);
+        audio_pos += len;
+        audio_len -= len;
+    }
+
+    /* Load the audio data ... */
+
+    ;;;;;
+
+    audio_pos = audio_chunk;
+
+    /* Let the callback function play the audio chunk */
+    SDL_PauseAudio(0);
+
+    /* Do some processing */
+
+    ;;;;;
+
+    /* Wait for sound to complete */
+    while ( audio_len > 0 ) {
+        SDL_Delay(100);         /* Sleep 1/10 second */
+    }
+    SDL_CloseAudio();


PrevHomeNext
Event ExamplesUpCDROM Examples
\ No newline at end of file diff --git a/SDL/docs/html/guidebasicsinit.html b/SDL/docs/html/guidebasicsinit.html new file mode 100644 index 0000000..dfda26a --- /dev/null +++ b/SDL/docs/html/guidebasicsinit.html @@ -0,0 +1,240 @@ +Initializing SDL
SDL Library Documentation
PrevChapter 1. The BasicsNext

Initializing SDL

SDL is composed of eight subsystems - Audio, CDROM, Event Handling, File I/O, Joystick Handling, Threading, Timers and Video. Before you can use any of these subsystems they must be initialized by calling SDL_Init (or SDL_InitSubSystem). SDL_Init must be called before any other SDL function. It automatically initializes the Event Handling, File I/O and Threading subsystems and it takes a parameter specifying which other subsystems to initialize. So, to initialize the default subsystems and the Video subsystems you would call: +

    SDL_Init ( SDL_INIT_VIDEO );
+To initialize the default subsystems, the Video subsystem and the Timers subsystem you would call: +
    SDL_Init ( SDL_INIT_VIDEO | SDL_INIT_TIMER );

SDL_Init is complemented by SDL_Quit (and SDL_QuitSubSystem). SDL_Quit shuts down all subsystems, including the default ones. It should always be called before a SDL application exits.

With SDL_Init and SDL_Quit firmly embedded in your programmers toolkit you can write your first and most basic SDL application. However, we must be prepare to handle errors. Many SDL functions return a value and indicates whether the function has succeeded or failed, SDL_Init, for instance, returns -1 if it could not initialize a subsystem. SDL provides a useful facility that allows you to determine exactly what the problem was, every time an error occurs within SDL an error message is stored which can be retrieved using SDL_GetError. Use this often, you can never know too much about an error.

Example 1-1. Initializing SDL

#include "SDL.h"   /* All SDL App's need this */
+#include <stdio.h>
+
+int main(int argc, char *argv[]) {
+    
+    printf("Initializing SDL.\n");
+    
+    /* Initialize defaults, Video and Audio */
+    if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) { 
+        printf("Could not initialize SDL: %s.\n", SDL_GetError());
+        exit(-1);
+    }
+
+    printf("SDL initialized.\n");
+
+    printf("Quiting SDL.\n");
+    
+    /* Shutdown all subsystems */
+    SDL_Quit();
+    
+    printf("Quiting....\n");
+
+    exit(0);
+}

PrevHomeNext
The BasicsUpGraphics and Video
\ No newline at end of file diff --git a/SDL/docs/html/guidecdromexamples.html b/SDL/docs/html/guidecdromexamples.html new file mode 100644 index 0000000..54a6cf6 --- /dev/null +++ b/SDL/docs/html/guidecdromexamples.html @@ -0,0 +1,275 @@ +CDROM Examples
SDL Library Documentation
PrevChapter 4. ExamplesNext

CDROM Examples

Listing CD-ROM drives

    #include "SDL.h"
+
+    /* Initialize SDL first */
+    if ( SDL_Init(SDL_INIT_CDROM) < 0 ) {
+        fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
+        exit(1);
+    }
+    atexit(SDL_Quit);
+
+    /* Find out how many CD-ROM drives are connected to the system */
+    printf("Drives available: %d\n", SDL_CDNumDrives());
+    for ( i=0; i<SDL_CDNumDrives(); ++i ) {
+        printf("Drive %d:  \"%s\"\n", i, SDL_CDName(i));
+    }

Opening the default drive

    SDL_CD *cdrom;
+    CDstatus status;
+    char *status_str;
+
+    cdrom = SDL_CDOpen(0);
+    if ( cdrom == NULL ) {
+        fprintf(stderr, "Couldn't open default CD-ROM drive: %s\n",
+                        SDL_GetError());
+        exit(2);
+    }
+
+    status = SDL_CDStatus(cdrom);
+    switch (status) {
+        case CD_TRAYEMPTY:
+            status_str = "tray empty";
+            break;
+        case CD_STOPPED:
+            status_str = "stopped";
+            break;
+        case CD_PLAYING:
+            status_str = "playing";
+            break;
+        case CD_PAUSED:
+            status_str = "paused";
+            break;
+        case CD_ERROR:
+            status_str = "error state";
+            break;
+    }
+    printf("Drive status: %s\n", status_str);
+    if ( status >= CD_PLAYING ) {
+        int m, s, f;
+        FRAMES_TO_MSF(cdrom->cur_frame, &m, &s, &f);
+        printf("Currently playing track %d, %d:%2.2d\n",
+        cdrom->track[cdrom->cur_track].id, m, s);
+    }

Listing the tracks on a CD

    SDL_CD *cdrom;          /* Assuming this has already been set.. */
+    int i;
+    int m, s, f;
+
+    SDL_CDStatus(cdrom);
+    printf("Drive tracks: %d\n", cdrom->numtracks);
+    for ( i=0; i<cdrom->numtracks; ++i ) {
+        FRAMES_TO_MSF(cdrom->track[i].length, &m, &s, &f);
+        if ( f > 0 )
+            ++s;
+        printf("\tTrack (index %d) %d: %d:%2.2d\n", i,
+        cdrom->track[i].id, m, s);
+    }

Play an entire CD

    SDL_CD *cdrom;          /* Assuming this has already been set.. */
+
+    // Play entire CD:
+    if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
+        SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
+
+        // Play last track:
+        if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
+            SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
+        }
+
+        // Play first and second track and 10 seconds of third track:
+        if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
+            SDL_CDPlayTracks(cdrom, 0, 0, 2, CD_FPS * 10);


PrevHomeNext
Audio ExamplesUpTime Examples
\ No newline at end of file diff --git a/SDL/docs/html/guidecredits.html b/SDL/docs/html/guidecredits.html new file mode 100644 index 0000000..1ce353c --- /dev/null +++ b/SDL/docs/html/guidecredits.html @@ -0,0 +1,195 @@ +Credits
SDL Library Documentation
PrevPrefaceNext

Credits

Sam Lantinga, slouken@libsdl.org
Martin Donlon, akawaka@skynet.ie
Mattias Engdegård
Julian Peterson
Ken Jordan
Maxim Sobolev
Wesley Poole
Michael Vance
Andreas Umbach
Andreas Hofmeister


PrevHomeNext
About SDLdocUpThe Basics
\ No newline at end of file diff --git a/SDL/docs/html/guideeventexamples.html b/SDL/docs/html/guideeventexamples.html new file mode 100644 index 0000000..689cc0a --- /dev/null +++ b/SDL/docs/html/guideeventexamples.html @@ -0,0 +1,247 @@ +Event Examples
SDL Library Documentation
PrevChapter 4. ExamplesNext

Event Examples

Filtering and Handling Events

#include <stdio.h>
+#include <stdlib.h>
+
+#include "SDL.h"
+
+/* This function may run in a separate event thread */
+int FilterEvents(const SDL_Event *event) {
+    static int boycott = 1;
+
+    /* This quit event signals the closing of the window */
+    if ( (event->type == SDL_QUIT) && boycott ) {
+        printf("Quit event filtered out -- try again.\n");
+        boycott = 0;
+        return(0);
+    }
+    if ( event->type == SDL_MOUSEMOTION ) {
+        printf("Mouse moved to (%d,%d)\n",
+                event->motion.x, event->motion.y);
+        return(0);    /* Drop it, we've handled it */
+    }
+    return(1);
+}
+
+int main(int argc, char *argv[])
+{
+    SDL_Event event;
+
+    /* Initialize the SDL library (starts the event loop) */
+    if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
+        fprintf(stderr,
+                "Couldn't initialize SDL: %s\n", SDL_GetError());
+        exit(1);
+    }
+
+    /* Clean up on exit, exit on window close and interrupt */
+    atexit(SDL_Quit);
+
+    /* Ignore key events */
+    SDL_EventState(SDL_KEYDOWN, SDL_IGNORE);
+    SDL_EventState(SDL_KEYUP, SDL_IGNORE);
+
+    /* Filter quit and mouse motion events */
+    SDL_SetEventFilter(FilterEvents);
+
+    /* The mouse isn't much use unless we have a display for reference */
+    if ( SDL_SetVideoMode(640, 480, 8, 0) == NULL ) {
+        fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
+                        SDL_GetError());
+        exit(1);
+    }
+
+    /* Loop waiting for ESC+Mouse_Button */
+    while ( SDL_WaitEvent(&event) >= 0 ) {
+        switch (event.type) {
+            case SDL_ACTIVEEVENT: {
+                if ( event.active.state & SDL_APPACTIVE ) {
+                    if ( event.active.gain ) {
+                        printf("App activated\n");
+                    } else {
+                        printf("App iconified\n");
+                    }
+                }
+            }
+            break;
+                    
+            case SDL_MOUSEBUTTONDOWN: {
+                Uint8 *keys;
+
+                keys = SDL_GetKeyState(NULL);
+                if ( keys[SDLK_ESCAPE] == SDL_PRESSED ) {
+                    printf("Bye bye...\n");
+                    exit(0);
+                }
+                printf("Mouse button pressed\n");
+            }
+            break;
+
+            case SDL_QUIT: {
+                printf("Quit requested, quitting.\n");
+                exit(0);
+            }
+            break;
+        }
+    }
+    /* This should never happen */
+    printf("SDL_WaitEvent error: %s\n", SDL_GetError());
+    exit(1);
+}


PrevHomeNext
ExamplesUpAudio Examples
\ No newline at end of file diff --git a/SDL/docs/html/guideexamples.html b/SDL/docs/html/guideexamples.html new file mode 100644 index 0000000..e723ea3 --- /dev/null +++ b/SDL/docs/html/guideexamples.html @@ -0,0 +1,188 @@ +Examples
SDL Library Documentation
PrevNext

Chapter 4. Examples

Introduction

For the moment these examples are taken directly from the old SDL documentation. By the 1.2 release these examples should hopefully deal with most common SDL programming problems.


PrevHomeNext
Handling the KeyboardUpEvent Examples
\ No newline at end of file diff --git a/SDL/docs/html/guideinput.html b/SDL/docs/html/guideinput.html new file mode 100644 index 0000000..a54edba --- /dev/null +++ b/SDL/docs/html/guideinput.html @@ -0,0 +1,739 @@ +Input handling
SDL Library Documentation
PrevNext

Chapter 3. Input handling

Handling Joysticks

Initialization

The first step in using a joystick in a SDL program is to initialize the Joystick subsystems of SDL. This done by passing the SDL_INIT_JOYSTICK flag to SDL_Init. The joystick flag will usually be used in conjunction with other flags (like the video flag) because the joystick is usually used to control something.

Example 3-1. Initializing SDL with Joystick Support

    if (SDL_Init( SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) < 0)
+    {
+        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        exit(1);
+    }

This will attempt to start SDL with both the video and the joystick subsystems activated.

Querying

If we have reached this point then we can safely assume that the SDL library has been initialized and that the Joystick subsystem is active. We can now call some video and/or sound functions to get things going before we need the joystick. Eventually we have to make sure that there is actually a joystick to work with. It's wise to always check even if you know a joystick will be present on the system because it can also help detect when the joystick is unplugged. The function used to check for joysticks is SDL_NumJoysticks.

This function simply returns the number of joysticks available on the system. If it is at least one then we are in good shape. The next step is to determine which joystick the user wants to use. If the number of joysticks available is only one then it is safe to assume that one joystick is the one the user wants to use. SDL has a function to get the name of the joysticks as assigned by the operations system and that function is SDL_JoystickName. The joystick is specified by an index where 0 is the first joystick and the last joystick is the number returned by SDL_NumJoysticks - 1. In the demonstration a list of all available joysticks is printed to stdout.

Example 3-2. Querying the Number of Available Joysticks

    printf("%i joysticks were found.\n\n", SDL_NumJoysticks() );
+    printf("The names of the joysticks are:\n");
+		
+    for( i=0; i < SDL_NumJoysticks(); i++ ) 
+    {
+        printf("    %s\n", SDL_JoystickName(i));
+    }

Opening a Joystick and Receiving Joystick Events

SDL's event driven architecture makes working with joysticks a snap. Joysticks can trigger 4 different types of events: +

SDL_JoyAxisEventOccurs when an axis changes
SDL_JoyBallEventOccurs when a joystick trackball's position changes
SDL_JoyHatEventOccurs when a hat's position changes
SDL_JoyButtonEventOccurs when a button is pressed or released

Events are received from all joysticks opened. The first thing that needs to be done in order to receive joystick events is to call SDL_JoystickEventState with the SDL_ENABLE flag. Next you must open the joysticks that you want to receive envents from. This is done with the SDL_JoystickOpen function. For the example we are only interested in events from the first joystick on the system, regardless of what it may be. To receive events from it we would do this:

Example 3-3. Opening a Joystick

    SDL_Joystick *joystick;
+
+    SDL_JoystickEventState(SDL_ENABLE);
+    joystick = SDL_JoystickOpen(0);

If we wanted to receive events for other joysticks we would open them with calls to SDL_JoystickOpen just like we opened joystick 0, except we would store the SDL_Joystick structure they return in a different pointer. We only need the joystick pointer when we are querying the joysticks or when we are closing the joystick.

Up to this point all the code we have is used just to initialize the joysticks in order to read values at run time. All we need now is an event loop, which is something that all SDL programs should have anyway to receive the systems quit events. We must now add code to check the event loop for at least some of the above mentioned events. Let's assume our event loop looks like this: +

    SDL_Event event;
+    /* Other initializtion code goes here */   
+
+    /* Start main game loop here */
+
+    while(SDL_PollEvent(&event))
+    {  
+        switch(event.type)
+        {  
+            case SDL_KEYDOWN:
+            /* handle keyboard stuff here */				
+            break;
+
+            case SDL_QUIT:
+            /* Set whatever flags are necessary to */
+            /* end the main game loop here */
+            break;
+        }
+    }
+
+    /* End loop here */
+To handle Joystick events we merely add cases for them, first we'll add axis handling code. Axis checks can get kinda of tricky because alot of the joystick events received are junk. Joystick axis have a tendency to vary just a little between polling due to the way they are designed. To compensate for this you have to set a threshold for changes and ignore the events that have'nt exceeded the threshold. 10% is usually a good threshold value. This sounds a lot more complicated than it is. Here is the Axis event handler:

Example 3-4. Joystick Axis Events

    case SDL_JOYAXISMOTION:  /* Handle Joystick Motion */
+    if ( ( event.jaxis.value < -3200 ) || (event.jaxis.value > 3200 ) ) 
+    {
+      /* code goes here */
+    }
+    break;

Another trick with axis events is that up-down and left-right movement are two different sets of axes. The most important axis is axis 0 (left-right) and axis 1 (up-down). To handle them seperatly in the code we do the following:

Example 3-5. More Joystick Axis Events

    case SDL_JOYAXISMOTION:  /* Handle Joystick Motion */
+    if ( ( event.jaxis.value < -3200 ) || (event.jaxis.value > 3200 ) ) 
+    {
+        if( event.jaxis.axis == 0) 
+        {
+            /* Left-right movement code goes here */
+        }
+
+        if( event.jaxis.axis == 1) 
+        {
+            /* Up-Down movement code goes here */
+        }
+    }
+    break;

Ideally the code here should use event.jaxis.value to scale something. For example lets assume you are using the joystick to control the movement of a spaceship. If the user is using an analog joystick and they push the stick a little bit they expect to move less than if they pushed it a lot. Designing your code for this situation is preferred because it makes the experience for users of analog controls better and remains the same for users of digital controls.

If your joystick has any additional axis then they may be used for other sticks or throttle controls and those axis return values too just with different event.jaxis.axis values.

Button handling is simple compared to the axis checking.

Example 3-6. Joystick Button Events

    case SDL_JOYBUTTONDOWN:  /* Handle Joystick Button Presses */
+    if ( event.jbutton.button == 0 ) 
+    {
+        /* code goes here */
+    }
+    break;

Button checks are simpler than axis checks because a button can only be pressed or not pressed. The SDL_JOYBUTTONDOWN event is triggered when a button is pressed and the SDL_JOYBUTTONUP event is fired when a button is released. We do have to know what button was pressed though, that is done by reading the event.jbutton.button field.

Lastly when we are through using our joysticks we should close them with a call to SDL_JoystickClose. To close our opened joystick 0 we would do this at the end of our program: +

    SDL_JoystickClose(joystick);

Advanced Joystick Functions

That takes care of the controls that you can count on being on every joystick under the sun, but there are a few extra things that SDL can support. Joyballs are next on our list, they are alot like axis with a few minor differences. Joyballs store relative changes unlike the the absolute postion stored in a axis event. Also one trackball event contains both the change in x and they change in y. Our case for it is as follows:

Example 3-7. Joystick Ball Events

    case SDL_JOYBALLMOTION:  /* Handle Joyball Motion */
+    if( event.jball.ball == 0 )
+    {
+      /* ball handling */
+    }
+    break;

The above checks the first joyball on the joystick. The change in position will be stored in event.jball.xrel and event.jball.yrel.

Finally we have the hat event. Hats report only the direction they are pushed in. We check hat's position with the bitmasks: + +

SDL_HAT_CENTERED
SDL_HAT_UP
SDL_HAT_RIGHT
SDL_HAT_DOWN
SDL_HAT_LEFT

+ +Also there are some predefined combinations of the above: +

SDL_HAT_RIGHTUP
SDL_HAT_RIGHTDOWN
SDL_HAT_LEFTUP
SDL_HAT_LEFTDOWN

+ +Our case for the hat may resemble the following:

Example 3-8. Joystick Hat Events

    case SDL_JOYHATMOTION:  /* Handle Hat Motion */
+    if ( event.jhat.value & SDL_HAT_UP )
+    {
+        /* Do up stuff here */
+    }
+
+    if ( event.jhat.value & SDL_HAT_LEFT )
+    {
+        /* Do left stuff here */
+    }
+
+    if ( event.jhat.value & SDL_HAT_RIGHTDOWN )
+    {
+        /* Do right and down together stuff here */
+    }
+    break;

In addition to the queries for number of joysticks on the system and their names there are additional functions to query the capabilities of attached joysticks: +

SDL_JoystickNumAxesReturns the number of joysitck axes
SDL_JoystickNumButtonsReturns the number of joysitck buttons
SDL_JoystickNumBallsReturns the number of joysitck balls
SDL_JoystickNumHatsReturns the number of joysitck hats

+ +To use these functions we just have to pass in the joystick structure we got when we opened the joystick. For Example:

Example 3-9. Querying Joystick Characteristics

    int number_of_buttons;
+    SDL_Joystick *joystick;
+
+    joystick = SDL_JoystickOpen(0);
+    number_of_buttons = SDL_JoystickNumButtons(joystick);

This block of code would get the number of buttons on the first joystick in the system.


PrevHomeNext
Using OpenGL With SDLUpHandling the Keyboard
\ No newline at end of file diff --git a/SDL/docs/html/guideinputkeyboard.html b/SDL/docs/html/guideinputkeyboard.html new file mode 100644 index 0000000..306d8f6 --- /dev/null +++ b/SDL/docs/html/guideinputkeyboard.html @@ -0,0 +1,746 @@ +Handling the Keyboard
SDL Library Documentation
PrevChapter 3. Input handlingNext

Handling the Keyboard

Keyboard Related Structures

It should make it a lot easier to understand this tutorial is you are familiar with the data types involved in keyboard access, so I'll explain them first.

SDLKey

SDLKey is an enumerated type defined in SDL/include/SDL_keysym.h and detailed here. Each SDLKey symbol represents a key, SDLK_a corresponds to the 'a' key on a keyboard, SDLK_SPACE corresponds to the space bar, and so on.

SDLMod

SDLMod is an enumerated type, similar to SDLKey, however it enumerates keyboard modifiers (Control, Alt, Shift). The full list of modifier symbols is here. SDLMod values can be AND'd together to represent several modifiers.

SDL_keysym

typedef struct{
+  Uint8 scancode;
+  SDLKey sym;
+  SDLMod mod;
+  Uint16 unicode;
+} SDL_keysym;

The SDL_keysym structure describes a key press or a key release. The scancode field is hardware specific and should be ignored unless you know what your doing. The sym field is the SDLKey value of the key being pressed or released. The mod field describes the state of the keyboard modifiers at the time the key press or release occurred. So a value of KMOD_NUM | KMOD_CAPS | KMOD_LSHIFT would mean that Numlock, Capslock and the left shift key were all press (or enabled in the case of the lock keys). Finally, the unicode field stores the 16-bit unicode value of the key.

Note: It should be noted and understood that this field is only valid when the SDL_keysym is describing a key press, not a key release. Unicode values only make sense on a key press because the unicode value describes an international character and only key presses produce characters. More information on Unicode can be found at www.unicode.org

Note: Unicode translation must be enabled using the SDL_EnableUNICODE function.

SDL_KeyboardEvent

typedef struct{
+  Uint8 type;
+  Uint8 state;
+  SDL_keysym keysym;
+} SDL_KeyboardEvent;

The SDL_KeyboardEvent describes a keyboard event (obviously). The key member of the SDL_Event union is a SDL_KeyboardEvent structure. The type field specifies whether the event is a key release (SDL_KEYUP) or a key press (SDL_KEYDOWN) event. The state is largely redundant, it reports the same information as the type field but uses different values (SDL_RELEASED and SDL_PRESSED). The keysym contains information of the key press or release that this event represents (see above).

Reading Keyboard Events

Reading keybaord events from the event queue is quite simple (the event queue and using it is described here). We read events using SDL_PollEvent in a while() loop and check for SDL_KEYUP and SDL_KEYDOWN events using a switch statement, like so:

Example 3-10. Reading Keyboard Events

  SDL_Event event;
+  .
+  .
+  /* Poll for events. SDL_PollEvent() returns 0 when there are no  */
+  /* more events on the event queue, our while loop will exit when */
+  /* that occurs.                                                  */
+  while( SDL_PollEvent( &event ) ){
+    /* We are only worried about SDL_KEYDOWN and SDL_KEYUP events */
+    switch( event.type ){
+      case SDL_KEYDOWN:
+        printf( "Key press detected\n" );
+        break;
+
+      case SDL_KEYUP:
+        printf( "Key release detected\n" );
+        break;
+
+      default:
+        break;
+    }
+  }
+  .
+  .

This is a very basic example. No information about the key press or release is interpreted. We will explore the other extreme out our first full example below - reporting all available information about a keyboard event.

A More Detailed Look

Before we can read events SDL must be initialised with SDL_Init and a video mode must be set using SDL_SetVideoMode. There are, however, two other functions we must use to obtain all the information required. We must enable unicode translation by calling SDL_EnableUNICODE(1) and we must convert SDLKey values into something printable, using SDL_GetKeyName

Note: It is useful to note that unicode values < 0x80 translate directly a characters ASCII value. THis is used in the example below

Example 3-11. Interpreting Key Event Information


    #include "SDL.h"
+
+    /* Function Prototypes */
+    void PrintKeyInfo( SDL_KeyboardEvent *key );
+    void PrintModifiers( SDLMod mod );
+
+    /* main */
+    int main( int argc, char *argv[] ){
+        
+        SDL_Event event;
+        int quit = 0;
+        
+        /* Initialise SDL */
+        if( SDL_Init( SDL_INIT_VIDEO ) < 0){
+            fprintf( stderr, "Could not initialise SDL: %s\n", SDL_GetError() );
+            exit( -1 );
+        }
+
+        /* Set a video mode */
+        if( !SDL_SetVideoMode( 320, 200, 0, 0 ) ){
+            fprintf( stderr, "Could not set video mode: %s\n", SDL_GetError() );
+            SDL_Quit();
+            exit( -1 );
+        }
+
+        /* Enable Unicode translation */
+        SDL_EnableUNICODE( 1 );
+
+        /* Loop until an SDL_QUIT event is found */
+        while( !quit ){
+
+            /* Poll for events */
+            while( SDL_PollEvent( &event ) ){
+                
+                switch( event.type ){
+                    /* Keyboard event */
+                    /* Pass the event data onto PrintKeyInfo() */
+                    case SDL_KEYDOWN:
+                    case SDL_KEYUP:
+                        PrintKeyInfo( &event.key );
+                        break;
+
+                    /* SDL_QUIT event (window close) */
+                    case SDL_QUIT:
+                        quit = 1;
+                        break;
+
+                    default:
+                        break;
+                }
+
+            }
+
+        }
+
+        /* Clean up */
+        SDL_Quit();
+        exit( 0 );
+    }
+
+    /* Print all information about a key event */
+    void PrintKeyInfo( SDL_KeyboardEvent *key ){
+        /* Is it a release or a press? */
+        if( key->type == SDL_KEYUP )
+            printf( "Release:- " );
+        else
+            printf( "Press:- " );
+
+        /* Print the hardware scancode first */
+        printf( "Scancode: 0x%02X", key->keysym.scancode );
+        /* Print the name of the key */
+        printf( ", Name: %s", SDL_GetKeyName( key->keysym.sym ) );
+        /* We want to print the unicode info, but we need to make */
+        /* sure its a press event first (remember, release events */
+        /* don't have unicode info                                */
+        if( key->type == SDL_KEYDOWN ){
+            /* If the Unicode value is less than 0x80 then the    */
+            /* unicode value can be used to get a printable       */
+            /* representation of the key, using (char)unicode.    */
+            printf(", Unicode: " );
+            if( key->keysym.unicode < 0x80 && key->keysym.unicode > 0 ){
+                printf( "%c (0x%04X)", (char)key->keysym.unicode,
+                        key->keysym.unicode );
+            }
+            else{
+                printf( "? (0x%04X)", key->keysym.unicode );
+            }
+        }
+        printf( "\n" );
+        /* Print modifier info */
+        PrintModifiers( key->keysym.mod );
+    }
+
+    /* Print modifier info */
+    void PrintModifiers( SDLMod mod ){
+        printf( "Modifers: " );
+
+        /* If there are none then say so and return */
+        if( mod == KMOD_NONE ){
+            printf( "None\n" );
+            return;
+        }
+
+        /* Check for the presence of each SDLMod value */
+        /* This looks messy, but there really isn't    */
+        /* a clearer way.                              */
+        if( mod & KMOD_NUM ) printf( "NUMLOCK " );
+        if( mod & KMOD_CAPS ) printf( "CAPSLOCK " );
+        if( mod & KMOD_LCTRL ) printf( "LCTRL " );
+        if( mod & KMOD_RCTRL ) printf( "RCTRL " );
+        if( mod & KMOD_RSHIFT ) printf( "RSHIFT " );
+        if( mod & KMOD_LSHIFT ) printf( "LSHIFT " );
+        if( mod & KMOD_RALT ) printf( "RALT " );
+        if( mod & KMOD_LALT ) printf( "LALT " );
+        if( mod & KMOD_CTRL ) printf( "CTRL " );
+        if( mod & KMOD_SHIFT ) printf( "SHIFT " );
+        if( mod & KMOD_ALT ) printf( "ALT " );
+        printf( "\n" );
+    }

Game-type Input

I have found that people using keyboard events for games and other interactive applications don't always understand one fundemental point.

Keyboard events only take place when a keys state changes from being unpressed to pressed, and vice versa.

Imagine you have an image of an alien that you wish to move around using the cursor keys: when you pressed the left arrow key you want him to slide over to the left, and when you press the down key you want him to slide down the screen. Examine the following code; it highlights an error that many people have made. +

    /* Alien screen coordinates */
+    int alien_x=0, alien_y=0;
+    .
+    .
+    /* Initialise SDL and video modes and all that */
+    .
+    /* Main game loop */
+    /* Check for events */
+    while( SDL_PollEvent( &event ) ){
+        switch( event.type ){
+            /* Look for a keypress */
+            case SDL_KEYDOWN:
+                /* Check the SDLKey values and move change the coords */
+                switch( event.key.keysym.sym ){
+                    case SDLK_LEFT:
+                        alien_x -= 1;
+                        break;
+                    case SDLK_RIGHT:
+                        alien_x += 1;
+                        break;
+                    case SDLK_UP:
+                        alien_y -= 1;
+                        break;
+                    case SDLK_DOWN:
+                        alien_y += 1;
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+    }
+    .
+    .
+At first glance you may think this is a perfectly reasonable piece of code for the task, but it isn't. Like I said keyboard events only occur when a key changes state, so the user would have to press and release the left cursor key 100 times to move the alien 100 pixels to the left.

To get around this problem we must not use the events to change the position of the alien, we use the events to set flags which are then used in a seperate section of code to move the alien. Something like this:

Example 3-12. Proper Game Movement

    /* Alien screen coordinates */
+    int alien_x=0, alien_y=0;
+    int alien_xvel=0, alien_yvel=0;
+    .
+    .
+    /* Initialise SDL and video modes and all that */
+    .
+    /* Main game loop */
+    /* Check for events */
+    while( SDL_PollEvent( &event ) ){
+        switch( event.type ){
+            /* Look for a keypress */
+            case SDL_KEYDOWN:
+                /* Check the SDLKey values and move change the coords */
+                switch( event.key.keysym.sym ){
+                    case SDLK_LEFT:
+                        alien_xvel = -1;
+                        break;
+                    case SDLK_RIGHT:
+                        alien_xvel =  1;
+                        break;
+                    case SDLK_UP:
+                        alien_yvel = -1;
+                        break;
+                    case SDLK_DOWN:
+                        alien_yvel =  1;
+                        break;
+                    default:
+                        break;
+                }
+                break;
+            /* We must also use the SDL_KEYUP events to zero the x */
+            /* and y velocity variables. But we must also be       */
+            /* careful not to zero the velocities when we shouldn't*/
+            case SDL_KEYUP:
+                switch( event.key.keysym.sym ){
+                    case SDLK_LEFT:
+                        /* We check to make sure the alien is moving */
+                        /* to the left. If it is then we zero the    */
+                        /* velocity. If the alien is moving to the   */
+                        /* right then the right key is still press   */
+                        /* so we don't tocuh the velocity            */
+                        if( alien_xvel < 0 )
+                            alien_xvel = 0;
+                        break;
+                    case SDLK_RIGHT:
+                        if( alien_xvel > 0 )
+                            alien_xvel = 0;
+                        break;
+                    case SDLK_UP:
+                        if( alien_yvel < 0 )
+                            alien_yvel = 0;
+                        break;
+                    case SDLK_DOWN:
+                        if( alien_yvel > 0 )
+                            alien_yvel = 0;
+                        break;
+                    default:
+                        break;
+                }
+                break;
+            
+            default:
+                break;
+        }
+    }
+    .
+    .
+    /* Update the alien position */
+    alien_x += alien_xvel;
+    alien_y += alien_yvel;

As can be seen, we use two extra variables, alien_xvel and alien_yvel, which represent the motion of the ship, it is these variables that we update when we detect keypresses and releases.


PrevHomeNext
Input handlingUpExamples
\ No newline at end of file diff --git a/SDL/docs/html/guidepreface.html b/SDL/docs/html/guidepreface.html new file mode 100644 index 0000000..600b5fc --- /dev/null +++ b/SDL/docs/html/guidepreface.html @@ -0,0 +1,178 @@ +Preface
SDL Library Documentation
PrevNext

Preface

About SDL

The SDL library is designed to make it easy to write games that run on Linux, *BSD, MacOS, Win32 and BeOS using the various native high-performance media interfaces, (for video, audio, etc) and presenting a single source-code level API to your application. SDL is a fairly low level API, but using it, completely portable applications can be written with a great deal of flexibility.


PrevHomeNext
SDL GuideUpAbout SDLdoc
\ No newline at end of file diff --git a/SDL/docs/html/guidethebasics.html b/SDL/docs/html/guidethebasics.html new file mode 100644 index 0000000..512fcd6 --- /dev/null +++ b/SDL/docs/html/guidethebasics.html @@ -0,0 +1,173 @@ +The Basics
SDL Library Documentation
PrevNext

Chapter 1. The Basics

Introduction

The SDL Guide section is pretty incomplete. If you feel you have anything to add mail akawaka@skynet.ie or visit http://akawaka.csn.ul.ie/tne/.


PrevHomeNext
CreditsUpInitializing SDL
\ No newline at end of file diff --git a/SDL/docs/html/guidetimeexamples.html b/SDL/docs/html/guidetimeexamples.html new file mode 100644 index 0000000..aea798e --- /dev/null +++ b/SDL/docs/html/guidetimeexamples.html @@ -0,0 +1,183 @@ +Time Examples
SDL Library Documentation
PrevChapter 4. ExamplesNext

Time Examples

Time based game loop

#define TICK_INTERVAL    30
+
+static Uint32 next_time;
+
+Uint32 time_left(void)
+{
+    Uint32 now;
+
+    now = SDL_GetTicks();
+    if(next_time <= now)
+        return 0;
+    else
+        return next_time - now;
+}
+
+
+/* main game loop */
+
+    next_time = SDL_GetTicks() + TICK_INTERVAL;
+    while ( game_running ) {
+        update_game_state();
+        SDL_Delay(time_left());
+        next_time += TICK_INTERVAL;
+    }


PrevHomeNext
CDROM ExamplesUpSDL Reference
\ No newline at end of file diff --git a/SDL/docs/html/guidevideo.html b/SDL/docs/html/guidevideo.html new file mode 100644 index 0000000..5e86874 --- /dev/null +++ b/SDL/docs/html/guidevideo.html @@ -0,0 +1,463 @@ +Graphics and Video
SDL Library Documentation
PrevNext

Chapter 2. Graphics and Video

Introduction to SDL Video

Video is probably the most common thing that SDL is used for, and +so it has the most complete subsystem. Here are a few +examples to demonstrate the basics.

Initializing the Video Display

This is what almost all SDL programs have to do in one way or +another.

Example 2-1. Initializing the Video Display

    SDL_Surface *screen;
+
+    /* Initialize the SDL library */
+    if( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
+        fprintf(stderr,
+                "Couldn't initialize SDL: %s\n", SDL_GetError());
+        exit(1);
+    }
+
+    /* Clean up on exit */
+    atexit(SDL_Quit);
+    
+    /*
+     * Initialize the display in a 640x480 8-bit palettized mode,
+     * requesting a software surface
+     */
+    screen = SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE);
+    if ( screen == NULL ) {
+        fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
+                        SDL_GetError());
+        exit(1);
+    }

Initializing the Best Video Mode

If you have a preference for a certain pixel depth but will accept any +other, use SDL_SetVideoMode with SDL_ANYFORMAT as below. You can also +use SDL_VideoModeOK() to find the native video mode that is closest to +the mode you request.

Example 2-2. Initializing the Best Video Mode

    /* Have a preference for 8-bit, but accept any depth */
+    screen = SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE|SDL_ANYFORMAT);
+    if ( screen == NULL ) {
+        fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
+                        SDL_GetError());
+        exit(1);
+    }
+    printf("Set 640x480 at %d bits-per-pixel mode\n",
+           screen->format->BitsPerPixel);

Loading and Displaying a BMP File

The following function loads and displays a BMP file given as +argument, once SDL is initialised and a video mode has been set.

Example 2-3. Loading and Displaying a BMP File

void display_bmp(char *file_name)
+{
+    SDL_Surface *image;
+
+    /* Load the BMP file into a surface */
+    image = SDL_LoadBMP(file_name);
+    if (image == NULL) {
+        fprintf(stderr, "Couldn't load %s: %s\n", file_name, SDL_GetError());
+        return;
+    }
+
+    /*
+     * Palettized screen modes will have a default palette (a standard
+     * 8*8*4 colour cube), but if the image is palettized as well we can
+     * use that palette for a nicer colour matching
+     */
+    if (image->format->palette && screen->format->palette) {
+    SDL_SetColors(screen, image->format->palette->colors, 0,
+                  image->format->palette->ncolors);
+    }
+
+    /* Blit onto the screen surface */
+    if(SDL_BlitSurface(image, NULL, screen, NULL) < 0)
+        fprintf(stderr, "BlitSurface error: %s\n", SDL_GetError());
+
+    SDL_UpdateRect(screen, 0, 0, image->w, image->h);
+
+    /* Free the allocated BMP surface */
+    SDL_FreeSurface(image);
+}

Drawing Directly to the Display

The following two functions can be used to get and set single +pixels of a surface. They are carefully written to work with any depth +currently supported by SDL. Remember to lock the surface before +calling them, and to unlock it before calling any other SDL +functions.

To convert between pixel values and their red, green, blue +components, use SDL_GetRGB() and SDL_MapRGB().

Example 2-4. getpixel()

/*
+ * Return the pixel value at (x, y)
+ * NOTE: The surface must be locked before calling this!
+ */
+Uint32 getpixel(SDL_Surface *surface, int x, int y)
+{
+    int bpp = surface->format->BytesPerPixel;
+    /* Here p is the address to the pixel we want to retrieve */
+    Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
+
+    switch(bpp) {
+    case 1:
+        return *p;
+
+    case 2:
+        return *(Uint16 *)p;
+
+    case 3:
+        if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
+            return p[0] << 16 | p[1] << 8 | p[2];
+        else
+            return p[0] | p[1] << 8 | p[2] << 16;
+
+    case 4:
+        return *(Uint32 *)p;
+
+    default:
+        return 0;       /* shouldn't happen, but avoids warnings */
+    }
+}

Example 2-5. putpixel()

/*
+ * Set the pixel at (x, y) to the given value
+ * NOTE: The surface must be locked before calling this!
+ */
+void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
+{
+    int bpp = surface->format->BytesPerPixel;
+    /* Here p is the address to the pixel we want to set */
+    Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
+
+    switch(bpp) {
+    case 1:
+        *p = pixel;
+        break;
+
+    case 2:
+        *(Uint16 *)p = pixel;
+        break;
+
+    case 3:
+        if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+            p[0] = (pixel >> 16) & 0xff;
+            p[1] = (pixel >> 8) & 0xff;
+            p[2] = pixel & 0xff;
+        } else {
+            p[0] = pixel & 0xff;
+            p[1] = (pixel >> 8) & 0xff;
+            p[2] = (pixel >> 16) & 0xff;
+        }
+        break;
+
+    case 4:
+        *(Uint32 *)p = pixel;
+        break;
+    }
+}

The following code uses the putpixel() function above to set a +yellow pixel in the middle of the screen.

Example 2-6. Using putpixel()


    /* Code to set a yellow pixel at the center of the screen */
+
+    int x, y;
+    Uint32 yellow;
+
+    /* Map the color yellow to this display (R=0xff, G=0xFF, B=0x00)
+       Note:  If the display is palettized, you must set the palette first.
+    */
+    yellow = SDL_MapRGB(screen->format, 0xff, 0xff, 0x00);
+
+    x = screen->w / 2;
+    y = screen->h / 2;
+
+    /* Lock the screen for direct access to the pixels */
+    if ( SDL_MUSTLOCK(screen) ) {
+        if ( SDL_LockSurface(screen) < 0 ) {
+            fprintf(stderr, "Can't lock screen: %s\n", SDL_GetError());
+            return;
+        }
+    }
+
+    putpixel(screen, x, y, yellow);
+
+    if ( SDL_MUSTLOCK(screen) ) {
+        SDL_UnlockSurface(screen);
+    }
+    /* Update just the part of the display that we've changed */
+    SDL_UpdateRect(screen, x, y, 1, 1);
+
+    return;

PrevHomeNext
Initializing SDLUpUsing OpenGL With SDL
\ No newline at end of file diff --git a/SDL/docs/html/guidevideoopengl.html b/SDL/docs/html/guidevideoopengl.html new file mode 100644 index 0000000..21924ed --- /dev/null +++ b/SDL/docs/html/guidevideoopengl.html @@ -0,0 +1,730 @@ +Using OpenGL With SDL
SDL Library Documentation
PrevChapter 2. Graphics and VideoNext

Using OpenGL With SDL

SDL has the ability to create and use OpenGL contexts on several platforms(Linux/X11, Win32, BeOS, MacOS Classic/Toolbox, Mac OS X, FreeBSD/X11 and Solaris/X11). This allows you to use SDL's audio, event handling, threads and times in your OpenGL applications (a function often performed by GLUT).

Initialisation

Initialising SDL to use OpenGL is not very different to initialising SDL normally. There are three differences; you must pass SDL_OPENGL to SDL_SetVideoMode, you must specify several GL attributes (depth buffer size, framebuffer sizes) using SDL_GL_SetAttribute and finally, if you wish to use double buffering you must specify it as a GL attribute, not by passing the SDL_DOUBLEBUF flag to SDL_SetVideoMode.

Example 2-7. Initializing SDL with OpenGL

    /* Information about the current video settings. */
+    const SDL_VideoInfo* info = NULL;
+    /* Dimensions of our window. */
+    int width = 0;
+    int height = 0;
+    /* Color depth in bits of our window. */
+    int bpp = 0;
+    /* Flags we will pass into SDL_SetVideoMode. */
+    int flags = 0;
+
+    /* First, initialize SDL's video subsystem. */
+    if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
+        /* Failed, exit. */
+        fprintf( stderr, "Video initialization failed: %s\n",
+             SDL_GetError( ) );
+        quit_tutorial( 1 );
+    }
+
+    /* Let's get some video information. */
+    info = SDL_GetVideoInfo( );
+
+    if( !info ) {
+        /* This should probably never happen. */
+        fprintf( stderr, "Video query failed: %s\n",
+             SDL_GetError( ) );
+        quit_tutorial( 1 );
+    }
+
+    /*
+     * Set our width/height to 640/480 (you would
+     * of course let the user decide this in a normal
+     * app). We get the bpp we will request from
+     * the display. On X11, VidMode can't change
+     * resolution, so this is probably being overly
+     * safe. Under Win32, ChangeDisplaySettings
+     * can change the bpp.
+     */
+    width = 640;
+    height = 480;
+    bpp = info->vfmt->BitsPerPixel;
+
+    /*
+     * Now, we want to setup our requested
+     * window attributes for our OpenGL window.
+     * We want *at least* 5 bits of red, green
+     * and blue. We also want at least a 16-bit
+     * depth buffer.
+     *
+     * The last thing we do is request a double
+     * buffered window. '1' turns on double
+     * buffering, '0' turns it off.
+     *
+     * Note that we do not use SDL_DOUBLEBUF in
+     * the flags to SDL_SetVideoMode. That does
+     * not affect the GL attribute state, only
+     * the standard 2D blitting setup.
+     */
+    SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
+    SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
+    SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
+    SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
+    SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
+
+    /*
+     * We want to request that SDL provide us
+     * with an OpenGL window, in a fullscreen
+     * video mode.
+     *
+     * EXERCISE:
+     * Make starting windowed an option, and
+     * handle the resize events properly with
+     * glViewport.
+     */
+    flags = SDL_OPENGL | SDL_FULLSCREEN;
+
+    /*
+     * Set the video mode
+     */
+    if( SDL_SetVideoMode( width, height, bpp, flags ) == 0 ) {
+        /* 
+         * This could happen for a variety of reasons,
+         * including DISPLAY not being set, the specified
+         * resolution not being available, etc.
+         */
+        fprintf( stderr, "Video mode set failed: %s\n",
+             SDL_GetError( ) );
+        quit_tutorial( 1 );
+    }

Drawing

Apart from initialisation, using OpenGL within SDL is the same as using OpenGL +with any other API, e.g. GLUT. You still use all the same function calls and +data types. However if you are using a double-buffered display, then you must +use +SDL_GL_SwapBuffers() +to swap the buffers and update the display. To request double-buffering +with OpenGL, use +SDL_GL_SetAttribute +with SDL_GL_DOUBLEBUFFER, and use +SDL_GL_GetAttribute +to see if you actually got it.

A full example code listing is now presented below.

Example 2-8. SDL and OpenGL

/*
+ * SDL OpenGL Tutorial.
+ * (c) Michael Vance, 2000
+ * briareos@lokigames.com
+ *
+ * Distributed under terms of the LGPL. 
+ */
+
+#include <SDL/SDL.h>
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+static GLboolean should_rotate = GL_TRUE;
+
+static void quit_tutorial( int code )
+{
+    /*
+     * Quit SDL so we can release the fullscreen
+     * mode and restore the previous video settings,
+     * etc.
+     */
+    SDL_Quit( );
+
+    /* Exit program. */
+    exit( code );
+}
+
+static void handle_key_down( SDL_keysym* keysym )
+{
+
+    /* 
+     * We're only interested if 'Esc' has
+     * been presssed.
+     *
+     * EXERCISE: 
+     * Handle the arrow keys and have that change the
+     * viewing position/angle.
+     */
+    switch( keysym->sym ) {
+    case SDLK_ESCAPE:
+        quit_tutorial( 0 );
+        break;
+    case SDLK_SPACE:
+        should_rotate = !should_rotate;
+        break;
+    default:
+        break;
+    }
+
+}
+
+static void process_events( void )
+{
+    /* Our SDL event placeholder. */
+    SDL_Event event;
+
+    /* Grab all the events off the queue. */
+    while( SDL_PollEvent( &event ) ) {
+
+        switch( event.type ) {
+        case SDL_KEYDOWN:
+            /* Handle key presses. */
+            handle_key_down( &event.key.keysym );
+            break;
+        case SDL_QUIT:
+            /* Handle quit requests (like Ctrl-c). */
+            quit_tutorial( 0 );
+            break;
+        }
+
+    }
+
+}
+
+static void draw_screen( void )
+{
+    /* Our angle of rotation. */
+    static float angle = 0.0f;
+
+    /*
+     * EXERCISE:
+     * Replace this awful mess with vertex
+     * arrays and a call to glDrawElements.
+     *
+     * EXERCISE:
+     * After completing the above, change
+     * it to use compiled vertex arrays.
+     *
+     * EXERCISE:
+     * Verify my windings are correct here ;).
+     */
+    static GLfloat v0[] = { -1.0f, -1.0f,  1.0f };
+    static GLfloat v1[] = {  1.0f, -1.0f,  1.0f };
+    static GLfloat v2[] = {  1.0f,  1.0f,  1.0f };
+    static GLfloat v3[] = { -1.0f,  1.0f,  1.0f };
+    static GLfloat v4[] = { -1.0f, -1.0f, -1.0f };
+    static GLfloat v5[] = {  1.0f, -1.0f, -1.0f };
+    static GLfloat v6[] = {  1.0f,  1.0f, -1.0f };
+    static GLfloat v7[] = { -1.0f,  1.0f, -1.0f };
+    static GLubyte red[]    = { 255,   0,   0, 255 };
+    static GLubyte green[]  = {   0, 255,   0, 255 };
+    static GLubyte blue[]   = {   0,   0, 255, 255 };
+    static GLubyte white[]  = { 255, 255, 255, 255 };
+    static GLubyte yellow[] = {   0, 255, 255, 255 };
+    static GLubyte black[]  = {   0,   0,   0, 255 };
+    static GLubyte orange[] = { 255, 255,   0, 255 };
+    static GLubyte purple[] = { 255,   0, 255,   0 };
+
+    /* Clear the color and depth buffers. */
+    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+
+    /* We don't want to modify the projection matrix. */
+    glMatrixMode( GL_MODELVIEW );
+    glLoadIdentity( );
+
+    /* Move down the z-axis. */
+    glTranslatef( 0.0, 0.0, -5.0 );
+
+    /* Rotate. */
+    glRotatef( angle, 0.0, 1.0, 0.0 );
+
+    if( should_rotate ) {
+
+        if( ++angle > 360.0f ) {
+            angle = 0.0f;
+        }
+
+    }
+
+    /* Send our triangle data to the pipeline. */
+    glBegin( GL_TRIANGLES );
+
+    glColor4ubv( red );
+    glVertex3fv( v0 );
+    glColor4ubv( green );
+    glVertex3fv( v1 );
+    glColor4ubv( blue );
+    glVertex3fv( v2 );
+
+    glColor4ubv( red );
+    glVertex3fv( v0 );
+    glColor4ubv( blue );
+    glVertex3fv( v2 );
+    glColor4ubv( white );
+    glVertex3fv( v3 );
+
+    glColor4ubv( green );
+    glVertex3fv( v1 );
+    glColor4ubv( black );
+    glVertex3fv( v5 );
+    glColor4ubv( orange );
+    glVertex3fv( v6 );
+
+    glColor4ubv( green );
+    glVertex3fv( v1 );
+    glColor4ubv( orange );
+    glVertex3fv( v6 );
+    glColor4ubv( blue );
+    glVertex3fv( v2 );
+
+    glColor4ubv( black );
+    glVertex3fv( v5 );
+    glColor4ubv( yellow );
+    glVertex3fv( v4 );
+    glColor4ubv( purple );
+    glVertex3fv( v7 );
+
+    glColor4ubv( black );
+    glVertex3fv( v5 );
+    glColor4ubv( purple );
+    glVertex3fv( v7 );
+    glColor4ubv( orange );
+    glVertex3fv( v6 );
+
+    glColor4ubv( yellow );
+    glVertex3fv( v4 );
+    glColor4ubv( red );
+    glVertex3fv( v0 );
+    glColor4ubv( white );
+    glVertex3fv( v3 );
+
+    glColor4ubv( yellow );
+    glVertex3fv( v4 );
+    glColor4ubv( white );
+    glVertex3fv( v3 );
+    glColor4ubv( purple );
+    glVertex3fv( v7 );
+
+    glColor4ubv( white );
+    glVertex3fv( v3 );
+    glColor4ubv( blue );
+    glVertex3fv( v2 );
+    glColor4ubv( orange );
+    glVertex3fv( v6 );
+
+    glColor4ubv( white );
+    glVertex3fv( v3 );
+    glColor4ubv( orange );
+    glVertex3fv( v6 );
+    glColor4ubv( purple );
+    glVertex3fv( v7 );
+
+    glColor4ubv( green );
+    glVertex3fv( v1 );
+    glColor4ubv( red );
+    glVertex3fv( v0 );
+    glColor4ubv( yellow );
+    glVertex3fv( v4 );
+
+    glColor4ubv( green );
+    glVertex3fv( v1 );
+    glColor4ubv( yellow );
+    glVertex3fv( v4 );
+    glColor4ubv( black );
+    glVertex3fv( v5 );
+
+    glEnd( );
+
+    /*
+     * EXERCISE:
+     * Draw text telling the user that 'Spc'
+     * pauses the rotation and 'Esc' quits.
+     * Do it using vetors and textured quads.
+     */
+
+    /*
+     * Swap the buffers. This this tells the driver to
+     * render the next frame from the contents of the
+     * back-buffer, and to set all rendering operations
+     * to occur on what was the front-buffer.
+     *
+     * Double buffering prevents nasty visual tearing
+     * from the application drawing on areas of the
+     * screen that are being updated at the same time.
+     */
+    SDL_GL_SwapBuffers( );
+}
+
+static void setup_opengl( int width, int height )
+{
+    float ratio = (float) width / (float) height;
+
+    /* Our shading model--Gouraud (smooth). */
+    glShadeModel( GL_SMOOTH );
+
+    /* Culling. */
+    glCullFace( GL_BACK );
+    glFrontFace( GL_CCW );
+    glEnable( GL_CULL_FACE );
+
+    /* Set the clear color. */
+    glClearColor( 0, 0, 0, 0 );
+
+    /* Setup our viewport. */
+    glViewport( 0, 0, width, height );
+
+    /*
+     * Change to the projection matrix and set
+     * our viewing volume.
+     */
+    glMatrixMode( GL_PROJECTION );
+    glLoadIdentity( );
+    /*
+     * EXERCISE:
+     * Replace this with a call to glFrustum.
+     */
+    gluPerspective( 60.0, ratio, 1.0, 1024.0 );
+}
+
+int main( int argc, char* argv[] )
+{
+    /* Information about the current video settings. */
+    const SDL_VideoInfo* info = NULL;
+    /* Dimensions of our window. */
+    int width = 0;
+    int height = 0;
+    /* Color depth in bits of our window. */
+    int bpp = 0;
+    /* Flags we will pass into SDL_SetVideoMode. */
+    int flags = 0;
+
+    /* First, initialize SDL's video subsystem. */
+    if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
+        /* Failed, exit. */
+        fprintf( stderr, "Video initialization failed: %s\n",
+             SDL_GetError( ) );
+        quit_tutorial( 1 );
+    }
+
+    /* Let's get some video information. */
+    info = SDL_GetVideoInfo( );
+
+    if( !info ) {
+        /* This should probably never happen. */
+        fprintf( stderr, "Video query failed: %s\n",
+             SDL_GetError( ) );
+        quit_tutorial( 1 );
+    }
+
+    /*
+     * Set our width/height to 640/480 (you would
+     * of course let the user decide this in a normal
+     * app). We get the bpp we will request from
+     * the display. On X11, VidMode can't change
+     * resolution, so this is probably being overly
+     * safe. Under Win32, ChangeDisplaySettings
+     * can change the bpp.
+     */
+    width = 640;
+    height = 480;
+    bpp = info->vfmt->BitsPerPixel;
+
+    /*
+     * Now, we want to setup our requested
+     * window attributes for our OpenGL window.
+     * We want *at least* 5 bits of red, green
+     * and blue. We also want at least a 16-bit
+     * depth buffer.
+     *
+     * The last thing we do is request a double
+     * buffered window. '1' turns on double
+     * buffering, '0' turns it off.
+     *
+     * Note that we do not use SDL_DOUBLEBUF in
+     * the flags to SDL_SetVideoMode. That does
+     * not affect the GL attribute state, only
+     * the standard 2D blitting setup.
+     */
+    SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
+    SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
+    SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
+    SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
+    SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
+
+    /*
+     * We want to request that SDL provide us
+     * with an OpenGL window, in a fullscreen
+     * video mode.
+     *
+     * EXERCISE:
+     * Make starting windowed an option, and
+     * handle the resize events properly with
+     * glViewport.
+     */
+    flags = SDL_OPENGL | SDL_FULLSCREEN;
+
+    /*
+     * Set the video mode
+     */
+    if( SDL_SetVideoMode( width, height, bpp, flags ) == 0 ) {
+        /* 
+         * This could happen for a variety of reasons,
+         * including DISPLAY not being set, the specified
+         * resolution not being available, etc.
+         */
+        fprintf( stderr, "Video mode set failed: %s\n",
+             SDL_GetError( ) );
+        quit_tutorial( 1 );
+    }
+
+    /*
+     * At this point, we should have a properly setup
+     * double-buffered window for use with OpenGL.
+     */
+    setup_opengl( width, height );
+
+    /*
+     * Now we want to begin our normal app process--
+     * an event loop with a lot of redrawing.
+     */
+    while( 1 ) {
+        /* Process incoming events. */
+        process_events( );
+        /* Draw the screen. */
+        draw_screen( );
+    }
+
+    /*
+     * EXERCISE:
+     * Record timings using SDL_GetTicks() and
+     * and print out frames per second at program
+     * end.
+     */
+
+    /* Never reached. */
+    return 0;
+}

PrevHomeNext
Graphics and VideoUpInput handling
\ No newline at end of file diff --git a/SDL/docs/html/index.html b/SDL/docs/html/index.html new file mode 100644 index 0000000..a163852 --- /dev/null +++ b/SDL/docs/html/index.html @@ -0,0 +1,1156 @@ +
Table of Contents
I. SDL Guide
Preface
About SDL
About SDLdoc
Credits
1. The Basics
Introduction
Initializing SDL
2. Graphics and Video
Introduction to SDL Video
Using OpenGL With SDL
3. Input handling
Handling Joysticks
Handling the Keyboard
4. Examples
Introduction
Event Examples
Audio Examples
CDROM Examples
Time Examples
II. SDL Reference
5. General
SDL_Init -- Initializes SDL
SDL_InitSubSystem -- Initialize subsystems
SDL_QuitSubSystem -- Shut down a subsystem
SDL_Quit -- Shut down SDL
SDL_WasInit -- Check which subsystems are initialized
SDL_GetError -- Get SDL error string
SDL_envvars -- SDL environment variables
6. Video
SDL_GetVideoSurface -- returns a pointer to the current display surface
SDL_GetVideoInfo -- returns a pointer to information about the video hardware
SDL_VideoDriverName -- Obtain the name of the video driver
SDL_ListModes -- Returns a pointer to an array of available screen dimensions for +the given format and video flags
SDL_VideoModeOK -- Check to see if a particular video mode is supported.
SDL_SetVideoMode -- Set up a video mode with the specified width, height and bits-per-pixel.
SDL_UpdateRect -- Makes sure the given area is updated on the given screen.
SDL_UpdateRects -- Makes sure the given list of rectangles is updated on the given screen.
SDL_Flip -- Swaps screen buffers
SDL_SetColors -- Sets a portion of the colormap for the given 8-bit surface.
SDL_SetPalette -- Sets the colors in the palette of an 8-bit surface.
SDL_SetGamma -- Sets the color gamma function for the display
SDL_GetGammaRamp -- Gets the color gamma lookup tables for the display
SDL_SetGammaRamp -- Sets the color gamma lookup tables for the display
SDL_MapRGB -- Map a RGB color value to a pixel format.
SDL_MapRGBA -- Map a RGBA color value to a pixel format.
SDL_GetRGB -- Get RGB values from a pixel in the specified pixel format.
SDL_GetRGBA -- Get RGBA values from a pixel in the specified pixel format.
SDL_CreateRGBSurface -- Create an empty SDL_Surface
SDL_CreateRGBSurfaceFrom -- Create an SDL_Surface from pixel data
SDL_FreeSurface -- Frees (deletes) a SDL_Surface
SDL_LockSurface -- Lock a surface for directly access.
SDL_UnlockSurface -- Unlocks a previously locked surface.
SDL_LoadBMP -- Load a Windows BMP file into an SDL_Surface.
SDL_SaveBMP -- Save an SDL_Surface as a Windows BMP file.
SDL_SetColorKey -- Sets the color key (transparent pixel) in a blittable surface and +RLE acceleration.
SDL_SetAlpha -- Adjust the alpha properties of a surface
SDL_SetClipRect -- Sets the clipping rectangle for a surface.
SDL_GetClipRect -- Gets the clipping rectangle for a surface.
SDL_ConvertSurface -- Converts a surface to the same format as another surface.
SDL_BlitSurface -- This performs a fast blit from the source surface to the destination surface.
SDL_FillRect -- This function performs a fast fill of the given rectangle with some color
SDL_DisplayFormat -- Convert a surface to the display format
SDL_DisplayFormatAlpha -- Convert a surface to the display format
SDL_WarpMouse -- Set the position of the mouse cursor.
SDL_CreateCursor -- Creates a new mouse cursor.
SDL_FreeCursor -- Frees a cursor created with SDL_CreateCursor.
SDL_SetCursor -- Set the currently active mouse cursor.
SDL_GetCursor -- Get the currently active mouse cursor.
SDL_ShowCursor -- Toggle whether or not the cursor is shown on the screen.
SDL_GL_LoadLibrary -- Specify an OpenGL library
SDL_GL_GetProcAddress -- Get the address of a GL function
SDL_GL_GetAttribute -- Get the value of a special SDL/OpenGL attribute
SDL_GL_SetAttribute -- Set a special SDL/OpenGL attribute
SDL_GL_SwapBuffers -- Swap OpenGL framebuffers/Update Display
SDL_CreateYUVOverlay -- Create a YUV video overlay
SDL_LockYUVOverlay -- Lock an overlay
SDL_UnlockYUVOverlay -- Unlock an overlay
SDL_DisplayYUVOverlay -- Blit the overlay to the display
SDL_FreeYUVOverlay -- Free a YUV video overlay
SDL_GLattr -- SDL GL Attributes
SDL_Rect -- Defines a rectangular area
SDL_Color -- Format independent color description
SDL_Palette -- Color palette for 8-bit pixel formats
SDL_PixelFormat -- Stores surface format information
SDL_Surface -- Graphical Surface Structure
SDL_VideoInfo -- Video Target information
SDL_Overlay -- YUV video overlay
7. Window Management
SDL_WM_SetCaption -- Sets the window tile and icon name.
SDL_WM_GetCaption -- Gets the window title and icon name.
SDL_WM_SetIcon -- Sets the icon for the display window.
SDL_WM_IconifyWindow -- Iconify/Minimise the window
SDL_WM_ToggleFullScreen -- Toggles fullscreen mode
SDL_WM_GrabInput -- Grabs mouse and keyboard input.
8. Events
Introduction
SDL Event Structures.
Event Functions.
9. Joystick
SDL_NumJoysticks -- Count available joysticks.
SDL_JoystickName -- Get joystick name.
SDL_JoystickOpen -- Opens a joystick for use.
SDL_JoystickOpened -- Determine if a joystick has been opened
SDL_JoystickIndex -- Get the index of an SDL_Joystick.
SDL_JoystickNumAxes -- Get the number of joystick axes
SDL_JoystickNumBalls -- Get the number of joystick trackballs
SDL_JoystickNumHats -- Get the number of joystick hats
SDL_JoystickNumButtons -- Get the number of joysitck buttons
SDL_JoystickUpdate -- Updates the state of all joysticks
SDL_JoystickGetAxis -- Get the current state of an axis
SDL_JoystickGetHat -- Get the current state of a joystick hat
SDL_JoystickGetButton -- Get the current state of a given button on a given joystick
SDL_JoystickGetBall -- Get relative trackball motion
SDL_JoystickClose -- Closes a previously opened joystick
10. Audio
SDL_AudioSpec -- Audio Specification Structure
SDL_OpenAudio -- Opens the audio device with the desired parameters.
SDL_PauseAudio -- Pauses and unpauses the audio callback processing
SDL_GetAudioStatus -- Get the current audio state
SDL_LoadWAV -- Load a WAVE file
SDL_FreeWAV -- Frees previously opened WAV data
SDL_AudioCVT -- Audio Conversion Structure
SDL_BuildAudioCVT -- Initializes a SDL_AudioCVT structure for conversion
SDL_ConvertAudio -- Convert audio data to a desired audio format.
SDL_MixAudio -- Mix audio data
SDL_LockAudio -- Lock out the callback function
SDL_UnlockAudio -- Unlock the callback function
SDL_CloseAudio -- Shuts down audio processing and closes the audio device.
11. CD-ROM
SDL_CDNumDrives -- Returns the number of CD-ROM drives on the system.
SDL_CDName -- Returns a human-readable, system-dependent identifier for the CD-ROM.
SDL_CDOpen -- Opens a CD-ROM drive for access.
SDL_CDStatus -- Returns the current status of the given drive.
SDL_CDPlay -- Play a CD
SDL_CDPlayTracks -- Play the given CD track(s)
SDL_CDPause -- Pauses a CDROM
SDL_CDResume -- Resumes a CDROM
SDL_CDStop -- Stops a CDROM
SDL_CDEject -- Ejects a CDROM
SDL_CDClose -- Closes a SDL_CD handle
SDL_CD -- CDROM Drive Information
SDL_CDtrack -- CD Track Information Structure
12. Multi-threaded Programming
SDL_CreateThread -- Creates a new thread of execution that shares its parent's properties.
SDL_ThreadID -- Get the 32-bit thread identifier for the current thread.
SDL_GetThreadID -- Get the SDL thread ID of a SDL_Thread
SDL_WaitThread -- Wait for a thread to finish.
SDL_KillThread -- Gracelessly terminates the thread.
SDL_CreateMutex -- Create a mutex
SDL_DestroyMutex -- Destroy a mutex
SDL_mutexP -- Lock a mutex
SDL_mutexV -- Unlock a mutex
SDL_CreateSemaphore -- Creates a new semaphore and assigns an initial value to it.
SDL_DestroySemaphore -- Destroys a semaphore that was created by SDL_CreateSemaphore.
SDL_SemWait -- Lock a semaphore and suspend the thread if the semaphore value is zero.
SDL_SemTryWait -- Attempt to lock a semaphore but don't suspend the thread.
SDL_SemWaitTimeout -- Lock a semaphore, but only wait up to a specified maximum time.
SDL_SemPost -- Unlock a semaphore.
SDL_SemValue -- Return the current value of a semaphore.
SDL_CreateCond -- Create a condition variable
SDL_DestroyCond -- Destroy a condition variable
SDL_CondSignal -- Restart a thread wait on a condition variable
SDL_CondBroadcast -- Restart all threads waiting on a condition variable
SDL_CondWait -- Wait on a condition variable
SDL_CondWaitTimeout -- Wait on a condition variable, with timeout
13. Time
SDL_GetTicks -- Get the number of milliseconds since the SDL library initialization.
SDL_Delay -- Wait a specified number of milliseconds before returning.
SDL_AddTimer -- Add a timer which will call a callback after the specified number of milliseconds has +elapsed.
SDL_RemoveTimer -- Remove a timer which was added with +SDL_AddTimer.
SDL_SetTimer -- Set a callback to run after the specified number of milliseconds has +elapsed.

  Next
  SDL Guide
\ No newline at end of file diff --git a/SDL/docs/html/joystick.html b/SDL/docs/html/joystick.html new file mode 100644 index 0000000..c4081a2 --- /dev/null +++ b/SDL/docs/html/joystick.html @@ -0,0 +1,296 @@ +Joystick
SDL Library Documentation
PrevNext

Chapter 9. Joystick

Table of Contents
SDL_NumJoysticks -- Count available joysticks.
SDL_JoystickName -- Get joystick name.
SDL_JoystickOpen -- Opens a joystick for use.
SDL_JoystickOpened -- Determine if a joystick has been opened
SDL_JoystickIndex -- Get the index of an SDL_Joystick.
SDL_JoystickNumAxes -- Get the number of joystick axes
SDL_JoystickNumBalls -- Get the number of joystick trackballs
SDL_JoystickNumHats -- Get the number of joystick hats
SDL_JoystickNumButtons -- Get the number of joysitck buttons
SDL_JoystickUpdate -- Updates the state of all joysticks
SDL_JoystickGetAxis -- Get the current state of an axis
SDL_JoystickGetHat -- Get the current state of a joystick hat
SDL_JoystickGetButton -- Get the current state of a given button on a given joystick
SDL_JoystickGetBall -- Get relative trackball motion
SDL_JoystickClose -- Closes a previously opened joystick

Joysticks, and other similar input devices, have a very strong role in game playing and SDL provides comprehensive support for them. Axes, Buttons, POV Hats and trackballs are all supported.

Joystick support is initialized by passed the SDL_INIT_JOYSTICK flag to SDL_Init. Once initilized joysticks must be opened using SDL_JoystickOpen.

While using the functions describe in this secton may seem like the best way to access and read from joysticks, in most cases they aren't. Ideally joysticks should be read using the event system. To enable this, you must set the joystick event processing state with SDL_JoystickEventState. Joysticks must be opened before they can be used of course.

Note: If you are not handling the joystick via the event queue then you must explicitly request a joystick update by calling SDL_JoystickUpdate.

Note: Force Feedback is not yet support. Sam (slouken@libsdl.org) is soliciting suggestions from people with force-feedback experience on the best wat to desgin the API.


PrevHomeNext
SDL_JoystickEventStateUpSDL_NumJoysticks
\ No newline at end of file diff --git a/SDL/docs/html/reference.html b/SDL/docs/html/reference.html new file mode 100644 index 0000000..674c34e --- /dev/null +++ b/SDL/docs/html/reference.html @@ -0,0 +1,194 @@ +SDL Reference
SDL Library Documentation
PrevNext

II. SDL Reference


PrevHomeNext
Time Examples General
\ No newline at end of file diff --git a/SDL/docs/html/sdlactiveevent.html b/SDL/docs/html/sdlactiveevent.html new file mode 100644 index 0000000..ec90c9d --- /dev/null +++ b/SDL/docs/html/sdlactiveevent.html @@ -0,0 +1,335 @@ +SDL_ActiveEvent
SDL Library Documentation
PrevNext

SDL_ActiveEvent

Name

SDL_ActiveEvent -- Application visibility event structure

Structure Definition

typedef struct{
+  Uint8 type;
+  Uint8 gain;
+  Uint8 state;
+} SDL_ActiveEvent;

Structure Data

typeSDL_ACTIVEEVENT.
gain0 if the event is a loss or 1 if it is a gain.
stateSDL_APPMOUSEFOCUS if mouse focus was gained or lost, SDL_APPINPUTFOCUS if input focus was gained or lost, or SDL_APPACTIVE if the application was iconified (gain=0) or restored(gain=1).

Description

SDL_ActiveEvent is a member of the SDL_Event union and is used when an event of type SDL_ACTIVEEVENT is reported.

When the mouse leaves or enters the window area a SDL_APPMOUSEFOCUS type activation event occurs, if the mouse entered the window then gain will be 1, otherwise gain will be 0. A SDL_APPINPUTFOCUS type activation event occurs when the application loses or gains keyboard focus. This usually occurs when another application is made active. Finally, a SDL_APPACTIVE type event occurs when the application is either minimised/iconified (gain=0) or restored.

Note: This event does not occur when an application window is first created.


PrevHomeNext
SDL_EventUpSDL_KeyboardEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdladdtimer.html b/SDL/docs/html/sdladdtimer.html new file mode 100644 index 0000000..b161603 --- /dev/null +++ b/SDL/docs/html/sdladdtimer.html @@ -0,0 +1,296 @@ +SDL_AddTimer
SDL Library Documentation
PrevNext

SDL_AddTimer

Name

SDL_AddTimer -- Add a timer which will call a callback after the specified number of milliseconds has +elapsed.

Synopsis

#include "SDL.h"

SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);

Callback

/* type definition for the "new" timer callback function */
+typedef Uint32 (*SDL_NewTimerCallback)(Uint32 interval, void *param);

Description

Adds a callback function to be run after the specified number of +milliseconds has elapsed. The callback function is passed the current +timer interval and the user supplied parameter from the +SDL_AddTimer call and returns the next timer +interval. If the returned value from the callback is the same as the one +passed in, the periodic alarm continues, otherwise a new alarm is +scheduled.

To cancel a currently running timer call +SDL_RemoveTimer with the +timer ID returned from +SDL_AddTimer.

The timer callback function may run in a different thread than your +main program, and so shouldn't call any functions from within itself. +You may always call SDL_PushEvent, however.

The granularity of the timer is platform-dependent, but you should count +on it being at least 10 ms as this is the most common number. +This means that if +you request a 16 ms timer, your callback will run approximately 20 ms +later on an unloaded system. If you wanted to set a flag signaling +a frame update at 30 frames per second (every 33 ms), you might set a +timer for 30 ms (see example below). + +If you use this function, you need to pass SDL_INIT_TIMER +to SDL_Init.

Return Value

Returns an ID value for the added timer or +NULL if there was an error.

Examples

my_timer_id = SDL_AddTimer((33/10)*10, my_callbackfunc, my_callback_param);


PrevHomeNext
SDL_DelayUpSDL_RemoveTimer
\ No newline at end of file diff --git a/SDL/docs/html/sdlaudiocvt.html b/SDL/docs/html/sdlaudiocvt.html new file mode 100644 index 0000000..900562f --- /dev/null +++ b/SDL/docs/html/sdlaudiocvt.html @@ -0,0 +1,556 @@ +SDL_AudioCVT
SDL Library Documentation
PrevNext

SDL_AudioCVT

Name

SDL_AudioCVT -- Audio Conversion Structure

Structure Definition

typedef struct{
+  int needed;
+  Uint16 src_format;
+  Uint16 dest_format;
+  double rate_incr;
+  Uint8 *buf;
+  int len;
+  int len_cvt;
+  int len_mult;
+  double len_ratio;
+  void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
+  int filter_index;
+} SDL_AudioCVT;

Structure Data

neededSet to one if the conversion is possible
src_formatAudio format of the source
dest_formatAudio format of the destination
rate_incrRate conversion increment
bufAudio buffer
lenLength of the original audio buffer in bytes
len_cvtLength of converted audio buffer in bytes (calculated)
len_multbuf must be len*len_mult bytes in size(calculated)
len_ratioFinal audio size is len*len_ratio
filters[10](..)Pointers to functions needed for this conversion
filter_indexCurrent conversion function

Description

The SDL_AudioCVT is used to convert audio data between different formats. A SDL_AudioCVT structure is created with the SDL_BuildAudioCVT function, while the actual conversion is done by the SDL_ConvertAudio function.

Many of the fields in the SDL_AudioCVT structure should be considered private and their function will not be discussed here.

Uint8 *buf

This points to the audio data that will be used in the conversion. It is both the source and the destination, which means the converted audio data overwrites the original data. It also means that the converted data may be larger than the original data (if you were converting from 8-bit to 16-bit, for instance), so you must ensure buf is large enough. See below.

int len

This is the length of the original audio data in bytes.

int len_mult

As explained above, the audio buffer needs to be big enough to store the converted data, which may be bigger than the original audio data. The length of buf should be len*len_mult.

double len_ratio

When you have finished converting your audio data, you need to know how much of your audio buffer is valid. len*len_ratio is the size of the converted audio data in bytes. This is very similar to len_mult, however when the convert audio data is shorter than the original len_mult would be 1. len_ratio, on the other hand, would be a fractional number between 0 and 1.


PrevHomeNext
SDL_FreeWAVUpSDL_BuildAudioCVT
\ No newline at end of file diff --git a/SDL/docs/html/sdlaudiospec.html b/SDL/docs/html/sdlaudiospec.html new file mode 100644 index 0000000..13c4f8c --- /dev/null +++ b/SDL/docs/html/sdlaudiospec.html @@ -0,0 +1,589 @@ +SDL_AudioSpec
SDL Library Documentation
PrevNext

SDL_AudioSpec

Name

SDL_AudioSpec -- Audio Specification Structure

Structure Definition

typedef struct{
+  int freq;
+  Uint16 format;
+  Uint8 channels;
+  Uint8 silence;
+  Uint16 samples;
+  Uint32 size;
+  void (*callback)(void *userdata, Uint8 *stream, int len);
+  void *userdata;
+} SDL_AudioSpec;

Structure Data

freqAudio frequency in samples per second
formatAudio data format
channelsNumber of channels: 1 mono, 2 stereo
silenceAudio buffer silence value (calculated)
samplesAudio buffer size in samples
sizeAudio buffer size in bytes (calculated)
callback(..)Callback function for filling the audio buffer
userdataPointer the user data which is passed to the callback function

Description

The SDL_AudioSpec structure is used to describe the format of some audio data. This structure is used by SDL_OpenAudio and SDL_LoadWAV. While all fields are used by SDL_OpenAudio only freq, format, samples and channels are used by SDL_LoadWAV. We will detail these common members here.

freq

The number of samples sent to the sound device every second. Common values are 11025, 22050 and 44100. The higher the better.

format

Specifies the size and type of each sample element +

AUDIO_U8

Unsigned 8-bit samples

AUDIO_S8

Signed 8-bit samples

AUDIO_U16 or AUDIO_U16LSB

Unsigned 16-bit little-endian samples

AUDIO_S16 or AUDIO_S16LSB

Signed 16-bit little-endian samples

AUDIO_U16MSB

Unsigned 16-bit big-endian samples

AUDIO_S16MSB

Signed 16-bit big-endian samples

AUDIO_U16SYS

Either AUDIO_U16LSB or AUDIO_U16MSB depending on you systems endianness

AUDIO_S16SYS

Either AUDIO_S16LSB or AUDIO_S16MSB depending on you systems endianness

channelsThe number of seperate sound channels. 1 is mono (single channel), 2 is stereo (dual channel).
samplesWhen used with SDL_OpenAudio this refers to the size of the audio buffer in samples. A sample a chunk of audio data of the size specified in format mulitplied by the number of channels. When the SDL_AudioSpec is used with SDL_LoadWAV samples is set to 4096.


PrevHomeNext
AudioUpSDL_OpenAudio
\ No newline at end of file diff --git a/SDL/docs/html/sdlblitsurface.html b/SDL/docs/html/sdlblitsurface.html new file mode 100644 index 0000000..513a0f3 --- /dev/null +++ b/SDL/docs/html/sdlblitsurface.html @@ -0,0 +1,339 @@ +SDL_BlitSurface
SDL Library Documentation
PrevNext

SDL_BlitSurface

Name

SDL_BlitSurface -- This performs a fast blit from the source surface to the destination surface.

Synopsis

#include "SDL.h"

int SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);

Description

This performs a fast blit from the source surface to the destination surface.

The width and height in srcrect determine the +size of the copied rectangle. Only the position is used in the +dstrect (the width and height are ignored).

If srcrect is NULL, the +entire surface is copied. If dstrect is +NULL, then the destination position (upper left +corner) is (0, 0).

The final blit rectangle is saved in +dstrect after all clipping is performed +(srcrect is not modified).

The blit function should not be called on a locked surface.

The results of blitting operations vary greatly depending on whether SDL_SRCAPLHA is set or not. See SDL_SetAlpha for an explaination of how this affects your results. Colorkeying and alpha attributes also interact with surface blitting, as the following pseudo-code should hopefully explain. +

if (source surface has SDL_SRCALPHA set) {
+    if (source surface has alpha channel (that is, format->Amask != 0))
+        blit using per-pixel alpha, ignoring any colour key
+    else {
+        if (source surface has SDL_SRCCOLORKEY set)
+            blit using the colour key AND the per-surface alpha value
+        else
+            blit using the per-surface alpha value
+    }
+} else {
+    if (source surface has SDL_SRCCOLORKEY set)
+        blit using the colour key
+    else
+        ordinary opaque rectangular blit
+}

Return Value

If the blit is successful, it returns 0, +otherwise it returns -1.

If either of the surfaces were in video memory, and the blit returns +-2, the video memory was lost, so it should be +reloaded with artwork and re-blitted: +

        while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
+                while ( SDL_LockSurface(image)) < 0 )
+                        SDL_Delay(10);
+                -- Write image pixels to image->pixels --
+                SDL_UnlockSurface(image);
+        }
+This happens under DirectX 5.0 when the system switches away from your +fullscreen application. Locking the surface will also fail until you +have access to the video memory again.


PrevHomeNext
SDL_ConvertSurfaceUpSDL_FillRect
\ No newline at end of file diff --git a/SDL/docs/html/sdlbuildaudiocvt.html b/SDL/docs/html/sdlbuildaudiocvt.html new file mode 100644 index 0000000..dc614b5 --- /dev/null +++ b/SDL/docs/html/sdlbuildaudiocvt.html @@ -0,0 +1,291 @@ +SDL_BuildAudioCVT
SDL Library Documentation
PrevNext

SDL_BuildAudioCVT

Name

SDL_BuildAudioCVT -- Initializes a SDL_AudioCVT structure for conversion

Synopsis

#include "SDL.h"

int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, Uint16 src_format, Uint8 src_channels, int src_rate, Uint16 dst_format, Uint8 dst_channels, int dst_rate);

Description

Before an SDL_AudioCVT structure can be used to convert audio data it must be initialized with source and destination information.

src_format and dst_format are the source and destination format of the conversion. (For information on audio formats see SDL_AudioSpec). src_channels and dst_channels are the number of channels in the source and destination formats. Finally, src_rate and dst_rate are the frequency or samples-per-second of the source and destination formats. Once again, see SDL_AudioSpec.

Return Values

Returns -1 if the filter could not be built or 1 if it could.

Examples

See SDL_ConvertAudio.


PrevHomeNext
SDL_AudioCVTUpSDL_ConvertAudio
\ No newline at end of file diff --git a/SDL/docs/html/sdlcd.html b/SDL/docs/html/sdlcd.html new file mode 100644 index 0000000..d64da8e --- /dev/null +++ b/SDL/docs/html/sdlcd.html @@ -0,0 +1,359 @@ +SDL_CD
SDL Library Documentation
PrevNext

SDL_CD

Name

SDL_CD -- CDROM Drive Information

Structure Definition

typedef struct{
+  int id;
+  CDstatus status;
+  int numtracks;
+  int cur_track;
+  int cur_frame;
+  SDL_CDtrack track[SDL_MAX_TRACKS+1];
+} SDL_CD;

Structure Data

idPrivate drive identifier
statusDrive status
numtracksNumber of tracks on the CD
cur_trackCurrent track
cur_frameCurrent frame offset within the track
track[SDL_MAX_TRACKS+1]Array of track descriptions. (see SDL_CDtrack)

Description

An SDL_CD structure is returned by SDL_CDOpen. It represents an opened CDROM device and stores information on the layout of the tracks on the disc.

A frame is the base data unit of a CD. CD_FPS frames is equal to 1 second of music. SDL provides two macros for converting between time and frames: FRAMES_TO_MSF(f, M,S,F) and MSF_TO_FRAMES.

Examples

int min, sec, frame;
+int frame_offset;
+
+FRAMES_TO_MSF(cdrom->cur_frame, &min, &sec, &frame);
+printf("Current Position: %d minutes, %d seconds, %d frames\n", min, sec, frame);
+
+frame_offset=MSF_TO_FRAMES(min, sec, frame);

PrevHomeNext
SDL_CDCloseUpSDL_CDtrack
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdclose.html b/SDL/docs/html/sdlcdclose.html new file mode 100644 index 0000000..2cf0b6e --- /dev/null +++ b/SDL/docs/html/sdlcdclose.html @@ -0,0 +1,217 @@ +SDL_CDClose
SDL Library Documentation
PrevNext

SDL_CDClose

Name

SDL_CDClose -- Closes a SDL_CD handle

Synopsis

#include "SDL.h"

void SDL_CDClose(SDL_CD *cdrom);

Description

Closes the given cdrom handle.

See Also

SDL_CDOpen, +SDL_CD


PrevHomeNext
SDL_CDEjectUpSDL_CD
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdeject.html b/SDL/docs/html/sdlcdeject.html new file mode 100644 index 0000000..197b10f --- /dev/null +++ b/SDL/docs/html/sdlcdeject.html @@ -0,0 +1,226 @@ +SDL_CDEject
SDL Library Documentation
PrevNext

SDL_CDEject

Name

SDL_CDEject -- Ejects a CDROM

Synopsis

#include "SDL.h"

int SDL_CDEject(SDL_CD *cdrom);

Description

Ejects the given cdrom.

Return Value

Returns 0 on success, or -1 on an error.

See Also

SDL_CD


PrevHomeNext
SDL_CDStopUpSDL_CDClose
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdname.html b/SDL/docs/html/sdlcdname.html new file mode 100644 index 0000000..c6eb789 --- /dev/null +++ b/SDL/docs/html/sdlcdname.html @@ -0,0 +1,239 @@ +SDL_CDName
SDL Library Documentation
PrevNext

SDL_CDName

Name

SDL_CDName -- Returns a human-readable, system-dependent identifier for the CD-ROM.

Synopsis

#include "SDL.h"

const char *SDL_CDName(int drive);

Description

Returns a human-readable, system-dependent identifier for the CD-ROM. drive is the index of the drive. Drive indices start to 0 and end at SDL_CDNumDrives()-1.

Examples

  • "/dev/cdrom"

  • "E:"

  • "/dev/disk/ide/1/master"


PrevHomeNext
SDL_CDNumDrivesUpSDL_CDOpen
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdnumdrives.html b/SDL/docs/html/sdlcdnumdrives.html new file mode 100644 index 0000000..c6cc698 --- /dev/null +++ b/SDL/docs/html/sdlcdnumdrives.html @@ -0,0 +1,205 @@ +SDL_CDNumDrives
SDL Library Documentation
PrevNext

SDL_CDNumDrives

Name

SDL_CDNumDrives -- Returns the number of CD-ROM drives on the system.

Synopsis

#include "SDL.h"

int SDL_CDNumDrives(void);

Description

Returns the number of CD-ROM drives on the system.

See Also

SDL_CDOpen


PrevHomeNext
CD-ROMUpSDL_CDName
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdopen.html b/SDL/docs/html/sdlcdopen.html new file mode 100644 index 0000000..f9874b5 --- /dev/null +++ b/SDL/docs/html/sdlcdopen.html @@ -0,0 +1,275 @@ +SDL_CDOpen
SDL Library Documentation
PrevNext

SDL_CDOpen

Name

SDL_CDOpen -- Opens a CD-ROM drive for access.

Synopsis

#include "SDL.h"

SDL_CD *SDL_CDOpen(int drive);

Description

Opens a CD-ROM drive for access. It returns a SDL_CD structure on success, or NULL if the drive was invalid or busy. This newly opened CD-ROM becomes the default CD used when other CD functions are passed a NULL CD-ROM handle.

Drives are numbered starting with 0. +Drive 0 is the system default CD-ROM.

Examples

SDL_CD *cdrom;
+int cur_track;
+int min, sec, frame;
+SDL_Init(SDL_INIT_CDROM);
+atexit(SDL_Quit);
+
+/* Check for CD drives */
+if(!SDL_CDNumDrives()){
+  /* None found */
+  fprintf(stderr, "No CDROM devices available\n");
+  exit(-1);
+}
+
+/* Open the default drive */
+cdrom=SDL_CDOpen(0);
+
+/* Did if open? Check if cdrom is NULL */
+if(!cdrom){
+  fprintf(stderr, "Couldn't open drive: %s\n", SDL_GetError());
+  exit(-1);
+}
+
+/* Print Volume info */
+printf("Name: %s\n", SDL_CDName(0));
+printf("Tracks: %d\n", cdrom->numtracks);
+for(cur_track=0;cur_track < cdrom->numtracks; cur_track++){
+  FRAMES_TO_MSF(cdrom->track[cur_track].length, &min, &sec, &frame);
+  printf("\tTrack %d: Length %d:%d\n", cur_track, min, sec);
+}
+
+SDL_CDClose(cdrom);

PrevHomeNext
SDL_CDNameUpSDL_CDStatus
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdpause.html b/SDL/docs/html/sdlcdpause.html new file mode 100644 index 0000000..7ea090c --- /dev/null +++ b/SDL/docs/html/sdlcdpause.html @@ -0,0 +1,233 @@ +SDL_CDPause
SDL Library Documentation
PrevNext

SDL_CDPause

Name

SDL_CDPause -- Pauses a CDROM

Synopsis

#include "SDL.h"

int SDL_CDPause(SDL_CD *cdrom);

Description

Pauses play on the given cdrom.

Return Value

Returns 0 on success, or -1 on an error.


PrevHomeNext
SDL_CDPlayTracksUpSDL_CDResume
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdplay.html b/SDL/docs/html/sdlcdplay.html new file mode 100644 index 0000000..855768d --- /dev/null +++ b/SDL/docs/html/sdlcdplay.html @@ -0,0 +1,243 @@ +SDL_CDPlay
SDL Library Documentation
PrevNext

SDL_CDPlay

Name

SDL_CDPlay -- Play a CD

Synopsis

#include "SDL.h"

int SDL_CDPlay(SDL_CD *cdrom, int start, int length);

Description

Plays the given cdrom, starting a frame start for length frames.

Return Values

Returns 0 on success, or -1 on an error.


PrevHomeNext
SDL_CDStatusUpSDL_CDPlayTracks
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdplaytracks.html b/SDL/docs/html/sdlcdplaytracks.html new file mode 100644 index 0000000..f3f7ee3 --- /dev/null +++ b/SDL/docs/html/sdlcdplaytracks.html @@ -0,0 +1,325 @@ +SDL_CDPlayTracks
SDL Library Documentation
PrevNext

SDL_CDPlayTracks

Name

SDL_CDPlayTracks -- Play the given CD track(s)

Synopsis

#include "SDL.h"

int SDL_CDPlayTracks(SDL_CD *cdrom, int start_track, int start_frame, int ntracks, int nframes));

Description

SDL_CDPlayTracks plays the given CD starting at track +start_track, for ntracks tracks.

start_frame is the frame offset, from the beginning of the start_track, at which to start. nframes is the frame offset, from the beginning of the last track (start_track+ntracks), at which to end playing.

SDL_CDPlayTracks should only be called after calling +SDL_CDStatus +to get track information about the CD.

Note: Data tracks are ignored.

Return Value

Returns 0, or -1 +if there was an error.

Examples

/* assuming cdrom is a previously opened device */
+/* Play the entire CD */
+if(CD_INDRIVE(SDL_CDStatus(cdrom)))
+  SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
+
+/* Play the first track */
+if(CD_INDRIVE(SDL_CDStatus(cdrom)))
+  SDL_CDPlayTracks(cdrom, 0, 0, 1, 0);
+
+/* Play first 15 seconds of the 2nd track */
+if(CD_INDRIVE(SDL_CDStatus(cdrom)))
+  SDL_CDPlayTracks(cdrom, 1, 0, 0, CD_FPS*15);
+


PrevHomeNext
SDL_CDPlayUpSDL_CDPause
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdresume.html b/SDL/docs/html/sdlcdresume.html new file mode 100644 index 0000000..9d9fd9f --- /dev/null +++ b/SDL/docs/html/sdlcdresume.html @@ -0,0 +1,233 @@ +SDL_CDResume
SDL Library Documentation
PrevNext

SDL_CDResume

Name

SDL_CDResume -- Resumes a CDROM

Synopsis

#include "SDL.h"

int SDL_CDResume(SDL_CD *cdrom);

Description

Resumes play on the given cdrom.

Return Value

Returns 0 on success, or -1 on an error.


PrevHomeNext
SDL_CDPauseUpSDL_CDStop
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdstatus.html b/SDL/docs/html/sdlcdstatus.html new file mode 100644 index 0000000..bbc256e --- /dev/null +++ b/SDL/docs/html/sdlcdstatus.html @@ -0,0 +1,273 @@ +SDL_CDStatus
SDL Library Documentation
PrevNext

SDL_CDStatus

Name

SDL_CDStatus -- Returns the current status of the given drive.

Synopsis

#include "SDL.h"

CDstatus SDL_CDStatus(SDL_CD *cdrom);

/* Given a status, returns true if there's a disk in the drive */
+#define CD_INDRIVE(status)      ((int)status > 0)

Description

This function returns the current status of the given drive. Status is described like so: +

typedef enum {
+  CD_TRAYEMPTY,
+  CD_STOPPED,
+  CD_PLAYING,
+  CD_PAUSED,
+  CD_ERROR = -1
+} CDstatus;

If the drive has a CD in it, the table of contents of the CD and current +play position of the CD will be stored in the SDL_CD structure.

The macro CD_INDRIVE is provided for convenience, +and given a status returns true if there's a disk in the drive.

Note: SDL_CDStatus also updates the SDL_CD structure passed to it.

Example

int playTrack(int track)
+{
+  int playing = 0;
+
+  if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
+  /* clamp to the actual number of tracks on the CD */
+    if (track >= cdrom->numtracks) {
+      track = cdrom->numtracks-1;
+    }
+
+    if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) {
+      playing = 1;
+    }
+  }
+  return playing;
+}

See Also

SDL_CD


PrevHomeNext
SDL_CDOpenUpSDL_CDPlay
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdstop.html b/SDL/docs/html/sdlcdstop.html new file mode 100644 index 0000000..5594d8f --- /dev/null +++ b/SDL/docs/html/sdlcdstop.html @@ -0,0 +1,226 @@ +SDL_CDStop
SDL Library Documentation
PrevNext

SDL_CDStop

Name

SDL_CDStop -- Stops a CDROM

Synopsis

#include "SDL.h"

int SDL_CDStop(SDL_CD *cdrom);

Description

Stops play on the given cdrom.

Return Value

Returns 0 on success, or -1 on an error.

See Also

SDL_CDPlay,


PrevHomeNext
SDL_CDResumeUpSDL_CDEject
\ No newline at end of file diff --git a/SDL/docs/html/sdlcdtrack.html b/SDL/docs/html/sdlcdtrack.html new file mode 100644 index 0000000..a7bd79c --- /dev/null +++ b/SDL/docs/html/sdlcdtrack.html @@ -0,0 +1,313 @@ +SDL_CDtrack
SDL Library Documentation
PrevNext

SDL_CDtrack

Name

SDL_CDtrack -- CD Track Information Structure

Structure Definition

typedef struct{
+  Uint8 id;
+  Uint8 type;
+  Uint32 length;
+  Uint32 offset;
+} SDL_CDtrack;

Structure Data

idTrack number (0-99)
typeSDL_AUDIO_TRACK or SDL_DATA_TRACK
lengthLength, in frames, of this track
offsetFrame offset to the beginning of this track

Description

SDL_CDtrack stores data on each track on a CD, its fields should be pretty self explainatory. It is a member a the SDL_CD structure.

Note: Frames can be converted to standard timings. There are CD_FPS frames per second, so SDL_CDtrack.length/CD_FPS=length_in_seconds.

See Also

SDL_CD


PrevHomeNext
SDL_CDUpMulti-threaded Programming
\ No newline at end of file diff --git a/SDL/docs/html/sdlcloseaudio.html b/SDL/docs/html/sdlcloseaudio.html new file mode 100644 index 0000000..84eed1c --- /dev/null +++ b/SDL/docs/html/sdlcloseaudio.html @@ -0,0 +1,205 @@ +SDL_CloseAudio
SDL Library Documentation
PrevNext

SDL_CloseAudio

Name

SDL_CloseAudio -- Shuts down audio processing and closes the audio device.

Synopsis

#include "SDL.h"

void SDL_CloseAudio(void);

Description

This function shuts down audio processing and closes the audio device.

See Also

SDL_OpenAudio


PrevHomeNext
SDL_UnlockAudioUpCD-ROM
\ No newline at end of file diff --git a/SDL/docs/html/sdlcolor.html b/SDL/docs/html/sdlcolor.html new file mode 100644 index 0000000..e22750d --- /dev/null +++ b/SDL/docs/html/sdlcolor.html @@ -0,0 +1,300 @@ +SDL_Color
SDL Library Documentation
PrevNext

SDL_Color

Name

SDL_Color -- Format independent color description

Structure Definition

typedef struct{
+  Uint8 r;
+  Uint8 g;
+  Uint8 b;
+  Uint8 unused;
+} SDL_Color;

Structure Data

rRed intensity
gGreen intensity
bBlue intensity
unusedUnused

Description

SDL_Color describes a color in a format independent way. You can convert a SDL_Color to a pixel value for a certain pixel format using SDL_MapRGB.


PrevHomeNext
SDL_RectUpSDL_Palette
\ No newline at end of file diff --git a/SDL/docs/html/sdlcondbroadcast.html b/SDL/docs/html/sdlcondbroadcast.html new file mode 100644 index 0000000..962ba28 --- /dev/null +++ b/SDL/docs/html/sdlcondbroadcast.html @@ -0,0 +1,224 @@ +SDL_CondBroadcast
SDL Library Documentation
PrevNext

SDL_CondBroadcast

Name

SDL_CondBroadcast -- Restart all threads waiting on a condition variable

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

int SDL_CondBroadcast(SDL_cond *cond);

Description

Restarts all threads that are waiting on the condition variable, cond. Returns 0 on success, or -1 on an error.


PrevHomeNext
SDL_CondSignalUpSDL_CondWait
\ No newline at end of file diff --git a/SDL/docs/html/sdlcondsignal.html b/SDL/docs/html/sdlcondsignal.html new file mode 100644 index 0000000..16835b1 --- /dev/null +++ b/SDL/docs/html/sdlcondsignal.html @@ -0,0 +1,224 @@ +SDL_CondSignal
SDL Library Documentation
PrevNext

SDL_CondSignal

Name

SDL_CondSignal -- Restart a thread wait on a condition variable

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

int SDL_CondSignal(SDL_cond *cond);

Description

Restart one of the threads that are waiting on the condition variable, cond. Returns 0 on success of -1 on an error.


PrevHomeNext
SDL_DestroyCondUpSDL_CondBroadcast
\ No newline at end of file diff --git a/SDL/docs/html/sdlcondwait.html b/SDL/docs/html/sdlcondwait.html new file mode 100644 index 0000000..4b6eba6 --- /dev/null +++ b/SDL/docs/html/sdlcondwait.html @@ -0,0 +1,231 @@ +SDL_CondWait
SDL Library Documentation
PrevNext

SDL_CondWait

Name

SDL_CondWait -- Wait on a condition variable

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

int SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);

Description

Wait on the condition variable cond and unlock the provided mutex. The mutex must the locked before entering this function. Returns 0 when it is signalled, or -1 on an error.


PrevHomeNext
SDL_CondBroadcastUpSDL_CondWaitTimeout
\ No newline at end of file diff --git a/SDL/docs/html/sdlcondwaittimeout.html b/SDL/docs/html/sdlcondwaittimeout.html new file mode 100644 index 0000000..60a9d41 --- /dev/null +++ b/SDL/docs/html/sdlcondwaittimeout.html @@ -0,0 +1,230 @@ +SDL_CondWaitTimeout
SDL Library Documentation
PrevNext

SDL_CondWaitTimeout

Name

SDL_CondWaitTimeout -- Wait on a condition variable, with timeout

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);

Description

Wait on the condition variable cond for, at most, ms milliseconds. mut is unlocked so it must be locked when the function is called. Returns SDL_MUTEX_TIMEDOUT if the condition is not signalled in the allotted time, 0 if it was signalled or -1 on an error.

See Also

SDL_CondWait


PrevHomeNext
SDL_CondWaitUpTime
\ No newline at end of file diff --git a/SDL/docs/html/sdlconvertaudio.html b/SDL/docs/html/sdlconvertaudio.html new file mode 100644 index 0000000..9aba579 --- /dev/null +++ b/SDL/docs/html/sdlconvertaudio.html @@ -0,0 +1,407 @@ +SDL_ConvertAudio
SDL Library Documentation
PrevNext

SDL_ConvertAudio

Name

SDL_ConvertAudio -- Convert audio data to a desired audio format.

Synopsis

#include "SDL.h"

int SDL_ConvertAudio(SDL_AudioCVT *cvt);

Description

SDL_ConvertAudio takes one parameter, cvt, which was previously initilized. Initilizing a SDL_AudioCVT is a two step process. First of all, the structure must be passed to SDL_BuildAudioCVT along with source and destination format parameters. Secondly, the cvt->buf and cvt->len fields must be setup. cvt->buf should point to the audio data and cvt->len should be set to the length of the audio data in bytes. Remember, the length of the buffer pointed to by buf show be len*len_mult bytes in length.

Once the SDL_AudioCVTstructure is initilized then we can pass it to SDL_ConvertAudio, which will convert the audio data pointer to by cvt->buf. If SDL_ConvertAudio returned 0 then the conversion was completed successfully, otherwise -1 is returned.

If the conversion completed successfully then the converted audio data can be read from cvt->buf. The amount of valid, converted, audio data in the buffer is equal to cvt->len*cvt->len_ratio.

Examples

/* Converting some WAV data to hardware format */
+void my_audio_callback(void *userdata, Uint8 *stream, int len);
+
+SDL_AudioSpec *desired, *obtained;
+SDL_AudioSpec wav_spec;
+SDL_AudioCVT  wav_cvt;
+Uint32 wav_len;
+Uint8 *wav_buf;
+int ret;
+
+/* Allocated audio specs */
+desired = malloc(sizeof(SDL_AudioSpec));
+obtained = malloc(sizeof(SDL_AudioSpec));
+
+/* Set desired format */
+desired->freq=22050;
+desired->format=AUDIO_S16LSB;
+desired->samples=8192;
+desired->callback=my_audio_callback;
+desired->userdata=NULL;
+
+/* Open the audio device */
+if ( SDL_OpenAudio(desired, obtained) < 0 ){
+  fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
+  exit(-1);
+}
+        
+free(desired);
+
+/* Load the test.wav */
+if( SDL_LoadWAV("test.wav", &wav_spec, &wav_buf, &wav_len) == NULL ){
+  fprintf(stderr, "Could not open test.wav: %s\n", SDL_GetError());
+  SDL_CloseAudio();
+  free(obtained);
+  exit(-1);
+}
+                                            
+/* Build AudioCVT */
+ret = SDL_BuildAudioCVT(&wav_cvt,
+                        wav_spec.format, wav_spec.channels, wav_spec.freq,
+                        obtained->format, obtained->channels, obtained->freq);
+
+/* Check that the convert was built */
+if(ret==-1){
+  fprintf(stderr, "Couldn't build converter!\n");
+  SDL_CloseAudio();
+  free(obtained);
+  SDL_FreeWAV(wav_buf);
+}
+
+/* Setup for conversion */
+wav_cvt.buf = malloc(wav_len * wav_cvt.len_mult);
+wav_cvt.len = wav_len;
+memcpy(wav_cvt.buf, wav_buf, wav_len);
+
+/* We can delete to original WAV data now */
+SDL_FreeWAV(wav_buf);
+
+/* And now we're ready to convert */
+SDL_ConvertAudio(&wav_cvt);
+
+/* do whatever */
+.
+.
+.
+.
+

PrevHomeNext
SDL_BuildAudioCVTUpSDL_MixAudio
\ No newline at end of file diff --git a/SDL/docs/html/sdlconvertsurface.html b/SDL/docs/html/sdlconvertsurface.html new file mode 100644 index 0000000..70202dd --- /dev/null +++ b/SDL/docs/html/sdlconvertsurface.html @@ -0,0 +1,271 @@ +SDL_ConvertSurface
SDL Library Documentation
PrevNext

SDL_ConvertSurface

Name

SDL_ConvertSurface -- Converts a surface to the same format as another surface.

Synopsis

#include "SDL/SDL.h"

SDL_Surface *SDL_ConvertSurface(SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);

Description

Creates a new surface of the specified format, and then copies and maps +the given surface to it. If this function fails, it returns +NULL.

The flags parameter is passed to +SDL_CreateRGBSurface +and has those semantics.

This function is used internally by +SDL_DisplayFormat.

This function can only be called after SDL_Init.

Return Value

Returns either a pointer to the new surface, or +NULL on error.


PrevHomeNext
SDL_GetClipRectUpSDL_BlitSurface
\ No newline at end of file diff --git a/SDL/docs/html/sdlcreatecond.html b/SDL/docs/html/sdlcreatecond.html new file mode 100644 index 0000000..32d06db --- /dev/null +++ b/SDL/docs/html/sdlcreatecond.html @@ -0,0 +1,240 @@ +SDL_CreateCond
SDL Library Documentation
PrevNext

SDL_CreateCond

Name

SDL_CreateCond -- Create a condition variable

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

SDL_cond *SDL_CreateCond(void);

Description

Creates a condition variable.

Examples

SDL_cond *cond;
+
+cond=SDL_CreateCond();
+.
+.
+/* Do stuff */
+
+.
+.
+SDL_DestroyCond(cond);

PrevHomeNext
SDL_SemValueUpSDL_DestroyCond
\ No newline at end of file diff --git a/SDL/docs/html/sdlcreatecursor.html b/SDL/docs/html/sdlcreatecursor.html new file mode 100644 index 0000000..4a58ce1 --- /dev/null +++ b/SDL/docs/html/sdlcreatecursor.html @@ -0,0 +1,398 @@ +SDL_CreateCursor
SDL Library Documentation
PrevNext

SDL_CreateCursor

Name

SDL_CreateCursor -- Creates a new mouse cursor.

Synopsis

#include "SDL.h"

SDL_Cursor *SDL_CreateCursor(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);

Description

Create a cursor using the specified data and mask (in MSB format). +The cursor width must be a multiple of 8 bits.

The cursor is created in black and white according to the following: +

Data / MaskResulting pixel on screen
0 / 1White
1 / 1Black
0 / 0Transparent
1 / 0Inverted color if possible, black if not.

Cursors created with this function must be freed with +SDL_FreeCursor.

Example

/* Stolen from the mailing list */
+/* Creates a new mouse cursor from an XPM */
+
+
+/* XPM */
+static const char *arrow[] = {
+  /* width height num_colors chars_per_pixel */
+  "    32    32        3            1",
+  /* colors */
+  "X c #000000",
+  ". c #ffffff",
+  "  c None",
+  /* pixels */
+  "X                               ",
+  "XX                              ",
+  "X.X                             ",
+  "X..X                            ",
+  "X...X                           ",
+  "X....X                          ",
+  "X.....X                         ",
+  "X......X                        ",
+  "X.......X                       ",
+  "X........X                      ",
+  "X.....XXXXX                     ",
+  "X..X..X                         ",
+  "X.X X..X                        ",
+  "XX  X..X                        ",
+  "X    X..X                       ",
+  "     X..X                       ",
+  "      X..X                      ",
+  "      X..X                      ",
+  "       XX                       ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "0,0"
+};
+
+static SDL_Cursor *init_system_cursor(const char *image[])
+{
+  int i, row, col;
+  Uint8 data[4*32];
+  Uint8 mask[4*32];
+  int hot_x, hot_y;
+
+  i = -1;
+  for ( row=0; row<32; ++row ) {
+    for ( col=0; col<32; ++col ) {
+      if ( col % 8 ) {
+        data[i] <<= 1;
+        mask[i] <<= 1;
+      } else {
+        ++i;
+        data[i] = mask[i] = 0;
+      }
+      switch (image[4+row][col]) {
+        case 'X':
+          data[i] |= 0x01;
+          mask[i] |= 0x01;
+          break;
+        case '.':
+          mask[i] |= 0x01;
+          break;
+        case ' ':
+          break;
+      }
+    }
+  }
+  sscanf(image[4+row], "%d,%d", &hot_x, &hot_y);
+  return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y);
+}

PrevHomeNext
SDL_WarpMouseUpSDL_FreeCursor
\ No newline at end of file diff --git a/SDL/docs/html/sdlcreatemutex.html b/SDL/docs/html/sdlcreatemutex.html new file mode 100644 index 0000000..ce00db1 --- /dev/null +++ b/SDL/docs/html/sdlcreatemutex.html @@ -0,0 +1,249 @@ +SDL_CreateMutex
SDL Library Documentation
PrevNext

SDL_CreateMutex

Name

SDL_CreateMutex -- Create a mutex

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

SDL_mutex *SDL_CreateMutex(void);

Description

Create a new, unlocked mutex.

Examples

SDL_mutex *mut;
+
+mut=SDL_CreateMutex();
+.
+.
+if(SDL_mutexP(mut)==-1){
+  fprintf(stderr, "Couldn't lock mutex\n");
+  exit(-1);
+}
+.
+/* Do stuff while mutex is locked */
+.
+.
+if(SDL_mutexV(mut)==-1){
+  fprintf(stderr, "Couldn't unlock mutex\n");
+  exit(-1);
+}
+
+SDL_DestroyMutex(mut);

PrevHomeNext
SDL_KillThreadUpSDL_DestroyMutex
\ No newline at end of file diff --git a/SDL/docs/html/sdlcreatergbsurface.html b/SDL/docs/html/sdlcreatergbsurface.html new file mode 100644 index 0000000..205bc2d --- /dev/null +++ b/SDL/docs/html/sdlcreatergbsurface.html @@ -0,0 +1,458 @@ +SDL_CreateRGBSurface
SDL Library Documentation
PrevNext

SDL_CreateRGBSurface

Name

SDL_CreateRGBSurface -- Create an empty SDL_Surface

Synopsis

#include "SDL.h"

SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);

Description

Allocate an empty surface (must be called after SDL_SetVideoMode)

If depth is 8 bits an empty palette is allocated for the surface, otherwise a 'packed-pixel' SDL_PixelFormat is created using the [RGBA]mask's provided (see SDL_PixelFormat). The flags specifies the type of surface that should be created, it is an OR'd combination of the following possible values.

SDL_SWSURFACESDL will create the surface in system memory. This improves the performance of pixel level access, however you may not be able to take advantage of some types of hardware blitting.
SDL_HWSURFACESDL will attempt to create the surface in video memory. This will allow SDL to take advantage of Video->Video blits (which are often accelerated).
SDL_SRCCOLORKEYThis flag turns on colourkeying for blits from this surface. If +SDL_HWSURFACE is also specified and colourkeyed blits +are hardware-accelerated, then SDL will attempt to place the surface in +video memory. +Use SDL_SetColorKey +to set or clear this flag after surface creation.
SDL_SRCALPHAThis flag turns on alpha-blending for blits from this surface. If +SDL_HWSURFACE is also specified and alpha-blending blits +are hardware-accelerated, then the surface will be placed in video memory if +possible. +Use SDL_SetAlpha to +set or clear this flag after surface creation.

Note: If an alpha-channel is specified (that is, if Amask is +nonzero), then the SDL_SRCALPHA flag is automatically +set. You may remove this flag by calling +SDL_SetAlpha +after surface creation.

Return Value

Returns the created surface, or NULL upon error.

Example

    /* Create a 32-bit surface with the bytes of each pixel in R,G,B,A order,
+       as expected by OpenGL for textures */
+    SDL_Surface *surface;
+    Uint32 rmask, gmask, bmask, amask;
+
+    /* SDL interprets each pixel as a 32-bit number, so our masks must depend
+       on the endianness (byte order) of the machine */
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+    rmask = 0xff000000;
+    gmask = 0x00ff0000;
+    bmask = 0x0000ff00;
+    amask = 0x000000ff;
+#else
+    rmask = 0x000000ff;
+    gmask = 0x0000ff00;
+    bmask = 0x00ff0000;
+    amask = 0xff000000;
+#endif
+
+    surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
+                                   rmask, gmask, bmask, amask);
+    if(surface == NULL) {
+        fprintf(stderr, "CreateRGBSurface failed: %s\n", SDL_GetError());
+        exit(1);
+    }

PrevHomeNext
SDL_GetRGBAUpSDL_CreateRGBSurfaceFrom
\ No newline at end of file diff --git a/SDL/docs/html/sdlcreatergbsurfacefrom.html b/SDL/docs/html/sdlcreatergbsurfacefrom.html new file mode 100644 index 0000000..0d0f19e --- /dev/null +++ b/SDL/docs/html/sdlcreatergbsurfacefrom.html @@ -0,0 +1,256 @@ +SDL_CreateRGBSurfaceFrom
SDL Library Documentation
PrevNext

SDL_CreateRGBSurfaceFrom

Name

SDL_CreateRGBSurfaceFrom -- Create an SDL_Surface from pixel data

Synopsis

#include "SDL.h"

SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);

Description

Creates an SDL_Surface from the provided pixel data.

The data stored in pixels is assumed to be of the depth specified in the parameter list. The pixel data is not copied into the SDL_Surface structure so it should not be freed until the surface has been freed with a called to SDL_FreeSurface. pitch is the length of each scanline in bytes.

See SDL_CreateRGBSurface for a more detailed description of the other parameters.

Return Value

Returns the created surface, or NULL upon error.


PrevHomeNext
SDL_CreateRGBSurfaceUpSDL_FreeSurface
\ No newline at end of file diff --git a/SDL/docs/html/sdlcreatesemaphore.html b/SDL/docs/html/sdlcreatesemaphore.html new file mode 100644 index 0000000..ac9c7fd --- /dev/null +++ b/SDL/docs/html/sdlcreatesemaphore.html @@ -0,0 +1,303 @@ +SDL_CreateSemaphore
SDL Library Documentation
PrevNext

SDL_CreateSemaphore

Name

SDL_CreateSemaphore -- Creates a new semaphore and assigns an initial value to it.

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

SDL_sem *SDL_CreateSemaphore(Uint32 initial_value);

Description

SDL_CreateSemaphore() creates a new semaphore and +initializes it with the value initial_value. +Each locking operation on the semaphore by +SDL_SemWait, +SDL_SemTryWait or +SDL_SemWaitTimeout +will atomically decrement the semaphore value. The locking operation will be blocked +if the semaphore value is not positive (greater than zero). Each unlock operation by +SDL_SemPost +will atomically increment the semaphore value.

Return Value

Returns a pointer to an initialized semaphore or +NULL if there was an error.

Examples

SDL_sem *my_sem;
+
+my_sem = SDL_CreateSemaphore(INITIAL_SEM_VALUE);
+
+if (my_sem == NULL) {
+        return CREATE_SEM_FAILED;
+}


PrevHomeNext
SDL_mutexVUpSDL_DestroySemaphore
\ No newline at end of file diff --git a/SDL/docs/html/sdlcreatethread.html b/SDL/docs/html/sdlcreatethread.html new file mode 100644 index 0000000..4c6a1a3 --- /dev/null +++ b/SDL/docs/html/sdlcreatethread.html @@ -0,0 +1,223 @@ +SDL_CreateThread
SDL Library Documentation
PrevNext

SDL_CreateThread

Name

SDL_CreateThread -- Creates a new thread of execution that shares its parent's properties.

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

SDL_Thread *SDL_CreateThread(int (*fn)(void *), void *data);

Description

SDL_CreateThread creates a new thread of execution +that shares all of its parent's global memory, signal handlers, +file descriptors, etc, and runs the function fn +passed the void pointer data +The thread quits when this function returns.


PrevHomeNext
Multi-threaded ProgrammingUpSDL_ThreadID
\ No newline at end of file diff --git a/SDL/docs/html/sdlcreateyuvoverlay.html b/SDL/docs/html/sdlcreateyuvoverlay.html new file mode 100644 index 0000000..b62a1b0 --- /dev/null +++ b/SDL/docs/html/sdlcreateyuvoverlay.html @@ -0,0 +1,256 @@ +SDL_CreateYUVOverlay
SDL Library Documentation
PrevNext

SDL_CreateYUVOverlay

Name

SDL_CreateYUVOverlay -- Create a YUV video overlay

Synopsis

#include "SDL.h"

SDL_Overlay *SDL_CreateYUVOverlay(int width, int height, Uint32 format, SDL_Surface *display);

Description

SDL_CreateYUVOverlay creates a YUV overlay of the specified width, height and format (see SDL_Overlay for a list of available formats), for the provided display. A SDL_Overlay structure is returned.

The term 'overlay' is a misnomer since, unless the overlay is created in hardware, the contents for the display surface underneath the area where the overlay is shown will be overwritten when the overlay is displayed.


PrevHomeNext
SDL_GL_SwapBuffersUpSDL_LockYUVOverlay
\ No newline at end of file diff --git a/SDL/docs/html/sdldelay.html b/SDL/docs/html/sdldelay.html new file mode 100644 index 0000000..c55cc87 --- /dev/null +++ b/SDL/docs/html/sdldelay.html @@ -0,0 +1,231 @@ +SDL_Delay
SDL Library Documentation
PrevNext

SDL_Delay

Name

SDL_Delay -- Wait a specified number of milliseconds before returning.

Synopsis

#include "SDL.h"

void SDL_Delay(Uint32 ms);

Description

Wait a specified number of milliseconds before returning. SDL_Delay will wait at least the specified time, but possible longer due to OS scheduling.

Note: Count on a delay granularity of at least 10 ms. +Some platforms have shorter clock ticks but this is the most common.

See Also

SDL_AddTimer


PrevHomeNext
SDL_GetTicksUpSDL_AddTimer
\ No newline at end of file diff --git a/SDL/docs/html/sdldestroycond.html b/SDL/docs/html/sdldestroycond.html new file mode 100644 index 0000000..d9d1bf8 --- /dev/null +++ b/SDL/docs/html/sdldestroycond.html @@ -0,0 +1,206 @@ +SDL_DestroyCond
SDL Library Documentation
PrevNext

SDL_DestroyCond

Name

SDL_DestroyCond -- Destroy a condition variable

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

void SDL_DestroyCond(SDL_cond *cond);

Description

Destroys a condition variable.


PrevHomeNext
SDL_CreateCondUpSDL_CondSignal
\ No newline at end of file diff --git a/SDL/docs/html/sdldestroymutex.html b/SDL/docs/html/sdldestroymutex.html new file mode 100644 index 0000000..eb9c24f --- /dev/null +++ b/SDL/docs/html/sdldestroymutex.html @@ -0,0 +1,209 @@ +SDL_DestroyMutex
SDL Library Documentation
PrevNext

SDL_DestroyMutex

Name

SDL_DestroyMutex -- Destroy a mutex

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

void SDL_DestroyMutex(SDL_mutex *mutex);

Description

Destroy a previously created mutex.


PrevHomeNext
SDL_CreateMutexUpSDL_mutexP
\ No newline at end of file diff --git a/SDL/docs/html/sdldestroysemaphore.html b/SDL/docs/html/sdldestroysemaphore.html new file mode 100644 index 0000000..dd151b3 --- /dev/null +++ b/SDL/docs/html/sdldestroysemaphore.html @@ -0,0 +1,278 @@ +SDL_DestroySemaphore
SDL Library Documentation
PrevNext

SDL_DestroySemaphore

Name

SDL_DestroySemaphore -- Destroys a semaphore that was created by SDL_CreateSemaphore.

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

void SDL_DestroySemaphore(SDL_sem *sem);

Description

SDL_DestroySemaphore destroys the semaphore pointed to +by sem that was created by +SDL_CreateSemaphore. +It is not safe to destroy a semaphore if there are threads currently blocked +waiting on it.

Examples

if (my_sem != NULL) {
+        SDL_DestroySemaphore(my_sem);
+        my_sem = NULL;
+}


PrevHomeNext
SDL_CreateSemaphoreUpSDL_SemWait
\ No newline at end of file diff --git a/SDL/docs/html/sdldisplayformat.html b/SDL/docs/html/sdldisplayformat.html new file mode 100644 index 0000000..f35ba0d --- /dev/null +++ b/SDL/docs/html/sdldisplayformat.html @@ -0,0 +1,262 @@ +SDL_DisplayFormat
SDL Library Documentation
PrevNext

SDL_DisplayFormat

Name

SDL_DisplayFormat -- Convert a surface to the display format

Synopsis

#include "SDL.h"

SDL_Surface *SDL_DisplayFormat(SDL_Surface *surface);

Description

This function takes a surface and copies it to a new surface of the +pixel format and colors of the video framebuffer, suitable for fast +blitting onto the display surface. It calls +SDL_ConvertSurface

If you want to take advantage of hardware colorkey or alpha blit +acceleration, you should set the colorkey and alpha value before +calling this function.

If you want an alpha channel, see SDL_DisplayFormatAlpha.

Return Value

If the conversion fails or runs out of memory, it returns +NULL


PrevHomeNext
SDL_FillRectUpSDL_DisplayFormatAlpha
\ No newline at end of file diff --git a/SDL/docs/html/sdldisplayformatalpha.html b/SDL/docs/html/sdldisplayformatalpha.html new file mode 100644 index 0000000..0e6b61a --- /dev/null +++ b/SDL/docs/html/sdldisplayformatalpha.html @@ -0,0 +1,250 @@ +SDL_DisplayFormatAlpha
SDL Library Documentation
PrevNext

SDL_DisplayFormatAlpha

Name

SDL_DisplayFormatAlpha -- Convert a surface to the display format

Synopsis

#include "SDL.h"

SDL_Surface *SDL_DisplayFormatAlpha(SDL_Surface *surface);

Description

This function takes a surface and copies it to a new surface of the +pixel format and colors of the video framebuffer plus an alpha channel, +suitable for fast blitting onto the display surface. It calls +SDL_ConvertSurface

If you want to take advantage of hardware colorkey or alpha blit +acceleration, you should set the colorkey and alpha value before +calling this function.

This function can be used to convert a colourkey to an alpha channel, +if the SDL_SRCCOLORKEY flag is set on the surface. +The generated surface will then be transparent (alpha=0) where the +pixels match the colourkey, and opaque (alpha=255) elsewhere.

Return Value

If the conversion fails or runs out of memory, it returns +NULL


PrevHomeNext
SDL_DisplayFormatUpSDL_WarpMouse
\ No newline at end of file diff --git a/SDL/docs/html/sdldisplayyuvoverlay.html b/SDL/docs/html/sdldisplayyuvoverlay.html new file mode 100644 index 0000000..b4f5300 --- /dev/null +++ b/SDL/docs/html/sdldisplayyuvoverlay.html @@ -0,0 +1,246 @@ +SDL_DisplayYUVOverlay
SDL Library Documentation
PrevNext

SDL_DisplayYUVOverlay

Name

SDL_DisplayYUVOverlay -- Blit the overlay to the display

Synopsis

#include "SDL.h"

int SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect);

Description

Blit the overlay to the surface specified when it was created. The SDL_Rect structure, dstrect, specifies the position and size of the destination. If the dstrect is a larger or smaller than the overlay then the overlay will be scaled, this is optimized for 2x scaling.

Return Values

Returns 0 on success


PrevHomeNext
SDL_UnlockYUVOverlayUpSDL_FreeYUVOverlay
\ No newline at end of file diff --git a/SDL/docs/html/sdlenablekeyrepeat.html b/SDL/docs/html/sdlenablekeyrepeat.html new file mode 100644 index 0000000..a13ca07 --- /dev/null +++ b/SDL/docs/html/sdlenablekeyrepeat.html @@ -0,0 +1,238 @@ +SDL_EnableKeyRepeat
SDL Library Documentation
PrevNext

SDL_EnableKeyRepeat

Name

SDL_EnableKeyRepeat -- Set keyboard repeat rate.

Synopsis

#include "SDL.h"

int SDL_EnableKeyRepeat(int delay, int interval);

Description

Enables or disables the keyboard repeat rate. delay specifies how long the key must be pressed before it begins repeating, it then repeats at the speed specified by interval. Both delay and interval are expressed in milliseconds.

Setting delay to 0 disables key repeating completely. Good default values are SDL_DEFAULT_REPEAT_DELAY and SDL_DEFAULT_REPEAT_INTERVAL.

Return Value

Returns 0 on success and -1 on failure.


PrevHomeNext
SDL_EnableUNICODEUpSDL_GetMouseState
\ No newline at end of file diff --git a/SDL/docs/html/sdlenableunicode.html b/SDL/docs/html/sdlenableunicode.html new file mode 100644 index 0000000..06cb1db --- /dev/null +++ b/SDL/docs/html/sdlenableunicode.html @@ -0,0 +1,252 @@ +SDL_EnableUNICODE
SDL Library Documentation
PrevNext

SDL_EnableUNICODE

Name

SDL_EnableUNICODE -- Enable UNICODE translation

Synopsis

#include "SDL.h"

int SDL_EnableUNICODE(int enable);

Description

Enables/Disables Unicode keyboard translation.

To obtain the character codes corresponding to received keyboard events, +Unicode translation must first be turned on using this function. The +translation incurs a slight overhead for each keyboard event and is therefore +disabled by default. For each subsequently received key down event, the +unicode member of the +SDL_keysym structure +will then contain the corresponding character code, or zero for keysyms that do +not correspond to any character code.

A value of 1 for enable enables Unicode translation; +0 disables it, and -1 leaves it unchanged (useful for querying the current +translation mode).

Note that only key press events will be translated, not release events.

Return Value

Returns the previous translation mode (0 or 1).

See Also

SDL_keysym


PrevHomeNext
SDL_GetKeyNameUpSDL_EnableKeyRepeat
\ No newline at end of file diff --git a/SDL/docs/html/sdlenvvars.html b/SDL/docs/html/sdlenvvars.html new file mode 100644 index 0000000..140073a --- /dev/null +++ b/SDL/docs/html/sdlenvvars.html @@ -0,0 +1,1212 @@ +SDL_envvars
SDL Library Documentation
PrevNext

SDL_envvars

Name

SDL_envvars -- SDL environment variables

Description

Not a function, set using setenv()

Several environment variables are available to modify the +behaviour of SDL. Using these variables isn't recommened and the names +and presence of these variables aren't guaranteed from one release to +the next. However, they can be very useful for debugging +purposes.

Video

SDL_FBACCEL

If set to 0, disable hardware acceleration in the linux fbcon driver.

SDL_FBDEV

Frame buffer device to use in the linux fbcon driver, instead of /dev/fb0

SDL_FULLSCREEN_UPDATE

In the ps2gs driver, sets the SDL_ASYNCBLIT flag on the +display surface.

SDL_VIDEODRIVER

Selectes the video driver for SDL to use. Possible values, in the +order they are tried if this variable is not set:

x11

dga

(the XFree86 DGA2)

nanox

(Linux)

fbcon

(Linux)

directfb

(Linux)

ps2gs

(Playstation 2)

ggi

vgl

(BSD)

svgalib

(Linux)

aalib

directx

(Win32)

windib

(Win32)

bwindow

(BeOS)

toolbox

(MacOS Classic)

DSp

(MacOS Classic)

Quartz

(Mac OS X)

CGX

(Amiga)

photon

(QNX)

dummy

SDL_VIDEO_CENTERED

If set, tries to center the SDL window when running in X11 windowed +mode, or using the CyberGrafix driver.

SDL_VIDEO_GL_DRIVER

The openGL driver (shared library) to use for X11. Default is libGL.so.1

SDL_VIDEO_X11_DGAMOUSE

With XFree86, enables use of DGA mouse if set.

SDL_VIDEO_X11_MOUSEACCEL

For X11, sets the mouse acceleration. The value should be a string +on the form:

"n/d/t"

where n and d are the +acceleration numerator/denumerators (so mouse movement is accelerated by +n/d), and +t is the threshold above which acceleration applies +(counted as number of pixels the mouse moves at once).

SDL_VIDEO_X11_NODIRECTCOLOR

If set, don't attempt to use DirectColor visuals even if they are +present. (SDL will use them otherwise for gamma correction). +This is needed with older X servers when using the XVideo extension.

SDL_VIDEO_X11_VISUALID

ID of an X11 visual to use, overriding SDL's default visual selection +algorithm. It can be in decimal or in hex (prefixed by 0x).

SDL_VIDEO_YUV_DIRECT

If set, display YUV overlay directly on the video surface if possible, +instead of on the surface passed to +SDL_CreateYUVOverlay.

SDL_VIDEO_YUV_HWACCEL

If not set or set to a nonzero value, SDL will attempt to use +hardware YUV acceleration for video playback.

SDL_WINDOWID

For X11 or Win32, contains the ID number of the window to be used by +SDL instead of creating its own window. Either in decimal or +in hex (prefixed by 0x).

Events/Input

SDL_MOUSE_RELATIVE

If set to 0, do not use mouse relative mode in X11. The default is +to use it if the mouse is hidden and input is grabbed.

SDL_MOUSEDEV

The mouse device to use for the linux fbcon driver. If not set, +SDL first tries to use GPM in repeater mode, then various other +devices (/dev/pcaux, /dev/adbmouse, /dev/mouse etc).

SDL_MOUSEDEV_IMPS2

If set, SDL will not try to auto-detect the IMPS/2 protocol of +a PS/2 mouse but use it right away. For the fbcon and ps2gs drivers.

SDL_MOUSEDRV

For the linux fbcon driver: if set to ELO, use the ELO touchscreen +controller as a pointer device

SDL_NO_RAWKBD

For the libvga driver: If set, do not attempt to put the keyboard in raw mode.

SDL_NOMOUSE

If set, the linux fbcon driver will not use a mouse at all.

SDL_NO_LOCK_KEYS

Disable CAPS-LOCK and NUM-LOCK suppression of down+up key events, +suitable for games where the player needs these keys to do more than just toggle. +A value of 1 will effect both CAPS-LOCK and NUM-LOCK. +A value of 2 will effect only CAPS-LOCK. +A value of 3 will effect only NUM-LOCK. +All other values have no effect. +

Audio

AUDIODEV

The audio device to use, if SDL_PATH_DSP isn't set.

SDL_AUDIODRIVER

Selects the audio driver for SDL to use. Possible values, in the +order they are tried if this variable is not set:

openbsd

(OpenBSD)

dsp

(OSS /dev/dsp: Linux, Solaris, BSD etc)

alsa

(Linux)

audio

(Unix style /dev/audio: SunOS, Solaris etc)

AL

(Irix)

artsc

(ARTS audio daemon)

esd

(esound audio daemon)

nas

(NAS audio daemon)

dma

(OSS /dev/dsp, using DMA)

dsound

(Win32 DirectX)

waveout

(Win32 WaveOut)

baudio

(BeOS)

sndmgr

(MacOS SoundManager)

paud

(AIX)

AHI

(Amiga)

disk

(all; output to file)

SDL_DISKAUDIOFILE

The name of the output file for the "disk" audio driver. If not +set, the name sdlaudio.raw is used.

SDL_DISKAUDIODELAY

For the "disk" audio driver, how long to wait (in ms) before writing +a full sound buffer. The default is 150 ms.

SDL_DSP_NOSELECT

For some audio drivers (alsa, paud, dma and dsp), don't use select() +but a timed method instead. May cure some audio problems, or cause +others.

SDL_PATH_DSP

The audio device to use. If not set, SDL tries AUDIODEV and then +a platform-dependent default value (/dev/audio on Solaris, +/dev/dsp on Linux etc).

CD-ROM

SDL_CDROM

A colon-separated list of CD-ROM devices to use, in addition to +the standard devices (typically /dev/cdrom, platform-dependent).

Debugging

SDL_DEBUG

If set, causes every call to SDL_SetError (that +is, every time SDL signals an error) to also print an error message on +stderr.

Joystick

SDL_JOYSTICK_DEVICE

Joystick device to use in the linux joystick driver, in addition +to the usual: /dev/js*, /dev/input/event*, /dev/input/js*

SDL_LINUX_JOYSTICK

Special joystick configuration string for linux. The format is

"name numaxes numhats numballs"

where name is the name string of the joystick +(possibly in single quotes), and the rest are the number of axes, hats +and balls respectively.


PrevHomeNext
SDL_GetErrorUpVideo
diff --git a/SDL/docs/html/sdlevent.html b/SDL/docs/html/sdlevent.html new file mode 100644 index 0000000..d80db8e --- /dev/null +++ b/SDL/docs/html/sdlevent.html @@ -0,0 +1,994 @@ +SDL_Event
SDL Library Documentation
PrevNext

SDL_Event

Name

SDL_Event -- General event structure

Structure Definition

typedef union{
+  Uint8 type;
+  SDL_ActiveEvent active;
+  SDL_KeyboardEvent key;
+  SDL_MouseMotionEvent motion;
+  SDL_MouseButtonEvent button;
+  SDL_JoyAxisEvent jaxis;
+  SDL_JoyBallEvent jball;
+  SDL_JoyHatEvent jhat;
+  SDL_JoyButtonEvent jbutton;
+  SDL_ResizeEvent resize;
+  SDL_ExposeEvent expose;
+  SDL_QuitEvent quit;
+  SDL_UserEvent user;
+  SDL_SysWMEvent syswm;
+} SDL_Event;

Description

The SDL_Event union is the core to all event handling is SDL, its probably the most important structure after SDL_Surface. SDL_Event is a union of all event structures used in SDL, using it is a simple matter of knowing which union member relates to which event type.

Event typeEvent Structure
SDL_ACTIVEEVENTSDL_ActiveEvent
SDL_KEYDOWN/UPSDL_KeyboardEvent
SDL_MOUSEMOTIONSDL_MouseMotionEvent
SDL_MOUSEBUTTONDOWN/UPSDL_MouseButtonEvent
SDL_JOYAXISMOTIONSDL_JoyAxisEvent
SDL_JOYBALLMOTIONSDL_JoyBallEvent
SDL_JOYHATMOTIONSDL_JoyHatEvent
SDL_JOYBUTTONDOWN/UPSDL_JoyButtonEvent
SDL_QUITSDL_QuitEvent
SDL_SYSWMEVENTSDL_SysWMEvent
SDL_VIDEORESIZESDL_ResizeEvent
SDL_VIDEOEXPOSESDL_ExposeEvent
SDL_USEREVENTSDL_UserEvent

Use

The SDL_Event structure has two uses

  • Reading events on the event queue

  • Placing events on the event queue

Reading events from the event queue is done with either SDL_PollEvent or SDL_PeepEvents. We'll use SDL_PollEvent and step through an example.

First off, we create an empty SDL_Event structure. +

SDL_Event test_event;
+SDL_PollEvent removes the next event from the event queue, if there are no events on the queue it returns 0 otherwise it returns 1. We use a while loop to process each event in turn. +
while(SDL_PollEvent(&test_event)) {
+The SDL_PollEvent function take a pointer to an SDL_Event structure that is to be filled with event information. We know that if SDL_PollEvent removes an event from the queue then the event information will be placed in our test_event structure, but we also know that the type of event will be placed in the type member of test_event. So to handle each event type seperately we use a switch statement. +
  switch(test_event.type) {
+We need to know what kind of events we're looking for and the event type's of those events. So lets assume we want to detect where the user is moving the mouse pointer within our application. We look through our event types and notice that SDL_MOUSEMOTION is, more than likely, the event we're looking for. A little more research tells use that SDL_MOUSEMOTION events are handled within the SDL_MouseMotionEvent structure which is the motion member of SDL_Event. We can check for the SDL_MOUSEMOTION event type within our switch statement like so: +
    case SDL_MOUSEMOTION:
+All we need do now is read the information out of the motion member of test_event. +
      printf("We got a motion event.\n");
+      printf("Current mouse position is: (%d, %d)\n", test_event.motion.x, test_event.motion.y);
+      break;
+    default:
+      printf("Unhandled Event!\n");
+      break;
+  }
+}
+printf("Event queue empty.\n");

It is also possible to push events onto the event queue and so use it as a two-way communication path. Both SDL_PushEvent and SDL_PeepEvents allow you to place events onto the event queue. This is usually used to place a SDL_USEREVENT on the event queue, however you could use it to post fake input events if you wished. Creating your own events is a simple matter of choosing the event type you want, setting the type member and filling the appropriate member structure with information. +

SDL_Event user_event;
+
+user_event.type=SDL_USEREVENT;
+user_event.user.code=2;
+user_event.user.data1=NULL;
+user_event.user.data2=NULL;
+SDL_PushEvent(&user_event);


PrevHomeNext
SDL Event Structures.UpSDL_ActiveEvent
diff --git a/SDL/docs/html/sdleventstate.html b/SDL/docs/html/sdleventstate.html new file mode 100644 index 0000000..3e47a12 --- /dev/null +++ b/SDL/docs/html/sdleventstate.html @@ -0,0 +1,276 @@ +SDL_EventState
SDL Library Documentation
PrevNext

SDL_EventState

Name

SDL_EventState -- This function allows you to set the state of processing certain events.

Synopsis

#include "SDL.h"

Uint8 SDL_EventState(Uint8 type, int state);

Description

This function allows you to set the state of processing certain event type's.

If state is set to SDL_IGNORE, +that event type will be automatically dropped from the event queue and will +not be filtered.

If state is set to SDL_ENABLE, +that event type will be processed normally.

If state is set to SDL_QUERY, +SDL_EventState will return the current processing +state of the specified event type.

A list of event type's can be found in the SDL_Event section.

See Also

SDL_Event


PrevHomeNext
SDL_GetEventFilterUpSDL_GetKeyState
\ No newline at end of file diff --git a/SDL/docs/html/sdlexposeevent.html b/SDL/docs/html/sdlexposeevent.html new file mode 100644 index 0000000..54ffb58 --- /dev/null +++ b/SDL/docs/html/sdlexposeevent.html @@ -0,0 +1,252 @@ +SDL_ExposeEvent
SDL Library Documentation
PrevNext

SDL_ExposeEvent

Name

SDL_ExposeEvent -- Quit requested event

Structure Definition

typedef struct{
+  Uint8 type
+} SDL_ExposeEvent;

Structure Data

typeSDL_VIDEOEXPOSE

Description

SDL_ExposeEvent is a member of the SDL_Event union and is used whan an event of type SDL_VIDEOEXPOSE is reported.

A VIDEOEXPOSE event is triggered when the screen has been modified +outside of the application, usually by the window manager and needs to +be redrawn.


PrevHomeNext
SDL_ResizeEventUpSDL_SysWMEvent
diff --git a/SDL/docs/html/sdlfillrect.html b/SDL/docs/html/sdlfillrect.html new file mode 100644 index 0000000..d84186c --- /dev/null +++ b/SDL/docs/html/sdlfillrect.html @@ -0,0 +1,291 @@ +SDL_FillRect
SDL Library Documentation
PrevNext

SDL_FillRect

Name

SDL_FillRect -- This function performs a fast fill of the given rectangle with some color

Synopsis

#include "SDL.h"

int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);

Description

This function performs a fast fill of the given rectangle with +color. If dstrect +is NULL, the whole surface will be filled with +color.

The color should be a pixel of the format used by the surface, and +can be generated by the +SDL_MapRGB or SDL_MapRGBA +functions. If the color value contains an alpha value then the +destination is simply "filled" with that alpha information, no blending +takes place.

If there is a clip rectangle set on the destination (set via +SDL_SetClipRect) then this +function will clip based on the intersection of the clip rectangle and +the dstrect rectangle and the dstrect rectangle +will be modified to represent the area actually filled.

Return Value

This function returns 0 on success, or +-1 on error.


PrevHomeNext
SDL_BlitSurfaceUpSDL_DisplayFormat
\ No newline at end of file diff --git a/SDL/docs/html/sdlflip.html b/SDL/docs/html/sdlflip.html new file mode 100644 index 0000000..00efb08 --- /dev/null +++ b/SDL/docs/html/sdlflip.html @@ -0,0 +1,259 @@ +SDL_Flip
SDL Library Documentation
PrevNext

SDL_Flip

Name

SDL_Flip -- Swaps screen buffers

Synopsis

#include "SDL.h"

int SDL_Flip(SDL_Surface *screen);

Description

On hardware that supports double-buffering, this function sets up a flip +and returns. The hardware will wait for vertical retrace, and then swap +video buffers before the next video surface blit or lock will return. +On hardware that doesn't support double-buffering, this is equivalent +to calling SDL_UpdateRect(screen, 0, 0, 0, 0)

The SDL_DOUBLEBUF flag must have been passed to +SDL_SetVideoMode, + when +setting the video mode for this function to perform hardware flipping.

Return Value

This function returns 0 if successful, or +-1 if there was an error.


PrevHomeNext
SDL_UpdateRectsUpSDL_SetColors
\ No newline at end of file diff --git a/SDL/docs/html/sdlfreecursor.html b/SDL/docs/html/sdlfreecursor.html new file mode 100644 index 0000000..f8d1cf9 --- /dev/null +++ b/SDL/docs/html/sdlfreecursor.html @@ -0,0 +1,209 @@ +SDL_FreeCursor
SDL Library Documentation
PrevNext

SDL_FreeCursor

Name

SDL_FreeCursor -- Frees a cursor created with SDL_CreateCursor.

Synopsis

#include "SDL.h"

void SDL_FreeCursor(SDL_Cursor *cursor);

Description

Frees a SDL_Cursor that was created using +SDL_CreateCursor.


PrevHomeNext
SDL_CreateCursorUpSDL_SetCursor
\ No newline at end of file diff --git a/SDL/docs/html/sdlfreesurface.html b/SDL/docs/html/sdlfreesurface.html new file mode 100644 index 0000000..da5705b --- /dev/null +++ b/SDL/docs/html/sdlfreesurface.html @@ -0,0 +1,219 @@ +SDL_FreeSurface
SDL Library Documentation
PrevNext

SDL_FreeSurface

Name

SDL_FreeSurface -- Frees (deletes) a SDL_Surface

Synopsis

#include "SDL.h"

void SDL_FreeSurface(SDL_Surface *surface);

Description

Frees the resources used by a previously created SDL_Surface. If the surface was created using +SDL_CreateRGBSurfaceFrom then the pixel data is not freed.


PrevHomeNext
SDL_CreateRGBSurfaceFromUpSDL_LockSurface
\ No newline at end of file diff --git a/SDL/docs/html/sdlfreewav.html b/SDL/docs/html/sdlfreewav.html new file mode 100644 index 0000000..e06bb30 --- /dev/null +++ b/SDL/docs/html/sdlfreewav.html @@ -0,0 +1,222 @@ +SDL_FreeWAV
SDL Library Documentation
PrevNext

SDL_FreeWAV

Name

SDL_FreeWAV -- Frees previously opened WAV data

Synopsis

#include "SDL.h"

void SDL_FreeWAV(Uint8 *audio_buf);

Description

After a WAVE file has been opened with SDL_LoadWAV its data can eventually be freed with SDL_FreeWAV. audio_buf is a pointer to the buffer created by SDL_LoadWAV.

See Also

SDL_LoadWAV


PrevHomeNext
SDL_LoadWAVUpSDL_AudioCVT
\ No newline at end of file diff --git a/SDL/docs/html/sdlfreeyuvoverlay.html b/SDL/docs/html/sdlfreeyuvoverlay.html new file mode 100644 index 0000000..204f9ff --- /dev/null +++ b/SDL/docs/html/sdlfreeyuvoverlay.html @@ -0,0 +1,233 @@ +SDL_FreeYUVOverlay
SDL Library Documentation
PrevNext

SDL_FreeYUVOverlay

Name

SDL_FreeYUVOverlay -- Free a YUV video overlay

Synopsis

#include "SDL.h"

void SDL_FreeYUVOverlay(SDL_Overlay *overlay);

Description

Frees and overlay created by SDL_CreateYUVOverlay.


PrevHomeNext
SDL_DisplayYUVOverlayUpSDL_GLattr
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetappstate.html b/SDL/docs/html/sdlgetappstate.html new file mode 100644 index 0000000..463fc5c --- /dev/null +++ b/SDL/docs/html/sdlgetappstate.html @@ -0,0 +1,263 @@ +SDL_GetAppState
SDL Library Documentation
PrevNext

SDL_GetAppState

Name

SDL_GetAppState -- Get the state of the application

Synopsis

#include "SDL.h"

Uint8 SDL_GetAppState(void);

Description

This function returns the current state of the application. The value returned is a bitwise combination of:

SDL_APPMOUSEFOCUSThe application has mouse focus.
SDL_APPINPUTFOCUSThe application has keyboard focus
SDL_APPACTIVEThe application is visible


PrevHomeNext
SDL_GetRelativeMouseStateUpSDL_JoystickEventState
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetaudiostatus.html b/SDL/docs/html/sdlgetaudiostatus.html new file mode 100644 index 0000000..8678f6e --- /dev/null +++ b/SDL/docs/html/sdlgetaudiostatus.html @@ -0,0 +1,221 @@ +SDL_GetAudioStatus
SDL Library Documentation
PrevNext

SDL_GetAudioStatus

Name

SDL_GetAudioStatus -- Get the current audio state

Synopsis

#include "SDL.h"

SDL_audiostatusSDL_GetAudioStatus(void);

Description

typedef enum{
+  SDL_AUDIO_STOPPED,
+  SDL_AUDIO_PAUSED,
+  SDL_AUDIO_PLAYING
+} SDL_audiostatus;

Returns either SDL_AUDIO_STOPPED, SDL_AUDIO_PAUSED or SDL_AUDIO_PLAYING depending on the current audio state.


PrevHomeNext
SDL_PauseAudioUpSDL_LoadWAV
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetcliprect.html b/SDL/docs/html/sdlgetcliprect.html new file mode 100644 index 0000000..a2b15bf --- /dev/null +++ b/SDL/docs/html/sdlgetcliprect.html @@ -0,0 +1,229 @@ +SDL_GetClipRect
SDL Library Documentation
PrevNext

SDL_GetClipRect

Name

SDL_GetClipRect -- Gets the clipping rectangle for a surface.

Synopsis

#include "SDL.h"

void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect);

Description

Gets the clipping rectangle for a surface. When this surface is the +destination of a blit, only the area within the clip rectangle is +drawn into.

The rectangle pointed to by rect will be +filled with the clipping rectangle of the surface.


PrevHomeNext
SDL_SetClipRectUpSDL_ConvertSurface
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetcursor.html b/SDL/docs/html/sdlgetcursor.html new file mode 100644 index 0000000..d4e2499 --- /dev/null +++ b/SDL/docs/html/sdlgetcursor.html @@ -0,0 +1,219 @@ +SDL_GetCursor
SDL Library Documentation
PrevNext

SDL_GetCursor

Name

SDL_GetCursor -- Get the currently active mouse cursor.

Synopsis

#include "SDL.h"

SDL_Cursor *SDL_GetCursor(void);

Description

Returns the currently active mouse cursor.


PrevHomeNext
SDL_SetCursorUpSDL_ShowCursor
\ No newline at end of file diff --git a/SDL/docs/html/sdlgeterror.html b/SDL/docs/html/sdlgeterror.html new file mode 100644 index 0000000..ad071ae --- /dev/null +++ b/SDL/docs/html/sdlgeterror.html @@ -0,0 +1,205 @@ +SDL_GetError
SDL Library Documentation
PrevNext

SDL_GetError

Name

SDL_GetError -- Get SDL error string

Synopsis

#include "SDL/SDL.h"

char *SDL_GetError(void);

Description

SDL_GetError returns a NULL terminated string containing information about the last internal SDL error.

Return Value

SDL_GetError returns a string containing the last error.


PrevHomeNext
SDL_WasInitUpSDL_envvars
\ No newline at end of file diff --git a/SDL/docs/html/sdlgeteventfilter.html b/SDL/docs/html/sdlgeteventfilter.html new file mode 100644 index 0000000..e5c0027 --- /dev/null +++ b/SDL/docs/html/sdlgeteventfilter.html @@ -0,0 +1,235 @@ +SDL_GetEventFilter
SDL Library Documentation
PrevNext

SDL_GetEventFilter

Name

SDL_GetEventFilter -- Retrieves a pointer to he event filter

Synopsis

#include "SDL.h"

SDL_EventFilter SDL_GetEventFilter(void);

Description

This function retrieces a pointer to the event filter that was previously set using SDL_SetEventFilter. An SDL_EventFilter function is defined as: +

typedef int (*SDL_EventFilter)(const SDL_Event *event);

Return Value

Returns a pointer to the event filter or NULL if no filter has been set.


PrevHomeNext
SDL_SetEventFilterUpSDL_EventState
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetgammaramp.html b/SDL/docs/html/sdlgetgammaramp.html new file mode 100644 index 0000000..5c09823 --- /dev/null +++ b/SDL/docs/html/sdlgetgammaramp.html @@ -0,0 +1,219 @@ +SDL_GetGammaRamp
SDL Library Documentation
PrevNext

SDL_GetGammaRamp

Name

SDL_GetGammaRamp -- Gets the color gamma lookup tables for the display

Synopsis

#include "SDL.h"

int SDL_GetGammaRamp(Uint16 *redtable, Uint16 *greentable, Uint16 *bluetable);

Description

Gets the gamma translation lookup tables currently used by the display. +Each table is an array of 256 Uint16 values.

Not all display hardware is able to change gamma.

Return Value

Returns -1 on error.


PrevHomeNext
SDL_SetGammaUpSDL_SetGammaRamp
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetkeyname.html b/SDL/docs/html/sdlgetkeyname.html new file mode 100644 index 0000000..b6a1141 --- /dev/null +++ b/SDL/docs/html/sdlgetkeyname.html @@ -0,0 +1,216 @@ +SDL_GetKeyName
SDL Library Documentation
PrevNext

SDL_GetKeyName

Name

SDL_GetKeyName -- Get the name of an SDL virtual keysym

Synopsis

#include "SDL.h"

char *SDL_GetKeyName(SDLKey key);

Description

Returns the SDL-defined name of the SDLKey key.

See Also

SDLKey


PrevHomeNext
SDL_SetModStateUpSDL_EnableUNICODE
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetkeystate.html b/SDL/docs/html/sdlgetkeystate.html new file mode 100644 index 0000000..4c81c58 --- /dev/null +++ b/SDL/docs/html/sdlgetkeystate.html @@ -0,0 +1,253 @@ +SDL_GetKeyState
SDL Library Documentation
PrevNext

SDL_GetKeyState

Name

SDL_GetKeyState -- Get a snapshot of the current keyboard state

Synopsis

#include "SDL.h"

Uint8 *SDL_GetKeyState(int *numkeys);

Description

Gets a snapshot of the current keyboard state. The current state is return as a pointer to an array, the size of this array is stored in numkeys. The array is indexed by the SDLK_* symbols. A value of 1 means the key is pressed and a value of 0 means its not. The pointer returned is a pointer to an internal SDL array and should not be freed by the caller.

Note: Use SDL_PumpEvents to update the state array.

Example

Uint8 *keystate = SDL_GetKeyState(NULL);
+if ( keystate[SDLK_RETURN] ) printf("Return Key Pressed.\n");


PrevHomeNext
SDL_EventStateUpSDL_GetModState
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetmodstate.html b/SDL/docs/html/sdlgetmodstate.html new file mode 100644 index 0000000..1418569 --- /dev/null +++ b/SDL/docs/html/sdlgetmodstate.html @@ -0,0 +1,257 @@ +SDL_GetModState
SDL Library Documentation
PrevNext

SDL_GetModState

Name

SDL_GetModState -- Get the state of modifier keys.

Synopsis

#include "SDL.h"

SDLMod SDL_GetModState(void);

Description

Returns the current state of the modifier keys (CTRL, ALT, etc.).

Return Value

The return value can be an OR'd combination of the SDLMod enum.

SDLMod

typedef enum {
+  KMOD_NONE  = 0x0000,
+  KMOD_LSHIFT= 0x0001,
+  KMOD_RSHIFT= 0x0002,
+  KMOD_LCTRL = 0x0040,
+  KMOD_RCTRL = 0x0080,
+  KMOD_LALT  = 0x0100,
+  KMOD_RALT  = 0x0200,
+  KMOD_LMETA = 0x0400,
+  KMOD_RMETA = 0x0800,
+  KMOD_NUM   = 0x1000,
+  KMOD_CAPS  = 0x2000,
+  KMOD_MODE  = 0x4000,
+} SDLMod;
+SDL also defines the following symbols for convenience: +
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
+#define KMOD_SHIFT  (KMOD_LSHIFT|KMOD_RSHIFT)
+#define KMOD_ALT  (KMOD_LALT|KMOD_RALT)
+#define KMOD_META (KMOD_LMETA|KMOD_RMETA)


PrevHomeNext
SDL_GetKeyStateUpSDL_SetModState
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetmousestate.html b/SDL/docs/html/sdlgetmousestate.html new file mode 100644 index 0000000..c9e7d29 --- /dev/null +++ b/SDL/docs/html/sdlgetmousestate.html @@ -0,0 +1,253 @@ +SDL_GetMouseState
SDL Library Documentation
PrevNext

SDL_GetMouseState

Name

SDL_GetMouseState -- Retrieve the current state of the mouse

Synopsis

#include "SDL.h"

Uint8 SDL_GetMouseState(int *x, int *y);

Description

The current button state is returned as a button bitmask, which can +be tested using the SDL_BUTTON(X) macros, and x and y are set to the +current mouse cursor position. You can pass NULL for either x or y.

Example

SDL_PumpEvents();
+if(SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
+  printf("Mouse Button 1(left) is pressed.\n");

PrevHomeNext
SDL_EnableKeyRepeatUpSDL_GetRelativeMouseState
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetrelativemousestate.html b/SDL/docs/html/sdlgetrelativemousestate.html new file mode 100644 index 0000000..095a79d --- /dev/null +++ b/SDL/docs/html/sdlgetrelativemousestate.html @@ -0,0 +1,235 @@ +SDL_GetRelativeMouseState
SDL Library Documentation
PrevNext

SDL_GetRelativeMouseState

Name

SDL_GetRelativeMouseState -- Retrieve the current state of the mouse

Synopsis

#include "SDL.h"

Uint8 SDL_GetRelativeMouseState(int *x, int *y);

Description

The current button state is returned as a button bitmask, which can +be tested using the SDL_BUTTON(X) macros, and x and y are set to the change in the mouse position since the last call to SDL_GetRelativeMouseState or since event initialization. You can pass NULL for either x or y.


PrevHomeNext
SDL_GetMouseStateUpSDL_GetAppState
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetrgb.html b/SDL/docs/html/sdlgetrgb.html new file mode 100644 index 0000000..3a4ab36 --- /dev/null +++ b/SDL/docs/html/sdlgetrgb.html @@ -0,0 +1,231 @@ +SDL_GetRGB
SDL Library Documentation
PrevNext

SDL_GetRGB

Name

SDL_GetRGB -- Get RGB values from a pixel in the specified pixel format.

Synopsis

#include "SDL.h"

void SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b);

Description

Get RGB component values from a pixel stored in the specified pixel format.

This function uses the entire 8-bit [0..255] range when converting color +components from pixel formats with less than 8-bits per RGB component +(e.g., a completely white pixel in 16-bit RGB565 format would return +[0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).


PrevHomeNext
SDL_MapRGBAUpSDL_GetRGBA
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetrgba.html b/SDL/docs/html/sdlgetrgba.html new file mode 100644 index 0000000..51ee414 --- /dev/null +++ b/SDL/docs/html/sdlgetrgba.html @@ -0,0 +1,222 @@ +SDL_GetRGBA
SDL Library Documentation
PrevNext

SDL_GetRGBA

Name

SDL_GetRGBA -- Get RGBA values from a pixel in the specified pixel format.

Synopsis

#include "SDL.h"

void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);

Description

Get RGBA component values from a pixel stored in the specified pixel format.

This function uses the entire 8-bit [0..255] range when converting color +components from pixel formats with less than 8-bits per RGB component +(e.g., a completely white pixel in 16-bit RGB565 format would return +[0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).

If the surface has no alpha component, the alpha will be returned as 0xff +(100% opaque).


PrevHomeNext
SDL_GetRGBUpSDL_CreateRGBSurface
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetthreadid.html b/SDL/docs/html/sdlgetthreadid.html new file mode 100644 index 0000000..6da9378 --- /dev/null +++ b/SDL/docs/html/sdlgetthreadid.html @@ -0,0 +1,209 @@ +SDL_GetThreadID
SDL Library Documentation
PrevNext

SDL_GetThreadID

Name

SDL_GetThreadID -- Get the SDL thread ID of a SDL_Thread

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

Uint32 SDL_GetThreadID(SDL_Thread *thread);

Description

Returns the ID of a SDL_Thread created by SDL_CreateThread.


PrevHomeNext
SDL_ThreadIDUpSDL_WaitThread
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetticks.html b/SDL/docs/html/sdlgetticks.html new file mode 100644 index 0000000..5e42399 --- /dev/null +++ b/SDL/docs/html/sdlgetticks.html @@ -0,0 +1,206 @@ +SDL_GetTicks
SDL Library Documentation
PrevNext

SDL_GetTicks

Name

SDL_GetTicks -- Get the number of milliseconds since the SDL library initialization.

Synopsis

#include "SDL.h"

Uint32 SDL_GetTicks(void);

Description

Get the number of milliseconds since the SDL library initialization. +Note that this value wraps if the program runs for more than ~49 days.

See Also

SDL_Delay


PrevHomeNext
TimeUpSDL_Delay
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetvideoinfo.html b/SDL/docs/html/sdlgetvideoinfo.html new file mode 100644 index 0000000..9ce9c48 --- /dev/null +++ b/SDL/docs/html/sdlgetvideoinfo.html @@ -0,0 +1,226 @@ +SDL_GetVideoInfo
SDL Library Documentation
PrevNext

SDL_GetVideoInfo

Name

SDL_GetVideoInfo -- returns a pointer to information about the video hardware

Synopsis

#include "SDL.h"

SDL_VideoInfo *SDL_GetVideoInfo(void);

Description

This function returns a read-only pointer to information about the video +hardware. If this is called before SDL_SetVideoMode, the +vfmt member of the returned structure will contain the +pixel format of the "best" video mode.


PrevHomeNext
SDL_GetVideoSurfaceUpSDL_VideoDriverName
\ No newline at end of file diff --git a/SDL/docs/html/sdlgetvideosurface.html b/SDL/docs/html/sdlgetvideosurface.html new file mode 100644 index 0000000..5b8a543 --- /dev/null +++ b/SDL/docs/html/sdlgetvideosurface.html @@ -0,0 +1,208 @@ +SDL_GetVideoSurface
SDL Library Documentation
PrevNext

SDL_GetVideoSurface

Name

SDL_GetVideoSurface -- returns a pointer to the current display surface

Synopsis

#include "SDL.h"

SDL_Surface *SDL_GetVideoSurface(void);

Description

This function returns a pointer to the current display surface. +If SDL is doing format conversion on the display surface, this +function returns the publicly visible surface, not the real video +surface.

See Also

SDL_Surface


PrevHomeNext
VideoUpSDL_GetVideoInfo
\ No newline at end of file diff --git a/SDL/docs/html/sdlglattr.html b/SDL/docs/html/sdlglattr.html new file mode 100644 index 0000000..ff23fb8 --- /dev/null +++ b/SDL/docs/html/sdlglattr.html @@ -0,0 +1,379 @@ +SDL_GLattr
SDL Library Documentation
PrevNext

SDL_GLattr

Name

SDL_GLattr -- SDL GL Attributes

Attributes

SDL_GL_RED_SIZESize of the framebuffer red component, in bits
SDL_GL_GREEN_SIZESize of the framebuffer green component, in bits
SDL_GL_BLUE_SIZESize of the framebuffer blue component, in bits
SDL_GL_ALPHA_SIZESize of the framebuffer alpha component, in bits
SDL_GL_DOUBLEBUFFER0 or 1, enable or disable double buffering
SDL_GL_BUFFER_SIZESize of the framebuffer, in bits
SDL_GL_DEPTH_SIZESize of the depth buffer, in bits
SDL_GL_STENCIL_SIZESize of the stencil buffer, in bits
SDL_GL_ACCUM_RED_SIZESize of the accumulation buffer red component, in bits
SDL_GL_ACCUM_GREEN_SIZESize of the accumulation buffer green component, in bits
SDL_GL_ACCUM_BLUE_SIZESize of the accumulation buffer blue component, in bits
SDL_GL_ACCUM_ALPHA_SIZESize of the accumulation buffer alpha component, in bits

Description

While you can set most OpenGL attributes normally, the attributes list above must be known before SDL sets the video mode. These attributes a set and read with SDL_GL_SetAttribute and SDL_GL_GetAttribute.


PrevHomeNext
SDL_FreeYUVOverlayUpSDL_Rect
\ No newline at end of file diff --git a/SDL/docs/html/sdlglgetattribute.html b/SDL/docs/html/sdlglgetattribute.html new file mode 100644 index 0000000..c850763 --- /dev/null +++ b/SDL/docs/html/sdlglgetattribute.html @@ -0,0 +1,247 @@ +SDL_GL_GetAttribute
SDL Library Documentation
PrevNext

SDL_GL_GetAttribute

Name

SDL_GL_GetAttribute -- Get the value of a special SDL/OpenGL attribute

Synopsis

#include "SDL.h"

int SDL_GL_GetAttribute(SDLGLattr attr, int *value);

Description

Places the value of the SDL/OpenGL attribute attr into value. This is useful after a call to SDL_SetVideoMode to check whether your attributes have been set as you expected.

Return Value

Returns 0 on success, or -1 on an error.


PrevHomeNext
SDL_GL_GetProcAddressUpSDL_GL_SetAttribute
\ No newline at end of file diff --git a/SDL/docs/html/sdlglgetprocaddress.html b/SDL/docs/html/sdlglgetprocaddress.html new file mode 100644 index 0000000..5bdb082 --- /dev/null +++ b/SDL/docs/html/sdlglgetprocaddress.html @@ -0,0 +1,262 @@ +SDL_GL_GetProcAddress
SDL Library Documentation
PrevNext

SDL_GL_GetProcAddress

Name

SDL_GL_GetProcAddress -- Get the address of a GL function

Synopsis

#include "SDL.h"

void *SDL_GL_GetProcAddress(const char* proc);

Description

Returns the address of the GL function proc, or NULL if the function is not found. If the GL library is loaded at runtime, with SDL_GL_LoadLibrary, then all GL functions must be retrieved this way. Usually this is used to retrieve function pointers to OpenGL extensions.

Example

typedef void (*GL_ActiveTextureARB_Func)(unsigned int);
+GL_ActiveTextureARB_Func glActiveTextureARB_ptr = 0;
+int has_multitexture=1;
+.
+.
+.
+/* Get function pointer */
+glActiveTextureARB_ptr=(GL_ActiveTextureARB_Func) SDL_GL_GetProcAddress("glActiveTextureARB");
+
+/* Check for a valid function ptr */
+if(!glActiveTextureARB_ptr){
+  fprintf(stderr, "Multitexture Extensions not present.\n");
+  has_multitexture=0;
+}
+.
+.
+.
+.
+if(has_multitexture){
+  glActiveTextureARB_ptr(GL_TEXTURE0_ARB);
+  .
+  .
+}
+else{
+  .
+  .
+}

PrevHomeNext
SDL_GL_LoadLibraryUpSDL_GL_GetAttribute
\ No newline at end of file diff --git a/SDL/docs/html/sdlglloadlibrary.html b/SDL/docs/html/sdlglloadlibrary.html new file mode 100644 index 0000000..2685cb6 --- /dev/null +++ b/SDL/docs/html/sdlglloadlibrary.html @@ -0,0 +1,231 @@ +SDL_GL_LoadLibrary
SDL Library Documentation
PrevNext

SDL_GL_LoadLibrary

Name

SDL_GL_LoadLibrary -- Specify an OpenGL library

Synopsis

#include "SDL.h"

int SDL_GL_LoadLibrary(const char *path);

Description

If you wish, you may load the OpenGL library at runtime, this must be done before SDL_SetVideoMode is called. The path of the GL library is passed to SDL_GL_LoadLibrary and it returns 0 on success, or -1 on an error. You must then use SDL_GL_GetProcAddress to retrieve function pointers to GL functions.


PrevHomeNext
SDL_ShowCursorUpSDL_GL_GetProcAddress
\ No newline at end of file diff --git a/SDL/docs/html/sdlglsetattribute.html b/SDL/docs/html/sdlglsetattribute.html new file mode 100644 index 0000000..07c8b50 --- /dev/null +++ b/SDL/docs/html/sdlglsetattribute.html @@ -0,0 +1,286 @@ +SDL_GL_SetAttribute
SDL Library Documentation
PrevNext

SDL_GL_SetAttribute

Name

SDL_GL_SetAttribute -- Set a special SDL/OpenGL attribute

Synopsis

#include "SDL.h"

int SDL_GL_SetAttribute(SDL_GLattr attr, int value);

Description

Sets the OpenGL attribute attr to value. The attributes you set don't take effect until after a call to SDL_SetVideoMode. You should use SDL_GL_GetAttribute to check the values after a SDL_SetVideoMode call.

Return Value

Returns 0 on success, or -1 on error.

Example

SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
+SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
+SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
+SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
+SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
+if ( (screen=SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL )) == NULL ) {
+  fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
+  SDL_Quit();
+  return;
+}

Note: The SDL_DOUBLEBUF flag is not required to enable double buffering when setting an OpenGL video mode. Double buffering is enabled or disabled using the SDL_GL_DOUBLEBUFFER attribute.


PrevHomeNext
SDL_GL_GetAttributeUpSDL_GL_SwapBuffers
\ No newline at end of file diff --git a/SDL/docs/html/sdlglswapbuffers.html b/SDL/docs/html/sdlglswapbuffers.html new file mode 100644 index 0000000..21c60b4 --- /dev/null +++ b/SDL/docs/html/sdlglswapbuffers.html @@ -0,0 +1,212 @@ +SDL_GL_SwapBuffers
SDL Library Documentation
PrevNext

SDL_GL_SwapBuffers

Name

SDL_GL_SwapBuffers -- Swap OpenGL framebuffers/Update Display

Synopsis

#include "SDL.h"

void SDL_GL_SwapBuffers(void );

Description

Swap the OpenGL buffers, if double-buffering is supported.


PrevHomeNext
SDL_GL_SetAttributeUpSDL_CreateYUVOverlay
\ No newline at end of file diff --git a/SDL/docs/html/sdlinit.html b/SDL/docs/html/sdlinit.html new file mode 100644 index 0000000..aaf7ddc --- /dev/null +++ b/SDL/docs/html/sdlinit.html @@ -0,0 +1,368 @@ +SDL_Init
SDL Library Documentation
PrevNext

SDL_Init

Name

SDL_Init -- Initializes SDL

Synopsis

#include "SDL.h"

int SDL_Init(Uint32 flags);

Description

Initializes SDL. This should be called before all other SDL functions. The flags parameter specifies what part(s) of SDL to initialize.

SDL_INIT_TIMERInitializes the timer subsystem.
SDL_INIT_AUDIOInitializes the audio subsystem.
SDL_INIT_VIDEOInitializes the video subsystem.
SDL_INIT_CDROMInitializes the cdrom subsystem.
SDL_INIT_JOYSTICKInitializes the joystick subsystem.
SDL_INIT_EVERYTHINGInitialize all of the above.
SDL_INIT_NOPARACHUTEPrevents SDL from catching fatal signals.
SDL_INIT_EVENTTHREAD 

Return Value

Returns -1 on an error or 0 on success.


PrevHomeNext
GeneralUpSDL_InitSubSystem
\ No newline at end of file diff --git a/SDL/docs/html/sdlinitsubsystem.html b/SDL/docs/html/sdlinitsubsystem.html new file mode 100644 index 0000000..897755f --- /dev/null +++ b/SDL/docs/html/sdlinitsubsystem.html @@ -0,0 +1,283 @@ +SDL_InitSubSystem
SDL Library Documentation
PrevNext

SDL_InitSubSystem

Name

SDL_InitSubSystem -- Initialize subsystems

Synopsis

#include "SDL.h"

int SDL_InitSubSystem(Uint32 flags);

Description

After SDL has been initialized with SDL_Init you may initialize uninitialized subsystems with SDL_InitSubSystem. The flags parameter is the same as that used in SDL_Init.

Examples

/* Seperating Joystick and Video initialization. */
+SDL_Init(SDL_INIT_VIDEO);
+.
+.
+SDL_SetVideoMode(640, 480, 16, SDL_DOUBLEBUF|SDL_FULLSCREEN);
+.
+/* Do Some Video stuff */
+.
+.
+/* Initialize the joystick subsystem */
+SDL_InitSubSystem(SDL_INIT_JOYSTICK);
+
+/* Do some stuff with video and joystick */
+.
+.
+.
+/* Shut them both down */
+SDL_Quit();

Return Value

Returns -1 on an error or 0 on success.


PrevHomeNext
SDL_InitUpSDL_QuitSubSystem
\ No newline at end of file diff --git a/SDL/docs/html/sdljoyaxisevent.html b/SDL/docs/html/sdljoyaxisevent.html new file mode 100644 index 0000000..afb152c --- /dev/null +++ b/SDL/docs/html/sdljoyaxisevent.html @@ -0,0 +1,330 @@ +SDL_JoyAxisEvent
SDL Library Documentation
PrevNext

SDL_JoyAxisEvent

Name

SDL_JoyAxisEvent -- Joystick axis motion event structure

Structure Definition

typedef struct{
+  Uint8 type;
+  Uint8 which;
+  Uint8 axis;
+  Sint16 value;
+} SDL_JoyAxisEvent;

Structure Data

typeSDL_JOYAXISMOTION
whichJoystick device index
axisJoystick axis index
valueAxis value (range: -32768 to 32767)

Description

SDL_JoyAxisEvent is a member of the SDL_Event union and is used when an event of type SDL_JOYAXISMOTION is reported.

A SDL_JOYAXISMOTION event occurs when ever a user moves an axis on the joystick. The field which is the index of the joystick that reported the event and axis is the index of the axis (for a more detailed explaination see the Joystick section). value is the current position of the axis.


PrevHomeNext
SDL_MouseButtonEventUpSDL_JoyButtonEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdljoyballevent.html b/SDL/docs/html/sdljoyballevent.html new file mode 100644 index 0000000..33b9efd --- /dev/null +++ b/SDL/docs/html/sdljoyballevent.html @@ -0,0 +1,340 @@ +SDL_JoyBallEvent
SDL Library Documentation
PrevNext

SDL_JoyBallEvent

Name

SDL_JoyBallEvent -- Joystick trackball motion event structure

Structure Definition

typedef struct{
+  Uint8 type;
+  Uint8 which;
+  Uint8 ball;
+  Sint16 xrel, yrel;
+} SDL_JoyBallEvent;

Structure Data

typeSDL_JOYBALLMOTION
whichJoystick device index
ballJoystick trackball index
xrel, yrelThe relative motion in the X/Y direction

Description

SDL_JoyBallEvent is a member of the SDL_Event union and is used when an event of type SDL_JOYBALLMOTION is reported.

A SDL_JOYBALLMOTION event occurs when a user moves a trackball on the joystick. The field which is the index of the joystick that reported the event and ball is the index of the trackball (for a more detailed explaination see the Joystick section). Trackballs only return relative motion, this is the change in position on the ball since it was last polled (last cycle of the event loop) and it is stored in xrel and yrel.


PrevHomeNext
SDL_JoyHatEventUpSDL_ResizeEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdljoybuttonevent.html b/SDL/docs/html/sdljoybuttonevent.html new file mode 100644 index 0000000..99cf882 --- /dev/null +++ b/SDL/docs/html/sdljoybuttonevent.html @@ -0,0 +1,351 @@ +SDL_JoyButtonEvent
SDL Library Documentation
PrevNext

SDL_JoyButtonEvent

Name

SDL_JoyButtonEvent -- Joystick button event structure

Structure Definition

typedef struct{
+  Uint8 type;
+  Uint8 which;
+  Uint8 button;
+  Uint8 state;
+} SDL_JoyButtonEvent;

Structure Data

typeSDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP
whichJoystick device index
buttonJoystick button index
stateSDL_PRESSED or SDL_RELEASED

Description

SDL_JoyButtonEvent is a member of the SDL_Event union and is used when an event of type SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP is reported.

A SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP event occurs when ever a user presses or releases a button on a joystick. The field which is the index of the joystick that reported the event and button is the index of the button (for a more detailed explaination see the Joystick section). state is the current state or the button which is either SDL_PRESSED or SDL_RELEASED.


PrevHomeNext
SDL_JoyAxisEventUpSDL_JoyHatEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdljoyhatevent.html b/SDL/docs/html/sdljoyhatevent.html new file mode 100644 index 0000000..3007dd7 --- /dev/null +++ b/SDL/docs/html/sdljoyhatevent.html @@ -0,0 +1,413 @@ +SDL_JoyHatEvent
SDL Library Documentation
PrevNext

SDL_JoyHatEvent

Name

SDL_JoyHatEvent -- Joystick hat position change event structure

Structure Definition

typedef struct{
+  Uint8 type;
+  Uint8 which;
+  Uint8 hat;
+  Uint8 value;
+} SDL_JoyHatEvent;

Structure Data

typeSDL_JOY
whichJoystick device index
hatJoystick hat index
valueHat position

Description

SDL_JoyHatEvent is a member of the SDL_Event union and is used when an event of type SDL_JOYHATMOTION is reported.

A SDL_JOYHATMOTION event occurs when ever a user moves a hat on the joystick. The field which is the index of the joystick that reported the event and hat is the index of the hat (for a more detailed exlaination see the Joystick section). value is the current position of the hat. It is a logically OR'd combination of the following values (whose meanings should be pretty obvious:) :

SDL_HAT_CENTERED
SDL_HAT_UP
SDL_HAT_RIGHT
SDL_HAT_DOWN
SDL_HAT_LEFT

The following defines are also provided:

SDL_HAT_RIGHTUP
SDL_HAT_RIGHTDOWN
SDL_HAT_LEFTUP
SDL_HAT_LEFTDOWN


PrevHomeNext
SDL_JoyButtonEventUpSDL_JoyBallEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdljoystickclose.html b/SDL/docs/html/sdljoystickclose.html new file mode 100644 index 0000000..f505285 --- /dev/null +++ b/SDL/docs/html/sdljoystickclose.html @@ -0,0 +1,223 @@ +SDL_JoystickClose
SDL Library Documentation
PrevNext

SDL_JoystickClose

Name

SDL_JoystickClose -- Closes a previously opened joystick

Synopsis

#include "SDL.h"

void SDL_JoystickClose(SDL_Joystick *joystick);

Description

Close a joystick that was previously opened with SDL_JoystickOpen.


PrevHomeNext
SDL_JoystickGetBallUpAudio
\ No newline at end of file diff --git a/SDL/docs/html/sdljoystickeventstate.html b/SDL/docs/html/sdljoystickeventstate.html new file mode 100644 index 0000000..f76465e --- /dev/null +++ b/SDL/docs/html/sdljoystickeventstate.html @@ -0,0 +1,290 @@ +SDL_JoystickEventState
SDL Library Documentation
PrevNext

SDL_JoystickEventState

Name

SDL_JoystickEventState -- Enable/disable joystick event polling

Synopsis

#include "SDL.h"

int SDL_JoystickEventState(int state);

Description

This function is used to enable or disable joystick event processing. With joystick event processing disabled you will have to update joystick states with SDL_JoystickUpdate and read the joystick information manually. state is either SDL_QUERY, SDL_ENABLE or SDL_IGNORE.

Note: Joystick event handling is prefered

Return Value

If state is SDL_QUERY then the current state is returned, otherwise the new processing state is returned.


PrevHomeNext
SDL_GetAppStateUpJoystick
\ No newline at end of file diff --git a/SDL/docs/html/sdljoystickgetaxis.html b/SDL/docs/html/sdljoystickgetaxis.html new file mode 100644 index 0000000..6f15d1d --- /dev/null +++ b/SDL/docs/html/sdljoystickgetaxis.html @@ -0,0 +1,271 @@ +SDL_JoystickGetAxis
SDL Library Documentation
PrevNext

SDL_JoystickGetAxis

Name

SDL_JoystickGetAxis -- Get the current state of an axis

Synopsis

#include "SDL.h"

Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);

Description

SDL_JoystickGetAxis returns the current state of the given axis on the given joystick.

On most modern joysticks the X axis is usually represented by axis 0 and the Y axis by axis 1. The value returned by SDL_JoystickGetAxis is a signed integer (-32768 to 32768) representing the current position of the axis, it maybe necessary to impose certain tolerances on these values to account for jitter. It is worth noting that some joysticks use axes 2 and 3 for extra buttons.

Return Value

Returns a 16-bit signed integer representing the current position of the axis.

Examples

Sint16 x_move, y_move;
+SDL_Joystick *joy1;
+.
+.
+x_move=SDL_JoystickGetAxis(joy1, 0);
+y_move=SDL_JoystickGetAxis(joy1, 1);


PrevHomeNext
SDL_JoystickUpdateUpSDL_JoystickGetHat
\ No newline at end of file diff --git a/SDL/docs/html/sdljoystickgetball.html b/SDL/docs/html/sdljoystickgetball.html new file mode 100644 index 0000000..a69c9d4 --- /dev/null +++ b/SDL/docs/html/sdljoystickgetball.html @@ -0,0 +1,262 @@ +SDL_JoystickGetBall
SDL Library Documentation
PrevNext

SDL_JoystickGetBall

Name

SDL_JoystickGetBall -- Get relative trackball motion

Synopsis

#include "SDL.h"

int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);

Description

Get the ball axis change.

Trackballs can only return relative motion since the last call to SDL_JoystickGetBall, these motion deltas a placed into dx and dy.

Return Value

Returns 0 on success or -1 on failure

Examples

int delta_x, delta_y;
+SDL_Joystick *joy;
+.
+.
+.
+SDL_JoystickUpdate();
+if(SDL_JoystickGetBall(joy, 0, &delta_x, &delta_y)==-1)
+  printf("TrackBall Read Error!\n");
+printf("Trackball Delta- X:%d, Y:%d\n", delta_x, delta_y);


PrevHomeNext
SDL_JoystickGetButtonUpSDL_JoystickClose
\ No newline at end of file diff --git a/SDL/docs/html/sdljoystickgetbutton.html b/SDL/docs/html/sdljoystickgetbutton.html new file mode 100644 index 0000000..5a9b2aa --- /dev/null +++ b/SDL/docs/html/sdljoystickgetbutton.html @@ -0,0 +1,231 @@ +SDL_JoystickGetButton
SDL Library Documentation
PrevNext

SDL_JoystickGetButton

Name

SDL_JoystickGetButton -- Get the current state of a given button on a given joystick

Synopsis

#include "SDL.h"

Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button);

Description

SDL_JoystickGetButton returns the current state of the given button on the given joystick.

Return Value

1 if the button is pressed. Otherwise, 0.


PrevHomeNext
SDL_JoystickGetHatUpSDL_JoystickGetBall
\ No newline at end of file diff --git a/SDL/docs/html/sdljoystickgethat.html b/SDL/docs/html/sdljoystickgethat.html new file mode 100644 index 0000000..d618c9e --- /dev/null +++ b/SDL/docs/html/sdljoystickgethat.html @@ -0,0 +1,297 @@ +SDL_JoystickGetHat
SDL Library Documentation
PrevNext

SDL_JoystickGetHat

Name

SDL_JoystickGetHat -- Get the current state of a joystick hat

Synopsis

#include "SDL.h"

Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);

Description

SDL_JoystickGetHat returns the current state of the given hat on the given joystick.

Return Value

The current state is returned as a Uint8 which is defined as an OR'd combination of one or more of the following

SDL_HAT_CENTERED
SDL_HAT_UP
SDL_HAT_RIGHT
SDL_HAT_DOWN
SDL_HAT_LEFT
SDL_HAT_RIGHTUP
SDL_HAT_RIGHTDOWN
SDL_HAT_LEFTUP
SDL_HAT_LEFTDOWN


PrevHomeNext
SDL_JoystickGetAxisUpSDL_JoystickGetButton
\ No newline at end of file diff --git a/SDL/docs/html/sdljoystickindex.html b/SDL/docs/html/sdljoystickindex.html new file mode 100644 index 0000000..b55eca6 --- /dev/null +++ b/SDL/docs/html/sdljoystickindex.html @@ -0,0 +1,218 @@ +SDL_JoystickIndex
SDL Library Documentation
PrevNext

SDL_JoystickIndex

Name

SDL_JoystickIndex -- Get the index of an SDL_Joystick.

Synopsis

#include "SDL.h"

int SDL_JoystickIndex(SDL_Joystick *joystick);

Description

Returns the index of a given SDL_Joystick structure.

Return Value

Index number of the joystick.


PrevHomeNext
SDL_JoystickOpenedUpSDL_JoystickNumAxes
\ No newline at end of file diff --git a/SDL/docs/html/sdljoystickname.html b/SDL/docs/html/sdljoystickname.html new file mode 100644 index 0000000..c35cdcc --- /dev/null +++ b/SDL/docs/html/sdljoystickname.html @@ -0,0 +1,238 @@ +SDL_JoystickName
SDL Library Documentation
PrevNext

SDL_JoystickName

Name

SDL_JoystickName -- Get joystick name.

Synopsis

#include "SDL.h"

const char *SDL_JoystickName(int index);

Description

Get the implementation dependent name of joystick. The index parameter refers to the N'th joystick on the system.

Return Value

Returns a char pointer to the joystick name.

Examples

/* Print the names of all attached joysticks */
+int num_joy, i;
+num_joy=SDL_NumJoysticks();
+printf("%d joysticks found\n", num_joy);
+for(i=0;i<num_joy;i++)
+  printf("%s\n", SDL_JoystickName(i));


PrevHomeNext
SDL_NumJoysticksUpSDL_JoystickOpen
\ No newline at end of file diff --git a/SDL/docs/html/sdljoysticknumaxes.html b/SDL/docs/html/sdljoysticknumaxes.html new file mode 100644 index 0000000..5dd2cb0 --- /dev/null +++ b/SDL/docs/html/sdljoysticknumaxes.html @@ -0,0 +1,225 @@ +SDL_JoystickNumAxes
SDL Library Documentation
PrevNext

SDL_JoystickNumAxes

Name

SDL_JoystickNumAxes -- Get the number of joystick axes

Synopsis

#include "SDL.h"

int SDL_JoystickNumAxes(SDL_Joystick *joystick);

Description

Return the number of axes available from a previously opened SDL_Joystick.

Return Value

Number of axes.


PrevHomeNext
SDL_JoystickIndexUpSDL_JoystickNumBalls
\ No newline at end of file diff --git a/SDL/docs/html/sdljoysticknumballs.html b/SDL/docs/html/sdljoysticknumballs.html new file mode 100644 index 0000000..a5f1693 --- /dev/null +++ b/SDL/docs/html/sdljoysticknumballs.html @@ -0,0 +1,225 @@ +SDL_JoystickNumBalls
SDL Library Documentation
PrevNext

SDL_JoystickNumBalls

Name

SDL_JoystickNumBalls -- Get the number of joystick trackballs

Synopsis

#include "SDL.h"

int SDL_JoystickNumBalls(SDL_Joystick *joystick);

Description

Return the number of trackballs available from a previously opened SDL_Joystick.

Return Value

Number of trackballs.


PrevHomeNext
SDL_JoystickNumAxesUpSDL_JoystickNumHats
\ No newline at end of file diff --git a/SDL/docs/html/sdljoysticknumbuttons.html b/SDL/docs/html/sdljoysticknumbuttons.html new file mode 100644 index 0000000..625da5d --- /dev/null +++ b/SDL/docs/html/sdljoysticknumbuttons.html @@ -0,0 +1,225 @@ +SDL_JoystickNumButtons
SDL Library Documentation
PrevNext

SDL_JoystickNumButtons

Name

SDL_JoystickNumButtons -- Get the number of joysitck buttons

Synopsis

#include "SDL.h"

int SDL_JoystickNumButtons(SDL_Joystick *joystick);

Description

Return the number of buttons available from a previously opened SDL_Joystick.

Return Value

Number of buttons.


PrevHomeNext
SDL_JoystickNumHatsUpSDL_JoystickUpdate
\ No newline at end of file diff --git a/SDL/docs/html/sdljoysticknumhats.html b/SDL/docs/html/sdljoysticknumhats.html new file mode 100644 index 0000000..a23e7c1 --- /dev/null +++ b/SDL/docs/html/sdljoysticknumhats.html @@ -0,0 +1,225 @@ +SDL_JoystickNumHats
SDL Library Documentation
PrevNext

SDL_JoystickNumHats

Name

SDL_JoystickNumHats -- Get the number of joystick hats

Synopsis

#include "SDL.h"

int SDL_JoystickNumHats(SDL_Joystick *joystick);

Description

Return the number of hats available from a previously opened SDL_Joystick.

Return Value

Number of hats.


PrevHomeNext
SDL_JoystickNumBallsUpSDL_JoystickNumButtons
\ No newline at end of file diff --git a/SDL/docs/html/sdljoystickopen.html b/SDL/docs/html/sdljoystickopen.html new file mode 100644 index 0000000..303d92d --- /dev/null +++ b/SDL/docs/html/sdljoystickopen.html @@ -0,0 +1,259 @@ +SDL_JoystickOpen
SDL Library Documentation
PrevNext

SDL_JoystickOpen

Name

SDL_JoystickOpen -- Opens a joystick for use.

Synopsis

#include "SDL.h"

SDL_Joystick *SDL_JoystickOpen(int index);

Description

Opens a joystick for use within SDL. The index refers to the N'th joystick in the system. A joystick must be opened before it game be used.

Return Value

Returns a SDL_Joystick structure on success. NULL on failure.

Examples

SDL_Joystick *joy;
+// Check for joystick
+if(SDL_NumJoysticks()>0){
+  // Open joystick
+  joy=SDL_JoystickOpen(0);
+  
+  if(joy)
+  {
+    printf("Opened Joystick 0\n");
+    printf("Name: %s\n", SDL_JoystickName(0));
+    printf("Number of Axes: %d\n", SDL_JoystickNumAxes(joy));
+    printf("Number of Buttons: %d\n", SDL_JoystickNumButtons(joy));
+    printf("Number of Balls: %d\n", SDL_JoystickNumBalls(joy));
+  }
+  else
+    printf("Couldn't open Joystick 0\n");
+  
+  // Close if opened
+  if(SDL_JoystickOpened(0))
+    SDL_JoystickClose(joy);
+}


PrevHomeNext
SDL_JoystickNameUpSDL_JoystickOpened
\ No newline at end of file diff --git a/SDL/docs/html/sdljoystickopened.html b/SDL/docs/html/sdljoystickopened.html new file mode 100644 index 0000000..84a31ee --- /dev/null +++ b/SDL/docs/html/sdljoystickopened.html @@ -0,0 +1,233 @@ +SDL_JoystickOpened
SDL Library Documentation
PrevNext

SDL_JoystickOpened

Name

SDL_JoystickOpened -- Determine if a joystick has been opened

Synopsis

#include "SDL.h"

int SDL_JoystickOpened(int index);

Description

Determines whether a joystick has already been opened within the application. index refers to the N'th joystick on the system.

Return Value

Returns 1 if the joystick has been opened, or 0 if it has not.


PrevHomeNext
SDL_JoystickOpenUpSDL_JoystickIndex
\ No newline at end of file diff --git a/SDL/docs/html/sdljoystickupdate.html b/SDL/docs/html/sdljoystickupdate.html new file mode 100644 index 0000000..b619018 --- /dev/null +++ b/SDL/docs/html/sdljoystickupdate.html @@ -0,0 +1,211 @@ +SDL_JoystickUpdate
SDL Library Documentation
PrevNext

SDL_JoystickUpdate

Name

SDL_JoystickUpdate -- Updates the state of all joysticks

Synopsis

#include "SDL.h"

void SDL_JoystickUpdate(void);

Description

Updates the state(position, buttons, etc.) of all open joysticks. If joystick events have been enabled with SDL_JoystickEventState then this is called automatically in the event loop.


PrevHomeNext
SDL_JoystickNumButtonsUpSDL_JoystickGetAxis
\ No newline at end of file diff --git a/SDL/docs/html/sdlkey.html b/SDL/docs/html/sdlkey.html new file mode 100644 index 0000000..056151f --- /dev/null +++ b/SDL/docs/html/sdlkey.html @@ -0,0 +1,2630 @@ +SDLKey
SDL Library Documentation
PrevNext

SDLKey

Name

SDLKey -- Keysym definitions.

Description

Table 8-1. SDL Keysym definitions

SDLKeyASCII valueCommon name
SDLK_BACKSPACE'\b'backspace
SDLK_TAB'\t'tab
SDLK_CLEAR clear
SDLK_RETURN'\r'return
SDLK_PAUSE pause
SDLK_ESCAPE'^['escape
SDLK_SPACE' 'space
SDLK_EXCLAIM'!'exclaim
SDLK_QUOTEDBL'"'quotedbl
SDLK_HASH'#'hash
SDLK_DOLLAR'$'dollar
SDLK_AMPERSAND'&'ampersand
SDLK_QUOTE'''quote
SDLK_LEFTPAREN'('left parenthesis
SDLK_RIGHTPAREN')'right parenthesis
SDLK_ASTERISK'*'asterisk
SDLK_PLUS'+'plus sign
SDLK_COMMA','comma
SDLK_MINUS'-'minus sign
SDLK_PERIOD'.'period
SDLK_SLASH'/'forward slash
SDLK_0'0'0
SDLK_1'1'1
SDLK_2'2'2
SDLK_3'3'3
SDLK_4'4'4
SDLK_5'5'5
SDLK_6'6'6
SDLK_7'7'7
SDLK_8'8'8
SDLK_9'9'9
SDLK_COLON':'colon
SDLK_SEMICOLON';'semicolon
SDLK_LESS'<'less-than sign
SDLK_EQUALS'='equals sign
SDLK_GREATER'>'greater-than sign
SDLK_QUESTION'?'question mark
SDLK_AT'@'at
SDLK_LEFTBRACKET'['left bracket
SDLK_BACKSLASH'\'backslash
SDLK_RIGHTBRACKET']'right bracket
SDLK_CARET'^'caret
SDLK_UNDERSCORE'_'underscore
SDLK_BACKQUOTE'`'grave
SDLK_a'a'a
SDLK_b'b'b
SDLK_c'c'c
SDLK_d'd'd
SDLK_e'e'e
SDLK_f'f'f
SDLK_g'g'g
SDLK_h'h'h
SDLK_i'i'i
SDLK_j'j'j
SDLK_k'k'k
SDLK_l'l'l
SDLK_m'm'm
SDLK_n'n'n
SDLK_o'o'o
SDLK_p'p'p
SDLK_q'q'q
SDLK_r'r'r
SDLK_s's's
SDLK_t't't
SDLK_u'u'u
SDLK_v'v'v
SDLK_w'w'w
SDLK_x'x'x
SDLK_y'y'y
SDLK_z'z'z
SDLK_DELETE'^?'delete
SDLK_KP0 keypad 0
SDLK_KP1 keypad 1
SDLK_KP2 keypad 2
SDLK_KP3 keypad 3
SDLK_KP4 keypad 4
SDLK_KP5 keypad 5
SDLK_KP6 keypad 6
SDLK_KP7 keypad 7
SDLK_KP8 keypad 8
SDLK_KP9 keypad 9
SDLK_KP_PERIOD'.'keypad period
SDLK_KP_DIVIDE'/'keypad divide
SDLK_KP_MULTIPLY'*'keypad multiply
SDLK_KP_MINUS'-'keypad minus
SDLK_KP_PLUS'+'keypad plus
SDLK_KP_ENTER'\r'keypad enter
SDLK_KP_EQUALS'='keypad equals
SDLK_UP up arrow
SDLK_DOWN down arrow
SDLK_RIGHT right arrow
SDLK_LEFT left arrow
SDLK_INSERT insert
SDLK_HOME home
SDLK_END end
SDLK_PAGEUP page up
SDLK_PAGEDOWN page down
SDLK_F1 F1
SDLK_F2 F2
SDLK_F3 F3
SDLK_F4 F4
SDLK_F5 F5
SDLK_F6 F6
SDLK_F7 F7
SDLK_F8 F8
SDLK_F9 F9
SDLK_F10 F10
SDLK_F11 F11
SDLK_F12 F12
SDLK_F13 F13
SDLK_F14 F14
SDLK_F15 F15
SDLK_NUMLOCK numlock
SDLK_CAPSLOCK capslock
SDLK_SCROLLOCK scrollock
SDLK_RSHIFT right shift
SDLK_LSHIFT left shift
SDLK_RCTRL right ctrl
SDLK_LCTRL left ctrl
SDLK_RALT right alt
SDLK_LALT left alt
SDLK_RMETA right meta
SDLK_LMETA left meta
SDLK_LSUPER left windows key
SDLK_RSUPER right windows key
SDLK_MODE mode shift
SDLK_HELP help
SDLK_PRINT print-screen
SDLK_SYSREQ SysRq
SDLK_BREAK break
SDLK_MENU menu
SDLK_POWER power
SDLK_EURO euro
+ +

Table 8-2. SDL modifier definitions

SDL ModifierMeaning
KMOD_NONENo modifiers applicable
KMOD_NUMNumlock is down
KMOD_CAPSCapslock is down
KMOD_LCTRLLeft Control is down
KMOD_RCTRLRight Control is down
KMOD_RSHIFTRight Shift is down
KMOD_LSHIFTLeft Shift is down
KMOD_RALTRight Alt is down
KMOD_LALTLeft Alt is down
KMOD_CTRLA Control key is down
KMOD_SHIFTA Shift key is down
KMOD_ALTAn Alt key is down


PrevHomeNext
SDL_keysymUpEvent Functions.
\ No newline at end of file diff --git a/SDL/docs/html/sdlkeyboardevent.html b/SDL/docs/html/sdlkeyboardevent.html new file mode 100644 index 0000000..7245bac --- /dev/null +++ b/SDL/docs/html/sdlkeyboardevent.html @@ -0,0 +1,375 @@ +SDL_KeyboardEvent
SDL Library Documentation
PrevNext

SDL_KeyboardEvent

Name

SDL_KeyboardEvent -- Keyboard event structure

Structure Definition

typedef struct{
+  Uint8 type;
+  Uint8 state;
+  SDL_keysym keysym;
+} SDL_KeyboardEvent;

Structure Data

typeSDL_KEYDOWN or SDL_KEYUP
stateSDL_PRESSED or SDL_RELEASED
keysymContains key press information

Description

SDL_KeyboardEvent is a member of the SDL_Event union and is used when an event of type SDL_KEYDOWN or SDL_KEYUP is reported.

The type and state actually report the same information, they just use different values to do it! A keyboard event occurs when a key is released (type=SDK_KEYUP or state=SDL_RELEASED) and when a key is pressed (type=SDL_KEYDOWN or state=SDL_PRESSED). The information on what key was pressed or released is in the keysym structure.

Note: Repeating SDL_KEYDOWN events will occur if key repeat is enabled (see SDL_EnableKeyRepeat).


PrevHomeNext
SDL_ActiveEventUpSDL_MouseMotionEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdlkeysym.html b/SDL/docs/html/sdlkeysym.html new file mode 100644 index 0000000..3c0645e --- /dev/null +++ b/SDL/docs/html/sdlkeysym.html @@ -0,0 +1,355 @@ +SDL_keysym
SDL Library Documentation
PrevNext

SDL_keysym

Name

SDL_keysym -- Keysym structure

Structure Definition

typedef struct{
+  Uint8 scancode;
+  SDLKey sym;
+  SDLMod mod;
+  Uint16 unicode;
+} SDL_keysym;

Structure Data

scancodeHardware specific scancode
symSDL virtual keysym
modCurrent key modifiers
unicodeTranslated character

Description

The SDL_keysym structure is used by reporting key presses and releases since it is a part of the SDL_KeyboardEvent.

The scancode field should generally be left alone, it is the hardware dependent scancode returned by the keyboard. The sym field is extremely useful. It is the SDL-defined value of the key (see SDL Key Syms. This field is very useful when you are checking for certain key presses, like so: +

.
+.
+while(SDL_PollEvent(&event)){
+  switch(event.type){
+    case SDL_KEYDOWN:
+      if(event.key.keysym.sym==SDLK_LEFT)
+        move_left();
+      break;
+    .
+    .
+    .
+  }
+}
+.
+.
+mod stores the current state of the keyboard modifiers as explained in SDL_GetModState. The unicode is only used when UNICODE translation is enabled with SDL_EnableUNICODE. If unicode is non-zero then this a the UNICODE character corresponding to the keypress. If the high 9 bits of the character are 0, then this maps to the equivalent ASCII character: +
char ch;
+if ( (keysym.unicode & 0xFF80) == 0 ) {
+  ch = keysym.unicode & 0x7F;
+}
+else {
+  printf("An International Character.\n");
+}
+UNICODE translation does have a slight overhead so don't enable it unless its needed.

See Also

SDLKey


PrevHomeNext
SDL_QuitEventUpSDLKey
\ No newline at end of file diff --git a/SDL/docs/html/sdlkillthread.html b/SDL/docs/html/sdlkillthread.html new file mode 100644 index 0000000..591a8df --- /dev/null +++ b/SDL/docs/html/sdlkillthread.html @@ -0,0 +1,223 @@ +SDL_KillThread
SDL Library Documentation
PrevNext

SDL_KillThread

Name

SDL_KillThread -- Gracelessly terminates the thread.

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

void SDL_KillThread(SDL_Thread *thread);

Description

SDL_KillThread gracelessly terminates the thread +associated with thread. If possible, you should +use some other form of IPC to signal the thread to quit.


PrevHomeNext
SDL_WaitThreadUpSDL_CreateMutex
\ No newline at end of file diff --git a/SDL/docs/html/sdllistmodes.html b/SDL/docs/html/sdllistmodes.html new file mode 100644 index 0000000..5fa7cbc --- /dev/null +++ b/SDL/docs/html/sdllistmodes.html @@ -0,0 +1,310 @@ +SDL_ListModes
SDL Library Documentation
PrevNext

SDL_ListModes

Name

SDL_ListModes -- Returns a pointer to an array of available screen dimensions for +the given format and video flags

Synopsis

#include "SDL.h"

SDL_Rect **SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);

Description

Return a pointer to an array of available screen dimensions for the given +format and video flags, sorted largest to smallest. Returns +NULL if there are no dimensions available for a particular +format, or -1 if any dimension is okay for +the given format.

If format is NULL, the mode list +will be for the format returned by SDL_GetVideoInfo()->vfmt. The flag parameter is an OR'd combination of surface flags. The flags are the same as those used SDL_SetVideoMode and they play a strong role in deciding what modes are valid. For instance, if you pass SDL_HWSURFACE as a flag only modes that support hardware video surfaces will be returned.

Example

SDL_Rect **modes;
+int i;
+.
+.
+.
+
+/* Get available fullscreen/hardware modes */
+modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
+
+/* Check is there are any modes available */
+if(modes == (SDL_Rect **)0){
+  printf("No modes available!\n");
+  exit(-1);
+}
+
+/* Check if our resolution is restricted */
+if(modes == (SDL_Rect **)-1){
+  printf("All resolutions available.\n");
+}
+else{
+  /* Print valid modes */
+  printf("Available Modes\n");
+  for(i=0;modes[i];++i)
+    printf("  %d x %d\n", modes[i]->w, modes[i]->h);
+}
+.
+.

PrevHomeNext
SDL_VideoDriverNameUpSDL_VideoModeOK
\ No newline at end of file diff --git a/SDL/docs/html/sdlloadbmp.html b/SDL/docs/html/sdlloadbmp.html new file mode 100644 index 0000000..6e8b90e --- /dev/null +++ b/SDL/docs/html/sdlloadbmp.html @@ -0,0 +1,219 @@ +SDL_LoadBMP
SDL Library Documentation
PrevNext

SDL_LoadBMP

Name

SDL_LoadBMP -- Load a Windows BMP file into an SDL_Surface.

Synopsis

#include "SDL.h"

SDL_Surface *SDL_LoadBMP(const char *file);

Description

Loads a surface from a named Windows BMP file.

Return Value

Returns the new surface, or NULL +if there was an error.

See Also

SDL_SaveBMP


PrevHomeNext
SDL_UnlockSurfaceUpSDL_SaveBMP
\ No newline at end of file diff --git a/SDL/docs/html/sdlloadwav.html b/SDL/docs/html/sdlloadwav.html new file mode 100644 index 0000000..0403f1c --- /dev/null +++ b/SDL/docs/html/sdlloadwav.html @@ -0,0 +1,296 @@ +SDL_LoadWAV
SDL Library Documentation
PrevNext

SDL_LoadWAV

Name

SDL_LoadWAV -- Load a WAVE file

Synopsis

#include "SDL.h"

SDL_AudioSpec *SDL_LoadWAV(const char *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);

Description

SDL_LoadWAV +This function loads a WAVE file into memory.

If this function succeeds, it returns the given +SDL_AudioSpec, +filled with the audio data format of the wave data, and sets +audio_buf to a malloc'd +buffer containing the audio data, and sets audio_len +to the length of that audio buffer, in bytes. You need to free the audio +buffer with SDL_FreeWAV when you are +done with it.

This function returns NULL and sets the SDL +error message if the wave file cannot be opened, uses an unknown data format, +or is corrupt. Currently raw, MS-ADPCM and IMA-ADPCM WAVE files are supported.

Example

SDL_AudioSpec wav_spec;
+Uint32 wav_length;
+Uint8 *wav_buffer;
+
+/* Load the WAV */
+if( SDL_LoadWAV("test.wav", &wav_spec, &wav_buffer, &wav_length) == NULL ){
+  fprintf(stderr, "Could not open test.wav: %s\n", SDL_GetError());
+  exit(-1);
+}
+.
+.
+.
+/* Do stuff with the WAV */
+.
+.
+/* Free It */
+SDL_FreeWAV(wav_buffer);

PrevHomeNext
SDL_GetAudioStatusUpSDL_FreeWAV
\ No newline at end of file diff --git a/SDL/docs/html/sdllockaudio.html b/SDL/docs/html/sdllockaudio.html new file mode 100644 index 0000000..7f78618 --- /dev/null +++ b/SDL/docs/html/sdllockaudio.html @@ -0,0 +1,208 @@ +SDL_LockAudio
SDL Library Documentation
PrevNext

SDL_LockAudio

Name

SDL_LockAudio -- Lock out the callback function

Synopsis

#include "SDL.h"

void SDL_LockAudio(void);

Description

The lock manipulated by these functions protects the callback function. +During a LockAudio period, you can be guaranteed that the +callback function is not running. Do not call these from the callback +function or you will cause deadlock.


PrevHomeNext
SDL_MixAudioUpSDL_UnlockAudio
\ No newline at end of file diff --git a/SDL/docs/html/sdllocksurface.html b/SDL/docs/html/sdllocksurface.html new file mode 100644 index 0000000..c6e7596 --- /dev/null +++ b/SDL/docs/html/sdllocksurface.html @@ -0,0 +1,306 @@ +SDL_LockSurface
SDL Library Documentation
PrevNext

SDL_LockSurface

Name

SDL_LockSurface -- Lock a surface for directly access.

Synopsis

#include "SDL.h"

int SDL_LockSurface(SDL_Surface *surface);

Description

SDL_LockSurface sets up a surface for directly +accessing the pixels. Between calls to SDL_LockSurface +and SDL_UnlockSurface, you can write to and read from +surface->pixels, using the pixel format stored in +surface->format. Once you are done accessing the +surface, you should use SDL_UnlockSurface to release it.

Not all surfaces require locking. +If SDL_MUSTLOCK(surface) +evaluates to 0, then you can read and write to the +surface at any time, and the pixel format of the surface will not change.

No operating system or library calls should be made between lock/unlock +pairs, as critical system locks may be held during this time.

It should be noted, that since SDL 1.1.8 surface locks are recursive. This means that you can lock a surface multiple times, but each lock must have a match unlock. +

    .
+    .
+    SDL_LockSurface( surface );
+    .
+    /* Surface is locked */
+    /* Direct pixel access on surface here */
+    .
+    SDL_LockSurface( surface );
+    .
+    /* More direct pixel access on surface */
+    .
+    SDL_UnlockSurface( surface );
+    /* Surface is still locked */
+    /* Note: Is versions < 1.1.8, the surface would have been */
+    /* no longer locked at this stage                         */
+    .
+    SDL_UnlockSurface( surface );
+    /* Surface is now unlocked */
+    .
+    .

Return Value

SDL_LockSurface returns 0, +or -1 if the surface couldn't be locked.


PrevHomeNext
SDL_FreeSurfaceUpSDL_UnlockSurface
\ No newline at end of file diff --git a/SDL/docs/html/sdllockyuvoverlay.html b/SDL/docs/html/sdllockyuvoverlay.html new file mode 100644 index 0000000..01232f9 --- /dev/null +++ b/SDL/docs/html/sdllockyuvoverlay.html @@ -0,0 +1,252 @@ +SDL_LockYUVOverlay
SDL Library Documentation
PrevNext

SDL_LockYUVOverlay

Name

SDL_LockYUVOverlay -- Lock an overlay

Synopsis

#include "SDL.h"

int SDL_LockYUVOverlay(SDL_Overlay *overlay);

Description

Much the same as SDL_LockSurface, SDL_LockYUVOverlay locks the overlay for direct access to pixel data.

Return Value

Returns 0 on success, or -1 on an error.


PrevHomeNext
SDL_CreateYUVOverlayUpSDL_UnlockYUVOverlay
\ No newline at end of file diff --git a/SDL/docs/html/sdlmaprgb.html b/SDL/docs/html/sdlmaprgb.html new file mode 100644 index 0000000..1fc3a69 --- /dev/null +++ b/SDL/docs/html/sdlmaprgb.html @@ -0,0 +1,254 @@ +SDL_MapRGB
SDL Library Documentation
PrevNext

SDL_MapRGB

Name

SDL_MapRGB -- Map a RGB color value to a pixel format.

Synopsis

#include "SDL.h"

Uint32 SDL_MapRGB(SDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b);

Description

Maps the RGB color value to the specified pixel format and returns the +pixel value as a 32-bit int.

If the format has a palette (8-bit) the index of the closest matching +color in the palette will be returned.

If the specified pixel format has an alpha component it will be returned +as all 1 bits (fully opaque).

Return Value

A pixel value best approximating the given RGB color value for a given +pixel format. If the pixel format bpp (color depth) is less than 32-bpp +then the unused upper bits of the return value can safely be ignored +(e.g., with a 16-bpp format the return value can be assigned to a +Uint16, and similarly a Uint8 for an 8-bpp +format).


PrevHomeNext
SDL_SetGammaRampUpSDL_MapRGBA
\ No newline at end of file diff --git a/SDL/docs/html/sdlmaprgba.html b/SDL/docs/html/sdlmaprgba.html new file mode 100644 index 0000000..94c9a40 --- /dev/null +++ b/SDL/docs/html/sdlmaprgba.html @@ -0,0 +1,242 @@ +SDL_MapRGBA
SDL Library Documentation
PrevNext

SDL_MapRGBA

Name

SDL_MapRGBA -- Map a RGBA color value to a pixel format.

Synopsis

#include "SDL.h"

Uint32 SDL_MapRGBA(SDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b, Uint8 a);

Description

Maps the RGBA color value to the specified pixel format and returns the +pixel value as a 32-bit int.

If the format has a palette (8-bit) the index of the closest matching +color in the palette will be returned.

If the specified pixel format has no alpha component the alpha value +will be ignored (as it will be in formats with a palette).

Return Value

A pixel value best approximating the given RGBA color value for a given +pixel format. If the pixel format bpp (color depth) is less than 32-bpp +then the unused upper bits of the return value can safely be ignored +(e.g., with a 16-bpp format the return value can be assigned to a +Uint16, and similarly a Uint8 for an 8-bpp +format).


PrevHomeNext
SDL_MapRGBUpSDL_GetRGB
\ No newline at end of file diff --git a/SDL/docs/html/sdlmixaudio.html b/SDL/docs/html/sdlmixaudio.html new file mode 100644 index 0000000..ad772a3 --- /dev/null +++ b/SDL/docs/html/sdlmixaudio.html @@ -0,0 +1,237 @@ +SDL_MixAudio
SDL Library Documentation
PrevNext

SDL_MixAudio

Name

SDL_MixAudio -- Mix audio data

Synopsis

#include "SDL.h"

void SDL_MixAudio(Uint8 *dst, Uint8 *src, Uint32 len, int volume);

Description

This function takes two audio buffers of len bytes each +of the playing audio format and mixes them, performing addition, volume +adjustment, and overflow clipping. The volume ranges +from 0 to SDL_MIX_MAXVOLUME and should be set to the maximum +value for full audio volume. Note this does not change hardware volume. This is +provided for convenience -- you can mix your own audio data.

Note: Do not use this function for mixing together more than two streams of sample +data. The output from repeated application of this function may be distorted +by clipping, because there is no accumulator with greater range than the +input (not to mention this being an inefficient way of doing it). +Use mixing functions from SDL_mixer, OpenAL, or write your own mixer instead.


PrevHomeNext
SDL_ConvertAudioUpSDL_LockAudio
\ No newline at end of file diff --git a/SDL/docs/html/sdlmousebuttonevent.html b/SDL/docs/html/sdlmousebuttonevent.html new file mode 100644 index 0000000..2398390 --- /dev/null +++ b/SDL/docs/html/sdlmousebuttonevent.html @@ -0,0 +1,346 @@ +SDL_MouseButtonEvent
SDL Library Documentation
PrevNext

SDL_MouseButtonEvent

Name

SDL_MouseButtonEvent -- Mouse button event structure

Structure Definition

typedef struct{
+  Uint8 type;
+  Uint8 button;
+  Uint8 state;
+  Uint16 x, y;
+} SDL_MouseButtonEvent;

Structure Data

typeSDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP
buttonThe mouse button index (SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT)
stateSDL_PRESSED or SDL_RELEASED
x, yThe X/Y coordinates of the mouse at press/release time

Description

SDL_MouseButtonEvent is a member of the SDL_Event union and is used when an event of type SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP is reported.

When a mouse button press or release is detected then number of the button pressed (from 1 to 255, with 1 usually being the left button and 2 the right) is placed into button, the position of the mouse when this event occured is stored in the x and the y fields. Like SDL_KeyboardEvent, information on whether the event was a press or a release event is stored in both the type and state fields, but this should be obvious.


PrevHomeNext
SDL_MouseMotionEventUpSDL_JoyAxisEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdlmousemotionevent.html b/SDL/docs/html/sdlmousemotionevent.html new file mode 100644 index 0000000..a514774 --- /dev/null +++ b/SDL/docs/html/sdlmousemotionevent.html @@ -0,0 +1,365 @@ +SDL_MouseMotionEvent
SDL Library Documentation
PrevNext

SDL_MouseMotionEvent

Name

SDL_MouseMotionEvent -- Mouse motion event structure

Structure Definition

typedef struct{
+  Uint8 type;
+  Uint8 state;
+  Uint16 x, y;
+  Sint16 xrel, yrel;
+} SDL_MouseMotionEvent;

Structure Data

typeSDL_MOUSEMOTION
stateThe current button state
x, yThe X/Y coordinates of the mouse
xrel, yrelRelative motion in the X/Y direction

Description

SDL_MouseMotionEvent is a member of the SDL_Event union and is used when an event of type SDL_MOUSEMOTION is reported.

Simply put, a SDL_MOUSEMOTION type event occurs when a user moves the mouse within the application window or when SDL_WarpMouse is called. Both the absolute (x and y) and relative (xrel and yrel) coordinates are reported along with the current button states (state). The button state can be interpreted using the SDL_BUTTON macro (see SDL_GetMouseState).

If the cursor is hidden (SDL_ShowCursor(0)) and the input is grabbed (SDL_WM_GrabInput(SDL_GRAB_ON)), then the mouse will give relative motion events even when the cursor reaches the edge fo the screen. This is currently only implemented on Windows and Linux/Unix-a-likes.


PrevHomeNext
SDL_KeyboardEventUpSDL_MouseButtonEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdlmutexp.html b/SDL/docs/html/sdlmutexp.html new file mode 100644 index 0000000..a16c3ca --- /dev/null +++ b/SDL/docs/html/sdlmutexp.html @@ -0,0 +1,241 @@ +SDL_mutexP
SDL Library Documentation
PrevNext

SDL_mutexP

Name

SDL_mutexP -- Lock a mutex

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

int SDL_mutexP(SDL_mutex *mutex);

Description

Locks the mutex, which was previously created with SDL_CreateMutex. If the mutex is already locked then SDL_mutexP will not return until it is unlocked. Returns 0 on success, or -1 on an error.

SDL also defines a macro #define SDL_LockMutex(m) SDL_mutexP(m).


PrevHomeNext
SDL_DestroyMutexUpSDL_mutexV
\ No newline at end of file diff --git a/SDL/docs/html/sdlmutexv.html b/SDL/docs/html/sdlmutexv.html new file mode 100644 index 0000000..2b0dfc8 --- /dev/null +++ b/SDL/docs/html/sdlmutexv.html @@ -0,0 +1,235 @@ +SDL_mutexV
SDL Library Documentation
PrevNext

SDL_mutexV

Name

SDL_mutexV -- Unlock a mutex

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

int SDL_mutexV(SDL_mutex *mutex);

Description

Unlocks the mutex, which was previously created with SDL_CreateMutex. Returns 0 on success, or -1 on an error.

SDL also defines a macro #define SDL_UnlockMutex(m) SDL_mutexV(m).


PrevHomeNext
SDL_mutexPUpSDL_CreateSemaphore
\ No newline at end of file diff --git a/SDL/docs/html/sdlnumjoysticks.html b/SDL/docs/html/sdlnumjoysticks.html new file mode 100644 index 0000000..adb15c7 --- /dev/null +++ b/SDL/docs/html/sdlnumjoysticks.html @@ -0,0 +1,222 @@ +SDL_NumJoysticks
SDL Library Documentation
PrevNext

SDL_NumJoysticks

Name

SDL_NumJoysticks -- Count available joysticks.

Synopsis

#include "SDL.h"

int SDL_NumJoysticks(void);

Description

Counts the number of joysticks attached to the system.

Return Value

Returns the number of attached joysticks


PrevHomeNext
JoystickUpSDL_JoystickName
\ No newline at end of file diff --git a/SDL/docs/html/sdlopenaudio.html b/SDL/docs/html/sdlopenaudio.html new file mode 100644 index 0000000..1b64e7f --- /dev/null +++ b/SDL/docs/html/sdlopenaudio.html @@ -0,0 +1,578 @@ +SDL_OpenAudio
SDL Library Documentation
PrevNext

SDL_OpenAudio

Name

SDL_OpenAudio -- Opens the audio device with the desired parameters.

Synopsis

#include "SDL.h"

int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);

Description

This function opens the audio device with the desired parameters, and +returns 0 if successful, placing the actual hardware parameters in the +structure pointed to by obtained. If obtained is NULL, the audio +data passed to the callback function will be guaranteed to be in the +requested format, and will be automatically converted to the hardware +audio format if necessary. This function returns -1 if it failed +to open the audio device, or couldn't set up the audio thread.

To open the audio device a desired SDL_AudioSpec must be created. +

SDL_AudioSpec *desired;
+.
+.
+desired = malloc(sizeof(SDL_AudioSpec));
+You must then fill this structure with your desired audio specifications.

desired->freq

The desired audio frequency in samples-per-second.

desired->format

The desired audio format (see SDL_AudioSpec)

desired->samples

The desired size of the audio buffer in samples. This number should be a power of two, and may be adjusted by the audio driver to a value more suitable for the hardware. Good values seem to range between 512 and 8192 inclusive, depending on the application and CPU speed. Smaller values yield faster response time, but can lead to underflow if the application is doing heavy processing and cannot fill the audio buffer in time. A stereo sample consists of both right and left channels in LR ordering. Note that the number of samples is directly related to time by the following formula: ms = (samples*1000)/freq

desired->callback

This should be set to a function that will be called when the audio device is ready for more data. It is passed a pointer to the audio buffer, and the length in bytes of the audio buffer. This function usually runs in a separate thread, and so you should protect data structures that it accesses by calling SDL_LockAudio and SDL_UnlockAudio in your code. The callback prototype is: +

void callback(void *userdata, Uint8 *stream, int len);
+userdata is the pointer stored in userdata field of the SDL_AudioSpec. stream is a pointer to the audio buffer you want to fill with information and len is the length of the audio buffer in bytes.

desired->userdata

This pointer is passed as the first parameter to the callback function.

SDL_OpenAudio reads these fields from the desired SDL_AudioSpec structure pass to the function and attempts to find an audio configuration matching your desired. As mentioned above, if the obtained parameter is NULL then SDL with convert from your desired audio settings to the hardware settings as it plays.

If obtained is NULL then the desired SDL_AudioSpec is your working specification, otherwise the obtained SDL_AudioSpec becomes the working specification and the desirec specification can be deleted. The data in the working specification is used when building SDL_AudioCVT's for converting loaded data to the hardware format.

SDL_OpenAudio calculates the size and silence fields for both the desired and obtained specifications. The size field stores the total size of the audio buffer in bytes, while the silence stores the value used to represent silence in the audio buffer

The audio device starts out playing silence when it's opened, and should be enabled for playing by calling SDL_PauseAudio(0) when you are ready for your audio callback function to be called. Since the audio driver may modify the requested size of the audio buffer, you should allocate any local mixing buffers after you open the audio device.

Examples

/* Prototype of our callback function */
+void my_audio_callback(void *userdata, Uint8 *stream, int len);
+
+/* Open the audio device */
+SDL_AudioSpec *desired, *obtained;
+SDL_AudioSpec *hardware_spec;
+
+/* Allocate a desired SDL_AudioSpec */
+desired = malloc(sizeof(SDL_AudioSpec));
+
+/* Allocate space for the obtained SDL_AudioSpec */
+obtained = malloc(sizeof(SDL_AudioSpec));
+
+/* 22050Hz - FM Radio quality */
+desired->freq=22050;
+
+/* 16-bit signed audio */
+desired->format=AUDIO_S16LSB;
+
+/* Mono */
+desired->channels=0;
+
+/* Large audio buffer reduces risk of dropouts but increases response time */
+desired->samples=8192;
+
+/* Our callback function */
+desired->callback=my_audio_callback;
+
+desired->userdata=NULL;
+
+/* Open the audio device */
+if ( SDL_OpenAudio(desired, obtained) < 0 ){
+  fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
+  exit(-1);
+}
+/* desired spec is no longer needed */
+free(desired);
+hardware_spec=obtained;
+.
+.
+/* Prepare callback for playing */
+.
+.
+.
+/* Start playing */
+SDL_PauseAudio(0);

PrevHomeNext
SDL_AudioSpecUpSDL_PauseAudio
\ No newline at end of file diff --git a/SDL/docs/html/sdloverlay.html b/SDL/docs/html/sdloverlay.html new file mode 100644 index 0000000..0a2a928 --- /dev/null +++ b/SDL/docs/html/sdloverlay.html @@ -0,0 +1,362 @@ +SDL_Overlay
SDL Library Documentation
PrevNext

SDL_Overlay

Name

SDL_Overlay -- YUV video overlay

Structure Definition

typedef struct{
+  Uint32 format;
+  int w, h;
+  int planes;
+  Uint16 *pitches;
+  Uint8 **pixels;
+  Uint32 hw_overlay:1;
+} SDL_Overlay;

Structure Data

formatOverlay format (see below)
w, hWidth and height of overlay
planesNumber of planes in the overlay. Usually either 1 or 3
pitchesAn array of pitches, one for each plane. Pitch is the length of a row in bytes.
pixelsAn array of pointers to teh data of each plane. The overlay should be locked before these pointers are used.
hw_overlayThis will be set to 1 if the overlay is hardware accelerated.

Description

A SDL_Overlay is similar to a SDL_Surface except it stores a YUV overlay. All the fields are read only, except for pixels which should be locked before use. The format field stores the format of the overlay which is one of the following: +

#define SDL_YV12_OVERLAY  0x32315659  /* Planar mode: Y + V + U */
+#define SDL_IYUV_OVERLAY  0x56555949  /* Planar mode: Y + U + V */
+#define SDL_YUY2_OVERLAY  0x32595559  /* Packed mode: Y0+U0+Y1+V0 */
+#define SDL_UYVY_OVERLAY  0x59565955  /* Packed mode: U0+Y0+V0+Y1 */
+#define SDL_YVYU_OVERLAY  0x55595659  /* Packed mode: Y0+V0+Y1+U0 */
+More information on YUV formats can be found at http://www.webartz.com/fourcc/indexyuv.htm.


PrevHomeNext
SDL_VideoInfoUpWindow Management
\ No newline at end of file diff --git a/SDL/docs/html/sdlpalette.html b/SDL/docs/html/sdlpalette.html new file mode 100644 index 0000000..9e89dbe --- /dev/null +++ b/SDL/docs/html/sdlpalette.html @@ -0,0 +1,301 @@ +SDL_Palette
SDL Library Documentation
PrevNext

SDL_Palette

Name

SDL_Palette -- Color palette for 8-bit pixel formats

Structure Definition

typedef struct{
+  int ncolors;
+  SDL_Color *colors;
+} SDL_Palette;

Structure Data

ncolorsNumber of colors used in this palette
colorsPointer to SDL_Color structures that make up the palette.

Description

Each pixel in an 8-bit surface is an index into the colors field of the SDL_Palette structure store in SDL_PixelFormat. A SDL_Palette should never need to be created manually. It is automatically created when SDL allocates a SDL_PixelFormat for a surface. The colors values of a SDL_Surfaces palette can be set with the SDL_SetColors.


PrevHomeNext
SDL_ColorUpSDL_PixelFormat
\ No newline at end of file diff --git a/SDL/docs/html/sdlpauseaudio.html b/SDL/docs/html/sdlpauseaudio.html new file mode 100644 index 0000000..53182ec --- /dev/null +++ b/SDL/docs/html/sdlpauseaudio.html @@ -0,0 +1,221 @@ +SDL_PauseAudio
SDL Library Documentation
PrevNext

SDL_PauseAudio

Name

SDL_PauseAudio -- Pauses and unpauses the audio callback processing

Synopsis

#include "SDL.h"

void SDL_PauseAudio(int pause_on);

Description

This function pauses and unpauses the audio callback processing. +It should be called with pause_on=0 after opening the audio +device to start playing sound. This is so you can safely initialize +data for your callback function after opening the audio device. +Silence will be written to the audio device during the pause.


PrevHomeNext
SDL_OpenAudioUpSDL_GetAudioStatus
\ No newline at end of file diff --git a/SDL/docs/html/sdlpeepevents.html b/SDL/docs/html/sdlpeepevents.html new file mode 100644 index 0000000..43dc09d --- /dev/null +++ b/SDL/docs/html/sdlpeepevents.html @@ -0,0 +1,321 @@ +SDL_PeepEvents
SDL Library Documentation
PrevNext

SDL_PeepEvents

Name

SDL_PeepEvents -- Checks the event queue for messages and optionally returns them.

Synopsis

#include "SDL.h"

int SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 mask);

Description

Checks the event queue for messages and optionally returns them.

If action is SDL_ADDEVENT, up to +numevents events will be added to the back of the event + queue.

If action is SDL_PEEKEVENT, up to +numevents events at the front of the event queue, +matching mask, +will be returned and will not be removed from the queue.

If action is SDL_GETEVENT, up to +numevents events at the front of the event queue, +matching mask, +will be returned and will be removed from the queue.

The mask parameter is an bitwise OR of +SDL_EVENTMASK(event_type), for all +event types you are interested in.

This function is thread-safe.

Return Value

This function returns the number of events actually stored, or +-1 if there was an error.


PrevHomeNext
SDL_PumpEventsUpSDL_PollEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdlpixelformat.html b/SDL/docs/html/sdlpixelformat.html new file mode 100644 index 0000000..bf38818 --- /dev/null +++ b/SDL/docs/html/sdlpixelformat.html @@ -0,0 +1,528 @@ +SDL_PixelFormat
SDL Library Documentation
PrevNext

SDL_PixelFormat

Name

SDL_PixelFormat -- Stores surface format information

Structure Definition

typedef struct SDL_PixelFormat {
+  SDL_Palette *palette;
+  Uint8  BitsPerPixel;
+  Uint8  BytesPerPixel;
+  Uint8  Rloss, Gloss, Bloss, Aloss;
+  Uint8  Rshift, Gshift, Bshift, Ashift;
+  Uint32 Rmask, Gmask, Bmask, Amask;
+  Uint32 colorkey;
+  Uint8  alpha;
+} SDL_PixelFormat;

Structure Data

palettePointer to the palette, or NULL if the BitsPerPixel>8
BitsPerPixelThe number of bits used to represent each pixel in a surface. Usually 8, 16, 24 or 32.
BytesPerPixelThe number of bytes used to represent each pixel in a surface. Usually one to four.
[RGBA]maskBinary mask used to retrieve individual color values
[RGBA]lossPrecision loss of each color component (2[RGBA]loss)
[RGBA]shiftBinary left shift of each color component in the pixel value
colorkeyPixel value of transparent pixels
alphaOverall surface alpha value

Description

A SDL_PixelFormat describes the format of the pixel data stored at the pixels field of a SDL_Surface. Every surface stores a SDL_PixelFormat in the format field.

If you wish to do pixel level modifications on a surface, then understanding how SDL stores its color information is essential.

8-bit pixel formats are the easiest to understand. Since its an 8-bit format, we have 8 BitsPerPixel and 1 BytesPerPixel. Since BytesPerPixel is 1, all pixels are represented by a Uint8 which contains an index into palette->colors. So, to determine the color of a pixel in a 8-bit surface: we read the color index from surface->pixels and we use that index to read the SDL_Color structure from surface->format->palette->colors. Like so: +

SDL_Surface *surface;
+SDL_PixelFormat *fmt;
+SDL_Color *color;
+Uint8 index;
+
+.
+.
+
+/* Create surface */
+.
+.
+fmt=surface->format;
+
+/* Check the bitdepth of the surface */
+if(fmt->BitsPerPixel!=8){
+  fprintf(stderr, "Not an 8-bit surface.\n");
+  return(-1);
+}
+
+/* Lock the surface */
+SDL_LockSurface(surface);
+
+/* Get the topleft pixel */
+index=*(Uint8 *)surface->pixels;
+color=fmt->palette->colors[index];
+
+/* Unlock the surface */
+SDL_UnlockSurface(surface);
+printf("Pixel Color-> Red: %d, Green: %d, Blue: %d. Index: %d\n",
+          color->r, color->g, color->b, index);
+.
+.

Pixel formats above 8-bit are an entirely different experience. They are +considered to be "TrueColor" formats and the color information is stored in the +pixels themselves, not in a palette. The mask, shift and loss fields tell us +how the color information is encoded. The mask fields allow us to isolate each +color component, the shift fields tell us the number of bits to the right of +each component in the pixel value and the loss fields tell us the number of +bits lost from each component when packing 8-bit color component in a pixel. +

/* Extracting color components from a 32-bit color value */
+SDL_PixelFormat *fmt;
+SDL_Surface *surface;
+Uint32 temp, pixel;
+Uint8 red, green, blue, alpha;
+.
+.
+.
+fmt=surface->format;
+SDL_LockSurface(surface);
+pixel=*((Uint32*)surface->pixels);
+SDL_UnlockSurface(surface);
+
+/* Get Red component */
+temp=pixel&fmt->Rmask; /* Isolate red component */
+temp=temp>>fmt->Rshift;/* Shift it down to 8-bit */
+temp=temp<<fmt->Rloss; /* Expand to a full 8-bit number */
+red=(Uint8)temp;
+
+/* Get Green component */
+temp=pixel&fmt->Gmask; /* Isolate green component */
+temp=temp>>fmt->Gshift;/* Shift it down to 8-bit */
+temp=temp<<fmt->Gloss; /* Expand to a full 8-bit number */
+green=(Uint8)temp;
+
+/* Get Blue component */
+temp=pixel&fmt->Bmask; /* Isolate blue component */
+temp=temp>>fmt->Bshift;/* Shift it down to 8-bit */
+temp=temp<<fmt->Bloss; /* Expand to a full 8-bit number */
+blue=(Uint8)temp;
+
+/* Get Alpha component */
+temp=pixel&fmt->Amask; /* Isolate alpha component */
+temp=temp>>fmt->Ashift;/* Shift it down to 8-bit */
+temp=temp<<fmt->Aloss; /* Expand to a full 8-bit number */
+alpha=(Uint8)temp;
+
+printf("Pixel Color -> R: %d,  G: %d,  B: %d,  A: %d\n", red, green, blue, alpha);
+.
+.
+.


PrevHomeNext
SDL_PaletteUpSDL_Surface
diff --git a/SDL/docs/html/sdlpollevent.html b/SDL/docs/html/sdlpollevent.html new file mode 100644 index 0000000..81bac44 --- /dev/null +++ b/SDL/docs/html/sdlpollevent.html @@ -0,0 +1,269 @@ +SDL_PollEvent
SDL Library Documentation
PrevNext

SDL_PollEvent

Name

SDL_PollEvent -- Polls for currently pending events.

Synopsis

#include "SDL.h"

int SDL_PollEvent(SDL_Event *event);

Description

Polls for currently pending events, and returns 1 +if there are any pending events, or 0 if there +are none available.

If event is not NULL, the next +event is removed from the queue and stored in that area.

Examples

SDL_Event event; /* Event structure */
+
+.
+.
+.
+/* Check for events */
+while(SDL_PollEvent(&event)){  /* Loop until there are no events left on the queue */
+  switch(event.type){  /* Process the appropiate event type */
+    case SDL_KEYDOWN:  /* Handle a KEYDOWN event */         
+      printf("Oh! Key press\n");
+      break;
+    case SDL_MOUSEMOTION:
+      .
+      .
+      .
+    default: /* Report an unhandled event */
+      printf("I don't know what this event is!\n");
+  }
+}


PrevHomeNext
SDL_PeepEventsUpSDL_WaitEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdlpumpevents.html b/SDL/docs/html/sdlpumpevents.html new file mode 100644 index 0000000..d2d9b32 --- /dev/null +++ b/SDL/docs/html/sdlpumpevents.html @@ -0,0 +1,244 @@ +SDL_PumpEvents
SDL Library Documentation
PrevNext

SDL_PumpEvents

Name

SDL_PumpEvents -- Pumps the event loop, gathering events from the input devices.

Synopsis

#include "SDL.h"

void SDL_PumpEvents(void);

Description

Pumps the event loop, gathering events from the input devices.

SDL_PumpEvents gathers all the pending input information from devices and places it on the event queue. Without calls to SDL_PumpEvents no events would ever be placed on the queue. Often calls the need for SDL_PumpEvents is hidden from the user since SDL_PollEvent and SDL_WaitEvent implicitly call SDL_PumpEvents. However, if you are not polling or waiting for events (e.g. you are filtering them), then you must call SDL_PumpEvents to force an event queue update.

Note: You can only call this function in the thread that set the video mode.


PrevHomeNext
Event Functions.UpSDL_PeepEvents
\ No newline at end of file diff --git a/SDL/docs/html/sdlpushevent.html b/SDL/docs/html/sdlpushevent.html new file mode 100644 index 0000000..8fdbb82 --- /dev/null +++ b/SDL/docs/html/sdlpushevent.html @@ -0,0 +1,266 @@ +SDL_PushEvent
SDL Library Documentation
PrevNext

SDL_PushEvent

Name

SDL_PushEvent -- Pushes an event onto the event queue

Synopsis

#include "SDL.h"

int SDL_PushEvent(SDL_Event *event);

Description

The event queue can actually be used as a two way communication channel. Not only can events be read from the queue, but the user can also push their own events onto it. event is a pointer to the event structure you wish to push onto the queue.

Note: Pushing device input events onto the queue doesn't modify the state of the device within SDL.

Return Value

Returns 0 on success or -1 if the event couldn't be pushed.

Examples

See SDL_Event.


PrevHomeNext
SDL_WaitEventUpSDL_SetEventFilter
\ No newline at end of file diff --git a/SDL/docs/html/sdlquit.html b/SDL/docs/html/sdlquit.html new file mode 100644 index 0000000..bb35ff3 --- /dev/null +++ b/SDL/docs/html/sdlquit.html @@ -0,0 +1,244 @@ +SDL_Quit
SDL Library Documentation
PrevNext

SDL_Quit

Name

SDL_Quit -- Shut down SDL

Synopsis

#include "SDL.h"

void SDL_Quit(void);

Description

SDL_Quit shuts down all SDL subsystems and frees the resources allocated to them. This should always be called before you exit. For the sake of simplicity you can set SDL_Quit as your atexit call, like: +

SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
+atexit(SDL_Quit);
+.
+.

Note: While using atexit maybe be fine for small programs, more advanced users should shut down SDL in their own cleanup code. Plus, using atexit in a library is a sure way to crash dynamically loaded code


PrevHomeNext
SDL_QuitSubSystemUpSDL_WasInit
\ No newline at end of file diff --git a/SDL/docs/html/sdlquitevent.html b/SDL/docs/html/sdlquitevent.html new file mode 100644 index 0000000..4f18502 --- /dev/null +++ b/SDL/docs/html/sdlquitevent.html @@ -0,0 +1,263 @@ +SDL_QuitEvent
SDL Library Documentation
PrevNext

SDL_QuitEvent

Name

SDL_QuitEvent -- Quit requested event

Structure Definition

typedef struct{
+  Uint8 type
+} SDL_QuitEvent;

Structure Data

typeSDL_QUIT

Description

SDL_QuitEvent is a member of the SDL_Event union and is used whan an event of type SDL_QUIT is reported.

As can be seen, the SDL_QuitEvent structure serves no useful purpose. The event itself, on the other hand, is very important. If you filter out or ignore a quit event then it is impossible for the user to close the window. On the other hand, if you do accept a quit event then the application window will be closed, and screen updates will still report success event though the application will no longer be visible.

Note: The macro SDL_QuitRequested will return non-zero if a quit event is pending


PrevHomeNext
SDL_UserEventUpSDL_keysym
\ No newline at end of file diff --git a/SDL/docs/html/sdlquitsubsystem.html b/SDL/docs/html/sdlquitsubsystem.html new file mode 100644 index 0000000..c8ca615 --- /dev/null +++ b/SDL/docs/html/sdlquitsubsystem.html @@ -0,0 +1,248 @@ +SDL_QuitSubSystem
SDL Library Documentation
PrevNext

SDL_QuitSubSystem

Name

SDL_QuitSubSystem -- Shut down a subsystem

Synopsis

#include "SDL.h"

void SDL_QuitSubSystem(Uint32 flags);

Description

SDL_QuitSubSystem allows you to shut down a subsystem that has been previously initialized by SDL_Init or SDL_InitSubSystem. The flags tells SDL_QuitSubSystem which subsystems to shut down, it uses the same values that are passed to SDL_Init.


PrevHomeNext
SDL_InitSubSystemUpSDL_Quit
\ No newline at end of file diff --git a/SDL/docs/html/sdlrect.html b/SDL/docs/html/sdlrect.html new file mode 100644 index 0000000..520031d --- /dev/null +++ b/SDL/docs/html/sdlrect.html @@ -0,0 +1,258 @@ +SDL_Rect
SDL Library Documentation
PrevNext

SDL_Rect

Name

SDL_Rect -- Defines a rectangular area

Structure Definition

typedef struct{
+  Sint16 x, y;
+  Uint16 w, h;
+} SDL_Rect;

Structure Data

x, yPosition of the upper-left corner of the rectangle
w, hThe width and height of the rectangle

Description

A SDL_Rect defines a rectangular area of pixels. It is used by SDL_BlitSurface to define blitting regions and by several other video functions.


PrevHomeNext
SDL_GLattrUpSDL_Color
\ No newline at end of file diff --git a/SDL/docs/html/sdlremovetimer.html b/SDL/docs/html/sdlremovetimer.html new file mode 100644 index 0000000..6dd29cc --- /dev/null +++ b/SDL/docs/html/sdlremovetimer.html @@ -0,0 +1,236 @@ +SDL_RemoveTimer
SDL Library Documentation
PrevNext

SDL_RemoveTimer

Name

SDL_RemoveTimer -- Remove a timer which was added with +SDL_AddTimer.

Synopsis

#include "SDL.h"

SDL_bool SDL_RemoveTimer(SDL_TimerID id);

Description

Removes a timer callback previously added with +SDL_AddTimer.

Return Value

Returns a boolean value indicating success.

Examples

SDL_RemoveTimer(my_timer_id);

See Also

SDL_AddTimer


PrevHomeNext
SDL_AddTimerUpSDL_SetTimer
\ No newline at end of file diff --git a/SDL/docs/html/sdlresizeevent.html b/SDL/docs/html/sdlresizeevent.html new file mode 100644 index 0000000..5df98da --- /dev/null +++ b/SDL/docs/html/sdlresizeevent.html @@ -0,0 +1,307 @@ +SDL_ResizeEvent
SDL Library Documentation
PrevNext

SDL_ResizeEvent

Name

SDL_ResizeEvent -- Window resize event structure

Structure Definition

typedef struct{
+  Uint8 type;
+  int w, h;
+} SDL_ResizeEvent;

Structure Data

typeSDL_VIDEORESIZE
w, hNew width and height of the window

Description

SDL_ResizeEvent is a member of the SDL_Event union and is used when an event of type SDL_VIDEORESIZE is reported.

When SDL_RESIZABLE is passed as a flag to SDL_SetVideoMode the user is allowed to resize the applications window. When the window is resized an SDL_VIDEORESIZE is report, with the new window width and height values stored in w and h, respectively. When an SDL_VIDEORESIZE is recieved the window should be resized to the new dimensions using SDL_SetVideoMode.


PrevHomeNext
SDL_JoyBallEventUpSDL_ExposeEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdlsavebmp.html b/SDL/docs/html/sdlsavebmp.html new file mode 100644 index 0000000..e348a7c --- /dev/null +++ b/SDL/docs/html/sdlsavebmp.html @@ -0,0 +1,236 @@ +SDL_SaveBMP
SDL Library Documentation
PrevNext

SDL_SaveBMP

Name

SDL_SaveBMP -- Save an SDL_Surface as a Windows BMP file.

Synopsis

#include "SDL.h"

int SDL_SaveBMP(SDL_Surface *surface, const char *file);

Description

Saves the SDL_Surface surface as a Windows BMP file named file.

Return Value

Returns 0 if successful or +-1 +if there was an error.

See Also

SDL_LoadBMP


PrevHomeNext
SDL_LoadBMPUpSDL_SetColorKey
\ No newline at end of file diff --git a/SDL/docs/html/sdlsempost.html b/SDL/docs/html/sdlsempost.html new file mode 100644 index 0000000..39f6e1e --- /dev/null +++ b/SDL/docs/html/sdlsempost.html @@ -0,0 +1,299 @@ +SDL_SemPost
SDL Library Documentation
PrevNext

SDL_SemPost

Name

SDL_SemPost -- Unlock a semaphore.

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

int SDL_SemPost(SDL_sem *sem);

Description

SDL_SemPost unlocks the semaphore pointed to by +sem and atomically increments the semaphores value. +Threads that were blocking on the semaphore may be scheduled after this call +succeeds.

SDL_SemPost should be called after a semaphore is locked by a successful call to +SDL_SemWait, +SDL_SemTryWait or +SDL_SemWaitTimeout.

Return Value

Returns 0 if successful or +-1 if there was an error (leaving the semaphore unchanged).

Examples

SDL_SemPost(my_sem);


PrevHomeNext
SDL_SemWaitTimeoutUpSDL_SemValue
\ No newline at end of file diff --git a/SDL/docs/html/sdlsemtrywait.html b/SDL/docs/html/sdlsemtrywait.html new file mode 100644 index 0000000..482548f --- /dev/null +++ b/SDL/docs/html/sdlsemtrywait.html @@ -0,0 +1,319 @@ +SDL_SemTryWait
SDL Library Documentation
PrevNext

SDL_SemTryWait

Name

SDL_SemTryWait -- Attempt to lock a semaphore but don't suspend the thread.

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

int SDL_SemTryWait(SDL_sem *sem);

Description

SDL_SemTryWait is a non-blocking varient of +SDL_SemWait. If the value of the semaphore +pointed to by sem is positive it will atomically +decrement the semaphore value and return 0, otherwise it will return +SDL_MUTEX_TIMEDOUT instead of suspending the thread.

After SDL_SemTryWait is successful, the semaphore +can be released and its count atomically incremented by a successful call to +SDL_SemPost.

Return Value

Returns 0 if the semaphore was successfully locked or +either SDL_MUTEX_TIMEDOUT or -1 +if the thread would have suspended or there was an error, respectivly.

If the semaphore was not successfully locked, the semaphore will be unchanged.

Examples

res = SDL_SemTryWait(my_sem);
+
+if (res == SDL_MUTEX_TIMEDOUT) {
+        return TRY_AGAIN;
+}
+if (res == -1) {
+        return WAIT_ERROR;
+}
+
+...
+
+SDL_SemPost(my_sem);


PrevHomeNext
SDL_SemWaitUpSDL_SemWaitTimeout
\ No newline at end of file diff --git a/SDL/docs/html/sdlsemvalue.html b/SDL/docs/html/sdlsemvalue.html new file mode 100644 index 0000000..450789c --- /dev/null +++ b/SDL/docs/html/sdlsemvalue.html @@ -0,0 +1,273 @@ +SDL_SemValue
SDL Library Documentation
PrevNext

SDL_SemValue

Name

SDL_SemValue -- Return the current value of a semaphore.

Synopsis

#include "SDL.h"
+#include "SDL/SDL_thread.h"

Uint32 SDL_SemValue(SDL_sem *sem);

Description

SDL_SemValue() returns the current semaphore value from +the semaphore pointed to by sem.

Return Value

Returns current value of the semaphore.

Examples

  sem_value = SDL_SemValue(my_sem);


PrevHomeNext
SDL_SemPostUpSDL_CreateCond
\ No newline at end of file diff --git a/SDL/docs/html/sdlsemwait.html b/SDL/docs/html/sdlsemwait.html new file mode 100644 index 0000000..d666d71 --- /dev/null +++ b/SDL/docs/html/sdlsemwait.html @@ -0,0 +1,298 @@ +SDL_SemWait
SDL Library Documentation
PrevNext

SDL_SemWait

Name

SDL_SemWait -- Lock a semaphore and suspend the thread if the semaphore value is zero.

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

int SDL_SemWait(SDL_sem *sem);

Description

SDL_SemWait() suspends the calling thread until either +the semaphore pointed to by sem has a positive value, +the call is interrupted by a signal or error. If the call is successful it +will atomically decrement the semaphore value.

After SDL_SemWait() is successful, the semaphore +can be released and its count atomically incremented by a successful call to +SDL_SemPost.

Return Value

Returns 0 if successful or +-1 if there was an error (leaving the semaphore unchanged).

Examples

if (SDL_SemWait(my_sem) == -1) {
+        return WAIT_FAILED;
+}
+
+...
+
+SDL_SemPost(my_sem);


PrevHomeNext
SDL_DestroySemaphoreUpSDL_SemTryWait
\ No newline at end of file diff --git a/SDL/docs/html/sdlsemwaittimeout.html b/SDL/docs/html/sdlsemwaittimeout.html new file mode 100644 index 0000000..47176b7 --- /dev/null +++ b/SDL/docs/html/sdlsemwaittimeout.html @@ -0,0 +1,322 @@ +SDL_SemWaitTimeout
SDL Library Documentation
PrevNext

SDL_SemWaitTimeout

Name

SDL_SemWaitTimeout -- Lock a semaphore, but only wait up to a specified maximum time.

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout);

Description

SDL_SemWaitTimeout() is a varient of +SDL_SemWait +with a maximum timeout value. +If the value of the semaphore pointed to by sem is +positive (greater than zero) it will atomically decrement the semaphore value +and return 0, otherwise it will wait up to timeout +milliseconds trying to lock the semaphore. This function is to be avoided if +possible since on some platforms it is implemented by polling the semaphore +every millisecond in a busy loop.

After SDL_SemWaitTimeout() is successful, the semaphore +can be released and its count atomically incremented by a successful call to +SDL_SemPost.

Return Value

Returns 0 if the semaphore was successfully locked or +either SDL_MUTEX_TIMEDOUT or -1 +if the timeout period was exceeded or there was an error, respectivly.

If the semaphore was not successfully locked, the semaphore will be unchanged.

Examples

res = SDL_SemWaitTimeout(my_sem, WAIT_TIMEOUT_MILLISEC);
+
+if (res == SDL_MUTEX_TIMEDOUT) {
+        return TRY_AGAIN;
+}
+if (res == -1) {
+        return WAIT_ERROR;
+}
+
+...
+
+SDL_SemPost(my_sem);


PrevHomeNext
SDL_SemTryWaitUpSDL_SemPost
\ No newline at end of file diff --git a/SDL/docs/html/sdlsetalpha.html b/SDL/docs/html/sdlsetalpha.html new file mode 100644 index 0000000..9c0dabb --- /dev/null +++ b/SDL/docs/html/sdlsetalpha.html @@ -0,0 +1,500 @@ +SDL_SetAlpha
SDL Library Documentation
PrevNext

SDL_SetAlpha

Name

SDL_SetAlpha -- Adjust the alpha properties of a surface

Synopsis

#include "SDL.h"

int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);

Description

Note: This function and the semantics of SDL alpha blending have changed since version 1.1.4. Up until version 1.1.5, an alpha value of 0 was considered opaque and a value of 255 was considered transparent. This has now been inverted: 0 (SDL_ALPHA_TRANSPARENT) is now considered transparent and 255 (SDL_ALPHA_OPAQUE) is now considered opaque.

SDL_SetAlpha is used for setting the per-surface alpha +value and/or enabling and disabling alpha blending.

Thesurface parameter specifies which surface whose alpha +attributes you wish to adjust. flags is used to specify +whether alpha blending should be used (SDL_SRCALPHA) and +whether the surface should use RLE acceleration for blitting +(SDL_RLEACCEL). flags can be an OR'd +combination of these two options, one of these options or 0. If +SDL_SRCALPHA is not passed as a flag then all alpha +information is ignored when blitting the surface. The +alpha parameter is the per-surface alpha value; a +surface need not have an alpha channel to use per-surface alpha and blitting +can still be accelerated with SDL_RLEACCEL.

Note: The per-surface alpha value of 128 is considered a special case and +is optimised, so it's much faster than other per-surface values.

Alpha effects surface blitting in the following ways:

RGBA->RGB with SDL_SRCALPHA

The source is alpha-blended with the destination, using the alpha channel. SDL_SRCCOLORKEY and the per-surface alpha are ignored.

RGBA->RGB without SDL_SRCALPHA

The RGB data is copied from the source. The source alpha channel and the per-surface alpha value are ignored.

RGB->RGBA with SDL_SRCALPHA

The source is alpha-blended with the destination using the per-surface alpha +value. If SDL_SRCCOLORKEY is set, only the pixels not +matching the colorkey value are copied. The alpha channel of the copied pixels +is set to opaque.

RGB->RGBA without SDL_SRCALPHA

The RGB data is copied from the source and the alpha value of the copied pixels +is set to opaque. If SDL_SRCCOLORKEY is set, only the pixels +not matching the colorkey value are copied.

RGBA->RGBA with SDL_SRCALPHA

The source is alpha-blended with the destination using the source alpha +channel. The alpha channel in the destination surface is left untouched. +SDL_SRCCOLORKEY is ignored.

RGBA->RGBA without SDL_SRCALPHA

The RGBA data is copied to the destination surface. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

RGB->RGB with SDL_SRCALPHA

The source is alpha-blended with the destination using the per-surface alpha value. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

RGB->RGB without SDL_SRCALPHA

The RGB data is copied from the source. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

Note: Note that RGBA->RGBA blits (with SDL_SRCALPHA set) keep the alpha +of the destination surface. This means that you cannot compose two arbitrary +RGBA surfaces this way and get the result you would expect from "overlaying" +them; the destination alpha will work as a mask.

Also note that per-pixel and per-surface alpha cannot be combined; +the per-pixel alpha is always used if available

Return Value

This function returns 0, or +-1 if there was an error.


PrevHomeNext
SDL_SetColorKeyUpSDL_SetClipRect
\ No newline at end of file diff --git a/SDL/docs/html/sdlsetcliprect.html b/SDL/docs/html/sdlsetcliprect.html new file mode 100644 index 0000000..bda7c02 --- /dev/null +++ b/SDL/docs/html/sdlsetcliprect.html @@ -0,0 +1,241 @@ +SDL_SetClipRect
SDL Library Documentation
PrevNext

SDL_SetClipRect

Name

SDL_SetClipRect -- Sets the clipping rectangle for a surface.

Synopsis

#include "SDL.h"

void SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect);

Description

Sets the clipping rectangle for a surface. When this surface is the +destination of a blit, only the area within the clip rectangle will be +drawn into.

The rectangle pointed to by rect will be +clipped to the edges of the surface so that the clip rectangle for a +surface can never fall outside the edges of the surface.

If rect is NULL the clipping +rectangle will be set to the full size of the surface.


PrevHomeNext
SDL_SetAlphaUpSDL_GetClipRect
\ No newline at end of file diff --git a/SDL/docs/html/sdlsetcolorkey.html b/SDL/docs/html/sdlsetcolorkey.html new file mode 100644 index 0000000..433efa5 --- /dev/null +++ b/SDL/docs/html/sdlsetcolorkey.html @@ -0,0 +1,321 @@ +SDL_SetColorKey
SDL Library Documentation
PrevNext

SDL_SetColorKey

Name

SDL_SetColorKey -- Sets the color key (transparent pixel) in a blittable surface and +RLE acceleration.

Synopsis

#include "SDL.h"

int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);

Description

Sets the color key (transparent pixel) in a blittable surface and enables or + disables RLE blit acceleration.

RLE acceleration can substantially speed up blitting of images with large +horizontal runs of transparent pixels (i.e., pixels that match the +key value). The key must be of the same pixel format as the surface, SDL_MapRGB is often useful for obtaining an acceptable value.

If flag is SDL_SRCCOLORKEY then +key is the transparent pixel value in the source image of a +blit.

If flag is OR'd with +SDL_RLEACCEL then the surface will be draw using RLE +acceleration when drawn with +SDL_BlitSurface. The surface will +actually be encoded for RLE acceleration the first time +SDL_BlitSurface or +SDL_DisplayFormat is called on the +surface.

If flag is 0, this function clears +any current color key.

Return Value

This function returns 0, or +-1 if there was an error.


PrevHomeNext
SDL_SaveBMPUpSDL_SetAlpha
\ No newline at end of file diff --git a/SDL/docs/html/sdlsetcolors.html b/SDL/docs/html/sdlsetcolors.html new file mode 100644 index 0000000..dfd3441 --- /dev/null +++ b/SDL/docs/html/sdlsetcolors.html @@ -0,0 +1,358 @@ +SDL_SetColors
SDL Library Documentation
PrevNext

SDL_SetColors

Name

SDL_SetColors -- Sets a portion of the colormap for the given 8-bit surface.

Synopsis

#include "SDL.h"

int SDL_SetColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);

Description

Sets a portion of the colormap for the given 8-bit surface.

When surface is the surface associated with the current +display, the display colormap will be updated with the requested colors. If +SDL_HWPALETTE was set in SDL_SetVideoMode flags, +SDL_SetColors will always return 1, +and the palette is guaranteed to be set the way you desire, even if the window +colormap has to be warped or run under emulation.

The color components of a +SDL_Color +structure are 8-bits in size, giving you a total of 2563 +=16777216 colors.

Palettized (8-bit) screen surfaces with the SDL_HWPALETTE +flag have two palettes, a logical palette that is used for mapping blits +to/from the surface and a physical palette (that determines how the +hardware will map the colors to the display). SDL_SetColors +modifies both palettes (if present), and is equivalent to calling +SDL_SetPalette with the +flags set to +(SDL_LOGPAL | SDL_PHYSPAL).

Return Value

If surface is not a palettized surface, this function +does nothing, returning 0. If all of the colors were set +as passed to SDL_SetColors, it will return +1. If not all the color entries were set exactly as +given, it will return 0, and you should look at the +surface palette to determine the actual color palette.

Example

/* Create a display surface with a grayscale palette */
+SDL_Surface *screen;
+SDL_Color colors[256];
+int i;
+.
+.
+.
+/* Fill colors with color information */
+for(i=0;i<256;i++){
+  colors[i].r=i;
+  colors[i].g=i;
+  colors[i].b=i;
+}
+
+/* Create display */
+screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE);
+if(!screen){
+  printf("Couldn't set video mode: %s\n", SDL_GetError());
+  exit(-1);
+}
+
+/* Set palette */
+SDL_SetColors(screen, colors, 0, 256);
+.
+.
+.
+.

PrevHomeNext
SDL_FlipUpSDL_SetPalette
\ No newline at end of file diff --git a/SDL/docs/html/sdlsetcursor.html b/SDL/docs/html/sdlsetcursor.html new file mode 100644 index 0000000..3613790 --- /dev/null +++ b/SDL/docs/html/sdlsetcursor.html @@ -0,0 +1,222 @@ +SDL_SetCursor
SDL Library Documentation
PrevNext

SDL_SetCursor

Name

SDL_SetCursor -- Set the currently active mouse cursor.

Synopsis

#include "SDL.h"

void SDL_SetCursor(SDL_Cursor *cursor);

Description

Sets the currently active cursor to +the specified one. +If the cursor is currently visible, the change will be immediately +represented on the display.


PrevHomeNext
SDL_FreeCursorUpSDL_GetCursor
diff --git a/SDL/docs/html/sdlseteventfilter.html b/SDL/docs/html/sdlseteventfilter.html new file mode 100644 index 0000000..29046ef --- /dev/null +++ b/SDL/docs/html/sdlseteventfilter.html @@ -0,0 +1,284 @@ +SDL_SetEventFilter
SDL Library Documentation
PrevNext

SDL_SetEventFilter

Name

SDL_SetEventFilter -- Sets up a filter to process all events before they are posted +to the event queue.

Synopsis

#include "SDL.h"

void SDL_SetEventFilter(SDL_EventFilter filter);

Description

This function sets up a filter to process all events before they are posted +to the event queue. This is a very powerful and flexible feature. The filter +is prototyped as: +

typedef int (*SDL_EventFilter)(const SDL_Event *event);
+If the filter returns 1, then the event will be +added to the internal queue. If it returns 0, +then the event will be dropped from the queue. This allows selective +filtering of dynamically.

There is one caveat when dealing with the SDL_QUITEVENT event type. The +event filter is only called when the window manager desires to close the +application window. If the event filter returns 1, then the window will +be closed, otherwise the window will remain open if possible. +If the quit event is generated by an interrupt signal, it will bypass the +internal queue and be delivered to the application at the next event poll.

Note: Events pushed onto the queue with SDL_PushEvent or SDL_PeepEvents do not get passed through the event filter.

Note: Be Careful! The event filter function may run in a different thread so be careful what you do within it.


PrevHomeNext
SDL_PushEventUpSDL_GetEventFilter
\ No newline at end of file diff --git a/SDL/docs/html/sdlsetgamma.html b/SDL/docs/html/sdlsetgamma.html new file mode 100644 index 0000000..b02595e --- /dev/null +++ b/SDL/docs/html/sdlsetgamma.html @@ -0,0 +1,231 @@ +SDL_SetGamma
SDL Library Documentation
PrevNext

SDL_SetGamma

Name

SDL_SetGamma -- Sets the color gamma function for the display

Synopsis

#include "SDL.h"

int SDL_SetGamma(float redgamma, float greengamma, float bluegamma);

Description

Sets the "gamma function" for the display of each color component. Gamma +controls the brightness/contrast of colors displayed on the screen. +A gamma value of 1.0 is identity (i.e., no adjustment +is made).

This function adjusts the gamma based on the "gamma function" parameter, +you can directly specify lookup tables for gamma adjustment with +SDL_SetGammaRamp.

Not all display hardware is able to change gamma.

Return Value

Returns -1 on error (or if gamma adjustment is not supported).


PrevHomeNext
SDL_SetPaletteUpSDL_GetGammaRamp
\ No newline at end of file diff --git a/SDL/docs/html/sdlsetgammaramp.html b/SDL/docs/html/sdlsetgammaramp.html new file mode 100644 index 0000000..6cc9e37 --- /dev/null +++ b/SDL/docs/html/sdlsetgammaramp.html @@ -0,0 +1,230 @@ +SDL_SetGammaRamp
SDL Library Documentation
PrevNext

SDL_SetGammaRamp

Name

SDL_SetGammaRamp -- Sets the color gamma lookup tables for the display

Synopsis

#include "SDL.h"

int SDL_SetGammaRamp(Uint16 *redtable, Uint16 *greentable, Uint16 *bluetable);

Description

Sets the gamma lookup tables for the display for each color component. +Each table is an array of 256 Uint16 values, representing a mapping +between the input and output for that channel. The input is the index +into the array, and the output is the 16-bit gamma value at that index, +scaled to the output color precision. You may pass NULL to any of the +channels to leave them unchanged.

This function adjusts the gamma based on lookup tables, you can also +have the gamma calculated based on a "gamma function" parameter with +SDL_SetGamma.

Not all display hardware is able to change gamma.

Return Value

Returns -1 on error (or if gamma adjustment is not supported).


PrevHomeNext
SDL_GetGammaRampUpSDL_MapRGB
\ No newline at end of file diff --git a/SDL/docs/html/sdlsetmodstate.html b/SDL/docs/html/sdlsetmodstate.html new file mode 100644 index 0000000..ce41ee8 --- /dev/null +++ b/SDL/docs/html/sdlsetmodstate.html @@ -0,0 +1,237 @@ +SDL_SetModState
SDL Library Documentation
PrevNext

SDL_SetModState

Name

SDL_SetModState -- Set the current key modifier state

Synopsis

#include "SDL.h"

void SDL_SetModState(SDLMod modstate);

Description

The inverse of SDL_GetModState, SDL_SetModState allows you to impose modifier key states on your application.

Simply pass your desired modifier states into modstate. This value my be a logical OR'd combination of the following:

typedef enum {
+  KMOD_NONE  = 0x0000,
+  KMOD_LSHIFT= 0x0001,
+  KMOD_RSHIFT= 0x0002,
+  KMOD_LCTRL = 0x0040,
+  KMOD_RCTRL = 0x0080,
+  KMOD_LALT  = 0x0100,
+  KMOD_RALT  = 0x0200,
+  KMOD_LMETA = 0x0400,
+  KMOD_RMETA = 0x0800,
+  KMOD_NUM   = 0x1000,
+  KMOD_CAPS  = 0x2000,
+  KMOD_MODE  = 0x4000,
+} SDLMod;

PrevHomeNext
SDL_GetModStateUpSDL_GetKeyName
\ No newline at end of file diff --git a/SDL/docs/html/sdlsetpalette.html b/SDL/docs/html/sdlsetpalette.html new file mode 100644 index 0000000..e3b5f00 --- /dev/null +++ b/SDL/docs/html/sdlsetpalette.html @@ -0,0 +1,352 @@ +SDL_SetPalette
SDL Library Documentation
PrevNext

SDL_SetPalette

Name

SDL_SetPalette -- Sets the colors in the palette of an 8-bit surface.

Synopsis

#include "SDL.h"

int SDL_SetPalette(SDL_Surface *surface, int flags, SDL_Color *colors, int firstcolor, int ncolors);

Description

Sets a portion of the palette for the given 8-bit surface.

Palettized (8-bit) screen surfaces with the +SDL_HWPALETTE flag have two palettes, a logical +palette that is used for mapping blits to/from the surface and a +physical palette (that determines how the hardware will map the colors +to the display). SDL_BlitSurface +always uses the logical palette when blitting surfaces (if it has to +convert between surface pixel formats). Because of this, it is often +useful to modify only one or the other palette to achieve various +special color effects (e.g., screen fading, color flashes, screen dimming).

This function can modify either the logical or physical palette by +specifing SDL_LOGPAL or +SDL_PHYSPALthe in the flags +parameter.

When surface is the surface associated with the current +display, the display colormap will be updated with the requested colors. If +SDL_HWPALETTE was set in SDL_SetVideoMode flags, +SDL_SetPalette will always return 1, +and the palette is guaranteed to be set the way you desire, even if the window +colormap has to be warped or run under emulation.

The color components of a +SDL_Color structure +are 8-bits in size, giving you a total of +2563=16777216 colors.

Return Value

If surface is not a palettized surface, this function +does nothing, returning 0. If all of the colors were set +as passed to SDL_SetPalette, it will return +1. If not all the color entries were set exactly as +given, it will return 0, and you should look at the +surface palette to determine the actual color palette.

Example

        /* Create a display surface with a grayscale palette */
+        SDL_Surface *screen;
+        SDL_Color colors[256];
+        int i;
+        .
+        .
+        .
+        /* Fill colors with color information */
+        for(i=0;i<256;i++){
+          colors[i].r=i;
+          colors[i].g=i;
+          colors[i].b=i;
+        }
+
+        /* Create display */
+        screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE);
+        if(!screen){
+          printf("Couldn't set video mode: %s\n", SDL_GetError());
+          exit(-1);
+        }
+
+        /* Set palette */
+        SDL_SetPalette(screen, SDL_LOGPAL|SDL_PHYSPAL, colors, 0, 256);
+        .
+        .
+        .
+        .

PrevHomeNext
SDL_SetColorsUpSDL_SetGamma
\ No newline at end of file diff --git a/SDL/docs/html/sdlsettimer.html b/SDL/docs/html/sdlsettimer.html new file mode 100644 index 0000000..b3eca65 --- /dev/null +++ b/SDL/docs/html/sdlsettimer.html @@ -0,0 +1,267 @@ +SDL_SetTimer
SDL Library Documentation
Prev 

SDL_SetTimer

Name

SDL_SetTimer -- Set a callback to run after the specified number of milliseconds has +elapsed.

Synopsis

#include "SDL.h"

int SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);

Callback

/* Function prototype for the timer callback function */ +typedef Uint32 (*SDL_TimerCallback)(Uint32 interval);

Description

Set a callback to run after the specified number of milliseconds has +elapsed. The callback function is passed the current timer interval +and returns the next timer interval. If the returned value is the +same as the one passed in, the periodic alarm continues, otherwise a +new alarm is scheduled.

To cancel a currently running timer, call +SDL_SetTimer(0, NULL);

The timer callback function may run in a different thread than your +main constant, and so shouldn't call any functions from within itself.

The maximum resolution of this timer is 10 ms, which means that if +you request a 16 ms timer, your callback will run approximately 20 ms +later on an unloaded system. If you wanted to set a flag signaling +a frame update at 30 frames per second (every 33 ms), you might set a +timer for 30 ms (see example below).

If you use this function, you need to pass SDL_INIT_TIMER +to SDL_Init().

Note: This function is kept for compatibility but has been superseded +by the new timer functions +SDL_AddTimer and +SDL_RemoveTimer which support +multiple timers.

Examples

SDL_SetTimer((33/10)*10, my_callback);

See Also

SDL_AddTimer


PrevHome 
SDL_RemoveTimerUp 
\ No newline at end of file diff --git a/SDL/docs/html/sdlsetvideomode.html b/SDL/docs/html/sdlsetvideomode.html new file mode 100644 index 0000000..b55ceed --- /dev/null +++ b/SDL/docs/html/sdlsetvideomode.html @@ -0,0 +1,558 @@ +SDL_SetVideoMode
SDL Library Documentation
PrevNext

SDL_SetVideoMode

Name

SDL_SetVideoMode -- Set up a video mode with the specified width, height and bits-per-pixel.

Synopsis

#include "SDL.h"

SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags);

Description

Set up a video mode with the specified width, height and bits-per-pixel.

If bpp is 0, it is treated as the +current display bits per pixel.

The flags parameter is the same as the flags field of the SDL_Surface structure. OR'd combinations of the following values are valid.

SDL_SWSURFACECreate the video surface in system memory
SDL_HWSURFACECreate the video surface in video memory
SDL_ASYNCBLITEnables the use of asynchronous updates of the display surface. This will +usually slow down blitting on single CPU machines, but may provide a speed +increase on SMP systems.
SDL_ANYFORMATNormally, if a video surface of the requested bits-per-pixel (bpp) is not available, SDL will emulate one with a shadow surface. Passing SDL_ANYFORMAT prevents this and causes SDL to use the video surface, regardless of its pixel depth.
SDL_HWPALETTEGive SDL exclusive palette access. Without this flag you may not always get the the colors you request with SDL_SetColors or SDL_SetPalette.
SDL_DOUBLEBUFEnable hardware double buffering; only valid with SDL_HWSURFACE. Calling +SDL_Flip will flip the +buffers and update the screen. All drawing will take place on the surface +that is not displayed at the moment. If double buffering could not be enabled +then SDL_Flip will just perform a +SDL_UpdateRect +on the entire screen.
SDL_FULLSCREENSDL will attempt to use a fullscreen mode. If a hardware resolution change is +not possible (for whatever reason), the next higher resolution will be used and +the display window centered on a black background.
SDL_OPENGLCreate an OpenGL rendering context. You should have previously set OpenGL video attributes with SDL_GL_SetAttribute.
SDL_OPENGLBLITCreate an OpenGL rendering context, like above, but allow normal blitting +operations. The screen (2D) surface may have an alpha channel, and +SDL_UpdateRects +must be used for updating changes to the screen surface. NOTE: This option +is kept for compatibility only, and is not recommended for +new code.
SDL_RESIZABLECreate a resizable window. When the window is resized by the user a SDL_VIDEORESIZE event is generated and SDL_SetVideoMode can be called again with the new size.
SDL_NOFRAMEIf possible, SDL_NOFRAME causes SDL to create a window with no title bar or frame decoration. Fullscreen modes automatically have this flag set.

Note: Whatever flags SDL_SetVideoMode could satisfy are set in the flags member of the returned surface.

Note: The bpp parameter is the number of bits per pixel, +so a bpp of 24 uses the packed representation of +3 bytes/pixel. For the more common 4 bytes/pixel mode, use a +bpp of 32. Somewhat oddly, both 15 and 16 will +request a 2 bytes/pixel mode, but different pixel formats.

Return Value

The framebuffer surface, or NULL if it fails. +The surface returned is freed by SDL_Quit() and should nt be freed by +the caller.


PrevHomeNext
SDL_VideoModeOKUpSDL_UpdateRect
\ No newline at end of file diff --git a/SDL/docs/html/sdlshowcursor.html b/SDL/docs/html/sdlshowcursor.html new file mode 100644 index 0000000..3697cc1 --- /dev/null +++ b/SDL/docs/html/sdlshowcursor.html @@ -0,0 +1,239 @@ +SDL_ShowCursor
SDL Library Documentation
PrevNext

SDL_ShowCursor

Name

SDL_ShowCursor -- Toggle whether or not the cursor is shown on the screen.

Synopsis

#include "SDL.h"

int SDL_ShowCursor(int toggle);

Description

Toggle whether or not the cursor is shown on the screen. Passing SDL_ENABLE displays the cursor and passing SDL_DISABLE hides it. The current state of the mouse cursor can be queried by passing SDL_QUERY, either SDL_DISABLE or SDL_ENABLE will be returned.

The cursor starts off displayed, but can be turned off.

Return Value

Returns the current state of the cursor.


PrevHomeNext
SDL_GetCursorUpSDL_GL_LoadLibrary
\ No newline at end of file diff --git a/SDL/docs/html/sdlsurface.html b/SDL/docs/html/sdlsurface.html new file mode 100644 index 0000000..7548810 --- /dev/null +++ b/SDL/docs/html/sdlsurface.html @@ -0,0 +1,597 @@ +SDL_Surface
SDL Library Documentation
PrevNext

SDL_Surface

Name

SDL_Surface -- Graphical Surface Structure

Structure Definition

typedef struct SDL_Surface {
+        Uint32 flags;                           /* Read-only */
+        SDL_PixelFormat *format;                /* Read-only */
+        int w, h;                               /* Read-only */
+        Uint16 pitch;                           /* Read-only */
+        void *pixels;                           /* Read-write */
+
+        /* clipping information */
+        SDL_Rect clip_rect;                     /* Read-only */
+
+        /* Reference count -- used when freeing surface */
+        int refcount;                           /* Read-mostly */
+
+	/* This structure also contains private fields not shown here */
+} SDL_Surface;

Structure Data

flagsSurface flags
formatPixel format
w, hWidth and height of the surface
pitchLength of a surface scanline in bytes
pixelsPointer to the actual pixel data
clip_rectsurface clip rectangle

Description

SDL_Surface's represent areas of "graphical" +memory, memory that can be drawn to. The video framebuffer is returned +as a SDL_Surface by +SDL_SetVideoMode +and SDL_GetVideoSurface. +Most of the fields should be pretty obvious. +w and h are the +width and height of the surface in pixels. +pixels is a pointer to the actual pixel data, +the surface should be locked +before accessing this field. The clip_rect field +is the clipping rectangle as set by +SDL_SetClipRect.

The following are supported in the +flags field.

SDL_SWSURFACESurface is stored in system memory
SDL_HWSURFACESurface is stored in video memory
SDL_ASYNCBLITSurface uses asynchronous blits if possible
SDL_ANYFORMATAllows any pixel-format (Display surface)
SDL_HWPALETTESurface has exclusive palette
SDL_DOUBLEBUFSurface is double buffered (Display surface)
SDL_FULLSCREENSurface is full screen (Display Surface)
SDL_OPENGLSurface has an OpenGL context (Display Surface)
SDL_OPENGLBLITSurface supports OpenGL blitting (Display Surface)
SDL_RESIZABLESurface is resizable (Display Surface)
SDL_HWACCELSurface blit uses hardware acceleration
SDL_SRCCOLORKEYSurface use colorkey blitting
SDL_RLEACCELColorkey blitting is accelerated with RLE
SDL_SRCALPHASurface blit uses alpha blending
SDL_PREALLOCSurface uses preallocated memory


PrevHomeNext
SDL_PixelFormatUpSDL_VideoInfo
\ No newline at end of file diff --git a/SDL/docs/html/sdlsyswmevent.html b/SDL/docs/html/sdlsyswmevent.html new file mode 100644 index 0000000..df5d244 --- /dev/null +++ b/SDL/docs/html/sdlsyswmevent.html @@ -0,0 +1,233 @@ +SDL_SysWMEvent
SDL Library Documentation
PrevNext

SDL_SysWMEvent

Name

SDL_SysWMEvent -- Platform-dependent window manager event.

Description

The system window manager event contains a pointer to system-specific +information about unknown window manager events. If you enable this event +using +SDL_EventState(), +it will be generated whenever unhandled events are received from the window +manager. This can be used, for example, to implement cut-and-paste in your +application. + +

typedef struct {
+         Uint8 type;   /* Always SDL_SYSWMEVENT */
+         SDL_SysWMmsg *msg;
+ } SDL_SysWMEvent;
+ +If you want to obtain system-specific information about the window manager, +you can fill the version member of a SDL_SysWMinfo +structure (details can be found in SDL_syswm.h, which must be included) using the SDL_VERSION() macro found in +SDL_version.h, and pass it to the +function: +

int SDL_GetWMInfo(SDL_SysWMinfo *info);


PrevHomeNext
SDL_ExposeEventUpSDL_UserEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdlthreadid.html b/SDL/docs/html/sdlthreadid.html new file mode 100644 index 0000000..6b378fa --- /dev/null +++ b/SDL/docs/html/sdlthreadid.html @@ -0,0 +1,190 @@ +SDL_ThreadID
SDL Library Documentation
PrevNext

SDL_ThreadID

Name

SDL_ThreadID -- Get the 32-bit thread identifier for the current thread.

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

Uint32 SDL_ThreadID(void);

Description

Get the 32-bit thread identifier for the current thread.


PrevHomeNext
SDL_CreateThreadUpSDL_GetThreadID
\ No newline at end of file diff --git a/SDL/docs/html/sdlunlockaudio.html b/SDL/docs/html/sdlunlockaudio.html new file mode 100644 index 0000000..f4489b0 --- /dev/null +++ b/SDL/docs/html/sdlunlockaudio.html @@ -0,0 +1,211 @@ +SDL_UnlockAudio
SDL Library Documentation
PrevNext

SDL_UnlockAudio

Name

SDL_UnlockAudio -- Unlock the callback function

Synopsis

#include "SDL.h"

void SDL_UnlockAudio(void);

Description

Unlocks a previous SDL_LockAudio call.


PrevHomeNext
SDL_LockAudioUpSDL_CloseAudio
\ No newline at end of file diff --git a/SDL/docs/html/sdlunlocksurface.html b/SDL/docs/html/sdlunlocksurface.html new file mode 100644 index 0000000..5b85e4f --- /dev/null +++ b/SDL/docs/html/sdlunlocksurface.html @@ -0,0 +1,219 @@ +SDL_UnlockSurface
SDL Library Documentation
PrevNext

SDL_UnlockSurface

Name

SDL_UnlockSurface -- Unlocks a previously locked surface.

Synopsis

#include "SDL.h"

void SDL_UnlockSurface(SDL_Surface *surface);

Description

Surfaces that were previously locked using SDL_LockSurface must be unlocked with SDL_UnlockSurface. Surfaces should be unlocked as soon as possible.

It should be noted that since 1.1.8, surface locks are recursive. See SDL_LockSurface.


PrevHomeNext
SDL_LockSurfaceUpSDL_LoadBMP
\ No newline at end of file diff --git a/SDL/docs/html/sdlunlockyuvoverlay.html b/SDL/docs/html/sdlunlockyuvoverlay.html new file mode 100644 index 0000000..5ebd618 --- /dev/null +++ b/SDL/docs/html/sdlunlockyuvoverlay.html @@ -0,0 +1,225 @@ +SDL_UnlockYUVOverlay
SDL Library Documentation
PrevNext

SDL_UnlockYUVOverlay

Name

SDL_UnlockYUVOverlay -- Unlock an overlay

Synopsis

#include "SDL.h"

void SDL_UnlockYUVOverlay(SDL_Overlay *overlay);

Description

The opposite to SDL_LockYUVOverlay. Unlocks a previously locked overlay. An overlay must be unlocked before it can be displayed.


PrevHomeNext
SDL_LockYUVOverlayUpSDL_DisplayYUVOverlay
\ No newline at end of file diff --git a/SDL/docs/html/sdlupdaterect.html b/SDL/docs/html/sdlupdaterect.html new file mode 100644 index 0000000..5d439c7 --- /dev/null +++ b/SDL/docs/html/sdlupdaterect.html @@ -0,0 +1,266 @@ +SDL_UpdateRect
SDL Library Documentation
PrevNext

SDL_UpdateRect

Name

SDL_UpdateRect -- Makes sure the given area is updated on the given screen.

Synopsis

#include "SDL.h"

void SDL_UpdateRect(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h);

Description

Makes sure the given area is updated on the given screen. The rectangle must +be confined within the screen boundaries (no clipping is done).

If 'x', 'y', 'w' +and 'h' are all 0, +SDL_UpdateRect will update the +entire screen.

This function should not be called while 'screen' is +locked.


PrevHomeNext
SDL_SetVideoModeUpSDL_UpdateRects
\ No newline at end of file diff --git a/SDL/docs/html/sdlupdaterects.html b/SDL/docs/html/sdlupdaterects.html new file mode 100644 index 0000000..be39788 --- /dev/null +++ b/SDL/docs/html/sdlupdaterects.html @@ -0,0 +1,255 @@ +SDL_UpdateRects
SDL Library Documentation
PrevNext

SDL_UpdateRects

Name

SDL_UpdateRects -- Makes sure the given list of rectangles is updated on the given screen.

Synopsis

#include "SDL.h"

void SDL_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect *rects);

Description

Makes sure the given list of rectangles is updated on the given screen. +The rectangles must all be confined within the screen boundaries (no +clipping is done).

This function should not be called while screen is +locked.

Note: It is adviced to call this function only once per frame, since each +call has some processing overhead. This is no restriction since you +can pass any number of rectangles each time.

The rectangles are not automatically merged or checked for overlap. In +general, the programmer can use his knowledge about his particular +rectangles to merge them in an efficient way, to avoid overdraw.


PrevHomeNext
SDL_UpdateRectUpSDL_Flip
\ No newline at end of file diff --git a/SDL/docs/html/sdluserevent.html b/SDL/docs/html/sdluserevent.html new file mode 100644 index 0000000..d87c552 --- /dev/null +++ b/SDL/docs/html/sdluserevent.html @@ -0,0 +1,337 @@ +SDL_UserEvent
SDL Library Documentation
PrevNext

SDL_UserEvent

Name

SDL_UserEvent -- A user-defined event type

Structure Definition

typedef struct{
+  Uint8 type;
+  int code;
+  void *data1;
+  void *data2;
+} SDL_UserEvent;

Structure Data

typeSDL_USEREVENT through to SDL_NUMEVENTS-1
codeUser defined event code
data1User defined data pointer
data2User defined data pointer

Description

SDL_UserEvent is in the user member of the structure SDL_Event. This event is unique, it is never created by SDL but only by the user. The event can be pushed onto the event queue using SDL_PushEvent. The contents of the structure members or completely up to the programmer, the only requirement is that type is a value from SDL_USEREVENT to SDL_NUMEVENTS-1 (inclusive).

Examples

SDL_Event event;
+
+event.type = SDL_USEREVENT;
+event.user.code = my_event_code;
+event.user.data1 = significant_data;
+event.user.data2 = 0;
+SDL_PushEvent(&event);


PrevHomeNext
SDL_SysWMEventUpSDL_QuitEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdlvideodrivername.html b/SDL/docs/html/sdlvideodrivername.html new file mode 100644 index 0000000..52d1a9c --- /dev/null +++ b/SDL/docs/html/sdlvideodrivername.html @@ -0,0 +1,243 @@ +SDL_VideoDriverName
SDL Library Documentation
PrevNext

SDL_VideoDriverName

Name

SDL_VideoDriverName -- Obtain the name of the video driver

Synopsis

#include "SDL.h"

char *SDL_VideoDriverName(char *namebuf, int maxlen);

Description

The buffer pointed to by namebuf is filled up to a maximum of maxlen characters (include the NULL terminator) with the name of the initialised video driver. The driver name is a simple one word identifier like "x11" or "windib".

Return Value

Returns NULL if video has not been initialised with SDL_Init or a pointer to namebuf otherwise.


PrevHomeNext
SDL_GetVideoInfoUpSDL_ListModes
\ No newline at end of file diff --git a/SDL/docs/html/sdlvideoinfo.html b/SDL/docs/html/sdlvideoinfo.html new file mode 100644 index 0000000..75b85f2 --- /dev/null +++ b/SDL/docs/html/sdlvideoinfo.html @@ -0,0 +1,408 @@ +SDL_VideoInfo
SDL Library Documentation
PrevNext

SDL_VideoInfo

Name

SDL_VideoInfo -- Video Target information

Structure Definition

typedef struct{
+  Uint32 hw_available:1;
+  Uint32 wm_available:1;
+  Uint32 blit_hw:1;
+  Uint32 blit_hw_CC:1;
+  Uint32 blit_hw_A:1;
+  Uint32 blit_sw:1;
+  Uint32 blit_sw_CC:1;
+  Uint32 blit_sw_A:1;
+  Uint32 blit_fill;
+  Uint32 video_mem;
+  SDL_PixelFormat *vfmt;
+} SDL_VideoInfo;

Structure Data

hw_availableIs it possible to create hardware surfaces?
wm_availableIs there a window manager available
blit_hwAre hardware to hardware blits accelerated?
blit_hw_CCAre hardware to hardware colorkey blits accelerated?
blit_hw_AAre hardware to hardware alpha blits accelerated?
blit_swAre software to hardware blits accelerated?
blit_sw_CCAre software to hardware colorkey blits accelerated?
blit_sw_AAre software to hardware alpha blits accelerated?
blit_fillAre color fills accelerated?
video_memTotal amount of video memory in Kilobytes
vfmtPixel format of the video device

Description

This (read-only) structure is returned by SDL_GetVideoInfo. It contains information on either the 'best' available mode (if called before SDL_SetVideoMode) or the current video mode.


PrevHomeNext
SDL_SurfaceUpSDL_Overlay
\ No newline at end of file diff --git a/SDL/docs/html/sdlvideomodeok.html b/SDL/docs/html/sdlvideomodeok.html new file mode 100644 index 0000000..7cec5bf --- /dev/null +++ b/SDL/docs/html/sdlvideomodeok.html @@ -0,0 +1,270 @@ +SDL_VideoModeOK
SDL Library Documentation
PrevNext

SDL_VideoModeOK

Name

SDL_VideoModeOK -- Check to see if a particular video mode is supported.

Synopsis

#include "SDL.h"

int SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);

Description

SDL_VideoModeOK returns 0 +if the requested mode is not supported under any bit depth, or returns the +bits-per-pixel of the closest available mode with the given width, height and requested surface flags (see SDL_SetVideoMode).

The bits-per-pixel value returned is only a suggested mode. You can usually request and bpp you want when setting the video mode and SDL will emulate that color depth with a shadow video surface.

The arguments to SDL_VideoModeOK are the same ones you +would pass to SDL_SetVideoMode

Example

SDL_Surface *screen;
+Uint32 bpp;
+.
+.
+.
+printf("Checking mode 640x480@16bpp.\n");
+bpp=SDL_VideoModeOK(640, 480, 16, SDL_HWSURFACE);
+
+if(!bpp){
+  printf("Mode not available.\n");
+  exit(-1);
+}
+
+printf("SDL Recommends 640x480@%dbpp.\n", bpp);
+screen=SDL_SetVideoMode(640, 480, bpp, SDL_HWSURFACE);
+.
+.

PrevHomeNext
SDL_ListModesUpSDL_SetVideoMode
\ No newline at end of file diff --git a/SDL/docs/html/sdlwaitevent.html b/SDL/docs/html/sdlwaitevent.html new file mode 100644 index 0000000..7116a0d --- /dev/null +++ b/SDL/docs/html/sdlwaitevent.html @@ -0,0 +1,231 @@ +SDL_WaitEvent
SDL Library Documentation
PrevNext

SDL_WaitEvent

Name

SDL_WaitEvent -- Waits indefinitely for the next available event.

Synopsis

#include "SDL.h"

int SDL_WaitEvent(SDL_Event *event);

Description

Waits indefinitely for the next available event, returning +1, or 0 if there was +an error while waiting for events.

If event is not NULL, the next +event is removed from the queue and stored in that area.


PrevHomeNext
SDL_PollEventUpSDL_PushEvent
\ No newline at end of file diff --git a/SDL/docs/html/sdlwaitthread.html b/SDL/docs/html/sdlwaitthread.html new file mode 100644 index 0000000..bc3f357 --- /dev/null +++ b/SDL/docs/html/sdlwaitthread.html @@ -0,0 +1,231 @@ +SDL_WaitThread
SDL Library Documentation
PrevNext

SDL_WaitThread

Name

SDL_WaitThread -- Wait for a thread to finish.

Synopsis

#include "SDL.h"
+#include "SDL_thread.h"

void SDL_WaitThread(SDL_Thread *thread, int *status);

Description

Wait for a thread to finish (timeouts are not supported).

Return Value

The return code for the thread function is placed in the area pointed to by +status, if status is not +NULL.


PrevHomeNext
SDL_GetThreadIDUpSDL_KillThread
\ No newline at end of file diff --git a/SDL/docs/html/sdlwarpmouse.html b/SDL/docs/html/sdlwarpmouse.html new file mode 100644 index 0000000..33b84ae --- /dev/null +++ b/SDL/docs/html/sdlwarpmouse.html @@ -0,0 +1,205 @@ +SDL_WarpMouse
SDL Library Documentation
PrevNext

SDL_WarpMouse

Name

SDL_WarpMouse -- Set the position of the mouse cursor.

Synopsis

#include "SDL.h"

void SDL_WarpMouse(Uint16 x, Uint16 y);

Description

Set the position of the mouse cursor (generates a mouse motion event).


PrevHomeNext
SDL_DisplayFormatAlphaUpSDL_CreateCursor
\ No newline at end of file diff --git a/SDL/docs/html/sdlwasinit.html b/SDL/docs/html/sdlwasinit.html new file mode 100644 index 0000000..e45fe9d --- /dev/null +++ b/SDL/docs/html/sdlwasinit.html @@ -0,0 +1,284 @@ +SDL_WasInit
SDL Library Documentation
PrevNext

SDL_WasInit

Name

SDL_WasInit -- Check which subsystems are initialized

Synopsis

#include "SDL.h"

Uint32 SDL_WasInit(Uint32 flags);

Description

SDL_WasInit allows you to see which SDL subsytems have been initialized. flags is a bitwise OR'd combination of the subsystems you wish to check (see SDL_Init for a list of subsystem flags).

Return Value

SDL_WasInit returns a bitwised OR'd combination of the initialized subsystems.

Examples


/* Here are several ways you can use SDL_WasInit() */
+
+/* Get init data on all the subsystems */
+Uint32 subsystem_init;
+
+subsystem_init=SDL_WasInit(SDL_INIT_EVERYTHING);
+
+if(subsystem_init&SDL_INIT_VIDEO)
+  printf("Video is initialized.\n");
+else
+  printf("Video is not initialized.\n");
+
+
+
+/* Just check for one specfic subsystem */
+
+if(SDL_WasInit(SDL_INIT_VIDEO)!=0)
+  printf("Video is initialized.\n");
+else
+  printf("Video is not initialized.\n");
+
+
+
+
+/* Check for two subsystems */
+
+Uint32 subsystem_mask=SDL_INIT_VIDEO|SDL_INIT_AUDIO;
+
+if(SDL_WasInit(subsystem_mask)==subsystem_mask)
+  printf("Video and Audio initialized.\n");
+else
+  printf("Video and Audio not initialized.\n");

PrevHomeNext
SDL_QuitUpSDL_GetError
\ No newline at end of file diff --git a/SDL/docs/html/sdlwmgetcaption.html b/SDL/docs/html/sdlwmgetcaption.html new file mode 100644 index 0000000..dfc9a4e --- /dev/null +++ b/SDL/docs/html/sdlwmgetcaption.html @@ -0,0 +1,222 @@ +SDL_WM_GetCaption
SDL Library Documentation
PrevNext

SDL_WM_GetCaption

Name

SDL_WM_GetCaption -- Gets the window title and icon name.

Synopsis

#include "SDL.h"

void SDL_WM_GetCaption(char **title, char **icon);

Description

Set pointers to the window title and icon name.


PrevHomeNext
SDL_WM_SetCaptionUpSDL_WM_SetIcon
\ No newline at end of file diff --git a/SDL/docs/html/sdlwmgrabinput.html b/SDL/docs/html/sdlwmgrabinput.html new file mode 100644 index 0000000..3762953 --- /dev/null +++ b/SDL/docs/html/sdlwmgrabinput.html @@ -0,0 +1,224 @@ +SDL_WM_GrabInput
SDL Library Documentation
PrevNext

SDL_WM_GrabInput

Name

SDL_WM_GrabInput -- Grabs mouse and keyboard input.

Synopsis

#include "SDL.h"

SDL_GrabMode SDL_WM_GrabInput(SDL_GrabMode mode);

Description

Grabbing means that the mouse is confined to the application window, +and nearly all keyboard input is passed directly to the application, +and not interpreted by a window manager, if any.

When mode is SDL_GRAB_QUERY the grab mode is not changed, but the current grab mode is returned.

typedef enum {
+  SDL_GRAB_QUERY,
+  SDL_GRAB_OFF,
+  SDL_GRAB_ON
+} SDL_GrabMode;
+

Return Value

The current/new SDL_GrabMode.


PrevHomeNext
SDL_WM_ToggleFullScreenUpEvents
\ No newline at end of file diff --git a/SDL/docs/html/sdlwmiconifywindow.html b/SDL/docs/html/sdlwmiconifywindow.html new file mode 100644 index 0000000..f245ace --- /dev/null +++ b/SDL/docs/html/sdlwmiconifywindow.html @@ -0,0 +1,211 @@ +SDL_WM_IconifyWindow
SDL Library Documentation
PrevNext

SDL_WM_IconifyWindow

Name

SDL_WM_IconifyWindow -- Iconify/Minimise the window

Synopsis

#include "SDL.h"

int SDL_WM_IconifyWindow(void);

Description

If the application is running in a window managed environment SDL attempts to iconify/minimise it. If SDL_WM_IconifyWindow is successful, the application will receive a SDL_APPACTIVE loss event.

Return Value

Returns non-zero on success or 0 if iconification is not support or was refused by the window manager.


PrevHomeNext
SDL_WM_SetIconUpSDL_WM_ToggleFullScreen
\ No newline at end of file diff --git a/SDL/docs/html/sdlwmsetcaption.html b/SDL/docs/html/sdlwmsetcaption.html new file mode 100644 index 0000000..2fe249f --- /dev/null +++ b/SDL/docs/html/sdlwmsetcaption.html @@ -0,0 +1,212 @@ +SDL_WM_SetCaption
SDL Library Documentation
PrevNext

SDL_WM_SetCaption

Name

SDL_WM_SetCaption -- Sets the window tile and icon name.

Synopsis

#include "SDL.h"

void SDL_WM_SetCaption(const char *title, const char *icon);

Description

Sets the title-bar and icon name of the display window.


PrevHomeNext
Window ManagementUpSDL_WM_GetCaption
\ No newline at end of file diff --git a/SDL/docs/html/sdlwmseticon.html b/SDL/docs/html/sdlwmseticon.html new file mode 100644 index 0000000..1097a7e --- /dev/null +++ b/SDL/docs/html/sdlwmseticon.html @@ -0,0 +1,260 @@ +SDL_WM_SetIcon
SDL Library Documentation
PrevNext

SDL_WM_SetIcon

Name

SDL_WM_SetIcon -- Sets the icon for the display window.

Synopsis

#include "SDL.h"

void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);

Description

Sets the icon for the display window. Win32 icons must be 32x32.

This function must be called before the first call to +SDL_SetVideoMode.

The mask is a bitmask that describes the shape of the +icon. If mask is NULL, then the shape is determined by +the colorkey of icon, if any, or makes the icon +rectangular (no transparency) otherwise.

If mask is non-NULL, it points to a bitmap with bits set +where the corresponding pixel should be visible. The format of the bitmap is as +follows: Scanlines come in the usual top-down order. Each scanline consists of +(width / 8) bytes, rounded up. The most significant bit of each byte represents +the leftmost pixel.

Example

SDL_WM_SetIcon(SDL_LoadBMP("icon.bmp"), NULL);

PrevHomeNext
SDL_WM_GetCaptionUpSDL_WM_IconifyWindow
\ No newline at end of file diff --git a/SDL/docs/html/sdlwmtogglefullscreen.html b/SDL/docs/html/sdlwmtogglefullscreen.html new file mode 100644 index 0000000..fb8bfe0 --- /dev/null +++ b/SDL/docs/html/sdlwmtogglefullscreen.html @@ -0,0 +1,205 @@ +SDL_WM_ToggleFullScreen
SDL Library Documentation
PrevNext

SDL_WM_ToggleFullScreen

Name

SDL_WM_ToggleFullScreen -- Toggles fullscreen mode

Synopsis

#include "SDL.h"

int SDL_WM_ToggleFullScreen(SDL_Surface *surface);

Description

Toggles the application between windowed and fullscreen mode, if supported. (X11 is the only target currently supported, BeOS support is experimental).

Return Value

Returns 0 on failure or 1 on success.


PrevHomeNext
SDL_WM_IconifyWindowUpSDL_WM_GrabInput
\ No newline at end of file diff --git a/SDL/docs/html/thread.html b/SDL/docs/html/thread.html new file mode 100644 index 0000000..406478a --- /dev/null +++ b/SDL/docs/html/thread.html @@ -0,0 +1,313 @@ +Multi-threaded Programming
SDL Library Documentation
PrevNext

Chapter 12. Multi-threaded Programming

Table of Contents
SDL_CreateThread -- Creates a new thread of execution that shares its parent's properties.
SDL_ThreadID -- Get the 32-bit thread identifier for the current thread.
SDL_GetThreadID -- Get the SDL thread ID of a SDL_Thread
SDL_WaitThread -- Wait for a thread to finish.
SDL_KillThread -- Gracelessly terminates the thread.
SDL_CreateMutex -- Create a mutex
SDL_DestroyMutex -- Destroy a mutex
SDL_mutexP -- Lock a mutex
SDL_mutexV -- Unlock a mutex
SDL_CreateSemaphore -- Creates a new semaphore and assigns an initial value to it.
SDL_DestroySemaphore -- Destroys a semaphore that was created by SDL_CreateSemaphore.
SDL_SemWait -- Lock a semaphore and suspend the thread if the semaphore value is zero.
SDL_SemTryWait -- Attempt to lock a semaphore but don't suspend the thread.
SDL_SemWaitTimeout -- Lock a semaphore, but only wait up to a specified maximum time.
SDL_SemPost -- Unlock a semaphore.
SDL_SemValue -- Return the current value of a semaphore.
SDL_CreateCond -- Create a condition variable
SDL_DestroyCond -- Destroy a condition variable
SDL_CondSignal -- Restart a thread wait on a condition variable
SDL_CondBroadcast -- Restart all threads waiting on a condition variable
SDL_CondWait -- Wait on a condition variable
SDL_CondWaitTimeout -- Wait on a condition variable, with timeout

SDL provides functions for creating threads, mutexes, semphores and condition variables.

In general, you must be very aware of concurrency and data integrity issues +when writing multi-threaded programs. Some good guidelines include: +

  • Don't call SDL video/event functions from separate threads

  • Don't use any library functions in separate threads

  • Don't perform any memory management in separate threads

  • Lock global variables which may be accessed by multiple threads

  • Never terminate threads, always set a flag and wait for them to quit

  • Think very carefully about all possible ways your code may interact

Note: SDL's threading is not implemented on MacOS, due to that lack of preemptive thread support (Mac OS X dos nt suffer from this problem)


PrevHomeNext
SDL_CDtrackUpSDL_CreateThread
\ No newline at end of file diff --git a/SDL/docs/html/time.html b/SDL/docs/html/time.html new file mode 100644 index 0000000..8aa1e28 --- /dev/null +++ b/SDL/docs/html/time.html @@ -0,0 +1,206 @@ +Time
SDL Library Documentation
PrevNext

Chapter 13. Time

Table of Contents
SDL_GetTicks -- Get the number of milliseconds since the SDL library initialization.
SDL_Delay -- Wait a specified number of milliseconds before returning.
SDL_AddTimer -- Add a timer which will call a callback after the specified number of milliseconds has +elapsed.
SDL_RemoveTimer -- Remove a timer which was added with +SDL_AddTimer.
SDL_SetTimer -- Set a callback to run after the specified number of milliseconds has +elapsed.

SDL provides several cross-platform functions for dealing with time. +It provides a way to get the current time, a way to wait a little while, +and a simple timer mechanism. These functions give you two ways of moving an +object every x milliseconds: + +

  • Use a timer callback function. This may have the bad effect that it runs in a seperate thread or uses alarm signals, but it's easier to implement.

  • Or you can get the number of milliseconds passed, and move the object if, for example, 30 ms passed.


PrevHomeNext
SDL_CondWaitTimeoutUpSDL_GetTicks
\ No newline at end of file diff --git a/SDL/docs/html/video.html b/SDL/docs/html/video.html new file mode 100644 index 0000000..39d0965 --- /dev/null +++ b/SDL/docs/html/video.html @@ -0,0 +1,507 @@ +Video
SDL Library Documentation
PrevNext

Chapter 6. Video

Table of Contents
SDL_GetVideoSurface -- returns a pointer to the current display surface
SDL_GetVideoInfo -- returns a pointer to information about the video hardware
SDL_VideoDriverName -- Obtain the name of the video driver
SDL_ListModes -- Returns a pointer to an array of available screen dimensions for +the given format and video flags
SDL_VideoModeOK -- Check to see if a particular video mode is supported.
SDL_SetVideoMode -- Set up a video mode with the specified width, height and bits-per-pixel.
SDL_UpdateRect -- Makes sure the given area is updated on the given screen.
SDL_UpdateRects -- Makes sure the given list of rectangles is updated on the given screen.
SDL_Flip -- Swaps screen buffers
SDL_SetColors -- Sets a portion of the colormap for the given 8-bit surface.
SDL_SetPalette -- Sets the colors in the palette of an 8-bit surface.
SDL_SetGamma -- Sets the color gamma function for the display
SDL_GetGammaRamp -- Gets the color gamma lookup tables for the display
SDL_SetGammaRamp -- Sets the color gamma lookup tables for the display
SDL_MapRGB -- Map a RGB color value to a pixel format.
SDL_MapRGBA -- Map a RGBA color value to a pixel format.
SDL_GetRGB -- Get RGB values from a pixel in the specified pixel format.
SDL_GetRGBA -- Get RGBA values from a pixel in the specified pixel format.
SDL_CreateRGBSurface -- Create an empty SDL_Surface
SDL_CreateRGBSurfaceFrom -- Create an SDL_Surface from pixel data
SDL_FreeSurface -- Frees (deletes) a SDL_Surface
SDL_LockSurface -- Lock a surface for directly access.
SDL_UnlockSurface -- Unlocks a previously locked surface.
SDL_LoadBMP -- Load a Windows BMP file into an SDL_Surface.
SDL_SaveBMP -- Save an SDL_Surface as a Windows BMP file.
SDL_SetColorKey -- Sets the color key (transparent pixel) in a blittable surface and +RLE acceleration.
SDL_SetAlpha -- Adjust the alpha properties of a surface
SDL_SetClipRect -- Sets the clipping rectangle for a surface.
SDL_GetClipRect -- Gets the clipping rectangle for a surface.
SDL_ConvertSurface -- Converts a surface to the same format as another surface.
SDL_BlitSurface -- This performs a fast blit from the source surface to the destination surface.
SDL_FillRect -- This function performs a fast fill of the given rectangle with some color
SDL_DisplayFormat -- Convert a surface to the display format
SDL_DisplayFormatAlpha -- Convert a surface to the display format
SDL_WarpMouse -- Set the position of the mouse cursor.
SDL_CreateCursor -- Creates a new mouse cursor.
SDL_FreeCursor -- Frees a cursor created with SDL_CreateCursor.
SDL_SetCursor -- Set the currently active mouse cursor.
SDL_GetCursor -- Get the currently active mouse cursor.
SDL_ShowCursor -- Toggle whether or not the cursor is shown on the screen.
SDL_GL_LoadLibrary -- Specify an OpenGL library
SDL_GL_GetProcAddress -- Get the address of a GL function
SDL_GL_GetAttribute -- Get the value of a special SDL/OpenGL attribute
SDL_GL_SetAttribute -- Set a special SDL/OpenGL attribute
SDL_GL_SwapBuffers -- Swap OpenGL framebuffers/Update Display
SDL_CreateYUVOverlay -- Create a YUV video overlay
SDL_LockYUVOverlay -- Lock an overlay
SDL_UnlockYUVOverlay -- Unlock an overlay
SDL_DisplayYUVOverlay -- Blit the overlay to the display
SDL_FreeYUVOverlay -- Free a YUV video overlay
SDL_GLattr -- SDL GL Attributes
SDL_Rect -- Defines a rectangular area
SDL_Color -- Format independent color description
SDL_Palette -- Color palette for 8-bit pixel formats
SDL_PixelFormat -- Stores surface format information
SDL_Surface -- Graphical Surface Structure
SDL_VideoInfo -- Video Target information
SDL_Overlay -- YUV video overlay

SDL presents a very simple interface to the display framebuffer. The +framebuffer is represented as an offscreen surface to which you can write +directly. If you want the screen to show what you have written, call the update function which will +guarantee that the desired portion of the screen is updated.

Before you call any of the SDL video functions, you must first call +SDL_Init(SDL_INIT_VIDEO), which initializes the video +and events in the SDL library. Check the return code, which should be +0, to see if there were any errors in starting up.

If you use both sound and video in your application, you need to call +SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO) before opening the +sound device, otherwise under Win32 DirectX, you won't be able to set +full-screen display modes.

After you have initialized the library, you can start up the video display in a +number of ways. The easiest way is to pick a common screen resolution and +depth and just initialize the video, checking for errors. You will probably +get what you want, but SDL may be emulating your requested mode and converting +the display on update. The best way is to +query, for the best +video mode closest to the desired one, and then +convert +your images to that pixel format.

SDL currently supports any bit depth >= 8 bits per pixel. 8 bpp formats are +considered 8-bit palettized modes, while 12, 15, 16, 24, and 32 bits per pixel +are considered "packed pixel" modes, meaning each pixel contains the RGB color +components packed in the bits of the pixel.

After you have initialized your video mode, you can take the surface that was +returned, and write to it like any other framebuffer, calling the update +routine as you go.

When you have finished your video access and are ready to quit your +application, you should call "SDL_Quit()" to shutdown the +video and events.


PrevHomeNext
SDL_envvarsUpSDL_GetVideoSurface
\ No newline at end of file diff --git a/SDL/docs/html/wm.html b/SDL/docs/html/wm.html new file mode 100644 index 0000000..54f4ec4 --- /dev/null +++ b/SDL/docs/html/wm.html @@ -0,0 +1,188 @@ +Window Management
SDL Library Documentation
PrevNext

Chapter 7. Window Management

Table of Contents
SDL_WM_SetCaption -- Sets the window tile and icon name.
SDL_WM_GetCaption -- Gets the window title and icon name.
SDL_WM_SetIcon -- Sets the icon for the display window.
SDL_WM_IconifyWindow -- Iconify/Minimise the window
SDL_WM_ToggleFullScreen -- Toggles fullscreen mode
SDL_WM_GrabInput -- Grabs mouse and keyboard input.

SDL provides a small set of window management functions which allow applications to change their title and toggle from windowed mode to fullscreen (if available)


PrevHomeNext
SDL_OverlayUpSDL_WM_SetCaption
\ No newline at end of file diff --git a/SDL/docs/images/rainbow.gif b/SDL/docs/images/rainbow.gif new file mode 100644 index 0000000000000000000000000000000000000000..07eb184f7e0496747543f459ae6981e5d70c0292 GIT binary patch literal 1715 zcmeIx`&ZL-7zgkvilCyKf<7uJpETp+<={wzd25XO(9Rr*H1L8`1ZJscD3|Gx;b;gu zUY8;caKJ*b1(>ruNrB)7N1S3dO>Ls0BelMy=+{JeqSHUnAJFUf_w&R1eV(Y8$dKS< z|Do<27l#8D7OV`|8E`P*WWdD$!vO07B!Cpq3FsnxmI#oDkcg2;k;qsgLn3F1f+b3p zs92(5iH;?DmKa!KVu_h07M36oqy+f{1q4L|#RR1UWd!8}6$F(8RRlEzbp-VU4FpXD z%>*q38wgqn+6g)cIw_x_e3l~csf$k;KA+(u2&hv)T>=CVb%>}_gdnDNF?EO$q|_>< zb}534Hpr+|h9IXFIc<;+LQqh%f?5;^N@`M4vl2l?4Jv9{s!hcoD(Ul4i>aDqL3qw7vI?eQ2tE2*{4 z*sSGF7aOAMD=rnm`{{RE>nm;h{lf}sxl-zc@VBhf2%lgyvNhaLI>RJ&kI&A$emxg}EM02`vS-8PWRU%@7*vzRj_PKlATQE>CvD|nedvrHHNwWKXUjC~I z4=&dV%a`Vl^nUIt7bfTJM&2_2&|z*Ou3F7o%ni-+T-w>WXH0m&eGM<@8pjQs>zchL z??`RdF1l6MT(GE1Qn6Q1)!kgUq^>)xXh|(sYxj( zji)B3W!#RO{AnF;)|9F#WYEsM?)9 z^|rd)(ch2o-@Um*E977K_^0K9KfA_DL|!YsrDFc08*$PV8-3zs+aCEO>?v63_$1AI z$&tAA%F3Iov**?yU7PC}Up&HNMvr=ZQNDkk{6I{+XycL61HYsgvd@W9D=drLAE6UAd|&R1v`J`q&vA{Sb_569=EeVLL`^QPK#BqzOQ%gLH2 zr_bIYr~S@3Wl^;k`U + +Simple DirectMedia Layer Introduction + + +
+

Simple DirectMedia Layer Introduction

+

+This library is designed to make it easy to write games that run on many +different platforms using the various native high-performance media interfaces, +(for video, audio, etc) and presenting a single source-code level API to +your application. This is a fairly low level API, but using this, completely +portable applications can be written with a great deal of flexibility. +

+An introduction to SDL can be found online at: + + http://www.libsdl.org/intro.php +

+Tutorials on a variety of topics can be found online at: + + http://www.libsdl.org/tutorials.php +

+Documentation in Wiki form can be found online at: + + http://www.libsdl.org/cgi/docwiki.cgi/ +

+Enjoy! +

+    Sam Lantinga + +

+


+

Table of Contents

+ +
diff --git a/SDL/docs/man3/SDLKey.3 b/SDL/docs/man3/SDLKey.3 new file mode 100644 index 0000000..69b4e46 --- /dev/null +++ b/SDL/docs/man3/SDLKey.3 @@ -0,0 +1,161 @@ +.TH "SDLKey" "3" "Wed 11 Oct 2000, 22:28" "SDL" "SDL API Reference" +.SH "NAME" +SDLKey \- SDL Keysym Definitions +.SH "SDL Keysym definitions" +.PP +\fBSDLKey ASCII value Common Name\fR +.nf +\f(CWSDLK_BACKSPACE '\\b' backspace +SDLK_TAB '\\t' tab +SDLK_CLEAR clear +SDLK_RETURN '\\r' return +SDLK_PAUSE pause +SDLK_ESCAPE '^[' escape +SDLK_SPACE ' ' space +SDLK_EXCLAIM '!' exclaim +SDLK_QUOTEDBL '"' quotedbl +SDLK_HASH '#' hash +SDLK_DOLLAR '$' dollar +SDLK_AMPERSAND '&' ampersand +SDLK_QUOTE ''' quote +SDLK_LEFTPAREN '(' left parenthesis +SDLK_RIGHTPAREN ')' right parenthesis +SDLK_ASTERISK '*' asterisk +SDLK_PLUS '+' plus sign +SDLK_COMMA ',' comma +SDLK_MINUS '-' minus sign +SDLK_PERIOD '.' period +SDLK_SLASH '/' forward slash +SDLK_0 '0' 0 +SDLK_1 '1' 1 +SDLK_2 '2' 2 +SDLK_3 '3' 3 +SDLK_4 '4' 4 +SDLK_5 '5' 5 +SDLK_6 '6' 6 +SDLK_7 '7' 7 +SDLK_8 '8' 8 +SDLK_9 '9' 9 +SDLK_COLON ':' colon +SDLK_SEMICOLON ';' semicolon +SDLK_LESS '<' less-than sign +SDLK_EQUALS '=' equals sign +SDLK_GREATER '>' greater-than sign +SDLK_QUESTION '?' question mark +SDLK_AT '@' at +SDLK_LEFTBRACKET '[' left bracket +SDLK_BACKSLASH '\\' backslash +SDLK_RIGHTBRACKET ']' right bracket +SDLK_CARET '^' caret +SDLK_UNDERSCORE '_' underscore +SDLK_BACKQUOTE '`' grave +SDLK_a 'a' a +SDLK_b 'b' b +SDLK_c 'c' c +SDLK_d 'd' d +SDLK_e 'e' e +SDLK_f 'f' f +SDLK_g 'g' g +SDLK_h 'h' h +SDLK_i 'i' i +SDLK_j 'j' j +SDLK_k 'k' k +SDLK_l 'l' l +SDLK_m 'm' m +SDLK_n 'n' n +SDLK_o 'o' o +SDLK_p 'p' p +SDLK_q 'q' q +SDLK_r 'r' r +SDLK_s 's' s +SDLK_t 't' t +SDLK_u 'u' u +SDLK_v 'v' v +SDLK_w 'w' w +SDLK_x 'x' x +SDLK_y 'y' y +SDLK_z 'z' z +SDLK_DELETE '^?' delete +SDLK_KP0 keypad 0 +SDLK_KP1 keypad 1 +SDLK_KP2 keypad 2 +SDLK_KP3 keypad 3 +SDLK_KP4 keypad 4 +SDLK_KP5 keypad 5 +SDLK_KP6 keypad 6 +SDLK_KP7 keypad 7 +SDLK_KP8 keypad 8 +SDLK_KP9 keypad 9 +SDLK_KP_PERIOD '.' keypad period +SDLK_KP_DIVIDE '/' keypad divide +SDLK_KP_MULTIPLY '*' keypad multiply +SDLK_KP_MINUS '-' keypad minus +SDLK_KP_PLUS '+' keypad plus +SDLK_KP_ENTER '\\r' keypad enter +SDLK_KP_EQUALS '=' keypad equals +SDLK_UP up arrow +SDLK_DOWN down arrow +SDLK_RIGHT right arrow +SDLK_LEFT left arrow +SDLK_INSERT insert +SDLK_HOME home +SDLK_END end +SDLK_PAGEUP page up +SDLK_PAGEDOWN page down +SDLK_F1 F1 +SDLK_F2 F2 +SDLK_F3 F3 +SDLK_F4 F4 +SDLK_F5 F5 +SDLK_F6 F6 +SDLK_F7 F7 +SDLK_F8 F8 +SDLK_F9 F9 +SDLK_F10 F10 +SDLK_F11 F11 +SDLK_F12 F12 +SDLK_F13 F13 +SDLK_F14 F14 +SDLK_F15 F15 +SDLK_NUMLOCK numlock +SDLK_CAPSLOCK capslock +SDLK_SCROLLOCK scrollock +SDLK_RSHIFT right shift +SDLK_LSHIFT left shift +SDLK_RCTRL right ctrl +SDLK_LCTRL left ctrl +SDLK_RALT right alt +SDLK_LALT left alt +SDLK_RMETA right meta +SDLK_LMETA left meta +SDLK_LSUPER left windows key +SDLK_RSUPER right windows key +SDLK_MODE mode shift +SDLK_HELP help +SDLK_PRINT print-screen +SDLK_SYSREQ SysRq +SDLK_BREAK break +SDLK_MENU menu +SDLK_POWER power +SDLK_EURO euro\fR +.fi + + +.SH "SDL modifier definitions" +.PP +\fBSDL Modifier Meaning\fR +.nf +\f(CWKMOD_NONE No modifiers applicable +KMOD_NUM Numlock is down +KMOD_CAPS Capslock is down +KMOD_LCTRL Left Control is down +KMOD_RCTRL Right Control is down +KMOD_RSHIFT Right Shift is down +KMOD_LSHIFT Left Shift is down +KMOD_RALT Right Alt is down +KMOD_LALT Left Alt is down +KMOD_CTRL A Control key is down +KMOD_SHIFT A Shift key is down +KMOD_ALT An Alt key is down\fR +.fi + diff --git a/SDL/docs/man3/SDL_ActiveEvent.3 b/SDL/docs/man3/SDL_ActiveEvent.3 new file mode 100644 index 0000000..31797f5 --- /dev/null +++ b/SDL/docs/man3/SDL_ActiveEvent.3 @@ -0,0 +1,38 @@ +.TH "SDL_ActiveEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ActiveEvent \- Application visibility event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 gain; + Uint8 state; +} SDL_ActiveEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_ACTIVEEVENT\&.\fP +.TP 20 +\fBgain\fR +0 if the event is a loss or 1 if it is a gain\&. +.TP 20 +\fBstate\fR +\fBSDL_APPMOUSEFOCUS\fP if mouse focus was gained or lost, \fBSDL_APPINPUTFOCUS\fP if input focus was gained or lost, or \fBSDL_APPACTIVE\fP if the application was iconified (\fBgain\fR=0) or restored(\fBgain\fR=1)\&. +.SH "DESCRIPTION" +.PP +\fBSDL_ActiveEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_ACTIVEEVENT\fP is reported\&. +.PP +When the mouse leaves or enters the window area a \fBSDL_APPMOUSEFOCUS\fP type activation event occurs, if the mouse entered the window then \fBgain\fR will be 1, otherwise \fBgain\fR will be 0\&. A \fBSDL_APPINPUTFOCUS\fP type activation event occurs when the application loses or gains keyboard focus\&. This usually occurs when another application is made active\&. Finally, a \fBSDL_APPACTIVE\fP type event occurs when the application is either minimised/iconified (\fBgain\fR=0) or restored\&. +.PP +.RS +\fBNote: +.PP +This event does not occur when an application window is first created\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_GetAppState\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_AddTimer.3 b/SDL/docs/man3/SDL_AddTimer.3 new file mode 100644 index 0000000..ff03c40 --- /dev/null +++ b/SDL/docs/man3/SDL_AddTimer.3 @@ -0,0 +1,38 @@ +.TH "SDL_AddTimer" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_AddTimer \- Add a timer which will call a callback after the specified number of milliseconds has elapsed\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_TimerID \fBSDL_AddTimer\fP\fR(\fBUint32 interval, SDL_NewTimerCallback callback, void *param\fR); +.SH "CALLBACK" +.PP +.nf +\f(CW/* type definition for the "new" timer callback function */ +typedef Uint32 (*SDL_NewTimerCallback)(Uint32 interval, void *param);\fR +.fi +.PP +.SH "DESCRIPTION" +.PP +Adds a callback function to be run after the specified number of milliseconds has elapsed\&. The callback function is passed the current timer interval and the user supplied parameter from the \fBSDL_AddTimer\fP call and returns the next timer interval\&. If the returned value from the callback is the same as the one passed in, the periodic alarm continues, otherwise a new alarm is scheduled\&. +.PP +To cancel a currently running timer call \fISDL_RemoveTimer\fR with the timer ID returned from \fBSDL_AddTimer\fP\&. +.PP +The timer callback function may run in a different thread than your main program, and so shouldn\&'t call any functions from within itself\&. You may always call \fISDL_PushEvent\fR, however\&. +.PP +The granularity of the timer is platform-dependent, but you should count on it being at least 10 ms as this is the most common number\&. This means that if you request a 16 ms timer, your callback will run approximately 20 ms later on an unloaded system\&. If you wanted to set a flag signaling a frame update at 30 frames per second (every 33 ms), you might set a timer for 30 ms (see example below)\&. If you use this function, you need to pass \fBSDL_INIT_TIMER\fP to \fISDL_Init\fR\&. +.SH "RETURN VALUE" +.PP +Returns an ID value for the added timer or \fBNULL\fR if there was an error\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWmy_timer_id = SDL_AddTimer((33/10)*10, my_callbackfunc, my_callback_param);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_RemoveTimer\fP\fR, \fI\fBSDL_PushEvent\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_AudioCVT.3 b/SDL/docs/man3/SDL_AudioCVT.3 new file mode 100644 index 0000000..f244c97 --- /dev/null +++ b/SDL/docs/man3/SDL_AudioCVT.3 @@ -0,0 +1,68 @@ +.TH "SDL_AudioCVT" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_AudioCVT \- Audio Conversion Structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + int needed; + Uint16 src_format; + Uint16 dest_format; + double rate_incr; + Uint8 *buf; + int len; + int len_cvt; + int len_mult; + double len_ratio; + void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format); + int filter_index; +} SDL_AudioCVT;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBneeded\fR +Set to one if the conversion is possible +.TP 20 +\fBsrc_format\fR +Audio format of the source +.TP 20 +\fBdest_format\fR +Audio format of the destination +.TP 20 +\fBrate_incr\fR +Rate conversion increment +.TP 20 +\fBbuf\fR +Audio buffer +.TP 20 +\fBlen\fR +Length of the original audio buffer in bytes +.TP 20 +\fBlen_cvt\fR +Length of converted audio buffer in bytes (calculated) +.TP 20 +\fBlen_mult\fR +\fBbuf\fR must be \fBlen\fR*\fBlen_mult\fR bytes in size(calculated) +.TP 20 +\fBlen_ratio\fR +Final audio size is \fBlen\fR*\fBlen_ratio\fR +.TP 20 +\fBfilters[10](\&.\&.)\fR +Pointers to functions needed for this conversion +.TP 20 +\fBfilter_index\fR +Current conversion function +.SH "DESCRIPTION" +.PP +The \fBSDL_AudioCVT\fR is used to convert audio data between different formats\&. A \fBSDL_AudioCVT\fR structure is created with the \fI\fBSDL_BuildAudioCVT\fP\fR function, while the actual conversion is done by the \fI\fBSDL_ConvertAudio\fP\fR function\&. +.PP +Many of the fields in the \fBSDL_AudioCVT\fR structure should be considered private and their function will not be discussed here\&. +.IP "\fBUint8 *\fP\fBbuf\fR" 10This points to the audio data that will be used in the conversion\&. It is both the source and the destination, which means the converted audio data overwrites the original data\&. It also means that the converted data may be larger than the original data (if you were converting from 8-bit to 16-bit, for instance), so you must ensure \fBbuf\fR is large enough\&. See below\&. +.IP "\fBint\fP \fBlen\fR" 10This is the length of the original audio data in bytes\&. +.IP "\fBint\fP \fBlen_mult\fR" 10As explained above, the audio buffer needs to be big enough to store the converted data, which may be bigger than the original audio data\&. The length of \fBbuf\fR should be \fBlen\fR*\fBlen_mult\fR\&. +.IP "\fBdouble\fP \fBlen_ratio\fR" 10When you have finished converting your audio data, you need to know how much of your audio buffer is valid\&. \fBlen\fR*\fBlen_ratio\fR is the size of the converted audio data in bytes\&. This is very similar to \fBlen_mult\fR, however when the convert audio data is shorter than the original \fBlen_mult\fR would be 1\&. \fBlen_ratio\fR, on the other hand, would be a fractional number between 0 and 1\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_BuildAudioCVT\fP\fR, \fI\fBSDL_ConvertAudio\fP\fR, \fI\fBSDL_AudioSpec\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_AudioSpec.3 b/SDL/docs/man3/SDL_AudioSpec.3 new file mode 100644 index 0000000..0e0b4d9 --- /dev/null +++ b/SDL/docs/man3/SDL_AudioSpec.3 @@ -0,0 +1,70 @@ +.TH "SDL_AudioSpec" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_AudioSpec \- Audio Specification Structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + int freq; + Uint16 format; + Uint8 channels; + Uint8 silence; + Uint16 samples; + Uint32 size; + void (*callback)(void *userdata, Uint8 *stream, int len); + void *userdata; +} SDL_AudioSpec;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBfreq\fR +Audio frequency in samples per second +.TP 20 +\fBformat\fR +Audio data format +.TP 20 +\fBchannels\fR +Number of channels: 1 mono, 2 stereo +.TP 20 +\fBsilence\fR +Audio buffer silence value (calculated) +.TP 20 +\fBsamples\fR +Audio buffer size in samples +.TP 20 +\fBsize\fR +Audio buffer size in bytes (calculated) +.TP 20 +\fBcallback(\&.\&.)\fR +Callback function for filling the audio buffer +.TP 20 +\fBuserdata\fR +Pointer the user data which is passed to the callback function +.SH "DESCRIPTION" +.PP +The \fBSDL_AudioSpec\fR structure is used to describe the format of some audio data\&. This structure is used by \fI\fBSDL_OpenAudio\fP\fR and \fI\fBSDL_LoadWAV\fP\fR\&. While all fields are used by \fBSDL_OpenAudio\fP only \fBfreq\fR, \fBformat\fR, \fBsamples\fR and \fBchannels\fR are used by \fBSDL_LoadWAV\fP\&. We will detail these common members here\&. +.TP 20 +\fBfreq\fR +The number of samples sent to the sound device every second\&. Common values are 11025, 22050 and 44100\&. The higher the better\&. +.TP 20 +\fBformat\fR +Specifies the size and type of each sample element +.IP "\fBAUDIO_U8\fP" 10Unsigned 8-bit samples +.IP "\fBAUDIO_S8\fP" 10Signed 8-bit samples +.IP "\fBAUDIO_U16\fP or \fBAUDIO_U16LSB\fP" 10Unsigned 16-bit little-endian samples +.IP "\fBAUDIO_S16\fP or \fBAUDIO_S16LSB\fP" 10Signed 16-bit little-endian samples +.IP "\fBAUDIO_U16MSB\fP" 10Unsigned 16-bit big-endian samples +.IP "\fBAUDIO_S16MSB\fP" 10Signed 16-bit big-endian samples +.IP "\fBAUDIO_U16SYS\fP" 10Either \fBAUDIO_U16LSB\fP or \fBAUDIO_U16MSB\fP depending on you systems endianness +.IP "\fBAUDIO_S16SYS\fP" 10Either \fBAUDIO_S16LSB\fP or \fBAUDIO_S16MSB\fP depending on you systems endianness +.TP 20 +\fBchannels\fR +The number of seperate sound channels\&. 1 is mono (single channel), 2 is stereo (dual channel)\&. +.TP 20 +\fBsamples\fR +When used with \fI\fBSDL_OpenAudio\fP\fR this refers to the size of the audio buffer in samples\&. A sample a chunk of audio data of the size specified in \fBformat\fR mulitplied by the number of channels\&. When the \fBSDL_AudioSpec\fR is used with \fI\fBSDL_LoadWAV\fP\fR \fBsamples\fR is set to 4096\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_OpenAudio\fP\fR, \fI\fBSDL_LoadWAV\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_BlitSurface.3 b/SDL/docs/man3/SDL_BlitSurface.3 new file mode 100644 index 0000000..7a54d33 --- /dev/null +++ b/SDL/docs/man3/SDL_BlitSurface.3 @@ -0,0 +1,60 @@ +.TH "SDL_BlitSurface" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_BlitSurface \- This performs a fast blit from the source surface to the destination surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_BlitSurface\fP\fR(\fBSDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect\fR); +.SH "DESCRIPTION" +.PP +This performs a fast blit from the source surface to the destination surface\&. +.PP +Only the position is used in the \fBdstrect\fR (the width and height are ignored)\&. +.PP +If either \fBsrcrect\fR or \fBdstrect\fR are \fBNULL\fP, the entire surface (\fBsrc\fR or \fBdst\fR) is copied\&. +.PP +The final blit rectangle is saved in \fBdstrect\fR after all clipping is performed (\fBsrcrect\fR is not modified)\&. +.PP +The blit function should not be called on a locked surface\&. +.PP +The results of blitting operations vary greatly depending on whether \fBSDL_SRCAPLHA\fP is set or not\&. See \fISDL_SetAlpha\fR for an explaination of how this affects your results\&. Colorkeying and alpha attributes also interact with surface blitting, as the following pseudo-code should hopefully explain\&. +.PP +.nf +\f(CWif (source surface has SDL_SRCALPHA set) { + if (source surface has alpha channel (that is, format->Amask != 0)) + blit using per-pixel alpha, ignoring any colour key + else { + if (source surface has SDL_SRCCOLORKEY set) + blit using the colour key AND the per-surface alpha value + else + blit using the per-surface alpha value + } +} else { + if (source surface has SDL_SRCCOLORKEY set) + blit using the colour key + else + ordinary opaque rectangular blit +}\fR +.fi +.PP +.SH "RETURN VALUE" +.PP +If the blit is successful, it returns \fB0\fR, otherwise it returns \fB-1\fR\&. +.PP +If either of the surfaces were in video memory, and the blit returns \fB-2\fR, the video memory was lost, so it should be reloaded with artwork and re-blitted: +.PP +.nf +\f(CW while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) { + while ( SDL_LockSurface(image)) < 0 ) + Sleep(10); + -- Write image pixels to image->pixels -- + SDL_UnlockSurface(image); + }\fR +.fi +.PP + This happens under DirectX 5\&.0 when the system switches away from your fullscreen application\&. Locking the surface will also fail until you have access to the video memory again\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_LockSurface\fP\fR, \fI\fBSDL_FillRect\fP\fR, \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_Rect\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_BuildAudioCVT.3 b/SDL/docs/man3/SDL_BuildAudioCVT.3 new file mode 100644 index 0000000..6ac193a --- /dev/null +++ b/SDL/docs/man3/SDL_BuildAudioCVT.3 @@ -0,0 +1,23 @@ +.TH "SDL_BuildAudioCVT" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_BuildAudioCVT \- Initializes a SDL_AudioCVT structure for conversion +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_BuildAudioCVT\fP\fR(\fBSDL_AudioCVT *cvt, Uint16 src_format, Uint8 src_channels, int src_rate, Uint16 dst_format, Uint8 dst_channels, int dst_rate\fR); +.SH "DESCRIPTION" +.PP +Before an \fI\fBSDL_AudioCVT\fR\fR structure can be used to convert audio data it must be initialized with source and destination information\&. +.PP +\fBsrc_format\fR and \fBdst_format\fR are the source and destination format of the conversion\&. (For information on audio formats see \fI\fB SDL_AudioSpec\fR\fR)\&. \fBsrc_channels\fR and \fBdst_channels\fR are the number of channels in the source and destination formats\&. Finally, \fBsrc_rate\fR and \fBdst_rate\fR are the frequency or samples-per-second of the source and destination formats\&. Once again, see \fI\fBSDL_AudioSpec\fR\fR\&. +.SH "RETURN VALUES" +.PP +Returns \fB-1\fR if the filter could not be built or 1 if it could\&. +.SH "EXAMPLES" +.PP +See \fI\fBSDL_ConvertAudio\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_ConvertAudio\fP\fR, \fI\fBSDL_AudioCVT\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CD.3 b/SDL/docs/man3/SDL_CD.3 new file mode 100644 index 0000000..6978eac --- /dev/null +++ b/SDL/docs/man3/SDL_CD.3 @@ -0,0 +1,57 @@ +.TH "SDL_CD" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CD \- CDROM Drive Information +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + int id; + CDstatus status; + int numtracks; + int cur_track; + int cur_frame; + SDL_CDtrack track[SDL_MAX_TRACKS+1]; +} SDL_CD;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBid\fR +Private drive identifier +.TP 20 +\fBstatus\fR +Drive \fIstatus\fR +.TP 20 +\fBnumtracks\fR +Number of tracks on the CD +.TP 20 +\fBcur_track\fR +Current track +.TP 20 +\fBcur_frame\fR +Current frame offset within the track +.TP 20 +\fBtrack\fR[SDL_MAX_TRACKS+1] +Array of track descriptions\&. (see \fI\fBSDL_CDtrack\fR\fR) +.SH "DESCRIPTION" +.PP +An \fBSDL_CD\fR structure is returned by \fI\fBSDL_CDOpen\fP\fR\&. It represents an opened CDROM device and stores information on the layout of the tracks on the disc\&. +.PP +A frame is the base data unit of a CD\&. \fBCD_FPS\fP frames is equal to 1 second of music\&. SDL provides two macros for converting between time and frames: \fBFRAMES_TO_MSF(f, M,S,F)\fP and \fBMSF_TO_FRAMES\fP\&. +.SH "EXAMPLES" +.PP +.nf +\f(CWint min, sec, frame; +int frame_offset; + +FRAMES_TO_MSF(cdrom->cur_frame, &min, &sec, &frame); +printf("Current Position: %d minutes, %d seconds, %d frames +", min, sec, frame); + +frame_offset=MSF_TO_FRAMES(min, sec, frame);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDOpen\fP\fR, \fI\fBSDL_CDtrack\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CDClose.3 b/SDL/docs/man3/SDL_CDClose.3 new file mode 100644 index 0000000..7738e1c --- /dev/null +++ b/SDL/docs/man3/SDL_CDClose.3 @@ -0,0 +1,15 @@ +.TH "SDL_CDClose" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDClose \- Closes a SDL_CD handle +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_CDClose\fP\fR(\fBSDL_CD *cdrom\fR); +.SH "DESCRIPTION" +.PP +Closes the given \fBcdrom\fR handle\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDOpen\fP\fR, \fI\fBSDL_CD\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CDEject.3 b/SDL/docs/man3/SDL_CDEject.3 new file mode 100644 index 0000000..83969ab --- /dev/null +++ b/SDL/docs/man3/SDL_CDEject.3 @@ -0,0 +1,18 @@ +.TH "SDL_CDEject" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDEject \- Ejects a CDROM +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDEject\fP\fR(\fBSDL_CD *cdrom\fR); +.SH "DESCRIPTION" +.PP +Ejects the given \fBcdrom\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CD\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CDName.3 b/SDL/docs/man3/SDL_CDName.3 new file mode 100644 index 0000000..d320b3d --- /dev/null +++ b/SDL/docs/man3/SDL_CDName.3 @@ -0,0 +1,23 @@ +.TH "SDL_CDName" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDName \- Returns a human-readable, system-dependent identifier for the CD-ROM\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBconst char *\fBSDL_CDName\fP\fR(\fBint drive\fR); +.SH "DESCRIPTION" +.PP +Returns a human-readable, system-dependent identifier for the CD-ROM\&. \fBdrive\fR is the index of the drive\&. Drive indices start to 0 and end at \fBSDL_CDNumDrives()\fP-1\&. +.SH "EXAMPLES" +.PP +.IP " \(bu" 6 +"/dev/cdrom" +.IP " \(bu" 6 +"E:" +.IP " \(bu" 6 +"/dev/disk/ide/1/master" +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDNumDrives\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CDNumDrives.3 b/SDL/docs/man3/SDL_CDNumDrives.3 new file mode 100644 index 0000000..8458837 --- /dev/null +++ b/SDL/docs/man3/SDL_CDNumDrives.3 @@ -0,0 +1,15 @@ +.TH "SDL_CDNumDrives" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDNumDrives \- Returns the number of CD-ROM drives on the system\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDNumDrives\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +Returns the number of CD-ROM drives on the system\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDOpen\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CDOpen.3 b/SDL/docs/man3/SDL_CDOpen.3 new file mode 100644 index 0000000..8ad2dc8 --- /dev/null +++ b/SDL/docs/man3/SDL_CDOpen.3 @@ -0,0 +1,58 @@ +.TH "SDL_CDOpen" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDOpen \- Opens a CD-ROM drive for access\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_CD *\fBSDL_CDOpen\fP\fR(\fBint drive\fR); +.SH "DESCRIPTION" +.PP +Opens a CD-ROM drive for access\&. It returns a \fI\fBSDL_CD\fR\fR structure on success, or \fBNULL\fP if the drive was invalid or busy\&. This newly opened CD-ROM becomes the default CD used when other CD functions are passed a \fBNULL\fP CD-ROM handle\&. +.PP +Drives are numbered starting with 0\&. Drive 0 is the system default CD-ROM\&. +.SH "EXAMPLES" +.PP +.nf +\f(CWSDL_CD *cdrom; +int cur_track; +int min, sec, frame; +SDL_Init(SDL_INIT_CDROM); +atexit(SDL_Quit); + +/* Check for CD drives */ +if(!SDL_CDNumDrives()){ + /* None found */ + fprintf(stderr, "No CDROM devices available +"); + exit(-1); +} + +/* Open the default drive */ +cdrom=SDL_CDOpen(0); + +/* Did if open? Check if cdrom is NULL */ +if(!cdrom){ + fprintf(stderr, "Couldn\&'t open drive: %s +", SDL_GetError()); + exit(-1); +} + +/* Print Volume info */ +printf("Name: %s +", SDL_CDName(0)); +printf("Tracks: %d +", cdrom->numtracks); +for(cur_track=0;cur_track < cdrom->numtracks; cur_track++){ + FRAMES_TO_MSF(cdrom->track[cur_track]\&.length, &min, &sec, &frame); + printf(" Track %d: Length %d:%d +", cur_track, min, sec); +} + +SDL_CDClose(cdrom);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CD\fR\fR, \fI\fBSDL_CDtrack\fR\fR, \fI\fBSDL_CDClose\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CDPause.3 b/SDL/docs/man3/SDL_CDPause.3 new file mode 100644 index 0000000..c504c6b --- /dev/null +++ b/SDL/docs/man3/SDL_CDPause.3 @@ -0,0 +1,18 @@ +.TH "SDL_CDPause" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDPause \- Pauses a CDROM +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDPause\fP\fR(\fBSDL_CD *cdrom\fR); +.SH "DESCRIPTION" +.PP +Pauses play on the given \fBcdrom\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDPlay\fP\fR, \fI\fBSDL_CDResume\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CDPlay.3 b/SDL/docs/man3/SDL_CDPlay.3 new file mode 100644 index 0000000..4e9303f --- /dev/null +++ b/SDL/docs/man3/SDL_CDPlay.3 @@ -0,0 +1,18 @@ +.TH "SDL_CDPlay" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDPlay \- Play a CD +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDPlay\fP\fR(\fBSDL_CD *cdrom, int start, int length\fR); +.SH "DESCRIPTION" +.PP +Plays the given \fBcdrom\fR, starting a frame \fBstart\fR for \fBlength\fR frames\&. +.SH "RETURN VALUES" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDPlayTracks\fP\fR, \fI\fBSDL_CDStop\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CDPlayTracks.3 b/SDL/docs/man3/SDL_CDPlayTracks.3 new file mode 100644 index 0000000..f33b93a --- /dev/null +++ b/SDL/docs/man3/SDL_CDPlayTracks.3 @@ -0,0 +1,47 @@ +.TH "SDL_CDPlayTracks" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDPlayTracks \- Play the given CD track(s) +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDPlayTracks\fP\fR(\fBSDL_CD *cdrom, int start_track, int start_frame, int ntracks, int nframes)\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_CDPlayTracks\fP plays the given CD starting at track \fBstart_track\fR, for \fBntracks\fR tracks\&. +.PP +\fBstart_frame\fR is the frame offset, from the beginning of the \fBstart_track\fR, at which to start\&. \fBnframes\fR is the frame offset, from the beginning of the last track (\fBstart_track\fR+\fBntracks\fR), at which to end playing\&. +.PP +\fBSDL_CDPlayTracks\fP should only be called after calling \fI\fBSDL_CDStatus\fP\fR to get track information about the CD\&. +.PP +.RS +\fBNote: +.PP +Data tracks are ignored\&. +.RE +.SH "RETURN VALUE" +.PP +Returns \fB0\fR, or \fB-1\fR if there was an error\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CW/* assuming cdrom is a previously opened device */ +/* Play the entire CD */ +if(CD_INDRIVE(SDL_CDStatus(cdrom))) + SDL_CDPlayTracks(cdrom, 0, 0, 0, 0); + +/* Play the first track */ +if(CD_INDRIVE(SDL_CDStatus(cdrom))) + SDL_CDPlayTracks(cdrom, 0, 0, 1, 0); + +/* Play first 15 seconds of the 2nd track */ +if(CD_INDRIVE(SDL_CDStatus(cdrom))) + SDL_CDPlayTracks(cdrom, 1, 0, 0, CD_FPS*15);\fR +.fi +.PP + +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDPlay\fP\fR, \fI\fBSDL_CDStatus\fP\fR, \fI\fBSDL_CD\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CDResume.3 b/SDL/docs/man3/SDL_CDResume.3 new file mode 100644 index 0000000..2f8ebdf --- /dev/null +++ b/SDL/docs/man3/SDL_CDResume.3 @@ -0,0 +1,18 @@ +.TH "SDL_CDResume" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDResume \- Resumes a CDROM +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDResume\fP\fR(\fBSDL_CD *cdrom\fR); +.SH "DESCRIPTION" +.PP +Resumes play on the given \fBcdrom\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDPlay\fP\fR, \fI\fBSDL_CDPause\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CDStatus.3 b/SDL/docs/man3/SDL_CDStatus.3 new file mode 100644 index 0000000..c98c547 --- /dev/null +++ b/SDL/docs/man3/SDL_CDStatus.3 @@ -0,0 +1,59 @@ +.TH "SDL_CDStatus" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDStatus \- Returns the current status of the given drive\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBCDstatus \fBSDL_CDStatus\fP\fR(\fBSDL_CD *cdrom\fR); +\fB/* Given a status, returns true if there\&'s a disk in the drive */ +#define CD_INDRIVE(status) ((int)status > 0) +.SH "DESCRIPTION" +.PP +This function returns the current status of the given drive\&. Status is described like so: +.PP +.nf +\f(CWtypedef enum { + CD_TRAYEMPTY, + CD_STOPPED, + CD_PLAYING, + CD_PAUSED, + CD_ERROR = -1 +} CDstatus;\fR +.fi +.PP +.PP +If the drive has a CD in it, the table of contents of the CD and current play position of the CD will be stored in the SDL_CD structure\&. +.PP +The macro \fBCD_INDRIVE\fP is provided for convenience, and given a status returns true if there\&'s a disk in the drive\&. +.PP +.RS +\fBNote: +.PP +\fBSDL_CDStatus\fP also updates the \fI\fBSDL_CD\fR\fR structure passed to it\&. +.RE +.SH "EXAMPLE" +.PP +.nf +\f(CWint playTrack(int track) +{ + int playing = 0; + + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) { + /* clamp to the actual number of tracks on the CD */ + if (track >= cdrom->numtracks) { + track = cdrom->numtracks-1; + } + + if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) { + playing = 1; + } + } + return playing; +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CD\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_CDStop.3 b/SDL/docs/man3/SDL_CDStop.3 new file mode 100644 index 0000000..a80db81 --- /dev/null +++ b/SDL/docs/man3/SDL_CDStop.3 @@ -0,0 +1,18 @@ +.TH "SDL_CDStop" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDStop \- Stops a CDROM +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDStop\fP\fR(\fBSDL_CD *cdrom\fR); +.SH "DESCRIPTION" +.PP +Stops play on the given \fBcdrom\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDPlay\fP\fR, +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_CDtrack.3 b/SDL/docs/man3/SDL_CDtrack.3 new file mode 100644 index 0000000..462512e --- /dev/null +++ b/SDL/docs/man3/SDL_CDtrack.3 @@ -0,0 +1,40 @@ +.TH "SDL_CDtrack" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDtrack \- CD Track Information Structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 id; + Uint8 type; + Uint32 length; + Uint32 offset; +} SDL_CDtrack;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBid\fR +Track number (0-99) +.TP 20 +\fBtype\fR +\fBSDL_AUDIO_TRACK\fP or \fBSDL_DATA_TRACK\fP +.TP 20 +\fBlength\fR +Length, in frames, of this track +.TP 20 +\fBoffset\fR +Frame offset to the beginning of this track +.SH "DESCRIPTION" +.PP +\fBSDL_CDtrack\fR stores data on each track on a CD, its fields should be pretty self explainatory\&. It is a member a the \fI\fBSDL_CD\fR\fR structure\&. +.PP +.RS +\fBNote: +.PP +Frames can be converted to standard timings\&. There are \fBCD_FPS\fP frames per second, so \fBSDL_CDtrack\fR\&.\fBlength\fR/\fBCD_FPS\fP=length_in_seconds\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_CD\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_CloseAudio.3 b/SDL/docs/man3/SDL_CloseAudio.3 new file mode 100644 index 0000000..119f421 --- /dev/null +++ b/SDL/docs/man3/SDL_CloseAudio.3 @@ -0,0 +1,15 @@ +.TH "SDL_CloseAudio" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CloseAudio \- Shuts down audio processing and closes the audio device\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_CloseAudio\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +This function shuts down audio processing and closes the audio device\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_OpenAudio\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_Color.3 b/SDL/docs/man3/SDL_Color.3 new file mode 100644 index 0000000..f5877b9 --- /dev/null +++ b/SDL/docs/man3/SDL_Color.3 @@ -0,0 +1,34 @@ +.TH "SDL_Color" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Color \- Format independent color description +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 r; + Uint8 g; + Uint8 b; + Uint8 unused; +} SDL_Color;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBr\fR +Red intensity +.TP 20 +\fBg\fR +Green intensity +.TP 20 +\fBb\fR +Blue intensity +.TP 20 +\fBunused\fR +Unused +.SH "DESCRIPTION" +.PP +\fBSDL_Color\fR describes a color in a format independent way\&. You can convert a \fBSDL_Color\fR to a pixel value for a certain pixel format using \fI\fBSDL_MapRGB\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_PixelFormat\fR\fR, \fI\fBSDL_SetColors\fP\fR, \fI\fBSDL_Palette\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_CondBroadcast.3 b/SDL/docs/man3/SDL_CondBroadcast.3 new file mode 100644 index 0000000..0e1643d --- /dev/null +++ b/SDL/docs/man3/SDL_CondBroadcast.3 @@ -0,0 +1,16 @@ +.TH "SDL_CondBroadcast" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CondBroadcast \- Restart all threads waiting on a condition variable +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_CondBroadcast\fP\fR(\fBSDL_cond *cond\fR); +.SH "DESCRIPTION" +.PP +Restarts all threads that are waiting on the condition variable, \fBcond\fR\&. Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CondSignal\fP\fR, \fI\fBSDL_CondWait\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_CondSignal.3 b/SDL/docs/man3/SDL_CondSignal.3 new file mode 100644 index 0000000..e4b0723 --- /dev/null +++ b/SDL/docs/man3/SDL_CondSignal.3 @@ -0,0 +1,16 @@ +.TH "SDL_CondSignal" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CondSignal \- Restart a thread wait on a condition variable +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_CondSignal\fP\fR(\fBSDL_cond *cond\fR); +.SH "DESCRIPTION" +.PP +Restart one of the threads that are waiting on the condition variable, \fBcond\fR\&. Returns \fB0\fR on success of \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CondWait\fP\fR, \fI\fBSDL_CondBroadcast\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_CondWait.3 b/SDL/docs/man3/SDL_CondWait.3 new file mode 100644 index 0000000..bf01b54 --- /dev/null +++ b/SDL/docs/man3/SDL_CondWait.3 @@ -0,0 +1,16 @@ +.TH "SDL_CondWait" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CondWait \- Wait on a condition variable +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_CondWait\fP\fR(\fBSDL_cond *cond, SDL_mutex *mut\fR); +.SH "DESCRIPTION" +.PP +Wait on the condition variable \fBcond\fR and unlock the provided mutex\&. The mutex must the locked before entering this function\&. Returns \fB0\fR when it is signalled, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CondWaitTimeout\fP\fR, \fI\fBSDL_CondSignal\fP\fR, \fI\fBSDL_mutexP\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_CondWaitTimeout.3 b/SDL/docs/man3/SDL_CondWaitTimeout.3 new file mode 100644 index 0000000..9720a30 --- /dev/null +++ b/SDL/docs/man3/SDL_CondWaitTimeout.3 @@ -0,0 +1,16 @@ +.TH "SDL_CondWaitTimeout" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CondWaitTimeout \- Wait on a condition variable, with timeout +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_CondWaitTimeout\fP\fR(\fBSDL_cond *cond, SDL_mutex *mutex, Uint32 ms\fR); +.SH "DESCRIPTION" +.PP +Wait on the condition variable \fBcond\fR for, at most, \fBms\fR milliseconds\&. \fBmut\fR is unlocked so it must be locked when the function is called\&. Returns \fBSDL_MUTEX_TIMEDOUT\fP if the condition is not signalled in the allotted time, \fB0\fR if it was signalled or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CondWait\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_ConvertAudio.3 b/SDL/docs/man3/SDL_ConvertAudio.3 new file mode 100644 index 0000000..d22237f --- /dev/null +++ b/SDL/docs/man3/SDL_ConvertAudio.3 @@ -0,0 +1,95 @@ +.TH "SDL_ConvertAudio" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ConvertAudio \- Convert audio data to a desired audio format\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_ConvertAudio\fP\fR(\fBSDL_AudioCVT *cvt\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_ConvertAudio\fP takes one parameter, \fBcvt\fR, which was previously initilized\&. Initilizing a \fI\fBSDL_AudioCVT\fR\fR is a two step process\&. First of all, the structure must be passed to \fI\fBSDL_BuildAudioCVT\fP\fR along with source and destination format parameters\&. Secondly, the \fBcvt\fR->\fBbuf\fR and \fBcvt\fR->\fBlen\fR fields must be setup\&. \fBcvt\fR->\fBbuf\fR should point to the audio data and \fBcvt\fR->\fBlen\fR should be set to the length of the audio data in bytes\&. Remember, the length of the buffer pointed to by \fBbuf\fR show be \fBlen\fR*\fBlen_mult\fR bytes in length\&. +.PP +Once the \fBSDL_AudioCVT\fRstructure is initilized then we can pass it to \fBSDL_ConvertAudio\fP, which will convert the audio data pointer to by \fBcvt\fR->\fBbuf\fR\&. If \fBSDL_ConvertAudio\fP returned \fB0\fR then the conversion was completed successfully, otherwise \fB-1\fR is returned\&. +.PP +If the conversion completed successfully then the converted audio data can be read from \fBcvt\fR->\fBbuf\fR\&. The amount of valid, converted, audio data in the buffer is equal to \fBcvt\fR->\fBlen\fR*\fBcvt\fR->\fBlen_ratio\fR\&. +.SH "EXAMPLES" +.PP +.nf +\f(CW/* Converting some WAV data to hardware format */ +void my_audio_callback(void *userdata, Uint8 *stream, int len); + +SDL_AudioSpec *desired, *obtained; +SDL_AudioSpec wav_spec; +SDL_AudioCVT wav_cvt; +Uint32 wav_len; +Uint8 *wav_buf; +int ret; + +/* Allocated audio specs */ +desired=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec)); +obtained=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec)); + +/* Set desired format */ +desired->freq=22050; +desired->format=AUDIO_S16LSB; +desired->samples=8192; +desired->callback=my_audio_callback; +desired->userdata=NULL; + +/* Open the audio device */ +if ( SDL_OpenAudio(desired, obtained) < 0 ){ + fprintf(stderr, "Couldn\&'t open audio: %s +", SDL_GetError()); + exit(-1); +} + +free(desired); + +/* Load the test\&.wav */ +if( SDL_LoadWAV("test\&.wav", &wav_spec, &wav_buf, &wav_len) == NULL ){ + fprintf(stderr, "Could not open test\&.wav: %s +", SDL_GetError()); + SDL_CloseAudio(); + free(obtained); + exit(-1); +} + +/* Build AudioCVT */ +ret = SDL_BuildAudioCVT(&wav_cvt, + wav_spec\&.format, wav_spec\&.channels, wav_spec\&.freq, + obtained->format, obtained->channels, obtained->freq); + +/* Check that the convert was built */ +if(ret==-1){ + fprintf(stderr, "Couldn\&'t build converter! +"); + SDL_CloseAudio(); + free(obtained); + SDL_FreeWAV(wav_buf); +} + +/* Setup for conversion */ +wav_cvt\&.buf=(Uint8 *)malloc(wav_len*wav_cvt\&.len_mult); +wav_cvt\&.len=wav_len; +memcpy(wav_cvt\&.buf, wav_buf, wav_len); + +/* We can delete to original WAV data now */ +SDL_FreeWAV(wav_buf); + +/* And now we\&'re ready to convert */ +SDL_ConvertAudio(&wav_cvt); + +/* do whatever */ +\&. +\&. +\&. +\&. + +\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_BuildAudioCVT\fP\fR, \fI\fBSDL_AudioCVT\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_ConvertSurface.3 b/SDL/docs/man3/SDL_ConvertSurface.3 new file mode 100644 index 0000000..ab870b1 --- /dev/null +++ b/SDL/docs/man3/SDL_ConvertSurface.3 @@ -0,0 +1,24 @@ +.TH "SDL_ConvertSurface" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ConvertSurface \- Converts a surface to the same format as another surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL/SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_ConvertSurface\fP\fR(\fBSDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags\fR); +.SH "DESCRIPTION" +.PP +Creates a new surface of the specified format, and then copies and maps the given surface to it\&. If this function fails, it returns \fBNULL\fP\&. +.PP +The \fBflags\fR parameter is passed to \fI\fBSDL_CreateRGBSurface\fP\fR and has those semantics\&. +.PP +This function is used internally by \fI\fBSDL_DisplayFormat\fP\fR\&. +.PP +This function can only be called after SDL_Init\&. +.SH "RETURN VALUE" +.PP +Returns either a pointer to the new surface, or \fBNULL\fP on error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateRGBSurface\fP\fR, \fI\fBSDL_DisplayFormat\fP\fR, \fI\fBSDL_PixelFormat\fR\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_CreateCond.3 b/SDL/docs/man3/SDL_CreateCond.3 new file mode 100644 index 0000000..f5eda23 --- /dev/null +++ b/SDL/docs/man3/SDL_CreateCond.3 @@ -0,0 +1,31 @@ +.TH "SDL_CreateCond" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateCond \- Create a condition variable +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBSDL_cond *\fBSDL_CreateCond\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Creates a condition variable\&. +.SH "EXAMPLES" +.PP +.nf +\f(CWSDL_cond *cond; + +cond=SDL_CreateCond(); +\&. +\&. +/* Do stuff */ + +\&. +\&. +SDL_DestroyCond(cond);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_DestroyCond\fP\fR, \fI\fBSDL_CondWait\fP\fR, \fI\fBSDL_CondSignal\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_CreateCursor.3 b/SDL/docs/man3/SDL_CreateCursor.3 new file mode 100644 index 0000000..842bcf0 --- /dev/null +++ b/SDL/docs/man3/SDL_CreateCursor.3 @@ -0,0 +1,120 @@ +.TH "SDL_CreateCursor" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateCursor \- Creates a new mouse cursor\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Cursor *\fBSDL_CreateCursor\fP\fR(\fBUint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y\fR); +.SH "DESCRIPTION" +.PP +Create a cursor using the specified \fBdata\fR and \fBmask\fR (in MSB format)\&. The cursor width must be a multiple of 8 bits\&. +.PP +The cursor is created in black and white according to the following: +.TP 20 +\fBData / Mask\fR +\fBResulting pixel on screen\fR +.TP 20 +0 / 1 +White +.TP 20 +1 / 1 +Black +.TP 20 +0 / 0 +Transparent +.TP 20 +1 / 0 +Inverted color if possible, black if not\&. +.PP +Cursors created with this function must be freed with \fISDL_FreeCursor\fR\&. +.SH "EXAMPLE" +.PP +.nf +\f(CW/* Stolen from the mailing list */ +/* Creates a new mouse cursor from an XPM */ + + +/* XPM */ +static const char *arrow[] = { + /* width height num_colors chars_per_pixel */ + " 32 32 3 1", + /* colors */ + "X c #000000", + "\&. c #ffffff", + " c None", + /* pixels */ + "X ", + "XX ", + "X\&.X ", + "X\&.\&.X ", + "X\&.\&.\&.X ", + "X\&.\&.\&.\&.X ", + "X\&.\&.\&.\&.\&.X ", + "X\&.\&.\&.\&.\&.\&.X ", + "X\&.\&.\&.\&.\&.\&.\&.X ", + "X\&.\&.\&.\&.\&.\&.\&.\&.X ", + "X\&.\&.\&.\&.\&.XXXXX ", + "X\&.\&.X\&.\&.X ", + "X\&.X X\&.\&.X ", + "XX X\&.\&.X ", + "X X\&.\&.X ", + " X\&.\&.X ", + " X\&.\&.X ", + " X\&.\&.X ", + " XX ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "0,0" +}; + +static SDL_Cursor *init_system_cursor(const char *image[]) +{ + int i, row, col; + Uint8 data[4*32]; + Uint8 mask[4*32]; + int hot_x, hot_y; + + i = -1; + for ( row=0; row<32; ++row ) { + for ( col=0; col<32; ++col ) { + if ( col % 8 ) { + data[i] <<= 1; + mask[i] <<= 1; + } else { + ++i; + data[i] = mask[i] = 0; + } + switch (image[4+row][col]) { + case \&'X\&': + data[i] |= 0x01; + k[i] |= 0x01; + break; + case \&'\&.\&': + mask[i] |= 0x01; + break; + case \&' \&': + break; + } + } + } + sscanf(image[4+row], "%d,%d", &hot_x, &hot_y); + return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y); +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_FreeCursor\fP\fR, \fI\fBSDL_SetCursor\fP\fR, \fI\fBSDL_ShowCursor\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_CreateMutex.3 b/SDL/docs/man3/SDL_CreateMutex.3 new file mode 100644 index 0000000..85f5498 --- /dev/null +++ b/SDL/docs/man3/SDL_CreateMutex.3 @@ -0,0 +1,43 @@ +.TH "SDL_CreateMutex" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateMutex \- Create a mutex +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBSDL_mutex *\fBSDL_CreateMutex\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Create a new, unlocked mutex\&. +.SH "EXAMPLES" +.PP +.nf +\f(CWSDL_mutex *mut; + +mut=SDL_CreateMutex(); +\&. +\&. +if(SDL_mutexP(mut)==-1){ + fprintf(stderr, "Couldn\&'t lock mutex +"); + exit(-1); +} +\&. +/* Do stuff while mutex is locked */ +\&. +\&. +if(SDL_mutexV(mut)==-1){ + fprintf(stderr, "Couldn\&'t unlock mutex +"); + exit(-1); +} + +SDL_DestroyMutex(mut); +\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_mutexP\fP\fR, \fI\fBSDL_mutexV\fP\fR, \fI\fBSDL_DestroyMutex\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_CreateRGBSurface.3 b/SDL/docs/man3/SDL_CreateRGBSurface.3 new file mode 100644 index 0000000..5639745 --- /dev/null +++ b/SDL/docs/man3/SDL_CreateRGBSurface.3 @@ -0,0 +1,69 @@ +.TH "SDL_CreateRGBSurface" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateRGBSurface \- Create an empty SDL_Surface +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_CreateRGBSurface\fP\fR(\fBUint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask\fR); +.SH "DESCRIPTION" +.PP +Allocate an empty surface (must be called after \fISDL_SetVideoMode\fR) +.PP +If \fBdepth\fR is 8 bits an empty palette is allocated for the surface, otherwise a \&'packed-pixel\&' \fI\fBSDL_PixelFormat\fR\fR is created using the \fB[RGBA]mask\fR\&'s provided (see \fI\fBSDL_PixelFormat\fR\fR)\&. The \fBflags\fR specifies the type of surface that should be created, it is an OR\&'d combination of the following possible values\&. +.TP 20 +\fBSDL_SWSURFACE\fP +SDL will create the surface in system memory\&. This improves the performance of pixel level access, however you may not be able to take advantage of some types of hardware blitting\&. +.TP 20 +\fBSDL_HWSURFACE\fP +SDL will attempt to create the surface in video memory\&. This will allow SDL to take advantage of Video->Video blits (which are often accelerated)\&. +.TP 20 +\fBSDL_SRCCOLORKEY\fP +This flag turns on colourkeying for blits from this surface\&. If \fBSDL_HWSURFACE\fP is also specified and colourkeyed blits are hardware-accelerated, then SDL will attempt to place the surface in video memory\&. Use \fI\fBSDL_SetColorKey\fP\fR to set or clear this flag after surface creation\&. +.TP 20 +\fBSDL_SRCALPHA\fP +This flag turns on alpha-blending for blits from this surface\&. If \fBSDL_HWSURFACE\fP is also specified and alpha-blending blits are hardware-accelerated, then the surface will be placed in video memory if possible\&. Use \fI\fBSDL_SetAlpha\fP\fR to set or clear this flag after surface creation\&. +.PP +.RS +\fBNote: +.PP +If an alpha-channel is specified (that is, if \fBAmask\fR is nonzero), then the \fBSDL_SRCALPHA\fP flag is automatically set\&. You may remove this flag by calling \fI\fBSDL_SetAlpha\fP\fR after surface creation\&. +.RE +.SH "RETURN VALUE" +.PP +Returns the created surface, or \fBNULL\fR upon error\&. +.SH "EXAMPLE" +.PP +.nf +\f(CW /* Create a 32-bit surface with the bytes of each pixel in R,G,B,A order, + as expected by OpenGL for textures */ + SDL_Surface *surface; + Uint32 rmask, gmask, bmask, amask; + + /* SDL interprets each pixel as a 32-bit number, so our masks must depend + on the endianness (byte order) of the machine */ +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + rmask = 0xff000000; + gmask = 0x00ff0000; + bmask = 0x0000ff00; + amask = 0x000000ff; +#else + rmask = 0x000000ff; + gmask = 0x0000ff00; + bmask = 0x00ff0000; + amask = 0xff000000; +#endif + + surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, + rmask, gmask, bmask, amask); + if(surface == NULL) { + fprintf(stderr, "CreateRGBSurface failed: %s +", SDL_GetError()); + exit(1); + }\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateRGBSurfaceFrom\fP\fR, \fI\fBSDL_FreeSurface\fP\fR, \fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_LockSurface\fP\fR, \fI\fBSDL_PixelFormat\fR\fR, \fI\fBSDL_Surface\fR\fR \fI\fBSDL_SetAlpha\fP\fR \fI\fBSDL_SetColorKey\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_CreateRGBSurfaceFrom.3 b/SDL/docs/man3/SDL_CreateRGBSurfaceFrom.3 new file mode 100644 index 0000000..f4e45e1 --- /dev/null +++ b/SDL/docs/man3/SDL_CreateRGBSurfaceFrom.3 @@ -0,0 +1,22 @@ +.TH "SDL_CreateRGBSurfaceFrom" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateRGBSurfaceFrom \- Create an SDL_Surface from pixel data +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_CreateRGBSurfaceFrom\fP\fR(\fBvoid *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask\fR); +.SH "DESCRIPTION" +.PP +Creates an SDL_Surface from the provided pixel data\&. +.PP +The data stored in \fBpixels\fR is assumed to be of the \fBdepth\fR specified in the parameter list\&. The pixel data is not copied into the \fBSDL_Surface\fR structure so it should not be freed until the surface has been freed with a called to \fISDL_FreeSurface\fR\&. \fBpitch\fR is the length of each scanline in bytes\&. +.PP +See \fI\fBSDL_CreateRGBSurface\fP\fR for a more detailed description of the other parameters\&. +.SH "RETURN VALUE" +.PP +Returns the created surface, or \fBNULL\fR upon error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateRGBSurface\fP\fR, \fI\fBSDL_FreeSurface\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_CreateSemaphore.3 b/SDL/docs/man3/SDL_CreateSemaphore.3 new file mode 100644 index 0000000..b0d03c1 --- /dev/null +++ b/SDL/docs/man3/SDL_CreateSemaphore.3 @@ -0,0 +1,32 @@ +.TH "SDL_CreateSemaphore" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateSemaphore \- Creates a new semaphore and assigns an initial value to it\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBSDL_sem *\fBSDL_CreateSemaphore\fP\fR(\fBUint32 initial_value\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_CreateSemaphore()\fP creates a new semaphore and initializes it with the value \fBinitial_value\fR\&. Each locking operation on the semaphore by \fISDL_SemWait\fR, \fISDL_SemTryWait\fR or \fISDL_SemWaitTimeout\fR will atomically decrement the semaphore value\&. The locking operation will be blocked if the semaphore value is not positive (greater than zero)\&. Each unlock operation by \fISDL_SemPost\fR will atomically increment the semaphore value\&. +.SH "RETURN VALUE" +.PP +Returns a pointer to an initialized semaphore or \fBNULL\fR if there was an error\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_sem *my_sem; + +my_sem = SDL_CreateSemaphore(INITIAL_SEM_VALUE); + +if (my_sem == NULL) { + return CREATE_SEM_FAILED; +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemPost\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_CreateThread.3 b/SDL/docs/man3/SDL_CreateThread.3 new file mode 100644 index 0000000..64003e1 --- /dev/null +++ b/SDL/docs/man3/SDL_CreateThread.3 @@ -0,0 +1,16 @@ +.TH "SDL_CreateThread" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateThread \- Creates a new thread of execution that shares its parent\&'s properties\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBSDL_Thread *\fBSDL_CreateThread\fP\fR(\fBint (*fn)(void *), void *data\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_CreateThread\fP creates a new thread of execution that shares all of its parent\&'s global memory, signal handlers, file descriptors, etc, and runs the function \fBfn\fR passed the void pointer \fBdata\fR The thread quits when this function returns\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_KillThread\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_CreateYUVOverlay.3 b/SDL/docs/man3/SDL_CreateYUVOverlay.3 new file mode 100644 index 0000000..0620674 --- /dev/null +++ b/SDL/docs/man3/SDL_CreateYUVOverlay.3 @@ -0,0 +1,17 @@ +.TH "SDL_CreateYUVOverlay" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateYUVOverlay \- Create a YUV video overlay +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Overlay *\fBSDL_CreateYUVOverlay\fP\fR(\fBint width, int height, Uint32 format, SDL_Surface *display\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_CreateYUVOverlay\fP creates a YUV overlay of the specified \fBwidth\fR, \fBheight\fR and \fBformat\fR (see \fI\fBSDL_Overlay\fR\fR for a list of available formats), for the provided \fBdisplay\fR\&. A \fI\fBSDL_Overlay\fR\fR structure is returned\&. +.PP +The term \&'overlay\&' is a misnomer since, unless the overlay is created in hardware, the contents for the display surface underneath the area where the overlay is shown will be overwritten when the overlay is displayed\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Overlay\fR\fR, \fI\fBSDL_DisplayYUVOverlay\fP\fR, \fI\fBSDL_FreeYUVOverlay\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_Delay.3 b/SDL/docs/man3/SDL_Delay.3 new file mode 100644 index 0000000..b248367 --- /dev/null +++ b/SDL/docs/man3/SDL_Delay.3 @@ -0,0 +1,21 @@ +.TH "SDL_Delay" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Delay \- Wait a specified number of milliseconds before returning\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_Delay\fP\fR(\fBUint32 ms\fR); +.SH "DESCRIPTION" +.PP +Wait a specified number of milliseconds before returning\&. \fBSDL_Delay\fP will wait at \fIleast\fP the specified time, but possible longer due to OS scheduling\&. +.PP +.RS +\fBNote: +.PP +Count on a delay granularity of \fIat least\fP 10 ms\&. Some platforms have shorter clock ticks but this is the most common\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_AddTimer\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_DestroyCond.3 b/SDL/docs/man3/SDL_DestroyCond.3 new file mode 100644 index 0000000..6d89404 --- /dev/null +++ b/SDL/docs/man3/SDL_DestroyCond.3 @@ -0,0 +1,16 @@ +.TH "SDL_DestroyCond" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DestroyCond \- Destroy a condition variable +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBvoid \fBSDL_DestroyCond\fP\fR(\fBSDL_cond *cond\fR); +.SH "DESCRIPTION" +.PP +Destroys a condition variable\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateCond\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_DestroyMutex.3 b/SDL/docs/man3/SDL_DestroyMutex.3 new file mode 100644 index 0000000..6f11528 --- /dev/null +++ b/SDL/docs/man3/SDL_DestroyMutex.3 @@ -0,0 +1,16 @@ +.TH "SDL_DestroyMutex" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DestroyMutex \- Destroy a mutex +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBvoid \fBSDL_DestroyMutex\fP\fR(\fBSDL_mutex *mutex\fR); +.SH "DESCRIPTION" +.PP +Destroy a previously \fIcreated\fR mutex\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateMutex\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_DestroySemaphore.3 b/SDL/docs/man3/SDL_DestroySemaphore.3 new file mode 100644 index 0000000..1987d32 --- /dev/null +++ b/SDL/docs/man3/SDL_DestroySemaphore.3 @@ -0,0 +1,26 @@ +.TH "SDL_DestroySemaphore" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DestroySemaphore \- Destroys a semaphore that was created by \fISDL_CreateSemaphore\fR\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBvoid \fBSDL_DestroySemaphore\fP\fR(\fBSDL_sem *sem\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_DestroySemaphore\fP destroys the semaphore pointed to by \fBsem\fR that was created by \fI\fBSDL_CreateSemaphore\fP\fR\&. It is not safe to destroy a semaphore if there are threads currently blocked waiting on it\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWif (my_sem != NULL) { + SDL_DestroySemaphore(my_sem); + my_sem = NULL; +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemPost\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_DisplayFormat.3 b/SDL/docs/man3/SDL_DisplayFormat.3 new file mode 100644 index 0000000..a6208d6 --- /dev/null +++ b/SDL/docs/man3/SDL_DisplayFormat.3 @@ -0,0 +1,22 @@ +.TH "SDL_DisplayFormat" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DisplayFormat \- Convert a surface to the display format +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_DisplayFormat\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +This function takes a surface and copies it to a new surface of the pixel format and colors of the video framebuffer, suitable for fast blitting onto the display surface\&. It calls \fISDL_ConvertSurface\fR +.PP +If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and alpha value before calling this function\&. +.PP +If you want an alpha channel, see \fISDL_DisplayFormatAlpha\fR\&. +.SH "RETURN VALUE" +.PP +If the conversion fails or runs out of memory, it returns \fBNULL\fR +.SH "SEE ALSO" +.PP +\fI\fBSDL_ConvertSurface\fP\fR, \fI\fBSDL_DisplayFormatAlpha\fP\fR \fI\fBSDL_SetAlpha\fP\fR, \fI\fBSDL_SetColorKey\fP\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_DisplayFormatAlpha.3 b/SDL/docs/man3/SDL_DisplayFormatAlpha.3 new file mode 100644 index 0000000..1fa394b --- /dev/null +++ b/SDL/docs/man3/SDL_DisplayFormatAlpha.3 @@ -0,0 +1,22 @@ +.TH "SDL_DisplayFormatAlpha" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DisplayFormatAlpha \- Convert a surface to the display format +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_DisplayFormatAlpha\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +This function takes a surface and copies it to a new surface of the pixel format and colors of the video framebuffer plus an alpha channel, suitable for fast blitting onto the display surface\&. It calls \fISDL_ConvertSurface\fR +.PP +If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and alpha value before calling this function\&. +.PP +This function can be used to convert a colourkey to an alpha channel, if the \fBSDL_SRCCOLORKEY\fP flag is set on the surface\&. The generated surface will then be transparent (alpha=0) where the pixels match the colourkey, and opaque (alpha=255) elsewhere\&. +.SH "RETURN VALUE" +.PP +If the conversion fails or runs out of memory, it returns \fBNULL\fR +.SH "SEE ALSO" +.PP +\fISDL_ConvertSurface\fR, \fISDL_SetAlpha\fR, \fISDL_SetColorKey\fR, \fISDL_DisplayFormat\fR, \fISDL_Surface\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_DisplayYUVOverlay.3 b/SDL/docs/man3/SDL_DisplayYUVOverlay.3 new file mode 100644 index 0000000..c7a588b --- /dev/null +++ b/SDL/docs/man3/SDL_DisplayYUVOverlay.3 @@ -0,0 +1,18 @@ +.TH "SDL_DisplayYUVOverlay" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DisplayYUVOverlay \- Blit the overlay to the display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_DisplayYUVOverlay\fP\fR(\fBSDL_Overlay *overlay, SDL_Rect *dstrect\fR); +.SH "DESCRIPTION" +.PP +Blit the \fBoverlay\fR to the surface specified when it was \fIcreated\fR\&. The \fI\fBSDL_Rect\fR\fR structure, \fBdstrect\fR, specifies the position and size of the destination\&. If the \fBdstrect\fR is a larger or smaller than the overlay then the overlay will be scaled, this is optimized for 2x scaling\&. +.SH "RETURN VALUES" +.PP +Returns 0 on success +.SH "SEE ALSO" +.PP +\fI\fBSDL_Overlay\fR\fR, \fI\fBSDL_CreateYUVOverlay\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_EnableKeyRepeat.3 b/SDL/docs/man3/SDL_EnableKeyRepeat.3 new file mode 100644 index 0000000..be95692 --- /dev/null +++ b/SDL/docs/man3/SDL_EnableKeyRepeat.3 @@ -0,0 +1,17 @@ +.TH "SDL_EnableKeyRepeat" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_EnableKeyRepeat \- Set keyboard repeat rate\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_EnableKeyRepeat\fP\fR(\fBint delay, int interval\fR); +.SH "DESCRIPTION" +.PP +Enables or disables the keyboard repeat rate\&. \fBdelay\fR specifies how long the key must be pressed before it begins repeating, it then repeats at the speed specified by \fBinterval\fR\&. Both \fBdelay\fR and \fBinterval\fR are expressed in milliseconds\&. +.PP +Setting \fBdelay\fR to 0 disables key repeating completely\&. Good default values are \fBSDL_DEFAULT_REPEAT_DELAY\fP and \fISDL_DEFAULT_REPEAT_INTERVAL\fP\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success and \fB-1\fR on failure\&. +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_EnableUNICODE.3 b/SDL/docs/man3/SDL_EnableUNICODE.3 new file mode 100644 index 0000000..b2da62c --- /dev/null +++ b/SDL/docs/man3/SDL_EnableUNICODE.3 @@ -0,0 +1,24 @@ +.TH "SDL_EnableUNICODE" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_EnableUNICODE \- Enable UNICODE translation +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_EnableUNICODE\fP\fR(\fBint enable\fR); +.SH "DESCRIPTION" +.PP +Enables/Disables Unicode keyboard translation\&. +.PP +To obtain the character codes corresponding to received keyboard events, Unicode translation must first be turned on using this function\&. The translation incurs a slight overhead for each keyboard event and is therefore disabled by default\&. For each subsequently received key down event, the \fBunicode\fR member of the \fI\fBSDL_keysym\fR\fR structure will then contain the corresponding character code, or zero for keysyms that do not correspond to any character code\&. +.PP +A value of 1 for \fBenable\fR enables Unicode translation; 0 disables it, and -1 leaves it unchanged (useful for querying the current translation mode)\&. +.PP +Note that only key press events will be translated, not release events\&. +.SH "RETURN VALUE" +.PP +Returns the previous translation mode (\fB0\fR or \fB1\fR)\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_keysym\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_Event.3 b/SDL/docs/man3/SDL_Event.3 new file mode 100644 index 0000000..3f1f32c --- /dev/null +++ b/SDL/docs/man3/SDL_Event.3 @@ -0,0 +1,182 @@ +.TH "SDL_Event" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Event \- General event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef union{ + Uint8 type; + SDL_ActiveEvent active; + SDL_KeyboardEvent key; + SDL_MouseMotionEvent motion; + SDL_MouseButtonEvent button; + SDL_JoyAxisEvent jaxis; + SDL_JoyBallEvent jball; + SDL_JoyHatEvent jhat; + SDL_JoyButtonEvent jbutton; + SDL_ResizeEvent resize; + SDL_ExposeEvent expose; + SDL_QuitEvent quit; + SDL_UserEvent user; + SDL_SysWMEvent syswm; +} SDL_Event;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +The type of event +.TP 20 +\fBactive\fR +\fIActivation event\fR +.TP 20 +\fBkey\fR +\fIKeyboard event\fR +.TP 20 +\fBmotion\fR +\fIMouse motion event\fR +.TP 20 +\fBbutton\fR +\fIMouse button event\fR +.TP 20 +\fBjaxis\fR +\fIJoystick axis motion event\fR +.TP 20 +\fBjball\fR +\fIJoystick trackball motion event\fR +.TP 20 +\fBjhat\fR +\fIJoystick hat motion event\fR +.TP 20 +\fBjbutton\fR +\fIJoystick button event\fR +.TP 20 +\fBresize\fR +\fIApplication window resize event\fR +.TP 20 +\fBexpose\fR +\fIApplication window expose event\fR +.TP 20 +\fBquit\fR +\fIApplication quit request event\fR +.TP 20 +\fBuser\fR +\fIUser defined event\fR +.TP 20 +\fBsyswm\fR +\fIUndefined window manager event\fR +.SH "DESCRIPTION" +.PP +The \fBSDL_Event\fR union is the core to all event handling is SDL, its probably the most important structure after \fBSDL_Surface\fR\&. \fBSDL_Event\fR is a union of all event structures used in SDL, using it is a simple matter of knowing which union member relates to which event \fBtype\fR\&. +.PP +.TP 20 +\fBEvent \fBtype\fR\fR +\fBEvent Structure\fR +.TP 20 +\fBSDL_ACTIVEEVENT\fP +\fI\fBSDL_ActiveEvent\fR\fR +.TP 20 +\fBSDL_KEYDOWN/UP\fP +\fI\fBSDL_KeyboardEvent\fR\fR +.TP 20 +\fBSDL_MOUSEMOTION\fP +\fI\fBSDL_MouseMotionEvent\fR\fR +.TP 20 +\fBSDL_MOUSEBUTTONDOWN/UP\fP +\fI\fBSDL_MouseButtonEvent\fR\fR +.TP 20 +\fBSDL_JOYAXISMOTION\fP +\fI\fBSDL_JoyAxisEvent\fR\fR +.TP 20 +\fBSDL_JOYBALLMOTION\fP +\fI\fBSDL_JoyBallEvent\fR\fR +.TP 20 +\fBSDL_JOYHATMOTION\fP +\fI\fBSDL_JoyHatEvent\fR\fR +.TP 20 +\fBSDL_JOYBUTTONDOWN/UP\fP +\fI\fBSDL_JoyButtonEvent\fR\fR +.TP 20 +\fBSDL_QUIT\fP +\fI\fBSDL_QuitEvent\fR\fR +.TP 20 +\fBSDL_SYSWMEVENT\fP +\fI\fBSDL_SysWMEvent\fR\fR +.TP 20 +\fBSDL_VIDEORESIZE\fP +\fI\fBSDL_ResizeEvent\fR\fR +.TP 20 +\fBSDL_VIDEOEXPOSE\fP +\fI\fBSDL_ExposeEvent\fR\fR +.TP 20 +\fBSDL_USEREVENT\fP +\fI\fBSDL_UserEvent\fR\fR +.SH "USE" +.PP +The \fBSDL_Event\fR structure has two uses +.IP " \(bu" 6 +Reading events on the event queue +.IP " \(bu" 6 +Placing events on the event queue +.PP +Reading events from the event queue is done with either \fI\fBSDL_PollEvent\fP\fR or \fI\fBSDL_PeepEvents\fP\fR\&. We\&'ll use \fBSDL_PollEvent\fP and step through an example\&. +.PP +First off, we create an empty \fBSDL_Event\fR structure\&. +.PP +.nf +\f(CWSDL_Event test_event;\fR +.fi +.PP + \fBSDL_PollEvent\fP removes the next event from the event queue, if there are no events on the queue it returns \fB0\fR otherwise it returns \fB1\fR\&. We use a \fBwhile\fP loop to process each event in turn\&. +.PP +.nf +\f(CWwhile(SDL_PollEvent(&test_event)) {\fR +.fi +.PP + The \fBSDL_PollEvent\fP function take a pointer to an \fBSDL_Event\fR structure that is to be filled with event information\&. We know that if \fBSDL_PollEvent\fP removes an event from the queue then the event information will be placed in our \fBtest_event\fR structure, but we also know that the \fItype\fP of event will be placed in the \fBtype\fR member of \fBtest_event\fR\&. So to handle each event \fBtype\fR seperately we use a \fBswitch\fP statement\&. +.PP +.nf +\f(CW switch(test_event\&.type) {\fR +.fi +.PP + We need to know what kind of events we\&'re looking for \fIand\fP the event \fBtype\fR\&'s of those events\&. So lets assume we want to detect where the user is moving the mouse pointer within our application\&. We look through our event types and notice that \fBSDL_MOUSEMOTION\fP is, more than likely, the event we\&'re looking for\&. A little \fImore\fR research tells use that \fBSDL_MOUSEMOTION\fP events are handled within the \fI\fBSDL_MouseMotionEvent\fR\fR structure which is the \fBmotion\fR member of \fBSDL_Event\fR\&. We can check for the \fBSDL_MOUSEMOTION\fP event \fBtype\fR within our \fBswitch\fP statement like so: +.PP +.nf +\f(CW case SDL_MOUSEMOTION:\fR +.fi +.PP + All we need do now is read the information out of the \fBmotion\fR member of \fBtest_event\fR\&. +.PP +.nf +\f(CW printf("We got a motion event\&. +"); + printf("Current mouse position is: (%d, %d) +", test_event\&.motion\&.x, test_event\&.motion\&.y); + break; + default: + printf("Unhandled Event! +"); + break; + } +} +printf("Event queue empty\&. +");\fR +.fi +.PP +.PP +It is also possible to push events onto the event queue and so use it as a two-way communication path\&. Both \fI\fBSDL_PushEvent\fP\fR and \fI\fBSDL_PeepEvents\fP\fR allow you to place events onto the event queue\&. This is usually used to place a \fBSDL_USEREVENT\fP on the event queue, however you could use it to post fake input events if you wished\&. Creating your own events is a simple matter of choosing the event type you want, setting the \fBtype\fR member and filling the appropriate member structure with information\&. +.PP +.nf +\f(CWSDL_Event user_event; + +user_event\&.type=SDL_USEREVENT; +user_event\&.user\&.code=2; +user_event\&.user\&.data1=NULL; +user_event\&.user\&.data2=NULL; +SDL_PushEvent(&user_event);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_PollEvent\fP\fR, \fI\fBSDL_PushEvent\fP\fR, \fI\fBSDL_PeepEvents\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_EventState.3 b/SDL/docs/man3/SDL_EventState.3 new file mode 100644 index 0000000..04db3bc --- /dev/null +++ b/SDL/docs/man3/SDL_EventState.3 @@ -0,0 +1,23 @@ +.TH "SDL_EventState" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_EventState \- This function allows you to set the state of processing certain events\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_EventState\fP\fR(\fBUint8 type, int state\fR); +.SH "DESCRIPTION" +.PP +This function allows you to set the state of processing certain event \fBtype\fR\&'s\&. +.PP +If \fBstate\fR is set to \fBSDL_IGNORE\fP, that event \fBtype\fR will be automatically dropped from the event queue and will not be filtered\&. +.PP +If \fBstate\fR is set to \fBSDL_ENABLE\fP, that event \fBtype\fR will be processed normally\&. +.PP +If \fBstate\fR is set to \fBSDL_QUERY\fP, \fBSDL_EventState\fP will return the current processing state of the specified event \fBtype\fR\&. +.PP +A list of event \fBtype\fR\&'s can be found in the \fI\fBSDL_Event\fR\fR section\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_ExposeEvent.3 b/SDL/docs/man3/SDL_ExposeEvent.3 new file mode 100644 index 0000000..d32713d --- /dev/null +++ b/SDL/docs/man3/SDL_ExposeEvent.3 @@ -0,0 +1,24 @@ +.TH "SDL_ExposeEvent" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ExposeEvent \- Quit requested event +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type +} SDL_ExposeEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_VIDEOEXPOSE\fP +.SH "DESCRIPTION" +.PP +\fBSDL_ExposeEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used whan an event of type \fBSDL_VIDEOEXPOSE\fP is reported\&. +.PP +A VIDEOEXPOSE event is triggered when the screen has been modified outside of the application, usually by the window manager and needs to be redrawn\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_SetEventFilter\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_FillRect.3 b/SDL/docs/man3/SDL_FillRect.3 new file mode 100644 index 0000000..cd5d651 --- /dev/null +++ b/SDL/docs/man3/SDL_FillRect.3 @@ -0,0 +1,22 @@ +.TH "SDL_FillRect" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FillRect \- This function performs a fast fill of the given rectangle with some color +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_FillRect\fP\fR(\fBSDL_Surface *dst, SDL_Rect *dstrect, Uint32 color\fR); +.SH "DESCRIPTION" +.PP +This function performs a fast fill of the given rectangle with \fBcolor\fR\&. If \fBdstrect\fR is \fBNULL\fP, the whole surface will be filled with \fBcolor\fR\&. +.PP +The color should be a pixel of the format used by the surface, and can be generated by the \fISDL_MapRGB\fR or \fISDL_MapRGBA\fR functions\&. If the color value contains an alpha value then the destination is simply "filled" with that alpha information, no blending takes place\&. +.PP +If there is a clip rectangle set on the destination (set via \fISDL_SetClipRect\fR) then this function will clip based on the intersection of the clip rectangle and the \fBdstrect\fR rectangle and the dstrect rectangle will be modified to represent the area actually filled\&. +.SH "RETURN VALUE" +.PP +This function returns \fB0\fR on success, or \fB-1\fR on error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_MapRGB\fP\fR, \fI\fBSDL_MapRGBA\fP\fR, \fI\fBSDL_BlitSurface\fP\fR, \fI\fBSDL_Rect\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_Flip.3 b/SDL/docs/man3/SDL_Flip.3 new file mode 100644 index 0000000..8e30f72 --- /dev/null +++ b/SDL/docs/man3/SDL_Flip.3 @@ -0,0 +1,20 @@ +.TH "SDL_Flip" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Flip \- Swaps screen buffers +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_Flip\fP\fR(\fBSDL_Surface *screen\fR); +.SH "DESCRIPTION" +.PP +On hardware that supports double-buffering, this function sets up a flip and returns\&. The hardware will wait for vertical retrace, and then swap video buffers before the next video surface blit or lock will return\&. On hardware that doesn\&'t support double-buffering, this is equivalent to calling \fISDL_UpdateRect\fR\fB(screen, 0, 0, 0, 0)\fR +.PP +The \fBSDL_DOUBLEBUF\fP flag must have been passed to \fISDL_SetVideoMode\fR, when setting the video mode for this function to perform hardware flipping\&. +.SH "RETURN VALUE" +.PP +This function returns \fB0\fR if successful, or \fB-1\fR if there was an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_UpdateRect\fP\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_FreeCursor.3 b/SDL/docs/man3/SDL_FreeCursor.3 new file mode 100644 index 0000000..f3e2e13 --- /dev/null +++ b/SDL/docs/man3/SDL_FreeCursor.3 @@ -0,0 +1,15 @@ +.TH "SDL_FreeCursor" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FreeCursor \- Frees a cursor created with SDL_CreateCursor\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_FreeCursor\fP\fR(\fBSDL_Cursor *cursor\fR); +.SH "DESCRIPTION" +.PP +Frees a \fBSDL_Cursor\fR that was created using \fISDL_CreateCursor\fR\&. +.SH "SEE ALSO" +.PP +\fISDL_CreateCursor\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_FreeSurface.3 b/SDL/docs/man3/SDL_FreeSurface.3 new file mode 100644 index 0000000..5e2f488 --- /dev/null +++ b/SDL/docs/man3/SDL_FreeSurface.3 @@ -0,0 +1,15 @@ +.TH "SDL_FreeSurface" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FreeSurface \- Frees (deletes) a SDL_Surface +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_FreeSurface\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +Frees the resources used by a previously created \fBSDL_Surface\fR\&. If the surface was created using \fISDL_CreateRGBSurfaceFrom\fR then the pixel data is not freed\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateRGBSurface\fP\fR \fI\fBSDL_CreateRGBSurfaceFrom\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_FreeWAV.3 b/SDL/docs/man3/SDL_FreeWAV.3 new file mode 100644 index 0000000..0cc3c76 --- /dev/null +++ b/SDL/docs/man3/SDL_FreeWAV.3 @@ -0,0 +1,15 @@ +.TH "SDL_FreeWAV" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FreeWAV \- Frees previously opened WAV data +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_FreeWAV\fP\fR(\fBUint8 *audio_buf\fR); +.SH "DESCRIPTION" +.PP +After a WAVE file has been opened with \fI\fBSDL_LoadWAV\fP\fR its data can eventually be freed with \fBSDL_FreeWAV\fP\&. \fBaudio_buf\fR is a pointer to the buffer created by \fBSDL_LoadWAV\fP\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_LoadWAV\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_FreeYUVOverlay.3 b/SDL/docs/man3/SDL_FreeYUVOverlay.3 new file mode 100644 index 0000000..8dfd624 --- /dev/null +++ b/SDL/docs/man3/SDL_FreeYUVOverlay.3 @@ -0,0 +1,15 @@ +.TH "SDL_FreeYUVOverlay" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FreeYUVOverlay \- Free a YUV video overlay +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_FreeYUVOverlay\fP\fR(\fBSDL_Overlay *overlay\fR); +.SH "DESCRIPTION" +.PP +Frees and \fI\fBoverlay\fR\fR created by \fI\fBSDL_CreateYUVOverlay\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Overlay\fR\fR, \fI\fBSDL_DisplayYUVOverlay\fP\fR, \fI\fBSDL_FreeYUVOverlay\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GL_GetAttribute.3 b/SDL/docs/man3/SDL_GL_GetAttribute.3 new file mode 100644 index 0000000..6b14813 --- /dev/null +++ b/SDL/docs/man3/SDL_GL_GetAttribute.3 @@ -0,0 +1,18 @@ +.TH "SDL_GL_GetAttribute" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GL_GetAttribute \- Get the value of a special SDL/OpenGL attribute +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_GL_GetAttribute\fP\fR(\fBSDLGLattr attr, int *value\fR); +.SH "DESCRIPTION" +.PP +Places the value of the SDL/OpenGL \fIattribute\fR \fBattr\fR into \fBvalue\fR\&. This is useful after a call to \fI\fBSDL_SetVideoMode\fP\fR to check whether your attributes have been \fIset\fR as you expected\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GL_SetAttribute\fP\fR, \fIGL Attributes\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GL_GetProcAddress.3 b/SDL/docs/man3/SDL_GL_GetProcAddress.3 new file mode 100644 index 0000000..13a5502 --- /dev/null +++ b/SDL/docs/man3/SDL_GL_GetProcAddress.3 @@ -0,0 +1,48 @@ +.TH "SDL_GL_GetProcAddress" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GL_GetProcAddress \- Get the address of a GL function +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid *\fBSDL_GL_GetProcAddress\fP\fR(\fBconst char* proc\fR); +.SH "DESCRIPTION" +.PP +Returns the address of the GL function \fBproc\fR, or \fBNULL\fR if the function is not found\&. If the GL library is loaded at runtime, with \fI\fBSDL_GL_LoadLibrary\fP\fR, then \fIall\fP GL functions must be retrieved this way\&. Usually this is used to retrieve function pointers to OpenGL extensions\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWtypedef void (*GL_ActiveTextureARB_Func)(unsigned int); +GL_ActiveTextureARB_Func glActiveTextureARB_ptr = 0; +int has_multitexture=1; +\&. +\&. +\&. +/* Get function pointer */ +glActiveTextureARB_ptr=(GL_ActiveTextureARB_Func) SDL_GL_GetProcAddress("glActiveTextureARB"); + +/* Check for a valid function ptr */ +if(!glActiveTextureARB_ptr){ + fprintf(stderr, "Multitexture Extensions not present\&. +"); + has_multitexture=0; +} +\&. +\&. +\&. +\&. +if(has_multitexture){ + glActiveTextureARB_ptr(GL_TEXTURE0_ARB); + \&. + \&. +} +else{ + \&. + \&. +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_GL_LoadLibrary\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GL_LoadLibrary.3 b/SDL/docs/man3/SDL_GL_LoadLibrary.3 new file mode 100644 index 0000000..77f92f5 --- /dev/null +++ b/SDL/docs/man3/SDL_GL_LoadLibrary.3 @@ -0,0 +1,15 @@ +.TH "SDL_GL_LoadLibrary" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GL_LoadLibrary \- Specify an OpenGL library +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_GL_LoadLibrary\fP\fR(\fBconst char *path\fR); +.SH "DESCRIPTION" +.PP +If you wish, you may load the OpenGL library at runtime, this must be done before \fI\fBSDL_SetVideoMode\fP\fR is called\&. The \fBpath\fR of the GL library is passed to \fBSDL_GL_LoadLibrary\fP and it returns \fB0\fR on success, or \fB-1\fR on an error\&. You must then use \fI\fBSDL_GL_GetProcAddress\fP\fR to retrieve function pointers to GL functions\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GL_GetProcAddress\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GL_SetAttribute.3 b/SDL/docs/man3/SDL_GL_SetAttribute.3 new file mode 100644 index 0000000..9b6a3f3 --- /dev/null +++ b/SDL/docs/man3/SDL_GL_SetAttribute.3 @@ -0,0 +1,40 @@ +.TH "SDL_GL_SetAttribute" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GL_SetAttribute \- Set a special SDL/OpenGL attribute +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_GL_SetAttribute\fP\fR(\fBSDL_GLattr attr, int value\fR); +.SH "DESCRIPTION" +.PP +Sets the OpenGL \fIattribute\fR \fBattr\fR to \fBvalue\fR\&. The attributes you set don\&'t take effect until after a call to \fI\fBSDL_SetVideoMode\fP\fR\&. You should use \fI\fBSDL_GL_GetAttribute\fP\fR to check the values after a \fBSDL_SetVideoMode\fP call\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on error\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); +SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 ); +SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 ); +SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); +SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); +if ( (screen=SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL )) == NULL ) { + fprintf(stderr, "Couldn\&'t set GL mode: %s +", SDL_GetError()); + SDL_Quit(); + return; +}\fR +.fi +.PP +.PP +.RS +\fBNote: +.PP +The \fBSDL_DOUBLEBUF\fP flag is not required to enable double buffering when setting an OpenGL video mode\&. Double buffering is enabled or disabled using the SDL_GL_DOUBLEBUFFER attribute\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_GL_GetAttribute\fP\fR, \fIGL Attributes\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GL_SwapBuffers.3 b/SDL/docs/man3/SDL_GL_SwapBuffers.3 new file mode 100644 index 0000000..0997975 --- /dev/null +++ b/SDL/docs/man3/SDL_GL_SwapBuffers.3 @@ -0,0 +1,15 @@ +.TH "SDL_GL_SwapBuffers" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GL_SwapBuffers \- Swap OpenGL framebuffers/Update Display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_GL_SwapBuffers\fP\fR(\fBvoid \fR); +.SH "DESCRIPTION" +.PP +Swap the OpenGL buffers, if double-buffering is supported\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_GL_SetAttribute\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GLattr.3 b/SDL/docs/man3/SDL_GLattr.3 new file mode 100644 index 0000000..a5fd2a8 --- /dev/null +++ b/SDL/docs/man3/SDL_GLattr.3 @@ -0,0 +1,47 @@ +.TH "SDL_GLattr" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GLattr \- SDL GL Attributes +.SH "ATTRIBUTES" +.TP 20 +\fBSDL_GL_RED_SIZE\fP +Size of the framebuffer red component, in bits +.TP 20 +\fBSDL_GL_GREEN_SIZE\fP +Size of the framebuffer green component, in bits +.TP 20 +\fBSDL_GL_BLUE_SIZE\fP +Size of the framebuffer blue component, in bits +.TP 20 +\fBSDL_GL_ALPHA_SIZE\fP +Size of the framebuffer alpha component, in bits +.TP 20 +\fBSDL_GL_DOUBLEBUFFER\fP +0 or 1, enable or disable double buffering +.TP 20 +\fBSDL_GL_BUFFER_SIZE\fP +Size of the framebuffer, in bits +.TP 20 +\fBSDL_GL_DEPTH_SIZE\fP +Size of the depth buffer, in bits +.TP 20 +\fBSDL_GL_STENCIL_SIZE\fP +Size of the stencil buffer, in bits +.TP 20 +\fBSDL_GL_ACCUM_RED_SIZE\fP +Size of the accumulation buffer red component, in bits +.TP 20 +\fBSDL_GL_ACCUM_GREEN_SIZE\fP +Size of the accumulation buffer green component, in bits +.TP 20 +\fBSDL_GL_ACCUM_BLUE_SIZE\fP +Size of the accumulation buffer blue component, in bits +.TP 20 +\fBSDL_GL_ACCUM_ALPHA_SIZE\fP +Size of the accumulation buffer alpha component, in bits +.SH "DESCRIPTION" +.PP +While you can set most OpenGL attributes normally, the attributes list above must be known \fIbefore\fP SDL sets the video mode\&. These attributes a set and read with \fI\fBSDL_GL_SetAttribute\fP\fR and \fI\fBSDL_GL_GetAttribute\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GL_SetAttribute\fP\fR, \fI\fBSDL_GL_GetAttribute\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GetAppState.3 b/SDL/docs/man3/SDL_GetAppState.3 new file mode 100644 index 0000000..553ad49 --- /dev/null +++ b/SDL/docs/man3/SDL_GetAppState.3 @@ -0,0 +1,24 @@ +.TH "SDL_GetAppState" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +\fBSDL_GetAppState\fP \- Get the state of the application +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_GetAppState\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +This function returns the current state of the application\&. The value returned is a bitwise combination of: +.TP 20 +\fBSDL_APPMOUSEFOCUS\fP +The application has mouse focus\&. +.TP 20 +\fBSDL_APPINPUTFOCUS\fP +The application has keyboard focus +.TP 20 +\fBSDL_APPACTIVE\fP +The application is visible +.SH "SEE ALSO" +.PP +\fI\fBSDL_ActiveEvent\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_GetAudioStatus.3 b/SDL/docs/man3/SDL_GetAudioStatus.3 new file mode 100644 index 0000000..f9cc750 --- /dev/null +++ b/SDL/docs/man3/SDL_GetAudioStatus.3 @@ -0,0 +1,24 @@ +.TH "SDL_GetAudioStatus" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetAudioStatus \- Get the current audio state +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_audiostatus\fBSDL_GetAudioStatus\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +.nf +\f(CWtypedef enum{ + SDL_AUDIO_STOPPED, + SDL_AUDIO_PAUSED, + SDL_AUDIO_PLAYING +} SDL_audiostatus;\fR +.fi +.PP +.PP +Returns either \fBSDL_AUDIO_STOPPED\fP, \fBSDL_AUDIO_PAUSED\fP or \fBSDL_AUDIO_PLAYING\fP depending on the current audio state\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_PauseAudio\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_GetClipRect.3 b/SDL/docs/man3/SDL_GetClipRect.3 new file mode 100644 index 0000000..7033777 --- /dev/null +++ b/SDL/docs/man3/SDL_GetClipRect.3 @@ -0,0 +1,17 @@ +.TH "SDL_GetClipRect" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetClipRect \- Gets the clipping rectangle for a surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_GetClipRect\fP\fR(\fBSDL_Surface *surface, SDL_Rect *rect\fR); +.SH "DESCRIPTION" +.PP +Gets the clipping rectangle for a surface\&. When this surface is the destination of a blit, only the area within the clip rectangle is drawn into\&. +.PP +The rectangle pointed to by \fBrect\fR will be filled with the clipping rectangle of the surface\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetClipRect\fP\fR, \fI\fBSDL_BlitSurface\fP\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GetCursor.3 b/SDL/docs/man3/SDL_GetCursor.3 new file mode 100644 index 0000000..eed248e --- /dev/null +++ b/SDL/docs/man3/SDL_GetCursor.3 @@ -0,0 +1,15 @@ +.TH "SDL_GetCursor" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetCursor \- Get the currently active mouse cursor\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Cursor *\fBSDL_GetCursor\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Returns the currently active mouse cursor\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetCursor\fP\fR, \fI\fBSDL_CreateCursor\fP\fR, \fI\fBSDL_ShowCursor\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GetError.3 b/SDL/docs/man3/SDL_GetError.3 new file mode 100644 index 0000000..9d48f04 --- /dev/null +++ b/SDL/docs/man3/SDL_GetError.3 @@ -0,0 +1,15 @@ +.TH "SDL_GetError" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetError \- Get SDL error string +.SH "SYNOPSIS" +.PP +\fB#include "SDL/SDL\&.h" +.sp +\fBchar *\fBSDL_GetError\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_GetError\fP returns a NULL terminated string containing information about the last internal SDL error\&. +.SH "RETURN VALUE" +.PP +\fBSDL_GetError\fP returns a string containing the last error\&. +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_GetEventFilter.3 b/SDL/docs/man3/SDL_GetEventFilter.3 new file mode 100644 index 0000000..98ab789 --- /dev/null +++ b/SDL/docs/man3/SDL_GetEventFilter.3 @@ -0,0 +1,23 @@ +.TH "SDL_GetEventFilter" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetEventFilter \- Retrieves a pointer to he event filter +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_EventFilter \fBSDL_GetEventFilter\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +This function retrieces a pointer to the event filter that was previously set using \fI\fBSDL_SetEventFilter\fP\fR\&. An SDL_EventFilter function is defined as: +.PP +.nf +\f(CWtypedef int (*SDL_EventFilter)(const SDL_Event *event);\fR +.fi +.PP +.SH "RETURN VALUE" +.PP +Returns a pointer to the event filter or \fBNULL\fP if no filter has been set\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_SetEventFilter\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_GetGamma.3 b/SDL/docs/man3/SDL_GetGamma.3 new file mode 100644 index 0000000..63a68ea --- /dev/null +++ b/SDL/docs/man3/SDL_GetGamma.3 @@ -0,0 +1,21 @@ +.TH "SDL_GetGamma" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetGamma \- Gets the gamma of the display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_GetGamma\fP\fR(\fBfloat *red, float *green, float *blue\fR); +.SH "DESCRIPTION" +.PP +Gets the color gamma of the display\&. The gamma value for each color component will be place in the parameters \fBred\fR, \fBgreen\fR and \fBblue\fR\&. The values can range from 0\&.1 to 10\&. +.PP +.RS +\fBNote: +.PP +This function currently only works on XFreee 4\&.0 and up\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetGamma\fP\fR, \fI\fBSDL_SetVideoMode\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GetGammaRamp.3 b/SDL/docs/man3/SDL_GetGammaRamp.3 new file mode 100644 index 0000000..26dd0b4 --- /dev/null +++ b/SDL/docs/man3/SDL_GetGammaRamp.3 @@ -0,0 +1,20 @@ +.TH "SDL_GetGammaRamp" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetGammaRamp \- Gets the color gamma lookup tables for the display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_GetGammaRamp\fP\fR(\fBUint16 *redtable, Uint16 *greentable, Uint16 *bluetable\fR); +.SH "DESCRIPTION" +.PP +Gets the gamma translation lookup tables currently used by the display\&. Each table is an array of 256 Uint16 values\&. +.PP +Not all display hardware is able to change gamma\&. +.SH "RETURN VALUE" +.PP +Returns -1 on error\&. +.SH "SEE ALSO" +.PP +\fISDL_SetGamma\fR \fISDL_SetGammaRamp\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GetKeyName.3 b/SDL/docs/man3/SDL_GetKeyName.3 new file mode 100644 index 0000000..b8ced12 --- /dev/null +++ b/SDL/docs/man3/SDL_GetKeyName.3 @@ -0,0 +1,15 @@ +.TH "SDL_GetKeyName" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetKeyName \- Get the name of an SDL virtual keysym +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBchar *\fBSDL_GetKeyName\fP\fR(\fBSDLKey key\fR); +.SH "DESCRIPTION" +.PP +Returns the SDL-defined name of the \fI\fBSDLKey\fR\fR \fBkey\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDLKey\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_GetKeyState.3 b/SDL/docs/man3/SDL_GetKeyState.3 new file mode 100644 index 0000000..a8c2d9e --- /dev/null +++ b/SDL/docs/man3/SDL_GetKeyState.3 @@ -0,0 +1,30 @@ +.TH "SDL_GetKeyState" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetKeyState \- Get a snapshot of the current keyboard state +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 *\fBSDL_GetKeyState\fP\fR(\fBint *numkeys\fR); +.SH "DESCRIPTION" +.PP +Gets a snapshot of the current keyboard state\&. The current state is return as a pointer to an array, the size of this array is stored in \fBnumkeys\fR\&. The array is indexed by the \fI\fBSDLK_*\fP\fR symbols\&. A value of 1 means the key is pressed and a value of 0 means its not\&. The pointer returned is a pointer to an internal SDL array and should not be freed by the caller\&. +.PP +.RS +\fBNote: +.PP +Use \fI\fBSDL_PumpEvents\fP\fR to update the state array\&. +.RE +.SH "EXAMPLE" +.PP +.PP +.nf +\f(CWUint8 *keystate = SDL_GetKeyState(NULL); +if ( keystate[SDLK_RETURN] ) printf("Return Key Pressed\&. +");\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL Key Symbols\fP\fR, \fI\fBSDL_PumpEvents\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_GetModState.3 b/SDL/docs/man3/SDL_GetModState.3 new file mode 100644 index 0000000..13f3e7e --- /dev/null +++ b/SDL/docs/man3/SDL_GetModState.3 @@ -0,0 +1,54 @@ +.TH "SDL_GetModState" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetModState \- Get the state of modifier keys\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDLMod \fBSDL_GetModState\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Returns the current state of the modifier keys (CTRL, ALT, etc\&.)\&. +.SH "RETURN VALUE" +.PP +The return value can be an OR\&'d combination of the SDLMod enum\&. +.PP +.PP +.RS +\fBSDLMod\fR +.PP +.PP +.nf +\f(CWtypedef enum { + KMOD_NONE = 0x0000, + KMOD_LSHIFT= 0x0001, + KMOD_RSHIFT= 0x0002, + KMOD_LCTRL = 0x0040, + KMOD_RCTRL = 0x0080, + KMOD_LALT = 0x0100, + KMOD_RALT = 0x0200, + KMOD_LMETA = 0x0400, + KMOD_RMETA = 0x0800, + KMOD_NUM = 0x1000, + KMOD_CAPS = 0x2000, + KMOD_MODE = 0x4000, +} SDLMod;\fR +.fi +.PP +.RE + SDL also defines the following symbols for convenience: +.PP +.RS +.PP +.nf +\f(CW#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) +#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) +#define KMOD_ALT (KMOD_LALT|KMOD_RALT) +#define KMOD_META (KMOD_LMETA|KMOD_RMETA)\fR +.fi +.PP +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetKeyState\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_GetMouseState.3 b/SDL/docs/man3/SDL_GetMouseState.3 new file mode 100644 index 0000000..ef20562 --- /dev/null +++ b/SDL/docs/man3/SDL_GetMouseState.3 @@ -0,0 +1,24 @@ +.TH "SDL_GetMouseState" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetMouseState \- Retrieve the current state of the mouse +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_GetMouseState\fP\fR(\fBint *x, int *y\fR); +.SH "DESCRIPTION" +.PP +The current button state is returned as a button bitmask, which can be tested using the \fBSDL_BUTTON(X)\fP macros, and \fBx\fR and \fBy\fR are set to the current mouse cursor position\&. You can pass \fBNULL\fP for either \fBx\fR or \fBy\fR\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_PumpEvents(); +if(SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1)) + printf("Mouse Button 1(left) is pressed\&. +");\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetRelativeMouseState\fP\fR, \fI\fBSDL_PumpEvents\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_GetRGB.3 b/SDL/docs/man3/SDL_GetRGB.3 new file mode 100644 index 0000000..55222db --- /dev/null +++ b/SDL/docs/man3/SDL_GetRGB.3 @@ -0,0 +1,17 @@ +.TH "SDL_GetRGB" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetRGB \- Get RGB values from a pixel in the specified pixel format\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_GetRGB\fP\fR(\fBUint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b\fR); +.SH "DESCRIPTION" +.PP +Get RGB component values from a pixel stored in the specified pixel format\&. +.PP +This function uses the entire 8-bit [0\&.\&.255] range when converting color components from pixel formats with less than 8-bits per RGB component (e\&.g\&., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8])\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetRGBA\fP\fR, \fI\fBSDL_MapRGB\fP\fR, \fI\fBSDL_MapRGBA\fP\fR, \fI\fBSDL_PixelFormat\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GetRGBA.3 b/SDL/docs/man3/SDL_GetRGBA.3 new file mode 100644 index 0000000..7c2876e --- /dev/null +++ b/SDL/docs/man3/SDL_GetRGBA.3 @@ -0,0 +1,19 @@ +.TH "SDL_GetRGBA" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetRGBA \- Get RGBA values from a pixel in the specified pixel format\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_GetRGBA\fP\fR(\fBUint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a\fR); +.SH "DESCRIPTION" +.PP +Get RGBA component values from a pixel stored in the specified pixel format\&. +.PP +This function uses the entire 8-bit [0\&.\&.255] range when converting color components from pixel formats with less than 8-bits per RGB component (e\&.g\&., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8])\&. +.PP +If the surface has no alpha component, the alpha will be returned as 0xff (100% opaque)\&. +.SH "SEE ALSO" +.PP +\fISDL_GetRGB\fR, \fISDL_MapRGB\fR, \fISDL_MapRGBA\fR, \fISDL_PixelFormat\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GetRelativeMouseState.3 b/SDL/docs/man3/SDL_GetRelativeMouseState.3 new file mode 100644 index 0000000..d33745f --- /dev/null +++ b/SDL/docs/man3/SDL_GetRelativeMouseState.3 @@ -0,0 +1,15 @@ +.TH "SDL_GetRelativeMouseState" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetRelativeMouseState \- Retrieve the current state of the mouse +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_GetRelativeMouseState\fP\fR(\fBint *x, int *y\fR); +.SH "DESCRIPTION" +.PP +The current button state is returned as a button bitmask, which can be tested using the \fBSDL_BUTTON(X)\fP macros, and \fBx\fR and \fBy\fR are set to the change in the mouse position since the last call to \fBSDL_GetRelativeMouseState\fP or since event initialization\&. You can pass \fBNULL\fP for either \fBx\fR or \fBy\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetMouseState\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_GetThreadID.3 b/SDL/docs/man3/SDL_GetThreadID.3 new file mode 100644 index 0000000..96c9267 --- /dev/null +++ b/SDL/docs/man3/SDL_GetThreadID.3 @@ -0,0 +1,16 @@ +.TH "SDL_GetThreadID" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetThreadID \- Get the SDL thread ID of a SDL_Thread +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBUint32 \fBSDL_GetThreadID\fP\fR(\fBSDL_Thread *thread\fR); +.SH "DESCRIPTION" +.PP +Returns the ID of a \fBSDL_Thread\fR created by \fISDL_CreateThread\fR\&. +.SH "SEE ALSO" +.PP +\fISDL_CreateThread\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_GetTicks.3 b/SDL/docs/man3/SDL_GetTicks.3 new file mode 100644 index 0000000..7386000 --- /dev/null +++ b/SDL/docs/man3/SDL_GetTicks.3 @@ -0,0 +1,15 @@ +.TH "SDL_GetTicks" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetTicks \- Get the number of milliseconds since the SDL library initialization\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint32 \fBSDL_GetTicks\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +Get the number of milliseconds since the SDL library initialization\&. Note that this value wraps if the program runs for more than ~49 days\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Delay\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GetVideoInfo.3 b/SDL/docs/man3/SDL_GetVideoInfo.3 new file mode 100644 index 0000000..6bb83cf --- /dev/null +++ b/SDL/docs/man3/SDL_GetVideoInfo.3 @@ -0,0 +1,15 @@ +.TH "SDL_GetVideoInfo" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetVideoInfo \- returns a pointer to information about the video hardware +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_VideoInfo *\fBSDL_GetVideoInfo\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +This function returns a read-only pointer to \fIinformation\fR about the video hardware\&. If this is called before \fISDL_SetVideoMode\fR, the \fBvfmt\fR member of the returned structure will contain the pixel format of the "best" video mode\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_VideoInfo\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_GetVideoSurface.3 b/SDL/docs/man3/SDL_GetVideoSurface.3 new file mode 100644 index 0000000..613b2c0 --- /dev/null +++ b/SDL/docs/man3/SDL_GetVideoSurface.3 @@ -0,0 +1,15 @@ +.TH "SDL_GetVideoSurface" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetVideoSurface \- returns a pointer to the current display surface +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_GetVideoSurface\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +This function returns a pointer to the current display surface\&. If SDL is doing format conversion on the display surface, this function returns the publicly visible surface, not the real video surface\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_Init.3 b/SDL/docs/man3/SDL_Init.3 new file mode 100644 index 0000000..0c34649 --- /dev/null +++ b/SDL/docs/man3/SDL_Init.3 @@ -0,0 +1,41 @@ +.TH "SDL_Init" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Init \- Initializes SDL +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_Init\fP\fR(\fBUint32 flags\fR); +.SH "DESCRIPTION" +.PP +Initializes SDL\&. This should be called before all other SDL functions\&. The \fBflags\fR parameter specifies what part(s) of SDL to initialize\&. +.TP 20 +\fBSDL_INIT_TIMER\fP +Initializes the \fItimer\fR subsystem\&. +.TP 20 +\fBSDL_INIT_AUDIO\fP +Initializes the \fIaudio\fR subsystem\&. +.TP 20 +\fBSDL_INIT_VIDEO\fP +Initializes the \fIvideo\fR subsystem\&. +.TP 20 +\fBSDL_INIT_CDROM\fP +Initializes the \fIcdrom\fR subsystem\&. +.TP 20 +\fBSDL_INIT_JOYSTICK\fP +Initializes the \fIjoystick\fR subsystem\&. +.TP 20 +\fBSDL_INIT_EVERYTHING\fP +Initialize all of the above\&. +.TP 20 +\fBSDL_INIT_NOPARACHUTE\fP +Prevents SDL from catching fatal signals\&. +.TP 20 +\fBSDL_INIT_EVENTTHREAD\fP +.SH "RETURN VALUE" +.PP +Returns \fB-1\fR on an error or \fB0\fR on success\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Quit\fP\fR, \fI\fBSDL_InitSubSystem\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_InitSubSystem.3 b/SDL/docs/man3/SDL_InitSubSystem.3 new file mode 100644 index 0000000..d65bdcd --- /dev/null +++ b/SDL/docs/man3/SDL_InitSubSystem.3 @@ -0,0 +1,41 @@ +.TH "SDL_InitSubSystem" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_InitSubSystem \- Initialize subsystems +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_InitSubSystem\fP\fR(\fBUint32 flags\fR); +.SH "DESCRIPTION" +.PP +After SDL has been initialized with \fI\fBSDL_Init\fP\fR you may initialize uninitialized subsystems with \fBSDL_InitSubSystem\fP\&. The \fBflags\fR parameter is the same as that used in \fI\fBSDL_Init\fP\fR\&. +.SH "EXAMPLES" +.PP +.nf +\f(CW/* Seperating Joystick and Video initialization\&. */ +SDL_Init(SDL_INIT_VIDEO); +\&. +\&. +SDL_SetVideoMode(640, 480, 16, SDL_DOUBLEBUF|SDL_FULLSCREEN); +\&. +/* Do Some Video stuff */ +\&. +\&. +/* Initialize the joystick subsystem */ +SDL_InitSubSystem(SDL_INIT_JOYSTICK); + +/* Do some stuff with video and joystick */ +\&. +\&. +\&. +/* Shut them both down */ +SDL_Quit();\fR +.fi +.PP +.SH "RETURN VALUE" +.PP +Returns \fB-1\fR on an error or \fB0\fR on success\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Init\fP\fR, \fI\fBSDL_Quit\fP\fR, \fI\fBSDL_QuitSubSystem\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_JoyAxisEvent.3 b/SDL/docs/man3/SDL_JoyAxisEvent.3 new file mode 100644 index 0000000..9241e7e --- /dev/null +++ b/SDL/docs/man3/SDL_JoyAxisEvent.3 @@ -0,0 +1,36 @@ +.TH "SDL_JoyAxisEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoyAxisEvent \- Joystick axis motion event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 which; + Uint8 axis; + Sint16 value; +} SDL_JoyAxisEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_JOYAXISMOTION\fP +.TP 20 +\fBwhich\fR +Joystick device index +.TP 20 +\fBaxis\fR +Joystick axis index +.TP 20 +\fBvalue\fR +Axis value (range: -32768 to 32767) +.SH "DESCRIPTION" +.PP +\fBSDL_JoyAxisEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_JOYAXISMOTION\fP is reported\&. +.PP +A \fBSDL_JOYAXISMOTION\fP event occurs when ever a user moves an axis on the joystick\&. The field \fBwhich\fR is the index of the joystick that reported the event and \fBaxis\fR is the index of the axis (for a more detailed explaination see the \fIJoystick section\fR)\&. \fBvalue\fR is the current position of the axis\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fIJoystick Functions\fR, \fI\fBSDL_JoystickEventState\fP\fR, \fI\fBSDL_JoystickGetAxis\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_JoyBallEvent.3 b/SDL/docs/man3/SDL_JoyBallEvent.3 new file mode 100644 index 0000000..9aa483c --- /dev/null +++ b/SDL/docs/man3/SDL_JoyBallEvent.3 @@ -0,0 +1,36 @@ +.TH "SDL_JoyBallEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoyBallEvent \- Joystick trackball motion event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 which; + Uint8 ball; + Sint16 xrel, yrel; +} SDL_JoyBallEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_JOYBALLMOTION\fP +.TP 20 +\fBwhich\fR +Joystick device index +.TP 20 +\fBball\fR +Joystick trackball index +.TP 20 +\fBxrel\fR, \fByrel\fR +The relative motion in the X/Y direction +.SH "DESCRIPTION" +.PP +\fBSDL_JoyBallEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_JOYBALLMOTION\fP is reported\&. +.PP +A \fBSDL_JOYBALLMOTION\fP event occurs when a user moves a trackball on the joystick\&. The field \fBwhich\fR is the index of the joystick that reported the event and \fBball\fR is the index of the trackball (for a more detailed explaination see the \fIJoystick section\fR)\&. Trackballs only return relative motion, this is the change in position on the ball since it was last polled (last cycle of the event loop) and it is stored in \fBxrel\fR and \fByrel\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fIJoystick Functions\fR, \fI\fBSDL_JoystickEventState\fP\fR, \fI\fBSDL_JoystickGetBall\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_JoyButtonEvent.3 b/SDL/docs/man3/SDL_JoyButtonEvent.3 new file mode 100644 index 0000000..b6aadca --- /dev/null +++ b/SDL/docs/man3/SDL_JoyButtonEvent.3 @@ -0,0 +1,36 @@ +.TH "SDL_JoyButtonEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoyButtonEvent \- Joystick button event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 which; + Uint8 button; + Uint8 state; +} SDL_JoyButtonEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_JOYBUTTONDOWN\fP or \fBSDL_JOYBUTTONUP\fP +.TP 20 +\fBwhich\fR +Joystick device index +.TP 20 +\fBbutton\fR +Joystick button index +.TP 20 +\fBstate\fR +\fBSDL_PRESSED\fP or \fBSDL_RELEASED\fP +.SH "DESCRIPTION" +.PP +\fBSDL_JoyButtonEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_JOYBUTTONDOWN\fP or \fBSDL_JOYBUTTONUP\fP is reported\&. +.PP +A \fBSDL_JOYBUTTONDOWN\fP or \fBSDL_JOYBUTTONUP\fP event occurs when ever a user presses or releases a button on a joystick\&. The field \fBwhich\fR is the index of the joystick that reported the event and \fBbutton\fR is the index of the button (for a more detailed explaination see the \fIJoystick section\fR)\&. \fBstate\fR is the current state or the button which is either \fBSDL_PRESSED\fP or \fBSDL_RELEASED\fP\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fIJoystick Functions\fR, \fI\fBSDL_JoystickEventState\fP\fR, \fI\fBSDL_JoystickGetButton\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_JoyHatEvent.3 b/SDL/docs/man3/SDL_JoyHatEvent.3 new file mode 100644 index 0000000..b3d1924 --- /dev/null +++ b/SDL/docs/man3/SDL_JoyHatEvent.3 @@ -0,0 +1,56 @@ +.TH "SDL_JoyHatEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoyHatEvent \- Joystick hat position change event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 which; + Uint8 hat; + Uint8 value; +} SDL_JoyHatEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_JOY\fP +.TP 20 +\fBwhich\fR +Joystick device index +.TP 20 +\fBhat\fR +Joystick hat index +.TP 20 +\fBvalue\fR +Hat position +.SH "DESCRIPTION" +.PP +\fBSDL_JoyHatEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_JOYHATMOTION\fP is reported\&. +.PP +A \fBSDL_JOYHATMOTION\fP event occurs when ever a user moves a hat on the joystick\&. The field \fBwhich\fR is the index of the joystick that reported the event and \fBhat\fR is the index of the hat (for a more detailed exlaination see the \fIJoystick section\fR)\&. \fBvalue\fR is the current position of the hat\&. It is a logically OR\&'d combination of the following values (whose meanings should be pretty obvious:) : +.IP "" 10 +\fBSDL_HAT_CENTERED\fP +.IP "" 10 +\fBSDL_HAT_UP\fP +.IP "" 10 +\fBSDL_HAT_RIGHT\fP +.IP "" 10 +\fBSDL_HAT_DOWN\fP +.IP "" 10 +\fBSDL_HAT_LEFT\fP +.PP +The following defines are also provided: +.IP "" 10 +\fBSDL_HAT_RIGHTUP\fP +.IP "" 10 +\fBSDL_HAT_RIGHTDOWN\fP +.IP "" 10 +\fBSDL_HAT_LEFTUP\fP +.IP "" 10 +\fBSDL_HAT_LEFTDOWN\fP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fIJoystick Functions\fR, \fI\fBSDL_JoystickEventState\fP\fR, \fI\fBSDL_JoystickGetHat\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_JoystickClose.3 b/SDL/docs/man3/SDL_JoystickClose.3 new file mode 100644 index 0000000..d72c22e --- /dev/null +++ b/SDL/docs/man3/SDL_JoystickClose.3 @@ -0,0 +1,15 @@ +.TH "SDL_JoystickClose" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickClose \- Closes a previously opened joystick +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_JoystickClose\fP\fR(\fBSDL_Joystick *joystick\fR); +.SH "DESCRIPTION" +.PP +Close a \fBjoystick\fR that was previously opened with \fI\fBSDL_JoystickOpen\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickOpen\fP\fR, \fI\fBSDL_JoystickOpened\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_JoystickEventState.3 b/SDL/docs/man3/SDL_JoystickEventState.3 new file mode 100644 index 0000000..2fdb5f4 --- /dev/null +++ b/SDL/docs/man3/SDL_JoystickEventState.3 @@ -0,0 +1,24 @@ +.TH "SDL_JoystickEventState" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickEventState \- Enable/disable joystick event polling +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_JoystickEventState\fP\fR(\fBint state\fR); +.SH "DESCRIPTION" +.PP +This function is used to enable or disable joystick event processing\&. With joystick event processing disabled you will have to update joystick states with \fI\fBSDL_JoystickUpdate\fP\fR and read the joystick information manually\&. \fBstate\fR is either \fBSDL_QUERY\fP, \fBSDL_ENABLE\fP or \fBSDL_IGNORE\fP\&. +.PP +.RS +\fBNote: +.PP +Joystick event handling is prefered +.RE +.SH "RETURN VALUE" +.PP +If \fBstate\fR is \fBSDL_QUERY\fP then the current state is returned, otherwise the new processing \fBstate\fR is returned\&. +.SH "SEE ALSO" +.PP +\fISDL Joystick Functions\fR, \fI\fBSDL_JoystickUpdate\fP\fR, \fI\fBSDL_JoyAxisEvent\fR\fR, \fI\fBSDL_JoyBallEvent\fR\fR, \fI\fBSDL_JoyButtonEvent\fR\fR, \fI\fBSDL_JoyHatEvent\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_JoystickGetAxis.3 b/SDL/docs/man3/SDL_JoystickGetAxis.3 new file mode 100644 index 0000000..2f2672b --- /dev/null +++ b/SDL/docs/man3/SDL_JoystickGetAxis.3 @@ -0,0 +1,32 @@ +.TH "SDL_JoystickGetAxis" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickGetAxis \- Get the current state of an axis +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSint16 \fBSDL_JoystickGetAxis\fP\fR(\fBSDL_Joystick *joystick, int axis\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_JoystickGetAxis\fP returns the current state of the given \fBaxis\fR on the given \fBjoystick\fR\&. +.PP +On most modern joysticks the X axis is usually represented by \fBaxis\fR 0 and the Y axis by \fBaxis\fR 1\&. The value returned by \fBSDL_JoystickGetAxis\fP is a signed integer (-32768 to 32768) representing the current position of the \fBaxis\fR, it maybe necessary to impose certain tolerances on these values to account for jitter\&. It is worth noting that some joysticks use axes 2 and 3 for extra buttons\&. +.SH "RETURN VALUE" +.PP +Returns a 16-bit signed integer representing the current position of the \fBaxis\fR\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSint16 x_move, y_move; +SDL_Joystick *joy1; +\&. +\&. +x_move=SDL_JoystickGetAxis(joy1, 0); +y_move=SDL_JoystickGetAxis(joy1, 1);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickNumAxes\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_JoystickGetBall.3 b/SDL/docs/man3/SDL_JoystickGetBall.3 new file mode 100644 index 0000000..655a4e3 --- /dev/null +++ b/SDL/docs/man3/SDL_JoystickGetBall.3 @@ -0,0 +1,37 @@ +.TH "SDL_JoystickGetBall" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickGetBall \- Get relative trackball motion +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_JoystickGetBall\fP\fR(\fBSDL_Joystick *joystick, int ball, int *dx, int *dy\fR); +.SH "DESCRIPTION" +.PP +Get the \fBball\fR axis change\&. +.PP +Trackballs can only return relative motion since the last call to \fBSDL_JoystickGetBall\fP, these motion deltas a placed into \fBdx\fR and \fBdy\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success or \fB-1\fR on failure +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWint delta_x, delta_y; +SDL_Joystick *joy; +\&. +\&. +\&. +SDL_JoystickUpdate(); +if(SDL_JoystickGetBall(joy, 0, &delta_x, &delta_y)==-1) + printf("TrackBall Read Error! +"); +printf("Trackball Delta- X:%d, Y:%d +", delta_x, delta_y);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickNumBalls\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_JoystickGetButton.3 b/SDL/docs/man3/SDL_JoystickGetButton.3 new file mode 100644 index 0000000..cbb395d --- /dev/null +++ b/SDL/docs/man3/SDL_JoystickGetButton.3 @@ -0,0 +1,18 @@ +.TH "SDL_JoystickGetButton" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickGetButton \- Get the current state of a given button on a given joystick +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_JoystickGetButton\fP\fR(\fBSDL_Joystick *joystick, int button\fR); +.SH "DESCRIPTION" +.PP +SDL_JoystickGetButton returns the current state of the given \fBbutton\fR on the given \fBjoystick\fR\&. +.SH "RETURN VALUE" +.PP +\fB1\fR if the button is pressed\&. Otherwise, \fB0\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickNumButtons\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_JoystickGetHat.3 b/SDL/docs/man3/SDL_JoystickGetHat.3 new file mode 100644 index 0000000..4c335c6 --- /dev/null +++ b/SDL/docs/man3/SDL_JoystickGetHat.3 @@ -0,0 +1,36 @@ +.TH "SDL_JoystickGetHat" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickGetHat \- Get the current state of a joystick hat +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_JoystickGetHat\fP\fR(\fBSDL_Joystick *joystick, int hat\fR); +.SH "DESCRIPTION" +.PP +SDL_JoystickGetHat returns the current state of the given \fBhat\fR on the given \fBjoystick\fR\&. +.SH "RETURN VALUE" +.PP +The current state is returned as a Uint8 which is defined as an OR\&'d combination of one or more of the following +.IP "" 10 +\fBSDL_HAT_CENTERED\fP +.IP "" 10 +\fBSDL_HAT_UP\fP +.IP "" 10 +\fBSDL_HAT_RIGHT\fP +.IP "" 10 +\fBSDL_HAT_DOWN\fP +.IP "" 10 +\fBSDL_HAT_LEFT\fP +.IP "" 10 +\fBSDL_HAT_RIGHTUP\fP +.IP "" 10 +\fBSDL_HAT_RIGHTDOWN\fP +.IP "" 10 +\fBSDL_HAT_LEFTUP\fP +.IP "" 10 +\fBSDL_HAT_LEFTDOWN\fP +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickNumHats\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_JoystickIndex.3 b/SDL/docs/man3/SDL_JoystickIndex.3 new file mode 100644 index 0000000..4ac8072 --- /dev/null +++ b/SDL/docs/man3/SDL_JoystickIndex.3 @@ -0,0 +1,18 @@ +.TH "SDL_JoystickIndex" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickIndex \- Get the index of an SDL_Joystick\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_JoystickIndex\fP\fR(\fBSDL_Joystick *joystick\fR); +.SH "DESCRIPTION" +.PP +Returns the index of a given \fBSDL_Joystick\fR structure\&. +.SH "RETURN VALUE" +.PP +Index number of the joystick\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickOpen\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_JoystickName.3 b/SDL/docs/man3/SDL_JoystickName.3 new file mode 100644 index 0000000..31da4e4 --- /dev/null +++ b/SDL/docs/man3/SDL_JoystickName.3 @@ -0,0 +1,32 @@ +.TH "SDL_JoystickName" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickName \- Get joystick name\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBconst char *\fBSDL_JoystickName\fP\fR(\fBint index\fR); +.SH "DESCRIPTION" +.PP +Get the implementation dependent name of joystick\&. The \fBindex\fR parameter refers to the N\&'th joystick on the system\&. +.SH "RETURN VALUE" +.PP +Returns a char pointer to the joystick name\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CW/* Print the names of all attached joysticks */ +int num_joy, i; +num_joy=SDL_NumJoysticks(); +printf("%d joysticks found +", num_joy); +for(i=0;i0){ + // Open joystick + joy=SDL_JoystickOpen(0); + + if(joy) + { + printf("Opened Joystick 0 +"); + printf("Name: %s +", SDL_JoystickName(0)); + printf("Number of Axes: %d +", SDL_JoystickNumAxes(joy)); + printf("Number of Buttons: %d +", SDL_JoystickNumButtons(joy)); + printf("Number of Balls: %d +", SDL_JoystickNumBalls(joy)); + } + else + printf("Couldn\&'t open Joystick 0 +"); + + // Close if opened + if(SDL_JoystickOpened(0)) + SDL_JoystickClose(joy); +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickClose\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_JoystickOpened.3 b/SDL/docs/man3/SDL_JoystickOpened.3 new file mode 100644 index 0000000..678bd48 --- /dev/null +++ b/SDL/docs/man3/SDL_JoystickOpened.3 @@ -0,0 +1,18 @@ +.TH "SDL_JoystickOpened" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickOpened \- Determine if a joystick has been opened +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_JoystickOpened\fP\fR(\fBint index\fR); +.SH "DESCRIPTION" +.PP +Determines whether a joystick has already been opened within the application\&. \fBindex\fR refers to the N\&'th joystick on the system\&. +.SH "RETURN VALUE" +.PP +Returns \fB1\fR if the joystick has been opened, or \fB0\fR if it has not\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickOpen\fP\fR, \fI\fBSDL_JoystickClose\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_JoystickUpdate.3 b/SDL/docs/man3/SDL_JoystickUpdate.3 new file mode 100644 index 0000000..dac4cae --- /dev/null +++ b/SDL/docs/man3/SDL_JoystickUpdate.3 @@ -0,0 +1,15 @@ +.TH "SDL_JoystickUpdate" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickUpdate \- Updates the state of all joysticks +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_JoystickUpdate\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Updates the state(position, buttons, etc\&.) of all open joysticks\&. If joystick events have been enabled with \fI\fBSDL_JoystickEventState\fP\fR then this is called automatically in the event loop\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickEventState\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_KeyboardEvent.3 b/SDL/docs/man3/SDL_KeyboardEvent.3 new file mode 100644 index 0000000..aa1095b --- /dev/null +++ b/SDL/docs/man3/SDL_KeyboardEvent.3 @@ -0,0 +1,38 @@ +.TH "SDL_KeyboardEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_KeyboardEvent \- Keyboard event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 state; + SDL_keysym keysym; +} SDL_KeyboardEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_KEYDOWN\fP or \fBSDL_KEYUP\fP +.TP 20 +\fBstate\fR +\fBSDL_PRESSED\fP or \fBSDL_RELEASED\fP +.TP 20 +\fBkeysym\fR +Contains key press information +.SH "DESCRIPTION" +.PP +\fBSDL_KeyboardEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_KEYDOWN\fP or \fBSDL_KEYUP\fP is reported\&. +.PP +The \fBtype\fR and \fBstate\fR actually report the same information, they just use different values to do it! A keyboard event occurs when a key is released (\fBtype\fR=\fBSDK_KEYUP\fP or \fBstate\fR=\fBSDL_RELEASED\fP) and when a key is pressed (\fBtype\fR=\fBSDL_KEYDOWN\fP or \fBstate\fR=\fBSDL_PRESSED\fP)\&. The information on what key was pressed or released is in the \fI\fBkeysym\fR\fR structure\&. +.PP +.RS +\fBNote: +.PP +Repeating \fBSDL_KEYDOWN\fP events will occur if key repeat is enabled (see \fI\fBSDL_EnableKeyRepeat\fP\fR)\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_keysym\fR\fR, \fI\fBSDL_EnableKeyRepeat\fP\fR, \fI\fBSDL_EnableUNICODE\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_KillThread.3 b/SDL/docs/man3/SDL_KillThread.3 new file mode 100644 index 0000000..ef8f2ae --- /dev/null +++ b/SDL/docs/man3/SDL_KillThread.3 @@ -0,0 +1,16 @@ +.TH "SDL_KillThread" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_KillThread \- Gracelessly terminates the thread\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBvoid \fBSDL_KillThread\fP\fR(\fBSDL_Thread *thread\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_KillThread\fP gracelessly terminates the thread associated with \fBthread\fR\&. If possible, you should use some other form of IPC to signal the thread to quit\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateThread\fP\fR, \fI\fBSDL_WaitThread\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_ListModes.3 b/SDL/docs/man3/SDL_ListModes.3 new file mode 100644 index 0000000..d8a1f76 --- /dev/null +++ b/SDL/docs/man3/SDL_ListModes.3 @@ -0,0 +1,53 @@ +.TH "SDL_ListModes" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ListModes \- Returns a pointer to an array of available screen dimensions for the given format and video flags +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Rect **\fBSDL_ListModes\fP\fR(\fBSDL_PixelFormat *format, Uint32 flags\fR); +.SH "DESCRIPTION" +.PP +Return a pointer to an array of available screen dimensions for the given format and video flags, sorted largest to smallest\&. Returns \fBNULL\fP if there are no dimensions available for a particular format, or \fB-1\fR if any dimension is okay for the given format\&. +.PP +If \fBformat\fR is \fBNULL\fP, the mode list will be for the format returned by \fISDL_GetVideoInfo()\fR->\fBvfmt\fR\&. The \fBflag\fR parameter is an OR\&'d combination of \fIsurface\fR flags\&. The flags are the same as those used \fI\fBSDL_SetVideoMode\fP\fR and they play a strong role in deciding what modes are valid\&. For instance, if you pass \fBSDL_HWSURFACE\fP as a flag only modes that support hardware video surfaces will be returned\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_Rect **modes; +int i; +\&. +\&. +\&. + +/* Get available fullscreen/hardware modes */ +modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE); + +/* Check is there are any modes available */ +if(modes == (SDL_Rect **)0){ + printf("No modes available! +"); + exit(-1); +} + +/* Check if or resolution is restricted */ +if(modes == (SDL_Rect **)-1){ + printf("All resolutions available\&. +"); +} +else{ + /* Print valid modes */ + printf("Available Modes +"); + for(i=0;modes[i];++i) + printf(" %d x %d +", modes[i]->w, modes[i]->h); +} +\&. +\&.\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_GetVideoInfo\fP\fR, \fI\fBSDL_Rect\fR\fR, \fI\fBSDL_PixelFormat\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_LoadBMP.3 b/SDL/docs/man3/SDL_LoadBMP.3 new file mode 100644 index 0000000..05e8e0a --- /dev/null +++ b/SDL/docs/man3/SDL_LoadBMP.3 @@ -0,0 +1,18 @@ +.TH "SDL_LoadBMP" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_LoadBMP \- Load a Windows BMP file into an SDL_Surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_LoadBMP\fP\fR(\fBconst char *file\fR); +.SH "DESCRIPTION" +.PP +Loads a surface from a named Windows BMP file\&. +.SH "RETURN VALUE" +.PP +Returns the new surface, or \fBNULL\fP if there was an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SaveBMP\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_LoadWAV.3 b/SDL/docs/man3/SDL_LoadWAV.3 new file mode 100644 index 0000000..632d334 --- /dev/null +++ b/SDL/docs/man3/SDL_LoadWAV.3 @@ -0,0 +1,42 @@ +.TH "SDL_LoadWAV" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_LoadWAV \- Load a WAVE file +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_AudioSpec *\fBSDL_LoadWAV\fP\fR(\fBconst char *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_LoadWAV\fP This function loads a WAVE \fBfile\fR into memory\&. +.PP +If this function succeeds, it returns the given \fI\fBSDL_AudioSpec\fP\fR, filled with the audio data format of the wave data, and sets \fBaudio_buf\fR to a \fBmalloc\fP\&'d buffer containing the audio data, and sets \fBaudio_len\fR to the length of that audio buffer, in bytes\&. You need to free the audio buffer with \fI\fBSDL_FreeWAV\fP\fR when you are done with it\&. +.PP +This function returns \fBNULL\fP and sets the SDL error message if the wave file cannot be opened, uses an unknown data format, or is corrupt\&. Currently raw, MS-ADPCM and IMA-ADPCM WAVE files are supported\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_AudioSpec wav_spec; +Uint32 wav_length; +Uint8 *wav_buffer; + +/* Load the WAV */ +if( SDL_LoadWAV("test\&.wav", &wav_spec, &wav_buffer, &wav_length) == NULL ){ + fprintf(stderr, "Could not open test\&.wav: %s +", SDL_GetError()); + exit(-1); +} +\&. +\&. +\&. +/* Do stuff with the WAV */ +\&. +\&. +/* Free It */ +SDL_FreeWAV(wav_buffer);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_AudioSpec\fR\fR, \fI\fBSDL_OpenAudio\fP\fR, \fI\fBSDL_FreeWAV\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_LockAudio.3 b/SDL/docs/man3/SDL_LockAudio.3 new file mode 100644 index 0000000..002bd2f --- /dev/null +++ b/SDL/docs/man3/SDL_LockAudio.3 @@ -0,0 +1,15 @@ +.TH "SDL_LockAudio" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_LockAudio \- Lock out the callback function +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_LockAudio\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +The lock manipulated by these functions protects the callback function\&. During a LockAudio period, you can be guaranteed that the callback function is not running\&. Do not call these from the callback function or you will cause deadlock\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_OpenAudio\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_LockSurface.3 b/SDL/docs/man3/SDL_LockSurface.3 new file mode 100644 index 0000000..2b09757 --- /dev/null +++ b/SDL/docs/man3/SDL_LockSurface.3 @@ -0,0 +1,48 @@ +.TH "SDL_LockSurface" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_LockSurface \- Lock a surface for directly access\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_LockSurface\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_LockSurface\fP sets up a surface for directly accessing the pixels\&. Between calls to \fBSDL_LockSurface\fP and \fBSDL_UnlockSurface\fP, you can write to and read from \fBsurface->\fBpixels\fR\fR, using the pixel format stored in \fBsurface->\fBformat\fR\fR\&. Once you are done accessing the surface, you should use \fBSDL_UnlockSurface\fP to release it\&. +.PP +Not all surfaces require locking\&. If \fBSDL_MUSTLOCK\fP(\fBsurface\fR) evaluates to \fB0\fR, then you can read and write to the surface at any time, and the pixel format of the surface will not change\&. +.PP +No operating system or library calls should be made between lock/unlock pairs, as critical system locks may be held during this time\&. +.PP +It should be noted, that since SDL 1\&.1\&.8 surface locks are recursive\&. This means that you can lock a surface multiple times, but each lock must have a match unlock\&. +.PP +.nf +\f(CW \&. + \&. + SDL_LockSurface( surface ); + \&. + /* Surface is locked */ + /* Direct pixel access on surface here */ + \&. + SDL_LockSurface( surface ); + \&. + /* More direct pixel access on surface */ + \&. + SDL_UnlockSurface( surface ); + /* Surface is still locked */ + /* Note: Is versions < 1\&.1\&.8, the surface would have been */ + /* no longer locked at this stage */ + \&. + SDL_UnlockSurface( surface ); + /* Surface is now unlocked */ + \&. + \&.\fR +.fi +.PP +.SH "RETURN VALUE" +.PP +\fBSDL_LockSurface\fP returns \fB0\fR, or \fB-1\fR if the surface couldn\&'t be locked\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_UnlockSurface\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_LockYUVOverlay.3 b/SDL/docs/man3/SDL_LockYUVOverlay.3 new file mode 100644 index 0000000..8a0b622 --- /dev/null +++ b/SDL/docs/man3/SDL_LockYUVOverlay.3 @@ -0,0 +1,18 @@ +.TH "SDL_LockYUVOverlay" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_LockYUVOverlay \- Lock an overlay +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_LockYUVOverlay\fP\fR(\fBSDL_Overlay *overlay\fR); +.SH "DESCRIPTION" +.PP +Much the same as \fI\fBSDL_LockSurface\fP\fR, \fBSDL_LockYUVOverlay\fP locks the \fI\fBoverlay\fR\fR for direct access to pixel data\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_UnlockYUVOverlay\fP\fR, \fI\fBSDL_CreateYUVOverlay\fP\fR, \fI\fBSDL_Overlay\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_MapRGB.3 b/SDL/docs/man3/SDL_MapRGB.3 new file mode 100644 index 0000000..11f0254 --- /dev/null +++ b/SDL/docs/man3/SDL_MapRGB.3 @@ -0,0 +1,22 @@ +.TH "SDL_MapRGB" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_MapRGB \- Map a RGB color value to a pixel format\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint32 \fBSDL_MapRGB\fP\fR(\fBSDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b\fR); +.SH "DESCRIPTION" +.PP +Maps the RGB color value to the specified pixel format and returns the pixel value as a 32-bit int\&. +.PP +If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned\&. +.PP +If the specified pixel format has an alpha component it will be returned as all 1 bits (fully opaque)\&. +.SH "RETURN VALUE" +.PP +A pixel value best approximating the given RGB color value for a given pixel format\&. If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e\&.g\&., with a 16-bpp format the return value can be assigned to a \fBUint16\fP, and similarly a \fBUint8\fP for an 8-bpp format)\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetRGB\fP\fR, \fI\fBSDL_GetRGBA\fP\fR, \fI\fBSDL_MapRGBA\fP\fR, \fI\fBSDL_PixelFormat\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_MapRGBA.3 b/SDL/docs/man3/SDL_MapRGBA.3 new file mode 100644 index 0000000..ff44e67 --- /dev/null +++ b/SDL/docs/man3/SDL_MapRGBA.3 @@ -0,0 +1,22 @@ +.TH "SDL_MapRGBA" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_MapRGBA \- Map a RGBA color value to a pixel format\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint32 \fBSDL_MapRGBA\fP\fR(\fBSDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b, Uint8 a\fR); +.SH "DESCRIPTION" +.PP +Maps the RGBA color value to the specified pixel format and returns the pixel value as a 32-bit int\&. +.PP +If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned\&. +.PP +If the specified pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette)\&. +.SH "RETURN VALUE" +.PP +A pixel value best approximating the given RGBA color value for a given pixel format\&. If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e\&.g\&., with a 16-bpp format the return value can be assigned to a \fBUint16\fP, and similarly a \fBUint8\fP for an 8-bpp format)\&. +.SH "SEE ALSO" +.PP +\fISDL_GetRGB\fR, \fISDL_GetRGBA\fR, \fISDL_MapRGB\fR, \fISDL_PixelFormat\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_MixAudio.3 b/SDL/docs/man3/SDL_MixAudio.3 new file mode 100644 index 0000000..12bf960 --- /dev/null +++ b/SDL/docs/man3/SDL_MixAudio.3 @@ -0,0 +1,21 @@ +.TH "SDL_MixAudio" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_MixAudio \- Mix audio data +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_MixAudio\fP\fR(\fBUint8 *dst, Uint8 *src, Uint32 len, int volume\fR); +.SH "DESCRIPTION" +.PP +This function takes two audio buffers of \fBlen\fR bytes each of the playing audio format and mixes them, performing addition, volume adjustment, and overflow clipping\&. The \fBvolume\fR ranges from 0 to \fBSDL_MIX_MAXVOLUME\fP and should be set to the maximum value for full audio volume\&. Note this does not change hardware volume\&. This is provided for convenience -- you can mix your own audio data\&. +.PP +.RS +\fBNote: +.PP +Do not use this function for mixing together more than two streams of sample data\&. The output from repeated application of this function may be distorted by clipping, because there is no accumulator with greater range than the input (not to mention this being an inefficient way of doing it)\&. Use mixing functions from SDL_mixer, OpenAL, or write your own mixer instead\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_OpenAudio\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_MouseButtonEvent.3 b/SDL/docs/man3/SDL_MouseButtonEvent.3 new file mode 100644 index 0000000..18e3bd9 --- /dev/null +++ b/SDL/docs/man3/SDL_MouseButtonEvent.3 @@ -0,0 +1,36 @@ +.TH "SDL_MouseButtonEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_MouseButtonEvent \- Mouse button event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 button; + Uint8 state; + Uint16 x, y; +} SDL_MouseButtonEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_MOUSEBUTTONDOWN\fP or \fBSDL_MOUSEBUTTONUP\fP +.TP 20 +\fBbutton\fR +The mouse button index (SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT) +.TP 20 +\fBstate\fR +\fBSDL_PRESSED\fP or \fBSDL_RELEASED\fP +.TP 20 +\fBx\fR, \fBy\fR +The X/Y coordinates of the mouse at press/release time +.SH "DESCRIPTION" +.PP +\fBSDL_MouseButtonEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_MOUSEBUTTONDOWN\fP or \fBSDL_MOUSEBUTTONUP\fP is reported\&. +.PP +When a mouse button press or release is detected then number of the button pressed (from 1 to 255, with 1 usually being the left button and 2 the right) is placed into \fBbutton\fR, the position of the mouse when this event occured is stored in the \fBx\fR and the \fBy\fR fields\&. Like \fI\fBSDL_KeyboardEvent\fR\fR, information on whether the event was a press or a release event is stored in both the \fBtype\fR and \fBstate\fR fields, but this should be obvious\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_MouseMotionEvent\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_MouseMotionEvent.3 b/SDL/docs/man3/SDL_MouseMotionEvent.3 new file mode 100644 index 0000000..455c705 --- /dev/null +++ b/SDL/docs/man3/SDL_MouseMotionEvent.3 @@ -0,0 +1,38 @@ +.TH "SDL_MouseMotionEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_MouseMotionEvent \- Mouse motion event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 state; + Uint16 x, y; + Sint16 xrel, yrel; +} SDL_MouseMotionEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_MOUSEMOTION\fP +.TP 20 +\fBstate\fR +The current button state +.TP 20 +\fBx\fR, \fBy\fR +The X/Y coordinates of the mouse +.TP 20 +\fBxrel\fR, \fByrel\fR +Relative motion in the X/Y direction +.SH "DESCRIPTION" +.PP +\fBSDL_MouseMotionEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_MOUSEMOTION\fP is reported\&. +.PP +Simply put, a \fBSDL_MOUSEMOTION\fP type event occurs when a user moves the mouse within the application window or when \fI\fBSDL_WarpMouse\fP\fR is called\&. Both the absolute (\fBx\fR and \fBy\fR) and relative (\fBxrel\fR and \fByrel\fR) coordinates are reported along with the current button states (\fBstate\fR)\&. The button state can be interpreted using the \fBSDL_BUTTON\fP macro (see \fI\fBSDL_GetMouseState\fP\fR)\&. +.PP +If the cursor is hidden (\fI\fBSDL_ShowCursor\fP(0)\fR) and the input is grabbed (\fI\fBSDL_WM_GrabInput\fP(SDL_GRAB_ON)\fR), then the mouse will give relative motion events even when the cursor reaches the edge fo the screen\&. This is currently only implemented on Windows and Linux/Unix-a-likes\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_MouseButtonEvent\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_NumJoysticks.3 b/SDL/docs/man3/SDL_NumJoysticks.3 new file mode 100644 index 0000000..199c3fb --- /dev/null +++ b/SDL/docs/man3/SDL_NumJoysticks.3 @@ -0,0 +1,18 @@ +.TH "SDL_NumJoysticks" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_NumJoysticks \- Count available joysticks\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_NumJoysticks\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Counts the number of joysticks attached to the system\&. +.SH "RETURN VALUE" +.PP +Returns the number of attached joysticks +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickName\fP\fR, \fI\fBSDL_JoystickOpen\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_OpenAudio.3 b/SDL/docs/man3/SDL_OpenAudio.3 new file mode 100644 index 0000000..8a2b532 --- /dev/null +++ b/SDL/docs/man3/SDL_OpenAudio.3 @@ -0,0 +1,97 @@ +.TH "SDL_OpenAudio" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_OpenAudio \- Opens the audio device with the desired parameters\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_OpenAudio\fP\fR(\fBSDL_AudioSpec *desired, SDL_AudioSpec *obtained\fR); +.SH "DESCRIPTION" +.PP +This function opens the audio device with the \fBdesired\fR parameters, and returns 0 if successful, placing the actual hardware parameters in the structure pointed to by \fBobtained\fR\&. If \fBobtained\fR is NULL, the audio data passed to the callback function will be guaranteed to be in the requested format, and will be automatically converted to the hardware audio format if necessary\&. This function returns -1 if it failed to open the audio device, or couldn\&'t set up the audio thread\&. +.PP +To open the audio device a \fBdesired\fR \fI\fBSDL_AudioSpec\fR\fR must be created\&. +.PP +.nf +\f(CWSDL_AudioSpec *desired; +\&. +\&. +desired=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec));\fR +.fi +.PP + You must then fill this structure with your desired audio specifications\&. +.IP "\fBdesired\fR->\fBfreq\fR" 10The desired audio frequency in samples-per-second\&. +.IP "\fBdesired\fR->\fBformat\fR" 10The desired audio format (see \fI\fBSDL_AudioSpec\fR\fR) +.IP "\fBdesired\fR->\fBsamples\fR" 10The desired size of the audio buffer in samples\&. This number should be a power of two, and may be adjusted by the audio driver to a value more suitable for the hardware\&. Good values seem to range between 512 and 8192 inclusive, depending on the application and CPU speed\&. Smaller values yield faster response time, but can lead to underflow if the application is doing heavy processing and cannot fill the audio buffer in time\&. A stereo sample consists of both right and left channels in LR ordering\&. Note that the number of samples is directly related to time by the following formula: ms = (samples*1000)/freq +.IP "\fBdesired\fR->\fBcallback\fR" 10This should be set to a function that will be called when the audio device is ready for more data\&. It is passed a pointer to the audio buffer, and the length in bytes of the audio buffer\&. This function usually runs in a separate thread, and so you should protect data structures that it accesses by calling \fI\fBSDL_LockAudio\fP\fR and \fI\fBSDL_UnlockAudio\fP\fR in your code\&. The callback prototype is: +.PP +.nf +\f(CWvoid callback(void *userdata, Uint8 *stream, int len);\fR +.fi +.PP + \fBuserdata\fR is the pointer stored in \fBuserdata\fR field of the \fBSDL_AudioSpec\fR\&. \fBstream\fR is a pointer to the audio buffer you want to fill with information and \fBlen\fR is the length of the audio buffer in bytes\&. +.IP "\fBdesired\fR->\fBuserdata\fR" 10This pointer is passed as the first parameter to the \fBcallback\fP function\&. +.PP +\fBSDL_OpenAudio\fP reads these fields from the \fBdesired\fR \fBSDL_AudioSpec\fR structure pass to the function and attempts to find an audio configuration matching your \fBdesired\fR\&. As mentioned above, if the \fBobtained\fR parameter is \fBNULL\fP then SDL with convert from your \fBdesired\fR audio settings to the hardware settings as it plays\&. +.PP +If \fBobtained\fR is \fBNULL\fP then the \fBdesired\fR \fBSDL_AudioSpec\fR is your working specification, otherwise the \fBobtained\fR \fBSDL_AudioSpec\fR becomes the working specification and the \fBdesirec\fR specification can be deleted\&. The data in the working specification is used when building \fBSDL_AudioCVT\fR\&'s for converting loaded data to the hardware format\&. +.PP +\fBSDL_OpenAudio\fP calculates the \fBsize\fR and \fBsilence\fR fields for both the \fBdesired\fR and \fBobtained\fR specifications\&. The \fBsize\fR field stores the total size of the audio buffer in bytes, while the \fBsilence\fR stores the value used to represent silence in the audio buffer +.PP +The audio device starts out playing \fBsilence\fR when it\&'s opened, and should be enabled for playing by calling \fI\fBSDL_PauseAudio\fP(\fB0\fR)\fR when you are ready for your audio \fBcallback\fR function to be called\&. Since the audio driver may modify the requested \fBsize\fR of the audio buffer, you should allocate any local mixing buffers after you open the audio device\&. +.SH "EXAMPLES" +.PP +.nf +\f(CW/* Prototype of our callback function */ +void my_audio_callback(void *userdata, Uint8 *stream, int len); + +/* Open the audio device */ +SDL_AudioSpec *desired, *obtained; +SDL_AudioSpec *hardware_spec; + +/* Allocate a desired SDL_AudioSpec */ +desired=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec)); + +/* Allocate space for the obtained SDL_AudioSpec */ +obtained=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec)); + +/* 22050Hz - FM Radio quality */ +desired->freq=22050; + +/* 16-bit signed audio */ +desired->format=AUDIO_S16LSB; + +/* Mono */ +desired->channels=0; + +/* Large audio buffer reduces risk of dropouts but increases response time */ +desired->samples=8192; + +/* Our callback function */ +desired->callback=my_audio_callback; + +desired->userdata=NULL; + +/* Open the audio device */ +if ( SDL_OpenAudio(desired, obtained) < 0 ){ + fprintf(stderr, "Couldn\&'t open audio: %s +", SDL_GetError()); + exit(-1); +} +/* desired spec is no longer needed */ +free(desired); +hardware_spec=obtained; +\&. +\&. +/* Prepare callback for playing */ +\&. +\&. +\&. +/* Start playing */ +SDL_PauseAudio(0);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_AudioSpec\fP\fR, \fI\fBSDL_LockAudio\fP\fR, \fI\fBSDL_UnlockAudio\fP\fR, \fI\fBSDL_PauseAudio\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_Overlay.3 b/SDL/docs/man3/SDL_Overlay.3 new file mode 100644 index 0000000..443bdc5 --- /dev/null +++ b/SDL/docs/man3/SDL_Overlay.3 @@ -0,0 +1,52 @@ +.TH "SDL_Overlay" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Overlay \- YUV video overlay +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint32 format; + int w, h; + int planes; + Uint16 *pitches; + Uint8 **pixels; + Uint32 hw_overlay:1; +} SDL_Overlay;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBformat\fR +Overlay format (see below) +.TP 20 +\fBw, h\fR +Width and height of overlay +.TP 20 +\fBplanes\fR +Number of planes in the overlay\&. Usually either 1 or 3 +.TP 20 +\fBpitches\fR +An array of pitches, one for each plane\&. Pitch is the length of a row in bytes\&. +.TP 20 +\fBpixels\fR +An array of pointers to teh data of each plane\&. The overlay should be locked before these pointers are used\&. +.TP 20 +\fBhw_overlay\fR +This will be set to 1 if the overlay is hardware accelerated\&. +.SH "DESCRIPTION" +.PP +A \fBSDL_Overlay\fR is similar to a \fI\fBSDL_Surface\fR\fR except it stores a YUV overlay\&. All the fields are read only, except for \fBpixels\fR which should be \fIlocked\fR before use\&. The \fBformat\fR field stores the format of the overlay which is one of the following: +.PP +.nf +\f(CW#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U */ +#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V */ +#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 */ +#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 */ +#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 */\fR +.fi +.PP + More information on YUV formats can be found at \fIhttp://www\&.webartz\&.com/fourcc/indexyuv\&.htm (link to URL http://www.webartz.com/fourcc/indexyuv.htm) \fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateYUVOverlay\fP\fR, \fI\fBSDL_LockYUVOverlay\fP\fR, \fI\fBSDL_UnlockYUVOverlay\fP\fR, \fI\fBSDL_FreeYUVOverlay\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_Palette.3 b/SDL/docs/man3/SDL_Palette.3 new file mode 100644 index 0000000..45cf985 --- /dev/null +++ b/SDL/docs/man3/SDL_Palette.3 @@ -0,0 +1,26 @@ +.TH "SDL_Palette" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Palette \- Color palette for 8-bit pixel formats +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + int ncolors; + SDL_Color *colors; +} SDL_Palette;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBncolors\fR +Number of colors used in this palette +.TP 20 +\fBcolors\fR +Pointer to \fI\fBSDL_Color\fR\fR structures that make up the palette\&. +.SH "DESCRIPTION" +.PP +Each pixel in an 8-bit surface is an index into the \fBcolors\fR field of the \fBSDL_Palette\fR structure store in \fI\fBSDL_PixelFormat\fR\fR\&. A \fBSDL_Palette\fR should never need to be created manually\&. It is automatically created when SDL allocates a \fBSDL_PixelFormat\fR for a surface\&. The colors values of a \fI\fBSDL_Surface\fR\fRs palette can be set with the \fI\fBSDL_SetColors\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Color\fR\fR, \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_SetColors\fP\fR \fI\fBSDL_SetPalette\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_PauseAudio.3 b/SDL/docs/man3/SDL_PauseAudio.3 new file mode 100644 index 0000000..9cc54c0 --- /dev/null +++ b/SDL/docs/man3/SDL_PauseAudio.3 @@ -0,0 +1,15 @@ +.TH "SDL_PauseAudio" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PauseAudio \- Pauses and unpauses the audio callback processing +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_PauseAudio\fP\fR(\fBint pause_on\fR); +.SH "DESCRIPTION" +.PP +This function pauses and unpauses the audio callback processing\&. It should be called with \fBpause_on\fR=0 after opening the audio device to start playing sound\&. This is so you can safely initialize data for your callback function after opening the audio device\&. Silence will be written to the audio device during the pause\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetAudioStatus\fP\fR, \fI\fBSDL_OpenAudio\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_PeepEvents.3 b/SDL/docs/man3/SDL_PeepEvents.3 new file mode 100644 index 0000000..fda4055 --- /dev/null +++ b/SDL/docs/man3/SDL_PeepEvents.3 @@ -0,0 +1,26 @@ +.TH "SDL_PeepEvents" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PeepEvents \- Checks the event queue for messages and optionally returns them\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_PeepEvents\fP\fR(\fBSDL_Event *events, int numevents, SDL_eventaction action, Uint32 mask\fR); +.SH "DESCRIPTION" +.PP +Checks the event queue for messages and optionally returns them\&. +.PP +If \fBaction\fR is \fBSDL_ADDEVENT\fP, up to \fBnumevents\fR events will be added to the back of the event queue\&. +.PP +If \fBaction\fR is \fBSDL_PEEKEVENT\fP, up to \fBnumevents\fR events at the front of the event queue, matching \fI\fBmask\fR\fR, will be returned and will not be removed from the queue\&. +.PP +If \fBaction\fR is \fBSDL_GETEVENT\fP, up to \fBnumevents\fR events at the front of the event queue, matching \fI\fBmask\fR\fR, will be returned and will be removed from the queue\&. +.PP +This function is thread-safe\&. +.SH "RETURN VALUE" +.PP +This function returns the number of events actually stored, or \fB-1\fR if there was an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_PollEvent\fP\fR, \fI\fBSDL_PushEvent\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_PixelFormat.3 b/SDL/docs/man3/SDL_PixelFormat.3 new file mode 100644 index 0000000..97755c0 --- /dev/null +++ b/SDL/docs/man3/SDL_PixelFormat.3 @@ -0,0 +1,140 @@ +.TH "SDL_PixelFormat" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PixelFormat \- Stores surface format information +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct SDL_PixelFormat { + SDL_Palette *palette; + Uint8 BitsPerPixel; + Uint8 BytesPerPixel; + Uint8 Rloss, Gloss, Bloss, Aloss; + Uint8 Rshift, Gshift, Bshift, Ashift; + Uint32 Rmask, Gmask, Bmask, Amask; + Uint32 colorkey; + Uint8 alpha; +} SDL_PixelFormat;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBpalette\fR +Pointer to the \fIpalette\fR, or \fBNULL\fP if the \fBBitsPerPixel\fR>8 +.TP 20 +\fBBitsPerPixel\fR +The number of bits used to represent each pixel in a surface\&. Usually 8, 16, 24 or 32\&. +.TP 20 +\fBBytesPerPixel\fR +The number of bytes used to represent each pixel in a surface\&. Usually one to four\&. +.TP 20 +\fB[RGBA]mask\fR +Binary mask used to retrieve individual color values +.TP 20 +\fB[RGBA]loss\fR +Precision loss of each color component (2^[RGBA]loss) +.TP 20 +\fB[RGBA]shift\fR +Binary left shift of each color component in the pixel value +.TP 20 +\fBcolorkey\fR +Pixel value of transparent pixels +.TP 20 +\fBalpha\fR +Overall surface alpha value +.SH "DESCRIPTION" +.PP +A \fBSDL_PixelFormat\fR describes the format of the pixel data stored at the \fBpixels\fR field of a \fI\fBSDL_Surface\fR\fR\&. Every surface stores a \fBSDL_PixelFormat\fR in the \fBformat\fR field\&. +.PP +If you wish to do pixel level modifications on a surface, then understanding how SDL stores its color information is essential\&. +.PP +8-bit pixel formats are the easiest to understand\&. Since its an 8-bit format, we have 8 \fBBitsPerPixel\fR and 1 \fBBytesPerPixel\fR\&. Since \fBBytesPerPixel\fR is 1, all pixels are represented by a Uint8 which contains an index into \fBpalette\fR->\fBcolors\fR\&. So, to determine the color of a pixel in a 8-bit surface: we read the color index from \fBsurface\fR->\fBpixels\fR and we use that index to read the \fI\fBSDL_Color\fR\fR structure from \fBsurface\fR->\fBformat\fR->\fBpalette\fR->\fBcolors\fR\&. Like so: +.PP +.nf +\f(CWSDL_Surface *surface; +SDL_PixelFormat *fmt; +SDL_Color *color; +Uint8 index; + +\&. +\&. + +/* Create surface */ +\&. +\&. +fmt=surface->format; + +/* Check the bitdepth of the surface */ +if(fmt->BitsPerPixel!=8){ + fprintf(stderr, "Not an 8-bit surface\&. +"); + return(-1); +} + +/* Lock the surface */ +SDL_LockSurface(surface); + +/* Get the topleft pixel */ +index=*(Uint8 *)surface->pixels; +color=fmt->palette->colors[index]; + +/* Unlock the surface */ +SDL_UnlockSurface(surface); +printf("Pixel Color-> Red: %d, Green: %d, Blue: %d\&. Index: %d +", + color->r, color->g, color->b, index); +\&. +\&.\fR +.fi +.PP +.PP +Pixel formats above 8-bit are an entirely different experience\&. They are considered to be "TrueColor" formats and the color information is stored in the pixels themselves, not in a palette\&. The mask, shift and loss fields tell us how the color information is encoded\&. The mask fields allow us to isolate each color component, the shift fields tell us the number of bits to the right of each component in the pixel value and the loss fields tell us the number of bits lost from each component when packing 8-bit color component in a pixel\&. +.PP +.nf +\f(CW/* Extracting color components from a 32-bit color value */ +SDL_PixelFormat *fmt; +SDL_Surface *surface; +Uint32 temp, pixel; +Uint8 red, green, blue, alpha; +\&. +\&. +\&. +fmt=surface->format; +SDL_LockSurface(surface); +pixel=*((Uint32*)surface->pixels); +SDL_UnlockSurface(surface); + +/* Get Red component */ +temp=pixel&fmt->Rmask; /* Isolate red component */ +temp=temp>>fmt->Rshift;/* Shift it down to 8-bit */ +temp=temp<Rloss; /* Expand to a full 8-bit number */ +red=(Uint8)temp; + +/* Get Green component */ +temp=pixel&fmt->Gmask; /* Isolate green component */ +temp=temp>>fmt->Gshift;/* Shift it down to 8-bit */ +temp=temp<Gloss; /* Expand to a full 8-bit number */ +green=(Uint8)temp; + +/* Get Blue component */ +temp=pixel&fmt->Bmask; /* Isolate blue component */ +temp=temp>>fmt->Bshift;/* Shift it down to 8-bit */ +temp=temp<Bloss; /* Expand to a full 8-bit number */ +blue=(Uint8)temp; + +/* Get Alpha component */ +temp=pixel&fmt->Amask; /* Isolate alpha component */ +temp=temp>>fmt->Ashift;/* Shift it down to 8-bit */ +temp=temp<Aloss; /* Expand to a full 8-bit number */ +alpha=(Uint8)temp; + +printf("Pixel Color -> R: %d, G: %d, B: %d, A: %d +", red, green, blue, alpha); +\&. +\&. +\&.\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Surface\fR\fR, \fI\fBSDL_MapRGB\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_PollEvent.3 b/SDL/docs/man3/SDL_PollEvent.3 new file mode 100644 index 0000000..083098f --- /dev/null +++ b/SDL/docs/man3/SDL_PollEvent.3 @@ -0,0 +1,44 @@ +.TH "SDL_PollEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PollEvent \- Polls for currently pending events\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_PollEvent\fP\fR(\fBSDL_Event *event\fR); +.SH "DESCRIPTION" +.PP +Polls for currently pending events, and returns \fB1\fR if there are any pending events, or \fB0\fR if there are none available\&. +.PP +If \fBevent\fR is not \fBNULL\fP, the next event is removed from the queue and stored in that area\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_Event event; /* Event structure */ + +\&. +\&. +\&. +/* Check for events */ +while(SDL_PollEvent(&event)){ /* Loop until there are no events left on the queue */ + switch(event\&.type){ /* Process the appropiate event type */ + case SDL_KEYDOWN: /* Handle a KEYDOWN event */ + printf("Oh! Key press +"); + break; + case SDL_MOUSEMOTION: + \&. + \&. + \&. + default: /* Report an unhandled event */ + printf("I don\&'t know what this event is! +"); + } +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_WaitEvent\fP\fR, \fI\fBSDL_PeepEvents\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_PumpEvents.3 b/SDL/docs/man3/SDL_PumpEvents.3 new file mode 100644 index 0000000..b2a8ffd --- /dev/null +++ b/SDL/docs/man3/SDL_PumpEvents.3 @@ -0,0 +1,23 @@ +.TH "SDL_PumpEvents" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PumpEvents \- Pumps the event loop, gathering events from the input devices\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_PumpEvents\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Pumps the event loop, gathering events from the input devices\&. +.PP +\fBSDL_PumpEvents\fP gathers all the pending input information from devices and places it on the event queue\&. Without calls to \fBSDL_PumpEvents\fP no events would ever be placed on the queue\&. Often calls the need for \fBSDL_PumpEvents\fP is hidden from the user since \fI\fBSDL_PollEvent\fP\fR and \fI\fBSDL_WaitEvent\fP\fR implicitly call \fBSDL_PumpEvents\fP\&. However, if you are not polling or waiting for events (e\&.g\&. your filtering them), then you must call \fBSDL_PumpEvents\fP to force an event queue update\&. +.PP +.RS +\fBNote: +.PP +You can only call this function in the thread that set the video mode\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_PollEvent\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_PushEvent.3 b/SDL/docs/man3/SDL_PushEvent.3 new file mode 100644 index 0000000..a2d7130 --- /dev/null +++ b/SDL/docs/man3/SDL_PushEvent.3 @@ -0,0 +1,27 @@ +.TH "SDL_PushEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PushEvent \- Pushes an event onto the event queue +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_PushEvent\fP\fR(\fBSDL_Event *event\fR); +.SH "DESCRIPTION" +.PP +The event queue can actually be used as a two way communication channel\&. Not only can events be read from the queue, but the user can also push their own events onto it\&. \fBevent\fR is a pointer to the event structure you wish to push onto the queue\&. +.PP +.RS +\fBNote: +.PP +Pushing device input events onto the queue doesn\&'t modify the state of the device within SDL\&. +.RE +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success or \fB-1\fR if the event couldn\&'t be pushed\&. +.SH "EXAMPLES" +.PP +See \fI\fBSDL_Event\fR\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_PollEvent\fP\fR, \fI\fBSDL_PeepEvents\fP\fR, \fI\fBSDL_Event\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_Quit.3 b/SDL/docs/man3/SDL_Quit.3 new file mode 100644 index 0000000..f8b4e7d --- /dev/null +++ b/SDL/docs/man3/SDL_Quit.3 @@ -0,0 +1,29 @@ +.TH "SDL_Quit" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Quit \- Shut down SDL +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_Quit\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_Quit\fP shuts down all SDL subsystems and frees the resources allocated to them\&. This should always be called before you exit\&. For the sake of simplicity you can set \fBSDL_Quit\fP as your \fBatexit\fP call, like: +.PP +.nf +\f(CWSDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO); +atexit(SDL_Quit); +\&. +\&.\fR +.fi +.PP +.PP +.RS +\fBNote: +.PP +While using \fBatexit\fP maybe be fine for small programs, more advanced users should shut down SDL in their own cleanup code\&. Plus, using \fBatexit\fP in a library is a sure way to crash dynamically loaded code +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_QuitSubsystem\fP\fR, \fI\fBSDL_Init\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_QuitEvent.3 b/SDL/docs/man3/SDL_QuitEvent.3 new file mode 100644 index 0000000..a77d0aa --- /dev/null +++ b/SDL/docs/man3/SDL_QuitEvent.3 @@ -0,0 +1,30 @@ +.TH "SDL_QuitEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_QuitEvent \- Quit requested event +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type +} SDL_QuitEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_QUIT\fP +.SH "DESCRIPTION" +.PP +\fBSDL_QuitEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used whan an event of type \fBSDL_QUIT\fP is reported\&. +.PP +As can be seen, the SDL_QuitEvent structure serves no useful purpose\&. The event itself, on the other hand, is very important\&. If you filter out or ignore a quit event then it is impossible for the user to close the window\&. On the other hand, if you do accept a quit event then the application window will be closed, and screen updates will still report success event though the application will no longer be visible\&. +.PP +.RS +\fBNote: +.PP +The macro \fBSDL_QuitRequested\fP will return non-zero if a quit event is pending +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_SetEventFilter\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_QuitSubSystem.3 b/SDL/docs/man3/SDL_QuitSubSystem.3 new file mode 100644 index 0000000..4d575c3 --- /dev/null +++ b/SDL/docs/man3/SDL_QuitSubSystem.3 @@ -0,0 +1,15 @@ +.TH "SDL_QuitSubSystem" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_QuitSubSystem \- Shut down a subsystem +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_QuitSubSystem\fP\fR(\fBUint32 flags\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_QuitSubSystem\fP allows you to shut down a subsystem that has been previously initialized by \fI\fBSDL_Init\fP\fR or \fI\fBSDL_InitSubSystem\fP\fR\&. The \fBflags\fR tells \fBSDL_QuitSubSystem\fP which subsystems to shut down, it uses the same values that are passed to \fI\fBSDL_Init\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Quit\fP\fR, \fI\fBSDL_Init\fP\fR, \fI\fBSDL_InitSubSystem\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_RWFromFile.3 b/SDL/docs/man3/SDL_RWFromFile.3 new file mode 100644 index 0000000..1847dae --- /dev/null +++ b/SDL/docs/man3/SDL_RWFromFile.3 @@ -0,0 +1,18 @@ +.TH "SDL_FunctionName" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FunctionName \- Short description of function +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBreturn type\fBSDL_FunctionName\fP\fR(\fBparameter\fR); +.SH "DESCRIPTION" +.PP +Full description +.SH "EXAMPLES" +.PP +examples here +.SH "SEE ALSO" +.PP +\fISDL_AnotherFunction\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_Rect.3 b/SDL/docs/man3/SDL_Rect.3 new file mode 100644 index 0000000..a25f35f --- /dev/null +++ b/SDL/docs/man3/SDL_Rect.3 @@ -0,0 +1,26 @@ +.TH "SDL_Rect" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Rect \- Defines a rectangular area +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Sint16 x, y; + Uint16 w, h; +} SDL_Rect;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBx, y\fR +Position of the upper-left corner of the rectangle +.TP 20 +\fBw, h\fR +The width and height of the rectangle +.SH "DESCRIPTION" +.PP +A \fBSDL_Rect\fR defines a rectangular area of pixels\&. It is used by \fI\fBSDL_BlitSurface\fP\fR to define blitting regions and by several other video functions\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_BlitSurface\fP\fR, \fI\fBSDL_UpdateRect\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_RemoveTimer.3 b/SDL/docs/man3/SDL_RemoveTimer.3 new file mode 100644 index 0000000..f2e67da --- /dev/null +++ b/SDL/docs/man3/SDL_RemoveTimer.3 @@ -0,0 +1,25 @@ +.TH "SDL_RemoveTimer" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_RemoveTimer \- Remove a timer which was added with \fISDL_AddTimer\fR\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_bool \fBSDL_RemoveTimer\fP\fR(\fBSDL_TimerID id\fR); +.SH "DESCRIPTION" +.PP +Removes a timer callback previously added with \fISDL_AddTimer\fR\&. +.SH "RETURN VALUE" +.PP +Returns a boolean value indicating success\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_RemoveTimer(my_timer_id);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_AddTimer\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_ResizeEvent.3 b/SDL/docs/man3/SDL_ResizeEvent.3 new file mode 100644 index 0000000..15335f6 --- /dev/null +++ b/SDL/docs/man3/SDL_ResizeEvent.3 @@ -0,0 +1,28 @@ +.TH "SDL_ResizeEvent" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ResizeEvent \- Window resize event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + int w, h; +} SDL_ResizeEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_VIDEORESIZE\fP +.TP 20 +\fBw\fR, \fBh\fR +New width and height of the window +.SH "DESCRIPTION" +.PP +\fBSDL_ResizeEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_VIDEORESIZE\fP is reported\&. +.PP +When \fBSDL_RESIZABLE\fP is passed as a \fBflag\fR to \fI\fBSDL_SetVideoMode\fP\fR the user is allowed to resize the applications window\&. When the window is resized an \fBSDL_VIDEORESIZE\fP is report, with the new window width and height values stored in \fBw\fR and \fBh\fR, respectively\&. When an \fBSDL_VIDEORESIZE\fP is received the window should be resized to the new dimensions using \fI\fBSDL_SetVideoMode\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_SetVideoMode\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_SaveBMP.3 b/SDL/docs/man3/SDL_SaveBMP.3 new file mode 100644 index 0000000..94703c1 --- /dev/null +++ b/SDL/docs/man3/SDL_SaveBMP.3 @@ -0,0 +1,18 @@ +.TH "SDL_SaveBMP" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SaveBMP \- Save an SDL_Surface as a Windows BMP file\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SaveBMP\fP\fR(\fBSDL_Surface *surface, const char *file\fR); +.SH "DESCRIPTION" +.PP +Saves the \fBSDL_Surface\fR \fBsurface\fR as a Windows BMP file named \fBfile\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR if successful or \fB-1\fR if there was an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_LoadBMP\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_SemPost.3 b/SDL/docs/man3/SDL_SemPost.3 new file mode 100644 index 0000000..aa6616c --- /dev/null +++ b/SDL/docs/man3/SDL_SemPost.3 @@ -0,0 +1,28 @@ +.TH "SDL_SemPost" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SemPost \- Unlock a semaphore\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_SemPost\fP\fR(\fBSDL_sem *sem\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_SemPost\fP unlocks the semaphore pointed to by \fBsem\fR and atomically increments the semaphores value\&. Threads that were blocking on the semaphore may be scheduled after this call succeeds\&. +.PP +\fBSDL_SemPost\fP should be called after a semaphore is locked by a successful call to \fISDL_SemWait\fR, \fISDL_SemTryWait\fR or \fISDL_SemWaitTimeout\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR if successful or \fB-1\fR if there was an error (leaving the semaphore unchanged)\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_SemPost(my_sem);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_SemTryWait.3 b/SDL/docs/man3/SDL_SemTryWait.3 new file mode 100644 index 0000000..71ffc3f --- /dev/null +++ b/SDL/docs/man3/SDL_SemTryWait.3 @@ -0,0 +1,41 @@ +.TH "SDL_SemTryWait" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SemTryWait \- Attempt to lock a semaphore but don\&'t suspend the thread\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_SemTryWait\fP\fR(\fBSDL_sem *sem\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_SemTryWait\fP is a non-blocking varient of \fI\fBSDL_SemWait\fP\fR\&. If the value of the semaphore pointed to by \fBsem\fR is positive it will atomically decrement the semaphore value and return 0, otherwise it will return \fBSDL_MUTEX_TIMEOUT\fR instead of suspending the thread\&. +.PP +After \fBSDL_SemTryWait\fP is successful, the semaphore can be released and its count atomically incremented by a successful call to \fISDL_SemPost\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR if the semaphore was successfully locked or either \fBSDL_MUTEX_TIMEOUT\fR or \fB-1\fR if the thread would have suspended or there was an error, respectivly\&. +.PP +If the semaphore was not successfully locked, the semaphore will be unchanged\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWres = SDL_SemTryWait(my_sem); + +if (res == SDL_MUTEX_TIMEOUT) { + return TRY_AGAIN; +} +if (res == -1) { + return WAIT_ERROR; +} + +\&.\&.\&. + +SDL_SemPost(my_sem);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemPost\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_SemValue.3 b/SDL/docs/man3/SDL_SemValue.3 new file mode 100644 index 0000000..cfd5199 --- /dev/null +++ b/SDL/docs/man3/SDL_SemValue.3 @@ -0,0 +1,26 @@ +.TH "SDL_SemValue" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SemValue \- Return the current value of a semaphore\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL/SDL_thread\&.h" +.sp +\fBUint32 \fBSDL_SemValue\fP\fR(\fBSDL_sem *sem\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_SemValue()\fP returns the current semaphore value from the semaphore pointed to by \fBsem\fR\&. +.SH "RETURN VALUE" +.PP +Returns current value of the semaphore\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CW sem_value = SDL_SemValue(my_sem);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemPost\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_SemWait.3 b/SDL/docs/man3/SDL_SemWait.3 new file mode 100644 index 0000000..9442780 --- /dev/null +++ b/SDL/docs/man3/SDL_SemWait.3 @@ -0,0 +1,34 @@ +.TH "SDL_SemWait" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SemWait \- Lock a semaphore and suspend the thread if the semaphore value is zero\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_SemWait\fP\fR(\fBSDL_sem *sem\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_SemWait()\fP suspends the calling thread until either the semaphore pointed to by \fBsem\fR has a positive value, the call is interrupted by a signal or error\&. If the call is successful it will atomically decrement the semaphore value\&. +.PP +After \fBSDL_SemWait()\fP is successful, the semaphore can be released and its count atomically incremented by a successful call to \fISDL_SemPost\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR if successful or \fB-1\fR if there was an error (leaving the semaphore unchanged)\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWif (SDL_SemWait(my_sem) == -1) { + return WAIT_FAILED; +} + +\&.\&.\&. + +SDL_SemPost(my_sem);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemPost\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_SemWaitTimeout.3 b/SDL/docs/man3/SDL_SemWaitTimeout.3 new file mode 100644 index 0000000..fed086d --- /dev/null +++ b/SDL/docs/man3/SDL_SemWaitTimeout.3 @@ -0,0 +1,41 @@ +.TH "SDL_SemWaitTimeout" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SemWaitTimeout \- Lock a semaphore, but only wait up to a specified maximum time\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_SemWaitTimeout\fP\fR(\fBSDL_sem *sem, Uint32 timeout\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_SemWaitTimeout()\fP is a varient of \fISDL_SemWait\fR with a maximum timeout value\&. If the value of the semaphore pointed to by \fBsem\fR is positive (greater than zero) it will atomically decrement the semaphore value and return 0, otherwise it will wait up to \fBtimeout\fR milliseconds trying to lock the semaphore\&. This function is to be avoided if possible since on some platforms it is implemented by polling the semaphore every millisecond in a busy loop\&. +.PP +After \fBSDL_SemWaitTimeout()\fP is successful, the semaphore can be released and its count atomically incremented by a successful call to \fISDL_SemPost\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR if the semaphore was successfully locked or either \fBSDL_MUTEX_TIMEOUT\fR or \fB-1\fR if the timeout period was exceeded or there was an error, respectivly\&. +.PP +If the semaphore was not successfully locked, the semaphore will be unchanged\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWres = SDL_SemWaitTimeout(my_sem, WAIT_TIMEOUT_MILLISEC); + +if (res == SDL_MUTEX_TIMEOUT) { + return TRY_AGAIN; +} +if (res == -1) { + return WAIT_ERROR; +} + +\&.\&.\&. + +SDL_SemPost(my_sem);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemPost\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_SetAlpha.3 b/SDL/docs/man3/SDL_SetAlpha.3 new file mode 100644 index 0000000..2b17565 --- /dev/null +++ b/SDL/docs/man3/SDL_SetAlpha.3 @@ -0,0 +1,66 @@ +.TH "SDL_SetAlpha" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetAlpha \- Adjust the alpha properties of a surface +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetAlpha\fP\fR(\fBSDL_Surface *surface, Uint32 flag, Uint8 alpha\fR); +.SH "DESCRIPTION" +.PP +.RS +\fBNote: +.PP +This function and the semantics of SDL alpha blending have changed since version 1\&.1\&.4\&. Up until version 1\&.1\&.5, an alpha value of 0 was considered opaque and a value of 255 was considered transparent\&. This has now been inverted: 0 (\fBSDL_ALPHA_TRANSPARENT\fP) is now considered transparent and 255 (\fBSDL_ALPHA_OPAQUE\fP) is now considered opaque\&. +.RE +.PP +\fBSDL_SetAlpha\fP is used for setting the per-surface alpha value and/or enabling and disabling alpha blending\&. +.PP +The\fBsurface\fR parameter specifies which surface whose alpha attributes you wish to adjust\&. \fBflags\fR is used to specify whether alpha blending should be used (\fBSDL_SRCALPHA\fP) and whether the surface should use RLE acceleration for blitting (\fBSDL_RLEACCEL\fP)\&. \fBflags\fR can be an OR\&'d combination of these two options, one of these options or 0\&. If \fBSDL_SRCALPHA\fP is not passed as a flag then all alpha information is ignored when blitting the surface\&. The \fBalpha\fR parameter is the per-surface alpha value; a surface need not have an alpha channel to use per-surface alpha and blitting can still be accelerated with \fBSDL_RLEACCEL\fP\&. +.PP +.RS +\fBNote: +.PP +The per-surface alpha value of 128 is considered a special case and is optimised, so it\&'s much faster than other per-surface values\&. +.RE +.PP +Alpha effects surface blitting in the following ways: +.TP 20 +RGBA->RGB with \fBSDL_SRCALPHA\fP +The source is alpha-blended with the destination, using the alpha channel\&. \fBSDL_SRCCOLORKEY\fP and the per-surface alpha are ignored\&. +.TP 20 +RGBA->RGB without \fBSDL_SRCALPHA\fP +The RGB data is copied from the source\&. The source alpha channel and the per-surface alpha value are ignored\&. +.TP 20 +RGB->RGBA with \fBSDL_SRCALPHA\fP +The source is alpha-blended with the destination using the per-surface alpha value\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&. The alpha channel of the copied pixels is set to opaque\&. +.TP 20 +RGB->RGBA without \fBSDL_SRCALPHA\fP +The RGB data is copied from the source and the alpha value of the copied pixels is set to opaque\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&. +.TP 20 +RGBA->RGBA with \fBSDL_SRCALPHA\fP +The source is alpha-blended with the destination using the source alpha channel\&. The alpha channel in the destination surface is left untouched\&. \fBSDL_SRCCOLORKEY\fP is ignored\&. +.TP 20 +RGBA->RGBA without \fBSDL_SRCALPHA\fP +The RGBA data is copied to the destination surface\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&. +.TP 20 +RGB->RGB with \fBSDL_SRCALPHA\fP +The source is alpha-blended with the destination using the per-surface alpha value\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&. +.TP 20 +RGB->RGB without \fBSDL_SRCALPHA\fP +The RGB data is copied from the source\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&. +.PP +.RS +\fBNote: +.PP + Note that RGBA->RGBA blits (with SDL_SRCALPHA set) keep the alpha of the destination surface\&. This means that you cannot compose two arbitrary RGBA surfaces this way and get the result you would expect from "overlaying" them; the destination alpha will work as a mask\&. +.PP +Also note that per-pixel and per-surface alpha cannot be combined; the per-pixel alpha is always used if available +.RE +.SH "RETURN VALUE" +.PP +This function returns \fB0\fR, or \fB-1\fR if there was an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_MapRGBA\fP\fR, \fI\fBSDL_GetRGBA\fP\fR, \fI\fBSDL_DisplayFormatAlpha\fP\fR, \fI\fBSDL_BlitSurface\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_SetClipRect.3 b/SDL/docs/man3/SDL_SetClipRect.3 new file mode 100644 index 0000000..0c8e21c --- /dev/null +++ b/SDL/docs/man3/SDL_SetClipRect.3 @@ -0,0 +1,19 @@ +.TH "SDL_SetClipRect" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetClipRect \- Sets the clipping rectangle for a surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_SetClipRect\fP\fR(\fBSDL_Surface *surface, SDL_Rect *rect\fR); +.SH "DESCRIPTION" +.PP +Sets the clipping rectangle for a surface\&. When this surface is the destination of a blit, only the area within the clip rectangle will be drawn into\&. +.PP +The rectangle pointed to by \fBrect\fR will be clipped to the edges of the surface so that the clip rectangle for a surface can never fall outside the edges of the surface\&. +.PP +If \fBrect\fR is \fBNULL\fP the clipping rectangle will be set to the full size of the surface\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetClipRect\fP\fR, \fI\fBSDL_BlitSurface\fP\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_SetColorKey.3 b/SDL/docs/man3/SDL_SetColorKey.3 new file mode 100644 index 0000000..d75380b --- /dev/null +++ b/SDL/docs/man3/SDL_SetColorKey.3 @@ -0,0 +1,26 @@ +.TH "SDL_SetColorKey" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetColorKey \- Sets the color key (transparent pixel) in a blittable surface and RLE acceleration\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetColorKey\fP\fR(\fBSDL_Surface *surface, Uint32 flag, Uint32 key\fR); +.SH "DESCRIPTION" +.PP + Sets the color key (transparent pixel) in a blittable surface and enables or disables RLE blit acceleration\&. +.PP +RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels (i\&.e\&., pixels that match the \fBkey\fR value)\&. The \fBkey\fR must be of the same pixel format as the \fBsurface\fR, \fI\fBSDL_MapRGB\fP\fR is often useful for obtaining an acceptable value\&. +.PP +If \fBflag\fR is \fBSDL_SRCCOLORKEY\fP then \fBkey\fR is the transparent pixel value in the source image of a blit\&. +.PP +If \fBflag\fR is OR\&'d with \fBSDL_RLEACCEL\fP then the surface will be draw using RLE acceleration when drawn with \fISDL_BlitSurface\fR\&. The surface will actually be encoded for RLE acceleration the first time \fISDL_BlitSurface\fR or \fISDL_DisplayFormat\fR is called on the surface\&. +.PP +If \fBflag\fR is 0, this function clears any current color key\&. +.SH "RETURN VALUE" +.PP +This function returns \fB0\fR, or \fB-1\fR if there was an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_BlitSurface\fP\fR, \fI\fBSDL_DisplayFormat\fP\fR, \fI\fBSDL_MapRGB\fP\fR, \fI\fBSDL_SetAlpha\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_SetColors.3 b/SDL/docs/man3/SDL_SetColors.3 new file mode 100644 index 0000000..c0b93c1 --- /dev/null +++ b/SDL/docs/man3/SDL_SetColors.3 @@ -0,0 +1,57 @@ +.TH "SDL_SetColors" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetColors \- Sets a portion of the colormap for the given 8-bit surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetColors\fP\fR(\fBSDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors\fR); +.SH "DESCRIPTION" +.PP +Sets a portion of the colormap for the given 8-bit surface\&. +.PP +When \fBsurface\fR is the surface associated with the current display, the display colormap will be updated with the requested colors\&. If \fBSDL_HWPALETTE\fP was set in \fISDL_SetVideoMode\fR flags, \fBSDL_SetColors\fP will always return \fB1\fR, and the palette is guaranteed to be set the way you desire, even if the window colormap has to be warped or run under emulation\&. +.PP +The color components of a \fI\fBSDL_Color\fR\fR structure are 8-bits in size, giving you a total of 256^3 =16777216 colors\&. +.PP +Palettized (8-bit) screen surfaces with the \fBSDL_HWPALETTE\fP flag have two palettes, a logical palette that is used for mapping blits to/from the surface and a physical palette (that determines how the hardware will map the colors to the display)\&. \fBSDL_SetColors\fP modifies both palettes (if present), and is equivalent to calling \fISDL_SetPalette\fR with the \fBflags\fR set to \fB(SDL_LOGPAL | SDL_PHYSPAL)\fP\&. +.SH "RETURN VALUE" +.PP +If \fBsurface\fR is not a palettized surface, this function does nothing, returning \fB0\fR\&. If all of the colors were set as passed to \fBSDL_SetColors\fP, it will return \fB1\fR\&. If not all the color entries were set exactly as given, it will return \fB0\fR, and you should look at the surface palette to determine the actual color palette\&. +.SH "EXAMPLE" +.PP +.nf +\f(CW/* Create a display surface with a grayscale palette */ +SDL_Surface *screen; +SDL_Color colors[256]; +int i; +\&. +\&. +\&. +/* Fill colors with color information */ +for(i=0;i<256;i++){ + colors[i]\&.r=i; + colors[i]\&.g=i; + colors[i]\&.b=i; +} + +/* Create display */ +screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE); +if(!screen){ + printf("Couldn\&'t set video mode: %s +", SDL_GetError()); + exit(-1); +} + +/* Set palette */ +SDL_SetColors(screen, colors, 0, 256); +\&. +\&. +\&. +\&.\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Color\fR\fR \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_SetPalette\fP\fR, \fI\fBSDL_SetVideoMode\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_SetCursor.3 b/SDL/docs/man3/SDL_SetCursor.3 new file mode 100644 index 0000000..ad6a3f8 --- /dev/null +++ b/SDL/docs/man3/SDL_SetCursor.3 @@ -0,0 +1,15 @@ +.TH "SDL_SetCursor" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetCursor \- Set the currently active mouse cursor\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_SetCursor\fP\fR(\fBSDL_Cursor *cursor\fR); +.SH "DESCRIPTION" +.PP +Sets the currently active cursor to the specified one\&. If the cursor is currently visible, the change will be immediately represented on the display\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetCursor\fP\fR, \fI\fBSDL_CreateCursor\fP\fR, \fI\fBSDL_ShowCursor\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_SetEventFilter.3 b/SDL/docs/man3/SDL_SetEventFilter.3 new file mode 100644 index 0000000..a43092f --- /dev/null +++ b/SDL/docs/man3/SDL_SetEventFilter.3 @@ -0,0 +1,35 @@ +.TH "SDL_SetEventFilter" "3" "Tue 11 Sep 2001, 22:59" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetEventFilter \- Sets up a filter to process all events before they are posted to the event queue\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_SetEventFilter\fP\fR(\fBSDL_EventFilter filter\fR); +.SH "DESCRIPTION" +.PP +This function sets up a filter to process all events before they are posted to the event queue\&. This is a very powerful and flexible feature\&. The filter is prototyped as: +.PP +.nf +\f(CWtypedef int (*SDL_EventFilter)(const SDL_Event *event);\fR +.fi +.PP + If the filter returns \fB1\fR, then the event will be added to the internal queue\&. If it returns \fB0\fR, then the event will be dropped from the queue\&. This allows selective filtering of dynamically\&. +.PP +There is one caveat when dealing with the \fBSDL_QUITEVENT\fP event type\&. The event filter is only called when the window manager desires to close the application window\&. If the event filter returns 1, then the window will be closed, otherwise the window will remain open if possible\&. If the quit event is generated by an interrupt signal, it will bypass the internal queue and be delivered to the application at the next event poll\&. +.PP +.RS +\fBNote: +.PP +Events pushed onto the queue with \fI\fBSDL_PushEvent\fP\fR or \fI\fBSDL_PeepEvents\fP\fR do not get passed through the event filter\&. +.RE +.PP +.RS +\fBNote: +.PP +\fIBe Careful!\fP The event filter function may run in a different thread so be careful what you do within it\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_GetEventFilter\fP\fR, \fI\fBSDL_PushEvent\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:59 diff --git a/SDL/docs/man3/SDL_SetGamma.3 b/SDL/docs/man3/SDL_SetGamma.3 new file mode 100644 index 0000000..c9191e6 --- /dev/null +++ b/SDL/docs/man3/SDL_SetGamma.3 @@ -0,0 +1,22 @@ +.TH "SDL_SetGamma" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetGamma \- Sets the color gamma function for the display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetGamma\fP\fR(\fBfloat redgamma, float greengamma, float bluegamma\fR); +.SH "DESCRIPTION" +.PP +Sets the "gamma function" for the display of each color component\&. Gamma controls the brightness/contrast of colors displayed on the screen\&. A gamma value of 1\&.0 is identity (i\&.e\&., no adjustment is made)\&. +.PP +This function adjusts the gamma based on the "gamma function" parameter, you can directly specify lookup tables for gamma adjustment with \fISDL_SetGammaRamp\fR\&. +.PP +Not all display hardware is able to change gamma\&. +.SH "RETURN VALUE" +.PP +Returns -1 on error (or if gamma adjustment is not supported)\&. +.SH "SEE ALSO" +.PP +\fISDL_GetGammaRamp\fR \fISDL_SetGammaRamp\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_SetGammaRamp.3 b/SDL/docs/man3/SDL_SetGammaRamp.3 new file mode 100644 index 0000000..a5790ae --- /dev/null +++ b/SDL/docs/man3/SDL_SetGammaRamp.3 @@ -0,0 +1,22 @@ +.TH "SDL_SetGammaRamp" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetGammaRamp \- Sets the color gamma lookup tables for the display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetGammaRamp\fP\fR(\fBUint16 *redtable, Uint16 *greentable, Uint16 *bluetable\fR); +.SH "DESCRIPTION" +.PP +Sets the gamma lookup tables for the display for each color component\&. Each table is an array of 256 Uint16 values, representing a mapping between the input and output for that channel\&. The input is the index into the array, and the output is the 16-bit gamma value at that index, scaled to the output color precision\&. You may pass NULL to any of the channels to leave them unchanged\&. +.PP +This function adjusts the gamma based on lookup tables, you can also have the gamma calculated based on a "gamma function" parameter with \fISDL_SetGamma\fR\&. +.PP +Not all display hardware is able to change gamma\&. +.SH "RETURN VALUE" +.PP +Returns -1 on error (or if gamma adjustment is not supported)\&. +.SH "SEE ALSO" +.PP +\fISDL_SetGamma\fR \fISDL_GetGammaRamp\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_SetModState.3 b/SDL/docs/man3/SDL_SetModState.3 new file mode 100644 index 0000000..0d784ba --- /dev/null +++ b/SDL/docs/man3/SDL_SetModState.3 @@ -0,0 +1,35 @@ +.TH "SDL_SetModState" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetModState \- Set the current key modifier state +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_SetModState\fP\fR(\fBSDLMod modstate\fR); +.SH "DESCRIPTION" +.PP +The inverse of \fI\fBSDL_GetModState\fP\fR, \fBSDL_SetModState\fP allows you to impose modifier key states on your application\&. +.PP +Simply pass your desired modifier states into \fBmodstate\fR\&. This value my be a logical OR\&'d combination of the following: +.PP +.nf +\f(CWtypedef enum { + KMOD_NONE = 0x0000, + KMOD_LSHIFT= 0x0001, + KMOD_RSHIFT= 0x0002, + KMOD_LCTRL = 0x0040, + KMOD_RCTRL = 0x0080, + KMOD_LALT = 0x0100, + KMOD_RALT = 0x0200, + KMOD_LMETA = 0x0400, + KMOD_RMETA = 0x0800, + KMOD_NUM = 0x1000, + KMOD_CAPS = 0x2000, + KMOD_MODE = 0x4000, +} SDLMod;\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetModState\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_SetPalette.3 b/SDL/docs/man3/SDL_SetPalette.3 new file mode 100644 index 0000000..2db3851 --- /dev/null +++ b/SDL/docs/man3/SDL_SetPalette.3 @@ -0,0 +1,59 @@ +.TH "SDL_SetPalette" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetPalette \- Sets the colors in the palette of an 8-bit surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetPalette\fP\fR(\fBSDL_Surface *surface, int flags, SDL_Color *colors, int firstcolor, int ncolors\fR); +.SH "DESCRIPTION" +.PP +Sets a portion of the palette for the given 8-bit surface\&. +.PP +Palettized (8-bit) screen surfaces with the \fBSDL_HWPALETTE\fP flag have two palettes, a logical palette that is used for mapping blits to/from the surface and a physical palette (that determines how the hardware will map the colors to the display)\&. \fISDL_BlitSurface\fR always uses the logical palette when blitting surfaces (if it has to convert between surface pixel formats)\&. Because of this, it is often useful to modify only one or the other palette to achieve various special color effects (e\&.g\&., screen fading, color flashes, screen dimming)\&. +.PP +This function can modify either the logical or physical palette by specifing \fBSDL_LOGPAL\fP or \fBSDL_PHYSPAL\fPthe in the \fBflags\fR parameter\&. +.PP +When \fBsurface\fR is the surface associated with the current display, the display colormap will be updated with the requested colors\&. If \fBSDL_HWPALETTE\fP was set in \fISDL_SetVideoMode\fR flags, \fBSDL_SetPalette\fP will always return \fB1\fR, and the palette is guaranteed to be set the way you desire, even if the window colormap has to be warped or run under emulation\&. +.PP +The color components of a \fI\fBSDL_Color\fR\fR structure are 8-bits in size, giving you a total of 256^3=16777216 colors\&. +.SH "RETURN VALUE" +.PP +If \fBsurface\fR is not a palettized surface, this function does nothing, returning \fB0\fR\&. If all of the colors were set as passed to \fBSDL_SetPalette\fP, it will return \fB1\fR\&. If not all the color entries were set exactly as given, it will return \fB0\fR, and you should look at the surface palette to determine the actual color palette\&. +.SH "EXAMPLE" +.PP +.nf +\f(CW /* Create a display surface with a grayscale palette */ + SDL_Surface *screen; + SDL_Color colors[256]; + int i; + \&. + \&. + \&. + /* Fill colors with color information */ + for(i=0;i<256;i++){ + colors[i]\&.r=i; + colors[i]\&.g=i; + colors[i]\&.b=i; + } + + /* Create display */ + screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE); + if(!screen){ + printf("Couldn\&'t set video mode: %s +", SDL_GetError()); + exit(-1); + } + + /* Set palette */ + SDL_SetPalette(screen, SDL_LOGPAL|SDL_PHYSPAL, colors, 0, 256); + \&. + \&. + \&. + \&.\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fISDL_SetColors\fR, \fISDL_SetVideoMode\fR, \fISDL_Surface\fR, \fISDL_Color\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_SetTimer.3 b/SDL/docs/man3/SDL_SetTimer.3 new file mode 100644 index 0000000..25b72f9 --- /dev/null +++ b/SDL/docs/man3/SDL_SetTimer.3 @@ -0,0 +1,39 @@ +.TH "SDL_SetTimer" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetTimer \- Set a callback to run after the specified number of milliseconds has elapsed\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetTimer\fP\fR(\fBUint32 interval, SDL_TimerCallback callback\fR); +.SH "CALLBACK" +.PP +/* Function prototype for the timer callback function */ typedef Uint32 (*SDL_TimerCallback)(Uint32 interval); +.SH "DESCRIPTION" +.PP +Set a callback to run after the specified number of milliseconds has elapsed\&. The callback function is passed the current timer interval and returns the next timer interval\&. If the returned value is the same as the one passed in, the periodic alarm continues, otherwise a new alarm is scheduled\&. +.PP +To cancel a currently running timer, call \fBSDL_SetTimer(0, NULL);\fP +.PP +The timer callback function may run in a different thread than your main constant, and so shouldn\&'t call any functions from within itself\&. +.PP +The maximum resolution of this timer is 10 ms, which means that if you request a 16 ms timer, your callback will run approximately 20 ms later on an unloaded system\&. If you wanted to set a flag signaling a frame update at 30 frames per second (every 33 ms), you might set a timer for 30 ms (see example below)\&. +.PP +If you use this function, you need to pass \fBSDL_INIT_TIMER\fP to \fBSDL_Init()\fP\&. +.PP +.RS +\fBNote: +.PP +This function is kept for compatibility but has been superseded by the new timer functions \fISDL_AddTimer\fR and \fISDL_RemoveTimer\fR which support multiple timers\&. +.RE +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_SetTimer((33/10)*10, my_callback);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_AddTimer\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_SetVideoMode.3 b/SDL/docs/man3/SDL_SetVideoMode.3 new file mode 100644 index 0000000..9f322db --- /dev/null +++ b/SDL/docs/man3/SDL_SetVideoMode.3 @@ -0,0 +1,67 @@ +.TH "SDL_SetVideoMode" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetVideoMode \- Set up a video mode with the specified width, height and bits-per-pixel\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_SetVideoMode\fP\fR(\fBint width, int height, int bpp, Uint32 flags\fR); +.SH "DESCRIPTION" +.PP +Set up a video mode with the specified width, height and bits-per-pixel\&. +.PP +If \fBbpp\fR is 0, it is treated as the current display bits per pixel\&. +.PP +The \fBflags\fR parameter is the same as the \fBflags\fR field of the \fI\fBSDL_Surface\fR\fR structure\&. OR\&'d combinations of the following values are valid\&. +.TP 20 +\fBSDL_SWSURFACE\fP +Create the video surface in system memory +.TP 20 +\fBSDL_HWSURFACE\fP +Create the video surface in video memory +.TP 20 +\fBSDL_ASYNCBLIT\fP +Enables the use of asynchronous updates of the display surface\&. This will usually slow down blitting on single CPU machines, but may provide a speed increase on SMP systems\&. +.TP 20 +\fBSDL_ANYFORMAT\fP +Normally, if a video surface of the requested bits-per-pixel (\fBbpp\fR) is not available, SDL will emulate one with a shadow surface\&. Passing \fBSDL_ANYFORMAT\fP prevents this and causes SDL to use the video surface, regardless of its pixel depth\&. +.TP 20 +\fBSDL_HWPALETTE\fP +Give SDL exclusive palette access\&. Without this flag you may not always get the the colors you request with \fI\fBSDL_SetColors\fP\fR or \fI\fBSDL_SetPalette\fP\fR\&. +.TP 20 +\fBSDL_DOUBLEBUF\fP +Enable hardware double buffering; only valid with SDL_HWSURFACE\&. Calling \fI\fBSDL_Flip\fP\fR will flip the buffers and update the screen\&. All drawing will take place on the surface that is not displayed at the moment\&. If double buffering could not be enabled then \fBSDL_Flip\fP will just perform a \fI\fBSDL_UpdateRect\fP\fR on the entire screen\&. +.TP 20 +\fBSDL_FULLSCREEN\fP +SDL will attempt to use a fullscreen mode\&. If a hardware resolution change is not possible (for whatever reason), the next higher resolution will be used and the display window centered on a black background\&. +.TP 20 +\fBSDL_OPENGL\fP +Create an OpenGL rendering context\&. You should have previously set OpenGL video attributes with \fI\fBSDL_GL_SetAttribute\fP\fR\&. +.TP 20 +\fBSDL_OPENGLBLIT\fP +Create an OpenGL rendering context, like above, but allow normal blitting operations\&. The screen (2D) surface may have an alpha channel, and \fI\fBSDL_UpdateRects\fP\fR must be used for updating changes to the screen surface\&. +.TP 20 +\fBSDL_RESIZABLE\fP +Create a resizable window\&. When the window is resized by the user a \fI\fBSDL_VIDEORESIZE\fP\fR event is generated and \fBSDL_SetVideoMode\fP can be called again with the new size\&. +.TP 20 +\fBSDL_NOFRAME\fP +If possible, \fBSDL_NOFRAME\fP causes SDL to create a window with no title bar or frame decoration\&. Fullscreen modes automatically have this flag set\&. +.PP +.RS +\fBNote: +.PP +Whatever \fBflags\fR \fBSDL_SetVideoMode\fP could satisfy are set in the \fBflags\fR member of the returned surface\&. +.RE +.PP +.RS +\fBNote: +.PP +The \fBbpp\fR parameter is the number of bits per pixel, so a \fBbpp\fR of 24 uses the packed representation of 3 bytes/pixel\&. For the more common 4 bytes/pixel mode, use a \fBbpp\fR of 32\&. Somewhat oddly, both 15 and 16 will request a 2 bytes/pixel mode, but different pixel formats\&. +.RE +.SH "RETURN VALUE" +.PP +The framebuffer surface, or \fBNULL\fR if it fails\&. The surface returned is freed by SDL_Quit() and should nt be freed by the caller\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_LockSurface\fP\fR, \fI\fBSDL_SetColors\fP\fR, \fI\fBSDL_Flip\fP\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_ShowCursor.3 b/SDL/docs/man3/SDL_ShowCursor.3 new file mode 100644 index 0000000..5898984 --- /dev/null +++ b/SDL/docs/man3/SDL_ShowCursor.3 @@ -0,0 +1,20 @@ +.TH "SDL_ShowCursor" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ShowCursor \- Toggle whether or not the cursor is shown on the screen\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_ShowCursor\fP\fR(\fBint toggle\fR); +.SH "DESCRIPTION" +.PP +Toggle whether or not the cursor is shown on the screen\&. Passing \fBSDL_ENABLE\fP displays the cursor and passing \fBSDL_DISABLE\fP hides it\&. The current state of the mouse cursor can be queried by passing \fBSDL_QUERY\fP, either \fBSDL_DISABLE\fP or \fBSDL_ENABLE\fP will be returned\&. +.PP +The cursor starts off displayed, but can be turned off\&. +.SH "RETURN VALUE" +.PP +Returns the current state of the cursor\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateCursor\fP\fR, \fI\fBSDL_SetCursor\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_Surface.3 b/SDL/docs/man3/SDL_Surface.3 new file mode 100644 index 0000000..2bde131 --- /dev/null +++ b/SDL/docs/man3/SDL_Surface.3 @@ -0,0 +1,96 @@ +.TH "SDL_Surface" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Surface \- Graphical Surface Structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct SDL_Surface { + Uint32 flags; /* Read-only */ + SDL_PixelFormat *format; /* Read-only */ + int w, h; /* Read-only */ + Uint16 pitch; /* Read-only */ + void *pixels; /* Read-write */ + + /* clipping information */ + SDL_Rect clip_rect; /* Read-only */ + + /* Reference count -- used when freeing surface */ + int refcount; /* Read-mostly */ + + /* This structure also contains private fields not shown here */ +} SDL_Surface;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBflags\fR +Surface flags +.TP 20 +\fBformat\fR +Pixel \fIformat\fR +.TP 20 +\fBw, h\fR +Width and height of the surface +.TP 20 +\fBpitch\fR +Length of a surface scanline in bytes +.TP 20 +\fBpixels\fR +Pointer to the actual pixel data +.TP 20 +\fBclip_rect\fR +surface clip \fIrectangle\fR +.SH "DESCRIPTION" +.PP +\fBSDL_Surface\fR\&'s represent areas of "graphical" memory, memory that can be drawn to\&. The video framebuffer is returned as a \fBSDL_Surface\fR by \fI\fBSDL_SetVideoMode\fP\fR and \fI\fBSDL_GetVideoSurface\fP\fR\&. Most of the fields should be pretty obvious\&. \fBw\fR and \fBh\fR are the width and height of the surface in pixels\&. \fBpixels\fR is a pointer to the actual pixel data, the surface should be \fIlocked\fR before accessing this field\&. The \fBclip_rect\fR field is the clipping rectangle as set by \fI\fBSDL_SetClipRect\fP\fR\&. +.PP +The following are supported in the \fBflags\fR field\&. +.TP 20 +\fBSDL_SWSURFACE\fP +Surface is stored in system memory +.TP 20 +\fBSDL_HWSURFACE\fP +Surface is stored in video memory +.TP 20 +\fBSDL_ASYNCBLIT\fP +Surface uses asynchronous blits if possible +.TP 20 +\fBSDL_ANYFORMAT\fP +Allows any pixel-format (Display surface) +.TP 20 +\fBSDL_HWPALETTE\fP +Surface has exclusive palette +.TP 20 +\fBSDL_DOUBLEBUF\fP +Surface is double buffered (Display surface) +.TP 20 +\fBSDL_FULLSCREEN\fP +Surface is full screen (Display Surface) +.TP 20 +\fBSDL_OPENGL\fP +Surface has an OpenGL context (Display Surface) +.TP 20 +\fBSDL_OPENGLBLIT\fP +Surface supports OpenGL blitting (Display Surface) +.TP 20 +\fBSDL_RESIZABLE\fP +Surface is resizable (Display Surface) +.TP 20 +\fBSDL_HWACCEL\fP +Surface blit uses hardware acceleration +.TP 20 +\fBSDL_SRCCOLORKEY\fP +Surface use colorkey blitting +.TP 20 +\fBSDL_RLEACCEL\fP +Colorkey blitting is accelerated with RLE +.TP 20 +\fBSDL_SRCALPHA\fP +Surface blit uses alpha blending +.TP 20 +\fBSDL_PREALLOC\fP +Surface uses preallocated memory +.SH "SEE ALSO" +.PP +\fI\fBSDL_PixelFormat\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_SysWMEvent.3 b/SDL/docs/man3/SDL_SysWMEvent.3 new file mode 100644 index 0000000..6831767 --- /dev/null +++ b/SDL/docs/man3/SDL_SysWMEvent.3 @@ -0,0 +1,21 @@ +.TH "SDL_SysWMEvent" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SysWMEvent \- Platform-dependent window manager event\&. +.SH "DESCRIPTION" +.PP +The system window manager event contains a pointer to system-specific information about unknown window manager events\&. If you enable this event using \fI\fBSDL_EventState()\fP\fR, it will be generated whenever unhandled events are received from the window manager\&. This can be used, for example, to implement cut-and-paste in your application\&. +.PP +.nf +\f(CWtypedef struct { + Uint8 type; /* Always SDL_SysWM */ + } SDL_SysWMEvent;\fR +.fi +.PP + If you want to obtain system-specific information about the window manager, you can fill the version member of a \fBSDL_SysWMinfo\fR structure (details can be found in \fBSDL_syswm\&.h\fP, which must be included) using the \fBSDL_VERSION()\fP macro found in \fBSDL_version\&.h\fP, and pass it to the function: +.PP +.sp +\fBint \fBSDL_GetWMInfo\fP\fR(\fBSDL_SysWMinfo *info\fR); +.SH "SEE ALSO" +.PP +\fI\fBSDL_EventState\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_ThreadID.3 b/SDL/docs/man3/SDL_ThreadID.3 new file mode 100644 index 0000000..bfe2cf4 --- /dev/null +++ b/SDL/docs/man3/SDL_ThreadID.3 @@ -0,0 +1,13 @@ +.TH "SDL_ThreadID" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ThreadID \- Get the 32-bit thread identifier for the current thread\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBUint32 \fBSDL_ThreadID\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +Get the 32-bit thread identifier for the current thread\&. +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_UnlockAudio.3 b/SDL/docs/man3/SDL_UnlockAudio.3 new file mode 100644 index 0000000..926b917 --- /dev/null +++ b/SDL/docs/man3/SDL_UnlockAudio.3 @@ -0,0 +1,15 @@ +.TH "SDL_UnlockAudio" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UnlockAudio \- Unlock the callback function +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_UnlockAudio\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +Unlocks a previous \fI\fBSDL_LockAudio\fP\fR call\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_OpenAudio\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 diff --git a/SDL/docs/man3/SDL_UnlockSurface.3 b/SDL/docs/man3/SDL_UnlockSurface.3 new file mode 100644 index 0000000..0776346 --- /dev/null +++ b/SDL/docs/man3/SDL_UnlockSurface.3 @@ -0,0 +1,17 @@ +.TH "SDL_UnlockSurface" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UnlockSurface \- Unlocks a previously locked surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_UnlockSurface\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +Surfaces that were previously locked using \fBSDL_LockSurface\fP must be unlocked with \fBSDL_UnlockSurface\fP\&. Surfaces should be unlocked as soon as possible\&. +.PP +It should be noted that since 1\&.1\&.8, surface locks are recursive\&. See \fI\fBSDL_LockSurface\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_LockSurface\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_UnlockYUVOverlay.3 b/SDL/docs/man3/SDL_UnlockYUVOverlay.3 new file mode 100644 index 0000000..f731212 --- /dev/null +++ b/SDL/docs/man3/SDL_UnlockYUVOverlay.3 @@ -0,0 +1,15 @@ +.TH "SDL_UnlockYUVOverlay" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UnlockYUVOverlay \- Unlock an overlay +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_UnlockYUVOverlay\fP\fR(\fBSDL_Overlay *overlay\fR); +.SH "DESCRIPTION" +.PP +The opposite to \fI\fBSDL_LockYUVOverlay\fP\fR\&. Unlocks a previously locked overlay\&. An overlay must be unlocked before it can be displayed\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_UnlockYUVOverlay\fP\fR, \fI\fBSDL_CreateYUVOverlay\fP\fR, \fI\fBSDL_Overlay\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_UpdateRect.3 b/SDL/docs/man3/SDL_UpdateRect.3 new file mode 100644 index 0000000..3a73c6d --- /dev/null +++ b/SDL/docs/man3/SDL_UpdateRect.3 @@ -0,0 +1,19 @@ +.TH "SDL_UpdateRect" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UpdateRect \- Makes sure the given area is updated on the given screen\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_UpdateRect\fP\fR(\fBSDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h\fR); +.SH "DESCRIPTION" +.PP +Makes sure the given area is updated on the given screen\&. The rectangle must be confined within the screen boundaries (no clipping is done)\&. +.PP +If \&'\fBx\fR\&', \&'\fBy\fR\&', \&'\fBw\fR\&' and \&'\fBh\fR\&' are all 0, \fBSDL_UpdateRect\fP will update the entire screen\&. +.PP +This function should not be called while \&'\fBscreen\fR\&' is \fIlocked\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_UpdateRects\fP\fR, \fI\fBSDL_Rect\fR\fR, \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_LockSurface\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_UpdateRects.3 b/SDL/docs/man3/SDL_UpdateRects.3 new file mode 100644 index 0000000..b6683e7 --- /dev/null +++ b/SDL/docs/man3/SDL_UpdateRects.3 @@ -0,0 +1,25 @@ +.TH "SDL_UpdateRects" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UpdateRects \- Makes sure the given list of rectangles is updated on the given screen\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_UpdateRects\fP\fR(\fBSDL_Surface *screen, int numrects, SDL_Rect *rects\fR); +.SH "DESCRIPTION" +.PP +Makes sure the given list of rectangles is updated on the given screen\&. The rectangles must all be confined within the screen boundaries (no clipping is done)\&. +.PP +This function should not be called while \fBscreen\fR is \fIlocked\fR\&. +.PP +.RS +\fBNote: +.PP +It is adviced to call this function only once per frame, since each call has some processing overhead\&. This is no restriction since you can pass any number of rectangles each time\&. +.PP +The rectangles are not automatically merged or checked for overlap\&. In general, the programmer can use his knowledge about his particular rectangles to merge them in an efficient way, to avoid overdraw\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_UpdateRect\fP\fR, \fI\fBSDL_Rect\fR\fR, \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_LockSurface\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_UserEvent.3 b/SDL/docs/man3/SDL_UserEvent.3 new file mode 100644 index 0000000..103581f --- /dev/null +++ b/SDL/docs/man3/SDL_UserEvent.3 @@ -0,0 +1,47 @@ +.TH "SDL_UserEvent" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UserEvent \- A user-defined event type +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + int code; + void *data1; + void *data2; +} SDL_UserEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_USEREVENT\fP through to \fBSDL_NUMEVENTS-1\fP +.TP 20 +\fBcode\fR +User defined event code +.TP 20 +\fBdata1\fR +User defined data pointer +.TP 20 +\fBdata2\fR +User defined data pointer +.SH "DESCRIPTION" +.PP +\fBSDL_UserEvent\fR is in the \fBuser\fR member of the structure \fI\fBSDL_Event\fR\fR\&. This event is unique, it is never created by SDL but only by the user\&. The event can be pushed onto the event queue using \fI\fBSDL_PushEvent\fP\fR\&. The contents of the structure members or completely up to the programmer, the only requirement is that \fBtype\fR is a value from \fBSDL_USEREVENT\fP to \fBSDL_NUMEVENTS-1\fP (inclusive)\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_Event event; + +event\&.type = SDL_USEREVENT; +event\&.user\&.code = my_event_code; +event\&.user\&.data1 = significant_data; +event\&.user\&.data2 = 0; +SDL_PushEvent(&event);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_PushEvent\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_VideoDriverName.3 b/SDL/docs/man3/SDL_VideoDriverName.3 new file mode 100644 index 0000000..1ae4614 --- /dev/null +++ b/SDL/docs/man3/SDL_VideoDriverName.3 @@ -0,0 +1,18 @@ +.TH "SDL_VideoDriverName" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_VideoDriverName \- Obtain the name of the video driver +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBchar *\fBSDL_VideoDriverName\fP\fR(\fBchar *namebuf, int maxlen\fR); +.SH "DESCRIPTION" +.PP +The buffer pointed to by \fBnamebuf\fR is filled up to a maximum of \fBmaxlen\fR characters (include the NULL terminator) with the name of the initialised video driver\&. The driver name is a simple one word identifier like "x11" or "windib"\&. +.SH "RETURN VALUE" +.PP +Returns \fBNULL\fP if video has not been initialised with \fBSDL_Init\fP or a pointer to \fBnamebuf\fR otherwise\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Init\fP\fR \fI\fBSDL_InitSubSystem\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_VideoInfo.3 b/SDL/docs/man3/SDL_VideoInfo.3 new file mode 100644 index 0000000..7af0c19 --- /dev/null +++ b/SDL/docs/man3/SDL_VideoInfo.3 @@ -0,0 +1,62 @@ +.TH "SDL_VideoInfo" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_VideoInfo \- Video Target information +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint32 hw_available:1; + Uint32 wm_available:1; + Uint32 blit_hw:1; + Uint32 blit_hw_CC:1; + Uint32 blit_hw_A:1; + Uint32 blit_sw:1; + Uint32 blit_sw_CC:1; + Uint32 blit_sw_A:1; + Uint32 blit_fill; + Uint32 video_mem; + SDL_PixelFormat *vfmt; +} SDL_VideoInfo;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBhw_available\fR +Is it possible to create hardware surfaces? +.TP 20 +\fBwm_available\fR +Is there a window manager available +.TP 20 +\fBblit_hw\fR +Are hardware to hardware blits accelerated? +.TP 20 +\fBblit_hw_CC\fR +Are hardware to hardware colorkey blits accelerated? +.TP 20 +\fBblit_hw_A\fR +Are hardware to hardware alpha blits accelerated? +.TP 20 +\fBblit_sw\fR +Are software to hardware blits accelerated? +.TP 20 +\fBblit_sw_CC\fR +Are software to hardware colorkey blits accelerated? +.TP 20 +\fBblit_sw_A\fR +Are software to hardware alpha blits accelerated? +.TP 20 +\fBblit_fill\fR +Are color fills accelerated? +.TP 20 +\fBvideo_mem\fR +Total amount of video memory in Kilobytes +.TP 20 +\fBvfmt\fR +\fIPixel format\fR of the video device +.SH "DESCRIPTION" +.PP +This (read-only) structure is returned by \fI\fBSDL_GetVideoInfo\fP\fR\&. It contains information on either the \&'best\&' available mode (if called before \fI\fBSDL_SetVideoMode\fP\fR) or the current video mode\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_PixelFormat\fR\fR, \fI\fBSDL_GetVideoInfo\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_VideoModeOK.3 b/SDL/docs/man3/SDL_VideoModeOK.3 new file mode 100644 index 0000000..cbaebfe --- /dev/null +++ b/SDL/docs/man3/SDL_VideoModeOK.3 @@ -0,0 +1,44 @@ +.TH "SDL_VideoModeOK" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_VideoModeOK \- Check to see if a particular video mode is supported\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_VideoModeOK\fP\fR(\fBint width, int height, int bpp, Uint32 flags\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_VideoModeOK\fP returns \fB0\fR if the requested mode is not supported under any bit depth, or returns the bits-per-pixel of the closest available mode with the given width, height and requested \fIsurface\fR flags (see \fI\fBSDL_SetVideoMode\fP\fR)\&. +.PP +The bits-per-pixel value returned is only a suggested mode\&. You can usually request and bpp you want when \fIsetting\fR the video mode and SDL will emulate that color depth with a shadow video surface\&. +.PP +The arguments to \fBSDL_VideoModeOK\fP are the same ones you would pass to \fISDL_SetVideoMode\fR +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_Surface *screen; +Uint32 bpp; +\&. +\&. +\&. +printf("Checking mode 640x480@16bpp\&. +"); +bpp=SDL_VideoModeOK(640, 480, 16, SDL_HWSURFACE); + +if(!bpp){ + printf("Mode not available\&. +"); + exit(-1); +} + +printf("SDL Recommends 640x480@%dbpp\&. +", bpp); +screen=SDL_SetVideoMode(640, 480, bpp, SDL_HWSURFACE); +\&. +\&.\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_GetVideoInfo\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_WM_GetCaption.3 b/SDL/docs/man3/SDL_WM_GetCaption.3 new file mode 100644 index 0000000..d1e9550 --- /dev/null +++ b/SDL/docs/man3/SDL_WM_GetCaption.3 @@ -0,0 +1,15 @@ +.TH "SDL_WM_GetCaption" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_GetCaption \- Gets the window title and icon name\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_WM_GetCaption\fP\fR(\fBchar **title, char **icon\fR); +.SH "DESCRIPTION" +.PP +Set pointers to the window \fBtitle\fR and \fBicon\fR name\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_WM_SetCaption\fP\fR, \fI\fBSDL_WM_SetIcon\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_WM_GrabInput.3 b/SDL/docs/man3/SDL_WM_GrabInput.3 new file mode 100644 index 0000000..86ada14 --- /dev/null +++ b/SDL/docs/man3/SDL_WM_GrabInput.3 @@ -0,0 +1,28 @@ +.TH "SDL_WM_GrabInput" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_GrabInput \- Grabs mouse and keyboard input\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_GrabMode \fBSDL_WM_GrabInput\fP\fR(\fBSDL_GrabMode mode\fR); +.SH "DESCRIPTION" +.PP +Grabbing means that the mouse is confined to the application window, and nearly all keyboard input is passed directly to the application, and not interpreted by a window manager, if any\&. +.PP +When \fBmode\fR is \fBSDL_GRAB_QUERY\fP the grab mode is not changed, but the current grab mode is returned\&. +.PP +.PP +.nf +\f(CWtypedef enum { + SDL_GRAB_QUERY, + SDL_GRAB_OFF, + SDL_GRAB_ON +} SDL_GrabMode;\fR +.fi +.PP + +.SH "RETURN VALUE" +.PP +The current/new \fBSDL_GrabMode\fR\&. +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_WM_IconifyWindow.3 b/SDL/docs/man3/SDL_WM_IconifyWindow.3 new file mode 100644 index 0000000..0aa2362 --- /dev/null +++ b/SDL/docs/man3/SDL_WM_IconifyWindow.3 @@ -0,0 +1,15 @@ +.TH "SDL_WM_IconifyWindow" "3" "Tue 11 Sep 2001, 23:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_IconifyWindow \- Iconify/Minimise the window +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_WM_IconifyWindow\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +If the application is running in a window managed environment SDL attempts to iconify/minimise it\&. If \fBSDL_WM_IconifyWindow\fP is successful, the application will receive a \fI\fBSDL_APPACTIVE\fP\fR loss event\&. +.SH "RETURN VALUE" +.PP +Returns non-zero on success or \fB0\fR if iconification is not support or was refused by the window manager\&. +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:02 diff --git a/SDL/docs/man3/SDL_WM_SetCaption.3 b/SDL/docs/man3/SDL_WM_SetCaption.3 new file mode 100644 index 0000000..b5d7241 --- /dev/null +++ b/SDL/docs/man3/SDL_WM_SetCaption.3 @@ -0,0 +1,15 @@ +.TH "SDL_WM_SetCaption" "3" "Tue 11 Sep 2001, 23:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_SetCaption \- Sets the window tile and icon name\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_WM_SetCaption\fP\fR(\fBconst char *title, const char *icon\fR); +.SH "DESCRIPTION" +.PP +Sets the title-bar and icon name of the display window\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_WM_GetCaption\fP\fR, \fI\fBSDL_WM_SetIcon\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:02 diff --git a/SDL/docs/man3/SDL_WM_SetIcon.3 b/SDL/docs/man3/SDL_WM_SetIcon.3 new file mode 100644 index 0000000..4fea444 --- /dev/null +++ b/SDL/docs/man3/SDL_WM_SetIcon.3 @@ -0,0 +1,27 @@ +.TH "SDL_WM_SetIcon" "3" "Tue 11 Sep 2001, 23:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_SetIcon \- Sets the icon for the display window\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_WM_SetIcon\fP\fR(\fBSDL_Surface *icon, Uint8 *mask\fR); +.SH "DESCRIPTION" +.PP +Sets the icon for the display window\&. Win32 icons must be 32x32\&. +.PP +This function must be called before the first call to \fISDL_SetVideoMode\fR\&. +.PP +It takes an \fBicon\fR surface, and a \fBmask\fR in MSB format\&. +.PP +If \fBmask\fR is \fBNULL\fP, the entire icon surface will be used as the icon\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_WM_SetIcon(SDL_LoadBMP("icon\&.bmp"), NULL);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_WM_SetCaption\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:02 diff --git a/SDL/docs/man3/SDL_WM_ToggleFullScreen.3 b/SDL/docs/man3/SDL_WM_ToggleFullScreen.3 new file mode 100644 index 0000000..7b02c85 --- /dev/null +++ b/SDL/docs/man3/SDL_WM_ToggleFullScreen.3 @@ -0,0 +1,15 @@ +.TH "SDL_WM_ToggleFullScreen" "3" "Tue 11 Sep 2001, 23:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_ToggleFullScreen \- Toggles fullscreen mode +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_WM_ToggleFullScreen\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +Toggles the application between windowed and fullscreen mode, if supported\&. (X11 is the only target currently supported, BeOS support is experimental)\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on failure or \fB1\fR on success\&. +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:02 diff --git a/SDL/docs/man3/SDL_WaitEvent.3 b/SDL/docs/man3/SDL_WaitEvent.3 new file mode 100644 index 0000000..596cedd --- /dev/null +++ b/SDL/docs/man3/SDL_WaitEvent.3 @@ -0,0 +1,17 @@ +.TH "SDL_WaitEvent" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WaitEvent \- Waits indefinitely for the next available event\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_WaitEvent\fP\fR(\fBSDL_Event *event\fR); +.SH "DESCRIPTION" +.PP +Waits indefinitely for the next available event, returning \fB1\fR, or \fB0\fR if there was an error while waiting for events\&. +.PP +If \fBevent\fR is not \fBNULL\fP, the next event is removed from the queue and stored in that area\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_PollEvent\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_WaitThread.3 b/SDL/docs/man3/SDL_WaitThread.3 new file mode 100644 index 0000000..43d5b15 --- /dev/null +++ b/SDL/docs/man3/SDL_WaitThread.3 @@ -0,0 +1,19 @@ +.TH "SDL_WaitThread" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WaitThread \- Wait for a thread to finish\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBvoid \fBSDL_WaitThread\fP\fR(\fBSDL_Thread *thread, int *status\fR); +.SH "DESCRIPTION" +.PP +Wait for a thread to finish (timeouts are not supported)\&. +.SH "RETURN VALUE" +.PP +The return code for the thread function is placed in the area pointed to by \fBstatus\fR, if \fBstatus\fR is not \fBNULL\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateThread\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_WarpMouse.3 b/SDL/docs/man3/SDL_WarpMouse.3 new file mode 100644 index 0000000..a4de2b7 --- /dev/null +++ b/SDL/docs/man3/SDL_WarpMouse.3 @@ -0,0 +1,15 @@ +.TH "SDL_WarpMouse" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WarpMouse \- Set the position of the mouse cursor\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_WarpMouse\fP\fR(\fBUint16 x, Uint16 y\fR); +.SH "DESCRIPTION" +.PP +Set the position of the mouse cursor (generates a mouse motion event)\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_MouseMotionEvent\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_WasInit.3 b/SDL/docs/man3/SDL_WasInit.3 new file mode 100644 index 0000000..31ff231 --- /dev/null +++ b/SDL/docs/man3/SDL_WasInit.3 @@ -0,0 +1,63 @@ +.TH "SDL_WasInit" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WasInit \- Check which subsystems are initialized +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint32 \fBSDL_WasInit\fP\fR(\fBUint32 flags\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_WasInit\fP allows you to see which SDL subsytems have been \fIinitialized\fR\&. \fBflags\fR is a bitwise OR\&'d combination of the subsystems you wish to check (see \fI\fBSDL_Init\fP\fR for a list of subsystem flags)\&. +.SH "RETURN VALUE" +.PP +\fBSDL_WasInit\fP returns a bitwised OR\&'d combination of the initialized subsystems\&. +.SH "EXAMPLES" +.PP +.nf +\f(CW +/* Here are several ways you can use SDL_WasInit() */ + +/* Get init data on all the subsystems */ +Uint32 subsystem_init; + +subsystem_init=SDL_WasInit(SDL_INIT_EVERYTHING); + +if(subsystem_init&SDL_INIT_VIDEO) + printf("Video is initialized\&. +"); +else + printf("Video is not initialized\&. +"); + + + +/* Just check for one specfic subsystem */ + +if(SDL_WasInit(SDL_INIT_VIDEO)!=0) + printf("Video is initialized\&. +"); +else + printf("Video is not initialized\&. +"); + + + + +/* Check for two subsystems */ + +Uint32 subsystem_mask=SDL_INIT_VIDEO|SDL_INIT_AUDIO; + +if(SDL_WasInit(subsystem_mask)==subsystem_mask) + printf("Video and Audio initialized\&. +"); +else + printf("Video and Audio not initialized\&. +"); +\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Init\fP\fR, \fI\fBSDL_Subsystem\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_keysym.3 b/SDL/docs/man3/SDL_keysym.3 new file mode 100644 index 0000000..12298d8 --- /dev/null +++ b/SDL/docs/man3/SDL_keysym.3 @@ -0,0 +1,69 @@ +.TH "SDL_keysym" "3" "Tue 11 Sep 2001, 23:00" "SDL" "SDL API Reference" +.SH "NAME" +SDL_keysym \- Keysym structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 scancode; + SDLKey sym; + SDLMod mod; + Uint16 unicode; +} SDL_keysym;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBscancode\fR +Hardware specific scancode +.TP 20 +\fBsym\fR +SDL virtual keysym +.TP 20 +\fBmod\fR +Current key modifiers +.TP 20 +\fBunicode\fR +Translated character +.SH "DESCRIPTION" +.PP +The \fBSDL_keysym\fR structure is used by reporting key presses and releases since it is a part of the \fI\fBSDL_KeyboardEvent\fR\fR\&. +.PP +The \fBscancode\fR field should generally be left alone, it is the hardware dependent scancode returned by the keyboard\&. The \fBsym\fR field is extremely useful\&. It is the SDL-defined value of the key (see \fISDL Key Syms\fR\&. This field is very useful when you are checking for certain key presses, like so: +.PP +.nf +\f(CW\&. +\&. +while(SDL_PollEvent(&event)){ + switch(event\&.type){ + case SDL_KEYDOWN: + if(event\&.key\&.keysym\&.sym==SDLK_LEFT) + move_left(); + break; + \&. + \&. + \&. + } +} +\&. +\&.\fR +.fi +.PP + \fBmod\fR stores the current state of the keyboard modifiers as explained in \fI\fBSDL_GetModState\fP\fR\&. The \fBunicode\fR is only used when UNICODE translation is enabled with \fI\fBSDL_EnableUNICODE\fP\fR\&. If \fBunicode\fR is non-zero then this a the UNICODE character corresponding to the keypress\&. If the high 9 bits of the character are 0, then this maps to the equivalent ASCII character: +.PP +.nf +\f(CWchar ch; +if ( (keysym\&.unicode & 0xFF80) == 0 ) { + ch = keysym\&.unicode & 0x7F; +} +else { + printf("An International Character\&. +"); +}\fR +.fi +.PP + UNICODE translation does have a slight overhead so don\&'t enable it unless its needed\&. +.SH "SEE ALSO" +.PP +\fI\fBSDLKey\fR\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:00 diff --git a/SDL/docs/man3/SDL_mutexP.3 b/SDL/docs/man3/SDL_mutexP.3 new file mode 100644 index 0000000..ceb36c3 --- /dev/null +++ b/SDL/docs/man3/SDL_mutexP.3 @@ -0,0 +1,18 @@ +.TH "SDL_mutexP" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_mutexP \- Lock a mutex +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_mutexP\fP\fR(\fBSDL_mutex *mutex\fR); +.SH "DESCRIPTION" +.PP +Locks the \fBmutex\fR, which was previously created with \fI\fBSDL_CreateMutex\fP\fR\&. If the mutex is already locked then \fBSDL_mutexP\fP will not return until it is \fIunlocked\fR\&. Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.PP +SDL also defines a macro \fB#define SDL_LockMutex(m) SDL_mutexP(m)\fP\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateMutex\fP\fR, \fI\fBSDL_mutexV\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/docs/man3/SDL_mutexV.3 b/SDL/docs/man3/SDL_mutexV.3 new file mode 100644 index 0000000..50abf69 --- /dev/null +++ b/SDL/docs/man3/SDL_mutexV.3 @@ -0,0 +1,18 @@ +.TH "SDL_mutexV" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" +.SH "NAME" +SDL_mutexV \- Unlock a mutex +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_mutexV\fP\fR(\fBSDL_mutex *mutex\fR); +.SH "DESCRIPTION" +.PP +Unlocks the \fBmutex\fR, which was previously created with \fI\fBSDL_CreateMutex\fP\fR\&. Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.PP +SDL also defines a macro \fB#define SDL_UnlockMutex(m) SDL_mutexV(m)\fP\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateMutex\fP\fR, \fI\fBSDL_mutexP\fP\fR +...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 diff --git a/SDL/sdl-config.in b/SDL/sdl-config.in new file mode 100644 index 0000000..25a402d --- /dev/null +++ b/SDL/sdl-config.in @@ -0,0 +1,60 @@ +#!/bin/sh + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +exec_prefix_set=no +libdir=@libdir@ + +@ENABLE_STATIC_FALSE@usage="\ +@ENABLE_STATIC_FALSE@Usage: sdl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]" +@ENABLE_STATIC_TRUE@usage="\ +@ENABLE_STATIC_TRUE@Usage: sdl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | LC_ALL="C" sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo $prefix + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo $exec_prefix + ;; + --version) + echo @SDL_VERSION@ + ;; + --cflags) + echo -I@includedir@/SDL @SDL_CFLAGS@ + ;; +@ENABLE_SHARED_TRUE@ --libs) +@ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@ +@ENABLE_SHARED_TRUE@ ;; +@ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs) +@ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs) +@ENABLE_STATIC_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_STATIC_LIBS@ +@ENABLE_STATIC_TRUE@ ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done diff --git a/SDL/sdl.m4 b/SDL/sdl.m4 new file mode 100644 index 0000000..1a58fef --- /dev/null +++ b/SDL/sdl.m4 @@ -0,0 +1,183 @@ +# Configure paths for SDL +# Sam Lantinga 9/21/99 +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS +dnl +AC_DEFUN([AM_PATH_SDL], +[dnl +dnl Get the cflags and libraries from the sdl-config script +dnl +AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], + sdl_prefix="$withval", sdl_prefix="") +AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], + sdl_exec_prefix="$withval", sdl_exec_prefix="") +AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], + , enable_sdltest=yes) + + if test x$sdl_exec_prefix != x ; then + sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_prefix/bin/sdl-config + fi + fi + + as_save_PATH="$PATH" + if test "x$prefix" != xNONE; then + PATH="$prefix/bin:$prefix/usr/bin:$PATH" + fi + AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) + PATH="$as_save_PATH" + min_sdl_version=ifelse([$1], ,0.11.0,$1) + AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) + no_sdl="" + if test "$SDL_CONFIG" = "no" ; then + no_sdl=yes + else + SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs` + + sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SDL is sufficiently new. (Also sanity +dnl checks the results of sdl-config to some extent +dnl + rm -f conf.sdltest + AC_TRY_RUN([ +#include +#include +#include +#include "SDL.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.sdltest"); + */ + { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_sdl_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); + printf("*** to point to the correct copy of sdl-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdl" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$SDL_CONFIG" = "no" ; then + echo "*** The sdl-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL_CONFIG environment variable to the" + echo "*** full path to sdl-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + AC_TRY_LINK([ +#include +#include "SDL.h" + +int main(int argc, char *argv[]) +{ return 0; } +#undef main +#define main K_and_R_C_main +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SDL_CFLAGS) + AC_SUBST(SDL_LIBS) + rm -f conf.sdltest +]) diff --git a/SDL/sdl.pc.in b/SDL/sdl.pc.in new file mode 100644 index 0000000..c9e95e4 --- /dev/null +++ b/SDL/sdl.pc.in @@ -0,0 +1,15 @@ +# sdl pkg-config source file + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: sdl +Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. +Version: @SDL_VERSION@ +Requires: +Conflicts: +Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ +Libs.private: @SDL_STATIC_LIBS@ +Cflags: -I${includedir}/SDL @SDL_CFLAGS@ diff --git a/SDL/src/SDL.c b/SDL/src/SDL.c new file mode 100644 index 0000000..00c5524 --- /dev/null +++ b/SDL/src/SDL.c @@ -0,0 +1,350 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Initialization code for SDL */ + +#include "SDL.h" +#include "SDL_fatal.h" +#if !SDL_VIDEO_DISABLED +#include "video/SDL_leaks.h" +#endif + +#if SDL_THREAD_PTH +#include +#endif + +/* Initialization/Cleanup routines */ +#if !SDL_JOYSTICK_DISABLED +extern int SDL_JoystickInit(void); +extern void SDL_JoystickQuit(void); +#endif +#if !SDL_CDROM_DISABLED +extern int SDL_CDROMInit(void); +extern void SDL_CDROMQuit(void); +#endif +#if !SDL_TIMERS_DISABLED +extern void SDL_StartTicks(void); +extern int SDL_TimerInit(void); +extern void SDL_TimerQuit(void); +#endif + +/* The current SDL version */ +static SDL_version version = + { SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL }; + +/* The initialized subsystems */ +static Uint32 SDL_initialized = 0; +#if !SDL_TIMERS_DISABLED +static Uint32 ticks_started = 0; +#endif + +#ifdef CHECK_LEAKS +int surfaces_allocated = 0; +#endif + +int SDL_InitSubSystem(Uint32 flags) +{ +#if !SDL_VIDEO_DISABLED + /* Initialize the video/event subsystem */ + if ( (flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO) ) { + if ( SDL_VideoInit(SDL_getenv("SDL_VIDEODRIVER"), + (flags&SDL_INIT_EVENTTHREAD)) < 0 ) { + return(-1); + } + SDL_initialized |= SDL_INIT_VIDEO; + } +#else + if ( flags & SDL_INIT_VIDEO ) { + SDL_SetError("SDL not built with video support"); + return(-1); + } +#endif + +#if !SDL_AUDIO_DISABLED + /* Initialize the audio subsystem */ + if ( (flags & SDL_INIT_AUDIO) && !(SDL_initialized & SDL_INIT_AUDIO) ) { + if ( SDL_AudioInit(SDL_getenv("SDL_AUDIODRIVER")) < 0 ) { + return(-1); + } + SDL_initialized |= SDL_INIT_AUDIO; + } +#else + if ( flags & SDL_INIT_AUDIO ) { + SDL_SetError("SDL not built with audio support"); + return(-1); + } +#endif + +#if !SDL_TIMERS_DISABLED + /* Initialize the timer subsystem */ + if ( ! ticks_started ) { + SDL_StartTicks(); + ticks_started = 1; + } + if ( (flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER) ) { + if ( SDL_TimerInit() < 0 ) { + return(-1); + } + SDL_initialized |= SDL_INIT_TIMER; + } +#else + if ( flags & SDL_INIT_TIMER ) { + SDL_SetError("SDL not built with timer support"); + return(-1); + } +#endif + +#if !SDL_JOYSTICK_DISABLED + /* Initialize the joystick subsystem */ + if ( (flags & SDL_INIT_JOYSTICK) && + !(SDL_initialized & SDL_INIT_JOYSTICK) ) { + if ( SDL_JoystickInit() < 0 ) { + return(-1); + } + SDL_initialized |= SDL_INIT_JOYSTICK; + } +#else + if ( flags & SDL_INIT_JOYSTICK ) { + SDL_SetError("SDL not built with joystick support"); + return(-1); + } +#endif + +#if !SDL_CDROM_DISABLED + /* Initialize the CD-ROM subsystem */ + if ( (flags & SDL_INIT_CDROM) && !(SDL_initialized & SDL_INIT_CDROM) ) { + if ( SDL_CDROMInit() < 0 ) { + return(-1); + } + SDL_initialized |= SDL_INIT_CDROM; + } +#else + if ( flags & SDL_INIT_CDROM ) { + SDL_SetError("SDL not built with cdrom support"); + return(-1); + } +#endif + return(0); +} + +int SDL_Init(Uint32 flags) +{ +#if !SDL_THREADS_DISABLED && SDL_THREAD_PTH + if (!pth_init()) { + return -1; + } +#endif + + /* Clear the error message */ + SDL_ClearError(); + + /* Initialize the desired subsystems */ + if ( SDL_InitSubSystem(flags) < 0 ) { + return(-1); + } + + /* Everything is initialized */ + if ( !(flags & SDL_INIT_NOPARACHUTE) ) { + SDL_InstallParachute(); + } + return(0); +} + +void SDL_QuitSubSystem(Uint32 flags) +{ + /* Shut down requested initialized subsystems */ +#if !SDL_CDROM_DISABLED + if ( (flags & SDL_initialized & SDL_INIT_CDROM) ) { + SDL_CDROMQuit(); + SDL_initialized &= ~SDL_INIT_CDROM; + } +#endif +#if !SDL_JOYSTICK_DISABLED + if ( (flags & SDL_initialized & SDL_INIT_JOYSTICK) ) { + SDL_JoystickQuit(); + SDL_initialized &= ~SDL_INIT_JOYSTICK; + } +#endif +#if !SDL_TIMERS_DISABLED + if ( (flags & SDL_initialized & SDL_INIT_TIMER) ) { + SDL_TimerQuit(); + SDL_initialized &= ~SDL_INIT_TIMER; + } +#endif +#if !SDL_AUDIO_DISABLED + if ( (flags & SDL_initialized & SDL_INIT_AUDIO) ) { + SDL_AudioQuit(); + SDL_initialized &= ~SDL_INIT_AUDIO; + } +#endif +#if !SDL_VIDEO_DISABLED + if ( (flags & SDL_initialized & SDL_INIT_VIDEO) ) { + SDL_VideoQuit(); + SDL_initialized &= ~SDL_INIT_VIDEO; + } +#endif +} + +Uint32 SDL_WasInit(Uint32 flags) +{ + if ( ! flags ) { + flags = SDL_INIT_EVERYTHING; + } + return (SDL_initialized&flags); +} + +void SDL_Quit(void) +{ + /* Quit all subsystems */ +#ifdef DEBUG_BUILD + printf("[SDL_Quit] : Enter! Calling QuitSubSystem()\n"); fflush(stdout); +#endif + SDL_QuitSubSystem(SDL_INIT_EVERYTHING); + +#ifdef CHECK_LEAKS +#ifdef DEBUG_BUILD + printf("[SDL_Quit] : CHECK_LEAKS\n"); fflush(stdout); +#endif + + /* Print the number of surfaces not freed */ + if ( surfaces_allocated != 0 ) { + fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n", + surfaces_allocated); + } +#endif +#ifdef DEBUG_BUILD + printf("[SDL_Quit] : SDL_UninstallParachute()\n"); fflush(stdout); +#endif + + /* Uninstall any parachute signal handlers */ + SDL_UninstallParachute(); + +#if !SDL_THREADS_DISABLED && SDL_THREAD_PTH + pth_kill(); +#endif +#ifdef DEBUG_BUILD + printf("[SDL_Quit] : Returning!\n"); fflush(stdout); +#endif + +} + +/* Return the library version number */ +const SDL_version * SDL_Linked_Version(void) +{ + return(&version); +} + +#if defined(__OS2__) +/* Building for OS/2 */ +#ifdef __WATCOMC__ + +#define INCL_DOSERRORS +#define INCL_DOSEXCEPTIONS +#include + +/* Exception handler to prevent the Audio thread hanging, making a zombie process! */ +ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec, + PEXCEPTIONREGISTRATIONRECORD pERegRec, + PCONTEXTRECORD pCtxRec, + PVOID p) +{ + if (pERepRec->fHandlerFlags & EH_EXIT_UNWIND) + return XCPT_CONTINUE_SEARCH; + if (pERepRec->fHandlerFlags & EH_UNWINDING) + return XCPT_CONTINUE_SEARCH; + if (pERepRec->fHandlerFlags & EH_NESTED_CALL) + return XCPT_CONTINUE_SEARCH; + + /* Do cleanup at every fatal exception! */ + if (((pERepRec->ExceptionNum & XCPT_SEVERITY_CODE) == XCPT_FATAL_EXCEPTION) && + (pERepRec->ExceptionNum != XCPT_BREAKPOINT) && + (pERepRec->ExceptionNum != XCPT_SINGLE_STEP) + ) + { + if (SDL_initialized & SDL_INIT_AUDIO) + { + /* This removes the zombie audio thread in case of emergency. */ +#ifdef DEBUG_BUILD + printf("[SDL_Main_ExceptionHandler] : Calling SDL_CloseAudio()!\n"); +#endif + SDL_CloseAudio(); + } + } + return (XCPT_CONTINUE_SEARCH); +} + + +EXCEPTIONREGISTRATIONRECORD SDL_Main_xcpthand = {0, SDL_Main_ExceptionHandler}; + +/* The main DLL entry for DLL Initialization and Uninitialization: */ +unsigned _System LibMain(unsigned hmod, unsigned termination) +{ + if (termination) + { +#ifdef DEBUG_BUILD +/* printf("[SDL DLL Unintialization] : Removing exception handler\n"); */ +#endif + DosUnsetExceptionHandler(&SDL_Main_xcpthand); + return 1; + } else + { +#ifdef DEBUG_BUILD + /* Make stdout and stderr unbuffered! */ + setbuf(stdout, NULL); + setbuf(stderr, NULL); +#endif + /* Fire up exception handler */ +#ifdef DEBUG_BUILD +/* printf("[SDL DLL Initialization] : Setting exception handler\n"); */ +#endif + /* Set exception handler */ + DosSetExceptionHandler(&SDL_Main_xcpthand); + + return 1; + } +} +#endif /* __WATCOMC__ */ + +#elif defined(__WIN32__) && !defined(__SYMBIAN32__) + +#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL)) +/* Need to include DllMain() on Watcom C for some reason.. */ +#define WIN32_LEAN_AND_MEAN +#include + +BOOL APIENTRY _DllMainCRTStartup( HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved ) +{ + switch (ul_reason_for_call) { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} +#endif /* building DLL with Watcom C */ + +#endif /* OS/2 elif __WIN32__ */ diff --git a/SDL/src/SDL_error.c b/SDL/src/SDL_error.c new file mode 100644 index 0000000..6fb8664 --- /dev/null +++ b/SDL/src/SDL_error.c @@ -0,0 +1,238 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Simple error handling in SDL */ + +#include "SDL_error.h" +#include "SDL_error_c.h" + +/* Routine to get the thread-specific error variable */ +#if SDL_THREADS_DISABLED +/* The SDL_arraysize(The ),default (non-thread-safe) global error variable */ +static SDL_error SDL_global_error; +#define SDL_GetErrBuf() (&SDL_global_error) +#else +extern SDL_error *SDL_GetErrBuf(void); +#endif /* SDL_THREADS_DISABLED */ + +#define SDL_ERRBUFIZE 1024 + +/* Private functions */ + +static const char *SDL_LookupString(const char *key) +{ + /* FIXME: Add code to lookup key in language string hash-table */ + return key; +} + +/* Public functions */ + +void SDL_SetError (const char *fmt, ...) +{ + va_list ap; + SDL_error *error; + + /* Copy in the key, mark error as valid */ + error = SDL_GetErrBuf(); + error->error = 1; + SDL_strlcpy((char *)error->key, fmt, sizeof(error->key)); + + va_start(ap, fmt); + error->argc = 0; + while ( *fmt ) { + if ( *fmt++ == '%' ) { + while ( *fmt == '.' || (*fmt >= '0' && *fmt <= '9') ) { + ++fmt; + } + switch (*fmt++) { + case 0: /* Malformed format string.. */ + --fmt; + break; + case 'c': + case 'i': + case 'd': + case 'u': + case 'o': + case 'x': + case 'X': + error->args[error->argc++].value_i = + va_arg(ap, int); + break; + case 'f': + error->args[error->argc++].value_f = + va_arg(ap, double); + break; + case 'p': + error->args[error->argc++].value_ptr = + va_arg(ap, void *); + break; + case 's': + { + int i = error->argc; + const char *str = va_arg(ap, const char *); + if (str == NULL) + str = "(null)"; + SDL_strlcpy((char *)error->args[i].buf, str, ERR_MAX_STRLEN); + error->argc++; + } + break; + default: + break; + } + if ( error->argc >= ERR_MAX_ARGS ) { + break; + } + } + } + va_end(ap); + + /* If we are in debug mode, print out an error message */ +#ifdef DEBUG_ERROR + fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError()); +#endif +} + +/* This function has a bit more overhead than most error functions + so that it supports internationalization and thread-safe errors. +*/ +char *SDL_GetErrorMsg(char *errstr, unsigned int maxlen) +{ + SDL_error *error; + + /* Clear the error string */ + *errstr = '\0'; --maxlen; + + /* Get the thread-safe error, and print it out */ + error = SDL_GetErrBuf(); + if ( error->error ) { + const char *fmt; + char *msg = errstr; + int len; + int argi; + + fmt = SDL_LookupString(error->key); + argi = 0; + while ( *fmt && (maxlen > 0) ) { + if ( *fmt == '%' ) { + char tmp[32], *spot = tmp; + *spot++ = *fmt++; + while ( (*fmt == '.' || (*fmt >= '0' && *fmt <= '9')) && spot < (tmp+SDL_arraysize(tmp)-2) ) { + *spot++ = *fmt++; + } + *spot++ = *fmt++; + *spot++ = '\0'; + switch (spot[-2]) { + case '%': + *msg++ = '%'; + maxlen -= 1; + break; + case 'c': + case 'i': + case 'd': + case 'u': + case 'o': + case 'x': + case 'X': + len = SDL_snprintf(msg, maxlen, tmp, error->args[argi++].value_i); + msg += len; + maxlen -= len; + break; + case 'f': + len = SDL_snprintf(msg, maxlen, tmp, error->args[argi++].value_f); + msg += len; + maxlen -= len; + break; + case 'p': + len = SDL_snprintf(msg, maxlen, tmp, error->args[argi++].value_ptr); + msg += len; + maxlen -= len; + break; + case 's': + len = SDL_snprintf(msg, maxlen, tmp, SDL_LookupString(error->args[argi++].buf)); + msg += len; + maxlen -= len; + break; + } + } else { + *msg++ = *fmt++; + maxlen -= 1; + } + } + *msg = 0; /* NULL terminate the string */ + } + return(errstr); +} + +/* Available for backwards compatibility */ +char *SDL_GetError (void) +{ + static char errmsg[SDL_ERRBUFIZE]; + + return((char *)SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE)); +} + +void SDL_ClearError(void) +{ + SDL_error *error; + + error = SDL_GetErrBuf(); + error->error = 0; +} + +/* Very common errors go here */ +void SDL_Error(SDL_errorcode code) +{ + switch (code) { + case SDL_ENOMEM: + SDL_SetError("Out of memory"); + break; + case SDL_EFREAD: + SDL_SetError("Error reading from datastream"); + break; + case SDL_EFWRITE: + SDL_SetError("Error writing to datastream"); + break; + case SDL_EFSEEK: + SDL_SetError("Error seeking in datastream"); + break; + default: + SDL_SetError("Unknown SDL error"); + break; + } +} + +#ifdef TEST_ERROR +int main(int argc, char *argv[]) +{ + char buffer[BUFSIZ+1]; + + SDL_SetError("Hi there!"); + printf("Error 1: %s\n", SDL_GetError()); + SDL_ClearError(); + SDL_memset(buffer, '1', BUFSIZ); + buffer[BUFSIZ] = 0; + SDL_SetError("This is the error: %s (%f)", buffer, 1.0); + printf("Error 2: %s\n", SDL_GetError()); + exit(0); +} +#endif diff --git a/SDL/src/SDL_error_c.h b/SDL/src/SDL_error_c.h new file mode 100644 index 0000000..aceda38 --- /dev/null +++ b/SDL/src/SDL_error_c.h @@ -0,0 +1,58 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* This file defines a structure that carries language-independent + error messages +*/ + +#ifndef _SDL_error_c_h +#define _SDL_error_c_h + +#define ERR_MAX_STRLEN 128 +#define ERR_MAX_ARGS 5 + +typedef struct SDL_error { + /* This is a numeric value corresponding to the current error */ + int error; + + /* This is a key used to index into a language hashtable containing + internationalized versions of the SDL error messages. If the key + is not in the hashtable, or no hashtable is available, the key is + used directly as an error message format string. + */ + char key[ERR_MAX_STRLEN]; + + /* These are the arguments for the error functions */ + int argc; + union { + void *value_ptr; +#if 0 /* What is a character anyway? (UNICODE issues) */ + unsigned char value_c; +#endif + int value_i; + double value_f; + char buf[ERR_MAX_STRLEN]; + } args[ERR_MAX_ARGS]; +} SDL_error; + +#endif /* _SDL_error_c_h */ diff --git a/SDL/src/SDL_fatal.c b/SDL/src/SDL_fatal.c new file mode 100644 index 0000000..bc9162c --- /dev/null +++ b/SDL/src/SDL_fatal.c @@ -0,0 +1,134 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* General fatal signal handling code for SDL */ + +#ifdef HAVE_SIGNAL_H + +#include + +#include "SDL.h" +#include "SDL_fatal.h" + +/* This installs some signal handlers for the more common fatal signals, + so that if the programmer is lazy, the app doesn't die so horribly if + the program crashes. +*/ + +static void SDL_Parachute(int sig) +{ + signal(sig, SIG_DFL); + SDL_Quit(); + raise(sig); +} + +static int SDL_fatal_signals[] = { + SIGSEGV, +#ifdef SIGBUS + SIGBUS, +#endif +#ifdef SIGFPE + SIGFPE, +#endif +#ifdef SIGQUIT + SIGQUIT, +#endif + 0 +}; + +void SDL_InstallParachute(void) +{ + /* Set a handler for any fatal signal not already handled */ + int i; +#ifdef HAVE_SIGACTION + struct sigaction action; + + for ( i=0; SDL_fatal_signals[i]; ++i ) { + sigaction(SDL_fatal_signals[i], NULL, &action); + if ( action.sa_handler == SIG_DFL ) { + action.sa_handler = SDL_Parachute; + sigaction(SDL_fatal_signals[i], &action, NULL); + } + } +#ifdef SIGALRM + /* Set SIGALRM to be ignored -- necessary on Solaris */ + sigaction(SIGALRM, NULL, &action); + if ( action.sa_handler == SIG_DFL ) { + action.sa_handler = SIG_IGN; + sigaction(SIGALRM, &action, NULL); + } +#endif +#else + void (*ohandler)(int); + + for ( i=0; SDL_fatal_signals[i]; ++i ) { + ohandler = signal(SDL_fatal_signals[i], SDL_Parachute); + if ( ohandler != SIG_DFL ) { + signal(SDL_fatal_signals[i], ohandler); + } + } +#endif /* HAVE_SIGACTION */ + return; +} + +void SDL_UninstallParachute(void) +{ + /* Remove a handler for any fatal signal handled */ + int i; +#ifdef HAVE_SIGACTION + struct sigaction action; + + for ( i=0; SDL_fatal_signals[i]; ++i ) { + sigaction(SDL_fatal_signals[i], NULL, &action); + if ( action.sa_handler == SDL_Parachute ) { + action.sa_handler = SIG_DFL; + sigaction(SDL_fatal_signals[i], &action, NULL); + } + } +#else + void (*ohandler)(int); + + for ( i=0; SDL_fatal_signals[i]; ++i ) { + ohandler = signal(SDL_fatal_signals[i], SIG_DFL); + if ( ohandler != SDL_Parachute ) { + signal(SDL_fatal_signals[i], ohandler); + } + } +#endif /* HAVE_SIGACTION */ +} + +#else + +/* No signals on this platform, nothing to do.. */ + +void SDL_InstallParachute(void) +{ + return; +} + +void SDL_UninstallParachute(void) +{ + return; +} + +#endif /* HAVE_SIGNAL_H */ diff --git a/SDL/src/SDL_fatal.h b/SDL/src/SDL_fatal.h new file mode 100644 index 0000000..75852f5 --- /dev/null +++ b/SDL/src/SDL_fatal.h @@ -0,0 +1,28 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* General fatal signal handling code for SDL */ + +extern void SDL_InstallParachute(void); +extern void SDL_UninstallParachute(void); + diff --git a/SDL/src/audio/SDL_audio.c b/SDL/src/audio/SDL_audio.c new file mode 100644 index 0000000..8c935f4 --- /dev/null +++ b/SDL/src/audio/SDL_audio.c @@ -0,0 +1,698 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Allow access to a raw mixing buffer */ + +#include "SDL.h" +#include "SDL_audio_c.h" +#include "SDL_audiomem.h" +#include "SDL_sysaudio.h" + +#ifdef __OS2__ +/* We'll need the DosSetPriority() API! */ +#define INCL_DOSPROCESS +#include +#endif + +/* Available audio drivers */ +static AudioBootStrap *bootstrap[] = { +#if SDL_AUDIO_DRIVER_BSD + &BSD_AUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_OSS + &DSP_bootstrap, + &DMA_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_ALSA + &ALSA_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_PULSE + &PULSE_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_QNXNTO + &QNXNTOAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_SUNAUDIO + &SUNAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DMEDIA + &DMEDIA_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_ARTS + &ARTS_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_ESD + &ESD_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_NAS + &NAS_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DSOUND + &DSOUND_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_WAVEOUT + &WAVEOUT_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_PAUD + &Paud_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_BAUDIO + &BAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_COREAUDIO + &COREAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_SNDMGR + &SNDMGR_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_MINT + &MINTAUDIO_GSXB_bootstrap, + &MINTAUDIO_MCSN_bootstrap, + &MINTAUDIO_STFA_bootstrap, + &MINTAUDIO_XBIOS_bootstrap, + &MINTAUDIO_DMA8_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DISK + &DISKAUD_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DUMMY + &DUMMYAUD_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_WII + &WIIAUD_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DC + &DCAUD_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_NDS + &NDSAUD_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_MMEAUDIO + &MMEAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DART + &DART_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_EPOCAUDIO + &EPOCAudio_bootstrap, +#endif + NULL +}; +SDL_AudioDevice *current_audio = NULL; + +/* Various local functions */ +int SDL_AudioInit(const char *driver_name); +void SDL_AudioQuit(void); + +/* The general mixing thread function */ +int SDLCALL SDL_RunAudio(void *audiop) +{ + SDL_AudioDevice *audio = (SDL_AudioDevice *)audiop; + Uint8 *stream; + int stream_len; + void *udata; + void (SDLCALL *fill)(void *userdata,Uint8 *stream, int len); + int silence; + + /* Perform any thread setup */ + if ( audio->ThreadInit ) { + audio->ThreadInit(audio); + } + audio->threadid = SDL_ThreadID(); + + /* Set up the mixing function */ + fill = audio->spec.callback; + udata = audio->spec.userdata; + + if ( audio->convert.needed ) { + if ( audio->convert.src_format == AUDIO_U8 ) { + silence = 0x80; + } else { + silence = 0; + } + stream_len = audio->convert.len; + } else { + silence = audio->spec.silence; + stream_len = audio->spec.size; + } + +#ifdef __OS2__ + /* Increase the priority of this thread to make sure that + the audio will be continuous all the time! */ +#ifdef USE_DOSSETPRIORITY + if (SDL_getenv("SDL_USE_TIMECRITICAL_AUDIO")) + { +#ifdef DEBUG_BUILD + printf("[SDL_RunAudio] : Setting priority to TimeCritical+0! (TID%d)\n", SDL_ThreadID()); +#endif + DosSetPriority(PRTYS_THREAD, PRTYC_TIMECRITICAL, 0, 0); + } + else + { +#ifdef DEBUG_BUILD + printf("[SDL_RunAudio] : Setting priority to ForegroundServer+0! (TID%d)\n", SDL_ThreadID()); +#endif + DosSetPriority(PRTYS_THREAD, PRTYC_FOREGROUNDSERVER, 0, 0); + } +#endif +#endif + + /* Loop, filling the audio buffers */ + while ( audio->enabled ) { + + /* Fill the current buffer with sound */ + if ( audio->convert.needed ) { + if ( audio->convert.buf ) { + stream = audio->convert.buf; + } else { + continue; + } + } else { + stream = audio->GetAudioBuf(audio); + if ( stream == NULL ) { + stream = audio->fake_stream; + } + } + + SDL_memset(stream, silence, stream_len); + + if ( ! audio->paused ) { + SDL_mutexP(audio->mixer_lock); + (*fill)(udata, stream, stream_len); + SDL_mutexV(audio->mixer_lock); + } + + /* Convert the audio if necessary */ + if ( audio->convert.needed ) { + SDL_ConvertAudio(&audio->convert); + stream = audio->GetAudioBuf(audio); + if ( stream == NULL ) { + stream = audio->fake_stream; + } + SDL_memcpy(stream, audio->convert.buf, + audio->convert.len_cvt); + } + + /* Ready current buffer for play and change current buffer */ + if ( stream != audio->fake_stream ) { + audio->PlayAudio(audio); + } + + /* Wait for an audio buffer to become available */ + if ( stream == audio->fake_stream ) { + SDL_Delay((audio->spec.samples*1000)/audio->spec.freq); + } else { + audio->WaitAudio(audio); + } + } + + /* Wait for the audio to drain.. */ + if ( audio->WaitDone ) { + audio->WaitDone(audio); + } + +#ifdef __OS2__ +#ifdef DEBUG_BUILD + printf("[SDL_RunAudio] : Task exiting. (TID%d)\n", SDL_ThreadID()); +#endif +#endif + return(0); +} + +static void SDL_LockAudio_Default(SDL_AudioDevice *audio) +{ + if ( audio->thread && (SDL_ThreadID() == audio->threadid) ) { + return; + } + SDL_mutexP(audio->mixer_lock); +} + +static void SDL_UnlockAudio_Default(SDL_AudioDevice *audio) +{ + if ( audio->thread && (SDL_ThreadID() == audio->threadid) ) { + return; + } + SDL_mutexV(audio->mixer_lock); +} + +static Uint16 SDL_ParseAudioFormat(const char *string) +{ + Uint16 format = 0; + + switch (*string) { + case 'U': + ++string; + format |= 0x0000; + break; + case 'S': + ++string; + format |= 0x8000; + break; + default: + return 0; + } + switch (SDL_atoi(string)) { + case 8: + string += 1; + format |= 8; + break; + case 16: + string += 2; + format |= 16; + if ( SDL_strcmp(string, "LSB") == 0 +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + || SDL_strcmp(string, "SYS") == 0 +#endif + ) { + format |= 0x0000; + } + if ( SDL_strcmp(string, "MSB") == 0 +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + || SDL_strcmp(string, "SYS") == 0 +#endif + ) { + format |= 0x1000; + } + break; + default: + return 0; + } + return format; +} + +int SDL_AudioInit(const char *driver_name) +{ + SDL_AudioDevice *audio; + int i = 0, idx; + + /* Check to make sure we don't overwrite 'current_audio' */ + if ( current_audio != NULL ) { + SDL_AudioQuit(); + } + + /* Select the proper audio driver */ + audio = NULL; + idx = 0; +#if SDL_AUDIO_DRIVER_ESD + if ( (driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL) ) { + /* Ahem, we know that if ESPEAKER is set, user probably wants + to use ESD, but don't start it if it's not already running. + This probably isn't the place to do this, but... Shh! :) + */ + for ( i=0; bootstrap[i]; ++i ) { + if ( SDL_strcasecmp(bootstrap[i]->name, "esd") == 0 ) { +#ifdef HAVE_PUTENV + const char *esd_no_spawn; + + /* Don't start ESD if it's not running */ + esd_no_spawn = getenv("ESD_NO_SPAWN"); + if ( esd_no_spawn == NULL ) { + putenv("ESD_NO_SPAWN=1"); + } +#endif + if ( bootstrap[i]->available() ) { + audio = bootstrap[i]->create(0); + break; + } +#ifdef HAVE_UNSETENV + if ( esd_no_spawn == NULL ) { + unsetenv("ESD_NO_SPAWN"); + } +#endif + } + } + } +#endif /* SDL_AUDIO_DRIVER_ESD */ + if ( audio == NULL ) { + if ( driver_name != NULL ) { +#if 0 /* This will be replaced with a better driver selection API */ + if ( SDL_strrchr(driver_name, ':') != NULL ) { + idx = atoi(SDL_strrchr(driver_name, ':')+1); + } +#endif + for ( i=0; bootstrap[i]; ++i ) { + if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) { + if ( bootstrap[i]->available() ) { + audio=bootstrap[i]->create(idx); + break; + } + } + } + } else { + for ( i=0; bootstrap[i]; ++i ) { + if ( bootstrap[i]->available() ) { + audio = bootstrap[i]->create(idx); + if ( audio != NULL ) { + break; + } + } + } + } + if ( audio == NULL ) { + SDL_SetError("No available audio device"); +#if 0 /* Don't fail SDL_Init() if audio isn't available. + SDL_OpenAudio() will handle it at that point. *sigh* + */ + return(-1); +#endif + } + } + current_audio = audio; + if ( current_audio ) { + current_audio->name = bootstrap[i]->name; + if ( !current_audio->LockAudio && !current_audio->UnlockAudio ) { + current_audio->LockAudio = SDL_LockAudio_Default; + current_audio->UnlockAudio = SDL_UnlockAudio_Default; + } + } + return(0); +} + +char *SDL_AudioDriverName(char *namebuf, int maxlen) +{ + if ( current_audio != NULL ) { + SDL_strlcpy(namebuf, current_audio->name, maxlen); + return(namebuf); + } + return(NULL); +} + +int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained) +{ + SDL_AudioDevice *audio; + const char *env; + + /* Start up the audio driver, if necessary */ + if ( ! current_audio ) { + if ( (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) || + (current_audio == NULL) ) { + return(-1); + } + } + audio = current_audio; + + if (audio->opened) { + SDL_SetError("Audio device is already opened"); + return(-1); + } + + /* Verify some parameters */ + if ( desired->freq == 0 ) { + env = SDL_getenv("SDL_AUDIO_FREQUENCY"); + if ( env ) { + desired->freq = SDL_atoi(env); + } + } + if ( desired->freq == 0 ) { + /* Pick some default audio frequency */ + desired->freq = 22050; + } + if ( desired->format == 0 ) { + env = SDL_getenv("SDL_AUDIO_FORMAT"); + if ( env ) { + desired->format = SDL_ParseAudioFormat(env); + } + } + if ( desired->format == 0 ) { + /* Pick some default audio format */ + desired->format = AUDIO_S16; + } + if ( desired->channels == 0 ) { + env = SDL_getenv("SDL_AUDIO_CHANNELS"); + if ( env ) { + desired->channels = (Uint8)SDL_atoi(env); + } + } + if ( desired->channels == 0 ) { + /* Pick a default number of channels */ + desired->channels = 2; + } + switch ( desired->channels ) { + case 1: /* Mono */ + case 2: /* Stereo */ + case 4: /* surround */ + case 6: /* surround with center and lfe */ + break; + default: + SDL_SetError("1 (mono) and 2 (stereo) channels supported"); + return(-1); + } + if ( desired->samples == 0 ) { + env = SDL_getenv("SDL_AUDIO_SAMPLES"); + if ( env ) { + desired->samples = (Uint16)SDL_atoi(env); + } + } + if ( desired->samples == 0 ) { + /* Pick a default of ~46 ms at desired frequency */ + int samples = (desired->freq / 1000) * 46; + int power2 = 1; + while ( power2 < samples ) { + power2 *= 2; + } + desired->samples = power2; + } + if ( desired->callback == NULL ) { + SDL_SetError("SDL_OpenAudio() passed a NULL callback"); + return(-1); + } + +#if SDL_THREADS_DISABLED + /* Uses interrupt driven audio, without thread */ +#else + /* Create a semaphore for locking the sound buffers */ + audio->mixer_lock = SDL_CreateMutex(); + if ( audio->mixer_lock == NULL ) { + SDL_SetError("Couldn't create mixer lock"); + SDL_CloseAudio(); + return(-1); + } +#endif /* SDL_THREADS_DISABLED */ + + /* Calculate the silence and size of the audio specification */ + SDL_CalculateAudioSpec(desired); + + /* Open the audio subsystem */ + SDL_memcpy(&audio->spec, desired, sizeof(audio->spec)); + audio->convert.needed = 0; + audio->enabled = 1; + audio->paused = 1; + + audio->opened = audio->OpenAudio(audio, &audio->spec)+1; + + if ( ! audio->opened ) { + SDL_CloseAudio(); + return(-1); + } + + /* If the audio driver changes the buffer size, accept it */ + if ( audio->spec.samples != desired->samples ) { + desired->samples = audio->spec.samples; + SDL_CalculateAudioSpec(desired); + } + + /* Allocate a fake audio memory buffer */ + audio->fake_stream = SDL_AllocAudioMem(audio->spec.size); + if ( audio->fake_stream == NULL ) { + SDL_CloseAudio(); + SDL_OutOfMemory(); + return(-1); + } + + /* See if we need to do any conversion */ + if ( obtained != NULL ) { + SDL_memcpy(obtained, &audio->spec, sizeof(audio->spec)); + } else if ( desired->freq != audio->spec.freq || + desired->format != audio->spec.format || + desired->channels != audio->spec.channels ) { + /* Build an audio conversion block */ + if ( SDL_BuildAudioCVT(&audio->convert, + desired->format, desired->channels, + desired->freq, + audio->spec.format, audio->spec.channels, + audio->spec.freq) < 0 ) { + SDL_CloseAudio(); + return(-1); + } + if ( audio->convert.needed ) { + audio->convert.len = (int) ( ((double) desired->size) / + audio->convert.len_ratio ); + audio->convert.buf =(Uint8 *)SDL_AllocAudioMem( + audio->convert.len*audio->convert.len_mult); + if ( audio->convert.buf == NULL ) { + SDL_CloseAudio(); + SDL_OutOfMemory(); + return(-1); + } + } + } + + /* Start the audio thread if necessary */ + switch (audio->opened) { + case 1: + /* Start the audio thread */ +#if (defined(__WIN32__) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC) && !defined(__SYMBIAN32__) +#undef SDL_CreateThread + audio->thread = SDL_CreateThread(SDL_RunAudio, audio, NULL, NULL); +#else + audio->thread = SDL_CreateThread(SDL_RunAudio, audio); +#endif + if ( audio->thread == NULL ) { + SDL_CloseAudio(); + SDL_SetError("Couldn't create audio thread"); + return(-1); + } + break; + + default: + /* The audio is now playing */ + break; + } + + return(0); +} + +SDL_audiostatus SDL_GetAudioStatus(void) +{ + SDL_AudioDevice *audio = current_audio; + SDL_audiostatus status; + + status = SDL_AUDIO_STOPPED; + if ( audio && audio->enabled ) { + if ( audio->paused ) { + status = SDL_AUDIO_PAUSED; + } else { + status = SDL_AUDIO_PLAYING; + } + } + return(status); +} + +void SDL_PauseAudio (int pause_on) +{ + SDL_AudioDevice *audio = current_audio; + + if ( audio ) { + audio->paused = pause_on; + } +} + +void SDL_LockAudio (void) +{ + SDL_AudioDevice *audio = current_audio; + + /* Obtain a lock on the mixing buffers */ + if ( audio && audio->LockAudio ) { + audio->LockAudio(audio); + } +} + +void SDL_UnlockAudio (void) +{ + SDL_AudioDevice *audio = current_audio; + + /* Release lock on the mixing buffers */ + if ( audio && audio->UnlockAudio ) { + audio->UnlockAudio(audio); + } +} + +void SDL_CloseAudio (void) +{ + SDL_QuitSubSystem(SDL_INIT_AUDIO); +} + +void SDL_AudioQuit(void) +{ + SDL_AudioDevice *audio = current_audio; + + if ( audio ) { + audio->enabled = 0; + if ( audio->thread != NULL ) { + SDL_WaitThread(audio->thread, NULL); + } + if ( audio->mixer_lock != NULL ) { + SDL_DestroyMutex(audio->mixer_lock); + } + if ( audio->fake_stream != NULL ) { + SDL_FreeAudioMem(audio->fake_stream); + } + if ( audio->convert.needed ) { + SDL_FreeAudioMem(audio->convert.buf); + + } + if ( audio->opened ) { + audio->CloseAudio(audio); + audio->opened = 0; + } + /* Free the driver data */ + audio->free(audio); + current_audio = NULL; + } +} + +#define NUM_FORMATS 6 +static int format_idx; +static int format_idx_sub; +static Uint16 format_list[NUM_FORMATS][NUM_FORMATS] = { + { AUDIO_U8, AUDIO_S8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB }, + { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB }, + { AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8, AUDIO_S8 }, + { AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_U8, AUDIO_S8 }, + { AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U8, AUDIO_S8 }, + { AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U8, AUDIO_S8 }, +}; + +Uint16 SDL_FirstAudioFormat(Uint16 format) +{ + for ( format_idx=0; format_idx < NUM_FORMATS; ++format_idx ) { + if ( format_list[format_idx][0] == format ) { + break; + } + } + format_idx_sub = 0; + return(SDL_NextAudioFormat()); +} + +Uint16 SDL_NextAudioFormat(void) +{ + if ( (format_idx == NUM_FORMATS) || (format_idx_sub == NUM_FORMATS) ) { + return(0); + } + return(format_list[format_idx][format_idx_sub++]); +} + +void SDL_CalculateAudioSpec(SDL_AudioSpec *spec) +{ + switch (spec->format) { + case AUDIO_U8: + spec->silence = 0x80; + break; + default: + spec->silence = 0x00; + break; + } + spec->size = (spec->format&0xFF)/8; + spec->size *= spec->channels; + spec->size *= spec->samples; +} diff --git a/SDL/src/audio/SDL_audio_c.h b/SDL/src/audio/SDL_audio_c.h new file mode 100644 index 0000000..5136984 --- /dev/null +++ b/SDL/src/audio/SDL_audio_c.h @@ -0,0 +1,34 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */ + +/* Functions to get a list of "close" audio formats */ +extern Uint16 SDL_FirstAudioFormat(Uint16 format); +extern Uint16 SDL_NextAudioFormat(void); + +/* Function to calculate the size and silence for a SDL_AudioSpec */ +extern void SDL_CalculateAudioSpec(SDL_AudioSpec *spec); + +/* The actual mixing thread function */ +extern int SDLCALL SDL_RunAudio(void *audiop); diff --git a/SDL/src/audio/SDL_audiocvt.c b/SDL/src/audio/SDL_audiocvt.c new file mode 100644 index 0000000..39bb27a --- /dev/null +++ b/SDL/src/audio/SDL_audiocvt.c @@ -0,0 +1,1510 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Functions for audio drivers to perform runtime conversion of audio format */ + +#include "SDL_audio.h" + + +/* Effectively mix right and left channels into a single channel */ +void SDLCALL SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Sint32 sample; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting to mono\n"); +#endif + switch (format&0x8018) { + + case AUDIO_U8: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + for ( i=cvt->len_cvt/2; i; --i ) { + sample = src[0] + src[1]; + *dst = (Uint8)(sample / 2); + src += 2; + dst += 1; + } + } + break; + + case AUDIO_S8: { + Sint8 *src, *dst; + + src = (Sint8 *)cvt->buf; + dst = (Sint8 *)cvt->buf; + for ( i=cvt->len_cvt/2; i; --i ) { + sample = src[0] + src[1]; + *dst = (Sint8)(sample / 2); + src += 2; + dst += 1; + } + } + break; + + case AUDIO_U16: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/4; i; --i ) { + sample = (Uint16)((src[0]<<8)|src[1])+ + (Uint16)((src[2]<<8)|src[3]); + sample /= 2; + dst[1] = (sample&0xFF); + sample >>= 8; + dst[0] = (sample&0xFF); + src += 4; + dst += 2; + } + } else { + for ( i=cvt->len_cvt/4; i; --i ) { + sample = (Uint16)((src[1]<<8)|src[0])+ + (Uint16)((src[3]<<8)|src[2]); + sample /= 2; + dst[0] = (sample&0xFF); + sample >>= 8; + dst[1] = (sample&0xFF); + src += 4; + dst += 2; + } + } + } + break; + + case AUDIO_S16: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/4; i; --i ) { + sample = (Sint16)((src[0]<<8)|src[1])+ + (Sint16)((src[2]<<8)|src[3]); + sample /= 2; + dst[1] = (sample&0xFF); + sample >>= 8; + dst[0] = (sample&0xFF); + src += 4; + dst += 2; + } + } else { + for ( i=cvt->len_cvt/4; i; --i ) { + sample = (Sint16)((src[1]<<8)|src[0])+ + (Sint16)((src[3]<<8)|src[2]); + sample /= 2; + dst[0] = (sample&0xFF); + sample >>= 8; + dst[1] = (sample&0xFF); + src += 4; + dst += 2; + } + } + } + break; + } + cvt->len_cvt /= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Discard top 4 channels */ +void SDLCALL SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Sint32 lsample, rsample; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting down to stereo\n"); +#endif + switch (format&0x8018) { + + case AUDIO_U8: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + for ( i=cvt->len_cvt/6; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + src += 6; + dst += 2; + } + } + break; + + case AUDIO_S8: { + Sint8 *src, *dst; + + src = (Sint8 *)cvt->buf; + dst = (Sint8 *)cvt->buf; + for ( i=cvt->len_cvt/6; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + src += 6; + dst += 2; + } + } + break; + + case AUDIO_U16: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/12; i; --i ) { + lsample = (Uint16)((src[0]<<8)|src[1]); + rsample = (Uint16)((src[2]<<8)|src[3]); + dst[1] = (lsample&0xFF); + lsample >>= 8; + dst[0] = (lsample&0xFF); + dst[3] = (rsample&0xFF); + rsample >>= 8; + dst[2] = (rsample&0xFF); + src += 12; + dst += 4; + } + } else { + for ( i=cvt->len_cvt/12; i; --i ) { + lsample = (Uint16)((src[1]<<8)|src[0]); + rsample = (Uint16)((src[3]<<8)|src[2]); + dst[0] = (lsample&0xFF); + lsample >>= 8; + dst[1] = (lsample&0xFF); + dst[2] = (rsample&0xFF); + rsample >>= 8; + dst[3] = (rsample&0xFF); + src += 12; + dst += 4; + } + } + } + break; + + case AUDIO_S16: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/12; i; --i ) { + lsample = (Sint16)((src[0]<<8)|src[1]); + rsample = (Sint16)((src[2]<<8)|src[3]); + dst[1] = (lsample&0xFF); + lsample >>= 8; + dst[0] = (lsample&0xFF); + dst[3] = (rsample&0xFF); + rsample >>= 8; + dst[2] = (rsample&0xFF); + src += 12; + dst += 4; + } + } else { + for ( i=cvt->len_cvt/12; i; --i ) { + lsample = (Sint16)((src[1]<<8)|src[0]); + rsample = (Sint16)((src[3]<<8)|src[2]); + dst[0] = (lsample&0xFF); + lsample >>= 8; + dst[1] = (lsample&0xFF); + dst[2] = (rsample&0xFF); + rsample >>= 8; + dst[3] = (rsample&0xFF); + src += 12; + dst += 4; + } + } + } + break; + } + cvt->len_cvt /= 3; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + + +/* Discard top 2 channels of 6 */ +void SDLCALL SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Sint32 lsample, rsample; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting 6 down to quad\n"); +#endif + switch (format&0x8018) { + + case AUDIO_U8: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + for ( i=cvt->len_cvt/4; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + src += 4; + dst += 2; + } + } + break; + + case AUDIO_S8: { + Sint8 *src, *dst; + + src = (Sint8 *)cvt->buf; + dst = (Sint8 *)cvt->buf; + for ( i=cvt->len_cvt/4; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + src += 4; + dst += 2; + } + } + break; + + case AUDIO_U16: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/8; i; --i ) { + lsample = (Uint16)((src[0]<<8)|src[1]); + rsample = (Uint16)((src[2]<<8)|src[3]); + dst[1] = (lsample&0xFF); + lsample >>= 8; + dst[0] = (lsample&0xFF); + dst[3] = (rsample&0xFF); + rsample >>= 8; + dst[2] = (rsample&0xFF); + src += 8; + dst += 4; + } + } else { + for ( i=cvt->len_cvt/8; i; --i ) { + lsample = (Uint16)((src[1]<<8)|src[0]); + rsample = (Uint16)((src[3]<<8)|src[2]); + dst[0] = (lsample&0xFF); + lsample >>= 8; + dst[1] = (lsample&0xFF); + dst[2] = (rsample&0xFF); + rsample >>= 8; + dst[3] = (rsample&0xFF); + src += 8; + dst += 4; + } + } + } + break; + + case AUDIO_S16: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/8; i; --i ) { + lsample = (Sint16)((src[0]<<8)|src[1]); + rsample = (Sint16)((src[2]<<8)|src[3]); + dst[1] = (lsample&0xFF); + lsample >>= 8; + dst[0] = (lsample&0xFF); + dst[3] = (rsample&0xFF); + rsample >>= 8; + dst[2] = (rsample&0xFF); + src += 8; + dst += 4; + } + } else { + for ( i=cvt->len_cvt/8; i; --i ) { + lsample = (Sint16)((src[1]<<8)|src[0]); + rsample = (Sint16)((src[3]<<8)|src[2]); + dst[0] = (lsample&0xFF); + lsample >>= 8; + dst[1] = (lsample&0xFF); + dst[2] = (rsample&0xFF); + rsample >>= 8; + dst[3] = (rsample&0xFF); + src += 8; + dst += 4; + } + } + } + break; + } + cvt->len_cvt /= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Duplicate a mono channel to both stereo channels */ +void SDLCALL SDL_ConvertStereo(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting to stereo\n"); +#endif + if ( (format & 0xFF) == 16 ) { + Uint16 *src, *dst; + + src = (Uint16 *)(cvt->buf+cvt->len_cvt); + dst = (Uint16 *)(cvt->buf+cvt->len_cvt*2); + for ( i=cvt->len_cvt/2; i; --i ) { + dst -= 2; + src -= 1; + dst[0] = src[0]; + dst[1] = src[0]; + } + } else { + Uint8 *src, *dst; + + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + for ( i=cvt->len_cvt; i; --i ) { + dst -= 2; + src -= 1; + dst[0] = src[0]; + dst[1] = src[0]; + } + } + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + + +/* Duplicate a stereo channel to a pseudo-5.1 stream */ +void SDLCALL SDL_ConvertSurround(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting stereo to surround\n"); +#endif + switch (format&0x8018) { + + case AUDIO_U8: { + Uint8 *src, *dst, lf, rf, ce; + + src = (Uint8 *)(cvt->buf+cvt->len_cvt); + dst = (Uint8 *)(cvt->buf+cvt->len_cvt*3); + for ( i=cvt->len_cvt; i; --i ) { + dst -= 6; + src -= 2; + lf = src[0]; + rf = src[1]; + ce = (lf/2) + (rf/2); + dst[0] = lf; + dst[1] = rf; + dst[2] = lf - ce; + dst[3] = rf - ce; + dst[4] = ce; + dst[5] = ce; + } + } + break; + + case AUDIO_S8: { + Sint8 *src, *dst, lf, rf, ce; + + src = (Sint8 *)cvt->buf+cvt->len_cvt; + dst = (Sint8 *)cvt->buf+cvt->len_cvt*3; + for ( i=cvt->len_cvt; i; --i ) { + dst -= 6; + src -= 2; + lf = src[0]; + rf = src[1]; + ce = (lf/2) + (rf/2); + dst[0] = lf; + dst[1] = rf; + dst[2] = lf - ce; + dst[3] = rf - ce; + dst[4] = ce; + dst[5] = ce; + } + } + break; + + case AUDIO_U16: { + Uint8 *src, *dst; + Uint16 lf, rf, ce, lr, rr; + + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*3; + + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/4; i; --i ) { + dst -= 12; + src -= 4; + lf = (Uint16)((src[0]<<8)|src[1]); + rf = (Uint16)((src[2]<<8)|src[3]); + ce = (lf/2) + (rf/2); + rr = lf - ce; + lr = rf - ce; + dst[1] = (lf&0xFF); + dst[0] = ((lf>>8)&0xFF); + dst[3] = (rf&0xFF); + dst[2] = ((rf>>8)&0xFF); + + dst[1+4] = (lr&0xFF); + dst[0+4] = ((lr>>8)&0xFF); + dst[3+4] = (rr&0xFF); + dst[2+4] = ((rr>>8)&0xFF); + + dst[1+8] = (ce&0xFF); + dst[0+8] = ((ce>>8)&0xFF); + dst[3+8] = (ce&0xFF); + dst[2+8] = ((ce>>8)&0xFF); + } + } else { + for ( i=cvt->len_cvt/4; i; --i ) { + dst -= 12; + src -= 4; + lf = (Uint16)((src[1]<<8)|src[0]); + rf = (Uint16)((src[3]<<8)|src[2]); + ce = (lf/2) + (rf/2); + rr = lf - ce; + lr = rf - ce; + dst[0] = (lf&0xFF); + dst[1] = ((lf>>8)&0xFF); + dst[2] = (rf&0xFF); + dst[3] = ((rf>>8)&0xFF); + + dst[0+4] = (lr&0xFF); + dst[1+4] = ((lr>>8)&0xFF); + dst[2+4] = (rr&0xFF); + dst[3+4] = ((rr>>8)&0xFF); + + dst[0+8] = (ce&0xFF); + dst[1+8] = ((ce>>8)&0xFF); + dst[2+8] = (ce&0xFF); + dst[3+8] = ((ce>>8)&0xFF); + } + } + } + break; + + case AUDIO_S16: { + Uint8 *src, *dst; + Sint16 lf, rf, ce, lr, rr; + + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*3; + + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/4; i; --i ) { + dst -= 12; + src -= 4; + lf = (Sint16)((src[0]<<8)|src[1]); + rf = (Sint16)((src[2]<<8)|src[3]); + ce = (lf/2) + (rf/2); + rr = lf - ce; + lr = rf - ce; + dst[1] = (lf&0xFF); + dst[0] = ((lf>>8)&0xFF); + dst[3] = (rf&0xFF); + dst[2] = ((rf>>8)&0xFF); + + dst[1+4] = (lr&0xFF); + dst[0+4] = ((lr>>8)&0xFF); + dst[3+4] = (rr&0xFF); + dst[2+4] = ((rr>>8)&0xFF); + + dst[1+8] = (ce&0xFF); + dst[0+8] = ((ce>>8)&0xFF); + dst[3+8] = (ce&0xFF); + dst[2+8] = ((ce>>8)&0xFF); + } + } else { + for ( i=cvt->len_cvt/4; i; --i ) { + dst -= 12; + src -= 4; + lf = (Sint16)((src[1]<<8)|src[0]); + rf = (Sint16)((src[3]<<8)|src[2]); + ce = (lf/2) + (rf/2); + rr = lf - ce; + lr = rf - ce; + dst[0] = (lf&0xFF); + dst[1] = ((lf>>8)&0xFF); + dst[2] = (rf&0xFF); + dst[3] = ((rf>>8)&0xFF); + + dst[0+4] = (lr&0xFF); + dst[1+4] = ((lr>>8)&0xFF); + dst[2+4] = (rr&0xFF); + dst[3+4] = ((rr>>8)&0xFF); + + dst[0+8] = (ce&0xFF); + dst[1+8] = ((ce>>8)&0xFF); + dst[2+8] = (ce&0xFF); + dst[3+8] = ((ce>>8)&0xFF); + } + } + } + break; + } + cvt->len_cvt *= 3; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + + +/* Duplicate a stereo channel to a pseudo-4.0 stream */ +void SDLCALL SDL_ConvertSurround_4(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting stereo to quad\n"); +#endif + switch (format&0x8018) { + + case AUDIO_U8: { + Uint8 *src, *dst, lf, rf, ce; + + src = (Uint8 *)(cvt->buf+cvt->len_cvt); + dst = (Uint8 *)(cvt->buf+cvt->len_cvt*2); + for ( i=cvt->len_cvt; i; --i ) { + dst -= 4; + src -= 2; + lf = src[0]; + rf = src[1]; + ce = (lf/2) + (rf/2); + dst[0] = lf; + dst[1] = rf; + dst[2] = lf - ce; + dst[3] = rf - ce; + } + } + break; + + case AUDIO_S8: { + Sint8 *src, *dst, lf, rf, ce; + + src = (Sint8 *)cvt->buf+cvt->len_cvt; + dst = (Sint8 *)cvt->buf+cvt->len_cvt*2; + for ( i=cvt->len_cvt; i; --i ) { + dst -= 4; + src -= 2; + lf = src[0]; + rf = src[1]; + ce = (lf/2) + (rf/2); + dst[0] = lf; + dst[1] = rf; + dst[2] = lf - ce; + dst[3] = rf - ce; + } + } + break; + + case AUDIO_U16: { + Uint8 *src, *dst; + Uint16 lf, rf, ce, lr, rr; + + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/4; i; --i ) { + dst -= 8; + src -= 4; + lf = (Uint16)((src[0]<<8)|src[1]); + rf = (Uint16)((src[2]<<8)|src[3]); + ce = (lf/2) + (rf/2); + rr = lf - ce; + lr = rf - ce; + dst[1] = (lf&0xFF); + dst[0] = ((lf>>8)&0xFF); + dst[3] = (rf&0xFF); + dst[2] = ((rf>>8)&0xFF); + + dst[1+4] = (lr&0xFF); + dst[0+4] = ((lr>>8)&0xFF); + dst[3+4] = (rr&0xFF); + dst[2+4] = ((rr>>8)&0xFF); + } + } else { + for ( i=cvt->len_cvt/4; i; --i ) { + dst -= 8; + src -= 4; + lf = (Uint16)((src[1]<<8)|src[0]); + rf = (Uint16)((src[3]<<8)|src[2]); + ce = (lf/2) + (rf/2); + rr = lf - ce; + lr = rf - ce; + dst[0] = (lf&0xFF); + dst[1] = ((lf>>8)&0xFF); + dst[2] = (rf&0xFF); + dst[3] = ((rf>>8)&0xFF); + + dst[0+4] = (lr&0xFF); + dst[1+4] = ((lr>>8)&0xFF); + dst[2+4] = (rr&0xFF); + dst[3+4] = ((rr>>8)&0xFF); + } + } + } + break; + + case AUDIO_S16: { + Uint8 *src, *dst; + Sint16 lf, rf, ce, lr, rr; + + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/4; i; --i ) { + dst -= 8; + src -= 4; + lf = (Sint16)((src[0]<<8)|src[1]); + rf = (Sint16)((src[2]<<8)|src[3]); + ce = (lf/2) + (rf/2); + rr = lf - ce; + lr = rf - ce; + dst[1] = (lf&0xFF); + dst[0] = ((lf>>8)&0xFF); + dst[3] = (rf&0xFF); + dst[2] = ((rf>>8)&0xFF); + + dst[1+4] = (lr&0xFF); + dst[0+4] = ((lr>>8)&0xFF); + dst[3+4] = (rr&0xFF); + dst[2+4] = ((rr>>8)&0xFF); + } + } else { + for ( i=cvt->len_cvt/4; i; --i ) { + dst -= 8; + src -= 4; + lf = (Sint16)((src[1]<<8)|src[0]); + rf = (Sint16)((src[3]<<8)|src[2]); + ce = (lf/2) + (rf/2); + rr = lf - ce; + lr = rf - ce; + dst[0] = (lf&0xFF); + dst[1] = ((lf>>8)&0xFF); + dst[2] = (rf&0xFF); + dst[3] = ((rf>>8)&0xFF); + + dst[0+4] = (lr&0xFF); + dst[1+4] = ((lr>>8)&0xFF); + dst[2+4] = (rr&0xFF); + dst[3+4] = ((rr>>8)&0xFF); + } + } + } + break; + } + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + + +/* Convert 8-bit to 16-bit - LSB */ +void SDLCALL SDL_Convert16LSB(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting to 16-bit LSB\n"); +#endif + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + for ( i=cvt->len_cvt; i; --i ) { + src -= 1; + dst -= 2; + dst[1] = *src; + dst[0] = 0; + } + format = ((format & ~0x0008) | AUDIO_U16LSB); + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} +/* Convert 8-bit to 16-bit - MSB */ +void SDLCALL SDL_Convert16MSB(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting to 16-bit MSB\n"); +#endif + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + for ( i=cvt->len_cvt; i; --i ) { + src -= 1; + dst -= 2; + dst[0] = *src; + dst[1] = 0; + } + format = ((format & ~0x0008) | AUDIO_U16MSB); + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Convert 16-bit to 8-bit */ +void SDLCALL SDL_Convert8(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting to 8-bit\n"); +#endif + src = cvt->buf; + dst = cvt->buf; + if ( (format & 0x1000) != 0x1000 ) { /* Little endian */ + ++src; + } + for ( i=cvt->len_cvt/2; i; --i ) { + *dst = *src; + src += 2; + dst += 1; + } + format = ((format & ~0x9010) | AUDIO_U8); + cvt->len_cvt /= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Toggle signed/unsigned */ +void SDLCALL SDL_ConvertSign(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *data; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio signedness\n"); +#endif + data = cvt->buf; + if ( (format & 0xFF) == 16 ) { + if ( (format & 0x1000) != 0x1000 ) { /* Little endian */ + ++data; + } + for ( i=cvt->len_cvt/2; i; --i ) { + *data ^= 0x80; + data += 2; + } + } else { + for ( i=cvt->len_cvt; i; --i ) { + *data++ ^= 0x80; + } + } + format = (format ^ 0x8000); + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Toggle endianness */ +void SDLCALL SDL_ConvertEndian(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *data, tmp; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio endianness\n"); +#endif + data = cvt->buf; + for ( i=cvt->len_cvt/2; i; --i ) { + tmp = data[0]; + data[0] = data[1]; + data[1] = tmp; + data += 2; + } + format = (format ^ 0x1000); + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Convert rate up by multiple of 2 */ +void SDLCALL SDL_RateMUL2(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate * 2\n"); +#endif + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + switch (format & 0xFF) { + case 8: + for ( i=cvt->len_cvt; i; --i ) { + src -= 1; + dst -= 2; + dst[0] = src[0]; + dst[1] = src[0]; + } + break; + case 16: + for ( i=cvt->len_cvt/2; i; --i ) { + src -= 2; + dst -= 4; + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[0]; + dst[3] = src[1]; + } + break; + } + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + + +/* Convert rate up by multiple of 2, for stereo */ +void SDLCALL SDL_RateMUL2_c2(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate * 2\n"); +#endif + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + switch (format & 0xFF) { + case 8: + for ( i=cvt->len_cvt/2; i; --i ) { + src -= 2; + dst -= 4; + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[0]; + dst[3] = src[1]; + } + break; + case 16: + for ( i=cvt->len_cvt/4; i; --i ) { + src -= 4; + dst -= 8; + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + dst[4] = src[0]; + dst[5] = src[1]; + dst[6] = src[2]; + dst[7] = src[3]; + } + break; + } + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Convert rate up by multiple of 2, for quad */ +void SDLCALL SDL_RateMUL2_c4(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate * 2\n"); +#endif + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + switch (format & 0xFF) { + case 8: + for ( i=cvt->len_cvt/4; i; --i ) { + src -= 4; + dst -= 8; + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + dst[4] = src[0]; + dst[5] = src[1]; + dst[6] = src[2]; + dst[7] = src[3]; + } + break; + case 16: + for ( i=cvt->len_cvt/8; i; --i ) { + src -= 8; + dst -= 16; + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + dst[4] = src[4]; + dst[5] = src[5]; + dst[6] = src[6]; + dst[7] = src[7]; + dst[8] = src[0]; + dst[9] = src[1]; + dst[10] = src[2]; + dst[11] = src[3]; + dst[12] = src[4]; + dst[13] = src[5]; + dst[14] = src[6]; + dst[15] = src[7]; + } + break; + } + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + + +/* Convert rate up by multiple of 2, for 5.1 */ +void SDLCALL SDL_RateMUL2_c6(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate * 2\n"); +#endif + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + switch (format & 0xFF) { + case 8: + for ( i=cvt->len_cvt/6; i; --i ) { + src -= 6; + dst -= 12; + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + dst[4] = src[4]; + dst[5] = src[5]; + dst[6] = src[0]; + dst[7] = src[1]; + dst[8] = src[2]; + dst[9] = src[3]; + dst[10] = src[4]; + dst[11] = src[5]; + } + break; + case 16: + for ( i=cvt->len_cvt/12; i; --i ) { + src -= 12; + dst -= 24; + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + dst[4] = src[4]; + dst[5] = src[5]; + dst[6] = src[6]; + dst[7] = src[7]; + dst[8] = src[8]; + dst[9] = src[9]; + dst[10] = src[10]; + dst[11] = src[11]; + dst[12] = src[0]; + dst[13] = src[1]; + dst[14] = src[2]; + dst[15] = src[3]; + dst[16] = src[4]; + dst[17] = src[5]; + dst[18] = src[6]; + dst[19] = src[7]; + dst[20] = src[8]; + dst[21] = src[9]; + dst[22] = src[10]; + dst[23] = src[11]; + } + break; + } + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Convert rate down by multiple of 2 */ +void SDLCALL SDL_RateDIV2(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate / 2\n"); +#endif + src = cvt->buf; + dst = cvt->buf; + switch (format & 0xFF) { + case 8: + for ( i=cvt->len_cvt/2; i; --i ) { + dst[0] = src[0]; + src += 2; + dst += 1; + } + break; + case 16: + for ( i=cvt->len_cvt/4; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + src += 4; + dst += 2; + } + break; + } + cvt->len_cvt /= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + + +/* Convert rate down by multiple of 2, for stereo */ +void SDLCALL SDL_RateDIV2_c2(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate / 2\n"); +#endif + src = cvt->buf; + dst = cvt->buf; + switch (format & 0xFF) { + case 8: + for ( i=cvt->len_cvt/4; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + src += 4; + dst += 2; + } + break; + case 16: + for ( i=cvt->len_cvt/8; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + src += 8; + dst += 4; + } + break; + } + cvt->len_cvt /= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + + +/* Convert rate down by multiple of 2, for quad */ +void SDLCALL SDL_RateDIV2_c4(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate / 2\n"); +#endif + src = cvt->buf; + dst = cvt->buf; + switch (format & 0xFF) { + case 8: + for ( i=cvt->len_cvt/8; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + src += 8; + dst += 4; + } + break; + case 16: + for ( i=cvt->len_cvt/16; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + dst[4] = src[4]; + dst[5] = src[5]; + dst[6] = src[6]; + dst[7] = src[7]; + src += 16; + dst += 8; + } + break; + } + cvt->len_cvt /= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Convert rate down by multiple of 2, for 5.1 */ +void SDLCALL SDL_RateDIV2_c6(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate / 2\n"); +#endif + src = cvt->buf; + dst = cvt->buf; + switch (format & 0xFF) { + case 8: + for ( i=cvt->len_cvt/12; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + dst[4] = src[4]; + dst[5] = src[5]; + src += 12; + dst += 6; + } + break; + case 16: + for ( i=cvt->len_cvt/24; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + dst[4] = src[4]; + dst[5] = src[5]; + dst[6] = src[6]; + dst[7] = src[7]; + dst[8] = src[8]; + dst[9] = src[9]; + dst[10] = src[10]; + dst[11] = src[11]; + src += 24; + dst += 12; + } + break; + } + cvt->len_cvt /= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Very slow rate conversion routine */ +void SDLCALL SDL_RateSLOW(SDL_AudioCVT *cvt, Uint16 format) +{ + double ipos; + int i, clen; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate * %4.4f\n", 1.0/cvt->rate_incr); +#endif + clen = (int)((double)cvt->len_cvt / cvt->rate_incr); + if ( cvt->rate_incr > 1.0 ) { + switch (format & 0xFF) { + case 8: { + Uint8 *output; + + output = cvt->buf; + ipos = 0.0; + for ( i=clen; i; --i ) { + *output = cvt->buf[(int)ipos]; + ipos += cvt->rate_incr; + output += 1; + } + } + break; + + case 16: { + Uint16 *output; + + clen &= ~1; + output = (Uint16 *)cvt->buf; + ipos = 0.0; + for ( i=clen/2; i; --i ) { + *output=((Uint16 *)cvt->buf)[(int)ipos]; + ipos += cvt->rate_incr; + output += 1; + } + } + break; + } + } else { + switch (format & 0xFF) { + case 8: { + Uint8 *output; + + output = cvt->buf+clen; + ipos = (double)cvt->len_cvt; + for ( i=clen; i; --i ) { + ipos -= cvt->rate_incr; + output -= 1; + *output = cvt->buf[(int)ipos]; + } + } + break; + + case 16: { + Uint16 *output; + + clen &= ~1; + output = (Uint16 *)(cvt->buf+clen); + ipos = (double)cvt->len_cvt/2; + for ( i=clen/2; i; --i ) { + ipos -= cvt->rate_incr; + output -= 1; + *output=((Uint16 *)cvt->buf)[(int)ipos]; + } + } + break; + } + } + cvt->len_cvt = clen; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +int SDL_ConvertAudio(SDL_AudioCVT *cvt) +{ + /* Make sure there's data to convert */ + if ( cvt->buf == NULL ) { + SDL_SetError("No buffer allocated for conversion"); + return(-1); + } + /* Return okay if no conversion is necessary */ + cvt->len_cvt = cvt->len; + if ( cvt->filters[0] == NULL ) { + return(0); + } + + /* Set up the conversion and go! */ + cvt->filter_index = 0; + cvt->filters[0](cvt, cvt->src_format); + return(0); +} + +/* Creates a set of audio filters to convert from one format to another. + Returns -1 if the format conversion is not supported, or 1 if the + audio filter is set up. +*/ + +int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, + Uint16 src_format, Uint8 src_channels, int src_rate, + Uint16 dst_format, Uint8 dst_channels, int dst_rate) +{ +/*printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n", + src_format, dst_format, src_channels, dst_channels, src_rate, dst_rate);*/ + /* Start off with no conversion necessary */ + cvt->needed = 0; + cvt->filter_index = 0; + cvt->filters[0] = NULL; + cvt->len_mult = 1; + cvt->len_ratio = 1.0; + + /* First filter: Endian conversion from src to dst */ + if ( (src_format & 0x1000) != (dst_format & 0x1000) + && ((src_format & 0xff) == 16) && ((dst_format & 0xff) == 16)) { + cvt->filters[cvt->filter_index++] = SDL_ConvertEndian; + } + + /* Second filter: Sign conversion -- signed/unsigned */ + if ( (src_format & 0x8000) != (dst_format & 0x8000) ) { + cvt->filters[cvt->filter_index++] = SDL_ConvertSign; + } + + /* Next filter: Convert 16 bit <--> 8 bit PCM */ + if ( (src_format & 0xFF) != (dst_format & 0xFF) ) { + switch (dst_format&0x10FF) { + case AUDIO_U8: + cvt->filters[cvt->filter_index++] = + SDL_Convert8; + cvt->len_ratio /= 2; + break; + case AUDIO_U16LSB: + cvt->filters[cvt->filter_index++] = + SDL_Convert16LSB; + cvt->len_mult *= 2; + cvt->len_ratio *= 2; + break; + case AUDIO_U16MSB: + cvt->filters[cvt->filter_index++] = + SDL_Convert16MSB; + cvt->len_mult *= 2; + cvt->len_ratio *= 2; + break; + } + } + + /* Last filter: Mono/Stereo conversion */ + if ( src_channels != dst_channels ) { + if ( (src_channels == 1) && (dst_channels > 1) ) { + cvt->filters[cvt->filter_index++] = + SDL_ConvertStereo; + cvt->len_mult *= 2; + src_channels = 2; + cvt->len_ratio *= 2; + } + if ( (src_channels == 2) && + (dst_channels == 6) ) { + cvt->filters[cvt->filter_index++] = + SDL_ConvertSurround; + src_channels = 6; + cvt->len_mult *= 3; + cvt->len_ratio *= 3; + } + if ( (src_channels == 2) && + (dst_channels == 4) ) { + cvt->filters[cvt->filter_index++] = + SDL_ConvertSurround_4; + src_channels = 4; + cvt->len_mult *= 2; + cvt->len_ratio *= 2; + } + while ( (src_channels*2) <= dst_channels ) { + cvt->filters[cvt->filter_index++] = + SDL_ConvertStereo; + cvt->len_mult *= 2; + src_channels *= 2; + cvt->len_ratio *= 2; + } + if ( (src_channels == 6) && + (dst_channels <= 2) ) { + cvt->filters[cvt->filter_index++] = + SDL_ConvertStrip; + src_channels = 2; + cvt->len_ratio /= 3; + } + if ( (src_channels == 6) && + (dst_channels == 4) ) { + cvt->filters[cvt->filter_index++] = + SDL_ConvertStrip_2; + src_channels = 4; + cvt->len_ratio /= 2; + } + /* This assumes that 4 channel audio is in the format: + Left {front/back} + Right {front/back} + so converting to L/R stereo works properly. + */ + while ( ((src_channels%2) == 0) && + ((src_channels/2) >= dst_channels) ) { + cvt->filters[cvt->filter_index++] = + SDL_ConvertMono; + src_channels /= 2; + cvt->len_ratio /= 2; + } + if ( src_channels != dst_channels ) { + /* Uh oh.. */; + } + } + + /* Do rate conversion */ + cvt->rate_incr = 0.0; + if ( (src_rate/100) != (dst_rate/100) ) { + Uint32 hi_rate, lo_rate; + int len_mult; + double len_ratio; + void (SDLCALL *rate_cvt)(SDL_AudioCVT *cvt, Uint16 format); + + if ( src_rate > dst_rate ) { + hi_rate = src_rate; + lo_rate = dst_rate; + switch (src_channels) { + case 1: rate_cvt = SDL_RateDIV2; break; + case 2: rate_cvt = SDL_RateDIV2_c2; break; + case 4: rate_cvt = SDL_RateDIV2_c4; break; + case 6: rate_cvt = SDL_RateDIV2_c6; break; + default: return -1; + } + len_mult = 1; + len_ratio = 0.5; + } else { + hi_rate = dst_rate; + lo_rate = src_rate; + switch (src_channels) { + case 1: rate_cvt = SDL_RateMUL2; break; + case 2: rate_cvt = SDL_RateMUL2_c2; break; + case 4: rate_cvt = SDL_RateMUL2_c4; break; + case 6: rate_cvt = SDL_RateMUL2_c6; break; + default: return -1; + } + len_mult = 2; + len_ratio = 2.0; + } + /* If hi_rate = lo_rate*2^x then conversion is easy */ + while ( ((lo_rate*2)/100) <= (hi_rate/100) ) { + cvt->filters[cvt->filter_index++] = rate_cvt; + cvt->len_mult *= len_mult; + lo_rate *= 2; + cvt->len_ratio *= len_ratio; + } + /* We may need a slow conversion here to finish up */ + if ( (lo_rate/100) != (hi_rate/100) ) { +#if 1 + /* The problem with this is that if the input buffer is + say 1K, and the conversion rate is say 1.1, then the + output buffer is 1.1K, which may not be an acceptable + buffer size for the audio driver (not a power of 2) + */ + /* For now, punt and hope the rate distortion isn't great. + */ +#else + if ( src_rate < dst_rate ) { + cvt->rate_incr = (double)lo_rate/hi_rate; + cvt->len_mult *= 2; + cvt->len_ratio /= cvt->rate_incr; + } else { + cvt->rate_incr = (double)hi_rate/lo_rate; + cvt->len_ratio *= cvt->rate_incr; + } + cvt->filters[cvt->filter_index++] = SDL_RateSLOW; +#endif + } + } + + /* Set up the filter information */ + if ( cvt->filter_index != 0 ) { + cvt->needed = 1; + cvt->src_format = src_format; + cvt->dst_format = dst_format; + cvt->len = 0; + cvt->buf = NULL; + cvt->filters[cvt->filter_index] = NULL; + } + return(cvt->needed); +} diff --git a/SDL/src/audio/SDL_audiodev.c b/SDL/src/audio/SDL_audiodev.c new file mode 100644 index 0000000..c73237e --- /dev/null +++ b/SDL/src/audio/SDL_audiodev.c @@ -0,0 +1,179 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Get the name of the audio device we use for output */ + +#if SDL_AUDIO_DRIVER_BSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO + +#include +#include +#include + +#include "SDL_stdinc.h" +#include "SDL_audiodev_c.h" + +#ifndef _PATH_DEV_DSP +#if defined(__NETBSD__) || defined(__OPENBSD__) +#define _PATH_DEV_DSP "/dev/audio" +#else +#define _PATH_DEV_DSP "/dev/dsp" +#endif +#endif +#ifndef _PATH_DEV_DSP24 +#define _PATH_DEV_DSP24 "/dev/sound/dsp" +#endif +#ifndef _PATH_DEV_AUDIO +#define _PATH_DEV_AUDIO "/dev/audio" +#endif + + +int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic) +{ + const char *audiodev; + int audio_fd; + char audiopath[1024]; + + /* Figure out what our audio device is */ + if ( ((audiodev=SDL_getenv("SDL_PATH_DSP")) == NULL) && + ((audiodev=SDL_getenv("AUDIODEV")) == NULL) ) { + if ( classic ) { + audiodev = _PATH_DEV_AUDIO; + } else { + struct stat sb; + + /* Added support for /dev/sound/\* in Linux 2.4 */ + if ( ((stat("/dev/sound", &sb) == 0) && S_ISDIR(sb.st_mode)) && + ((stat(_PATH_DEV_DSP24, &sb) == 0) && S_ISCHR(sb.st_mode)) ) { + audiodev = _PATH_DEV_DSP24; + } else { + audiodev = _PATH_DEV_DSP; + } + } + } + audio_fd = open(audiodev, flags, 0); + + /* If the first open fails, look for other devices */ + if ( (audio_fd < 0) && (SDL_strlen(audiodev) < (sizeof(audiopath)-3)) ) { + int exists, instance; + struct stat sb; + + instance = 1; + do { /* Don't use errno ENOENT - it may not be thread-safe */ + SDL_snprintf(audiopath, SDL_arraysize(audiopath), + "%s%d", audiodev, instance++); + exists = 0; + if ( stat(audiopath, &sb) == 0 ) { + exists = 1; + audio_fd = open(audiopath, flags, 0); + } + } while ( exists && (audio_fd < 0) ); + audiodev = audiopath; + } + if ( path != NULL ) { + SDL_strlcpy(path, audiodev, maxlen); + path[maxlen-1] = '\0'; + } + return(audio_fd); +} + +#elif SDL_AUDIO_DRIVER_PAUD + +/* Get the name of the audio device we use for output */ + +#include +#include + +#include "SDL_stdinc.h" +#include "SDL_audiodev_c.h" + +#ifndef _PATH_DEV_DSP +#define _PATH_DEV_DSP "/dev/%caud%c/%c" +#endif + +char devsettings[][3] = +{ + { 'p', '0', '1' }, { 'p', '0', '2' }, { 'p', '0', '3' }, { 'p', '0', '4' }, + { 'p', '1', '1' }, { 'p', '1', '2' }, { 'p', '1', '3' }, { 'p', '1', '4' }, + { 'p', '2', '1' }, { 'p', '2', '2' }, { 'p', '2', '3' }, { 'p', '2', '4' }, + { 'p', '3', '1' }, { 'p', '3', '2' }, { 'p', '3', '3' }, { 'p', '3', '4' }, + { 'b', '0', '1' }, { 'b', '0', '2' }, { 'b', '0', '3' }, { 'b', '0', '4' }, + { 'b', '1', '1' }, { 'b', '1', '2' }, { 'b', '1', '3' }, { 'b', '1', '4' }, + { 'b', '2', '1' }, { 'b', '2', '2' }, { 'b', '2', '3' }, { 'b', '2', '4' }, + { 'b', '3', '1' }, { 'b', '3', '2' }, { 'b', '3', '3' }, { 'b', '3', '4' }, + { '\0', '\0', '\0' } +}; + +static int OpenUserDefinedDevice(char *path, int maxlen, int flags) +{ + const char *audiodev; + int audio_fd; + + /* Figure out what our audio device is */ + if ((audiodev=SDL_getenv("SDL_PATH_DSP")) == NULL) { + audiodev=SDL_getenv("AUDIODEV"); + } + if ( audiodev == NULL ) { + return -1; + } + audio_fd = open(audiodev, flags, 0); + if ( path != NULL ) { + SDL_strlcpy(path, audiodev, maxlen); + path[maxlen-1] = '\0'; + } + return audio_fd; +} + +int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic) +{ + struct stat sb; + int audio_fd; + char audiopath[1024]; + int cycle; + + audio_fd = OpenUserDefinedDevice(path,maxlen,flags); + if ( audio_fd != -1 ) { + return audio_fd; + } + + cycle = 0; + while( devsettings[cycle][0] != '\0' ) { + SDL_snprintf( audiopath, SDL_arraysize(audiopath), + _PATH_DEV_DSP, + devsettings[cycle][0], + devsettings[cycle][1], + devsettings[cycle][2]); + + if ( stat(audiopath, &sb) == 0 ) { + audio_fd = open(audiopath, flags, 0); + if ( audio_fd > 0 ) { + if ( path != NULL ) { + SDL_strlcpy( path, audiopath, maxlen ); + } + return audio_fd; + } + } + } + return -1; +} + +#endif /* Audio driver selection */ diff --git a/SDL/src/audio/SDL_audiodev_c.h b/SDL/src/audio/SDL_audiodev_c.h new file mode 100644 index 0000000..ddd8c52 --- /dev/null +++ b/SDL/src/audio/SDL_audiodev_c.h @@ -0,0 +1,26 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Open the audio device, storing the pathname in 'path' */ +extern int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic); + diff --git a/SDL/src/audio/SDL_audiomem.h b/SDL/src/audio/SDL_audiomem.h new file mode 100644 index 0000000..910c849 --- /dev/null +++ b/SDL/src/audio/SDL_audiomem.h @@ -0,0 +1,25 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#define SDL_AllocAudioMem SDL_malloc +#define SDL_FreeAudioMem SDL_free diff --git a/SDL/src/audio/SDL_mixer.c b/SDL/src/audio/SDL_mixer.c new file mode 100644 index 0000000..67ad777 --- /dev/null +++ b/SDL/src/audio/SDL_mixer.c @@ -0,0 +1,258 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* This provides the default mixing callback for the SDL audio routines */ + +#include "SDL_cpuinfo.h" +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "SDL_sysaudio.h" +#include "SDL_mixer_MMX.h" +#include "SDL_mixer_MMX_VC.h" +#include "SDL_mixer_m68k.h" + +/* This table is used to add two sound values together and pin + * the value to avoid overflow. (used with permission from ARDI) + * Changed to use 0xFE instead of 0xFF for better sound quality. + */ +static const Uint8 mix8[] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, + 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, + 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, + 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, + 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, + 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, + 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, + 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, + 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, + 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, + 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, + 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, + 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, + 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, + 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, + 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, + 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, + 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, + 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE +}; + +/* The volume ranges from 0 - 128 */ +#define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME) +#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128) + +void SDL_MixAudio (Uint8 *dst, const Uint8 *src, Uint32 len, int volume) +{ + Uint16 format; + + if ( volume == 0 ) { + return; + } + /* Mix the user-level audio format */ + if ( current_audio ) { + if ( current_audio->convert.needed ) { + format = current_audio->convert.src_format; + } else { + format = current_audio->spec.format; + } + } else { + /* HACK HACK HACK */ + format = AUDIO_S16; + } + switch (format) { + + case AUDIO_U8: { +#if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES) + SDL_MixAudio_m68k_U8((char*)dst,(char*)src,(unsigned long)len,(long)volume,(char *)mix8); +#else + Uint8 src_sample; + + while ( len-- ) { + src_sample = *src; + ADJUST_VOLUME_U8(src_sample, volume); + *dst = mix8[*dst+src_sample]; + ++dst; + ++src; + } +#endif + } + break; + + case AUDIO_S8: { +#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES) + if (SDL_HasMMX()) + { + SDL_MixAudio_MMX_S8((char*)dst,(char*)src,(unsigned int)len,(int)volume); + } + else +#elif ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES) + if (SDL_HasMMX()) + { + SDL_MixAudio_MMX_S8_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume); + } + else +#endif +#if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES) + SDL_MixAudio_m68k_S8((char*)dst,(char*)src,(unsigned long)len,(long)volume); +#else + { + Sint8 *dst8, *src8; + Sint8 src_sample; + int dst_sample; + const int max_audioval = ((1<<(8-1))-1); + const int min_audioval = -(1<<(8-1)); + + src8 = (Sint8 *)src; + dst8 = (Sint8 *)dst; + while ( len-- ) { + src_sample = *src8; + ADJUST_VOLUME(src_sample, volume); + dst_sample = *dst8 + src_sample; + if ( dst_sample > max_audioval ) { + *dst8 = max_audioval; + } else + if ( dst_sample < min_audioval ) { + *dst8 = min_audioval; + } else { + *dst8 = dst_sample; + } + ++dst8; + ++src8; + } + } +#endif + } + break; + + case AUDIO_S16LSB: { +#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES) + if (SDL_HasMMX()) + { + SDL_MixAudio_MMX_S16((char*)dst,(char*)src,(unsigned int)len,(int)volume); + } + else +#elif ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES) + if (SDL_HasMMX()) + { + SDL_MixAudio_MMX_S16_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume); + } + else +#endif +#if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES) + SDL_MixAudio_m68k_S16LSB((short*)dst,(short*)src,(unsigned long)len,(long)volume); +#else + { + Sint16 src1, src2; + int dst_sample; + const int max_audioval = ((1<<(16-1))-1); + const int min_audioval = -(1<<(16-1)); + + len /= 2; + while ( len-- ) { + src1 = ((src[1])<<8|src[0]); + ADJUST_VOLUME(src1, volume); + src2 = ((dst[1])<<8|dst[0]); + src += 2; + dst_sample = src1+src2; + if ( dst_sample > max_audioval ) { + dst_sample = max_audioval; + } else + if ( dst_sample < min_audioval ) { + dst_sample = min_audioval; + } + dst[0] = dst_sample&0xFF; + dst_sample >>= 8; + dst[1] = dst_sample&0xFF; + dst += 2; + } + } +#endif + } + break; + + case AUDIO_S16MSB: { +#if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES) + SDL_MixAudio_m68k_S16MSB((short*)dst,(short*)src,(unsigned long)len,(long)volume); +#else + Sint16 src1, src2; + int dst_sample; + const int max_audioval = ((1<<(16-1))-1); + const int min_audioval = -(1<<(16-1)); + + len /= 2; + while ( len-- ) { + src1 = ((src[0])<<8|src[1]); + ADJUST_VOLUME(src1, volume); + src2 = ((dst[0])<<8|dst[1]); + src += 2; + dst_sample = src1+src2; + if ( dst_sample > max_audioval ) { + dst_sample = max_audioval; + } else + if ( dst_sample < min_audioval ) { + dst_sample = min_audioval; + } + dst[1] = dst_sample&0xFF; + dst_sample >>= 8; + dst[0] = dst_sample&0xFF; + dst += 2; + } +#endif + } + break; + + default: /* If this happens... FIXME! */ + SDL_SetError("SDL_MixAudio(): unknown audio format"); + return; + } +} + diff --git a/SDL/src/audio/SDL_mixer_MMX.c b/SDL/src/audio/SDL_mixer_MMX.c new file mode 100644 index 0000000..12894a4 --- /dev/null +++ b/SDL/src/audio/SDL_mixer_MMX.c @@ -0,0 +1,206 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + MMX assembler version of SDL_MixAudio for signed little endian 16 bit samples and signed 8 bit samples + Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr) + This code is licensed under the LGPL (see COPYING for details) + + Assumes buffer size in bytes is a multiple of 16 + Assumes SDL_MIX_MAXVOLUME = 128 +*/ + + +/*********************************************** +* Mixing for 16 bit signed buffers +***********************************************/ + +#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES) +void SDL_MixAudio_MMX_S16(char* dst,char* src,unsigned int size,int volume) +{ + __asm__ __volatile__ ( + +" movl %3,%%eax\n" /* eax = volume */ + +" movl %2,%%edx\n" /* edx = size */ + +" shrl $4,%%edx\n" /* process 16 bytes per iteration = 8 samples */ + +" jz .endS16\n" + +" pxor %%mm0,%%mm0\n" + +" movd %%eax,%%mm0\n" +" movq %%mm0,%%mm1\n" +" psllq $16,%%mm0\n" +" por %%mm1,%%mm0\n" +" psllq $16,%%mm0\n" +" por %%mm1,%%mm0\n" +" psllq $16,%%mm0\n" +" por %%mm1,%%mm0\n" /* mm0 = vol|vol|vol|vol */ + +".align 8\n" +" .mixloopS16:\n" + +" movq (%1),%%mm1\n" /* mm1 = a|b|c|d */ + +" movq %%mm1,%%mm2\n" /* mm2 = a|b|c|d */ + +" movq 8(%1),%%mm4\n" /* mm4 = e|f|g|h */ + + /* pré charger le buffer dst dans mm7 */ +" movq (%0),%%mm7\n" /* mm7 = dst[0] */ + + /* multiplier par le volume */ +" pmullw %%mm0,%%mm1\n" /* mm1 = l(a*v)|l(b*v)|l(c*v)|l(d*v) */ + +" pmulhw %%mm0,%%mm2\n" /* mm2 = h(a*v)|h(b*v)|h(c*v)|h(d*v) */ +" movq %%mm4,%%mm5\n" /* mm5 = e|f|g|h */ + +" pmullw %%mm0,%%mm4\n" /* mm4 = l(e*v)|l(f*v)|l(g*v)|l(h*v) */ + +" pmulhw %%mm0,%%mm5\n" /* mm5 = h(e*v)|h(f*v)|h(g*v)|h(h*v) */ +" movq %%mm1,%%mm3\n" /* mm3 = l(a*v)|l(b*v)|l(c*v)|l(d*v) */ + +" punpckhwd %%mm2,%%mm1\n" /* mm1 = a*v|b*v */ + +" movq %%mm4,%%mm6\n" /* mm6 = l(e*v)|l(f*v)|l(g*v)|l(h*v) */ +" punpcklwd %%mm2,%%mm3\n" /* mm3 = c*v|d*v */ + +" punpckhwd %%mm5,%%mm4\n" /* mm4 = e*f|f*v */ + +" punpcklwd %%mm5,%%mm6\n" /* mm6 = g*v|h*v */ + + /* pré charger le buffer dst dans mm5 */ +" movq 8(%0),%%mm5\n" /* mm5 = dst[1] */ + + /* diviser par 128 */ +" psrad $7,%%mm1\n" /* mm1 = a*v/128|b*v/128 , 128 = SDL_MIX_MAXVOLUME */ +" add $16,%1\n" + +" psrad $7,%%mm3\n" /* mm3 = c*v/128|d*v/128 */ + +" psrad $7,%%mm4\n" /* mm4 = e*v/128|f*v/128 */ + + /* mm1 = le sample avec le volume modifié */ +" packssdw %%mm1,%%mm3\n" /* mm3 = s(a*v|b*v|c*v|d*v) */ + +" psrad $7,%%mm6\n" /* mm6= g*v/128|h*v/128 */ +" paddsw %%mm7,%%mm3\n" /* mm3 = adjust_volume(src)+dst */ + + /* mm4 = le sample avec le volume modifié */ +" packssdw %%mm4,%%mm6\n" /* mm6 = s(e*v|f*v|g*v|h*v) */ +" movq %%mm3,(%0)\n" + +" paddsw %%mm5,%%mm6\n" /* mm6 = adjust_volume(src)+dst */ + +" movq %%mm6,8(%0)\n" + +" add $16,%0\n" + +" dec %%edx\n" + +" jnz .mixloopS16\n" + +" emms\n" + +".endS16:\n" + : + : "r" (dst), "r"(src),"m"(size), + "m"(volume) + : "eax","edx","memory" + ); +} + + + +/*////////////////////////////////////////////// */ +/* Mixing for 8 bit signed buffers */ +/*////////////////////////////////////////////// */ + +void SDL_MixAudio_MMX_S8(char* dst,char* src,unsigned int size,int volume) +{ + __asm__ __volatile__ ( + +" movl %3,%%eax\n" /* eax = volume */ + +" movd %%eax,%%mm0\n" +" movq %%mm0,%%mm1\n" +" psllq $16,%%mm0\n" +" por %%mm1,%%mm0\n" +" psllq $16,%%mm0\n" +" por %%mm1,%%mm0\n" +" psllq $16,%%mm0\n" +" por %%mm1,%%mm0\n" + +" movl %2,%%edx\n" /* edx = size */ +" shr $3,%%edx\n" /* process 8 bytes per iteration = 8 samples */ + +" cmp $0,%%edx\n" +" je .endS8\n" + +".align 8\n" +" .mixloopS8:\n" + +" pxor %%mm2,%%mm2\n" /* mm2 = 0 */ +" movq (%1),%%mm1\n" /* mm1 = a|b|c|d|e|f|g|h */ + +" movq %%mm1,%%mm3\n" /* mm3 = a|b|c|d|e|f|g|h */ + + /* on va faire le "sign extension" en faisant un cmp avec 0 qui retourne 1 si <0, 0 si >0 */ +" pcmpgtb %%mm1,%%mm2\n" /* mm2 = 11111111|00000000|00000000.... */ + +" punpckhbw %%mm2,%%mm1\n" /* mm1 = 0|a|0|b|0|c|0|d */ + +" punpcklbw %%mm2,%%mm3\n" /* mm3 = 0|e|0|f|0|g|0|h */ +" movq (%0),%%mm2\n" /* mm2 = destination */ + +" pmullw %%mm0,%%mm1\n" /* mm1 = v*a|v*b|v*c|v*d */ +" add $8,%1\n" + +" pmullw %%mm0,%%mm3\n" /* mm3 = v*e|v*f|v*g|v*h */ +" psraw $7,%%mm1\n" /* mm1 = v*a/128|v*b/128|v*c/128|v*d/128 */ + +" psraw $7,%%mm3\n" /* mm3 = v*e/128|v*f/128|v*g/128|v*h/128 */ + +" packsswb %%mm1,%%mm3\n" /* mm1 = v*a/128|v*b/128|v*c/128|v*d/128|v*e/128|v*f/128|v*g/128|v*h/128 */ + +" paddsb %%mm2,%%mm3\n" /* add to destination buffer */ + +" movq %%mm3,(%0)\n" /* store back to ram */ +" add $8,%0\n" + +" dec %%edx\n" + +" jnz .mixloopS8\n" + +".endS8:\n" +" emms\n" + : + : "r" (dst), "r"(src),"m"(size), + "m"(volume) + : "eax","edx","memory" + ); +} +#endif + diff --git a/SDL/src/audio/SDL_mixer_MMX.h b/SDL/src/audio/SDL_mixer_MMX.h new file mode 100644 index 0000000..d4c4cc7 --- /dev/null +++ b/SDL/src/audio/SDL_mixer_MMX.h @@ -0,0 +1,15 @@ +/* + headers for MMX assembler version of SDL_MixAudio + Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr) + This code is licensed under the LGPL (see COPYING for details) + + Assumes buffer size in bytes is a multiple of 16 + Assumes SDL_MIX_MAXVOLUME = 128 +*/ +#include "SDL_config.h" + +#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES) +void SDL_MixAudio_MMX_S16(char* ,char* ,unsigned int ,int ); +void SDL_MixAudio_MMX_S8(char* ,char* ,unsigned int ,int ); +#endif + diff --git a/SDL/src/audio/SDL_mixer_MMX_VC.c b/SDL/src/audio/SDL_mixer_MMX_VC.c new file mode 100644 index 0000000..03ad4df --- /dev/null +++ b/SDL/src/audio/SDL_mixer_MMX_VC.c @@ -0,0 +1,181 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#include "SDL_mixer_MMX_VC.h" + +#if ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES) +// MMX assembler version of SDL_MixAudio for signed little endian 16 bit samples and signed 8 bit samples +// Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr) +// Converted to Intel ASM notation by Cth +// This code is licensed under the LGPL (see COPYING for details) +// +// Assumes buffer size in bytes is a multiple of 16 +// Assumes SDL_MIX_MAXVOLUME = 128 + + +//////////////////////////////////////////////// +// Mixing for 16 bit signed buffers +//////////////////////////////////////////////// + +void SDL_MixAudio_MMX_S16_VC(char* dst,char* src,unsigned int nSize,int volume) +{ + __asm + { + + push edi + push esi + push ebx + + mov edi, dst // edi = dst + mov esi, src // esi = src + mov eax, volume // eax = volume + mov ebx, nSize // ebx = size + shr ebx, 4 // process 16 bytes per iteration = 8 samples + jz endS16 + + pxor mm0, mm0 + movd mm0, eax //%%eax,%%mm0 + movq mm1, mm0 //%%mm0,%%mm1 + psllq mm0, 16 //$16,%%mm0 + por mm0, mm1 //%%mm1,%%mm0 + psllq mm0, 16 //$16,%%mm0 + por mm0, mm1 //%%mm1,%%mm0 + psllq mm0, 16 //$16,%%mm0 + por mm0, mm1 //%%mm1,%%mm0 // mm0 = vol|vol|vol|vol + + #ifndef __WATCOMC__ + align 16 + #endif +mixloopS16: + movq mm1, [esi] //(%%esi),%%mm1\n" // mm1 = a|b|c|d + movq mm2, mm1 //%%mm1,%%mm2\n" // mm2 = a|b|c|d + movq mm4, [esi + 8] //8(%%esi),%%mm4\n" // mm4 = e|f|g|h + // pre charger le buffer dst dans mm7 + movq mm7, [edi] //(%%edi),%%mm7\n" // mm7 = dst[0]" + // multiplier par le volume + pmullw mm1, mm0 //%%mm0,%%mm1\n" // mm1 = l(a*v)|l(b*v)|l(c*v)|l(d*v) + pmulhw mm2, mm0 //%%mm0,%%mm2\n" // mm2 = h(a*v)|h(b*v)|h(c*v)|h(d*v) + movq mm5, mm4 //%%mm4,%%mm5\n" // mm5 = e|f|g|h + pmullw mm4, mm0 //%%mm0,%%mm4\n" // mm4 = l(e*v)|l(f*v)|l(g*v)|l(h*v) + pmulhw mm5, mm0 //%%mm0,%%mm5\n" // mm5 = h(e*v)|h(f*v)|h(g*v)|h(h*v) + movq mm3, mm1 //%%mm1,%%mm3\n" // mm3 = l(a*v)|l(b*v)|l(c*v)|l(d*v) + punpckhwd mm1, mm2 //%%mm2,%%mm1\n" // mm1 = a*v|b*v + movq mm6, mm4 //%%mm4,%%mm6\n" // mm6 = l(e*v)|l(f*v)|l(g*v)|l(h*v) + punpcklwd mm3, mm2 //%%mm2,%%mm3\n" // mm3 = c*v|d*v + punpckhwd mm4, mm5 //%%mm5,%%mm4\n" // mm4 = e*f|f*v + punpcklwd mm6, mm5 //%%mm5,%%mm6\n" // mm6 = g*v|h*v + // pre charger le buffer dst dans mm5 + movq mm5, [edi + 8] //8(%%edi),%%mm5\n" // mm5 = dst[1] + // diviser par 128 + psrad mm1, 7 //$7,%%mm1\n" // mm1 = a*v/128|b*v/128 , 128 = SDL_MIX_MAXVOLUME + add esi, 16 //$16,%%esi\n" + psrad mm3, 7 //$7,%%mm3\n" // mm3 = c*v/128|d*v/128 + psrad mm4, 7 //$7,%%mm4\n" // mm4 = e*v/128|f*v/128 + // mm1 = le sample avec le volume modifie + packssdw mm3, mm1 //%%mm1,%%mm3\n" // mm3 = s(a*v|b*v|c*v|d*v) + psrad mm6, 7 //$7,%%mm6\n" // mm6= g*v/128|h*v/128 + paddsw mm3, mm7 //%%mm7,%%mm3\n" // mm3 = adjust_volume(src)+dst + // mm4 = le sample avec le volume modifie + packssdw mm6, mm4 //%%mm4,%%mm6\n" // mm6 = s(e*v|f*v|g*v|h*v) + movq [edi], mm3 //%%mm3,(%%edi)\n" + paddsw mm6, mm5 //%%mm5,%%mm6\n" // mm6 = adjust_volume(src)+dst + movq [edi + 8], mm6 //%%mm6,8(%%edi)\n" + add edi, 16 //$16,%%edi\n" + dec ebx //%%ebx\n" + jnz mixloopS16 + +endS16: + emms + + pop ebx + pop esi + pop edi + } + +} + +//////////////////////////////////////////////// +// Mixing for 8 bit signed buffers +//////////////////////////////////////////////// + +void SDL_MixAudio_MMX_S8_VC(char* dst,char* src,unsigned int nSize,int volume) +{ + _asm + { + + push edi + push esi + push ebx + + mov edi, dst //movl %0,%%edi // edi = dst + mov esi, src //%1,%%esi // esi = src + mov eax, volume //%3,%%eax // eax = volume + + movd mm0, eax //%%eax,%%mm0 + movq mm1, mm0 //%%mm0,%%mm1 + psllq mm0, 16 //$16,%%mm0 + por mm0, mm1 //%%mm1,%%mm0 + psllq mm0, 16 //$16,%%mm0 + por mm0, mm1 //%%mm1,%%mm0 + psllq mm0, 16 //$16,%%mm0 + por mm0, mm1 //%%mm1,%%mm0 + + mov ebx, nSize //%2,%%ebx // ebx = size + shr ebx, 3 //$3,%%ebx // process 8 bytes per iteration = 8 samples + cmp ebx, 0 //$0,%%ebx + je endS8 + + #ifndef __WATCOMC__ + align 16 + #endif +mixloopS8: + pxor mm2, mm2 //%%mm2,%%mm2 // mm2 = 0 + movq mm1, [esi] //(%%esi),%%mm1 // mm1 = a|b|c|d|e|f|g|h + movq mm3, mm1 //%%mm1,%%mm3 // mm3 = a|b|c|d|e|f|g|h + // on va faire le "sign extension" en faisant un cmp avec 0 qui retourne 1 si <0, 0 si >0 + pcmpgtb mm2, mm1 //%%mm1,%%mm2 // mm2 = 11111111|00000000|00000000.... + punpckhbw mm1, mm2 //%%mm2,%%mm1 // mm1 = 0|a|0|b|0|c|0|d + punpcklbw mm3, mm2 //%%mm2,%%mm3 // mm3 = 0|e|0|f|0|g|0|h + movq mm2, [edi] //(%%edi),%%mm2 // mm2 = destination + pmullw mm1, mm0 //%%mm0,%%mm1 // mm1 = v*a|v*b|v*c|v*d + add esi, 8 //$8,%%esi + pmullw mm3, mm0 //%%mm0,%%mm3 // mm3 = v*e|v*f|v*g|v*h + psraw mm1, 7 //$7,%%mm1 // mm1 = v*a/128|v*b/128|v*c/128|v*d/128 + psraw mm3, 7 //$7,%%mm3 // mm3 = v*e/128|v*f/128|v*g/128|v*h/128 + packsswb mm3, mm1 //%%mm1,%%mm3 // mm1 = v*a/128|v*b/128|v*c/128|v*d/128|v*e/128|v*f/128|v*g/128|v*h/128 + paddsb mm3, mm2 //%%mm2,%%mm3 // add to destination buffer + movq [edi], mm3 //%%mm3,(%%edi) // store back to ram + add edi, 8 //$8,%%edi + dec ebx //%%ebx + jnz mixloopS8 + +endS8: + emms + + pop ebx + pop esi + pop edi + } +} + +#endif /* SDL_ASSEMBLY_ROUTINES */ diff --git a/SDL/src/audio/SDL_mixer_MMX_VC.h b/SDL/src/audio/SDL_mixer_MMX_VC.h new file mode 100644 index 0000000..127aaf9 --- /dev/null +++ b/SDL/src/audio/SDL_mixer_MMX_VC.h @@ -0,0 +1,36 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + + +#if ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES) +/* headers for MMX assembler version of SDL_MixAudio + Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr) + Converted to Intel ASM notation by Cth + This code is licensed under the LGPL (see COPYING for details) + + Assumes buffer size in bytes is a multiple of 16 + Assumes SDL_MIX_MAXVOLUME = 128 +*/ +void SDL_MixAudio_MMX_S16_VC(char* ,char* ,unsigned int ,int ); +void SDL_MixAudio_MMX_S8_VC(char* ,char* ,unsigned int ,int ); +#endif diff --git a/SDL/src/audio/SDL_mixer_m68k.c b/SDL/src/audio/SDL_mixer_m68k.c new file mode 100644 index 0000000..b6fe9fe --- /dev/null +++ b/SDL/src/audio/SDL_mixer_m68k.c @@ -0,0 +1,211 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + m68k assembly mix routines + + Patrice Mandin +*/ + +#if defined(__M68000__) && defined(__GNUC__) +void SDL_MixAudio_m68k_U8(char* dst, char* src, long len, long volume, char* mix8) +{ + __asm__ __volatile__ ( + + "tstl %2\n" +" beqs stoploop_u8\n" +"mixloop_u8:\n" + + /* Mix a sample */ + +" moveq #0,%%d0\n" +" moveq #0,%%d1\n" + +" moveb %1@+,%%d0\n" /* d0 = *src++ */ +" sub #128,%%d0\n" /* d0 -= 128 */ +" muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ +" moveb %0@,%%d1\n" /* d1 = *dst */ +" asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ +" add #128,%%d0\n" /* d0 += 128 */ + +" add %%d1,%%d0\n" + +" moveb %4@(%%d0:w),%0@+\n" + + /* Loop till done */ + +" subql #1,%2\n" +" bhis mixloop_u8\n" +"stoploop_u8:\n" + + : /* no return value */ + : /* input */ + "a"(dst), "a"(src), "d"(len), "d"(volume), "a"(mix8) + : /* clobbered registers */ + "d0", "d1", "cc", "memory" + ); +} + +void SDL_MixAudio_m68k_S8(char* dst, char* src, long len, long volume) +{ + __asm__ __volatile__ ( + + "tstl %2\n" +" beqs stoploop_s8\n" +" moveq #-128,%%d2\n" +" moveq #127,%%d3\n" +"mixloop_s8:\n" + + /* Mix a sample */ + +" moveq #0,%%d0\n" +" moveq #0,%%d1\n" + +" moveb %1@+,%%d0\n" /* d0 = *src++ */ +" muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ +" moveb %0@,%%d1\n" /* d1 = *dst */ +" asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ + +" add %%d1,%%d0\n" + +" cmp %%d2,%%d0\n" +" bges lower_limit_s8\n" +" move %%d2,%%d0\n" +"lower_limit_s8:\n" + +" cmp %%d3,%%d0\n" +" bles upper_limit_s8\n" +" move %%d3,%%d0\n" +"upper_limit_s8:\n" +" moveb %%d0,%0@+\n" + + /* Loop till done */ + +" subql #1,%2\n" +" bhis mixloop_s8\n" +"stoploop_s8:\n" + + : /* no return value */ + : /* input */ + "a"(dst), "a"(src), "d"(len), "d"(volume) + : /* clobbered registers */ + "d0", "d1", "d2", "d3", "cc", "memory" + ); +} + +void SDL_MixAudio_m68k_S16MSB(short* dst, short* src, long len, long volume) +{ + __asm__ __volatile__ ( + + "tstl %2\n" +" beqs stoploop_s16msb\n" +" movel #-32768,%%d2\n" +" movel #32767,%%d3\n" +" lsrl #1,%2\n" +"mixloop_s16msb:\n" + + /* Mix a sample */ + +" move %1@+,%%d0\n" /* d0 = *src++ */ +" muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ +" move %0@,%%d1\n" /* d1 = *dst */ +" extl %%d1\n" /* extend d1 to 32 bits */ +" asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ + +" addl %%d1,%%d0\n" + +" cmpl %%d2,%%d0\n" +" bges lower_limit_s16msb\n" +" move %%d2,%%d0\n" +"lower_limit_s16msb:\n" + +" cmpl %%d3,%%d0\n" +" bles upper_limit_s16msb\n" +" move %%d3,%%d0\n" +"upper_limit_s16msb:\n" +" move %%d0,%0@+\n" + + /* Loop till done */ + +" subql #1,%2\n" +" bhis mixloop_s16msb\n" +"stoploop_s16msb:\n" + + : /* no return value */ + : /* input */ + "a"(dst), "a"(src), "d"(len), "d"(volume) + : /* clobbered registers */ + "d0", "d1", "d2", "d3", "cc", "memory" + ); +} + +void SDL_MixAudio_m68k_S16LSB(short* dst, short* src, long len, long volume) +{ + __asm__ __volatile__ ( + + "tstl %2\n" +" beqs stoploop_s16lsb\n" +" movel #-32768,%%d2\n" +" movel #32767,%%d3\n" +" lsrl #1,%2\n" +"mixloop_s16lsb:\n" + + /* Mix a sample */ + +" move %1@+,%%d0\n" /* d0 = *src++ */ +" rorw #8,%%d0\n" +" muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ +" move %0@,%%d1\n" /* d1 = *dst */ +" rorw #8,%%d1\n" +" extl %%d1\n" /* extend d1 to 32 bits */ +" asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ + +" addl %%d1,%%d0\n" + +" cmpl %%d2,%%d0\n" +" bges lower_limit_s16lsb\n" +" move %%d2,%%d0\n" +"lower_limit_s16lsb:\n" + +" cmpl %%d3,%%d0\n" +" bles upper_limit_s16lsb\n" +" move %%d3,%%d0\n" +"upper_limit_s16lsb:\n" +" rorw #8,%%d0\n" +" move %%d0,%0@+\n" + + /* Loop till done */ + +" subql #1,%2\n" +" bhis mixloop_s16lsb\n" +"stoploop_s16lsb:\n" + + : /* no return value */ + : /* input */ + "a"(dst), "a"(src), "d"(len), "d"(volume) + : /* clobbered registers */ + "d0", "d1", "d2", "d3", "cc", "memory" + ); +} +#endif + diff --git a/SDL/src/audio/SDL_mixer_m68k.h b/SDL/src/audio/SDL_mixer_m68k.h new file mode 100644 index 0000000..ce537bc --- /dev/null +++ b/SDL/src/audio/SDL_mixer_m68k.h @@ -0,0 +1,36 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + m68k assembly mix routines + + Patrice Mandin +*/ + +#if defined(__M68000__) && defined(__GNUC__) +void SDL_MixAudio_m68k_U8(char* dst,char* src, long len, long volume, char* mix8); +void SDL_MixAudio_m68k_S8(char* dst,char* src, long len, long volume); + +void SDL_MixAudio_m68k_S16MSB(short* dst,short* src, long len, long volume); +void SDL_MixAudio_m68k_S16LSB(short* dst,short* src, long len, long volume); +#endif diff --git a/SDL/src/audio/SDL_sysaudio.h b/SDL/src/audio/SDL_sysaudio.h new file mode 100644 index 0000000..002220b --- /dev/null +++ b/SDL/src/audio/SDL_sysaudio.h @@ -0,0 +1,187 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is SDL_free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_sysaudio_h +#define _SDL_sysaudio_h + +#include "SDL_mutex.h" +#include "SDL_thread.h" + +/* The SDL audio driver */ +typedef struct SDL_AudioDevice SDL_AudioDevice; + +/* Define the SDL audio driver structure */ +#define _THIS SDL_AudioDevice *_this +#ifndef _STATUS +#define _STATUS SDL_status *status +#endif +struct SDL_AudioDevice { + /* * * */ + /* The name of this audio driver */ + const char *name; + + /* * * */ + /* The description of this audio driver */ + const char *desc; + + /* * * */ + /* Public driver functions */ + int (*OpenAudio)(_THIS, SDL_AudioSpec *spec); + void (*ThreadInit)(_THIS); /* Called by audio thread at start */ + void (*WaitAudio)(_THIS); + void (*PlayAudio)(_THIS); + Uint8 *(*GetAudioBuf)(_THIS); + void (*WaitDone)(_THIS); + void (*CloseAudio)(_THIS); + + /* * * */ + /* Lock / Unlock functions added for the Mac port */ + void (*LockAudio)(_THIS); + void (*UnlockAudio)(_THIS); + + /* * * */ + /* Data common to all devices */ + + /* The current audio specification (shared with audio thread) */ + SDL_AudioSpec spec; + + /* An audio conversion block for audio format emulation */ + SDL_AudioCVT convert; + + /* Current state flags */ + int enabled; + int paused; + int opened; + + /* Fake audio buffer for when the audio hardware is busy */ + Uint8 *fake_stream; + + /* A semaphore for locking the mixing buffers */ + SDL_mutex *mixer_lock; + + /* A thread to feed the audio device */ + SDL_Thread *thread; + Uint32 threadid; + + /* * * */ + /* Data private to this driver */ + struct SDL_PrivateAudioData *hidden; + + /* * * */ + /* The function used to dispose of this structure */ + void (*free)(_THIS); +}; +#undef _THIS + +typedef struct AudioBootStrap { + const char *name; + const char *desc; + int (*available)(void); + SDL_AudioDevice *(*create)(int devindex); +} AudioBootStrap; + +#if SDL_AUDIO_DRIVER_BSD +extern AudioBootStrap BSD_AUDIO_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_PULSE +extern AudioBootStrap PULSE_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_OSS +extern AudioBootStrap DSP_bootstrap; +extern AudioBootStrap DMA_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_ALSA +extern AudioBootStrap ALSA_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_QNXNTO +extern AudioBootStrap QNXNTOAUDIO_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_SUNAUDIO +extern AudioBootStrap SUNAUDIO_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_DMEDIA +extern AudioBootStrap DMEDIA_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_ARTS +extern AudioBootStrap ARTS_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_ESD +extern AudioBootStrap ESD_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_NAS +extern AudioBootStrap NAS_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_DSOUND +extern AudioBootStrap DSOUND_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_WAVEOUT +extern AudioBootStrap WAVEOUT_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_PAUD +extern AudioBootStrap Paud_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_BAUDIO +extern AudioBootStrap BAUDIO_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_COREAUDIO +extern AudioBootStrap COREAUDIO_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_SNDMGR +extern AudioBootStrap SNDMGR_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_MINT +extern AudioBootStrap MINTAUDIO_GSXB_bootstrap; +extern AudioBootStrap MINTAUDIO_MCSN_bootstrap; +extern AudioBootStrap MINTAUDIO_STFA_bootstrap; +extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap; +extern AudioBootStrap MINTAUDIO_DMA8_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_DISK +extern AudioBootStrap DISKAUD_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_DUMMY +extern AudioBootStrap DUMMYAUD_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_WII +extern AudioBootStrap WIIAUD_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_DC +extern AudioBootStrap DCAUD_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_NDS +extern AudioBootStrap NDSAUD_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_MMEAUDIO +extern AudioBootStrap MMEAUDIO_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_DART +extern AudioBootStrap DART_bootstrap; +#endif +#if SDL_AUDIO_DRIVER_EPOCAUDIO +extern AudioBootStrap EPOCAudio_bootstrap; +#endif + +/* This is the current audio device */ +extern SDL_AudioDevice *current_audio; + +#endif /* _SDL_sysaudio_h */ diff --git a/SDL/src/audio/SDL_wave.c b/SDL/src/audio/SDL_wave.c new file mode 100644 index 0000000..9084aca --- /dev/null +++ b/SDL/src/audio/SDL_wave.c @@ -0,0 +1,600 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Microsoft WAVE file loading routines */ + +#include "SDL_audio.h" +#include "SDL_wave.h" + + +static int ReadChunk(SDL_RWops *src, Chunk *chunk); + +struct MS_ADPCM_decodestate { + Uint8 hPredictor; + Uint16 iDelta; + Sint16 iSamp1; + Sint16 iSamp2; +}; +static struct MS_ADPCM_decoder { + WaveFMT wavefmt; + Uint16 wSamplesPerBlock; + Uint16 wNumCoef; + Sint16 aCoeff[7][2]; + /* * * */ + struct MS_ADPCM_decodestate state[2]; +} MS_ADPCM_state; + +static int InitMS_ADPCM(WaveFMT *format) +{ + Uint8 *rogue_feel; + Uint16 extra_info; + int i; + + /* Set the rogue pointer to the MS_ADPCM specific data */ + MS_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding); + MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels); + MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency); + MS_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate); + MS_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign); + MS_ADPCM_state.wavefmt.bitspersample = + SDL_SwapLE16(format->bitspersample); + rogue_feel = (Uint8 *)format+sizeof(*format); + if ( sizeof(*format) == 16 ) { + extra_info = ((rogue_feel[1]<<8)|rogue_feel[0]); + rogue_feel += sizeof(Uint16); + } + MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1]<<8)|rogue_feel[0]); + rogue_feel += sizeof(Uint16); + MS_ADPCM_state.wNumCoef = ((rogue_feel[1]<<8)|rogue_feel[0]); + rogue_feel += sizeof(Uint16); + if ( MS_ADPCM_state.wNumCoef != 7 ) { + SDL_SetError("Unknown set of MS_ADPCM coefficients"); + return(-1); + } + for ( i=0; iiSamp1 * coeff[0]) + + (state->iSamp2 * coeff[1]))/256; + if ( nybble & 0x08 ) { + new_sample += state->iDelta * (nybble-0x10); + } else { + new_sample += state->iDelta * nybble; + } + if ( new_sample < min_audioval ) { + new_sample = min_audioval; + } else + if ( new_sample > max_audioval ) { + new_sample = max_audioval; + } + delta = ((Sint32)state->iDelta * adaptive[nybble])/256; + if ( delta < 16 ) { + delta = 16; + } + state->iDelta = (Uint16)delta; + state->iSamp2 = state->iSamp1; + state->iSamp1 = (Sint16)new_sample; + return(new_sample); +} + +static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len) +{ + struct MS_ADPCM_decodestate *state[2]; + Uint8 *freeable, *encoded, *decoded; + Sint32 encoded_len, samplesleft; + Sint8 nybble, stereo; + Sint16 *coeff[2]; + Sint32 new_sample; + + /* Allocate the proper sized output buffer */ + encoded_len = *audio_len; + encoded = *audio_buf; + freeable = *audio_buf; + *audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) * + MS_ADPCM_state.wSamplesPerBlock* + MS_ADPCM_state.wavefmt.channels*sizeof(Sint16); + *audio_buf = (Uint8 *)SDL_malloc(*audio_len); + if ( *audio_buf == NULL ) { + SDL_Error(SDL_ENOMEM); + return(-1); + } + decoded = *audio_buf; + + /* Get ready... Go! */ + stereo = (MS_ADPCM_state.wavefmt.channels == 2); + state[0] = &MS_ADPCM_state.state[0]; + state[1] = &MS_ADPCM_state.state[stereo]; + while ( encoded_len >= MS_ADPCM_state.wavefmt.blockalign ) { + /* Grab the initial information for this block */ + state[0]->hPredictor = *encoded++; + if ( stereo ) { + state[1]->hPredictor = *encoded++; + } + state[0]->iDelta = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + if ( stereo ) { + state[1]->iDelta = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + } + state[0]->iSamp1 = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + if ( stereo ) { + state[1]->iSamp1 = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + } + state[0]->iSamp2 = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + if ( stereo ) { + state[1]->iSamp2 = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + } + coeff[0] = MS_ADPCM_state.aCoeff[state[0]->hPredictor]; + coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor]; + + /* Store the two initial samples we start with */ + decoded[0] = state[0]->iSamp2&0xFF; + decoded[1] = state[0]->iSamp2>>8; + decoded += 2; + if ( stereo ) { + decoded[0] = state[1]->iSamp2&0xFF; + decoded[1] = state[1]->iSamp2>>8; + decoded += 2; + } + decoded[0] = state[0]->iSamp1&0xFF; + decoded[1] = state[0]->iSamp1>>8; + decoded += 2; + if ( stereo ) { + decoded[0] = state[1]->iSamp1&0xFF; + decoded[1] = state[1]->iSamp1>>8; + decoded += 2; + } + + /* Decode and store the other samples in this block */ + samplesleft = (MS_ADPCM_state.wSamplesPerBlock-2)* + MS_ADPCM_state.wavefmt.channels; + while ( samplesleft > 0 ) { + nybble = (*encoded)>>4; + new_sample = MS_ADPCM_nibble(state[0],nybble,coeff[0]); + decoded[0] = new_sample&0xFF; + new_sample >>= 8; + decoded[1] = new_sample&0xFF; + decoded += 2; + + nybble = (*encoded)&0x0F; + new_sample = MS_ADPCM_nibble(state[1],nybble,coeff[1]); + decoded[0] = new_sample&0xFF; + new_sample >>= 8; + decoded[1] = new_sample&0xFF; + decoded += 2; + + ++encoded; + samplesleft -= 2; + } + encoded_len -= MS_ADPCM_state.wavefmt.blockalign; + } + SDL_free(freeable); + return(0); +} + +struct IMA_ADPCM_decodestate { + Sint32 sample; + Sint8 index; +}; +static struct IMA_ADPCM_decoder { + WaveFMT wavefmt; + Uint16 wSamplesPerBlock; + /* * * */ + struct IMA_ADPCM_decodestate state[2]; +} IMA_ADPCM_state; + +static int InitIMA_ADPCM(WaveFMT *format) +{ + Uint8 *rogue_feel; + Uint16 extra_info; + + /* Set the rogue pointer to the IMA_ADPCM specific data */ + IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding); + IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels); + IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency); + IMA_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate); + IMA_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign); + IMA_ADPCM_state.wavefmt.bitspersample = + SDL_SwapLE16(format->bitspersample); + rogue_feel = (Uint8 *)format+sizeof(*format); + if ( sizeof(*format) == 16 ) { + extra_info = ((rogue_feel[1]<<8)|rogue_feel[0]); + rogue_feel += sizeof(Uint16); + } + IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1]<<8)|rogue_feel[0]); + return(0); +} + +static Sint32 IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state,Uint8 nybble) +{ + const Sint32 max_audioval = ((1<<(16-1))-1); + const Sint32 min_audioval = -(1<<(16-1)); + const int index_table[16] = { + -1, -1, -1, -1, + 2, 4, 6, 8, + -1, -1, -1, -1, + 2, 4, 6, 8 + }; + const Sint32 step_table[89] = { + 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, + 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, + 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, + 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, + 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, + 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, + 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, + 22385, 24623, 27086, 29794, 32767 + }; + Sint32 delta, step; + + /* Compute difference and new sample value */ + step = step_table[state->index]; + delta = step >> 3; + if ( nybble & 0x04 ) delta += step; + if ( nybble & 0x02 ) delta += (step >> 1); + if ( nybble & 0x01 ) delta += (step >> 2); + if ( nybble & 0x08 ) delta = -delta; + state->sample += delta; + + /* Update index value */ + state->index += index_table[nybble]; + if ( state->index > 88 ) { + state->index = 88; + } else + if ( state->index < 0 ) { + state->index = 0; + } + + /* Clamp output sample */ + if ( state->sample > max_audioval ) { + state->sample = max_audioval; + } else + if ( state->sample < min_audioval ) { + state->sample = min_audioval; + } + return(state->sample); +} + +/* Fill the decode buffer with a channel block of data (8 samples) */ +static void Fill_IMA_ADPCM_block(Uint8 *decoded, Uint8 *encoded, + int channel, int numchannels, struct IMA_ADPCM_decodestate *state) +{ + int i; + Sint8 nybble; + Sint32 new_sample; + + decoded += (channel * 2); + for ( i=0; i<4; ++i ) { + nybble = (*encoded)&0x0F; + new_sample = IMA_ADPCM_nibble(state, nybble); + decoded[0] = new_sample&0xFF; + new_sample >>= 8; + decoded[1] = new_sample&0xFF; + decoded += 2 * numchannels; + + nybble = (*encoded)>>4; + new_sample = IMA_ADPCM_nibble(state, nybble); + decoded[0] = new_sample&0xFF; + new_sample >>= 8; + decoded[1] = new_sample&0xFF; + decoded += 2 * numchannels; + + ++encoded; + } +} + +static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len) +{ + struct IMA_ADPCM_decodestate *state; + Uint8 *freeable, *encoded, *decoded; + Sint32 encoded_len, samplesleft; + unsigned int c, channels; + + /* Check to make sure we have enough variables in the state array */ + channels = IMA_ADPCM_state.wavefmt.channels; + if ( channels > SDL_arraysize(IMA_ADPCM_state.state) ) { + SDL_SetError("IMA ADPCM decoder can only handle %d channels", + SDL_arraysize(IMA_ADPCM_state.state)); + return(-1); + } + state = IMA_ADPCM_state.state; + + /* Allocate the proper sized output buffer */ + encoded_len = *audio_len; + encoded = *audio_buf; + freeable = *audio_buf; + *audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) * + IMA_ADPCM_state.wSamplesPerBlock* + IMA_ADPCM_state.wavefmt.channels*sizeof(Sint16); + *audio_buf = (Uint8 *)SDL_malloc(*audio_len); + if ( *audio_buf == NULL ) { + SDL_Error(SDL_ENOMEM); + return(-1); + } + decoded = *audio_buf; + + /* Get ready... Go! */ + while ( encoded_len >= IMA_ADPCM_state.wavefmt.blockalign ) { + /* Grab the initial information for this block */ + for ( c=0; c>8); + decoded += 2; + } + + /* Decode and store the other samples in this block */ + samplesleft = (IMA_ADPCM_state.wSamplesPerBlock-1)*channels; + while ( samplesleft > 0 ) { + for ( c=0; cencoding)) { + case PCM_CODE: + /* We can understand this */ + break; + case MS_ADPCM_CODE: + /* Try to understand this */ + if ( InitMS_ADPCM(format) < 0 ) { + was_error = 1; + goto done; + } + MS_ADPCM_encoded = 1; + break; + case IMA_ADPCM_CODE: + /* Try to understand this */ + if ( InitIMA_ADPCM(format) < 0 ) { + was_error = 1; + goto done; + } + IMA_ADPCM_encoded = 1; + break; + case MP3_CODE: + SDL_SetError("MPEG Layer 3 data not supported", + SDL_SwapLE16(format->encoding)); + was_error = 1; + goto done; + default: + SDL_SetError("Unknown WAVE data format: 0x%.4x", + SDL_SwapLE16(format->encoding)); + was_error = 1; + goto done; + } + SDL_memset(spec, 0, (sizeof *spec)); + spec->freq = SDL_SwapLE32(format->frequency); + switch (SDL_SwapLE16(format->bitspersample)) { + case 4: + if ( MS_ADPCM_encoded || IMA_ADPCM_encoded ) { + spec->format = AUDIO_S16; + } else { + was_error = 1; + } + break; + case 8: + spec->format = AUDIO_U8; + break; + case 16: + spec->format = AUDIO_S16; + break; + default: + was_error = 1; + break; + } + if ( was_error ) { + SDL_SetError("Unknown %d-bit PCM data format", + SDL_SwapLE16(format->bitspersample)); + goto done; + } + spec->channels = (Uint8)SDL_SwapLE16(format->channels); + spec->samples = 4096; /* Good default buffer size */ + + /* Read the audio data chunk */ + *audio_buf = NULL; + do { + if ( *audio_buf != NULL ) { + SDL_free(*audio_buf); + *audio_buf = NULL; + } + lenread = ReadChunk(src, &chunk); + if ( lenread < 0 ) { + was_error = 1; + goto done; + } + *audio_len = lenread; + *audio_buf = chunk.data; + if(chunk.magic != DATA) headerDiff += lenread + 2 * sizeof(Uint32); + } while ( chunk.magic != DATA ); + headerDiff += 2 * sizeof(Uint32); /* for the data chunk and len */ + + if ( MS_ADPCM_encoded ) { + if ( MS_ADPCM_decode(audio_buf, audio_len) < 0 ) { + was_error = 1; + goto done; + } + } + if ( IMA_ADPCM_encoded ) { + if ( IMA_ADPCM_decode(audio_buf, audio_len) < 0 ) { + was_error = 1; + goto done; + } + } + + /* Don't return a buffer that isn't a multiple of samplesize */ + samplesize = ((spec->format & 0xFF)/8)*spec->channels; + *audio_len &= ~(samplesize-1); + +done: + if ( format != NULL ) { + SDL_free(format); + } + if ( src ) { + if ( freesrc ) { + SDL_RWclose(src); + } else { + /* seek to the end of the file (given by the RIFF chunk) */ + SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR); + } + } + if ( was_error ) { + spec = NULL; + } + return(spec); +} + +/* Since the WAV memory is allocated in the shared library, it must also + be freed here. (Necessary under Win32, VC++) + */ +void SDL_FreeWAV(Uint8 *audio_buf) +{ + if ( audio_buf != NULL ) { + SDL_free(audio_buf); + } +} + +static int ReadChunk(SDL_RWops *src, Chunk *chunk) +{ + chunk->magic = SDL_ReadLE32(src); + chunk->length = SDL_ReadLE32(src); + chunk->data = (Uint8 *)SDL_malloc(chunk->length); + if ( chunk->data == NULL ) { + SDL_Error(SDL_ENOMEM); + return(-1); + } + if ( SDL_RWread(src, chunk->data, chunk->length, 1) != 1 ) { + SDL_Error(SDL_EFREAD); + SDL_free(chunk->data); + chunk->data = NULL; + return(-1); + } + return(chunk->length); +} diff --git a/SDL/src/audio/SDL_wave.h b/SDL/src/audio/SDL_wave.h new file mode 100644 index 0000000..5f9de98 --- /dev/null +++ b/SDL/src/audio/SDL_wave.h @@ -0,0 +1,62 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is SDL_free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* WAVE files are little-endian */ + +/*******************************************/ +/* Define values for Microsoft WAVE format */ +/*******************************************/ +#define RIFF 0x46464952 /* "RIFF" */ +#define WAVE 0x45564157 /* "WAVE" */ +#define FACT 0x74636166 /* "fact" */ +#define LIST 0x5453494c /* "LIST" */ +#define FMT 0x20746D66 /* "fmt " */ +#define DATA 0x61746164 /* "data" */ +#define PCM_CODE 0x0001 +#define MS_ADPCM_CODE 0x0002 +#define IMA_ADPCM_CODE 0x0011 +#define MP3_CODE 0x0055 +#define WAVE_MONO 1 +#define WAVE_STEREO 2 + +/* Normally, these three chunks come consecutively in a WAVE file */ +typedef struct WaveFMT { +/* Not saved in the chunk we read: + Uint32 FMTchunk; + Uint32 fmtlen; +*/ + Uint16 encoding; + Uint16 channels; /* 1 = mono, 2 = stereo */ + Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */ + Uint32 byterate; /* Average bytes per second */ + Uint16 blockalign; /* Bytes per sample block */ + Uint16 bitspersample; /* One of 8, 12, 16, or 4 for ADPCM */ +} WaveFMT; + +/* The general chunk found in the WAVE file */ +typedef struct Chunk { + Uint32 magic; + Uint32 length; + Uint8 *data; +} Chunk; + diff --git a/SDL/src/audio/alsa/SDL_alsa_audio.c b/SDL/src/audio/alsa/SDL_alsa_audio.c new file mode 100644 index 0000000..6e3496c --- /dev/null +++ b/SDL/src/audio/alsa/SDL_alsa_audio.c @@ -0,0 +1,538 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Allow access to a raw mixing buffer */ + +#include +#include /* For kill() */ + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audiomem.h" +#include "../SDL_audio_c.h" +#include "SDL_alsa_audio.h" + +#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC +#include +#include "SDL_name.h" +#include "SDL_loadso.h" +#else +#define SDL_NAME(X) X +#endif + + +/* The tag name used by ALSA audio */ +#define DRIVER_NAME "alsa" + +/* The default ALSA audio driver */ +#define DEFAULT_DEVICE "default" + +/* Audio driver functions */ +static int ALSA_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void ALSA_WaitAudio(_THIS); +static void ALSA_PlayAudio(_THIS); +static Uint8 *ALSA_GetAudioBuf(_THIS); +static void ALSA_CloseAudio(_THIS); + +#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC + +static const char *alsa_library = SDL_AUDIO_DRIVER_ALSA_DYNAMIC; +static void *alsa_handle = NULL; +static int alsa_loaded = 0; + +static int (*SDL_snd_pcm_open)(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode); +static int (*SDL_NAME(snd_pcm_open))(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode); +static int (*SDL_NAME(snd_pcm_close))(snd_pcm_t *pcm); +static snd_pcm_sframes_t (*SDL_NAME(snd_pcm_writei))(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size); +static int (*SDL_NAME(snd_pcm_resume))(snd_pcm_t *pcm); +static int (*SDL_NAME(snd_pcm_prepare))(snd_pcm_t *pcm); +static int (*SDL_NAME(snd_pcm_drain))(snd_pcm_t *pcm); +static const char *(*SDL_NAME(snd_strerror))(int errnum); +static size_t (*SDL_NAME(snd_pcm_hw_params_sizeof))(void); +static size_t (*SDL_NAME(snd_pcm_sw_params_sizeof))(void); +static int (*SDL_NAME(snd_pcm_hw_params_any))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); +static int (*SDL_NAME(snd_pcm_hw_params_set_access))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access); +static int (*SDL_NAME(snd_pcm_hw_params_set_format))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); +static int (*SDL_NAME(snd_pcm_hw_params_set_channels))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); +static int (*SDL_NAME(snd_pcm_hw_params_get_channels))(const snd_pcm_hw_params_t *params); +static unsigned int (*SDL_NAME(snd_pcm_hw_params_set_rate_near))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir); +static snd_pcm_uframes_t (*SDL_NAME(snd_pcm_hw_params_set_period_size_near))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int *dir); +static snd_pcm_sframes_t (*SDL_NAME(snd_pcm_hw_params_get_period_size))(const snd_pcm_hw_params_t *params); +static unsigned int (*SDL_NAME(snd_pcm_hw_params_set_periods_near))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir); +static int (*SDL_NAME(snd_pcm_hw_params_get_periods))(snd_pcm_hw_params_t *params); +static int (*SDL_NAME(snd_pcm_hw_params))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); +/* +*/ +static int (*SDL_NAME(snd_pcm_sw_params_current))(snd_pcm_t *pcm, snd_pcm_sw_params_t *swparams); +static int (*SDL_NAME(snd_pcm_sw_params_set_start_threshold))(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); +static int (*SDL_NAME(snd_pcm_sw_params_set_avail_min))(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); +static int (*SDL_NAME(snd_pcm_sw_params))(snd_pcm_t *pcm, snd_pcm_sw_params_t *params); +static int (*SDL_NAME(snd_pcm_nonblock))(snd_pcm_t *pcm, int nonblock); +#define snd_pcm_hw_params_sizeof SDL_NAME(snd_pcm_hw_params_sizeof) +#define snd_pcm_sw_params_sizeof SDL_NAME(snd_pcm_sw_params_sizeof) + +/* cast funcs to char* first, to please GCC's strict aliasing rules. */ +static struct { + const char *name; + void **func; +} alsa_functions[] = { + { "snd_pcm_open", (void**)(char*)&SDL_NAME(snd_pcm_open) }, + { "snd_pcm_close", (void**)(char*)&SDL_NAME(snd_pcm_close) }, + { "snd_pcm_writei", (void**)(char*)&SDL_NAME(snd_pcm_writei) }, + { "snd_pcm_resume", (void**)(char*)&SDL_NAME(snd_pcm_resume) }, + { "snd_pcm_prepare", (void**)(char*)&SDL_NAME(snd_pcm_prepare) }, + { "snd_pcm_drain", (void**)(char*)&SDL_NAME(snd_pcm_drain) }, + { "snd_strerror", (void**)(char*)&SDL_NAME(snd_strerror) }, + { "snd_pcm_hw_params_sizeof", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_sizeof) }, + { "snd_pcm_sw_params_sizeof", (void**)(char*)&SDL_NAME(snd_pcm_sw_params_sizeof) }, + { "snd_pcm_hw_params_any", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_any) }, + { "snd_pcm_hw_params_set_access", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_access) }, + { "snd_pcm_hw_params_set_format", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_format) }, + { "snd_pcm_hw_params_set_channels", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_channels) }, + { "snd_pcm_hw_params_get_channels", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_get_channels) }, + { "snd_pcm_hw_params_set_rate_near", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_rate_near) }, + { "snd_pcm_hw_params_set_period_size_near", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_period_size_near) }, + { "snd_pcm_hw_params_get_period_size", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_get_period_size) }, + { "snd_pcm_hw_params_set_periods_near", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_periods_near) }, + { "snd_pcm_hw_params_get_periods", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_get_periods) }, + { "snd_pcm_hw_params", (void**)(char*)&SDL_NAME(snd_pcm_hw_params) }, + { "snd_pcm_sw_params_current", (void**)(char*)&SDL_NAME(snd_pcm_sw_params_current) }, + { "snd_pcm_sw_params_set_start_threshold", (void**)(char*)&SDL_NAME(snd_pcm_sw_params_set_start_threshold) }, + { "snd_pcm_sw_params_set_avail_min", (void**)(char*)&SDL_NAME(snd_pcm_sw_params_set_avail_min) }, + { "snd_pcm_sw_params", (void**)(char*)&SDL_NAME(snd_pcm_sw_params) }, + { "snd_pcm_nonblock", (void**)(char*)&SDL_NAME(snd_pcm_nonblock) }, +}; + +static void UnloadALSALibrary(void) { + if (alsa_loaded) { +/* SDL_UnloadObject(alsa_handle);*/ + dlclose(alsa_handle); + alsa_handle = NULL; + alsa_loaded = 0; + } +} + +static int LoadALSALibrary(void) { + int i, retval = -1; + +/* alsa_handle = SDL_LoadObject(alsa_library);*/ + alsa_handle = dlopen(alsa_library,RTLD_NOW); + if (alsa_handle) { + alsa_loaded = 1; + retval = 0; + for (i = 0; i < SDL_arraysize(alsa_functions); i++) { +/* *alsa_functions[i].func = SDL_LoadFunction(alsa_handle,alsa_functions[i].name);*/ +#if HAVE_DLVSYM + *alsa_functions[i].func = dlvsym(alsa_handle,alsa_functions[i].name,"ALSA_0.9"); + if (!*alsa_functions[i].func) +#endif + *alsa_functions[i].func = dlsym(alsa_handle,alsa_functions[i].name); + if (!*alsa_functions[i].func) { + retval = -1; + UnloadALSALibrary(); + break; + } + } + } + return retval; +} + +#else + +static void UnloadALSALibrary(void) { + return; +} + +static int LoadALSALibrary(void) { + return 0; +} + +#endif /* SDL_AUDIO_DRIVER_ALSA_DYNAMIC */ + +static const char *get_audio_device(int channels) +{ + const char *device; + + device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */ + if ( device == NULL ) { + if (channels == 6) device = "surround51"; + else if (channels == 4) device = "surround40"; + else device = DEFAULT_DEVICE; + } + return device; +} + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + int available; + int status; + snd_pcm_t *handle; + + available = 0; + if (LoadALSALibrary() < 0) { + return available; + } + status = SDL_NAME(snd_pcm_open)(&handle, get_audio_device(2), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); + if ( status >= 0 ) { + available = 1; + SDL_NAME(snd_pcm_close)(handle); + } + UnloadALSALibrary(); + return(available); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); + UnloadALSALibrary(); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + LoadALSALibrary(); + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = ALSA_OpenAudio; + this->WaitAudio = ALSA_WaitAudio; + this->PlayAudio = ALSA_PlayAudio; + this->GetAudioBuf = ALSA_GetAudioBuf; + this->CloseAudio = ALSA_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap ALSA_bootstrap = { + DRIVER_NAME, "ALSA 0.9 PCM audio", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void ALSA_WaitAudio(_THIS) +{ + /* Check to see if the thread-parent process is still alive */ + { static int cnt = 0; + /* Note that this only works with thread implementations + that use a different process id for each thread. + */ + if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */ + if ( kill(parent, 0) < 0 ) { + this->enabled = 0; + } + } + } +} + + +/* + * http://bugzilla.libsdl.org/show_bug.cgi?id=110 + * "For Linux ALSA, this is FL-FR-RL-RR-C-LFE + * and for Windows DirectX [and CoreAudio], this is FL-FR-C-LFE-RL-RR" + */ +#define SWIZ6(T) \ + T *ptr = (T *) mixbuf; \ + const Uint32 count = (this->spec.samples / 6); \ + Uint32 i; \ + for (i = 0; i < count; i++, ptr += 6) { \ + T tmp; \ + tmp = ptr[2]; ptr[2] = ptr[4]; ptr[4] = tmp; \ + tmp = ptr[3]; ptr[3] = ptr[5]; ptr[5] = tmp; \ + } + +static __inline__ void swizzle_alsa_channels_6_64bit(_THIS) { SWIZ6(Uint64); } +static __inline__ void swizzle_alsa_channels_6_32bit(_THIS) { SWIZ6(Uint32); } +static __inline__ void swizzle_alsa_channels_6_16bit(_THIS) { SWIZ6(Uint16); } +static __inline__ void swizzle_alsa_channels_6_8bit(_THIS) { SWIZ6(Uint8); } + +#undef SWIZ6 + + +/* + * Called right before feeding this->mixbuf to the hardware. Swizzle channels + * from Windows/Mac order to the format alsalib will want. + */ +static __inline__ void swizzle_alsa_channels(_THIS) +{ + if (this->spec.channels == 6) { + const Uint16 fmtsize = (this->spec.format & 0xFF); /* bits/channel. */ + if (fmtsize == 16) + swizzle_alsa_channels_6_16bit(this); + else if (fmtsize == 8) + swizzle_alsa_channels_6_8bit(this); + else if (fmtsize == 32) + swizzle_alsa_channels_6_32bit(this); + else if (fmtsize == 64) + swizzle_alsa_channels_6_64bit(this); + } + + /* !!! FIXME: update this for 7.1 if needed, later. */ +} + + +static void ALSA_PlayAudio(_THIS) +{ + int status; + int sample_len; + signed short *sample_buf; + + swizzle_alsa_channels(this); + + sample_len = this->spec.samples; + sample_buf = (signed short *)mixbuf; + + while ( sample_len > 0 ) { + status = SDL_NAME(snd_pcm_writei)(pcm_handle, sample_buf, sample_len); + if ( status < 0 ) { + if ( status == -EAGAIN ) { + SDL_Delay(1); + continue; + } + if ( status == -ESTRPIPE ) { + do { + SDL_Delay(1); + status = SDL_NAME(snd_pcm_resume)(pcm_handle); + } while ( status == -EAGAIN ); + } + if ( status < 0 ) { + status = SDL_NAME(snd_pcm_prepare)(pcm_handle); + } + if ( status < 0 ) { + /* Hmm, not much we can do - abort */ + this->enabled = 0; + return; + } + continue; + } + sample_buf += status * this->spec.channels; + sample_len -= status; + } +} + +static Uint8 *ALSA_GetAudioBuf(_THIS) +{ + return(mixbuf); +} + +static void ALSA_CloseAudio(_THIS) +{ + if ( mixbuf != NULL ) { + SDL_FreeAudioMem(mixbuf); + mixbuf = NULL; + } + if ( pcm_handle ) { + SDL_NAME(snd_pcm_drain)(pcm_handle); + SDL_NAME(snd_pcm_close)(pcm_handle); + pcm_handle = NULL; + } +} + +static int ALSA_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + int status; + snd_pcm_hw_params_t *hwparams; + snd_pcm_sw_params_t *swparams; + snd_pcm_format_t format; + snd_pcm_uframes_t frames; + Uint16 test_format; + + /* Open the audio device */ + /* Name of device should depend on # channels in spec */ + status = SDL_NAME(snd_pcm_open)(&pcm_handle, get_audio_device(spec->channels), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); + + if ( status < 0 ) { + SDL_SetError("Couldn't open audio device: %s", SDL_NAME(snd_strerror)(status)); + return(-1); + } + + /* Figure out what the hardware is capable of */ + snd_pcm_hw_params_alloca(&hwparams); + status = SDL_NAME(snd_pcm_hw_params_any)(pcm_handle, hwparams); + if ( status < 0 ) { + SDL_SetError("Couldn't get hardware config: %s", SDL_NAME(snd_strerror)(status)); + ALSA_CloseAudio(this); + return(-1); + } + + /* SDL only uses interleaved sample output */ + status = SDL_NAME(snd_pcm_hw_params_set_access)(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); + if ( status < 0 ) { + SDL_SetError("Couldn't set interleaved access: %s", SDL_NAME(snd_strerror)(status)); + ALSA_CloseAudio(this); + return(-1); + } + + /* Try for a closest match on audio format */ + status = -1; + for ( test_format = SDL_FirstAudioFormat(spec->format); + test_format && (status < 0); ) { + switch ( test_format ) { + case AUDIO_U8: + format = SND_PCM_FORMAT_U8; + break; + case AUDIO_S8: + format = SND_PCM_FORMAT_S8; + break; + case AUDIO_S16LSB: + format = SND_PCM_FORMAT_S16_LE; + break; + case AUDIO_S16MSB: + format = SND_PCM_FORMAT_S16_BE; + break; + case AUDIO_U16LSB: + format = SND_PCM_FORMAT_U16_LE; + break; + case AUDIO_U16MSB: + format = SND_PCM_FORMAT_U16_BE; + break; + default: + format = 0; + break; + } + if ( format != 0 ) { + status = SDL_NAME(snd_pcm_hw_params_set_format)(pcm_handle, hwparams, format); + } + if ( status < 0 ) { + test_format = SDL_NextAudioFormat(); + } + } + if ( status < 0 ) { + SDL_SetError("Couldn't find any hardware audio formats"); + ALSA_CloseAudio(this); + return(-1); + } + spec->format = test_format; + + /* Set the number of channels */ + status = SDL_NAME(snd_pcm_hw_params_set_channels)(pcm_handle, hwparams, spec->channels); + if ( status < 0 ) { + status = SDL_NAME(snd_pcm_hw_params_get_channels)(hwparams); + if ( (status <= 0) || (status > 2) ) { + SDL_SetError("Couldn't set audio channels"); + ALSA_CloseAudio(this); + return(-1); + } + spec->channels = status; + } + + /* Set the audio rate */ + status = SDL_NAME(snd_pcm_hw_params_set_rate_near)(pcm_handle, hwparams, spec->freq, NULL); + if ( status < 0 ) { + SDL_SetError("Couldn't set audio frequency: %s", SDL_NAME(snd_strerror)(status)); + ALSA_CloseAudio(this); + return(-1); + } + spec->freq = status; + + /* Set the buffer size, in samples */ + frames = spec->samples; + frames = SDL_NAME(snd_pcm_hw_params_set_period_size_near)(pcm_handle, hwparams, frames, NULL); + spec->samples = frames; + SDL_NAME(snd_pcm_hw_params_set_periods_near)(pcm_handle, hwparams, 2, NULL); + + /* "set" the hardware with the desired parameters */ + status = SDL_NAME(snd_pcm_hw_params)(pcm_handle, hwparams); + if ( status < 0 ) { + SDL_SetError("Couldn't set hardware audio parameters: %s", SDL_NAME(snd_strerror)(status)); + ALSA_CloseAudio(this); + return(-1); + } + +/* This is useful for debugging... */ +/* +{ snd_pcm_sframes_t bufsize; int fragments; + bufsize = SDL_NAME(snd_pcm_hw_params_get_period_size)(hwparams); + fragments = SDL_NAME(snd_pcm_hw_params_get_periods)(hwparams); + + fprintf(stderr, "ALSA: bufsize = %ld, fragments = %d\n", bufsize, fragments); +} +*/ + + /* Set the software parameters */ + snd_pcm_sw_params_alloca(&swparams); + status = SDL_NAME(snd_pcm_sw_params_current)(pcm_handle, swparams); + if ( status < 0 ) { + SDL_SetError("Couldn't get software config: %s", SDL_NAME(snd_strerror)(status)); + ALSA_CloseAudio(this); + return(-1); + } + status = SDL_NAME(snd_pcm_sw_params_set_start_threshold)(pcm_handle, swparams, 0); + if ( status < 0 ) { + SDL_SetError("Couldn't set start threshold: %s", SDL_NAME(snd_strerror)(status)); + ALSA_CloseAudio(this); + return(-1); + } + status = SDL_NAME(snd_pcm_sw_params_set_avail_min)(pcm_handle, swparams, frames); + if ( status < 0 ) { + SDL_SetError("Couldn't set avail min: %s", SDL_NAME(snd_strerror)(status)); + ALSA_CloseAudio(this); + return(-1); + } + status = SDL_NAME(snd_pcm_sw_params)(pcm_handle, swparams); + if ( status < 0 ) { + SDL_SetError("Couldn't set software audio parameters: %s", SDL_NAME(snd_strerror)(status)); + ALSA_CloseAudio(this); + return(-1); + } + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + /* Allocate mixing buffer */ + mixlen = spec->size; + mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen); + if ( mixbuf == NULL ) { + ALSA_CloseAudio(this); + return(-1); + } + SDL_memset(mixbuf, spec->silence, spec->size); + + /* Get the parent process id (we're the parent of the audio thread) */ + parent = getpid(); + + /* Switch to blocking mode for playback */ + SDL_NAME(snd_pcm_nonblock)(pcm_handle, 0); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff --git a/SDL/src/audio/alsa/SDL_alsa_audio.h b/SDL/src/audio/alsa/SDL_alsa_audio.h new file mode 100644 index 0000000..b06e3dc --- /dev/null +++ b/SDL/src/audio/alsa/SDL_alsa_audio.h @@ -0,0 +1,54 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _ALSA_PCM_audio_h +#define _ALSA_PCM_audio_h + +#define ALSA_PCM_OLD_HW_PARAMS_API +#define ALSA_PCM_OLD_SW_PARAMS_API +#include + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The audio device handle */ + snd_pcm_t *pcm_handle; + + /* The parent process id, to detect when application quits */ + pid_t parent; + + /* Raw mixing buffer */ + Uint8 *mixbuf; + int mixlen; +}; + +/* Old variable names */ +#define pcm_handle (this->hidden->pcm_handle) +#define parent (this->hidden->parent) +#define mixbuf (this->hidden->mixbuf) +#define mixlen (this->hidden->mixlen) + +#endif /* _ALSA_PCM_audio_h */ diff --git a/SDL/src/audio/arts/SDL_artsaudio.c b/SDL/src/audio/arts/SDL_artsaudio.c new file mode 100644 index 0000000..82e108e --- /dev/null +++ b/SDL/src/audio/arts/SDL_artsaudio.c @@ -0,0 +1,348 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Allow access to a raw mixing buffer */ + +#ifdef HAVE_SIGNAL_H +#include +#endif +#include + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audiomem.h" +#include "../SDL_audio_c.h" +#include "../SDL_audiodev_c.h" +#include "SDL_artsaudio.h" + +#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC +#include "SDL_name.h" +#include "SDL_loadso.h" +#else +#define SDL_NAME(X) X +#endif + +/* The tag name used by artsc audio */ +#define ARTS_DRIVER_NAME "arts" + +/* Audio driver functions */ +static int ARTS_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void ARTS_WaitAudio(_THIS); +static void ARTS_PlayAudio(_THIS); +static Uint8 *ARTS_GetAudioBuf(_THIS); +static void ARTS_CloseAudio(_THIS); + +#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC + +static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC; +static void *arts_handle = NULL; +static int arts_loaded = 0; + +static int (*SDL_NAME(arts_init))(void); +static void (*SDL_NAME(arts_free))(void); +static arts_stream_t (*SDL_NAME(arts_play_stream))(int rate, int bits, int channels, const char *name); +static int (*SDL_NAME(arts_stream_set))(arts_stream_t s, arts_parameter_t param, int value); +static int (*SDL_NAME(arts_stream_get))(arts_stream_t s, arts_parameter_t param); +static int (*SDL_NAME(arts_write))(arts_stream_t s, const void *buffer, int count); +static void (*SDL_NAME(arts_close_stream))(arts_stream_t s); +static int (*SDL_NAME(arts_suspended))(void); +static const char *(*SDL_NAME(arts_error_text))(int errorcode); + +static struct { + const char *name; + void **func; +} arts_functions[] = { + { "arts_init", (void **)&SDL_NAME(arts_init) }, + { "arts_free", (void **)&SDL_NAME(arts_free) }, + { "arts_play_stream", (void **)&SDL_NAME(arts_play_stream) }, + { "arts_stream_set", (void **)&SDL_NAME(arts_stream_set) }, + { "arts_stream_get", (void **)&SDL_NAME(arts_stream_get) }, + { "arts_write", (void **)&SDL_NAME(arts_write) }, + { "arts_close_stream", (void **)&SDL_NAME(arts_close_stream) }, + { "arts_suspended", (void **)&SDL_NAME(arts_suspended) }, + { "arts_error_text", (void **)&SDL_NAME(arts_error_text) }, +}; + +static void UnloadARTSLibrary() +{ + if ( arts_loaded ) { + SDL_UnloadObject(arts_handle); + arts_handle = NULL; + arts_loaded = 0; + } +} + +static int LoadARTSLibrary(void) +{ + int i, retval = -1; + + arts_handle = SDL_LoadObject(arts_library); + if ( arts_handle ) { + arts_loaded = 1; + retval = 0; + for ( i=0; ihidden); + SDL_free(device); + UnloadARTSLibrary(); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + LoadARTSLibrary(); + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + stream = 0; + + /* Set the function pointers */ + this->OpenAudio = ARTS_OpenAudio; + this->WaitAudio = ARTS_WaitAudio; + this->PlayAudio = ARTS_PlayAudio; + this->GetAudioBuf = ARTS_GetAudioBuf; + this->CloseAudio = ARTS_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap ARTS_bootstrap = { + ARTS_DRIVER_NAME, "Analog Realtime Synthesizer", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void ARTS_WaitAudio(_THIS) +{ + Sint32 ticks; + + /* Check to see if the thread-parent process is still alive */ + { static int cnt = 0; + /* Note that this only works with thread implementations + that use a different process id for each thread. + */ + if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */ + if ( kill(parent, 0) < 0 ) { + this->enabled = 0; + } + } + } + + /* Use timer for general audio synchronization */ + ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS; + if ( ticks > 0 ) { + SDL_Delay(ticks); + } +} + +static void ARTS_PlayAudio(_THIS) +{ + int written; + + /* Write the audio data */ + written = SDL_NAME(arts_write)(stream, mixbuf, mixlen); + + /* If timer synchronization is enabled, set the next write frame */ + if ( frame_ticks ) { + next_frame += frame_ticks; + } + + /* If we couldn't write, assume fatal error for now */ + if ( written < 0 ) { + this->enabled = 0; + } +#ifdef DEBUG_AUDIO + fprintf(stderr, "Wrote %d bytes of audio data\n", written); +#endif +} + +static Uint8 *ARTS_GetAudioBuf(_THIS) +{ + return(mixbuf); +} + +static void ARTS_CloseAudio(_THIS) +{ + if ( mixbuf != NULL ) { + SDL_FreeAudioMem(mixbuf); + mixbuf = NULL; + } + if ( stream ) { + SDL_NAME(arts_close_stream)(stream); + stream = 0; + } + SDL_NAME(arts_free)(); +} + +static int ARTS_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + int bits, frag_spec; + Uint16 test_format, format; + int error_code; + + /* Reset the timer synchronization flag */ + frame_ticks = 0.0; + + mixbuf = NULL; + + /* Try for a closest match on audio format */ + format = 0; + bits = 0; + for ( test_format = SDL_FirstAudioFormat(spec->format); + ! format && test_format; ) { +#ifdef DEBUG_AUDIO + fprintf(stderr, "Trying format 0x%4.4x\n", test_format); +#endif + switch ( test_format ) { + case AUDIO_U8: + bits = 8; + format = 1; + break; + case AUDIO_S16LSB: + bits = 16; + format = 1; + break; + default: + format = 0; + break; + } + if ( ! format ) { + test_format = SDL_NextAudioFormat(); + } + } + if ( format == 0 ) { + SDL_SetError("Couldn't find any hardware audio formats"); + return(-1); + } + spec->format = test_format; + + error_code = SDL_NAME(arts_init)(); + if ( error_code != 0 ) { + SDL_SetError("Unable to initialize ARTS: %s", SDL_NAME(arts_error_text)(error_code)); + return(-1); + } + if ( ! SDL_NAME(arts_suspended)() ) { + SDL_SetError("ARTS can not open audio device"); + return(-1); + } + stream = SDL_NAME(arts_play_stream)(spec->freq, bits, spec->channels, "SDL"); + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + /* Determine the power of two of the fragment size */ + for ( frag_spec = 0; (0x01<size; ++frag_spec ); + if ( (0x01<size ) { + SDL_SetError("Fragment size must be a power of two"); + return(-1); + } + frag_spec |= 0x00020000; /* two fragments, for low latency */ + +#ifdef ARTS_P_PACKET_SETTINGS + SDL_NAME(arts_stream_set)(stream, ARTS_P_PACKET_SETTINGS, frag_spec); +#else + SDL_NAME(arts_stream_set)(stream, ARTS_P_PACKET_SIZE, frag_spec&0xffff); + SDL_NAME(arts_stream_set)(stream, ARTS_P_PACKET_COUNT, frag_spec>>16); +#endif + spec->size = SDL_NAME(arts_stream_get)(stream, ARTS_P_PACKET_SIZE); + + /* Allocate mixing buffer */ + mixlen = spec->size; + mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen); + if ( mixbuf == NULL ) { + return(-1); + } + SDL_memset(mixbuf, spec->silence, spec->size); + + /* Get the parent process id (we're the parent of the audio thread) */ + parent = getpid(); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff --git a/SDL/src/audio/arts/SDL_artsaudio.h b/SDL/src/audio/arts/SDL_artsaudio.h new file mode 100644 index 0000000..805e3ea --- /dev/null +++ b/SDL/src/audio/arts/SDL_artsaudio.h @@ -0,0 +1,60 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_artscaudio_h +#define _SDL_artscaudio_h + +#include + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The stream descriptor for the audio device */ + arts_stream_t stream; + + /* The parent process id, to detect when application quits */ + pid_t parent; + + /* Raw mixing buffer */ + Uint8 *mixbuf; + int mixlen; + + /* Support for audio timing using a timer, in addition to select() */ + float frame_ticks; + float next_frame; +}; +#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ + +/* Old variable names */ +#define stream (this->hidden->stream) +#define parent (this->hidden->parent) +#define mixbuf (this->hidden->mixbuf) +#define mixlen (this->hidden->mixlen) +#define frame_ticks (this->hidden->frame_ticks) +#define next_frame (this->hidden->next_frame) + +#endif /* _SDL_artscaudio_h */ + diff --git a/SDL/src/audio/baudio/SDL_beaudio.cc b/SDL/src/audio/baudio/SDL_beaudio.cc new file mode 100644 index 0000000..656e001 --- /dev/null +++ b/SDL/src/audio/baudio/SDL_beaudio.cc @@ -0,0 +1,225 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Allow access to the audio stream on BeOS */ + +#include + +#include "../../main/beos/SDL_BeApp.h" + +extern "C" { + +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "../../thread/beos/SDL_systhread_c.h" +#include "SDL_beaudio.h" + + +/* Audio driver functions */ +static int BE_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void BE_WaitAudio(_THIS); +static void BE_PlayAudio(_THIS); +static Uint8 *BE_GetAudioBuf(_THIS); +static void BE_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + return(1); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *device; + + /* Initialize all variables that we clean on shutdown */ + device = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( device ) { + SDL_memset(device, 0, (sizeof *device)); + device->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *device->hidden)); + } + if ( (device == NULL) || (device->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( device ) { + SDL_free(device); + } + return(0); + } + SDL_memset(device->hidden, 0, (sizeof *device->hidden)); + + /* Set the function pointers */ + device->OpenAudio = BE_OpenAudio; + device->WaitAudio = BE_WaitAudio; + device->PlayAudio = BE_PlayAudio; + device->GetAudioBuf = BE_GetAudioBuf; + device->CloseAudio = BE_CloseAudio; + + device->free = Audio_DeleteDevice; + + return device; +} + +AudioBootStrap BAUDIO_bootstrap = { + "baudio", "BeOS BSoundPlayer", + Audio_Available, Audio_CreateDevice +}; + +/* The BeOS callback for handling the audio buffer */ +static void FillSound(void *device, void *stream, size_t len, + const media_raw_audio_format &format) +{ + SDL_AudioDevice *audio = (SDL_AudioDevice *)device; + + /* Silence the buffer, since it's ours */ + SDL_memset(stream, audio->spec.silence, len); + + /* Only do soemthing if audio is enabled */ + if ( ! audio->enabled ) + return; + + if ( ! audio->paused ) { + if ( audio->convert.needed ) { + SDL_mutexP(audio->mixer_lock); + (*audio->spec.callback)(audio->spec.userdata, + (Uint8 *)audio->convert.buf,audio->convert.len); + SDL_mutexV(audio->mixer_lock); + SDL_ConvertAudio(&audio->convert); + SDL_memcpy(stream,audio->convert.buf,audio->convert.len_cvt); + } else { + SDL_mutexP(audio->mixer_lock); + (*audio->spec.callback)(audio->spec.userdata, + (Uint8 *)stream, len); + SDL_mutexV(audio->mixer_lock); + } + } + return; +} + +/* Dummy functions -- we don't use thread-based audio */ +void BE_WaitAudio(_THIS) +{ + return; +} +void BE_PlayAudio(_THIS) +{ + return; +} +Uint8 *BE_GetAudioBuf(_THIS) +{ + return(NULL); +} + +void BE_CloseAudio(_THIS) +{ + if ( audio_obj ) { + audio_obj->Stop(); + delete audio_obj; + audio_obj = NULL; + } + + /* Quit the Be Application, if there's nothing left to do */ + SDL_QuitBeApp(); +} + +int BE_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + int valid_datatype = 0; + media_raw_audio_format format; + Uint16 test_format = SDL_FirstAudioFormat(spec->format); + + /* Parse the audio format and fill the Be raw audio format */ + memset(&format, '\0', sizeof (media_raw_audio_format)); + format.byte_order = B_MEDIA_LITTLE_ENDIAN; + format.frame_rate = (float) spec->freq; + format.channel_count = spec->channels; /* !!! FIXME: support > 2? */ + while ((!valid_datatype) && (test_format)) { + valid_datatype = 1; + spec->format = test_format; + switch (test_format) { + case AUDIO_S8: + format.format = media_raw_audio_format::B_AUDIO_CHAR; + break; + + case AUDIO_U8: + format.format = media_raw_audio_format::B_AUDIO_UCHAR; + break; + + case AUDIO_S16LSB: + format.format = media_raw_audio_format::B_AUDIO_SHORT; + break; + + case AUDIO_S16MSB: + format.format = media_raw_audio_format::B_AUDIO_SHORT; + format.byte_order = B_MEDIA_BIG_ENDIAN; + break; + + default: + valid_datatype = 0; + test_format = SDL_NextAudioFormat(); + break; + } + } + + if (!valid_datatype) { /* shouldn't happen, but just in case... */ + SDL_SetError("Unsupported audio format"); + return (-1); + } + + /* Initialize the Be Application, if it's not already started */ + if (SDL_InitBeApp() < 0) { + return (-1); + } + + format.buffer_size = spec->samples; + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + /* Subscribe to the audio stream (creates a new thread) */ + { sigset_t omask; + SDL_MaskSignals(&omask); + audio_obj = new BSoundPlayer(&format, "SDL Audio", FillSound, + NULL, _this); + SDL_UnmaskSignals(&omask); + } + if ( audio_obj->Start() == B_NO_ERROR ) { + audio_obj->SetHasData(true); + } else { + SDL_SetError("Unable to start Be audio"); + return(-1); + } + + /* We're running! */ + return(1); +} + +}; /* Extern C */ diff --git a/SDL/src/audio/baudio/SDL_beaudio.h b/SDL/src/audio/baudio/SDL_beaudio.h new file mode 100644 index 0000000..7dfa3dd --- /dev/null +++ b/SDL/src/audio/baudio/SDL_beaudio.h @@ -0,0 +1,39 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_lowaudio_h +#define _SDL_lowaudio_h + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *_this + +struct SDL_PrivateAudioData { + BSoundPlayer *audio_obj; +}; + +/* Old variable names */ +#define audio_obj (_this->hidden->audio_obj) + +#endif /* _SDL_lowaudio_h */ diff --git a/SDL/src/audio/bsd/SDL_bsdaudio.c b/SDL/src/audio/bsd/SDL_bsdaudio.c new file mode 100644 index 0000000..a011f7b --- /dev/null +++ b/SDL/src/audio/bsd/SDL_bsdaudio.c @@ -0,0 +1,404 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + * Driver for native OpenBSD/NetBSD audio(4). + * vedge@vedge.com.ar. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audiomem.h" +#include "../SDL_audio_c.h" +#include "../SDL_audiodev_c.h" +#include "SDL_bsdaudio.h" + +/* The tag name used by NetBSD/OpenBSD audio */ +#ifdef __NetBSD__ +#define BSD_AUDIO_DRIVER_NAME "netbsd" +#define BSD_AUDIO_DRIVER_DESC "Native NetBSD audio" +#else +#define BSD_AUDIO_DRIVER_NAME "openbsd" +#define BSD_AUDIO_DRIVER_DESC "Native OpenBSD audio" +#endif + +/* Open the audio device for playback, and don't block if busy */ +/* #define USE_BLOCKING_WRITES */ + +/* Use timer for synchronization */ +/* #define USE_TIMER_SYNC */ + +/* #define DEBUG_AUDIO */ +/* #define DEBUG_AUDIO_STREAM */ + +#ifdef USE_BLOCKING_WRITES +#define OPEN_FLAGS O_WRONLY +#else +#define OPEN_FLAGS (O_WRONLY|O_NONBLOCK) +#endif + +/* Audio driver functions */ +static void OBSD_WaitAudio(_THIS); +static int OBSD_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void OBSD_PlayAudio(_THIS); +static Uint8 *OBSD_GetAudioBuf(_THIS); +static void OBSD_CloseAudio(_THIS); + +#ifdef DEBUG_AUDIO +static void OBSD_Status(_THIS); +#endif + +/* Audio driver bootstrap functions */ + +static int +Audio_Available(void) +{ + int fd; + int available; + + available = 0; + fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); + if(fd >= 0) { + available = 1; + close(fd); + } + return(available); +} + +static void +Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice +*Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice*)SDL_malloc(sizeof(SDL_AudioDevice)); + if(this) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = + (struct SDL_PrivateAudioData*)SDL_malloc((sizeof *this->hidden)); + } + if((this == NULL) || (this->hidden == NULL)) { + SDL_OutOfMemory(); + if(this) SDL_free(this); + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + audio_fd = -1; + + /* Set the function pointers */ + this->OpenAudio = OBSD_OpenAudio; + this->WaitAudio = OBSD_WaitAudio; + this->PlayAudio = OBSD_PlayAudio; + this->GetAudioBuf = OBSD_GetAudioBuf; + this->CloseAudio = OBSD_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap BSD_AUDIO_bootstrap = { + BSD_AUDIO_DRIVER_NAME, BSD_AUDIO_DRIVER_DESC, + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void +OBSD_WaitAudio(_THIS) +{ +#ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */ + /* See if we need to use timed audio synchronization */ + if ( frame_ticks ) { + /* Use timer for general audio synchronization */ + Sint32 ticks; + + ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS; + if ( ticks > 0 ) { + SDL_Delay(ticks); + } + } else { + /* Use select() for audio synchronization */ + fd_set fdset; + struct timeval timeout; + + FD_ZERO(&fdset); + FD_SET(audio_fd, &fdset); + timeout.tv_sec = 10; + timeout.tv_usec = 0; +#ifdef DEBUG_AUDIO + fprintf(stderr, "Waiting for audio to get ready\n"); +#endif + if ( select(audio_fd+1, NULL, &fdset, NULL, &timeout) <= 0 ) { + const char *message = + "Audio timeout - buggy audio driver? (disabled)"; + /* In general we should never print to the screen, + but in this case we have no other way of letting + the user know what happened. + */ + fprintf(stderr, "SDL: %s\n", message); + this->enabled = 0; + /* Don't try to close - may hang */ + audio_fd = -1; +#ifdef DEBUG_AUDIO + fprintf(stderr, "Done disabling audio\n"); +#endif + } +#ifdef DEBUG_AUDIO + fprintf(stderr, "Ready!\n"); +#endif + } +#endif /* !USE_BLOCKING_WRITES */ +} + +static void +OBSD_PlayAudio(_THIS) +{ + int written, p=0; + + /* Write the audio data, checking for EAGAIN on broken audio drivers */ + do { + written = write(audio_fd, &mixbuf[p], mixlen-p); + if (written>0) + p += written; + if (written == -1 && errno != 0 && errno != EAGAIN && errno != EINTR) + { + /* Non recoverable error has occurred. It should be reported!!! */ + perror("audio"); + break; + } + + if ( p < written || ((written < 0) && ((errno == 0) || (errno == EAGAIN))) ) { + SDL_Delay(1); /* Let a little CPU time go by */ + } + } while ( p < written ); + + /* If timer synchronization is enabled, set the next write frame */ + if ( frame_ticks ) { + next_frame += frame_ticks; + } + + /* If we couldn't write, assume fatal error for now */ + if ( written < 0 ) { + this->enabled = 0; + } +#ifdef DEBUG_AUDIO + fprintf(stderr, "Wrote %d bytes of audio data\n", written); +#endif +} + +static Uint8 +*OBSD_GetAudioBuf(_THIS) +{ + return(mixbuf); +} + +static void +OBSD_CloseAudio(_THIS) +{ + if(mixbuf != NULL) { + SDL_FreeAudioMem(mixbuf); + mixbuf = NULL; + } + if(audio_fd >= 0) { + close(audio_fd); + audio_fd = -1; + } +} + +#ifdef DEBUG_AUDIO +void +OBSD_Status(_THIS) +{ + audio_info_t info; + + if(ioctl(audio_fd, AUDIO_GETINFO, &info) < 0) { + fprintf(stderr,"AUDIO_GETINFO failed.\n"); + return; + } + + fprintf(stderr,"\n" +"[play/record info]\n" +"buffer size : %d bytes\n" +"sample rate : %i Hz\n" +"channels : %i\n" +"precision : %i-bit\n" +"encoding : 0x%x\n" +"seek : %i\n" +"sample count : %i\n" +"EOF count : %i\n" +"paused : %s\n" +"error occured : %s\n" +"waiting : %s\n" +"active : %s\n" +"", + info.play.buffer_size, + info.play.sample_rate, + info.play.channels, + info.play.precision, + info.play.encoding, + info.play.seek, + info.play.samples, + info.play.eof, + info.play.pause ? "yes" : "no", + info.play.error ? "yes" : "no", + info.play.waiting ? "yes" : "no", + info.play.active ? "yes": "no"); + + fprintf(stderr,"\n" +"[audio info]\n" +"monitor_gain : %i\n" +"hw block size : %d bytes\n" +"hi watermark : %i\n" +"lo watermark : %i\n" +"audio mode : %s\n" +"", + info.monitor_gain, + info.blocksize, + info.hiwat, info.lowat, + (info.mode == AUMODE_PLAY) ? "PLAY" + : (info.mode = AUMODE_RECORD) ? "RECORD" + : (info.mode == AUMODE_PLAY_ALL ? "PLAY_ALL" + : "?")); +} +#endif /* DEBUG_AUDIO */ + +static int +OBSD_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + char audiodev[64]; + Uint16 format; + audio_info_t info; + + AUDIO_INITINFO(&info); + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + +#ifdef USE_TIMER_SYNC + frame_ticks = 0.0; +#endif + + /* Open the audio device */ + audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0); + if(audio_fd < 0) { + SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); + return(-1); + } + + /* Set to play mode */ + info.mode = AUMODE_PLAY; + if(ioctl(audio_fd, AUDIO_SETINFO, &info) < 0) { + SDL_SetError("Couldn't put device into play mode"); + return(-1); + } + + mixbuf = NULL; + AUDIO_INITINFO(&info); + for (format = SDL_FirstAudioFormat(spec->format); + format; format = SDL_NextAudioFormat()) + { + switch(format) { + case AUDIO_U8: + info.play.encoding = AUDIO_ENCODING_ULINEAR; + info.play.precision = 8; + break; + case AUDIO_S8: + info.play.encoding = AUDIO_ENCODING_SLINEAR; + info.play.precision = 8; + break; + case AUDIO_S16LSB: + info.play.encoding = AUDIO_ENCODING_SLINEAR_LE; + info.play.precision = 16; + break; + case AUDIO_S16MSB: + info.play.encoding = AUDIO_ENCODING_SLINEAR_BE; + info.play.precision = 16; + break; + case AUDIO_U16LSB: + info.play.encoding = AUDIO_ENCODING_ULINEAR_LE; + info.play.precision = 16; + break; + case AUDIO_U16MSB: + info.play.encoding = AUDIO_ENCODING_ULINEAR_BE; + info.play.precision = 16; + break; + default: + continue; + } + if (ioctl(audio_fd, AUDIO_SETINFO, &info) == 0) + break; + } + + if(!format) { + SDL_SetError("No supported encoding for 0x%x", spec->format); + return(-1); + } + + spec->format = format; + + AUDIO_INITINFO(&info); + info.play.channels = spec->channels; + if (ioctl(audio_fd, AUDIO_SETINFO, &info) == -1) + spec->channels = 1; + AUDIO_INITINFO(&info); + info.play.sample_rate = spec->freq; + info.blocksize = spec->size; + info.hiwat = 5; + info.lowat = 3; + (void)ioctl(audio_fd, AUDIO_SETINFO, &info); + (void)ioctl(audio_fd, AUDIO_GETINFO, &info); + spec->freq = info.play.sample_rate; + /* Allocate mixing buffer */ + mixlen = spec->size; + mixbuf = (Uint8*)SDL_AllocAudioMem(mixlen); + if(mixbuf == NULL) { + return(-1); + } + SDL_memset(mixbuf, spec->silence, spec->size); + + /* Get the parent process id (we're the parent of the audio thread) */ + parent = getpid(); + +#ifdef DEBUG_AUDIO + OBSD_Status(this); +#endif + + /* We're ready to rock and roll. :-) */ + return(0); +} diff --git a/SDL/src/audio/bsd/SDL_bsdaudio.h b/SDL/src/audio/bsd/SDL_bsdaudio.h new file mode 100644 index 0000000..0c95fc6 --- /dev/null +++ b/SDL/src/audio/bsd/SDL_bsdaudio.h @@ -0,0 +1,58 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_openbsdaudio_h +#define _SDL_openbsdaudio_h + +#include "../SDL_sysaudio.h" + +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData +{ + /* The file descriptor for the audio device */ + int audio_fd; + + /* The parent process id, to detect when application quits */ + pid_t parent; + + /* Raw mixing buffer */ + Uint8 *mixbuf; + int mixlen; + + /* Support for audio timing using a timer, in addition to select() */ + float frame_ticks; + float next_frame; +}; + +#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ + +/* Old variable names */ +#define audio_fd (this->hidden->audio_fd) +#define parent (this->hidden->parent) +#define mixbuf (this->hidden->mixbuf) +#define mixlen (this->hidden->mixlen) +#define frame_ticks (this->hidden->frame_ticks) +#define next_frame (this->hidden->next_frame) + +#endif /* _SDL_openbsdaudio_h */ diff --git a/SDL/src/audio/dart/SDL_dart.c b/SDL/src/audio/dart/SDL_dart.c new file mode 100644 index 0000000..b6eeda6 --- /dev/null +++ b/SDL/src/audio/dart/SDL_dart.c @@ -0,0 +1,441 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Allow access to a raw mixing buffer */ + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "SDL_dart.h" + +// Buffer states: +#define BUFFER_EMPTY 0 +#define BUFFER_USED 1 + +typedef struct _tMixBufferDesc { + int iBufferUsage; // BUFFER_EMPTY or BUFFER_USED + SDL_AudioDevice *pSDLAudioDevice; +} tMixBufferDesc, *pMixBufferDesc; + + +//--------------------------------------------------------------------- +// DARTEventFunc +// +// This function is called by DART, when an event occures, like end of +// playback of a buffer, etc... +//--------------------------------------------------------------------- +LONG APIENTRY DARTEventFunc(ULONG ulStatus, + PMCI_MIX_BUFFER pBuffer, + ULONG ulFlags) +{ + if (ulFlags && MIX_WRITE_COMPLETE) + { // Playback of buffer completed! + + // Get pointer to buffer description + pMixBufferDesc pBufDesc; + + if (pBuffer) + { + pBufDesc = (pMixBufferDesc) (*pBuffer).ulUserParm; + + if (pBufDesc) + { + SDL_AudioDevice *pSDLAudioDevice = pBufDesc->pSDLAudioDevice; + // Set the buffer to be empty + pBufDesc->iBufferUsage = BUFFER_EMPTY; + // And notify DART feeder thread that it will have to work a bit. + if (pSDLAudioDevice) + DosPostEventSem(pSDLAudioDevice->hidden->hevAudioBufferPlayed); + } + } + } + return TRUE; +} + + +int DART_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + Uint16 test_format = SDL_FirstAudioFormat(spec->format); + int valid_datatype = 0; + MCI_AMP_OPEN_PARMS AmpOpenParms; + MCI_GENERIC_PARMS GenericParms; + int iDeviceOrd = 0; // Default device to be used + int bOpenShared = 1; // Try opening it shared + int iBits = 16; // Default is 16 bits signed + int iFreq = 44100; // Default is 44KHz + int iChannels = 2; // Default is 2 channels (Stereo) + int iNumBufs = 2; // Number of audio buffers: 2 + int iBufSize; + int iOpenMode; + int iSilence; + int rc; + + // First thing is to try to open a given DART device! + SDL_memset(&AmpOpenParms, 0, sizeof(MCI_AMP_OPEN_PARMS)); + // pszDeviceType should contain the device type in low word, and device ordinal in high word! + AmpOpenParms.pszDeviceType = (PSZ) (MCI_DEVTYPE_AUDIO_AMPMIX | (iDeviceOrd << 16)); + + iOpenMode = MCI_WAIT | MCI_OPEN_TYPE_ID; + if (bOpenShared) iOpenMode |= MCI_OPEN_SHAREABLE; + + rc = mciSendCommand( 0, MCI_OPEN, + iOpenMode, + (PVOID) &AmpOpenParms, 0); + if (rc!=MCIERR_SUCCESS) // No audio available?? + return (-1); + // Save the device ID we got from DART! + // We will use this in the next calls! + iDeviceOrd = AmpOpenParms.usDeviceID; + + // Determine the audio parameters from the AudioSpec + if (spec->channels > 2) + spec->channels = 2; // !!! FIXME: more than stereo support in OS/2? + + while ((!valid_datatype) && (test_format)) { + spec->format = test_format; + valid_datatype = 1; + switch (test_format) { + case AUDIO_U8: + // Unsigned 8 bit audio data + iSilence = 0x80; + iBits = 8; + break; + + case AUDIO_S16LSB: + // Signed 16 bit audio data + iSilence = 0x00; + iBits = 16; + break; + + default: + valid_datatype = 0; + test_format = SDL_NextAudioFormat(); + break; + } + } + + if (!valid_datatype) { // shouldn't happen, but just in case... + // Close DART, and exit with error code! + mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0); + SDL_SetError("Unsupported audio format"); + return (-1); + } + + iFreq = spec->freq; + iChannels = spec->channels; + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(spec); + iBufSize = spec->size; + + // Now query this device if it supports the given freq/bits/channels! + SDL_memset(&(_this->hidden->MixSetupParms), 0, sizeof(MCI_MIXSETUP_PARMS)); + _this->hidden->MixSetupParms.ulBitsPerSample = iBits; + _this->hidden->MixSetupParms.ulFormatTag = MCI_WAVE_FORMAT_PCM; + _this->hidden->MixSetupParms.ulSamplesPerSec = iFreq; + _this->hidden->MixSetupParms.ulChannels = iChannels; + _this->hidden->MixSetupParms.ulFormatMode = MCI_PLAY; + _this->hidden->MixSetupParms.ulDeviceType = MCI_DEVTYPE_WAVEFORM_AUDIO; + _this->hidden->MixSetupParms.pmixEvent = DARTEventFunc; + rc = mciSendCommand (iDeviceOrd, MCI_MIXSETUP, + MCI_WAIT | MCI_MIXSETUP_QUERYMODE, + &(_this->hidden->MixSetupParms), 0); + if (rc!=MCIERR_SUCCESS) + { // The device cannot handle this format! + // Close DART, and exit with error code! + mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0); + SDL_SetError("Audio device doesn't support requested audio format"); + return(-1); + } + // The device can handle this format, so initialize! + rc = mciSendCommand(iDeviceOrd, MCI_MIXSETUP, + MCI_WAIT | MCI_MIXSETUP_INIT, + &(_this->hidden->MixSetupParms), 0); + if (rc!=MCIERR_SUCCESS) + { // The device could not be opened! + // Close DART, and exit with error code! + mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0); + SDL_SetError("Audio device could not be set up"); + return(-1); + } + // Ok, the device is initialized. + // Now we should allocate buffers. For this, we need a place where + // the buffer descriptors will be: + _this->hidden->pMixBuffers = (MCI_MIX_BUFFER *) SDL_malloc(sizeof(MCI_MIX_BUFFER)*iNumBufs); + if (!(_this->hidden->pMixBuffers)) + { // Not enough memory! + // Close DART, and exit with error code! + mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0); + SDL_SetError("Not enough memory for audio buffer descriptors"); + return(-1); + } + // Now that we have the place for buffer list, we can ask DART for the + // buffers! + _this->hidden->BufferParms.ulNumBuffers = iNumBufs; // Number of buffers + _this->hidden->BufferParms.ulBufferSize = iBufSize; // each with this size + _this->hidden->BufferParms.pBufList = _this->hidden->pMixBuffers; // getting descriptorts into this list + // Allocate buffers! + rc = mciSendCommand(iDeviceOrd, MCI_BUFFER, + MCI_WAIT | MCI_ALLOCATE_MEMORY, + &(_this->hidden->BufferParms), 0); + if ((rc!=MCIERR_SUCCESS) || (iNumBufs != _this->hidden->BufferParms.ulNumBuffers) || (_this->hidden->BufferParms.ulBufferSize==0)) + { // Could not allocate memory! + // Close DART, and exit with error code! + SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL; + mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0); + SDL_SetError("DART could not allocate buffers"); + return(-1); + } + // Ok, we have all the buffers allocated, let's mark them! + { + int i; + for (i=0; ihidden->pMixBuffers[i].pBuffer)) || (!pBufferDesc)) + { // Wrong buffer! + // Close DART, and exit with error code! + // Free buffer descriptions + { int j; + for (j=0; jhidden->pMixBuffers[j].ulUserParm)); + } + // and cleanup + mciSendCommand(iDeviceOrd, MCI_BUFFER, MCI_WAIT | MCI_DEALLOCATE_MEMORY, &(_this->hidden->BufferParms), 0); + SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL; + mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0); + SDL_SetError("Error at internal buffer check"); + return(-1); + } + pBufferDesc->iBufferUsage = BUFFER_EMPTY; + pBufferDesc->pSDLAudioDevice = _this; + + _this->hidden->pMixBuffers[i].ulBufferLength = _this->hidden->BufferParms.ulBufferSize; + _this->hidden->pMixBuffers[i].ulUserParm = (ULONG) pBufferDesc; // User parameter: Description of buffer + _this->hidden->pMixBuffers[i].ulFlags = 0; // Some stuff should be flagged here for DART, like end of + // audio data, but as we will continously send + // audio data, there will be no end.:) + SDL_memset(_this->hidden->pMixBuffers[i].pBuffer, iSilence, iBufSize); + } + } + _this->hidden->iNextFreeBuffer = 0; + _this->hidden->iLastPlayedBuf = -1; + // Create event semaphore + if (DosCreateEventSem(NULL, &(_this->hidden->hevAudioBufferPlayed), 0, FALSE)!=NO_ERROR) + { + // Could not create event semaphore! + { + int i; + for (i=0; ihidden->pMixBuffers[i].ulUserParm)); + } + mciSendCommand(iDeviceOrd, MCI_BUFFER, MCI_WAIT | MCI_DEALLOCATE_MEMORY, &(_this->hidden->BufferParms), 0); + SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL; + mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0); + SDL_SetError("Could not create event semaphore"); + return(-1); + } + + // Store the new settings in global variables + _this->hidden->iCurrDeviceOrd = iDeviceOrd; + _this->hidden->iCurrFreq = iFreq; + _this->hidden->iCurrBits = iBits; + _this->hidden->iCurrChannels = iChannels; + _this->hidden->iCurrNumBufs = iNumBufs; + _this->hidden->iCurrBufSize = iBufSize; + + return (0); +} + + + +void DART_ThreadInit(_THIS) +{ + return; +} + +/* This function waits until it is possible to write a full sound buffer */ +void DART_WaitAudio(_THIS) +{ + int i; + pMixBufferDesc pBufDesc; + ULONG ulPostCount; + + DosResetEventSem(_this->hidden->hevAudioBufferPlayed, &ulPostCount); + // If there is already an empty buffer, then return now! + for (i=0; i<_this->hidden->iCurrNumBufs; i++) + { + pBufDesc = (pMixBufferDesc) _this->hidden->pMixBuffers[i].ulUserParm; + if (pBufDesc->iBufferUsage == BUFFER_EMPTY) + return; + } + // If there is no empty buffer, wait for one to be empty! + DosWaitEventSem(_this->hidden->hevAudioBufferPlayed, 1000); // Wait max 1 sec!!! Important! + return; +} + +void DART_PlayAudio(_THIS) +{ + int iFreeBuf = _this->hidden->iNextFreeBuffer; + pMixBufferDesc pBufDesc; + + pBufDesc = (pMixBufferDesc) _this->hidden->pMixBuffers[iFreeBuf].ulUserParm; + pBufDesc->iBufferUsage = BUFFER_USED; + // Send it to DART to be queued + _this->hidden->MixSetupParms.pmixWrite(_this->hidden->MixSetupParms.ulMixHandle, + &(_this->hidden->pMixBuffers[iFreeBuf]), 1); + + _this->hidden->iLastPlayedBuf = iFreeBuf; + iFreeBuf = (iFreeBuf+1) % _this->hidden->iCurrNumBufs; + _this->hidden->iNextFreeBuffer = iFreeBuf; +} + +Uint8 *DART_GetAudioBuf(_THIS) +{ + int iFreeBuf; + Uint8 *pResult; + pMixBufferDesc pBufDesc; + + if (_this) + { + if (_this->hidden) + { + iFreeBuf = _this->hidden->iNextFreeBuffer; + pBufDesc = (pMixBufferDesc) _this->hidden->pMixBuffers[iFreeBuf].ulUserParm; + + if (pBufDesc) + { + if (pBufDesc->iBufferUsage == BUFFER_EMPTY) + { + pResult = _this->hidden->pMixBuffers[iFreeBuf].pBuffer; + return pResult; + } + } else + printf("[DART_GetAudioBuf] : ERROR! pBufDesc = %p\n", pBufDesc); + } else + printf("[DART_GetAudioBuf] : ERROR! _this->hidden = %p\n", _this->hidden); + } else + printf("[DART_GetAudioBuf] : ERROR! _this = %p\n", _this); + return NULL; +} + +void DART_WaitDone(_THIS) +{ + pMixBufferDesc pBufDesc; + ULONG ulPostCount; + APIRET rc; + + pBufDesc = (pMixBufferDesc) _this->hidden->pMixBuffers[_this->hidden->iLastPlayedBuf].ulUserParm; + rc = NO_ERROR; + while ((pBufDesc->iBufferUsage != BUFFER_EMPTY) && (rc==NO_ERROR)) + { + DosResetEventSem(_this->hidden->hevAudioBufferPlayed, &ulPostCount); + rc = DosWaitEventSem(_this->hidden->hevAudioBufferPlayed, 1000); // 1 sec timeout! Important! + } +} + +void DART_CloseAudio(_THIS) +{ + MCI_GENERIC_PARMS GenericParms; + int rc; + + // Stop DART playback + rc = mciSendCommand(_this->hidden->iCurrDeviceOrd, MCI_STOP, MCI_WAIT, &GenericParms, 0); + if (rc!=MCIERR_SUCCESS) + { +#ifdef SFX_DEBUG_BUILD + printf("Could not stop DART playback!\n"); + fflush(stdout); +#endif + } + + // Close event semaphore + DosCloseEventSem(_this->hidden->hevAudioBufferPlayed); + + // Free memory of buffer descriptions + { + int i; + for (i=0; i<_this->hidden->iCurrNumBufs; i++) SDL_free((void *)(_this->hidden->pMixBuffers[i].ulUserParm)); + } + + // Deallocate buffers + rc = mciSendCommand(_this->hidden->iCurrDeviceOrd, MCI_BUFFER, MCI_WAIT | MCI_DEALLOCATE_MEMORY, &(_this->hidden->BufferParms), 0); + + // Free bufferlist + SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL; + + // Close dart + rc = mciSendCommand(_this->hidden->iCurrDeviceOrd, MCI_CLOSE, MCI_WAIT, &(GenericParms), 0); +} + +/* Audio driver bootstrap functions */ + +int Audio_Available(void) +{ + return(1); +} + +void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) + { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) + { + SDL_OutOfMemory(); + if ( this ) + SDL_free(this); + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = DART_OpenAudio; + this->ThreadInit = DART_ThreadInit; + this->WaitAudio = DART_WaitAudio; + this->PlayAudio = DART_PlayAudio; + this->GetAudioBuf = DART_GetAudioBuf; + this->WaitDone = DART_WaitDone; + this->CloseAudio = DART_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap DART_bootstrap = { + "dart", "OS/2 Direct Audio RouTines (DART)", + Audio_Available, Audio_CreateDevice +}; + diff --git a/SDL/src/audio/dart/SDL_dart.h b/SDL/src/audio/dart/SDL_dart.h new file mode 100644 index 0000000..760944c --- /dev/null +++ b/SDL/src/audio/dart/SDL_dart.h @@ -0,0 +1,63 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_lowaudio_h +#define _SDL_lowaudio_h + +#define INCL_TYPES +#define INCL_DOSSEMAPHORES +#define INCL_DOSRESOURCES +#define INCL_DOSMISC +#define INCL_DOSERRORS + +#define INCL_OS2MM +#define INCL_MMIOOS2 +#define INCL_MCIOS2 +#include +#include // DART stuff and MMIO stuff + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *_this + +/* The DirectSound objects */ +struct SDL_PrivateAudioData +{ + int iCurrDeviceOrd; + int iCurrFreq; + int iCurrBits; + int iCurrChannels; + int iCurrNumBufs; + int iCurrBufSize; + + int iLastPlayedBuf; + int iNextFreeBuffer; + + MCI_BUFFER_PARMS BufferParms; // Sound buffer parameters + MCI_MIX_BUFFER *pMixBuffers; // Sound buffers + MCI_MIXSETUP_PARMS MixSetupParms; // Mixer setup parameters + HEV hevAudioBufferPlayed; // Event semaphore to indicate that an audio buffer has been played by DART +}; + +#endif /* _SDL_lowaudio_h */ diff --git a/SDL/src/audio/dc/SDL_dcaudio.c b/SDL/src/audio/dc/SDL_dcaudio.c new file mode 100644 index 0000000..695a6da --- /dev/null +++ b/SDL/src/audio/dc/SDL_dcaudio.c @@ -0,0 +1,246 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org + +*/ +#include "SDL_config.h" + +/* Output dreamcast aica */ + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audiomem.h" +#include "../SDL_audio_c.h" +#include "../SDL_audiodev_c.h" +#include "SDL_dcaudio.h" + +#include "aica.h" +#include + +/* Audio driver functions */ +static int DCAUD_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void DCAUD_WaitAudio(_THIS); +static void DCAUD_PlayAudio(_THIS); +static Uint8 *DCAUD_GetAudioBuf(_THIS); +static void DCAUD_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ +static int DCAUD_Available(void) +{ + return 1; +} + +static void DCAUD_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *DCAUD_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = DCAUD_OpenAudio; + this->WaitAudio = DCAUD_WaitAudio; + this->PlayAudio = DCAUD_PlayAudio; + this->GetAudioBuf = DCAUD_GetAudioBuf; + this->CloseAudio = DCAUD_CloseAudio; + + this->free = DCAUD_DeleteDevice; + + spu_init(); + + return this; +} + +AudioBootStrap DCAUD_bootstrap = { + "dcaudio", "Dreamcast AICA audio", + DCAUD_Available, DCAUD_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void DCAUD_WaitAudio(_THIS) +{ + if (this->hidden->playing) { + /* wait */ + while(aica_get_pos(0)/this->spec.samples == this->hidden->nextbuf) { + thd_pass(); + } + } +} + +#define SPU_RAM_BASE 0xa0800000 + +static void spu_memload_stereo8(int leftpos,int rightpos,void *src0,size_t size) +{ + uint8 *src = src0; + uint32 *left = (uint32*)(leftpos +SPU_RAM_BASE); + uint32 *right = (uint32*)(rightpos+SPU_RAM_BASE); + size = (size+7)/8; + while(size--) { + unsigned lval,rval; + lval = *src++; + rval = *src++; + lval|= (*src++)<<8; + rval|= (*src++)<<8; + lval|= (*src++)<<16; + rval|= (*src++)<<16; + lval|= (*src++)<<24; + rval|= (*src++)<<24; + g2_write_32(left++,lval); + g2_write_32(right++,rval); + g2_fifo_wait(); + } +} + +static void spu_memload_stereo16(int leftpos,int rightpos,void *src0,size_t size) +{ + uint16 *src = src0; + uint32 *left = (uint32*)(leftpos +SPU_RAM_BASE); + uint32 *right = (uint32*)(rightpos+SPU_RAM_BASE); + size = (size+7)/8; + while(size--) { + unsigned lval,rval; + lval = *src++; + rval = *src++; + lval|= (*src++)<<16; + rval|= (*src++)<<16; + g2_write_32(left++,lval); + g2_write_32(right++,rval); + g2_fifo_wait(); + } +} + +static void DCAUD_PlayAudio(_THIS) +{ + SDL_AudioSpec *spec = &this->spec; + unsigned int offset; + + if (this->hidden->playing) { + /* wait */ + while(aica_get_pos(0)/spec->samples == this->hidden->nextbuf) { + thd_pass(); + } + } + + offset = this->hidden->nextbuf*spec->size; + this->hidden->nextbuf^=1; + /* Write the audio data, checking for EAGAIN on broken audio drivers */ + if (spec->channels==1) { + spu_memload(this->hidden->leftpos+offset,this->hidden->mixbuf,this->hidden->mixlen); + } else { + offset/=2; + if ((this->spec.format&255)==8) { + spu_memload_stereo8(this->hidden->leftpos+offset,this->hidden->rightpos+offset,this->hidden->mixbuf,this->hidden->mixlen); + } else { + spu_memload_stereo16(this->hidden->leftpos+offset,this->hidden->rightpos+offset,this->hidden->mixbuf,this->hidden->mixlen); + } + } + + if (!this->hidden->playing) { + int mode; + this->hidden->playing = 1; + mode = (spec->format==AUDIO_S8)?SM_8BIT:SM_16BIT; + if (spec->channels==1) { + aica_play(0,mode,this->hidden->leftpos,0,spec->samples*2,spec->freq,255,128,1); + } else { + aica_play(0,mode,this->hidden->leftpos ,0,spec->samples*2,spec->freq,255,0,1); + aica_play(1,mode,this->hidden->rightpos,0,spec->samples*2,spec->freq,255,255,1); + } + } +} + +static Uint8 *DCAUD_GetAudioBuf(_THIS) +{ + return(this->hidden->mixbuf); +} + +static void DCAUD_CloseAudio(_THIS) +{ + aica_stop(0); + if (this->spec.channels==2) aica_stop(1); + if ( this->hidden->mixbuf != NULL ) { + SDL_FreeAudioMem(this->hidden->mixbuf); + this->hidden->mixbuf = NULL; + } +} + +static int DCAUD_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + Uint16 test_format = SDL_FirstAudioFormat(spec->format); + int valid_datatype = 0; + while ((!valid_datatype) && (test_format)) { + spec->format = test_format; + switch (test_format) { + /* only formats Dreamcast accepts... */ + case AUDIO_S8: + case AUDIO_S16LSB: + valid_datatype = 1; + break; + + default: + test_format = SDL_NextAudioFormat(); + break; + } + } + + if (!valid_datatype) { /* shouldn't happen, but just in case... */ + SDL_SetError("Unsupported audio format"); + return (-1); + } + + if (spec->channels > 2) + spec->channels = 2; /* no more than stereo on the Dreamcast. */ + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(spec); + + /* Allocate mixing buffer */ + this->hidden->mixlen = spec->size; + this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); + if ( this->hidden->mixbuf == NULL ) { + return(-1); + } + SDL_memset(this->hidden->mixbuf, spec->silence, spec->size); + this->hidden->leftpos = 0x11000; + this->hidden->rightpos = 0x11000+spec->size; + this->hidden->playing = 0; + this->hidden->nextbuf = 0; + + /* We're ready to rock and roll. :-) */ + return(0); +} diff --git a/SDL/src/audio/dc/SDL_dcaudio.h b/SDL/src/audio/dc/SDL_dcaudio.h new file mode 100644 index 0000000..ca996f3 --- /dev/null +++ b/SDL/src/audio/dc/SDL_dcaudio.h @@ -0,0 +1,41 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_dcaudio_h +#define _SDL_dcaudio_h + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The file descriptor for the audio device */ + Uint8 *mixbuf; + Uint32 mixlen; + int playing; + int leftpos,rightpos; + int nextbuf; +}; + +#endif /* _SDL_dcaudio_h */ diff --git a/SDL/src/audio/dc/aica.c b/SDL/src/audio/dc/aica.c new file mode 100644 index 0000000..d0bbc54 --- /dev/null +++ b/SDL/src/audio/dc/aica.c @@ -0,0 +1,271 @@ +/* This file is part of the Dreamcast function library. + * Please see libdream.c for further details. + * + * (c)2000 Dan Potter + * modify BERO + */ +#include "aica.h" + +#include +#include + +/* #define dc_snd_base ((volatile unsigned char *)0x00800000) */ /* arm side */ +#define dc_snd_base ((volatile unsigned char *)0xa0700000) /* dc side */ + +/* Some convienence macros */ +#define SNDREGADDR(x) (0xa0700000 + (x)) +#define CHNREGADDR(ch,x) SNDREGADDR(0x80*(ch)+(x)) + + +#define SNDREG32(x) (*(volatile unsigned long *)SNDREGADDR(x)) +#define SNDREG8(x) (*(volatile unsigned char *)SNDREGADDR(x)) +#define CHNREG32(ch, x) (*(volatile unsigned long *)CHNREGADDR(ch,x)) +#define CHNREG8(ch, x) (*(volatile unsigned long *)CHNREGADDR(ch,x)) + +#define G2_LOCK(OLD) \ + do { \ + if (!irq_inside_int()) \ + OLD = irq_disable(); \ + /* suspend any G2 DMA here... */ \ + while((*(volatile unsigned int *)0xa05f688c) & 0x20) \ + ; \ + } while(0) + +#define G2_UNLOCK(OLD) \ + do { \ + /* resume any G2 DMA here... */ \ + if (!irq_inside_int()) \ + irq_restore(OLD); \ + } while(0) + + +void aica_init() { + int i, j, old = 0; + + /* Initialize AICA channels */ + G2_LOCK(old); + SNDREG32(0x2800) = 0x0000; + + for (i=0; i<64; i++) { + for (j=0; j<0x80; j+=4) { + if ((j&31)==0) g2_fifo_wait(); + CHNREG32(i, j) = 0; + } + g2_fifo_wait(); + CHNREG32(i,0) = 0x8000; + CHNREG32(i,20) = 0x1f; + } + + SNDREG32(0x2800) = 0x000f; + g2_fifo_wait(); + G2_UNLOCK(old); +} + +/* Translates a volume from linear form to logarithmic form (required by + the AICA chip */ +/* int logs[] = { + +0, 40, 50, 58, 63, 68, 73, 77, 80, 83, 86, 89, 92, 94, 97, 99, 101, 103, +105, 107, 109, 111, 112, 114, 116, 117, 119, 120, 122, 123, 125, 126, 127, +129, 130, 131, 133, 134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 145, +146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, +160, 161, 162, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 170, 171, +172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 180, 180, 181, 182, +182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 188, 189, 190, 190, 191, +191, 192, 193, 193, 194, 194, 195, 196, 196, 197, 197, 198, 198, 199, 199, +200, 201, 201, 202, 202, 203, 203, 204, 204, 205, 205, 206, 206, 207, 207, +208, 208, 209, 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215, +215, 216, 216, 217, 217, 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, +222, 222, 223, 223, 224, 224, 225, 225, 225, 226, 226, 227, 227, 228, 228, +228, 229, 229, 230, 230, 230, 231, 231, 232, 232, 232, 233, 233, 234, 234, +234, 235, 235, 236, 236, 236, 237, 237, 238, 238, 238, 239, 239, 240, 240, +240, 241, 241, 241, 242, 242, 243, 243, 243, 244, 244, 244, 245, 245, 245, +246, 246, 247, 247, 247, 248, 248, 248, 249, 249, 249, 250, 250, 250, 251, +251, 251, 252, 252, 252, 253, 253, 253, 254, 254, 254, 255 + +}; */ + +const static unsigned char logs[] = { + 0, 15, 22, 27, 31, 35, 39, 42, 45, 47, 50, 52, 55, 57, 59, 61, + 63, 65, 67, 69, 71, 73, 74, 76, 78, 79, 81, 82, 84, 85, 87, 88, + 90, 91, 92, 94, 95, 96, 98, 99, 100, 102, 103, 104, 105, 106, + 108, 109, 110, 111, 112, 113, 114, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, + 157, 158, 159, 160, 160, 161, 162, 163, 164, 164, 165, 166, 167, + 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, + 177, 178, 178, 179, 180, 181, 181, 182, 183, 183, 184, 185, 185, + 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, 193, 194, + 195, 195, 196, 197, 197, 198, 199, 199, 200, 200, 201, 202, 202, + 203, 204, 204, 205, 205, 206, 207, 207, 208, 209, 209, 210, 210, + 211, 212, 212, 213, 213, 214, 215, 215, 216, 216, 217, 217, 218, + 219, 219, 220, 220, 221, 221, 222, 223, 223, 224, 224, 225, 225, + 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 232, 232, 233, + 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 239, 239, 240, + 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, + 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 254, 255 +}; + +/* For the moment this is going to have to suffice, until we really + figure out what these mean. */ +#define AICA_PAN(x) ((x)==0x80?(0):((x)<0x80?(0x1f):(0x0f))) +#define AICA_VOL(x) (0xff - logs[128 + (((x) & 0xff) / 2)]) +//#define AICA_VOL(x) (0xff - logs[x&255]) + +static inline unsigned AICA_FREQ(unsigned freq) { + unsigned long freq_lo, freq_base = 5644800; + int freq_hi = 7; + + /* Need to convert frequency to floating point format + (freq_hi is exponent, freq_lo is mantissa) + Formula is ferq = 44100*2^freq_hi*(1+freq_lo/1024) */ + while (freq < freq_base && freq_hi > -8) { + freq_base >>= 1; + --freq_hi; + } + while (freq < freq_base && freq_hi > -8) { + freq_base >>= 1; + freq_hi--; + } + freq_lo = (freq<<10) / freq_base; + return (freq_hi << 11) | (freq_lo & 1023); +} + +/* Sets up a sound channel completely. This is generally good if you want + a quick and dirty way to play notes. If you want a more comprehensive + set of routines (more like PC wavetable cards) see below. + + ch is the channel to play on (0 - 63) + smpptr is the pointer to the sound data; if you're running off the + SH4, then this ought to be (ptr - 0xa0800000); otherwise it's just + ptr. Basically, it's an offset into sound ram. + mode is one of the mode constants (16 bit, 8 bit, ADPCM) + nsamp is the number of samples to play (not number of bytes!) + freq is the sampling rate of the sound + vol is the volume, 0 to 0xff (0xff is louder) + pan is a panning constant -- 0 is left, 128 is center, 255 is right. + + This routine (and the similar ones) owe a lot to Marcus' sound example -- + I hadn't gotten quite this far into dissecting the individual regs yet. */ +void aica_play(int ch,int mode,unsigned long smpptr,int loopst,int loopend,int freq,int vol,int pan,int loopflag) { +/* int i; +*/ + int val; + int old = 0; + + /* Stop the channel (if it's already playing) */ + aica_stop(ch); + /* doesn't seem to be needed, but it's here just in case */ +/* + for (i=0; i<256; i++) { + asm("nop"); + asm("nop"); + asm("nop"); + asm("nop"); + } +*/ + G2_LOCK(old); + /* Envelope setup. The first of these is the loop point, + e.g., where the sample starts over when it loops. The second + is the loop end. This is the full length of the sample when + you are not looping, or the loop end point when you are (though + storing more than that is a waste of memory if you're not doing + volume enveloping). */ + CHNREG32(ch, 8) = loopst & 0xffff; + CHNREG32(ch, 12) = loopend & 0xffff; + + /* Write resulting values */ + CHNREG32(ch, 24) = AICA_FREQ(freq); + + /* Set volume, pan, and some other things that we don't know what + they do =) */ + CHNREG32(ch, 36) = AICA_PAN(pan) | (0xf<<8); + /* Convert the incoming volume and pan into hardware values */ + /* Vol starts at zero so we can ramp */ + vol = AICA_VOL(vol); + CHNREG32(ch, 40) = 0x24 | (vol<<8); + /* Convert the incoming volume and pan into hardware values */ + /* Vol starts at zero so we can ramp */ + + /* If we supported volume envelopes (which we don't yet) then + this value would set that up. The top 4 bits determine the + envelope speed. f is the fastest, 1 is the slowest, and 0 + seems to be an invalid value and does weird things). The + default (below) sets it into normal mode (play and terminate/loop). + CHNREG32(ch, 16) = 0xf010; + */ + CHNREG32(ch, 16) = 0x1f; /* No volume envelope */ + + + /* Set sample format, buffer address, and looping control. If + 0x0200 mask is set on reg 0, the sample loops infinitely. If + it's not set, the sample plays once and terminates. We'll + also set the bits to start playback here. */ + CHNREG32(ch, 4) = smpptr & 0xffff; + val = 0xc000 | 0x0000 | (mode<<7) | (smpptr >> 16); + if (loopflag) val|=0x200; + + CHNREG32(ch, 0) = val; + + G2_UNLOCK(old); + + /* Enable playback */ + /* CHNREG32(ch, 0) |= 0xc000; */ + g2_fifo_wait(); + +#if 0 + for (i=0xff; i>=vol; i--) { + if ((i&7)==0) g2_fifo_wait(); + CHNREG32(ch, 40) = 0x24 | (i<<8);; + } + + g2_fifo_wait(); +#endif +} + +/* Stop the sound on a given channel */ +void aica_stop(int ch) { + g2_write_32(CHNREGADDR(ch, 0),(g2_read_32(CHNREGADDR(ch, 0)) & ~0x4000) | 0x8000); + g2_fifo_wait(); +} + + +/* The rest of these routines can change the channel in mid-stride so you + can do things like vibrato and panning effects. */ + +/* Set channel volume */ +void aica_vol(int ch,int vol) { +// g2_write_8(CHNREGADDR(ch, 41),AICA_VOL(vol)); + g2_write_32(CHNREGADDR(ch, 40),(g2_read_32(CHNREGADDR(ch, 40))&0xffff00ff)|(AICA_VOL(vol)<<8) ); + g2_fifo_wait(); +} + +/* Set channel pan */ +void aica_pan(int ch,int pan) { +// g2_write_8(CHNREGADDR(ch, 36),AICA_PAN(pan)); + g2_write_32(CHNREGADDR(ch, 36),(g2_read_32(CHNREGADDR(ch, 36))&0xffffff00)|(AICA_PAN(pan)) ); + g2_fifo_wait(); +} + +/* Set channel frequency */ +void aica_freq(int ch,int freq) { + g2_write_32(CHNREGADDR(ch, 24),AICA_FREQ(freq)); + g2_fifo_wait(); +} + +/* Get channel position */ +int aica_get_pos(int ch) { +#if 1 + /* Observe channel ch */ + g2_write_32(SNDREGADDR(0x280c),(g2_read_32(SNDREGADDR(0x280c))&0xffff00ff) | (ch<<8)); + g2_fifo_wait(); + /* Update position counters */ + return g2_read_32(SNDREGADDR(0x2814)) & 0xffff; +#else + /* Observe channel ch */ + g2_write_8(SNDREGADDR(0x280d),ch); + /* Update position counters */ + return g2_read_32(SNDREGADDR(0x2814)) & 0xffff; +#endif +} diff --git a/SDL/src/audio/dc/aica.h b/SDL/src/audio/dc/aica.h new file mode 100644 index 0000000..5265b4a --- /dev/null +++ b/SDL/src/audio/dc/aica.h @@ -0,0 +1,40 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _AICA_H_ +#define _AICA_H_ + +#define AICA_MEM 0xa0800000 + +#define SM_8BIT 1 +#define SM_16BIT 0 +#define SM_ADPCM 2 + +void aica_play(int ch,int mode,unsigned long smpptr,int looptst,int loopend,int freq,int vol,int pan,int loopflag); +void aica_stop(int ch); +void aica_vol(int ch,int vol); +void aica_pan(int ch,int pan); +void aica_freq(int ch,int freq); +int aica_get_pos(int ch); + +#endif diff --git a/SDL/src/audio/disk/SDL_diskaudio.c b/SDL/src/audio/disk/SDL_diskaudio.c new file mode 100644 index 0000000..81bdbc9 --- /dev/null +++ b/SDL/src/audio/disk/SDL_diskaudio.c @@ -0,0 +1,186 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org + + This file written by Ryan C. Gordon (icculus@icculus.org) +*/ +#include "SDL_config.h" + +/* Output raw audio data to a file. */ + +#if HAVE_STDIO_H +#include +#endif + +#include "SDL_rwops.h" +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audiomem.h" +#include "../SDL_audio_c.h" +#include "../SDL_audiodev_c.h" +#include "SDL_diskaudio.h" + +/* The tag name used by DISK audio */ +#define DISKAUD_DRIVER_NAME "disk" + +/* environment variables and defaults. */ +#define DISKENVR_OUTFILE "SDL_DISKAUDIOFILE" +#define DISKDEFAULT_OUTFILE "sdlaudio.raw" +#define DISKENVR_WRITEDELAY "SDL_DISKAUDIODELAY" +#define DISKDEFAULT_WRITEDELAY 150 + +/* Audio driver functions */ +static int DISKAUD_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void DISKAUD_WaitAudio(_THIS); +static void DISKAUD_PlayAudio(_THIS); +static Uint8 *DISKAUD_GetAudioBuf(_THIS); +static void DISKAUD_CloseAudio(_THIS); + +static const char *DISKAUD_GetOutputFilename(void) +{ + const char *envr = SDL_getenv(DISKENVR_OUTFILE); + return((envr != NULL) ? envr : DISKDEFAULT_OUTFILE); +} + +/* Audio driver bootstrap functions */ +static int DISKAUD_Available(void) +{ + const char *envr = SDL_getenv("SDL_AUDIODRIVER"); + if (envr && (SDL_strcmp(envr, DISKAUD_DRIVER_NAME) == 0)) { + return(1); + } + return(0); +} + +static void DISKAUD_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *DISKAUD_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + const char *envr; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + envr = SDL_getenv(DISKENVR_WRITEDELAY); + this->hidden->write_delay = (envr) ? SDL_atoi(envr) : DISKDEFAULT_WRITEDELAY; + + /* Set the function pointers */ + this->OpenAudio = DISKAUD_OpenAudio; + this->WaitAudio = DISKAUD_WaitAudio; + this->PlayAudio = DISKAUD_PlayAudio; + this->GetAudioBuf = DISKAUD_GetAudioBuf; + this->CloseAudio = DISKAUD_CloseAudio; + + this->free = DISKAUD_DeleteDevice; + + return this; +} + +AudioBootStrap DISKAUD_bootstrap = { + DISKAUD_DRIVER_NAME, "direct-to-disk audio", + DISKAUD_Available, DISKAUD_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void DISKAUD_WaitAudio(_THIS) +{ + SDL_Delay(this->hidden->write_delay); +} + +static void DISKAUD_PlayAudio(_THIS) +{ + int written; + + /* Write the audio data */ + written = SDL_RWwrite(this->hidden->output, + this->hidden->mixbuf, 1, + this->hidden->mixlen); + + /* If we couldn't write, assume fatal error for now */ + if ( (Uint32)written != this->hidden->mixlen ) { + this->enabled = 0; + } +#ifdef DEBUG_AUDIO + fprintf(stderr, "Wrote %d bytes of audio data\n", written); +#endif +} + +static Uint8 *DISKAUD_GetAudioBuf(_THIS) +{ + return(this->hidden->mixbuf); +} + +static void DISKAUD_CloseAudio(_THIS) +{ + if ( this->hidden->mixbuf != NULL ) { + SDL_FreeAudioMem(this->hidden->mixbuf); + this->hidden->mixbuf = NULL; + } + if ( this->hidden->output != NULL ) { + SDL_RWclose(this->hidden->output); + this->hidden->output = NULL; + } +} + +static int DISKAUD_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + const char *fname = DISKAUD_GetOutputFilename(); + + /* Open the audio device */ + this->hidden->output = SDL_RWFromFile(fname, "wb"); + if ( this->hidden->output == NULL ) { + return(-1); + } + +#if HAVE_STDIO_H + fprintf(stderr, "WARNING: You are using the SDL disk writer" + " audio driver!\n Writing to file [%s].\n", fname); +#endif + + /* Allocate mixing buffer */ + this->hidden->mixlen = spec->size; + this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); + if ( this->hidden->mixbuf == NULL ) { + return(-1); + } + SDL_memset(this->hidden->mixbuf, spec->silence, spec->size); + + /* We're ready to rock and roll. :-) */ + return(0); +} + diff --git a/SDL/src/audio/disk/SDL_diskaudio.h b/SDL/src/audio/disk/SDL_diskaudio.h new file mode 100644 index 0000000..a6112e5 --- /dev/null +++ b/SDL/src/audio/disk/SDL_diskaudio.h @@ -0,0 +1,41 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_diskaudio_h +#define _SDL_diskaudio_h + +#include "SDL_rwops.h" +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The file descriptor for the audio device */ + SDL_RWops *output; + Uint8 *mixbuf; + Uint32 mixlen; + Uint32 write_delay; +}; + +#endif /* _SDL_diskaudio_h */ diff --git a/SDL/src/audio/dma/SDL_dmaaudio.c b/SDL/src/audio/dma/SDL_dmaaudio.c new file mode 100644 index 0000000..11a51e9 --- /dev/null +++ b/SDL/src/audio/dma/SDL_dmaaudio.c @@ -0,0 +1,455 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Allow access to a raw mixing buffer */ + +#include +#include /* For strerror() */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H +/* This is installed on some systems */ +#include +#else +/* This is recommended by OSS */ +#include +#endif + +#ifndef MAP_FAILED +#define MAP_FAILED ((Uint8 *)-1) +#endif + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "../SDL_audiodev_c.h" +#include "SDL_dmaaudio.h" + +/* The tag name used by DMA audio */ +#define DMA_DRIVER_NAME "dma" + +/* Open the audio device for playback, and don't block if busy */ +#define OPEN_FLAGS (O_RDWR|O_NONBLOCK) + +/* Audio driver functions */ +static int DMA_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void DMA_WaitAudio(_THIS); +static void DMA_PlayAudio(_THIS); +static Uint8 *DMA_GetAudioBuf(_THIS); +static void DMA_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + int available; + int fd; + + available = 0; + + fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); + if ( fd >= 0 ) { + int caps; + struct audio_buf_info info; + + if ( (ioctl(fd, SNDCTL_DSP_GETCAPS, &caps) == 0) && + (caps & DSP_CAP_TRIGGER) && (caps & DSP_CAP_MMAP) && + (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) == 0) ) { + available = 1; + } + close(fd); + } + return(available); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + audio_fd = -1; + + /* Set the function pointers */ + this->OpenAudio = DMA_OpenAudio; + this->WaitAudio = DMA_WaitAudio; + this->PlayAudio = DMA_PlayAudio; + this->GetAudioBuf = DMA_GetAudioBuf; + this->CloseAudio = DMA_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap DMA_bootstrap = { + DMA_DRIVER_NAME, "OSS /dev/dsp DMA audio", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void DMA_WaitAudio(_THIS) +{ + fd_set fdset; + + /* Check to see if the thread-parent process is still alive */ + { static int cnt = 0; + /* Note that this only works with thread implementations + that use a different process id for each thread. + */ + if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */ + if ( kill(parent, 0) < 0 ) { + this->enabled = 0; + } + } + } + + /* See if we need to use timed audio synchronization */ + if ( frame_ticks ) { + /* Use timer for general audio synchronization */ + Sint32 ticks; + + ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS; + if ( ticks > 0 ) { + SDL_Delay(ticks); + } + } else { + /* Use select() for audio synchronization */ + struct timeval timeout; + FD_ZERO(&fdset); + FD_SET(audio_fd, &fdset); + timeout.tv_sec = 10; + timeout.tv_usec = 0; +#ifdef DEBUG_AUDIO + fprintf(stderr, "Waiting for audio to get ready\n"); +#endif + if ( select(audio_fd+1, NULL, &fdset, NULL, &timeout) <= 0 ) { + const char *message = +#ifdef AUDIO_OSPACE_HACK + "Audio timeout - buggy audio driver? (trying ospace)"; +#else + "Audio timeout - buggy audio driver? (disabled)"; +#endif + /* In general we should never print to the screen, + but in this case we have no other way of letting + the user know what happened. + */ + fprintf(stderr, "SDL: %s\n", message); +#ifdef AUDIO_OSPACE_HACK + /* We may be able to use GET_OSPACE trick */ + frame_ticks = (float)(this->spec->samples*1000) / + this->spec->freq; + next_frame = SDL_GetTicks()+frame_ticks; +#else + this->enabled = 0; + /* Don't try to close - may hang */ + audio_fd = -1; +#ifdef DEBUG_AUDIO + fprintf(stderr, "Done disabling audio\n"); +#endif +#endif /* AUDIO_OSPACE_HACK */ + } +#ifdef DEBUG_AUDIO + fprintf(stderr, "Ready!\n"); +#endif + } +} + +static void DMA_PlayAudio(_THIS) +{ + /* If timer synchronization is enabled, set the next write frame */ + if ( frame_ticks ) { + next_frame += frame_ticks; + } + return; +} + +static Uint8 *DMA_GetAudioBuf(_THIS) +{ + count_info info; + int playing; + int filling; + + /* Get number of blocks, looping if we're not using select() */ + do { + if ( ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) < 0 ) { + /* Uh oh... */ + this->enabled = 0; + return(NULL); + } + } while ( frame_ticks && (info.blocks < 1) ); +#ifdef DEBUG_AUDIO + if ( info.blocks > 1 ) { + printf("Warning: audio underflow (%d frags)\n", info.blocks-1); + } +#endif + playing = info.ptr / this->spec.size; + filling = (playing + 1)%num_buffers; + return (dma_buf + (filling * this->spec.size)); +} + +static void DMA_CloseAudio(_THIS) +{ + if ( dma_buf != NULL ) { + munmap(dma_buf, dma_len); + dma_buf = NULL; + } + if ( audio_fd >= 0 ) { + close(audio_fd); + audio_fd = -1; + } +} + +static int DMA_ReopenAudio(_THIS, const char *audiodev, int format, int stereo, + SDL_AudioSpec *spec) +{ + int frag_spec; + int value; + + /* Close and then reopen the audio device */ + close(audio_fd); + audio_fd = open(audiodev, O_RDWR, 0); + if ( audio_fd < 0 ) { + SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); + return(-1); + } + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + /* Determine the power of two of the fragment size */ + for ( frag_spec = 0; (0x01<size; ++frag_spec ); + if ( (0x01<size ) { + SDL_SetError("Fragment size must be a power of two"); + return(-1); + } + + /* Set the audio buffering parameters */ + if ( ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0 ) { + SDL_SetError("Couldn't set audio fragment spec"); + return(-1); + } + + /* Set the audio format */ + value = format; + if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || + (value != format) ) { + SDL_SetError("Couldn't set audio format"); + return(-1); + } + + /* Set mono or stereo audio */ + value = (spec->channels > 1); + if ( (ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo) < 0) || + (value != stereo) ) { + SDL_SetError("Couldn't set audio channels"); + return(-1); + } + + /* Set the DSP frequency */ + value = spec->freq; + if ( ioctl(audio_fd, SNDCTL_DSP_SPEED, &value) < 0 ) { + SDL_SetError("Couldn't set audio frequency"); + return(-1); + } + spec->freq = value; + + /* We successfully re-opened the audio */ + return(0); +} + +static int DMA_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + char audiodev[1024]; + int format; + int stereo; + int value; + Uint16 test_format; + struct audio_buf_info info; + + /* Reset the timer synchronization flag */ + frame_ticks = 0.0; + + /* Open the audio device */ + audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0); + if ( audio_fd < 0 ) { + SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); + return(-1); + } + dma_buf = NULL; + ioctl(audio_fd, SNDCTL_DSP_RESET, 0); + + /* Get a list of supported hardware formats */ + if ( ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0 ) { + SDL_SetError("Couldn't get audio format list"); + return(-1); + } + + /* Try for a closest match on audio format */ + format = 0; + for ( test_format = SDL_FirstAudioFormat(spec->format); + ! format && test_format; ) { +#ifdef DEBUG_AUDIO + fprintf(stderr, "Trying format 0x%4.4x\n", test_format); +#endif + switch ( test_format ) { + case AUDIO_U8: + if ( value & AFMT_U8 ) { + format = AFMT_U8; + } + break; + case AUDIO_S8: + if ( value & AFMT_S8 ) { + format = AFMT_S8; + } + break; + case AUDIO_S16LSB: + if ( value & AFMT_S16_LE ) { + format = AFMT_S16_LE; + } + break; + case AUDIO_S16MSB: + if ( value & AFMT_S16_BE ) { + format = AFMT_S16_BE; + } + break; + case AUDIO_U16LSB: + if ( value & AFMT_U16_LE ) { + format = AFMT_U16_LE; + } + break; + case AUDIO_U16MSB: + if ( value & AFMT_U16_BE ) { + format = AFMT_U16_BE; + } + break; + default: + format = 0; + break; + } + if ( ! format ) { + test_format = SDL_NextAudioFormat(); + } + } + if ( format == 0 ) { + SDL_SetError("Couldn't find any hardware audio formats"); + return(-1); + } + spec->format = test_format; + + /* Set the audio format */ + value = format; + if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || + (value != format) ) { + SDL_SetError("Couldn't set audio format"); + return(-1); + } + + /* Set mono or stereo audio (currently only two channels supported) */ + stereo = (spec->channels > 1); + ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo); + if ( stereo ) { + spec->channels = 2; + } else { + spec->channels = 1; + } + + /* Because some drivers don't allow setting the buffer size + after setting the format, we must re-open the audio device + once we know what format and channels are supported + */ + if ( DMA_ReopenAudio(this, audiodev, format, stereo, spec) < 0 ) { + /* Error is set by DMA_ReopenAudio() */ + return(-1); + } + + /* Memory map the audio buffer */ + if ( ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info) < 0 ) { + SDL_SetError("Couldn't get OSPACE parameters"); + return(-1); + } + spec->size = info.fragsize; + spec->samples = spec->size / ((spec->format & 0xFF) / 8); + spec->samples /= spec->channels; + num_buffers = info.fragstotal; + dma_len = num_buffers*spec->size; + dma_buf = (Uint8 *)mmap(NULL, dma_len, PROT_WRITE, MAP_SHARED, + audio_fd, 0); + if ( dma_buf == MAP_FAILED ) { + SDL_SetError("DMA memory map failed"); + dma_buf = NULL; + return(-1); + } + SDL_memset(dma_buf, spec->silence, dma_len); + + /* Check to see if we need to use select() workaround */ + { char *workaround; + workaround = SDL_getenv("SDL_DSP_NOSELECT"); + if ( workaround ) { + frame_ticks = (float)(spec->samples*1000)/spec->freq; + next_frame = SDL_GetTicks()+frame_ticks; + } + } + + /* Trigger audio playback */ + value = 0; + ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &value); + value = PCM_ENABLE_OUTPUT; + if ( ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &value) < 0 ) { + SDL_SetError("Couldn't trigger audio output"); + return(-1); + } + + /* Get the parent process id (we're the parent of the audio thread) */ + parent = getpid(); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff --git a/SDL/src/audio/dma/SDL_dmaaudio.h b/SDL/src/audio/dma/SDL_dmaaudio.h new file mode 100644 index 0000000..fc75ac1 --- /dev/null +++ b/SDL/src/audio/dma/SDL_dmaaudio.h @@ -0,0 +1,59 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_dspaudio_h +#define _SDL_dspaudio_h + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The file descriptor for the audio device */ + int audio_fd; + + /* The parent process id, to detect when application quits */ + pid_t parent; + + /* Raw mixing buffer */ + Uint8 *dma_buf; + int dma_len; + int num_buffers; + + /* Support for audio timing using a timer, in addition to select() */ + float frame_ticks; + float next_frame; +}; +#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ + +/* Old variable names */ +#define audio_fd (this->hidden->audio_fd) +#define parent (this->hidden->parent) +#define dma_buf (this->hidden->dma_buf) +#define dma_len (this->hidden->dma_len) +#define num_buffers (this->hidden->num_buffers) +#define frame_ticks (this->hidden->frame_ticks) +#define next_frame (this->hidden->next_frame) + +#endif /* _SDL_dspaudio_h */ diff --git a/SDL/src/audio/dmedia/SDL_irixaudio.c b/SDL/src/audio/dmedia/SDL_irixaudio.c new file mode 100644 index 0000000..6e93b33 --- /dev/null +++ b/SDL/src/audio/dmedia/SDL_irixaudio.c @@ -0,0 +1,242 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Allow access to a raw mixing buffer (For IRIX 6.5 and higher) */ +/* patch for IRIX 5 by Georg Schwarz 18/07/2004 */ + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audiomem.h" +#include "../SDL_audio_c.h" +#include "SDL_irixaudio.h" + + +#ifndef AL_RESOURCE /* as a test whether we use the old IRIX audio libraries */ +#define OLD_IRIX_AUDIO +#define alClosePort(x) ALcloseport(x) +#define alFreeConfig(x) ALfreeconfig(x) +#define alGetFillable(x) ALgetfillable(x) +#define alNewConfig() ALnewconfig() +#define alOpenPort(x,y,z) ALopenport(x,y,z) +#define alSetChannels(x,y) ALsetchannels(x,y) +#define alSetQueueSize(x,y) ALsetqueuesize(x,y) +#define alSetSampFmt(x,y) ALsetsampfmt(x,y) +#define alSetWidth(x,y) ALsetwidth(x,y) +#endif + +/* Audio driver functions */ +static int AL_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void AL_WaitAudio(_THIS); +static void AL_PlayAudio(_THIS); +static Uint8 *AL_GetAudioBuf(_THIS); +static void AL_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + return 1; +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = AL_OpenAudio; + this->WaitAudio = AL_WaitAudio; + this->PlayAudio = AL_PlayAudio; + this->GetAudioBuf = AL_GetAudioBuf; + this->CloseAudio = AL_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap DMEDIA_bootstrap = { + "AL", "IRIX DMedia audio", + Audio_Available, Audio_CreateDevice +}; + + +void static AL_WaitAudio(_THIS) +{ + Sint32 timeleft; + + timeleft = this->spec.samples - alGetFillable(audio_port); + if ( timeleft > 0 ) { + timeleft /= (this->spec.freq/1000); + SDL_Delay((Uint32)timeleft); + } +} + +static void AL_PlayAudio(_THIS) +{ + /* Write the audio data out */ + if ( alWriteFrames(audio_port, mixbuf, this->spec.samples) < 0 ) { + /* Assume fatal error, for now */ + this->enabled = 0; + } +} + +static Uint8 *AL_GetAudioBuf(_THIS) +{ + return(mixbuf); +} + +static void AL_CloseAudio(_THIS) +{ + if ( mixbuf != NULL ) { + SDL_FreeAudioMem(mixbuf); + mixbuf = NULL; + } + if ( audio_port != NULL ) { + alClosePort(audio_port); + audio_port = NULL; + } +} + +static int AL_OpenAudio(_THIS, SDL_AudioSpec * spec) +{ + Uint16 test_format = SDL_FirstAudioFormat(spec->format); + long width = 0; + long fmt = 0; + int valid = 0; + +#ifdef OLD_IRIX_AUDIO + { + long audio_param[2]; + audio_param[0] = AL_OUTPUT_RATE; + audio_param[1] = spec->freq; + valid = (ALsetparams(AL_DEFAULT_DEVICE, audio_param, 2) < 0); + } +#else + { + ALpv audio_param; + audio_param.param = AL_RATE; + audio_param.value.i = spec->freq; + valid = (alSetParams(AL_DEFAULT_OUTPUT, &audio_param, 1) < 0); + } +#endif + + while ((!valid) && (test_format)) { + valid = 1; + spec->format = test_format; + + switch (test_format) { + case AUDIO_S8: + width = AL_SAMPLE_8; + fmt = AL_SAMPFMT_TWOSCOMP; + break; + + case AUDIO_S16SYS: + width = AL_SAMPLE_16; + fmt = AL_SAMPFMT_TWOSCOMP; + break; + + default: + valid = 0; + test_format = SDL_NextAudioFormat(); + break; + } + + if (valid) { + ALconfig audio_config = alNewConfig(); + valid = 0; + if (audio_config) { + if (alSetChannels(audio_config, spec->channels) < 0) { + if (spec->channels > 2) { /* can't handle > stereo? */ + spec->channels = 2; /* try again below. */ + } + } + + if ((alSetSampFmt(audio_config, fmt) >= 0) && + ((!width) || (alSetWidth(audio_config, width) >= 0)) && + (alSetQueueSize(audio_config, spec->samples * 2) >= 0) && + (alSetChannels(audio_config, spec->channels) >= 0)) { + + audio_port = alOpenPort("SDL audio", "w", audio_config); + if (audio_port == NULL) { + /* docs say AL_BAD_CHANNELS happens here, too. */ + int err = oserror(); + if (err == AL_BAD_CHANNELS) { + spec->channels = 2; + alSetChannels(audio_config, spec->channels); + audio_port = alOpenPort("SDL audio", "w", + audio_config); + } + } + + if (audio_port != NULL) { + valid = 1; + } + } + + alFreeConfig(audio_config); + } + } + } + + if (!valid) { + SDL_SetError("Unsupported audio format"); + return (-1); + } + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(spec); + + /* Allocate mixing buffer */ + mixbuf = (Uint8 *) SDL_AllocAudioMem(spec->size); + if (mixbuf == NULL) { + SDL_OutOfMemory(); + return (-1); + } + SDL_memset(mixbuf, spec->silence, spec->size); + + /* We're ready to rock and roll. :-) */ + return (0); +} + diff --git a/SDL/src/audio/dmedia/SDL_irixaudio.h b/SDL/src/audio/dmedia/SDL_irixaudio.h new file mode 100644 index 0000000..28f89ad --- /dev/null +++ b/SDL/src/audio/dmedia/SDL_irixaudio.h @@ -0,0 +1,45 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_lowaudio_h +#define _SDL_lowaudio_h + +#include + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The handle for the audio device */ + ALport audio_port; + + Uint8 *mixbuf; /* The app mixing buffer */ +}; + +/* Old variable names */ +#define audio_port (this->hidden->audio_port) +#define mixbuf (this->hidden->mixbuf) + +#endif /* _SDL_lowaudio_h */ diff --git a/SDL/src/audio/dsp/SDL_dspaudio.c b/SDL/src/audio/dsp/SDL_dspaudio.c new file mode 100644 index 0000000..584c2d4 --- /dev/null +++ b/SDL/src/audio/dsp/SDL_dspaudio.c @@ -0,0 +1,340 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org + + Modified in Oct 2004 by Hannu Savolainen + hannu@opensound.com +*/ +#include "SDL_config.h" + +/* Allow access to a raw mixing buffer */ + +#include /* For perror() */ +#include /* For strerror() */ +#include +#include +#include +#include +#include +#include +#include + +#if SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H +/* This is installed on some systems */ +#include +#else +/* This is recommended by OSS */ +#include +#endif + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audiomem.h" +#include "../SDL_audio_c.h" +#include "../SDL_audiodev_c.h" +#include "SDL_dspaudio.h" + +/* The tag name used by DSP audio */ +#define DSP_DRIVER_NAME "dsp" + +/* Open the audio device for playback, and don't block if busy */ +#define OPEN_FLAGS (O_WRONLY|O_NONBLOCK) + +/* Audio driver functions */ +static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void DSP_WaitAudio(_THIS); +static void DSP_PlayAudio(_THIS); +static Uint8 *DSP_GetAudioBuf(_THIS); +static void DSP_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + int fd; + int available; + + available = 0; + fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); + if ( fd >= 0 ) { + available = 1; + close(fd); + } + return(available); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + audio_fd = -1; + + /* Set the function pointers */ + this->OpenAudio = DSP_OpenAudio; + this->WaitAudio = DSP_WaitAudio; + this->PlayAudio = DSP_PlayAudio; + this->GetAudioBuf = DSP_GetAudioBuf; + this->CloseAudio = DSP_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap DSP_bootstrap = { + DSP_DRIVER_NAME, "OSS /dev/dsp standard audio", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void DSP_WaitAudio(_THIS) +{ + /* Not needed at all since OSS handles waiting automagically */ +} + +static void DSP_PlayAudio(_THIS) +{ + if (write(audio_fd, mixbuf, mixlen)==-1) + { + perror("Audio write"); + this->enabled = 0; + } + +#ifdef DEBUG_AUDIO + fprintf(stderr, "Wrote %d bytes of audio data\n", mixlen); +#endif +} + +static Uint8 *DSP_GetAudioBuf(_THIS) +{ + return(mixbuf); +} + +static void DSP_CloseAudio(_THIS) +{ + if ( mixbuf != NULL ) { + SDL_FreeAudioMem(mixbuf); + mixbuf = NULL; + } + if ( audio_fd >= 0 ) { + close(audio_fd); + audio_fd = -1; + } +} + +static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + char audiodev[1024]; + int format; + int value; + int frag_spec; + Uint16 test_format; + + /* Make sure fragment size stays a power of 2, or OSS fails. */ + /* I don't know which of these are actually legal values, though... */ + if (spec->channels > 8) + spec->channels = 8; + else if (spec->channels > 4) + spec->channels = 4; + else if (spec->channels > 2) + spec->channels = 2; + + /* Open the audio device */ + audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0); + if ( audio_fd < 0 ) { + SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); + return(-1); + } + mixbuf = NULL; + + /* Make the file descriptor use blocking writes with fcntl() */ + { long flags; + flags = fcntl(audio_fd, F_GETFL); + flags &= ~O_NONBLOCK; + if ( fcntl(audio_fd, F_SETFL, flags) < 0 ) { + SDL_SetError("Couldn't set audio blocking mode"); + DSP_CloseAudio(this); + return(-1); + } + } + + /* Get a list of supported hardware formats */ + if ( ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0 ) { + perror("SNDCTL_DSP_GETFMTS"); + SDL_SetError("Couldn't get audio format list"); + DSP_CloseAudio(this); + return(-1); + } + + /* Try for a closest match on audio format */ + format = 0; + for ( test_format = SDL_FirstAudioFormat(spec->format); + ! format && test_format; ) { +#ifdef DEBUG_AUDIO + fprintf(stderr, "Trying format 0x%4.4x\n", test_format); +#endif + switch ( test_format ) { + case AUDIO_U8: + if ( value & AFMT_U8 ) { + format = AFMT_U8; + } + break; + case AUDIO_S16LSB: + if ( value & AFMT_S16_LE ) { + format = AFMT_S16_LE; + } + break; + case AUDIO_S16MSB: + if ( value & AFMT_S16_BE ) { + format = AFMT_S16_BE; + } + break; +#if 0 +/* + * These formats are not used by any real life systems so they are not + * needed here. + */ + case AUDIO_S8: + if ( value & AFMT_S8 ) { + format = AFMT_S8; + } + break; + case AUDIO_U16LSB: + if ( value & AFMT_U16_LE ) { + format = AFMT_U16_LE; + } + break; + case AUDIO_U16MSB: + if ( value & AFMT_U16_BE ) { + format = AFMT_U16_BE; + } + break; +#endif + default: + format = 0; + break; + } + if ( ! format ) { + test_format = SDL_NextAudioFormat(); + } + } + if ( format == 0 ) { + SDL_SetError("Couldn't find any hardware audio formats"); + DSP_CloseAudio(this); + return(-1); + } + spec->format = test_format; + + /* Set the audio format */ + value = format; + if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || + (value != format) ) { + perror("SNDCTL_DSP_SETFMT"); + SDL_SetError("Couldn't set audio format"); + DSP_CloseAudio(this); + return(-1); + } + + /* Set the number of channels of output */ + value = spec->channels; + if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0 ) { + perror("SNDCTL_DSP_CHANNELS"); + SDL_SetError("Cannot set the number of channels"); + DSP_CloseAudio(this); + return(-1); + } + spec->channels = value; + + /* Set the DSP frequency */ + value = spec->freq; + if ( ioctl(audio_fd, SNDCTL_DSP_SPEED, &value) < 0 ) { + perror("SNDCTL_DSP_SPEED"); + SDL_SetError("Couldn't set audio frequency"); + DSP_CloseAudio(this); + return(-1); + } + spec->freq = value; + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + /* Determine the power of two of the fragment size */ + for ( frag_spec = 0; (0x01U<size; ++frag_spec ); + if ( (0x01U<size ) { + SDL_SetError("Fragment size must be a power of two"); + DSP_CloseAudio(this); + return(-1); + } + frag_spec |= 0x00020000; /* two fragments, for low latency */ + + /* Set the audio buffering parameters */ +#ifdef DEBUG_AUDIO + fprintf(stderr, "Requesting %d fragments of size %d\n", + (frag_spec >> 16), 1<<(frag_spec&0xFFFF)); +#endif + if ( ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0 ) { + perror("SNDCTL_DSP_SETFRAGMENT"); + } +#ifdef DEBUG_AUDIO + { audio_buf_info info; + ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info); + fprintf(stderr, "fragments = %d\n", info.fragments); + fprintf(stderr, "fragstotal = %d\n", info.fragstotal); + fprintf(stderr, "fragsize = %d\n", info.fragsize); + fprintf(stderr, "bytes = %d\n", info.bytes); + } +#endif + + /* Allocate mixing buffer */ + mixlen = spec->size; + mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen); + if ( mixbuf == NULL ) { + DSP_CloseAudio(this); + return(-1); + } + SDL_memset(mixbuf, spec->silence, spec->size); + + /* Get the parent process id (we're the parent of the audio thread) */ + parent = getpid(); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff --git a/SDL/src/audio/dsp/SDL_dspaudio.h b/SDL/src/audio/dsp/SDL_dspaudio.h new file mode 100644 index 0000000..01cc7d7 --- /dev/null +++ b/SDL/src/audio/dsp/SDL_dspaudio.h @@ -0,0 +1,53 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_dspaudio_h +#define _SDL_dspaudio_h + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The file descriptor for the audio device */ + int audio_fd; + + /* The parent process id, to detect when application quits */ + pid_t parent; + + /* Raw mixing buffer */ + Uint8 *mixbuf; + int mixlen; +}; +#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ + +/* Old variable names */ +#define audio_fd (this->hidden->audio_fd) +#define parent (this->hidden->parent) +#define mixbuf (this->hidden->mixbuf) +#define mixlen (this->hidden->mixlen) +#define frame_ticks (this->hidden->frame_ticks) +#define next_frame (this->hidden->next_frame) + +#endif /* _SDL_dspaudio_h */ diff --git a/SDL/src/audio/dummy/SDL_dummyaudio.c b/SDL/src/audio/dummy/SDL_dummyaudio.c new file mode 100644 index 0000000..dbae19d --- /dev/null +++ b/SDL/src/audio/dummy/SDL_dummyaudio.c @@ -0,0 +1,156 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org + + This file written by Ryan C. Gordon (icculus@icculus.org) +*/ +#include "SDL_config.h" + +/* Output audio to nowhere... */ + +#include "SDL_rwops.h" +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audiomem.h" +#include "../SDL_audio_c.h" +#include "../SDL_audiodev_c.h" +#include "SDL_dummyaudio.h" + +/* The tag name used by DUMMY audio */ +#define DUMMYAUD_DRIVER_NAME "dummy" + +/* Audio driver functions */ +static int DUMMYAUD_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void DUMMYAUD_WaitAudio(_THIS); +static void DUMMYAUD_PlayAudio(_THIS); +static Uint8 *DUMMYAUD_GetAudioBuf(_THIS); +static void DUMMYAUD_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ +static int DUMMYAUD_Available(void) +{ + const char *envr = SDL_getenv("SDL_AUDIODRIVER"); + if (envr && (SDL_strcmp(envr, DUMMYAUD_DRIVER_NAME) == 0)) { + return(1); + } + return(0); +} + +static void DUMMYAUD_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *DUMMYAUD_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = DUMMYAUD_OpenAudio; + this->WaitAudio = DUMMYAUD_WaitAudio; + this->PlayAudio = DUMMYAUD_PlayAudio; + this->GetAudioBuf = DUMMYAUD_GetAudioBuf; + this->CloseAudio = DUMMYAUD_CloseAudio; + + this->free = DUMMYAUD_DeleteDevice; + + return this; +} + +AudioBootStrap DUMMYAUD_bootstrap = { + DUMMYAUD_DRIVER_NAME, "SDL dummy audio driver", + DUMMYAUD_Available, DUMMYAUD_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void DUMMYAUD_WaitAudio(_THIS) +{ + /* Don't block on first calls to simulate initial fragment filling. */ + if (this->hidden->initial_calls) + this->hidden->initial_calls--; + else + SDL_Delay(this->hidden->write_delay); +} + +static void DUMMYAUD_PlayAudio(_THIS) +{ + /* no-op...this is a null driver. */ +} + +static Uint8 *DUMMYAUD_GetAudioBuf(_THIS) +{ + return(this->hidden->mixbuf); +} + +static void DUMMYAUD_CloseAudio(_THIS) +{ + if ( this->hidden->mixbuf != NULL ) { + SDL_FreeAudioMem(this->hidden->mixbuf); + this->hidden->mixbuf = NULL; + } +} + +static int DUMMYAUD_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + float bytes_per_sec = 0.0f; + + /* Allocate mixing buffer */ + this->hidden->mixlen = spec->size; + this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); + if ( this->hidden->mixbuf == NULL ) { + return(-1); + } + SDL_memset(this->hidden->mixbuf, spec->silence, spec->size); + + bytes_per_sec = (float) (((spec->format & 0xFF) / 8) * + spec->channels * spec->freq); + + /* + * We try to make this request more audio at the correct rate for + * a given audio spec, so timing stays fairly faithful. + * Also, we have it not block at all for the first two calls, so + * it seems like we're filling two audio fragments right out of the + * gate, like other SDL drivers tend to do. + */ + this->hidden->initial_calls = 2; + this->hidden->write_delay = + (Uint32) ((((float) spec->size) / bytes_per_sec) * 1000.0f); + + /* We're ready to rock and roll. :-) */ + return(0); +} + diff --git a/SDL/src/audio/dummy/SDL_dummyaudio.h b/SDL/src/audio/dummy/SDL_dummyaudio.h new file mode 100644 index 0000000..fe2ded5 --- /dev/null +++ b/SDL/src/audio/dummy/SDL_dummyaudio.h @@ -0,0 +1,40 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_dummyaudio_h +#define _SDL_dummyaudio_h + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The file descriptor for the audio device */ + Uint8 *mixbuf; + Uint32 mixlen; + Uint32 write_delay; + Uint32 initial_calls; +}; + +#endif /* _SDL_dummyaudio_h */ diff --git a/SDL/src/audio/esd/SDL_esdaudio.c b/SDL/src/audio/esd/SDL_esdaudio.c new file mode 100644 index 0000000..0c9a9f2 --- /dev/null +++ b/SDL/src/audio/esd/SDL_esdaudio.c @@ -0,0 +1,323 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Allow access to an ESD network stream mixing buffer */ + +#include +#include +#include +#include +#include + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audiomem.h" +#include "../SDL_audio_c.h" +#include "../SDL_audiodev_c.h" +#include "SDL_esdaudio.h" + +#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC +#include "SDL_name.h" +#include "SDL_loadso.h" +#else +#define SDL_NAME(X) X +#endif + +/* The tag name used by ESD audio */ +#define ESD_DRIVER_NAME "esd" + +/* Audio driver functions */ +static int ESD_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void ESD_WaitAudio(_THIS); +static void ESD_PlayAudio(_THIS); +static Uint8 *ESD_GetAudioBuf(_THIS); +static void ESD_CloseAudio(_THIS); + +#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC + +static const char *esd_library = SDL_AUDIO_DRIVER_ESD_DYNAMIC; +static void *esd_handle = NULL; +static int esd_loaded = 0; + +static int (*SDL_NAME(esd_open_sound))( const char *host ); +static int (*SDL_NAME(esd_close))( int esd ); +static int (*SDL_NAME(esd_play_stream))( esd_format_t format, int rate, + const char *host, const char *name ); +static struct { + const char *name; + void **func; +} esd_functions[] = { + { "esd_open_sound", (void **)&SDL_NAME(esd_open_sound) }, + { "esd_close", (void **)&SDL_NAME(esd_close) }, + { "esd_play_stream", (void **)&SDL_NAME(esd_play_stream) }, +}; + +static void UnloadESDLibrary() +{ + if ( esd_loaded ) { + SDL_UnloadObject(esd_handle); + esd_handle = NULL; + esd_loaded = 0; + } +} + +static int LoadESDLibrary(void) +{ + int i, retval = -1; + + esd_handle = SDL_LoadObject(esd_library); + if ( esd_handle ) { + esd_loaded = 1; + retval = 0; + for ( i=0; i= 0 ) { + available = 1; + SDL_NAME(esd_close)(connection); + } + UnloadESDLibrary(); + return(available); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); + UnloadESDLibrary(); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + LoadESDLibrary(); + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + audio_fd = -1; + + /* Set the function pointers */ + this->OpenAudio = ESD_OpenAudio; + this->WaitAudio = ESD_WaitAudio; + this->PlayAudio = ESD_PlayAudio; + this->GetAudioBuf = ESD_GetAudioBuf; + this->CloseAudio = ESD_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap ESD_bootstrap = { + ESD_DRIVER_NAME, "Enlightened Sound Daemon", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void ESD_WaitAudio(_THIS) +{ + Sint32 ticks; + + /* Check to see if the thread-parent process is still alive */ + { static int cnt = 0; + /* Note that this only works with thread implementations + that use a different process id for each thread. + */ + if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */ + if ( kill(parent, 0) < 0 ) { + this->enabled = 0; + } + } + } + + /* Use timer for general audio synchronization */ + ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS; + if ( ticks > 0 ) { + SDL_Delay(ticks); + } +} + +static void ESD_PlayAudio(_THIS) +{ + int written; + + /* Write the audio data, checking for EAGAIN on broken audio drivers */ + do { + written = write(audio_fd, mixbuf, mixlen); + if ( (written < 0) && ((errno == 0) || (errno == EAGAIN)) ) { + SDL_Delay(1); /* Let a little CPU time go by */ + } + } while ( (written < 0) && + ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)) ); + + /* Set the next write frame */ + next_frame += frame_ticks; + + /* If we couldn't write, assume fatal error for now */ + if ( written < 0 ) { + this->enabled = 0; + } +} + +static Uint8 *ESD_GetAudioBuf(_THIS) +{ + return(mixbuf); +} + +static void ESD_CloseAudio(_THIS) +{ + if ( mixbuf != NULL ) { + SDL_FreeAudioMem(mixbuf); + mixbuf = NULL; + } + if ( audio_fd >= 0 ) { + SDL_NAME(esd_close)(audio_fd); + audio_fd = -1; + } +} + +/* Try to get the name of the program */ +static char *get_progname(void) +{ + char *progname = NULL; +#ifdef __LINUX__ + FILE *fp; + static char temp[BUFSIZ]; + + SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid()); + fp = fopen(temp, "r"); + if ( fp != NULL ) { + if ( fgets(temp, sizeof(temp)-1, fp) ) { + progname = SDL_strrchr(temp, '/'); + if ( progname == NULL ) { + progname = temp; + } else { + progname = progname+1; + } + } + fclose(fp); + } +#endif + return(progname); +} + +static int ESD_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + esd_format_t format; + + /* Convert audio spec to the ESD audio format */ + format = (ESD_STREAM | ESD_PLAY); + switch ( spec->format & 0xFF ) { + case 8: + format |= ESD_BITS8; + break; + case 16: + format |= ESD_BITS16; + break; + default: + SDL_SetError("Unsupported ESD audio format"); + return(-1); + } + if ( spec->channels == 1 ) { + format |= ESD_MONO; + } else { + format |= ESD_STEREO; + } +#if 0 + spec->samples = ESD_BUF_SIZE; /* Darn, no way to change this yet */ +#endif + + /* Open a connection to the ESD audio server */ + audio_fd = SDL_NAME(esd_play_stream)(format, spec->freq, NULL, get_progname()); + if ( audio_fd < 0 ) { + SDL_SetError("Couldn't open ESD connection"); + return(-1); + } + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + frame_ticks = (float)(spec->samples*1000)/spec->freq; + next_frame = SDL_GetTicks()+frame_ticks; + + /* Allocate mixing buffer */ + mixlen = spec->size; + mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen); + if ( mixbuf == NULL ) { + return(-1); + } + SDL_memset(mixbuf, spec->silence, spec->size); + + /* Get the parent process id (we're the parent of the audio thread) */ + parent = getpid(); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff --git a/SDL/src/audio/esd/SDL_esdaudio.h b/SDL/src/audio/esd/SDL_esdaudio.h new file mode 100644 index 0000000..1ac8bcf --- /dev/null +++ b/SDL/src/audio/esd/SDL_esdaudio.h @@ -0,0 +1,57 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_esdaudio_h +#define _SDL_esdaudio_h + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The file descriptor for the audio device */ + int audio_fd; + + /* The parent process id, to detect when application quits */ + pid_t parent; + + /* Raw mixing buffer */ + Uint8 *mixbuf; + int mixlen; + + /* Support for audio timing using a timer */ + float frame_ticks; + float next_frame; +}; +#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ + +/* Old variable names */ +#define audio_fd (this->hidden->audio_fd) +#define parent (this->hidden->parent) +#define mixbuf (this->hidden->mixbuf) +#define mixlen (this->hidden->mixlen) +#define frame_ticks (this->hidden->frame_ticks) +#define next_frame (this->hidden->next_frame) + +#endif /* _SDL_esdaudio_h */ diff --git a/SDL/src/audio/macosx/SDL_coreaudio.c b/SDL/src/audio/macosx/SDL_coreaudio.c new file mode 100644 index 0000000..3fec604 --- /dev/null +++ b/SDL/src/audio/macosx/SDL_coreaudio.c @@ -0,0 +1,280 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#include +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER +#include +#endif + +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_coreaudio.h" + + +/* Audio driver functions */ + +static int Core_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void Core_WaitAudio(_THIS); +static void Core_PlayAudio(_THIS); +static Uint8 *Core_GetAudioBuf(_THIS); +static void Core_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + return(1); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = Core_OpenAudio; + this->WaitAudio = Core_WaitAudio; + this->PlayAudio = Core_PlayAudio; + this->GetAudioBuf = Core_GetAudioBuf; + this->CloseAudio = Core_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap COREAUDIO_bootstrap = { + "coreaudio", "Mac OS X CoreAudio", + Audio_Available, Audio_CreateDevice +}; + +/* The CoreAudio callback */ +static OSStatus audioCallback (void *inRefCon, + AudioUnitRenderActionFlags inActionFlags, + const AudioTimeStamp *inTimeStamp, + UInt32 inBusNumber, + AudioBuffer *ioData) +{ + SDL_AudioDevice *this = (SDL_AudioDevice *)inRefCon; + UInt32 remaining, len; + void *ptr; + + /* Only do anything if audio is enabled and not paused */ + if ( ! this->enabled || this->paused ) { + SDL_memset(ioData->mData, this->spec.silence, ioData->mDataByteSize); + return 0; + } + + /* No SDL conversion should be needed here, ever, since we accept + any input format in OpenAudio, and leave the conversion to CoreAudio. + */ + /* + assert(!this->convert.needed); + assert(this->spec.channels == ioData->mNumberChannels); + */ + + remaining = ioData->mDataByteSize; + ptr = ioData->mData; + while (remaining > 0) { + if (bufferOffset >= bufferSize) { + /* Generate the data */ + SDL_memset(buffer, this->spec.silence, bufferSize); + SDL_mutexP(this->mixer_lock); + (*this->spec.callback)(this->spec.userdata, + buffer, bufferSize); + SDL_mutexV(this->mixer_lock); + bufferOffset = 0; + } + + len = bufferSize - bufferOffset; + if (len > remaining) + len = remaining; + SDL_memcpy(ptr, (char *)buffer + bufferOffset, len); + ptr = (char *)ptr + len; + remaining -= len; + bufferOffset += len; + } + + return 0; +} + +/* Dummy functions -- we don't use thread-based audio */ +void Core_WaitAudio(_THIS) +{ + return; +} + +void Core_PlayAudio(_THIS) +{ + return; +} + +Uint8 *Core_GetAudioBuf(_THIS) +{ + return(NULL); +} + +void Core_CloseAudio(_THIS) +{ + OSStatus result; + struct AudioUnitInputCallback callback; + + /* stop processing the audio unit */ + result = AudioOutputUnitStop (outputAudioUnit); + if (result != noErr) { + SDL_SetError("Core_CloseAudio: AudioOutputUnitStop"); + return; + } + + /* Remove the input callback */ + callback.inputProc = 0; + callback.inputProcRefCon = 0; + result = AudioUnitSetProperty (outputAudioUnit, + kAudioUnitProperty_SetInputCallback, + kAudioUnitScope_Input, + 0, + &callback, + sizeof(callback)); + if (result != noErr) { + SDL_SetError("Core_CloseAudio: AudioUnitSetProperty (kAudioUnitProperty_SetInputCallback)"); + return; + } + + result = CloseComponent(outputAudioUnit); + if (result != noErr) { + SDL_SetError("Core_CloseAudio: CloseComponent"); + return; + } + + SDL_free(buffer); +} + +#define CHECK_RESULT(msg) \ + if (result != noErr) { \ + SDL_SetError("Failed to start CoreAudio: " msg); \ + return -1; \ + } + + +int Core_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + OSStatus result = noErr; + Component comp; + ComponentDescription desc; + struct AudioUnitInputCallback callback; + AudioStreamBasicDescription requestedDesc; + + /* Setup a AudioStreamBasicDescription with the requested format */ + requestedDesc.mFormatID = kAudioFormatLinearPCM; + requestedDesc.mFormatFlags = kLinearPCMFormatFlagIsPacked; + requestedDesc.mChannelsPerFrame = spec->channels; + requestedDesc.mSampleRate = spec->freq; + + requestedDesc.mBitsPerChannel = spec->format & 0xFF; + if (spec->format & 0x8000) + requestedDesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; + if (spec->format & 0x1000) + requestedDesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; + + requestedDesc.mFramesPerPacket = 1; + requestedDesc.mBytesPerFrame = requestedDesc.mBitsPerChannel * requestedDesc.mChannelsPerFrame / 8; + requestedDesc.mBytesPerPacket = requestedDesc.mBytesPerFrame * requestedDesc.mFramesPerPacket; + + + /* Locate the default output audio unit */ + desc.componentType = kAudioUnitComponentType; + desc.componentSubType = kAudioUnitSubType_Output; + desc.componentManufacturer = kAudioUnitID_DefaultOutput; + desc.componentFlags = 0; + desc.componentFlagsMask = 0; + + comp = FindNextComponent (NULL, &desc); + if (comp == NULL) { + SDL_SetError ("Failed to start CoreAudio: FindNextComponent returned NULL"); + return -1; + } + + /* Open & initialize the default output audio unit */ + result = OpenAComponent (comp, &outputAudioUnit); + CHECK_RESULT("OpenAComponent") + + result = AudioUnitInitialize (outputAudioUnit); + CHECK_RESULT("AudioUnitInitialize") + + /* Set the input format of the audio unit. */ + result = AudioUnitSetProperty (outputAudioUnit, + kAudioUnitProperty_StreamFormat, + kAudioUnitScope_Input, + 0, + &requestedDesc, + sizeof (requestedDesc)); + CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)") + + /* Set the audio callback */ + callback.inputProc = audioCallback; + callback.inputProcRefCon = this; + result = AudioUnitSetProperty (outputAudioUnit, + kAudioUnitProperty_SetInputCallback, + kAudioUnitScope_Input, + 0, + &callback, + sizeof(callback)); + CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_SetInputCallback)") + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + /* Allocate a sample buffer */ + bufferOffset = bufferSize = this->spec.size; + buffer = SDL_malloc(bufferSize); + + /* Finally, start processing of the audio unit */ + result = AudioOutputUnitStart (outputAudioUnit); + CHECK_RESULT("AudioOutputUnitStart") + + + /* We're running! */ + return(1); +} diff --git a/SDL/src/audio/macosx/SDL_coreaudio.h b/SDL/src/audio/macosx/SDL_coreaudio.h new file mode 100644 index 0000000..162c68d --- /dev/null +++ b/SDL/src/audio/macosx/SDL_coreaudio.h @@ -0,0 +1,45 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_coreaudio_h +#define _SDL_coreaudio_h + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + AudioUnit outputAudioUnit; + void *buffer; + UInt32 bufferOffset; + UInt32 bufferSize; +}; + +/* Old variable names */ +#define outputAudioUnit (this->hidden->outputAudioUnit) +#define buffer (this->hidden->buffer) +#define bufferOffset (this->hidden->bufferOffset) +#define bufferSize (this->hidden->bufferSize) + +#endif /* _SDL_coreaudio_h */ diff --git a/SDL/src/audio/macrom/SDL_romaudio.c b/SDL/src/audio/macrom/SDL_romaudio.c new file mode 100644 index 0000000..145477e --- /dev/null +++ b/SDL/src/audio/macrom/SDL_romaudio.c @@ -0,0 +1,496 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#if defined(__APPLE__) && defined(__MACH__) +# include +#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335) +# include +#else +# include /* SoundManager interface */ +# include +# include +#endif + +#if !defined(NewSndCallBackUPP) && (UNIVERSAL_INTERFACES_VERSION < 0x0335) +#if !defined(NewSndCallBackProc) /* avoid circular redefinition... */ +#define NewSndCallBackUPP NewSndCallBackProc +#endif +#if !defined(NewSndCallBackUPP) +#define NewSndCallBackUPP NewSndCallBackProc +#endif +#endif + +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_romaudio.h" + +/* Audio driver functions */ + +static void Mac_CloseAudio(_THIS); +static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void Mac_LockAudio(_THIS); +static void Mac_UnlockAudio(_THIS); + +/* Audio driver bootstrap functions */ + + +static int Audio_Available(void) +{ + return(1); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = Mac_OpenAudio; + this->CloseAudio = Mac_CloseAudio; + this->LockAudio = Mac_LockAudio; + this->UnlockAudio = Mac_UnlockAudio; + this->free = Audio_DeleteDevice; + +#ifdef __MACOSX__ /* Mac OS X uses threaded audio, so normal thread code is okay */ + this->LockAudio = NULL; + this->UnlockAudio = NULL; +#endif + return this; +} + +AudioBootStrap SNDMGR_bootstrap = { + "sndmgr", "MacOS SoundManager 3.0", + Audio_Available, Audio_CreateDevice +}; + +#if defined(TARGET_API_MAC_CARBON) || defined(USE_RYANS_SOUNDCODE) +/* This works correctly on Mac OS X */ + +#pragma options align=power + +static volatile SInt32 audio_is_locked = 0; +static volatile SInt32 need_to_mix = 0; + +static UInt8 *buffer[2]; +static volatile UInt32 running = 0; +static CmpSoundHeader header; +static volatile Uint32 fill_me = 0; + +static void mix_buffer(SDL_AudioDevice *audio, UInt8 *buffer) +{ + if ( ! audio->paused ) { +#ifdef __MACOSX__ + SDL_mutexP(audio->mixer_lock); +#endif + if ( audio->convert.needed ) { + audio->spec.callback(audio->spec.userdata, + (Uint8 *)audio->convert.buf,audio->convert.len); + SDL_ConvertAudio(&audio->convert); + if ( audio->convert.len_cvt != audio->spec.size ) { + /* Uh oh... probably crashes here */; + } + SDL_memcpy(buffer, audio->convert.buf, audio->convert.len_cvt); + } else { + audio->spec.callback(audio->spec.userdata, buffer, audio->spec.size); + } +#ifdef __MACOSX__ + SDL_mutexV(audio->mixer_lock); +#endif + } + + DecrementAtomic((SInt32 *) &need_to_mix); +} + +static void Mac_LockAudio(_THIS) +{ + IncrementAtomic((SInt32 *) &audio_is_locked); +} + +static void Mac_UnlockAudio(_THIS) +{ + SInt32 oldval; + + oldval = DecrementAtomic((SInt32 *) &audio_is_locked); + if ( oldval != 1 ) /* != 1 means audio is still locked. */ + return; + + /* Did we miss the chance to mix in an interrupt? Do it now. */ + if ( BitAndAtomic (0xFFFFFFFF, (UInt32 *) &need_to_mix) ) { + /* + * Note that this could be a problem if you missed an interrupt + * while the audio was locked, and get preempted by a second + * interrupt here, but that means you locked for way too long anyhow. + */ + mix_buffer (this, buffer[fill_me]); + } +} + +static void callBackProc (SndChannel *chan, SndCommand *cmd_passed ) { + UInt32 play_me; + SndCommand cmd; + SDL_AudioDevice *audio = (SDL_AudioDevice *)chan->userInfo; + + IncrementAtomic((SInt32 *) &need_to_mix); + + fill_me = cmd_passed->param2; /* buffer that has just finished playing, so fill it */ + play_me = ! fill_me; /* filled buffer to play _now_ */ + + if ( ! audio->enabled ) { + return; + } + + /* queue previously mixed buffer for playback. */ + header.samplePtr = (Ptr)buffer[play_me]; + cmd.cmd = bufferCmd; + cmd.param1 = 0; + cmd.param2 = (long)&header; + SndDoCommand (chan, &cmd, 0); + + memset (buffer[fill_me], 0, audio->spec.size); + + /* + * if audio device isn't locked, mix the next buffer to be queued in + * the memory block that just finished playing. + */ + if ( ! BitAndAtomic(0xFFFFFFFF, (UInt32 *) &audio_is_locked) ) { + mix_buffer (audio, buffer[fill_me]); + } + + /* set this callback to run again when current buffer drains. */ + if ( running ) { + cmd.cmd = callBackCmd; + cmd.param1 = 0; + cmd.param2 = play_me; + + SndDoCommand (chan, &cmd, 0); + } +} + +static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec) { + + SndCallBackUPP callback; + int sample_bits; + int i; + long initOptions; + + /* Very few conversions are required, but... */ + switch (spec->format) { + case AUDIO_S8: + spec->format = AUDIO_U8; + break; + case AUDIO_U16LSB: + spec->format = AUDIO_S16LSB; + break; + case AUDIO_U16MSB: + spec->format = AUDIO_S16MSB; + break; + } + SDL_CalculateAudioSpec(spec); + + /* initialize bufferCmd header */ + memset (&header, 0, sizeof(header)); + callback = (SndCallBackUPP) NewSndCallBackUPP (callBackProc); + sample_bits = spec->size / spec->samples / spec->channels * 8; + +#ifdef DEBUG_AUDIO + fprintf(stderr, + "Audio format 0x%x, channels = %d, sample_bits = %d, frequency = %d\n", + spec->format, spec->channels, sample_bits, spec->freq); +#endif /* DEBUG_AUDIO */ + + header.numChannels = spec->channels; + header.sampleSize = sample_bits; + header.sampleRate = spec->freq << 16; + header.numFrames = spec->samples; + header.encode = cmpSH; + + /* Note that we install the 16bitLittleEndian Converter if needed. */ + if ( spec->format == 0x8010 ) { + header.compressionID = fixedCompression; + header.format = k16BitLittleEndianFormat; + } + + /* allocate 2 buffers */ + for (i=0; i<2; i++) { + buffer[i] = (UInt8*)malloc (sizeof(UInt8) * spec->size); + if (buffer[i] == NULL) { + SDL_OutOfMemory(); + return (-1); + } + memset (buffer[i], 0, spec->size); + } + + /* Create the sound manager channel */ + channel = (SndChannelPtr)SDL_malloc(sizeof(*channel)); + if ( channel == NULL ) { + SDL_OutOfMemory(); + return(-1); + } + if ( spec->channels >= 2 ) { + initOptions = initStereo; + } else { + initOptions = initMono; + } + channel->userInfo = (long)this; + channel->qLength = 128; + if ( SndNewChannel(&channel, sampledSynth, initOptions, callback) != noErr ) { + SDL_SetError("Unable to create audio channel"); + SDL_free(channel); + channel = NULL; + return(-1); + } + + /* start playback */ + { + SndCommand cmd; + cmd.cmd = callBackCmd; + cmd.param2 = 0; + running = 1; + SndDoCommand (channel, &cmd, 0); + } + + return 1; +} + +static void Mac_CloseAudio(_THIS) { + + int i; + + running = 0; + + if (channel) { + SndDisposeChannel (channel, true); + channel = NULL; + } + + for ( i=0; i<2; ++i ) { + if ( buffer[i] ) { + SDL_free(buffer[i]); + buffer[i] = NULL; + } + } +} + +#else /* !TARGET_API_MAC_CARBON && !USE_RYANS_SOUNDCODE */ + +static void Mac_LockAudio(_THIS) +{ + /* no-op. */ +} + +static void Mac_UnlockAudio(_THIS) +{ + /* no-op. */ +} + + +/* This function is called by Sound Manager when it has exhausted one of + the buffers, so we'll zero it to silence and fill it with audio if + we're not paused. +*/ +static pascal +void sndDoubleBackProc (SndChannelPtr chan, SndDoubleBufferPtr newbuf) +{ + SDL_AudioDevice *audio = (SDL_AudioDevice *)newbuf->dbUserInfo[0]; + + /* If audio is quitting, don't do anything */ + if ( ! audio->enabled ) { + return; + } + memset (newbuf->dbSoundData, 0, audio->spec.size); + newbuf->dbNumFrames = audio->spec.samples; + if ( ! audio->paused ) { + if ( audio->convert.needed ) { + audio->spec.callback(audio->spec.userdata, + (Uint8 *)audio->convert.buf,audio->convert.len); + SDL_ConvertAudio(&audio->convert); +#if 0 + if ( audio->convert.len_cvt != audio->spec.size ) { + /* Uh oh... probably crashes here */; + } +#endif + SDL_memcpy(newbuf->dbSoundData, audio->convert.buf, + audio->convert.len_cvt); + } else { + audio->spec.callback(audio->spec.userdata, + (Uint8 *)newbuf->dbSoundData, audio->spec.size); + } + } + newbuf->dbFlags |= dbBufferReady; +} + +static int DoubleBufferAudio_Available(void) +{ + int available; + NumVersion sndversion; + long response; + + available = 0; + sndversion = SndSoundManagerVersion(); + if ( sndversion.majorRev >= 3 ) { + if ( Gestalt(gestaltSoundAttr, &response) == noErr ) { + if ( (response & (1 << gestaltSndPlayDoubleBuffer)) ) { + available = 1; + } + } + } else { + if ( Gestalt(gestaltSoundAttr, &response) == noErr ) { + if ( (response & (1 << gestaltHasASC)) ) { + available = 1; + } + } + } + return(available); +} + +static void Mac_CloseAudio(_THIS) +{ + int i; + + if ( channel != NULL ) { + /* Clean up the audio channel */ + SndDisposeChannel(channel, true); + channel = NULL; + } + for ( i=0; i<2; ++i ) { + if ( audio_buf[i] ) { + SDL_free(audio_buf[i]); + audio_buf[i] = NULL; + } + } +} + +static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + SndDoubleBufferHeader2 audio_dbh; + int i; + long initOptions; + int sample_bits; + SndDoubleBackUPP doubleBackProc; + + /* Check to make sure double-buffered audio is available */ + if ( ! DoubleBufferAudio_Available() ) { + SDL_SetError("Sound manager doesn't support double-buffering"); + return(-1); + } + + /* Very few conversions are required, but... */ + switch (spec->format) { + case AUDIO_S8: + spec->format = AUDIO_U8; + break; + case AUDIO_U16LSB: + spec->format = AUDIO_S16LSB; + break; + case AUDIO_U16MSB: + spec->format = AUDIO_S16MSB; + break; + } + SDL_CalculateAudioSpec(spec); + + /* initialize the double-back header */ + SDL_memset(&audio_dbh, 0, sizeof(audio_dbh)); + doubleBackProc = NewSndDoubleBackProc (sndDoubleBackProc); + sample_bits = spec->size / spec->samples / spec->channels * 8; + + audio_dbh.dbhNumChannels = spec->channels; + audio_dbh.dbhSampleSize = sample_bits; + audio_dbh.dbhCompressionID = 0; + audio_dbh.dbhPacketSize = 0; + audio_dbh.dbhSampleRate = spec->freq << 16; + audio_dbh.dbhDoubleBack = doubleBackProc; + audio_dbh.dbhFormat = 0; + + /* Note that we install the 16bitLittleEndian Converter if needed. */ + if ( spec->format == 0x8010 ) { + audio_dbh.dbhCompressionID = fixedCompression; + audio_dbh.dbhFormat = k16BitLittleEndianFormat; + } + + /* allocate the 2 double-back buffers */ + for ( i=0; i<2; ++i ) { + audio_buf[i] = SDL_calloc(1, sizeof(SndDoubleBuffer)+spec->size); + if ( audio_buf[i] == NULL ) { + SDL_OutOfMemory(); + return(-1); + } + audio_buf[i]->dbNumFrames = spec->samples; + audio_buf[i]->dbFlags = dbBufferReady; + audio_buf[i]->dbUserInfo[0] = (long)this; + audio_dbh.dbhBufferPtr[i] = audio_buf[i]; + } + + /* Create the sound manager channel */ + channel = (SndChannelPtr)SDL_malloc(sizeof(*channel)); + if ( channel == NULL ) { + SDL_OutOfMemory(); + return(-1); + } + if ( spec->channels >= 2 ) { + initOptions = initStereo; + } else { + initOptions = initMono; + } + channel->userInfo = 0; + channel->qLength = 128; + if ( SndNewChannel(&channel, sampledSynth, initOptions, 0L) != noErr ) { + SDL_SetError("Unable to create audio channel"); + SDL_free(channel); + channel = NULL; + return(-1); + } + + /* Start playback */ + if ( SndPlayDoubleBuffer(channel, (SndDoubleBufferHeaderPtr)&audio_dbh) + != noErr ) { + SDL_SetError("Unable to play double buffered audio"); + return(-1); + } + + return 1; +} + +#endif /* TARGET_API_MAC_CARBON || USE_RYANS_SOUNDCODE */ + diff --git a/SDL/src/audio/macrom/SDL_romaudio.h b/SDL/src/audio/macrom/SDL_romaudio.h new file mode 100644 index 0000000..34857b9 --- /dev/null +++ b/SDL/src/audio/macrom/SDL_romaudio.h @@ -0,0 +1,50 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_romaudio_h +#define _SDL_romaudio_h + +#include "../SDL_sysaudio.h" + +/* This is Ryan's improved MacOS sound code, with locking support */ +#define USE_RYANS_SOUNDCODE + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* Sound manager audio channel */ + SndChannelPtr channel; +#if defined(TARGET_API_MAC_CARBON) || defined(USE_RYANS_SOUNDCODE) + /* FIXME: Add Ryan's static data here */ +#else + /* Double buffering variables */ + SndDoubleBufferPtr audio_buf[2]; +#endif +}; + +/* Old variable names */ +#define channel (this->hidden->channel) +#define audio_buf (this->hidden->audio_buf) + +#endif /* _SDL_romaudio_h */ diff --git a/SDL/src/audio/mint/SDL_mintaudio.c b/SDL/src/audio/mint/SDL_mintaudio.c new file mode 100644 index 0000000..d4d77e7 --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio.c @@ -0,0 +1,215 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + Audio interrupt variables and callback function + + Patrice Mandin +*/ + +#include + +#include +#include +#include +#include + +#include "SDL_audio.h" +#include "SDL_mintaudio.h" +#include "SDL_mintaudio_stfa.h" + +/* The audio device */ + +SDL_AudioDevice *SDL_MintAudio_device; +Uint8 *SDL_MintAudio_audiobuf[2]; /* Pointers to buffers */ +unsigned long SDL_MintAudio_audiosize; /* Length of audio buffer=spec->size */ +volatile unsigned short SDL_MintAudio_numbuf; /* Buffer to play */ +volatile unsigned short SDL_MintAudio_mutex; +volatile unsigned long SDL_MintAudio_clocktics; +cookie_stfa_t *SDL_MintAudio_stfa; +unsigned short SDL_MintAudio_hasfpu; + +/* MiNT thread variables */ +SDL_bool SDL_MintAudio_mint_present; +SDL_bool SDL_MintAudio_quit_thread; +SDL_bool SDL_MintAudio_thread_finished; +long SDL_MintAudio_thread_pid; + +/* The callback function, called by each driver whenever needed */ + +void SDL_MintAudio_Callback(void) +{ + Uint8 *buffer; + SDL_AudioDevice *audio = SDL_MintAudio_device; + + buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; + SDL_memset(buffer, audio->spec.silence, audio->spec.size); + + if (audio->paused) + return; + + if (audio->convert.needed) { + int silence; + + if ( audio->convert.src_format == AUDIO_U8 ) { + silence = 0x80; + } else { + silence = 0; + } + SDL_memset(audio->convert.buf, silence, audio->convert.len); + audio->spec.callback(audio->spec.userdata, + (Uint8 *)audio->convert.buf,audio->convert.len); + SDL_ConvertAudio(&audio->convert); + SDL_memcpy(buffer, audio->convert.buf, audio->convert.len_cvt); + } else { + audio->spec.callback(audio->spec.userdata, buffer, audio->spec.size); + } +} + +/* Add a new frequency/clock/predivisor to the current list */ +void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock, + Uint32 prediv, int gpio_bits) +{ + int i, p; + + if (MINTAUDIO_freqcount==MINTAUDIO_maxfreqs) { + return; + } + + /* Search where to insert the frequency (highest first) */ + for (p=0; p MINTAUDIO_frequencies[p].frequency) { + break; + } + } + + /* Put all following ones farer */ + if (MINTAUDIO_freqcount>0) { + for (i=MINTAUDIO_freqcount; i>p; i--) { + SDL_memcpy(&MINTAUDIO_frequencies[i], &MINTAUDIO_frequencies[i-1], sizeof(mint_frequency_t)); + } + } + + /* And insert new one */ + MINTAUDIO_frequencies[p].frequency = frequency; + MINTAUDIO_frequencies[p].masterclock = clock; + MINTAUDIO_frequencies[p].predivisor = prediv; + MINTAUDIO_frequencies[p].gpio_bits = gpio_bits; + + MINTAUDIO_freqcount++; +} + +/* Search for the nearest frequency */ +int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq) +{ + int i; + + /* Only 1 freq ? */ + if (MINTAUDIO_freqcount==1) { + return 0; + } + + /* Check the array */ + for (i=0; i= ((MINTAUDIO_frequencies[i].frequency+ + MINTAUDIO_frequencies[i+1].frequency)>>1)) { + return i; + } + } + + /* Not in the array, give the latest */ + return MINTAUDIO_freqcount-1; +} + +/* Check if FPU is present */ +void SDL_MintAudio_CheckFpu(void) +{ + unsigned long cookie_fpu; + + SDL_MintAudio_hasfpu = 0; + if (Getcookie(C__FPU, &cookie_fpu) != C_FOUND) { + return; + } + switch ((cookie_fpu>>16)&0xfffe) { + case 2: + case 4: + case 6: + case 8: + case 16: + SDL_MintAudio_hasfpu = 1; + break; + } +} + +/* The thread function, used under MiNT with xbios */ +int SDL_MintAudio_Thread(long param) +{ + SndBufPtr pointers; + SDL_bool buffers_filled[2] = {SDL_FALSE, SDL_FALSE}; + + SDL_MintAudio_thread_finished = SDL_FALSE; + while (!SDL_MintAudio_quit_thread) { + if (Buffptr(&pointers)!=0) + continue; + + if (( (unsigned long)pointers.play>=(unsigned long)SDL_MintAudio_audiobuf[0]) + && ( (unsigned long)pointers.play<=(unsigned long)SDL_MintAudio_audiobuf[1])) + { + /* DMA is reading buffer #0, setup buffer #1 if not already done */ + if (!buffers_filled[1]) { + SDL_MintAudio_numbuf = 1; + SDL_MintAudio_Callback(); + Setbuffer(0, SDL_MintAudio_audiobuf[1], SDL_MintAudio_audiobuf[1] + SDL_MintAudio_audiosize); + buffers_filled[1]=SDL_TRUE; + buffers_filled[0]=SDL_FALSE; + } + } else { + /* DMA is reading buffer #1, setup buffer #0 if not already done */ + if (!buffers_filled[0]) { + SDL_MintAudio_numbuf = 0; + SDL_MintAudio_Callback(); + Setbuffer(0, SDL_MintAudio_audiobuf[0], SDL_MintAudio_audiobuf[0] + SDL_MintAudio_audiosize); + buffers_filled[0]=SDL_TRUE; + buffers_filled[1]=SDL_FALSE; + } + } + + usleep(100); + } + SDL_MintAudio_thread_finished = SDL_TRUE; + return 0; +} + +void SDL_MintAudio_WaitThread(void) +{ + if (!SDL_MintAudio_mint_present) + return; + + if (SDL_MintAudio_thread_finished) + return; + + SDL_MintAudio_quit_thread = SDL_TRUE; + while (!SDL_MintAudio_thread_finished) { + Syield(); + } +} diff --git a/SDL/src/audio/mint/SDL_mintaudio.h b/SDL/src/audio/mint/SDL_mintaudio.h new file mode 100644 index 0000000..e4cb955 --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio.h @@ -0,0 +1,153 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + MiNT audio driver + + Patrice Mandin +*/ + +#ifndef _SDL_mintaudio_h +#define _SDL_mintaudio_h + +#include "../SDL_sysaudio.h" +#include "SDL_mintaudio_stfa.h" + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *this + +/* 16 predivisors with 3 clocks max. */ +#define MINTAUDIO_maxfreqs (16*3) + +typedef struct { + Uint32 frequency; + Uint32 masterclock; + Uint32 predivisor; + int gpio_bits; /* in case of external clock */ +} mint_frequency_t; + +struct SDL_PrivateAudioData { + mint_frequency_t frequencies[MINTAUDIO_maxfreqs]; + int freq_count; /* Number of frequencies in the array */ + int numfreq; /* Number of selected frequency */ +}; + +/* Old variable names */ + +#define MINTAUDIO_frequencies (this->hidden->frequencies) +#define MINTAUDIO_freqcount (this->hidden->freq_count) +#define MINTAUDIO_numfreq (this->hidden->numfreq) + +/* _MCH cookie (values>>16) */ +enum { + MCH_ST=0, + MCH_STE, + MCH_TT, + MCH_F30, + MCH_CLONE, + MCH_ARANYM +}; + +/* Master clocks for replay frequencies */ +#define MASTERCLOCK_STE 8010666 /* Not sure of this one */ +#define MASTERCLOCK_TT 16107953 /* Not sure of this one */ +#define MASTERCLOCK_FALCON1 25175000 +#define MASTERCLOCK_FALCON2 32000000 /* Only usable for DSP56K */ +#define MASTERCLOCK_FALCONEXT -1 /* Clock on DSP56K port, unknown */ +#define MASTERCLOCK_44K 22579200 /* Standard clock for 44.1 Khz */ +#define MASTERCLOCK_48K 24576000 /* Standard clock for 48 Khz */ + +/* Master clock predivisors */ +#define MASTERPREDIV_STE 160 +#define MASTERPREDIV_TT 320 +#define MASTERPREDIV_FALCON 256 +#define MASTERPREDIV_MILAN 256 + +/* MFP 68901 interrupt sources */ +enum { + MFP_PARALLEL=0, + MFP_DCD, + MFP_CTS, + MFP_BITBLT, + MFP_TIMERD, + MFP_BAUDRATE=MFP_TIMERD, + MFP_TIMERC, + MFP_200HZ=MFP_TIMERC, + MFP_ACIA, + MFP_DISK, + MFP_TIMERB, + MFP_HBLANK=MFP_TIMERB, + MFP_TERR, + MFP_TBE, + MFP_RERR, + MFP_RBF, + MFP_TIMERA, + MFP_DMASOUND=MFP_TIMERA, + MFP_RING, + MFP_MONODETECT +}; + +/* Xbtimer() timers */ +enum { + XB_TIMERA=0, + XB_TIMERB, + XB_TIMERC, + XB_TIMERD +}; + +/* Variables */ +extern SDL_AudioDevice *SDL_MintAudio_device; +extern Uint8 *SDL_MintAudio_audiobuf[2]; /* Pointers to buffers */ +extern unsigned long SDL_MintAudio_audiosize; /* Length of audio buffer=spec->size */ +extern volatile unsigned short SDL_MintAudio_numbuf; /* Buffer to play */ +extern volatile unsigned short SDL_MintAudio_mutex; +extern cookie_stfa_t *SDL_MintAudio_stfa; +extern volatile unsigned long SDL_MintAudio_clocktics; +extern unsigned short SDL_MintAudio_hasfpu; /* To preserve fpu registers if needed */ + +/* MiNT thread variables */ +extern SDL_bool SDL_MintAudio_mint_present; +extern SDL_bool SDL_MintAudio_quit_thread; +extern SDL_bool SDL_MintAudio_thread_finished; +extern long SDL_MintAudio_thread_pid; + +/* Functions */ +void SDL_MintAudio_Callback(void); +void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock, + Uint32 prediv, int gpio_bits); +int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq); +void SDL_MintAudio_CheckFpu(void); + +/* MiNT thread functions */ +int SDL_MintAudio_Thread(long param); +void SDL_MintAudio_WaitThread(void); + +/* ASM interrupt functions */ +void SDL_MintAudio_GsxbInterrupt(void); +void SDL_MintAudio_EmptyGsxbInterrupt(void); +void SDL_MintAudio_XbiosInterruptMeasureClock(void); +void SDL_MintAudio_XbiosInterrupt(void); +void SDL_MintAudio_Dma8Interrupt(void); +void SDL_MintAudio_StfaInterrupt(void); + +#endif /* _SDL_mintaudio_h */ diff --git a/SDL/src/audio/mint/SDL_mintaudio_dma8.c b/SDL/src/audio/mint/SDL_mintaudio_dma8.c new file mode 100644 index 0000000..3a60fbf --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio_dma8.c @@ -0,0 +1,361 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + MiNT audio driver + using DMA 8bits (hardware access) + + Patrice Mandin +*/ + +/* Mint includes */ +#include +#include +#include + +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" + +#include "../../video/ataricommon/SDL_atarimxalloc_c.h" + +#include "SDL_mintaudio.h" +#include "SDL_mintaudio_dma8.h" + +/*--- Defines ---*/ + +#define MINT_AUDIO_DRIVER_NAME "mint_dma8" + +/* Debug print info */ +#define DEBUG_NAME "audio:dma8: " +#if 0 +#define DEBUG_PRINT(what) \ + { \ + printf what; \ + } +#else +#define DEBUG_PRINT(what) +#endif + +/*--- Static variables ---*/ + +static unsigned long cookie_snd, cookie_mch; + +/*--- Audio driver functions ---*/ + +static void Mint_CloseAudio(_THIS); +static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void Mint_LockAudio(_THIS); +static void Mint_UnlockAudio(_THIS); + +/* To check/init hardware audio */ +static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec); +static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec); + +/*--- Audio driver bootstrap functions ---*/ + +static int Audio_Available(void) +{ + const char *envr = SDL_getenv("SDL_AUDIODRIVER"); + + /* Check if user asked a different audio driver */ + if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) { + DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n")); + return 0; + } + + /* Cookie _MCH present ? if not, assume ST machine */ + if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) { + cookie_mch = MCH_ST; + } + + /* Cookie _SND present ? if not, assume ST machine */ + if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { + cookie_snd = SND_PSG; + } + + /* Check if we have 8 bits audio */ + if ((cookie_snd & SND_8BIT)==0) { + DEBUG_PRINT((DEBUG_NAME "no 8 bits sound\n")); + return(0); + } + + /* Check if audio is lockable */ + if (cookie_snd & SND_16BIT) { + if (Locksnd()!=1) { + DEBUG_PRINT((DEBUG_NAME "audio locked by other application\n")); + return(0); + } + + Unlocksnd(); + } + + DEBUG_PRINT((DEBUG_NAME "8 bits audio available!\n")); + return(1); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = Mint_OpenAudio; + this->CloseAudio = Mint_CloseAudio; + this->LockAudio = Mint_LockAudio; + this->UnlockAudio = Mint_UnlockAudio; + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap MINTAUDIO_DMA8_bootstrap = { + MINT_AUDIO_DRIVER_NAME, "MiNT DMA 8 bits audio driver", + Audio_Available, Audio_CreateDevice +}; + +static void Mint_LockAudio(_THIS) +{ + void *oldpile; + + /* Stop replay */ + oldpile=(void *)Super(0); + DMAAUDIO_IO.control=0; + Super(oldpile); +} + +static void Mint_UnlockAudio(_THIS) +{ + void *oldpile; + + /* Restart replay */ + oldpile=(void *)Super(0); + DMAAUDIO_IO.control=3; + Super(oldpile); +} + +static void Mint_CloseAudio(_THIS) +{ + void *oldpile; + + /* Stop replay */ + oldpile=(void *)Super(0); + DMAAUDIO_IO.control=0; + Super(oldpile); + + DEBUG_PRINT((DEBUG_NAME "closeaudio: replay stopped\n")); + + /* Disable interrupt */ + Jdisint(MFP_DMASOUND); + + DEBUG_PRINT((DEBUG_NAME "closeaudio: interrupt disabled\n")); + + /* Wait if currently playing sound */ + while (SDL_MintAudio_mutex != 0) { + } + + DEBUG_PRINT((DEBUG_NAME "closeaudio: no more interrupt running\n")); + + /* Clear buffers */ + if (SDL_MintAudio_audiobuf[0]) { + Mfree(SDL_MintAudio_audiobuf[0]); + SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL; + } + + DEBUG_PRINT((DEBUG_NAME "closeaudio: buffers freed\n")); +} + +static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) +{ + int i, masterprediv, sfreq; + unsigned long masterclock; + + DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff)); + DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); + DEBUG_PRINT(("channels=%d, ", spec->channels)); + DEBUG_PRINT(("freq=%d\n", spec->freq)); + + if (spec->channels > 2) + spec->channels = 2; + + /* Check formats available */ + spec->format = AUDIO_S8; + + /* Calculate and select the closest frequency */ + sfreq=0; + masterclock=MASTERCLOCK_STE; + masterprediv=MASTERPREDIV_STE; + switch(cookie_mch>>16) { +/* + case MCH_STE: + masterclock=MASTERCLOCK_STE; + masterprediv=MASTERPREDIV_STE; + break; +*/ + case MCH_TT: + masterclock=MASTERCLOCK_TT; + masterprediv=MASTERPREDIV_TT; + break; + case MCH_F30: + case MCH_ARANYM: + masterclock=MASTERCLOCK_FALCON1; + masterprediv=MASTERPREDIV_FALCON; + sfreq=1; + break; + } + + MINTAUDIO_freqcount=0; + for (i=sfreq;i<4;i++) { + SDL_MintAudio_AddFrequency(this, masterclock/(masterprediv*(1<freq); + spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; + + DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); + DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); + DEBUG_PRINT(("channels=%d, ", spec->channels)); + DEBUG_PRINT(("freq=%d\n", spec->freq)); + + return 0; +} + +static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec) +{ + void *oldpile; + unsigned long buffer; + unsigned char mode; + + /* Set replay tracks */ + if (cookie_snd & SND_16BIT) { + Settracks(0,0); + Setmontracks(0); + } + + oldpile=(void *)Super(0); + + /* Stop currently playing sound */ + DMAAUDIO_IO.control=0; + + /* Set buffer */ + buffer = (unsigned long) SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; + DMAAUDIO_IO.start_high = (buffer>>16) & 255; + DMAAUDIO_IO.start_mid = (buffer>>8) & 255; + DMAAUDIO_IO.start_low = buffer & 255; + + buffer += SDL_MintAudio_audiosize; + DMAAUDIO_IO.end_high = (buffer>>16) & 255; + DMAAUDIO_IO.end_mid = (buffer>>8) & 255; + DMAAUDIO_IO.end_low = buffer & 255; + + mode = 3-MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor; + if (spec->channels==1) { + mode |= 1<<7; + } + DMAAUDIO_IO.sound_ctrl = mode; + + /* Set interrupt */ + Jdisint(MFP_DMASOUND); + Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt); + Jenabint(MFP_DMASOUND); + + if (cookie_snd & SND_16BIT) { + if (Setinterrupt(SI_TIMERA, SI_PLAY)<0) { + DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n")); + } + } + + /* Go */ + DMAAUDIO_IO.control = 3; /* playback + repeat */ + + Super(oldpile); +} + +static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + SDL_MintAudio_device = this; + + /* Check audio capabilities */ + if (Mint_CheckAudio(this, spec)==-1) { + return -1; + } + + SDL_CalculateAudioSpec(spec); + + /* Allocate memory for audio buffers in DMA-able RAM */ + DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); + + SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); + if (SDL_MintAudio_audiobuf[0]==NULL) { + SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer"); + return (-1); + } + SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ; + SDL_MintAudio_numbuf=0; + SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2); + SDL_MintAudio_audiosize = spec->size; + SDL_MintAudio_mutex = 0; + + DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0])); + DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1])); + + SDL_MintAudio_CheckFpu(); + + /* Setup audio hardware */ + Mint_InitAudio(this, spec); + + return(1); /* We don't use threaded audio */ +} diff --git a/SDL/src/audio/mint/SDL_mintaudio_dma8.h b/SDL/src/audio/mint/SDL_mintaudio_dma8.h new file mode 100644 index 0000000..78db70c --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio_dma8.h @@ -0,0 +1,85 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + DMA 8bits and Falcon Codec audio definitions + + Patrice Mandin, Didier Méquignon +*/ + +#ifndef _SDL_mintaudio_dma8_h +#define _SDL_mintaudio_dma8_h + +#define DMAAUDIO_IO_BASE (0xffff8900) +struct DMAAUDIO_IO_S { + unsigned char int_ctrl; + unsigned char control; + + unsigned char dummy1; + unsigned char start_high; + unsigned char dummy2; + unsigned char start_mid; + unsigned char dummy3; + unsigned char start_low; + + unsigned char dummy4; + unsigned char cur_high; + unsigned char dummy5; + unsigned char cur_mid; + unsigned char dummy6; + unsigned char cur_low; + + unsigned char dummy7; + unsigned char end_high; + unsigned char dummy8; + unsigned char end_mid; + unsigned char dummy9; + unsigned char end_low; + + unsigned char dummy10[12]; + + unsigned char track_ctrl; /* CODEC only */ + unsigned char sound_ctrl; + unsigned short sound_data; + unsigned short sound_mask; + + unsigned char dummy11[10]; + + unsigned short dev_ctrl; + unsigned short dest_ctrl; + unsigned short sync_div; + unsigned char track_rec; + unsigned char adderin_input; + unsigned char channel_input; + unsigned char channel_amplification; + unsigned char channel_reduction; + + unsigned char dummy12[6]; + + unsigned char data_direction; + unsigned char dummy13; + unsigned char dev_data; +}; +#define DMAAUDIO_IO ((*(volatile struct DMAAUDIO_IO_S *)DMAAUDIO_IO_BASE)) + +#endif /* _SDL_mintaudio_dma8_h */ diff --git a/SDL/src/audio/mint/SDL_mintaudio_gsxb.c b/SDL/src/audio/mint/SDL_mintaudio_gsxb.c new file mode 100644 index 0000000..56e7eae --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio_gsxb.c @@ -0,0 +1,436 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + MiNT audio driver + using XBIOS functions (GSXB compatible driver) + + Patrice Mandin +*/ + +/* Mint includes */ +#include +#include +#include + +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" + +#include "../../video/ataricommon/SDL_atarimxalloc_c.h" + +#include "SDL_mintaudio.h" +#include "SDL_mintaudio_gsxb.h" + +/*--- Defines ---*/ + +#define MINT_AUDIO_DRIVER_NAME "mint_gsxb" + +/* Debug print info */ +#define DEBUG_NAME "audio:gsxb: " +#if 0 +#define DEBUG_PRINT(what) \ + { \ + printf what; \ + } +#else +#define DEBUG_PRINT(what) +#endif + +/*--- Static variables ---*/ + +static unsigned long cookie_snd, cookie_gsxb; + +/*--- Audio driver functions ---*/ + +static void Mint_CloseAudio(_THIS); +static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void Mint_LockAudio(_THIS); +static void Mint_UnlockAudio(_THIS); + +/* To check/init hardware audio */ +static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec); +static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec); + +/* GSXB callbacks */ +static void Mint_GsxbInterrupt(void); +static void Mint_GsxbNullInterrupt(void); + +/*--- Audio driver bootstrap functions ---*/ + +static int Audio_Available(void) +{ + const char *envr = SDL_getenv("SDL_AUDIODRIVER"); + + /* Check if user asked a different audio driver */ + if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) { + DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n")); + return(0); + } + + /* Cookie _SND present ? if not, assume ST machine */ + if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { + cookie_snd = SND_PSG; + } + + /* Check if we have 16 bits audio */ + if ((cookie_snd & SND_16BIT)==0) { + DEBUG_PRINT((DEBUG_NAME "no 16 bits sound\n")); + return(0); + } + + /* Cookie GSXB present ? */ + cookie_gsxb = (Getcookie(C_GSXB, &cookie_gsxb) == C_FOUND); + + /* Is it GSXB ? */ + if (((cookie_snd & SND_GSXB)==0) || (cookie_gsxb==0)) { + DEBUG_PRINT((DEBUG_NAME "no GSXB audio\n")); + return(0); + } + + /* Check if audio is lockable */ + if (Locksnd()!=1) { + DEBUG_PRINT((DEBUG_NAME "audio locked by other application\n")); + return(0); + } + + Unlocksnd(); + + DEBUG_PRINT((DEBUG_NAME "GSXB audio available!\n")); + return(1); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = Mint_OpenAudio; + this->CloseAudio = Mint_CloseAudio; + this->LockAudio = Mint_LockAudio; + this->UnlockAudio = Mint_UnlockAudio; + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap MINTAUDIO_GSXB_bootstrap = { + MINT_AUDIO_DRIVER_NAME, "MiNT GSXB audio driver", + Audio_Available, Audio_CreateDevice +}; + +static void Mint_LockAudio(_THIS) +{ + /* Stop replay */ + Buffoper(0); +} + +static void Mint_UnlockAudio(_THIS) +{ + /* Restart replay */ + Buffoper(SB_PLA_ENA|SB_PLA_RPT); +} + +static void Mint_CloseAudio(_THIS) +{ + /* Stop replay */ + Buffoper(0); + + /* Uninstall interrupt */ + if (NSetinterrupt(2, SI_NONE, Mint_GsxbNullInterrupt)<0) { + DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed in close\n")); + } + + /* Wait if currently playing sound */ + while (SDL_MintAudio_mutex != 0) { + } + + /* Clear buffers */ + if (SDL_MintAudio_audiobuf[0]) { + Mfree(SDL_MintAudio_audiobuf[0]); + SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL; + } + + /* Unlock sound system */ + Unlocksnd(); +} + +static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) +{ + long snd_format; + int i, resolution, format_signed, format_bigendian; + Uint16 test_format = SDL_FirstAudioFormat(spec->format); + int valid_datatype = 0; + + resolution = spec->format & 0x00ff; + format_signed = ((spec->format & 0x8000)!=0); + format_bigendian = ((spec->format & 0x1000)!=0); + + DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff)); + DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); + DEBUG_PRINT(("channels=%d, ", spec->channels)); + DEBUG_PRINT(("freq=%d\n", spec->freq)); + + if (spec->channels > 2) { + spec->channels = 2; /* no more than stereo! */ + } + + while ((!valid_datatype) && (test_format)) { + /* Check formats available */ + snd_format = Sndstatus(SND_QUERYFORMATS); + spec->format = test_format; + resolution = spec->format & 0xff; + format_signed = (spec->format & (1<<15)); + format_bigendian = (spec->format & (1<<12)); + switch (test_format) { + case AUDIO_U8: + case AUDIO_S8: + if (snd_format & SND_FORMAT8) { + valid_datatype = 1; + snd_format = Sndstatus(SND_QUERY8BIT); + } + break; + + case AUDIO_U16LSB: + case AUDIO_S16LSB: + case AUDIO_U16MSB: + case AUDIO_S16MSB: + if (snd_format & SND_FORMAT16) { + valid_datatype = 1; + snd_format = Sndstatus(SND_QUERY16BIT); + } + break; + + default: + test_format = SDL_NextAudioFormat(); + break; + } + } + + if (!valid_datatype) { + SDL_SetError("Unsupported audio format"); + return (-1); + } + + /* Check signed/unsigned format */ + if (format_signed) { + if (snd_format & SND_FORMATSIGNED) { + /* Ok */ + } else if (snd_format & SND_FORMATUNSIGNED) { + /* Give unsigned format */ + spec->format = spec->format & (~0x8000); + } + } else { + if (snd_format & SND_FORMATUNSIGNED) { + /* Ok */ + } else if (snd_format & SND_FORMATSIGNED) { + /* Give signed format */ + spec->format |= 0x8000; + } + } + + if (format_bigendian) { + if (snd_format & SND_FORMATBIGENDIAN) { + /* Ok */ + } else if (snd_format & SND_FORMATLITTLEENDIAN) { + /* Give little endian format */ + spec->format = spec->format & (~0x1000); + } + } else { + if (snd_format & SND_FORMATLITTLEENDIAN) { + /* Ok */ + } else if (snd_format & SND_FORMATBIGENDIAN) { + /* Give big endian format */ + spec->format |= 0x1000; + } + } + + /* Calculate and select the closest frequency */ + MINTAUDIO_freqcount=0; + for (i=1;i<4;i++) { + SDL_MintAudio_AddFrequency(this, + MASTERCLOCK_44K/(MASTERPREDIV_MILAN*(1<freq); + spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; + + DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); + DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); + DEBUG_PRINT(("channels=%d, ", spec->channels)); + DEBUG_PRINT(("freq=%d\n", spec->freq)); + + return 0; +} + +static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec) +{ + int channels_mode, prediv; + void *buffer; + + /* Stop currently playing sound */ + Buffoper(0); + + /* Set replay tracks */ + Settracks(0,0); + Setmontracks(0); + + /* Select replay format */ + switch (spec->format & 0xff) { + case 8: + if (spec->channels==2) { + channels_mode=STEREO8; + } else { + channels_mode=MONO8; + } + break; + case 16: + if (spec->channels==2) { + channels_mode=STEREO16; + } else { + channels_mode=MONO16; + } + break; + default: + channels_mode=STEREO16; + break; + } + if (Setmode(channels_mode)<0) { + DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n")); + } + + prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor; + Devconnect(DMAPLAY, DAC, CLKEXT, prediv, 1); + + /* Set buffer */ + buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; + if (Setbuffer(0, buffer, buffer + spec->size)<0) { + DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n")); + } + + /* Install interrupt */ + if (NSetinterrupt(2, SI_PLAY, Mint_GsxbInterrupt)<0) { + DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed\n")); + } + + /* Go */ + Buffoper(SB_PLA_ENA|SB_PLA_RPT); + DEBUG_PRINT((DEBUG_NAME "hardware initialized\n")); +} + +static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + /* Lock sound system */ + if (Locksnd()!=1) { + SDL_SetError("Mint_OpenAudio: Audio system already in use"); + return(-1); + } + + SDL_MintAudio_device = this; + + /* Check audio capabilities */ + if (Mint_CheckAudio(this, spec)==-1) { + return -1; + } + + SDL_CalculateAudioSpec(spec); + + /* Allocate memory for audio buffers in DMA-able RAM */ + DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); + + SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); + if (SDL_MintAudio_audiobuf[0]==NULL) { + SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer"); + return (-1); + } + SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ; + SDL_MintAudio_numbuf=0; + SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2); + SDL_MintAudio_audiosize = spec->size; + SDL_MintAudio_mutex = 0; + + DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0])); + DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1])); + + SDL_MintAudio_CheckFpu(); + + /* Setup audio hardware */ + Mint_InitAudio(this, spec); + + return(1); /* We don't use threaded audio */ +} + +static void Mint_GsxbInterrupt(void) +{ + Uint8 *newbuf; + + if (SDL_MintAudio_mutex) + return; + + SDL_MintAudio_mutex=1; + + SDL_MintAudio_numbuf ^= 1; + SDL_MintAudio_Callback(); + newbuf = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; + Setbuffer(0, newbuf, newbuf + SDL_MintAudio_audiosize); + + SDL_MintAudio_mutex=0; +} + +static void Mint_GsxbNullInterrupt(void) +{ +} diff --git a/SDL/src/audio/mint/SDL_mintaudio_gsxb.h b/SDL/src/audio/mint/SDL_mintaudio_gsxb.h new file mode 100644 index 0000000..4ebfac6 --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio_gsxb.h @@ -0,0 +1,108 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + * GSXB audio definitions + * + * Patrice Mandin + */ + +#ifndef _SDL_mintaudio_gsxb_h +#define _SDL_mintaudio_gsxb_h + +#include /* for trap_14_xxx macros */ + +/* GSXB Cookie */ + +#define C_GSXB 0x47535842L + +/* Bit 5 in cookie _SND */ + +#define SND_GSXB (1<<5) + +/* NSoundcmd modes */ + +#define SETRATE 7 /* Set sample rate */ +#define SET8BITFORMAT 8 /* 8 bits format */ +#define SET16BITFORMAT 9 /* 16 bits format */ +#define SET24BITFORMAT 10 /* 24 bits format */ +#define SET32BITFORMAT 11 /* 32 bits format */ +#define LTATTEN_MASTER 12 /* Attenuation */ +#define RTATTEN_MASTER 13 +#define LTATTEN_MICIN 14 +#define RTATTEN_MICIN 15 +#define LTATTEN_FMGEN 16 +#define RTATTEN_FMGEN 17 +#define LTATTEN_LINEIN 18 +#define RTATTEN_LINEIN 19 +#define LTATTEN_CDIN 20 +#define RTATTEN_CDIN 21 +#define LTATTEN_VIDIN 22 +#define RTATTEN_VIDIN 23 +#define LTATTEN_AUXIN 24 +#define RTATTEN_AUXIN 25 + +/* Setmode modes */ + +#define MONO16 3 +#define STEREO24 4 +#define STEREO32 5 +#define MONO24 6 +#define MONO32 7 + +/* Sndstatus modes */ + +#define SND_QUERYFORMATS 2 +#define SND_QUERYMIXERS 3 +#define SND_QUERYSOURCES 4 +#define SND_QUERYDUPLEX 5 +#define SND_QUERY8BIT 8 +#define SND_QUERY16BIT 9 +#define SND_QUERY24BIT 10 +#define SND_QUERY32BIT 11 + +#define SND_FORMAT8 (1<<0) +#define SND_FORMAT16 (1<<1) +#define SND_FORMAT24 (1<<2) +#define SND_FORMAT32 (1<<3) + +#define SND_FORMATSIGNED (1<<0) +#define SND_FORMATUNSIGNED (1<<1) +#define SND_FORMATBIGENDIAN (1<<2) +#define SND_FORMATLITTLEENDIAN (1<<3) + +/* Devconnect prescalers */ + +#define CLK_44K 1 +#define CLK_22K 3 +#define CLK_11K 7 + +/* Extra xbios functions */ + +#define NSoundcmd(mode,data,data2) \ + (long)trap_14_wwl((short)130,(short)(mode),(short)(data),(long)(data2)) +#define NSetinterrupt(src_inter,cause,inth_addr) \ + (long)trap_14_wwwl((short)135,(short)(src_inter),(short)(cause), \ + (long)(inth_addr)) + +#endif /* _SDL_mintaudio_gsxb_h */ diff --git a/SDL/src/audio/mint/SDL_mintaudio_it.S b/SDL/src/audio/mint/SDL_mintaudio_it.S new file mode 100644 index 0000000..e24d628 --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio_it.S @@ -0,0 +1,281 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* + Audio interrupts + + Patrice Mandin, Didier Méquignon + */ + + .text + + .globl _SDL_MintAudio_Callback + + .globl _SDL_MintAudio_XbiosInterrupt + .globl _SDL_MintAudio_XbiosInterruptMeasureClock + .globl _SDL_MintAudio_Dma8Interrupt + .globl _SDL_MintAudio_StfaInterrupt + + .globl _SDL_MintAudio_mutex + .globl _SDL_MintAudio_audiobuf + .globl _SDL_MintAudio_numbuf + .globl _SDL_MintAudio_audiosize + .globl _SDL_MintAudio_clocktics + .globl _SDL_MintAudio_hasfpu + + .globl _SDL_MintAudio_stfa + +/* + How it works: + - Audio is playing buffer #0 (resp. #1) + - We must calculate a sample in buffer #1 (resp. #0) + so we first call the callback to do it + - Then we swap the buffers +*/ + +#define savptr 0x4a2 +#define savamt 0x46 + +/*--- Xbios interrupt vector to measure Falcon external clock ---*/ + +_SDL_MintAudio_XbiosInterruptMeasureClock: /* 1 mS */ + + btst #0,0xFFFF8901:w /* state DMA sound */ + beqs SDL_MintAudio_EndIntMeasure + addql #1,_SDL_MintAudio_clocktics +SDL_MintAudio_EndIntMeasure: + bclr #5,0xFFFFFA0F:w /* Clear service bit */ + rte + +/*--- Xbios interrupt vector ---*/ + +_SDL_MintAudio_XbiosInterrupt: + + /* Reenable interrupts, so other interrupts can work */ + movew #0x2300,sr + + /* Clear service bit, so other MFP interrupts can work */ + bclr #5,0xfffffa0f:w + + /* Check if we are not already running */ + tstw _SDL_MintAudio_mutex + bne SDL_MintAudio_XbiosEnd + notw _SDL_MintAudio_mutex + + /* Swap buffers */ + eorw #1,_SDL_MintAudio_numbuf + + moveml d0-d7/a0-a6,sp@- + + /* Save FPU if needed */ + tstw _SDL_MintAudio_hasfpu + beqs SDL_MintAudio_Xbios_nofpu1 + .chip 68060 + fsave sp@- + fmoveml fpcr/fpsr/fpiar,sp@- + fmovemx fp0-fp7,sp@- + .chip 68000 +SDL_MintAudio_Xbios_nofpu1: + + /* Callback */ + jsr _SDL_MintAudio_Callback + + /* Restore FPU if needed */ + tstw _SDL_MintAudio_hasfpu + beqs SDL_MintAudio_Xbios_nofpu2 + .chip 68060 + fmovemx sp@+,fp0-fp7 + fmoveml sp@+,fpcr/fpsr/fpiar + frestore sp@+ + .chip 68000 +SDL_MintAudio_Xbios_nofpu2: + + /* Reserve space for registers */ + subl #savamt,savptr + + /* Set new buffer */ + + moveq #0,d0 + movel _SDL_MintAudio_audiosize,d1 + + movew _SDL_MintAudio_numbuf,d0 + lsll #2,d0 + lea _SDL_MintAudio_audiobuf,a0 + movel a0@(d0:l),a1 + + lea a1@(d1:l),a2 + + movel a2,sp@- + movel a1,sp@- + clrw sp@- + movew #131,sp@- + trap #14 + lea sp@(12),sp + + /* Restore registers space */ + addl #savamt,savptr + + moveml sp@+,d0-d7/a0-a6 + + clrw _SDL_MintAudio_mutex +SDL_MintAudio_XbiosEnd: + rte + +/*--- DMA 8 bits interrupt vector ---*/ + +_SDL_MintAudio_Dma8Interrupt: + + /* Reenable interrupts, so other interrupts can work */ + movew #0x2300,sr + + /* Clear service bit, so other MFP interrupts can work */ + bclr #5,0xfffffa0f:w + + /* Check if we are not already running */ + tstw _SDL_MintAudio_mutex + bne SDL_MintAudio_Dma8End + notw _SDL_MintAudio_mutex + + /* Swap buffers */ + eorw #1,_SDL_MintAudio_numbuf + + moveml d0-d1/a0-a1,sp@- + + /* Save FPU if needed */ + tstw _SDL_MintAudio_hasfpu + beqs SDL_MintAudio_Dma8_nofpu1 + .chip 68060 + fsave sp@- + fmoveml fpcr/fpsr/fpiar,sp@- + fmovemx fp0-fp7,sp@- + .chip 68000 +SDL_MintAudio_Dma8_nofpu1: + + /* Callback */ + jsr _SDL_MintAudio_Callback + + /* Restore FPU if needed */ + tstw _SDL_MintAudio_hasfpu + beqs SDL_MintAudio_Dma8_nofpu2 + .chip 68060 + fmovemx sp@+,fp0-fp7 + fmoveml sp@+,fpcr/fpsr/fpiar + frestore sp@+ + .chip 68000 +SDL_MintAudio_Dma8_nofpu2: + + /* Set new buffer */ + + moveq #0,d0 + + movew _SDL_MintAudio_numbuf,d0 + lslw #2,d0 + lea _SDL_MintAudio_audiobuf,a0 + movel a0@(d0:w),d1 + + /* Modify DMA addresses */ + lea 0xffff8900:w,a0 + + moveb d1,a0@(0x07) /* Start address */ + rorl #8,d1 + moveb d1,a0@(0x05) + rorl #8,d1 + moveb d1,a0@(0x03) + swap d1 + + addl _SDL_MintAudio_audiosize,d1 + + moveb d1,a0@(0x13) /* End address */ + rorl #8,d1 + moveb d1,a0@(0x11) + rorl #8,d1 + moveb d1,a0@(0x0f) + + moveml sp@+,d0-d1/a0-a1 + + clrw _SDL_MintAudio_mutex +SDL_MintAudio_Dma8End: + rte + +/*--- STFA interrupt vector ---*/ + +STFA_SOUND_START = 6 +STFA_SOUND_END = STFA_SOUND_START+8 + +_SDL_MintAudio_StfaInterrupt: + + /* Reenable interrupts, so other interrupts can work */ + movew #0x2300,sr + + /* Check if we are not already running */ + tstw _SDL_MintAudio_mutex + bnes SDL_MintAudio_StfaEnd + notw _SDL_MintAudio_mutex + + /* Swap buffers */ + eorw #1,_SDL_MintAudio_numbuf + + moveml d0-d7/a0-a6,sp@- + + /* Save FPU if needed */ + tstw _SDL_MintAudio_hasfpu + beqs SDL_MintAudio_Stfa_nofpu1 + .chip 68060 + fsave sp@- + fmoveml fpcr/fpsr/fpiar,sp@- + fmovemx fp0-fp7,sp@- + .chip 68000 +SDL_MintAudio_Stfa_nofpu1: + + /* Callback */ + jsr _SDL_MintAudio_Callback + + /* Restore FPU if needed */ + tstw _SDL_MintAudio_hasfpu + beqs SDL_MintAudio_Stfa_nofpu2 + .chip 68060 + fmovemx sp@+,fp0-fp7 + fmoveml sp@+,fpcr/fpsr/fpiar + frestore sp@+ + .chip 68000 +SDL_MintAudio_Stfa_nofpu2: + + /* Set new buffer */ + + moveq #0,d0 + movel _SDL_MintAudio_stfa,a1 + + movew _SDL_MintAudio_numbuf,d0 + lslw #2,d0 + lea _SDL_MintAudio_audiobuf,a0 + movel a0@(d0:w),d1 + + /* Modify STFA replay buffers */ + movel d1,a1@(STFA_SOUND_START) + addl _SDL_MintAudio_audiosize,d1 + movel d1,a1@(STFA_SOUND_END) + + moveml sp@+,d0-d7/a0-a6 + + clrw _SDL_MintAudio_mutex +SDL_MintAudio_StfaEnd: + rte diff --git a/SDL/src/audio/mint/SDL_mintaudio_mcsn.c b/SDL/src/audio/mint/SDL_mintaudio_mcsn.c new file mode 100644 index 0000000..7c50ca6 --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio_mcsn.c @@ -0,0 +1,404 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + MiNT audio driver + using XBIOS functions (MacSound compatible driver) + + Patrice Mandin +*/ + +#include + +/* Mint includes */ +#include +#include +#include + +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" + +#include "../../video/ataricommon/SDL_atarimxalloc_c.h" + +#include "SDL_mintaudio.h" +#include "SDL_mintaudio_mcsn.h" + +/*--- Defines ---*/ + +#define MINT_AUDIO_DRIVER_NAME "mint_mcsn" + +/* Debug print info */ +#define DEBUG_NAME "audio:mcsn: " +#if 0 +#define DEBUG_PRINT(what) \ + { \ + printf what; \ + } +#else +#define DEBUG_PRINT(what) +#endif + +/*--- Static variables ---*/ + +static unsigned long cookie_snd, cookie_mch; +static cookie_mcsn_t *cookie_mcsn; + +/*--- Audio driver functions ---*/ + +static void Mint_CloseAudio(_THIS); +static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void Mint_LockAudio(_THIS); +static void Mint_UnlockAudio(_THIS); + +/* To check/init hardware audio */ +static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec); +static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec); + +/*--- Audio driver bootstrap functions ---*/ + +static int Audio_Available(void) +{ + unsigned long dummy; + const char *envr = SDL_getenv("SDL_AUDIODRIVER"); + + SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND); + + /* We can't use XBIOS in interrupt with Magic, don't know about thread */ + if (Getcookie(C_MagX, &dummy) == C_FOUND) { + return(0); + } + + /* Check if user asked a different audio driver */ + if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) { + DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n")); + return(0); + } + + /* Cookie _MCH present ? if not, assume ST machine */ + if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) { + cookie_mch = MCH_ST; + } + + /* Cookie _SND present ? if not, assume ST machine */ + if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { + cookie_snd = SND_PSG; + } + + /* Check if we have 16 bits audio */ + if ((cookie_snd & SND_16BIT)==0) { + DEBUG_PRINT((DEBUG_NAME "no 16 bits sound\n")); + return(0); + } + + /* Cookie MCSN present ? */ + if (Getcookie(C_McSn, (long *) &cookie_mcsn) != C_FOUND) { + DEBUG_PRINT((DEBUG_NAME "no MCSN audio\n")); + return(0); + } + + /* Check if interrupt at end of replay */ + if (cookie_mcsn->pint == 0) { + DEBUG_PRINT((DEBUG_NAME "no interrupt at end of replay\n")); + return(0); + } + + /* Check if audio is lockable */ + if (Locksnd()!=1) { + DEBUG_PRINT((DEBUG_NAME "audio locked by other application\n")); + return(0); + } + + Unlocksnd(); + + DEBUG_PRINT((DEBUG_NAME "MCSN audio available!\n")); + return(1); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = Mint_OpenAudio; + this->CloseAudio = Mint_CloseAudio; + this->LockAudio = Mint_LockAudio; + this->UnlockAudio = Mint_UnlockAudio; + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap MINTAUDIO_MCSN_bootstrap = { + MINT_AUDIO_DRIVER_NAME, "MiNT MCSN audio driver", + Audio_Available, Audio_CreateDevice +}; + +static void Mint_LockAudio(_THIS) +{ + /* Stop replay */ + Buffoper(0); +} + +static void Mint_UnlockAudio(_THIS) +{ + /* Restart replay */ + Buffoper(SB_PLA_ENA|SB_PLA_RPT); +} + +static void Mint_CloseAudio(_THIS) +{ + /* Stop replay */ + SDL_MintAudio_WaitThread(); + Buffoper(0); + + if (!SDL_MintAudio_mint_present) { + /* Uninstall interrupt */ + Jdisint(MFP_DMASOUND); + } + + /* Wait if currently playing sound */ + while (SDL_MintAudio_mutex != 0) { + } + + /* Clear buffers */ + if (SDL_MintAudio_audiobuf[0]) { + Mfree(SDL_MintAudio_audiobuf[0]); + SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL; + } + + /* Unlock sound system */ + Unlocksnd(); +} + +static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) +{ + int i; + unsigned long masterclock, masterprediv; + + DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff)); + DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); + DEBUG_PRINT(("channels=%d, ", spec->channels)); + DEBUG_PRINT(("freq=%d\n", spec->freq)); + + if (spec->channels > 2) { + spec->channels = 2; /* no more than stereo! */ + } + + /* Check formats available */ + MINTAUDIO_freqcount=0; + switch(cookie_mcsn->play) { + case MCSN_ST: + spec->channels=1; + spec->format=8; /* FIXME: is it signed or unsigned ? */ + SDL_MintAudio_AddFrequency(this, 12500, 0, 0, -1); + break; + case MCSN_TT: /* Also STE, Mega STE */ + spec->format=AUDIO_S8; + masterclock=MASTERCLOCK_STE; + masterprediv=MASTERPREDIV_STE; + if ((cookie_mch>>16)==MCH_TT) { + masterclock=MASTERCLOCK_TT; + masterprediv=MASTERPREDIV_TT; + } + for (i=0; i<4; i++) { + SDL_MintAudio_AddFrequency(this, masterclock/(masterprediv*(1<res1 != 0) { + for (i=1; i<4; i++) { + SDL_MintAudio_AddFrequency(this, (cookie_mcsn->res1)/(MASTERPREDIV_FALCON*(1<format |= 0x8000; /* Audio is always signed */ + if ((spec->format & 0x00ff)==16) { + spec->format |= 0x1000; /* Audio is always big endian */ + spec->channels=2; /* 16 bits always stereo */ + } + break; + } + +#if 1 + for (i=0; ifreq); + spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; + + DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); + DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); + DEBUG_PRINT(("channels=%d, ", spec->channels)); + DEBUG_PRINT(("freq=%d\n", spec->freq)); + + return 0; +} + +static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec) +{ + int channels_mode, prediv, dmaclock; + void *buffer; + + /* Stop currently playing sound */ + SDL_MintAudio_quit_thread = SDL_FALSE; + SDL_MintAudio_thread_finished = SDL_TRUE; + SDL_MintAudio_WaitThread(); + Buffoper(0); + + /* Set replay tracks */ + Settracks(0,0); + Setmontracks(0); + + /* Select replay format */ + channels_mode=STEREO16; + switch (spec->format & 0xff) { + case 8: + if (spec->channels==2) { + channels_mode=STEREO8; + } else { + channels_mode=MONO8; + } + break; + } + if (Setmode(channels_mode)<0) { + DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n")); + } + + dmaclock = MINTAUDIO_frequencies[MINTAUDIO_numfreq].masterclock; + prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor; + switch(cookie_mcsn->play) { + case MCSN_TT: + Devconnect(DMAPLAY, DAC, CLK25M, CLKOLD, 1); + Soundcmd(SETPRESCALE, prediv); + DEBUG_PRINT((DEBUG_NAME "STE/TT prescaler selected\n")); + break; + case MCSN_FALCON: + Devconnect(DMAPLAY, DAC, dmaclock, prediv, 1); + DEBUG_PRINT((DEBUG_NAME "Falcon prescaler selected\n")); + break; + } + + /* Set buffer */ + buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; + if (Setbuffer(0, buffer, buffer + spec->size)<0) { + DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n")); + } + + if (SDL_MintAudio_mint_present) { + SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0); + } else { + /* Install interrupt */ + Jdisint(MFP_DMASOUND); + Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt); + Jenabint(MFP_DMASOUND); + + if (Setinterrupt(SI_TIMERA, SI_PLAY)<0) { + DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n")); + } + } + + /* Go */ + Buffoper(SB_PLA_ENA|SB_PLA_RPT); + DEBUG_PRINT((DEBUG_NAME "hardware initialized\n")); +} + +static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + /* Lock sound system */ + if (Locksnd()!=1) { + SDL_SetError("Mint_OpenAudio: Audio system already in use"); + return(-1); + } + + SDL_MintAudio_device = this; + + /* Check audio capabilities */ + if (Mint_CheckAudio(this, spec)==-1) { + return -1; + } + + SDL_CalculateAudioSpec(spec); + + /* Allocate memory for audio buffers in DMA-able RAM */ + DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); + + SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); + if (SDL_MintAudio_audiobuf[0]==NULL) { + SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer"); + return (-1); + } + SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ; + SDL_MintAudio_numbuf=0; + SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2); + SDL_MintAudio_audiosize = spec->size; + SDL_MintAudio_mutex = 0; + + DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0])); + DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1])); + + SDL_MintAudio_CheckFpu(); + + /* Setup audio hardware */ + Mint_InitAudio(this, spec); + + return(1); /* We don't use SDL threaded audio */ +} diff --git a/SDL/src/audio/mint/SDL_mintaudio_mcsn.h b/SDL/src/audio/mint/SDL_mintaudio_mcsn.h new file mode 100644 index 0000000..2d6bc26 --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio_mcsn.h @@ -0,0 +1,59 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + MCSN control structure + + Patrice Mandin +*/ + +#ifndef _SDL_mintaudio_mcsh_h +#define _SDL_mintaudio_mcsh_h + +typedef struct { + unsigned short version; /* Version */ + unsigned short size; /* Size of structure */ + + unsigned short play; /* Replay capability */ + unsigned short record; /* Record capability */ + unsigned short dsp; /* DSP56K present */ + unsigned short pint; /* Interrupt at end of replay */ + unsigned short rint; /* Interrupt at end of record */ + + unsigned long res1; /* Frequency of external clock */ + unsigned long res2; + unsigned long res3; + unsigned long res4; +} cookie_mcsn_t __attribute__((packed)); + +enum { + MCSN_ST=0, + MCSN_TT, + MCSN_STE=MCSN_TT, + MCSN_FALCON, + MCSN_MAC=MCSN_FALCON +}; + +#define SETSMPFREQ 7 /* Set sample frequency */ + +#endif /* _SDL_mintaudio_mcsh_h */ diff --git a/SDL/src/audio/mint/SDL_mintaudio_stfa.c b/SDL/src/audio/mint/SDL_mintaudio_stfa.c new file mode 100644 index 0000000..8e2f0b0 --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio_stfa.c @@ -0,0 +1,323 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + MiNT audio driver + using XBIOS functions (STFA driver) + + Patrice Mandin +*/ + +/* Mint includes */ +#include +#include +#include + +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" + +#include "../../video/ataricommon/SDL_atarimxalloc_c.h" + +#include "SDL_mintaudio.h" +#include "SDL_mintaudio_stfa.h" + +/*--- Defines ---*/ + +#define MINT_AUDIO_DRIVER_NAME "mint_stfa" + +/* Debug print info */ +#define DEBUG_NAME "audio:stfa: " +#if 0 +#define DEBUG_PRINT(what) \ + { \ + printf what; \ + } +#else +#define DEBUG_PRINT(what) +#endif + +/*--- Static variables ---*/ + +static unsigned long cookie_snd, cookie_mch; +static cookie_stfa_t *cookie_stfa; + +static const int freqs[16]={ + 4995, 6269, 7493, 8192, + 9830, 10971, 12538, 14985, + 16384, 19819, 21943, 24576, + 30720, 32336, 43885, 49152 +}; + +/*--- Audio driver functions ---*/ + +static void Mint_CloseAudio(_THIS); +static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void Mint_LockAudio(_THIS); +static void Mint_UnlockAudio(_THIS); + +/* To check/init hardware audio */ +static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec); +static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec); + +/*--- Audio driver bootstrap functions ---*/ + +static int Audio_Available(void) +{ + const char *envr = SDL_getenv("SDL_AUDIODRIVER"); + + /* Check if user asked a different audio driver */ + if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) { + DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n")); + return(0); + } + + /* Cookie _MCH present ? if not, assume ST machine */ + if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) { + cookie_mch = MCH_ST; + } + + /* Cookie _SND present ? if not, assume ST machine */ + if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { + cookie_snd = SND_PSG; + } + + /* Cookie STFA present ? */ + if (Getcookie(C_STFA, (long *) &cookie_stfa) != C_FOUND) { + DEBUG_PRINT((DEBUG_NAME "no STFA audio\n")); + return(0); + } + + SDL_MintAudio_stfa = cookie_stfa; + + DEBUG_PRINT((DEBUG_NAME "STFA audio available!\n")); + return(1); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = Mint_OpenAudio; + this->CloseAudio = Mint_CloseAudio; + this->LockAudio = Mint_LockAudio; + this->UnlockAudio = Mint_UnlockAudio; + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap MINTAUDIO_STFA_bootstrap = { + MINT_AUDIO_DRIVER_NAME, "MiNT STFA audio driver", + Audio_Available, Audio_CreateDevice +}; + +static void Mint_LockAudio(_THIS) +{ + void *oldpile; + + /* Stop replay */ + oldpile=(void *)Super(0); + cookie_stfa->sound_enable=STFA_PLAY_DISABLE; + Super(oldpile); +} + +static void Mint_UnlockAudio(_THIS) +{ + void *oldpile; + + /* Restart replay */ + oldpile=(void *)Super(0); + cookie_stfa->sound_enable=STFA_PLAY_ENABLE|STFA_PLAY_REPEAT; + Super(oldpile); +} + +static void Mint_CloseAudio(_THIS) +{ + void *oldpile; + + /* Stop replay */ + oldpile=(void *)Super(0); + cookie_stfa->sound_enable=STFA_PLAY_DISABLE; + Super(oldpile); + + /* Wait if currently playing sound */ + while (SDL_MintAudio_mutex != 0) { + } + + /* Clear buffers */ + if (SDL_MintAudio_audiobuf[0]) { + Mfree(SDL_MintAudio_audiobuf[0]); + SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL; + } +} + +static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) +{ + int i; + + DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff)); + DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); + DEBUG_PRINT(("channels=%d, ", spec->channels)); + DEBUG_PRINT(("freq=%d\n", spec->freq)); + + if (spec->channels > 2) { + spec->channels = 2; /* no more than stereo! */ + } + + /* Check formats available */ + MINTAUDIO_freqcount=0; + for (i=0;i<16;i++) { + SDL_MintAudio_AddFrequency(this, freqs[i], 0, i, -1); + } + +#if 1 + for (i=0; ifreq); + spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; + + DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); + DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); + DEBUG_PRINT(("channels=%d, ", spec->channels)); + DEBUG_PRINT(("freq=%d\n", spec->freq)); + + return 0; +} + +static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec) +{ + void *buffer; + void *oldpile; + + buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; + + oldpile=(void *)Super(0); + + /* Stop replay */ + cookie_stfa->sound_enable=STFA_PLAY_DISABLE; + + /* Select replay format */ + cookie_stfa->sound_control = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor; + if ((spec->format & 0xff)==8) { + cookie_stfa->sound_control |= STFA_FORMAT_8BIT; + } else { + cookie_stfa->sound_control |= STFA_FORMAT_16BIT; + } + if (spec->channels==2) { + cookie_stfa->sound_control |= STFA_FORMAT_STEREO; + } else { + cookie_stfa->sound_control |= STFA_FORMAT_MONO; + } + if ((spec->format & 0x8000)!=0) { + cookie_stfa->sound_control |= STFA_FORMAT_SIGNED; + } else { + cookie_stfa->sound_control |= STFA_FORMAT_UNSIGNED; + } + if ((spec->format & 0x1000)!=0) { + cookie_stfa->sound_control |= STFA_FORMAT_BIGENDIAN; + } else { + cookie_stfa->sound_control |= STFA_FORMAT_LITENDIAN; + } + + /* Set buffer */ + cookie_stfa->sound_start = (unsigned long) buffer; + cookie_stfa->sound_end = (unsigned long) (buffer + spec->size); + + /* Set interrupt */ + cookie_stfa->stfa_it = SDL_MintAudio_StfaInterrupt; + + /* Restart replay */ + cookie_stfa->sound_enable=STFA_PLAY_ENABLE|STFA_PLAY_REPEAT; + + Super(oldpile); + + DEBUG_PRINT((DEBUG_NAME "hardware initialized\n")); +} + +static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + SDL_MintAudio_device = this; + + /* Check audio capabilities */ + if (Mint_CheckAudio(this, spec)==-1) { + return -1; + } + + SDL_CalculateAudioSpec(spec); + + /* Allocate memory for audio buffers in DMA-able RAM */ + DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); + + SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); + if (SDL_MintAudio_audiobuf[0]==NULL) { + SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer"); + return (-1); + } + SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ; + SDL_MintAudio_numbuf=0; + SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2); + SDL_MintAudio_audiosize = spec->size; + SDL_MintAudio_mutex = 0; + + DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0])); + DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1])); + + SDL_MintAudio_CheckFpu(); + + /* Setup audio hardware */ + Mint_InitAudio(this, spec); + + return(1); /* We don't use threaded audio */ +} diff --git a/SDL/src/audio/mint/SDL_mintaudio_stfa.h b/SDL/src/audio/mint/SDL_mintaudio_stfa.h new file mode 100644 index 0000000..fb42b97 --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio_stfa.h @@ -0,0 +1,100 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + STFA control structure + + Patrice Mandin +*/ + +#ifndef _SDL_mintaudio_stfa_h +#define _SDL_mintaudio_stfa_h + +/*--- Defines ---*/ + +#define C_STFA 0x53544641L /* Sound treiber für atari (seb/The removers) */ + +#define STFA_PLAY_ENABLE (1<<0) +#define STFA_PLAY_DISABLE (0<<0) +#define STFA_PLAY_REPEAT (1<<1) +#define STFA_PLAY_SINGLE (0<<1) + +#define STFA_FORMAT_SIGNED (1<<15) +#define STFA_FORMAT_UNSIGNED (0<<15) +#define STFA_FORMAT_STEREO (1<<14) +#define STFA_FORMAT_MONO (0<<14) +#define STFA_FORMAT_16BIT (1<<13) +#define STFA_FORMAT_8BIT (0<<13) +#define STFA_FORMAT_LITENDIAN (1<<9) +#define STFA_FORMAT_BIGENDIAN (0<<9) +#define STFA_FORMAT_FREQ_MASK 0x0f +enum { + STFA_FORMAT_F4995=0, + STFA_FORMAT_F6269, + STFA_FORMAT_F7493, + STFA_FORMAT_F8192, + + STFA_FORMAT_F9830, + STFA_FORMAT_F10971, + STFA_FORMAT_F12538, + STFA_FORMAT_F14985, + + STFA_FORMAT_F16384, + STFA_FORMAT_F19819, + STFA_FORMAT_F21943, + STFA_FORMAT_F24576, + + STFA_FORMAT_F30720, + STFA_FORMAT_F32336, + STFA_FORMAT_F43885, + STFA_FORMAT_F49152 +}; + +/*--- Types ---*/ + +typedef struct { + unsigned short sound_enable; + unsigned short sound_control; + unsigned short sound_output; + unsigned long sound_start; + unsigned long sound_current; + unsigned long sound_end; + unsigned short version; + void *old_vbl; + void *old_timera; + unsigned long old_mfp_status; + void *new_vbl; + void *drivers_list; + void *play_stop; + unsigned short frequency; + void *set_frequency; + + unsigned short frequency_threshold; + unsigned short *custom_freq_table; + unsigned short stfa_on_off; + void *new_drivers_list; + unsigned long old_bit_2_of_cookie_snd; + void (*stfa_it)(void); +} cookie_stfa_t __attribute__((packed)); + +#endif /* _SDL_mintaudio_stfa_h */ diff --git a/SDL/src/audio/mint/SDL_mintaudio_xbios.c b/SDL/src/audio/mint/SDL_mintaudio_xbios.c new file mode 100644 index 0000000..8fd9ce4 --- /dev/null +++ b/SDL/src/audio/mint/SDL_mintaudio_xbios.c @@ -0,0 +1,495 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* + MiNT audio driver + using XBIOS functions (Falcon) + + Patrice Mandin, Didier Méquignon +*/ + +#include +#include + +/* Mint includes */ +#include +#include +#include + +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" + +#include "../../video/ataricommon/SDL_atarimxalloc_c.h" + +#include "SDL_mintaudio.h" +#include "SDL_mintaudio_dma8.h" + +/*--- Defines ---*/ + +#define MINT_AUDIO_DRIVER_NAME "mint_xbios" + +/* Debug print info */ +#define DEBUG_NAME "audio:xbios: " +#if 0 +#define DEBUG_PRINT(what) \ + { \ + printf what; \ + } +#else +#define DEBUG_PRINT(what) +#endif + +/*--- Static variables ---*/ + +static unsigned long cookie_snd; + +/*--- Audio driver functions ---*/ + +static void Mint_CloseAudio(_THIS); +static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void Mint_LockAudio(_THIS); +static void Mint_UnlockAudio(_THIS); + +/* To check/init hardware audio */ +static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec); +static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec); + +/*--- Audio driver bootstrap functions ---*/ + +static int Audio_Available(void) +{ + unsigned long dummy; + const char *envr = SDL_getenv("SDL_AUDIODRIVER"); + + /*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);*/ + SDL_MintAudio_mint_present = SDL_FALSE; + + /* We can't use XBIOS in interrupt with Magic, don't know about thread */ + if (Getcookie(C_MagX, &dummy) == C_FOUND) { + return(0); + } + + /* Check if user asked a different audio driver */ + if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) { + DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n")); + return(0); + } + + /* Cookie _SND present ? if not, assume ST machine */ + if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { + cookie_snd = SND_PSG; + } + + /* Check if we have 16 bits audio */ + if ((cookie_snd & SND_16BIT)==0) { + DEBUG_PRINT((DEBUG_NAME "no 16 bits sound\n")); + return(0); + } + + /* Check if audio is lockable */ + if (Locksnd()!=1) { + DEBUG_PRINT((DEBUG_NAME "audio locked by other application\n")); + return(0); + } + + Unlocksnd(); + + DEBUG_PRINT((DEBUG_NAME "XBIOS audio available!\n")); + return(1); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = Mint_OpenAudio; + this->CloseAudio = Mint_CloseAudio; + this->LockAudio = Mint_LockAudio; + this->UnlockAudio = Mint_UnlockAudio; + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap MINTAUDIO_XBIOS_bootstrap = { + MINT_AUDIO_DRIVER_NAME, "MiNT XBIOS audio driver", + Audio_Available, Audio_CreateDevice +}; + +static void Mint_LockAudio(_THIS) +{ + /* Stop replay */ + Buffoper(0); +} + +static void Mint_UnlockAudio(_THIS) +{ + /* Restart replay */ + Buffoper(SB_PLA_ENA|SB_PLA_RPT); +} + +static void Mint_CloseAudio(_THIS) +{ + /* Stop replay */ + SDL_MintAudio_WaitThread(); + Buffoper(0); + + if (!SDL_MintAudio_mint_present) { + /* Uninstall interrupt */ + Jdisint(MFP_DMASOUND); + } + + /* Wait if currently playing sound */ + while (SDL_MintAudio_mutex != 0) { + } + + /* Clear buffers */ + if (SDL_MintAudio_audiobuf[0]) { + Mfree(SDL_MintAudio_audiobuf[0]); + SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL; + } + + /* Unlock sound system */ + Unlocksnd(); +} + +/* Falcon XBIOS implementation of Devconnect() is buggy with external clock */ +static void Devconnect2(int src, int dst, int sclk, int pre) +{ + static const unsigned short MASK1[3] = { 0, 0x6000, 0 }; + static const unsigned short MASK2[4] = { 0xFFF0, 0xFF8F, 0xF0FF, 0x0FFF }; + static const unsigned short INDEX1[4] = { 1, 3, 5, 7 }; + static const unsigned short INDEX2[4] = { 0, 2, 4, 6 }; + unsigned short sync_div,dev_ctrl,dest_ctrl; + void *oldstack; + + if (dst==0) { + return; + } + + oldstack=(void *)Super(0); + + dev_ctrl = DMAAUDIO_IO.dev_ctrl; + dest_ctrl = DMAAUDIO_IO.dest_ctrl; + dev_ctrl &= MASK2[src]; + + if (src==ADC) { + dev_ctrl |= MASK1[sclk]; + } else { + dev_ctrl |= (INDEX1[sclk] << (src<<4)); + } + + if (dst & DMAREC) { + dest_ctrl &= 0xFFF0; + dest_ctrl |= INDEX1[src]; + } + + if (dst & DSPRECV) { + dest_ctrl &= 0xFF8F; + dest_ctrl |= (INDEX1[src]<<4); + } + + if (dst & EXTOUT) { + dest_ctrl &= 0xF0FF; + dest_ctrl |= (INDEX1[src]<<8); + } + + if (dst & DAC) { + dev_ctrl &= 0x0FFF; + dev_ctrl |= MASK1[sclk]; + dest_ctrl &= 0x0FFF; + dest_ctrl |= (INDEX2[src]<<12); + } + + sync_div = DMAAUDIO_IO.sync_div; + if (sclk==CLKEXT) { + pre<<=8; + sync_div &= 0xF0FF; + } else { + sync_div &= 0xFFF0; + } + sync_div |= pre; + + DMAAUDIO_IO.dev_ctrl = dev_ctrl; + DMAAUDIO_IO.dest_ctrl = dest_ctrl; + DMAAUDIO_IO.sync_div = sync_div; + + Super(oldstack); +} + +static void Mint_CheckExternalClock(_THIS) +{ +#define SIZE_BUF_CLOCK_MEASURE (44100/10) + + unsigned long cookie_snd; + char *buffer; + int i, j; + + /* DSP present with its GPIO port ? */ + if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) { + return; + } + if ((cookie_snd & SND_DSP)==0) { + return; + } + + buffer = Atari_SysMalloc(SIZE_BUF_CLOCK_MEASURE, MX_STRAM); + if (buffer==NULL) { + DEBUG_PRINT((DEBUG_NAME "Not enough memory for the measure\n")); + return; + } + SDL_memset(buffer, 0, SIZE_BUF_CLOCK_MEASURE); + + Buffoper(0); + Settracks(0,0); + Setmontracks(0); + Setmode(MONO8); + Jdisint(MFP_TIMERA); + + for (i=0; i<2; i++) { + Gpio(GPIO_SET,7); /* DSP port gpio outputs */ + Gpio(GPIO_WRITE,2+i); /* 22.5792/24.576 MHz for 44.1/48KHz */ + Devconnect2(DMAPLAY, DAC, CLKEXT, CLK50K); /* Matrix and clock source */ + Setbuffer(0, buffer, buffer + SIZE_BUF_CLOCK_MEASURE); /* Set buffer */ + Xbtimer(XB_TIMERA, 5, 38, SDL_MintAudio_XbiosInterruptMeasureClock); /* delay mode timer A, prediv /64, 1KHz */ + Jenabint(MFP_TIMERA); + SDL_MintAudio_clocktics = 0; + Buffoper(SB_PLA_ENA); + usleep(110000); + + if((Buffoper(-1) & 1)==0) { + if (SDL_MintAudio_clocktics) { + unsigned long khz; + + khz = ((SIZE_BUF_CLOCK_MEASURE/SDL_MintAudio_clocktics) +1) & 0xFFFFFFFE; + DEBUG_PRINT((DEBUG_NAME "measure %d: freq=%lu KHz\n", i+1, khz)); + + if(khz==44) { + for (j=1; j<4; j++) { + SDL_MintAudio_AddFrequency(this, MASTERCLOCK_44K/(MASTERPREDIV_FALCON*(1<format & 0x00ff)); + DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); + DEBUG_PRINT(("channels=%d, ", spec->channels)); + DEBUG_PRINT(("freq=%d\n", spec->freq)); + + if (spec->channels > 2) { + spec->channels = 2; /* no more than stereo! */ + } + + spec->format |= 0x8000; /* Audio is always signed */ + if ((spec->format & 0x00ff)==16) { + spec->format |= 0x1000; /* Audio is always big endian */ + spec->channels=2; /* 16 bits always stereo */ + } + + MINTAUDIO_freqcount=0; + + /* Add external clocks if present */ + Mint_CheckExternalClock(this); + + /* Standard clocks */ + for (i=1;i<12;i++) { + /* Remove unusable Falcon codec predivisors */ + if ((i==6) || (i==8) || (i==10)) { + continue; + } + SDL_MintAudio_AddFrequency(this, MASTERCLOCK_FALCON1/(MASTERPREDIV_FALCON*(i+1)), MASTERCLOCK_FALCON1, i, -1); + } + +#if 1 + for (i=0; ifreq); + spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; + + DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); + DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); + DEBUG_PRINT(("channels=%d, ", spec->channels)); + DEBUG_PRINT(("freq=%d\n", spec->freq)); + + return 0; +} + +static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec) +{ + int channels_mode, dmaclock, prediv; + void *buffer; + + /* Stop currently playing sound */ + SDL_MintAudio_quit_thread = SDL_FALSE; + SDL_MintAudio_thread_finished = SDL_TRUE; + SDL_MintAudio_WaitThread(); + Buffoper(0); + + /* Set replay tracks */ + Settracks(0,0); + Setmontracks(0); + + /* Select replay format */ + channels_mode=STEREO16; + switch (spec->format & 0xff) { + case 8: + if (spec->channels==2) { + channels_mode=STEREO8; + } else { + channels_mode=MONO8; + } + break; + } + if (Setmode(channels_mode)<0) { + DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n")); + } + + dmaclock = MINTAUDIO_frequencies[MINTAUDIO_numfreq].masterclock; + prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor; + if (MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits != -1) { + Gpio(GPIO_SET,7); /* DSP port gpio outputs */ + Gpio(GPIO_WRITE, MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits); + Devconnect2(DMAPLAY, DAC|EXTOUT, CLKEXT, prediv); + } else { + Devconnect2(DMAPLAY, DAC, CLK25M, prediv); + } + + /* Set buffer */ + buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; + if (Setbuffer(0, buffer, buffer + spec->size)<0) { + DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n")); + } + + if (SDL_MintAudio_mint_present) { + SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0); + } else { + /* Install interrupt */ + Jdisint(MFP_DMASOUND); + /*Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt);*/ + Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt); + Jenabint(MFP_DMASOUND); + + if (Setinterrupt(SI_TIMERA, SI_PLAY)<0) { + DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n")); + } + } + + /* Go */ + Buffoper(SB_PLA_ENA|SB_PLA_RPT); + DEBUG_PRINT((DEBUG_NAME "hardware initialized\n")); +} + +static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + /* Lock sound system */ + if (Locksnd()!=1) { + SDL_SetError("Mint_OpenAudio: Audio system already in use"); + return(-1); + } + + SDL_MintAudio_device = this; + + /* Check audio capabilities */ + if (Mint_CheckAudio(this, spec)==-1) { + return -1; + } + + SDL_CalculateAudioSpec(spec); + + /* Allocate memory for audio buffers in DMA-able RAM */ + DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); + + SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); + if (SDL_MintAudio_audiobuf[0]==NULL) { + SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer"); + return (-1); + } + SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ; + SDL_MintAudio_numbuf=0; + SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2); + SDL_MintAudio_audiosize = spec->size; + SDL_MintAudio_mutex = 0; + + DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0])); + DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1])); + + SDL_MintAudio_CheckFpu(); + + /* Setup audio hardware */ + Mint_InitAudio(this, spec); + + return(1); /* We don't use SDL threaded audio */ +} diff --git a/SDL/src/audio/mme/SDL_mmeaudio.c b/SDL/src/audio/mme/SDL_mmeaudio.c new file mode 100644 index 0000000..b8d8638 --- /dev/null +++ b/SDL/src/audio/mme/SDL_mmeaudio.c @@ -0,0 +1,264 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Tru64 UNIX MME support */ +#include + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "SDL_mmeaudio.h" + +static BOOL inUse[NUM_BUFFERS]; + +/* Audio driver functions */ +static int MME_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void MME_WaitAudio(_THIS); +static Uint8 *MME_GetAudioBuf(_THIS); +static void MME_PlayAudio(_THIS); +static void MME_WaitDone(_THIS); +static void MME_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ +static int Audio_Available(void) +{ + return(1); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + if ( device ) { + if ( device->hidden ) { + SDL_free(device->hidden); + device->hidden = NULL; + } + SDL_free(device); + device = NULL; + } +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + +/* Initialize all variables that we clean on shutdown */ + this = SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + /* Set the function pointers */ + this->OpenAudio = MME_OpenAudio; + this->WaitAudio = MME_WaitAudio; + this->PlayAudio = MME_PlayAudio; + this->GetAudioBuf = MME_GetAudioBuf; + this->WaitDone = MME_WaitDone; + this->CloseAudio = MME_CloseAudio; + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap MMEAUDIO_bootstrap = { + "waveout", "Tru64 MME WaveOut", + Audio_Available, Audio_CreateDevice +}; + +static void SetMMerror(char *function, MMRESULT code) +{ + int len; + char errbuf[MAXERRORLENGTH]; + + SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function); + len = SDL_strlen(errbuf); + waveOutGetErrorText(code, errbuf+len, MAXERRORLENGTH-len); + SDL_SetError("%s",errbuf); +} + +static void CALLBACK MME_CALLBACK(HWAVEOUT hwo, + UINT uMsg, + DWORD dwInstance, + LPARAM dwParam1, + LPARAM dwParam2) +{ + WAVEHDR *wp = (WAVEHDR *) dwParam1; + + if ( uMsg == WOM_DONE ) + inUse[wp->dwUser] = FALSE; +} + +static int MME_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + MMRESULT result; + int i; + + mixbuf = NULL; + + /* Set basic WAVE format parameters */ + shm = mmeAllocMem(sizeof(*shm)); + if ( shm == NULL ) { + SDL_SetError("Out of memory: shm"); + return(-1); + } + shm->sound = 0; + shm->wFmt.wf.wFormatTag = WAVE_FORMAT_PCM; + + /* Determine the audio parameters from the AudioSpec */ + switch ( spec->format & 0xFF ) { + case 8: + /* Unsigned 8 bit audio data */ + spec->format = AUDIO_U8; + shm->wFmt.wBitsPerSample = 8; + break; + case 16: + /* Signed 16 bit audio data */ + spec->format = AUDIO_S16; + shm->wFmt.wBitsPerSample = 16; + break; + default: + SDL_SetError("Unsupported audio format"); + return(-1); + } + + shm->wFmt.wf.nChannels = spec->channels; + shm->wFmt.wf.nSamplesPerSec = spec->freq; + shm->wFmt.wf.nBlockAlign = + shm->wFmt.wf.nChannels * shm->wFmt.wBitsPerSample / 8; + shm->wFmt.wf.nAvgBytesPerSec = + shm->wFmt.wf.nSamplesPerSec * shm->wFmt.wf.nBlockAlign; + + /* Check the buffer size -- minimum of 1/4 second (word aligned) */ + if ( spec->samples < (spec->freq/4) ) + spec->samples = ((spec->freq/4)+3)&~3; + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(spec); + + /* Open the audio device */ + result = waveOutOpen(&(shm->sound), + WAVE_MAPPER, + &(shm->wFmt.wf), + MME_CALLBACK, + NULL, + (CALLBACK_FUNCTION|WAVE_OPEN_SHAREABLE)); + if ( result != MMSYSERR_NOERROR ) { + SetMMerror("waveOutOpen()", result); + return(-1); + } + + /* Create the sound buffers */ + mixbuf = (Uint8 *)mmeAllocBuffer(NUM_BUFFERS * (spec->size)); + if ( mixbuf == NULL ) { + SDL_SetError("Out of memory: mixbuf"); + return(-1); + } + + for (i = 0; i < NUM_BUFFERS; i++) { + shm->wHdr[i].lpData = &mixbuf[i * (spec->size)]; + shm->wHdr[i].dwBufferLength = spec->size; + shm->wHdr[i].dwFlags = 0; + shm->wHdr[i].dwUser = i; + shm->wHdr[i].dwLoops = 0; /* loop control counter */ + shm->wHdr[i].lpNext = NULL; /* reserved for driver */ + shm->wHdr[i].reserved = 0; + inUse[i] = FALSE; + } + next_buffer = 0; + return 0; +} + +static void MME_WaitAudio(_THIS) +{ + while ( inUse[next_buffer] ) { + mmeWaitForCallbacks(); + mmeProcessCallbacks(); + } +} + +static Uint8 *MME_GetAudioBuf(_THIS) +{ + Uint8 *retval; + + inUse[next_buffer] = TRUE; + retval = (Uint8 *)(shm->wHdr[next_buffer].lpData); + return retval; +} + +static void MME_PlayAudio(_THIS) +{ + /* Queue it up */ + waveOutWrite(shm->sound, &(shm->wHdr[next_buffer]), sizeof(WAVEHDR)); + next_buffer = (next_buffer+1)%NUM_BUFFERS; +} + +static void MME_WaitDone(_THIS) +{ + MMRESULT result; + int i; + + if ( shm->sound ) { + for (i = 0; i < NUM_BUFFERS; i++) + while ( inUse[i] ) { + mmeWaitForCallbacks(); + mmeProcessCallbacks(); + } + result = waveOutReset(shm->sound); + if ( result != MMSYSERR_NOERROR ) + SetMMerror("waveOutReset()", result); + mmeProcessCallbacks(); + } +} + +static void MME_CloseAudio(_THIS) +{ + MMRESULT result; + + if ( mixbuf ) { + result = mmeFreeBuffer(mixbuf); + if (result != MMSYSERR_NOERROR ) + SetMMerror("mmeFreeBuffer", result); + mixbuf = NULL; + } + + if ( shm ) { + if ( shm->sound ) { + result = waveOutClose(shm->sound); + if (result != MMSYSERR_NOERROR ) + SetMMerror("waveOutClose()", result); + mmeProcessCallbacks(); + } + result = mmeFreeMem(shm); + if (result != MMSYSERR_NOERROR ) + SetMMerror("mmeFreeMem()", result); + shm = NULL; + } +} + diff --git a/SDL/src/audio/mme/SDL_mmeaudio.h b/SDL/src/audio/mme/SDL_mmeaudio.h new file mode 100644 index 0000000..3dbaf06 --- /dev/null +++ b/SDL/src/audio/mme/SDL_mmeaudio.h @@ -0,0 +1,51 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Allow access to a raw mixing buffer */ + +#ifndef _SDL_lowaudio_h +#define _SDL_lowaudio_h + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this +#define NUM_BUFFERS 2 + +struct SharedMem { + HWAVEOUT sound; + WAVEHDR wHdr[NUM_BUFFERS]; + PCMWAVEFORMAT wFmt; +}; + +struct SDL_PrivateAudioData { + Uint8 *mixbuf; /* The raw allocated mixing buffer */ + struct SharedMem *shm; + int next_buffer; +}; + +#define shm (this->hidden->shm) +#define mixbuf (this->hidden->mixbuf) +#define next_buffer (this->hidden->next_buffer) +/* Old variable names */ +#endif /* _SDL_lowaudio_h */ diff --git a/SDL/src/audio/nas/SDL_nasaudio.c b/SDL/src/audio/nas/SDL_nasaudio.c new file mode 100644 index 0000000..213b2f4 --- /dev/null +++ b/SDL/src/audio/nas/SDL_nasaudio.c @@ -0,0 +1,299 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org + + This driver was written by: + Erik Inge Bolsø + knan@mo.himolde.no +*/ +#include "SDL_config.h" + +/* Allow access to a raw mixing buffer */ + +#include +#include + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audiomem.h" +#include "../SDL_audio_c.h" +#include "../SDL_audiodev_c.h" +#include "SDL_nasaudio.h" + +/* The tag name used by artsc audio */ +#define NAS_DRIVER_NAME "nas" + +static struct SDL_PrivateAudioData *this2 = NULL; + +/* Audio driver functions */ +static int NAS_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void NAS_WaitAudio(_THIS); +static void NAS_PlayAudio(_THIS); +static Uint8 *NAS_GetAudioBuf(_THIS); +static void NAS_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + AuServer *aud = AuOpenServer("", 0, NULL, 0, NULL, NULL); + if (!aud) return 0; + + AuCloseServer(aud); + return 1; +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + SDL_free(device->hidden); + SDL_free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + SDL_memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + SDL_free(this); + } + return(0); + } + SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = NAS_OpenAudio; + this->WaitAudio = NAS_WaitAudio; + this->PlayAudio = NAS_PlayAudio; + this->GetAudioBuf = NAS_GetAudioBuf; + this->CloseAudio = NAS_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap NAS_bootstrap = { + NAS_DRIVER_NAME, "Network Audio System", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void NAS_WaitAudio(_THIS) +{ + while ( this->hidden->buf_free < this->hidden->mixlen ) { + AuEvent ev; + AuNextEvent(this->hidden->aud, AuTrue, &ev); + AuDispatchEvent(this->hidden->aud, &ev); + } +} + +static void NAS_PlayAudio(_THIS) +{ + while (this->hidden->mixlen > this->hidden->buf_free) { /* We think the buffer is full? Yikes! Ask the server for events, + in the hope that some of them is LowWater events telling us more + of the buffer is free now than what we think. */ + AuEvent ev; + AuNextEvent(this->hidden->aud, AuTrue, &ev); + AuDispatchEvent(this->hidden->aud, &ev); + } + this->hidden->buf_free -= this->hidden->mixlen; + + /* Write the audio data */ + AuWriteElement(this->hidden->aud, this->hidden->flow, 0, this->hidden->mixlen, this->hidden->mixbuf, AuFalse, NULL); + + this->hidden->written += this->hidden->mixlen; + +#ifdef DEBUG_AUDIO + fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen); +#endif +} + +static Uint8 *NAS_GetAudioBuf(_THIS) +{ + return(this->hidden->mixbuf); +} + +static void NAS_CloseAudio(_THIS) +{ + if ( this->hidden->mixbuf != NULL ) { + SDL_FreeAudioMem(this->hidden->mixbuf); + this->hidden->mixbuf = NULL; + } + if ( this->hidden->aud ) { + AuCloseServer(this->hidden->aud); + this->hidden->aud = 0; + } +} + +static unsigned char sdlformat_to_auformat(unsigned int fmt) +{ + switch (fmt) + { + case AUDIO_U8: + return AuFormatLinearUnsigned8; + case AUDIO_S8: + return AuFormatLinearSigned8; + case AUDIO_U16LSB: + return AuFormatLinearUnsigned16LSB; + case AUDIO_U16MSB: + return AuFormatLinearUnsigned16MSB; + case AUDIO_S16LSB: + return AuFormatLinearSigned16LSB; + case AUDIO_S16MSB: + return AuFormatLinearSigned16MSB; + } + return AuNone; +} + +static AuBool +event_handler(AuServer* aud, AuEvent* ev, AuEventHandlerRec* hnd) +{ + switch (ev->type) { + case AuEventTypeElementNotify: { + AuElementNotifyEvent* event = (AuElementNotifyEvent *)ev; + + switch (event->kind) { + case AuElementNotifyKindLowWater: + if (this2->buf_free >= 0) { + this2->really += event->num_bytes; + gettimeofday(&this2->last_tv, 0); + this2->buf_free += event->num_bytes; + } else { + this2->buf_free = event->num_bytes; + } + break; + case AuElementNotifyKindState: + switch (event->cur_state) { + case AuStatePause: + if (event->reason != AuReasonUser) { + if (this2->buf_free >= 0) { + this2->really += event->num_bytes; + gettimeofday(&this2->last_tv, 0); + this2->buf_free += event->num_bytes; + } else { + this2->buf_free = event->num_bytes; + } + } + break; + } + } + } + } + return AuTrue; +} + +static AuDeviceID +find_device(_THIS, int nch) +{ + int i; + for (i = 0; i < AuServerNumDevices(this->hidden->aud); i++) { + if ((AuDeviceKind(AuServerDevice(this->hidden->aud, i)) == + AuComponentKindPhysicalOutput) && + AuDeviceNumTracks(AuServerDevice(this->hidden->aud, i)) == nch) { + return AuDeviceIdentifier(AuServerDevice(this->hidden->aud, i)); + } + } + return AuNone; +} + +static int NAS_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + AuElement elms[3]; + int buffer_size; + Uint16 test_format, format; + + this->hidden->mixbuf = NULL; + + /* Try for a closest match on audio format */ + format = 0; + for ( test_format = SDL_FirstAudioFormat(spec->format); + ! format && test_format; ) { + format = sdlformat_to_auformat(test_format); + + if (format == AuNone) { + test_format = SDL_NextAudioFormat(); + } + } + if ( format == 0 ) { + SDL_SetError("Couldn't find any hardware audio formats"); + return(-1); + } + spec->format = test_format; + + this->hidden->aud = AuOpenServer("", 0, NULL, 0, NULL, NULL); + if (this->hidden->aud == 0) + { + SDL_SetError("Couldn't open connection to NAS server"); + return (-1); + } + + this->hidden->dev = find_device(this, spec->channels); + if ((this->hidden->dev == AuNone) || (!(this->hidden->flow = AuCreateFlow(this->hidden->aud, NULL)))) { + AuCloseServer(this->hidden->aud); + this->hidden->aud = 0; + SDL_SetError("Couldn't find a fitting playback device on NAS server"); + return (-1); + } + + buffer_size = spec->freq; + if (buffer_size < 4096) + buffer_size = 4096; + + if (buffer_size > 32768) + buffer_size = 32768; /* So that the buffer won't get unmanageably big. */ + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + this2 = this->hidden; + + AuMakeElementImportClient(elms, spec->freq, format, spec->channels, AuTrue, + buffer_size, buffer_size / 4, 0, NULL); + AuMakeElementExportDevice(elms+1, 0, this->hidden->dev, spec->freq, + AuUnlimitedSamples, 0, NULL); + AuSetElements(this->hidden->aud, this->hidden->flow, AuTrue, 2, elms, NULL); + AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0, this->hidden->flow, + event_handler, (AuPointer) NULL); + + AuStartFlow(this->hidden->aud, this->hidden->flow, NULL); + + /* Allocate mixing buffer */ + this->hidden->mixlen = spec->size; + this->hidden->mixbuf = (Uint8 *)SDL_AllocAudioMem(this->hidden->mixlen); + if ( this->hidden->mixbuf == NULL ) { + return(-1); + } + SDL_memset(this->hidden->mixbuf, spec->silence, spec->size); + + /* Get the parent process id (we're the parent of the audio thread) */ + this->hidden->parent = getpid(); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff --git a/SDL/src/audio/nas/SDL_nasaudio.h b/SDL/src/audio/nas/SDL_nasaudio.h new file mode 100644 index 0000000..dff41c5 --- /dev/null +++ b/SDL/src/audio/nas/SDL_nasaudio.h @@ -0,0 +1,62 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org + + This driver was written by: + Erik Inge Bolsø + knan@mo.himolde.no +*/ +#include "SDL_config.h" + +#ifndef _SDL_nasaudio_h +#define _SDL_nasaudio_h + +#ifdef __sgi +#include +#else +#include