Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Explicitly specify the SDL API calling convention (C by default)
  • Loading branch information
slouken committed Apr 11, 2002
1 parent a17946b commit 5fd81ce
Show file tree
Hide file tree
Showing 24 changed files with 200 additions and 195 deletions.
10 changes: 5 additions & 5 deletions include/SDL.h
Expand Up @@ -69,24 +69,24 @@ extern "C" {
* Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
* signal handlers for some commonly ignored fatal signals (like SIGSEGV)
*/
extern DECLSPEC int SDL_Init(Uint32 flags);
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);

/* This function initializes specific SDL subsystems */
extern DECLSPEC int SDL_InitSubSystem(Uint32 flags);
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);

/* This function cleans up specific SDL subsystems */
extern DECLSPEC void SDL_QuitSubSystem(Uint32 flags);
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);

/* This function returns mask of the specified subsystems which have
been initialized.
If 'flags' is 0, it returns a mask of all initialized subsystems.
*/
extern DECLSPEC Uint32 SDL_WasInit(Uint32 flags);
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);

/* This function cleans up all initialized subsystems and unloads the
* dynamically linked library. You should call it upon all exit conditions.
*/
extern DECLSPEC void SDL_Quit(void);
extern DECLSPEC void SDLCALL SDL_Quit(void);

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_active.h
Expand Up @@ -48,7 +48,7 @@ extern "C" {
* SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to
* see your application, otherwise it has been iconified or disabled.
*/
extern DECLSPEC Uint8 SDL_GetAppState(void);
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);


/* Ends C function definitions when using C++ */
Expand Down
29 changes: 14 additions & 15 deletions include/SDL_audio.h
Expand Up @@ -105,14 +105,14 @@ typedef struct SDL_AudioCVT {
* have a specific need to specify the audio driver you want to use.
* You should normally use SDL_Init() or SDL_InitSubSystem().
*/
extern DECLSPEC int SDL_AudioInit(const char *driver_name);
extern DECLSPEC void SDL_AudioQuit(void);
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
extern DECLSPEC void SDLCALL SDL_AudioQuit(void);

/* This function fills the given character buffer with the name of the
* current audio driver, and returns a pointer to it if the audio driver has
* been initialized. It returns NULL if no driver has been initialized.
*/
extern DECLSPEC char *SDL_AudioDriverName(char *namebuf, int maxlen);
extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);

/*
* This function opens the audio device with the desired parameters, and
Expand Down Expand Up @@ -155,7 +155,7 @@ extern DECLSPEC char *SDL_AudioDriverName(char *namebuf, int maxlen);
* may modify the requested size of the audio buffer, you should allocate
* any local mixing buffers after you open the audio device.
*/
extern DECLSPEC int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);

/*
* Get the current audio state:
Expand All @@ -165,7 +165,7 @@ typedef enum {
SDL_AUDIO_PLAYING,
SDL_AUDIO_PAUSED
} SDL_audiostatus;
extern DECLSPEC SDL_audiostatus SDL_GetAudioStatus(void);
extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);

/*
* This function pauses and unpauses the audio callback processing.
Expand All @@ -174,7 +174,7 @@ extern DECLSPEC SDL_audiostatus SDL_GetAudioStatus(void);
* data for your callback function after opening the audio device.
* Silence will be written to the audio device during the pause.
*/
extern DECLSPEC void SDL_PauseAudio(int pause_on);
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);

/*
* This function loads a WAVE from the data source, automatically freeing
Expand All @@ -193,8 +193,7 @@ extern DECLSPEC void SDL_PauseAudio(int pause_on);
* wave file cannot be opened, uses an unknown data format, or is
* corrupt. Currently raw and MS-ADPCM WAVE files are supported.
*/
extern DECLSPEC SDL_AudioSpec *SDL_LoadWAV_RW(SDL_RWops *src, int freesrc,
SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);

/* Compatibility convenience function -- loads a WAV from a file */
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
Expand All @@ -203,7 +202,7 @@ extern DECLSPEC SDL_AudioSpec *SDL_LoadWAV_RW(SDL_RWops *src, int freesrc,
/*
* This function frees data previously allocated with SDL_LoadWAV_RW()
*/
extern DECLSPEC void SDL_FreeWAV(Uint8 *audio_buf);
extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);

/*
* This function takes a source format and rate and a destination format
Expand All @@ -212,7 +211,7 @@ extern DECLSPEC void SDL_FreeWAV(Uint8 *audio_buf);
* to the other.
* This function returns 0, or -1 if there was an error.
*/
extern DECLSPEC int SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
Uint16 src_format, Uint8 src_channels, int src_rate,
Uint16 dst_format, Uint8 dst_channels, int dst_rate);

Expand All @@ -224,7 +223,7 @@ extern DECLSPEC int SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
* cvt->buf should be allocated after the cvt structure is initialized by
* SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long.
*/
extern DECLSPEC int SDL_ConvertAudio(SDL_AudioCVT *cvt);
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);

/*
* This takes two audio buffers of the playing audio format and mixes
Expand All @@ -234,21 +233,21 @@ extern DECLSPEC int SDL_ConvertAudio(SDL_AudioCVT *cvt);
* This is provided for convenience -- you can mix your own audio data.
*/
#define SDL_MIX_MAXVOLUME 128
extern DECLSPEC void SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);

/*
* The lock manipulated by these functions protects the callback function.
* During a LockAudio/UnlockAudio pair, you can be guaranteed that the
* callback function is not running. Do not call these from the callback
* function or you will cause deadlock.
*/
extern DECLSPEC void SDL_LockAudio(void);
extern DECLSPEC void SDL_UnlockAudio(void);
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);

/*
* This function shuts down audio processing and closes the audio device.
*/
extern DECLSPEC void SDL_CloseAudio(void);
extern DECLSPEC void SDLCALL SDL_CloseAudio(void);


/* Ends C function definitions when using C++ */
Expand Down
22 changes: 11 additions & 11 deletions include/SDL_cdrom.h
Expand Up @@ -99,29 +99,29 @@ typedef struct SDL_CD {
/* Returns the number of CD-ROM drives on the system, or -1 if
SDL_Init() has not been called with the SDL_INIT_CDROM flag.
*/
extern DECLSPEC int SDL_CDNumDrives(void);
extern DECLSPEC int SDLCALL SDL_CDNumDrives(void);

/* Returns a human-readable, system-dependent identifier for the CD-ROM.
Example:
"/dev/cdrom"
"E:"
"/dev/disk/ide/1/master"
*/
extern DECLSPEC const char * SDL_CDName(int drive);
extern DECLSPEC const char * SDLCALL SDL_CDName(int drive);

/* Opens a CD-ROM drive for access. It returns a drive handle 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.
*/
extern DECLSPEC SDL_CD * SDL_CDOpen(int drive);
extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive);

/* This function returns the current status of the given drive.
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.
*/
extern DECLSPEC CDstatus SDL_CDStatus(SDL_CD *cdrom);
extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom);

/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
Expand All @@ -142,28 +142,28 @@ extern DECLSPEC CDstatus SDL_CDStatus(SDL_CD *cdrom);
This function returns 0, or -1 if there was an error.
*/
extern DECLSPEC int SDL_CDPlayTracks(SDL_CD *cdrom,
extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom,
int start_track, int start_frame, int ntracks, int nframes);

/* Play the given CD starting at 'start' frame for 'length' frames.
It returns 0, or -1 if there was an error.
*/
extern DECLSPEC int SDL_CDPlay(SDL_CD *cdrom, int start, int length);
extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length);

/* Pause play -- returns 0, or -1 on error */
extern DECLSPEC int SDL_CDPause(SDL_CD *cdrom);
extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom);

/* Resume play -- returns 0, or -1 on error */
extern DECLSPEC int SDL_CDResume(SDL_CD *cdrom);
extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom);

/* Stop play -- returns 0, or -1 on error */
extern DECLSPEC int SDL_CDStop(SDL_CD *cdrom);
extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom);

/* Eject CD-ROM -- returns 0, or -1 on error */
extern DECLSPEC int SDL_CDEject(SDL_CD *cdrom);
extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom);

/* Closes the handle for the CD-ROM drive */
extern DECLSPEC void SDL_CDClose(SDL_CD *cdrom);
extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom);


