Updated for SDL3 version changes

main
Sam Lantinga 2024-05-15 13:16:44 -07:00
parent 39c611e573
commit bf7520195f
5 changed files with 36 additions and 44 deletions

View File

@ -7,7 +7,7 @@ mainincludefname = SDL3_rtf/SDL_rtf.h
versionfname = include/SDL3_rtf/SDL_rtf.h
versionmajorregex = \A\#define\s+SDL_RTF_MAJOR_VERSION\s+(\d+)\Z
versionminorregex = \A\#define\s+SDL_RTF_MINOR_VERSION\s+(\d+)\Z
versionpatchregex = \A\#define\s+SDL_RTF_PATCHLEVEL\s+(\d+)\Z
versionmicroregex = \A\#define\s+SDL_RTF_MICRO_VERSION\s+(\d+)\Z
selectheaderregex = \ASDL_rtf\.h\Z
projecturl = https://libsdl.org/projects/SDL_rtf
wikiurl = https://wiki.libsdl.org/SDL_rtf

View File

@ -11,7 +11,7 @@ export LC_CTYPE=C
ref_major=$(sed -ne 's/^#define SDL_RTF_MAJOR_VERSION *//p' include/SDL3_rtf/SDL_rtf.h)
ref_minor=$(sed -ne 's/^#define SDL_RTF_MINOR_VERSION *//p' include/SDL3_rtf/SDL_rtf.h)
ref_micro=$(sed -ne 's/^#define SDL_RTF_PATCHLEVEL *//p' include/SDL3_rtf/SDL_rtf.h)
ref_micro=$(sed -ne 's/^#define SDL_RTF_MICRO_VERSION *//p' include/SDL3_rtf/SDL_rtf.h)
ref_version="${ref_major}.${ref_minor}.${ref_micro}"
tests=0

View File

