[libmarpa-r2-perl] 07/12: Work on libmarpa version #: t+

Jonas Smedegaard dr at jones.dk
Sat May 17 21:24:06 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag Marpa-R2-2.085_002
in repository libmarpa-r2-perl.

commit 5d046f2b08fb792f330e41256843fac96e8c2c31
Author: Jeffrey Kegler <JKEGL at cpan.org>
Date:   Tue Apr 15 20:20:26 2014 -0700

    Work on libmarpa version #: t+
---
 bump_version                         |   8 ++
 cpan/MANIFEST                        |   2 +
 cpan/inc/Marpa/R2/License.pm         |   2 +
 cpan/libmarpa/ac/configure.ac        |   3 +
 cpan/libmarpa/dev/api.texi           |  10 +--
 cpan/libmarpa/dev/marpa.w            |  22 +++--
 cpan/libmarpa/public/Makefile        |   2 +-
 cpan/libmarpa/public/marpa.h-version |   3 +
 cpan/xs/R2.xs                        | 162 +++++++++++++++++++----------------
 9 files changed, 120 insertions(+), 94 deletions(-)

diff --git a/bump_version b/bump_version
index 04baa76..c2eebfc 100644
--- a/bump_version
+++ b/bump_version
@@ -111,6 +111,14 @@ for my $configure_ac_file (
     print $out $file;
 } ## end for my $configure_ac_file ( qw( cpan/libmarpa/ac/configure.ac...))
 
+{
+    open my $out, '>', 'cpan/libmarpa/public/marpa.h-version';
+    say $out join " ", q{#define MARPA_H_MAJOR_VERSION}, $libmarpa_major;
+    say $out join " ", q{#define MARPA_H_MINOR_VERSION}, $libmarpa_minor;
+    say $out join " ", q{#define MARPA_H_MICRO_VERSION}, $libmarpa_micro;
+    close $out;
+}
+
 chdir 'cpan';
 die qq{"perl Build.PL" failed: $!}
     if not IPC::Cmd::run(
diff --git a/cpan/MANIFEST b/cpan/MANIFEST
index 9b8e052..b4b075b 100644
--- a/cpan/MANIFEST
+++ b/cpan/MANIFEST
@@ -152,6 +152,7 @@ libmarpa/obs/marpa_obs.c
 libmarpa/obs/marpa_obs.h
 libmarpa/public/.gitignore
 libmarpa/public/Makefile
+libmarpa/public/marpa.h-version
 libmarpa/public/marpa.h.p10
 libmarpa/public/marpa.h.p90
 libmarpa/public/marpa_codes.c.p10
@@ -188,6 +189,7 @@ libmarpa_dist/Makefile.in
 libmarpa_dist/NEWS
 libmarpa_dist/README
 libmarpa_dist/VERSION
+libmarpa_dist/VERSION.in
 libmarpa_dist/aclocal.m4
 libmarpa_dist/config.guess
 libmarpa_dist/config.h.in
diff --git a/cpan/inc/Marpa/R2/License.pm b/cpan/inc/Marpa/R2/License.pm
index 3093c4a..a74ab9a 100644
--- a/cpan/inc/Marpa/R2/License.pm
+++ b/cpan/inc/Marpa/R2/License.pm
@@ -285,9 +285,11 @@ my %files_by_type = (
     'libmarpa/public/marpa_codes.c.p10' => \&trivial,
     'libmarpa/public/marpa_slif.h.p20' => \&trivial,
     'libmarpa/public/marpa.h.p10' => \&trivial,
+    'libmarpa/public/marpa.h-version' => \&trivial,
     'libmarpa/public/marpa.h.p90' => \&trivial,
     'libmarpa/dev/README'                    => \&trivial,
     'libmarpa_dist/VERSION'                 => \&trivial,
+    'libmarpa_dist/VERSION.in'                 => \&trivial,
     'libmarpa/bin/too_long.pl' => \&trivial,
     'libmarpa/shared/copyright_page_license.w' => \&copyright_page,
     'libmarpa/shared/cwebmac.tex' =>
diff --git a/cpan/libmarpa/ac/configure.ac b/cpan/libmarpa/ac/configure.ac
index 3f2ed9d..1cc9ea8 100644
--- a/cpan/libmarpa/ac/configure.ac
+++ b/cpan/libmarpa/ac/configure.ac
@@ -107,6 +107,9 @@ AC_SUBST(WARNING_CPPFLAGS)
 AC_SUBST(MARPA_MAJOR_VERSION, [marpa_major_version])
 AC_SUBST(MARPA_MINOR_VERSION, [marpa_minor_version])
 AC_SUBST(MARPA_MICRO_VERSION, [marpa_micro_version])
+AC_DEFINE([MARPA_MAJOR_VERSION], [marpa_major_version], [Marpa major version.])
+AC_DEFINE([MARPA_MINOR_VERSION], [marpa_minor_version], [Marpa minor version.])
+AC_DEFINE([MARPA_MICRO_VERSION], [marpa_micro_version], [Marpa micro version.])
 AC_ARG_VAR(MARPA_DEBUG_FLAG,[Marpa debugging])
 
 AC_CHECK_SIZEOF([int])
diff --git a/cpan/libmarpa/dev/api.texi b/cpan/libmarpa/dev/api.texi
index 2f73f03..6150086 100644
--- a/cpan/libmarpa/dev/api.texi
+++ b/cpan/libmarpa/dev/api.texi
@@ -1262,9 +1262,9 @@ of one of these two prefixes.
 @chapter Static methods
 
 @deftypefun Marpa_Error_Code marpa_check_version @
-    (unsigned int @var{required_major}, @
-    unsigned int @var{required_minor}, @
-    unsigned int @var{required_micro} @
+    (int @var{required_major}, @
+    int @var{required_minor}, @
+    int @var{required_micro} @
     )
 
 Checks that the Marpa library in use is compatible with the
@@ -1297,10 +1297,10 @@ one of the following is returned, indicating the nature of the mismatch:
 
 @end deftypefun
 
- at deftypefun Marpa_Error_Code marpa_version (unsigned int* version)
+ at deftypefun Marpa_Error_Code marpa_version (int* version)
 
 Returns the version number in @var{version},
-which must have room for three @code{unsigned int}'s.
+which must have room for three @code{int}'s.
 
 Return value: A non-negative number on success,
 @minus{}2 on failure.
diff --git a/cpan/libmarpa/dev/marpa.w b/cpan/libmarpa/dev/marpa.w
index b789a8e..8825792 100644
--- a/cpan/libmarpa/dev/marpa.w
+++ b/cpan/libmarpa/dev/marpa.w
@@ -587,15 +587,15 @@ prototypes, look at
 @** The public header file.
 @*0 Version constants.
 @<Global constant variables@> =
-const unsigned int marpa_major_version = MARPA_MAJOR_VERSION;
-const unsigned int marpa_minor_version = MARPA_MINOR_VERSION;
-const unsigned int marpa_micro_version = MARPA_MICRO_VERSION;
+const int marpa_major_version = MARPA_MAJOR_VERSION;
+const int marpa_minor_version = MARPA_MINOR_VERSION;
+const int marpa_micro_version = MARPA_MICRO_VERSION;
 
 @ @<Function definitions@> =
 Marpa_Error_Code
-marpa_check_version (unsigned int required_major,
-                    unsigned int required_minor,
-                    unsigned int required_micro)
+marpa_check_version (int required_major,
+                    int required_minor,
+                    int required_micro)
 {
   if (required_major != MARPA_MAJOR_VERSION)
     return MARPA_ERR_MAJOR_VERSION_MISMATCH;
@@ -611,7 +611,7 @@ marpa_check_version (unsigned int required_major,
 @ Always succeeds at this point.
 @<Function definitions@> =
 Marpa_Error_Code
-marpa_version (unsigned int* version)
+marpa_version (int* version)
 {
   *version++ = MARPA_MAJOR_VERSION;
   *version++ = MARPA_MINOR_VERSION;
@@ -15820,11 +15820,9 @@ or used strictly for debugging.
 @*0 Public header file.
 @ Our portion of the public header file.
 @ @(marpa.h.p50@> =
-extern const unsigned int marpa_major_version;
-extern const unsigned int marpa_minor_version;
-extern const unsigned int marpa_micro_version;
-extern const unsigned int marpa_interface_age;
-extern const unsigned int marpa_binary_age;
+extern const int marpa_major_version;
+extern const int marpa_minor_version;
+extern const int marpa_micro_version;
 
 #define MARPA_CHECK_VERSION(major,minor,micro) @| \
     @[ (MARPA_MAJOR_VERSION > (major) \
diff --git a/cpan/libmarpa/public/Makefile b/cpan/libmarpa/public/Makefile
index f8dd0d2..48966a1 100644
--- a/cpan/libmarpa/public/Makefile
+++ b/cpan/libmarpa/public/Makefile
@@ -23,7 +23,7 @@
 CPPWRAP = perl ../bin/cppwrap.pl
 C_LANGUAGE_PREAMBLE = ../shared/license.c ../shared/do_not_edit.c
 MARPA_H_PIECES = $(C_LANGUAGE_PREAMBLE) \
-  marpa.h.p10 marpa.h-err \
+  marpa.h.p10 marpa.h-version marpa.h-err \
   marpa.h-event marpa.h-step \
   marpa.h.p50 marpa.h.p80 marpa.h.p90
 
diff --git a/cpan/libmarpa/public/marpa.h-version b/cpan/libmarpa/public/marpa.h-version
new file mode 100644
index 0000000..8588045
--- /dev/null
+++ b/cpan/libmarpa/public/marpa.h-version
@@ -0,0 +1,3 @@
+#define MARPA_H_MAJOR_VERSION 6
+#define MARPA_H_MINOR_VERSION 0
+#define MARPA_H_MICRO_VERSION 0
diff --git a/cpan/xs/R2.xs b/cpan/xs/R2.xs
index c9c3791..a287fb1 100644
--- a/cpan/xs/R2.xs
+++ b/cpan/xs/R2.xs
@@ -2432,7 +2432,7 @@ void
 version()
 PPCODE:
 {
-    unsigned int version[3];
+    int version[3];
     int result = marpa_version(version);
     if (result < 0) { XSRETURN_UNDEF; }
     XPUSHs (sv_2mortal (newSViv (version[0])));
@@ -2455,101 +2455,111 @@ PPCODE:
 
   switch (items)
     {
-    case 1: {
-      /* If we are using the (deprecated) interface 0,
-       * get the throw setting from a (deprecated) global variable
-       */
-      SV *throw_sv = get_sv ("Marpa::R2::Thin::C::THROW", 0);
-      throw = throw_sv && SvTRUE (throw_sv);
-    }
-    break;
-    croak("Usage: Marpa::R2::Thin:G::new(class, arg_hash)");
+    case 1:
+      {
+	/* If we are using the (deprecated) interface 0,
+	 * get the throw setting from a (deprecated) global variable
+	 */
+	SV *throw_sv = get_sv ("Marpa::R2::Thin::C::THROW", 0);
+	throw = throw_sv && SvTRUE (throw_sv);
+      }
+      break;
+      croak ("Usage: Marpa::R2::Thin:G::new(class, arg_hash)");
     case 2:
       {
-        I32 retlen;
-        char *key;
-        SV *arg_value;
-        SV *arg = ST (1);
-        HV *named_args;
-        if (!SvROK (arg) || SvTYPE (SvRV (arg)) != SVt_PVHV)
-            croak ("Problem in $g->new(): argument is not hash ref");
-        named_args = (HV *) SvRV (arg);
-        hv_iterinit (named_args);
-        while ((arg_value = hv_iternextsv (named_args, &key, &retlen)))
-          {
-            if ((*key == 'i') && strnEQ (key, "if", (unsigned) retlen))
-              {
-                interface = SvIV (arg_value);
-                if (interface != 1)
-                  {
-                    croak ("Problem in $g->new(): interface value must be 1");
-                  }
-                continue;
-              }
-            croak ("Problem in $g->new(): unknown named argument: %s", key);
-          }
-        if (interface != 1)
-          {
-            croak
-              ("Problem in $g->new(): 'interface' named argument is required");
-          }
+	I32 retlen;
+	char *key;
+	SV *arg_value;
+	SV *arg = ST (1);
+	HV *named_args;
+	if (!SvROK (arg) || SvTYPE (SvRV (arg)) != SVt_PVHV)
+	  croak ("Problem in $g->new(): argument is not hash ref");
+	named_args = (HV *) SvRV (arg);
+	hv_iterinit (named_args);
+	while ((arg_value = hv_iternextsv (named_args, &key, &retlen)))
+	  {
+	    if ((*key == 'i') && strnEQ (key, "if", (unsigned) retlen))
+	      {
+		interface = SvIV (arg_value);
+		if (interface != 1)
+		  {
+		    croak ("Problem in $g->new(): interface value must be 1");
+		  }
+		continue;
+	      }
+	    croak ("Problem in $g->new(): unknown named argument: %s", key);
+	  }
+	if (interface != 1)
+	  {
+	    croak
+	      ("Problem in $g->new(): 'interface' named argument is required");
+	  }
       }
     }
 
+  /* Make sure the header is from the version we want */
+  if (MARPA_H_MAJOR_VERSION != EXPECTED_LIBMARPA_MAJOR
+      || MARPA_H_MINOR_VERSION != EXPECTED_LIBMARPA_MINOR
+      || MARPA_H_MICRO_VERSION != EXPECTED_LIBMARPA_MICRO)
+    {
+      croak
+	("Problem in $g->new(): want Libmarpa %d.%d.%d, header was from Libmarpa %d.%d.%d",
+	 EXPECTED_LIBMARPA_MAJOR, EXPECTED_LIBMARPA_MINOR,
+	 EXPECTED_LIBMARPA_MICRO,
+	 MARPA_H_MAJOR_VERSION, MARPA_H_MINOR_VERSION,
+	 MARPA_H_MICRO_VERSION);
+    }
+
   {
-    unsigned int version[3];
+    /* Now make sure the library is from the version we want */
+    int version[3];
     error_code = marpa_version (version);
     if (error_code != MARPA_ERR_NONE
-        || version[0] != EXPECTED_LIBMARPA_MAJOR
-        || version[1] != EXPECTED_LIBMARPA_MINOR
-        || version[2] != EXPECTED_LIBMARPA_MICRO)
+	|| version[0] != EXPECTED_LIBMARPA_MAJOR
+	|| version[1] != EXPECTED_LIBMARPA_MINOR
+	|| version[2] != EXPECTED_LIBMARPA_MICRO)
       {
-        croak
-          ("Problem in $g->new(): want Libmarpa %d.%d.%d, using Libmarpa %d.%d.%d",
-           EXPECTED_LIBMARPA_MAJOR, EXPECTED_LIBMARPA_MINOR,
-           EXPECTED_LIBMARPA_MICRO, version[0], version[1], version[2]);
+	croak
+	  ("Problem in $g->new(): want Libmarpa %d.%d.%d, using Libmarpa %d.%d.%d",
+	   EXPECTED_LIBMARPA_MAJOR, EXPECTED_LIBMARPA_MINOR,
+	   EXPECTED_LIBMARPA_MICRO, version[0], version[1], version[2]);
       }
   }
 
-  error_code =
-    marpa_check_version (MARPA_MAJOR_VERSION, MARPA_MINOR_VERSION,
-                         MARPA_MICRO_VERSION);
-  if (error_code == MARPA_ERR_NONE)
+  marpa_c_init (&marpa_configuration);
+  g = marpa_g_new (&marpa_configuration);
+  if (g)
+    {
+      SV *sv;
+      Newx (g_wrapper, 1, G_Wrapper);
+      g_wrapper->throw = throw;
+      g_wrapper->g = g;
+      g_wrapper->message_buffer = NULL;
+      g_wrapper->libmarpa_error_code = MARPA_ERR_NONE;
+      g_wrapper->libmarpa_error_string = NULL;
+      g_wrapper->message_is_marpa_thin_error = 0;
+      sv = sv_newmortal ();
+      sv_setref_pv (sv, grammar_c_class_name, (void *) g_wrapper);
+      XPUSHs (sv);
+    }
+  else
     {
-      marpa_c_init (&marpa_configuration);
-      g = marpa_g_new (&marpa_configuration);
-      if (g)
-        {
-          SV *sv;
-          Newx (g_wrapper, 1, G_Wrapper);
-          g_wrapper->throw = throw;
-          g_wrapper->g = g;
-          g_wrapper->message_buffer = NULL;
-          g_wrapper->libmarpa_error_code = MARPA_ERR_NONE;
-          g_wrapper->libmarpa_error_string = NULL;
-          g_wrapper->message_is_marpa_thin_error = 0;
-          sv = sv_newmortal ();
-          sv_setref_pv (sv, grammar_c_class_name, (void *) g_wrapper);
-          XPUSHs (sv);
-        }
-      else
-        {
-          error_code = marpa_c_error (&marpa_configuration, NULL);
-        }
+      error_code = marpa_c_error (&marpa_configuration, NULL);
     }
+
   if (error_code != MARPA_ERR_NONE)
     {
       const char *error_description = "Error code out of bounds";
       if (error_code >= 0 && error_code < MARPA_ERROR_COUNT)
-        {
-          error_description = marpa_error_description[error_code].name;
-        }
+	{
+	  error_description = marpa_error_description[error_code].name;
+	}
       if (throw)
-        croak ("Problem in Marpa::R2->new(): %s", error_description);
+	croak ("Problem in Marpa::R2->new(): %s", error_description);
       if (GIMME != G_ARRAY)
-        {
-          XSRETURN_UNDEF;
-        }
+	{
+	  XSRETURN_UNDEF;
+	}
       XPUSHs (&PL_sv_undef);
       XPUSHs (sv_2mortal (newSViv (error_code)));
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmarpa-r2-perl.git



More information about the Pkg-perl-cvs-commits mailing list