/* Ends C function definitions when using C++ */
Expand Down
24 changes: 12 additions & 12 deletions include/SDL_endian.h
Expand Up @@ -124,20 +124,20 @@ static __inline__ Uint64 SDL_Swap64(Uint64 val) {
#endif

/* Read an item of the specified endianness and return in native format */
extern DECLSPEC Uint16 SDL_ReadLE16(SDL_RWops *src);
extern DECLSPEC Uint16 SDL_ReadBE16(SDL_RWops *src);
extern DECLSPEC Uint32 SDL_ReadLE32(SDL_RWops *src);
extern DECLSPEC Uint32 SDL_ReadBE32(SDL_RWops *src);
extern DECLSPEC Uint64 SDL_ReadLE64(SDL_RWops *src);
extern DECLSPEC Uint64 SDL_ReadBE64(SDL_RWops *src);
extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);

/* Write an item of native format to the specified endianness */
extern DECLSPEC int SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
extern DECLSPEC int SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
extern DECLSPEC int SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
extern DECLSPEC int SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
extern DECLSPEC int SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
extern DECLSPEC int SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);


/* Ends C function definitions when using C++ */
Expand Down
6 changes: 3 additions & 3 deletions include/SDL_error.h
Expand Up @@ -37,9 +37,9 @@ extern "C" {
#endif

/* Public functions */
extern DECLSPEC void SDL_SetError(const char *fmt, ...);
extern DECLSPEC char * SDL_GetError(void);
extern DECLSPEC void SDL_ClearError(void);
extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
extern DECLSPEC char * SDLCALL SDL_GetError(void);
extern DECLSPEC void SDLCALL SDL_ClearError(void);

/* Private error message function - used internally */
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
Expand Down
16 changes: 8 additions & 8 deletions include/SDL_events.h
Expand Up @@ -238,7 +238,7 @@ typedef union {
This function updates the event queue and internal input device state.
This should only be run in the thread that sets the video mode.
*/
extern DECLSPEC void SDL_PumpEvents(void);
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);

/* Checks the event queue for messages and optionally returns them.
If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
Expand All @@ -258,26 +258,26 @@ typedef enum {
SDL_GETEVENT
} SDL_eventaction;
/* */
extern DECLSPEC int SDL_PeepEvents(SDL_Event *events, int numevents,
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
SDL_eventaction action, Uint32 mask);

/* 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.
*/
extern DECLSPEC int SDL_PollEvent(SDL_Event *event);
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);

/* 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.
*/
extern DECLSPEC int SDL_WaitEvent(SDL_Event *event);
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);

/* Add an event to the event queue.
This function returns 0 if the event queue was full, or -1
if there was some other error. Returns 1 on success.
*/
extern DECLSPEC int SDL_PushEvent(SDL_Event *event);
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);

/*
This function sets up a filter to process all events before they
Expand All @@ -302,13 +302,13 @@ typedef int (*SDL_EventFilter)(const SDL_Event *event);
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.
*/
extern DECLSPEC void SDL_SetEventFilter(SDL_EventFilter filter);
extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);

/*
Return the current event filter - can be used to "chain" filters.
If there is no event filter set, this function returns NULL.
*/
extern DECLSPEC SDL_EventFilter SDL_GetEventFilter(void);
extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);

/*
This function allows you to set the state of processing certain events.
Expand All @@ -322,7 +322,7 @@ extern DECLSPEC SDL_EventFilter SDL_GetEventFilter(void);
#define SDL_IGNORE 0
#define SDL_DISABLE 0
#define SDL_ENABLE 1
extern DECLSPEC Uint8 SDL_EventState(Uint8 type, int state);
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);


/* Ends C function definitions when using C++ */
Expand Down
4 changes: 2 additions & 2 deletions include/SDL_getenv.h
Expand Up @@ -14,11 +14,11 @@ extern "C" {
#endif

/* Put a variable of the form "name=value" into the environment */
extern DECLSPEC int SDL_putenv(const char *variable);
extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
#define putenv(X) SDL_putenv(X)

/* Retrieve a variable named "name" from the environment */
extern DECLSPEC char *SDL_getenv(const char *name);
extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
#define getenv(X) SDL_getenv(X)

/* Ends C function definitions when using C++ */
Expand Down

0 comments on commit 5fd81ce

Please sign in to comment.