@ -16,7 +16,7 @@ my $apiprefixregex = undef;
my $versionfname = 'include/SDL_version.h';
my $versionmajorregex = '\A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z';
my $versionminorregex = '\A\#define\s+SDL_MINOR_VERSION\s+(\d+)\Z';
my $versionpatchregex = '\A\#define\s+SDL_PATCHLEVEL\s+(\d+)\Z';
my $versionmicroregex = '\A\#define\s+SDL_MICRO_VERSION\s+(\d+)\Z';
my $mainincludefname = 'SDL.h';
my $selectheaderregex = '\ASDL.*?\.h\Z';
my $projecturl = 'https://libsdl.org/';
@ -92,7 +92,7 @@ if (defined $optionsfname) {
$readmesubdir = $val, next if $key eq 'readmesubdir';
$versionmajorregex = $val, next if $key eq 'versionmajorregex';
$versionminorregex = $val, next if $key eq 'versionminorregex';
$versionpatchregex = $val, next if $key eq 'versionpatchregex';
$versionmicroregex = $val, next if $key eq 'versionmicroregex';
$versionfname = $val, next if $key eq 'versionfname';
$mainincludefname = $val, next if $key eq 'mainincludefname';
$selectheaderregex = $val, next if $key eq 'selectheaderregex';
@ -2036,19 +2036,19 @@ if ($copy_direction == 1) { # --copy-to-headers
open(FH, '<', "$srcpath/$versionfname") or die("Can't open '$srcpath/$versionfname': $!\n");
my $majorver = 0;
my $minorver = 0;
my $patchver = 0;
my $microver = 0;
while (<FH>) {
chomp;
if (/$versionmajorregex/) {
$majorver = int($1);
} elsif (/$versionminorregex/) {
$minorver = int($1);
} elsif (/$versionpatchregex/) {
$patchver = int($1);
} elsif (/$versionmicroregex/) {
$microver = int($1);
}
}
close(FH);
my $fullversion = "$majorver.$minorver.$patchver";
my $fullversion = "$majorver.$minorver.$microver";
foreach (keys %headersyms) {
my $sym = $_;
@ -2318,19 +2318,19 @@ if ($copy_direction == 1) { # --copy-to-headers
open(FH, '<', "$srcpath/$versionfname") or die("Can't open '$srcpath/$versionfname': $!\n");
my $majorver = 0;
my $minorver = 0;
my $patchver = 0;
my $microver = 0;
while (<FH>) {
chomp;
if (/$versionmajorregex/) {
$majorver = int($1);
} elsif (/$versionminorregex/) {
$minorver = int($1);
} elsif (/$versionpatchregex/) {
$patchver = int($1);
} elsif (/$versionmicroregex/) {
$microver = int($1);
}
}
close(FH);
my $fullversion = "$majorver.$minorver.$patchver";
my $fullversion = "$majorver.$minorver.$microver";
my $latex_fname = "$srcpath/$projectshortname.tex";
my $latex_tmpfname = "$latex_fname.tmp";
@ -2369,7 +2369,7 @@ if ($copy_direction == 1) { # --copy-to-headers
\\begin{document}
\\frontmatter
\\title{$projectfullname $majorver.$minorver.$patchver Reference Manual}
\\title{$projectfullname $majorver.$minorver.$microver Reference Manual}
\\author{The $projectshortname Developers}
\\maketitle

View File

@ -32,42 +32,36 @@
extern "C" {
#endif
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
/**
* Printable format: "%d.%d.%d", MAJOR, MINOR, MICRO
*/
#define SDL_RTF_MAJOR_VERSION 3
#define SDL_RTF_MINOR_VERSION 0
#define SDL_RTF_PATCHLEVEL 0
/* This macro can be used to fill a version structure with the compile-time
* version of the SDL_rtf library.
*/
#define SDL_RTF_VERSION(X) \
{ \
(X)->major = SDL_RTF_MAJOR_VERSION; \
(X)->minor = SDL_RTF_MINOR_VERSION; \
(X)->patch = SDL_RTF_PATCHLEVEL; \
}
/* Backwards compatibility */
#define RTF_MAJOR_VERSION SDL_RTF_MAJOR_VERSION
#define RTF_MINOR_VERSION SDL_RTF_MINOR_VERSION
#define RTF_PATCHLEVEL SDL_RTF_PATCHLEVEL
#define RTF_VERSION(X) SDL_RTF_VERSION(X)
#define SDL_RTF_MICRO_VERSION 0
/**
* This is the version number macro for the current SDL_rtf version.
*/
#define SDL_RTF_VERSION \
SDL_VERSIONNUM(SDL_RTF_MAJOR_VERSION, SDL_RTF_MINOR_VERSION, SDL_RTF_MICRO_VERSION)
/**
* This macro will evaluate to true if compiled with SDL_rtf at least X.Y.Z.
*/
#define SDL_RTF_VERSION_ATLEAST(X, Y, Z) \
((SDL_RTF_MAJOR_VERSION >= X) && \
(SDL_RTF_MAJOR_VERSION > X || SDL_RTF_MINOR_VERSION >= Y) && \
(SDL_RTF_MAJOR_VERSION > X || SDL_RTF_MINOR_VERSION > Y || SDL_RTF_MICRO_VERSION >= Z))
/**
* Query the version of SDL_rtf that the program is linked against.
*
* This function gets the version of the dynamically linked SDL_rtf library.
* This is separate from the SDL_RTF_VERSION() macro, which tells you what
* version of the SDL_rtf headers you compiled against.
*
* This returns static internal data; do not free or modify it!
*
* \returns a pointer to the version information.
* \returns SDL_rtf version
*
* \since This function is available since SDL_rtf 3.0.0.
*/
extern DECLSPEC const SDL_Version * SDLCALL RTF_Linked_Version(void);
extern DECLSPEC int SDLCALL RTF_Version(void);
typedef struct _RTF_Context RTF_Context;

View File

@ -28,11 +28,9 @@
/* rcg06192001 get linked library's version. */
const SDL_Version *RTF_Linked_Version(void)
int RTF_Linked_Version(void)
{
static SDL_Version linked_version;
SDL_RTF_VERSION(&linked_version);
return(&linked_version);
return SDL_RTF_VERSION;
}