texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/XS/XSParagraph.xs (xspara_new), tp/T


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/XSParagraph.xs (xspara_new), tp/Texinfo/XS/xspara.c (xspara_new): call xspara_init_state from XSParagraph.xs, not from C.
Date: Thu, 14 Nov 2024 13:57:53 -0500

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

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new ae63c2867e * tp/Texinfo/XS/XSParagraph.xs (xspara_new), 
tp/Texinfo/XS/xspara.c (xspara_new): call xspara_init_state from 
XSParagraph.xs, not from C.
ae63c2867e is described below

commit ae63c2867e3a1d244e7edf3339c7e56276aa74e3
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Nov 14 19:57:47 2024 +0100

    * tp/Texinfo/XS/XSParagraph.xs (xspara_new), tp/Texinfo/XS/xspara.c
    (xspara_new): call xspara_init_state from XSParagraph.xs, not from C.
    
    * tp/Texinfo/XS/XSParagraph.xs (xspara_*), tp/Texinfo/XS/xspara.c
    (xspara_set_state): use XS implicit rules for conversion of paragraph
    integer SV to int.
---
 ChangeLog                    |  9 +++++++++
 tp/Texinfo/XS/XSParagraph.xs | 47 +++++++++++++++++---------------------------
 tp/Texinfo/XS/xspara.c       | 15 +++-----------
 tp/Texinfo/XS/xspara.h       |  4 ++--
 4 files changed, 32 insertions(+), 43 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f710fcf631..df45d2c714 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-11-14  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/XSParagraph.xs (xspara_new), tp/Texinfo/XS/xspara.c
+       (xspara_new): call xspara_init_state from XSParagraph.xs, not from C.
+
+       * tp/Texinfo/XS/XSParagraph.xs (xspara_*), tp/Texinfo/XS/xspara.c
+       (xspara_set_state): use XS implicit rules for conversion of paragraph
+       integer SV to int.
+
 2024-11-14  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/Makefile.am (MiscXS_la_CPPFLAGS, MiscXS_la_LIBADD),
diff --git a/tp/Texinfo/XS/XSParagraph.xs b/tp/Texinfo/XS/XSParagraph.xs
index 5e23e65222..ba8416bbcf 100644
--- a/tp/Texinfo/XS/XSParagraph.xs
+++ b/tp/Texinfo/XS/XSParagraph.xs
@@ -38,8 +38,7 @@ MODULE = Texinfo::Convert::Paragraph PACKAGE = 
Texinfo::Convert::Paragraph PREFI
 PROTOTYPES: ENABLE
 
 void
-xspara_set_state (state)
-     SV * state
+xspara_set_state (int state)
 
 # Return a reference blessed into the XSParagraph class
 # CLASS is ignored because we know it is "XSParagraph".  Optional
@@ -57,7 +56,10 @@ xspara_new (class, ...)
             if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1))) == SVt_PVHV)
               conf = (HV *) SvRV(ST(1));
           }
-        id = xspara_new (conf);
+        id = xspara_new ();
+
+        if (conf)
+          xspara_init_state (conf);
 
         /* Create an integer, which the other functions
            need as their first argument. */
@@ -67,8 +69,7 @@ xspara_new (class, ...)
 
 
 int
-xspara_end_line_count (paragraph)
-        SV *paragraph
+xspara_end_line_count (int paragraph)
     CODE:
         xspara_set_state (paragraph);
         RETVAL = xspara_end_line_count ();
@@ -76,8 +77,7 @@ xspara_end_line_count (paragraph)
         RETVAL
 
 int
-xspara_counter (paragraph)
-        SV *paragraph
+xspara_counter (int paragraph)
     CODE:
         xspara_set_state (paragraph);
         RETVAL = xspara_counter ();
@@ -85,15 +85,13 @@ xspara_counter (paragraph)
         RETVAL
 
 void
-xspara__end_line (paragraph)
-        SV *paragraph
+xspara__end_line (int paragraph)
     CODE:
         xspara_set_state (paragraph);
         xspara__end_line ();
 
 char *
-xspara_end_line (paragraph)
-        SV *paragraph
+xspara_end_line (int paragraph)
     CODE:
         xspara_set_state (paragraph);
         RETVAL = xspara_end_line ();
@@ -101,8 +99,7 @@ xspara_end_line (paragraph)
         RETVAL
 
 char *
-xspara_get_pending (paragraph)
-        SV *paragraph
+xspara_get_pending (int paragraph)
     CODE:
         xspara_set_state (paragraph);
         RETVAL = xspara_get_pending ();
@@ -111,8 +108,7 @@ xspara_get_pending (paragraph)
 
 # ... is for add_spaces
 SV *
-xspara_add_pending_word (paragraph, ...)
-        SV *paragraph
+xspara_add_pending_word (int paragraph, ...)
     PREINIT:
         int add_spaces = 0;
         char *retval;
@@ -134,8 +130,7 @@ xspara_add_pending_word (paragraph, ...)
         RETVAL
 
 SV *
-xspara_end (paragraph)
-        SV *paragraph
+xspara_end (int paragraph)
     PREINIT:
         char *retval;
     CODE:
@@ -149,8 +144,7 @@ xspara_end (paragraph)
 
 
 SV *
-xspara_add_text (paragraph, text_in)
-        SV *paragraph
+xspara_add_text (int paragraph, text_in)
         SV *text_in
     PREINIT:
         char *text;
@@ -174,8 +168,7 @@ xspara_add_text (paragraph, text_in)
         RETVAL
 
 SV *
-xspara_add_next (paragraph, text_in, ...)
-        SV *paragraph
+xspara_add_next (int paragraph, text_in, ...)
         SV *text_in
     PREINIT:
         char *text;
@@ -210,15 +203,13 @@ xspara_add_next (paragraph, text_in, ...)
 
 
 void
-xspara_remove_end_sentence (paragraph)
-        SV *paragraph
+xspara_remove_end_sentence (int paragraph)
     CODE:
         xspara_set_state (paragraph);
         xspara_remove_end_sentence ();
 
 void
-xspara_add_end_sentence (paragraph, value)
-        SV *paragraph
+xspara_add_end_sentence (int paragraph, value)
         SV * value
     PREINIT:
         int intvalue = 0;
@@ -229,8 +220,7 @@ xspara_add_end_sentence (paragraph, value)
         xspara_add_end_sentence (intvalue);
 
 void
-xspara_allow_end_sentence (paragraph)
-        SV *paragraph
+xspara_allow_end_sentence (int paragraph)
     CODE:
         xspara_set_state (paragraph);
         xspara_allow_end_sentence ();
@@ -239,8 +229,7 @@ xspara_allow_end_sentence (paragraph)
 # DOUBLE_WIDTH_NO_BREAK.
 # Pass them to the C function as -1 if not given or undef.
 void
-xspara_set_space_protection (paragraph, space_protection_in, ...)
-        SV *paragraph
+xspara_set_space_protection (int paragraph, space_protection_in, ...)
         SV * space_protection_in
     PREINIT:
         int space_protection = -1;
diff --git a/tp/Texinfo/XS/xspara.c b/tp/Texinfo/XS/xspara.c
index 419b47d41d..8cd115425c 100644
--- a/tp/Texinfo/XS/xspara.c
+++ b/tp/Texinfo/XS/xspara.c
@@ -162,12 +162,10 @@ xspara__switch_state (int id)
 }
 
 int
-xspara_new (HV *conf)
+xspara_new (void)
 {
   int i;
 
-  dTHX; /* Perl boiler plate */
-
   TEXT saved_space, saved_word;
 
   /* Find an unused slot in state_array */
@@ -201,21 +199,14 @@ xspara_new (HV *conf)
   state.end_sentence = eos_undef;
   state.last_letter = (char32_t) '\0';
 
-  if (conf)
-    xspara_init_state (conf);
-
   /* The paragraph ID. */
   return i;
 }
 
-
-/* SV is a blessed reference to an integer containing the paragraph ID. */
 void
-xspara_set_state (SV *sv)
+xspara_set_state (int paragraph)
 {
-  dTHX;
-
-  xspara__switch_state (SvIV (sv));
+  xspara__switch_state (paragraph);
 }
 
 /* Set the state internal to this C module from the Perl hash. */
diff --git a/tp/Texinfo/XS/xspara.h b/tp/Texinfo/XS/xspara.h
index b3f4863919..9a0640c3a0 100644
--- a/tp/Texinfo/XS/xspara.h
+++ b/tp/Texinfo/XS/xspara.h
@@ -1,8 +1,8 @@
 #include "main/text.h"
 
-int xspara_new (HV *conf);
+int xspara_new (void);
 void xspara_init_state (HV *hash);
-void xspara_set_state (SV *state);
+void xspara_set_state (int paragraph);
 TEXT xspara_add_next (char *, int, int transparent);
 TEXT xspara_add_text (char *, int);
 void xspara_set_space_protection (int space_protection, int ignore_columns,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]