Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
package SDL::Version; | |||
use strict; | |||
use warnings; | |||
require Exporter; | |||
require DynaLoader; | |||
our @ISA = qw(Exporter DynaLoader); | |||
bootstrap SDL::Version; | |||
|
|||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,49 @@ | |||
#include "EXTERN.h" | |||
#include "perl.h" | |||
#include "XSUB.h" | |||
|
|||
#ifndef aTHX_ | |||
#define aTHX_ | |||
#endif | |||
|
|||
#include <SDL.h> | |||
#include <SDL_version.h> | |||
|
|||
MODULE = SDL::Version PACKAGE = SDL::Version PREFIX = version_ | |||
|
|||
=for documentation | |||
|
|||
SDL_Version -- Version structure | |||
|
|||
typedef struct SDL_version { | |||
Uint8 major; | |||
Uint8 minor; | |||
Uint8 patch; | |||
} SDL_version; | |||
|
|||
=cut | |||
|
|||
Uint8 | |||
version_major ( version, ... ) | |||
SDL_version *version | |||
CODE: | |||
RETVAL = version->major; | |||
OUTPUT: | |||
RETVAL | |||
|
|||
Uint8 | |||
version_minor ( version, ... ) | |||
SDL_version *version | |||
CODE: | |||
RETVAL = version->minor; | |||
OUTPUT: | |||
RETVAL | |||
|
|||
Uint8 | |||
version_patch ( version, ... ) | |||
SDL_version *version | |||
CODE: | |||
RETVAL = version->patch; | |||
OUTPUT: | |||
RETVAL | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
#!/usr/bin/perl -w | |||
use strict; | |||
use SDL; | |||
use SDL::Version; | |||
use Test::More tests => 8; | |||
|
|||
my $version = SDL::version(); | |||
isa_ok( $version, 'SDL::Version' ); | |||
like( $version->major, qr/^\d+$/, 'Compile-time version major is a number' ); | |||
like( $version->minor, qr/^\d+$/, 'Compile-time version minor is a number' ); | |||
like( $version->patch, qr/^\d+$/, 'Compile-time version patch is a number' ); | |||
|
|||
my $linked_version = SDL::linked_version(); | |||
isa_ok( $linked_version, 'SDL::Version' ); | |||
like( $linked_version->major, qr/^\d+$/, | |||
'Link-time version major is a number' ); | |||
like( $linked_version->minor, qr/^\d+$/, | |||
'Link-time version minor is a number' ); | |||
like( $linked_version->patch, qr/^\d+$/, | |||
'Link-time version patch is a number' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters