🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
2 messages
2 total messages Started by Ian T Zimmerman Thu, 04 Sep 1997 00:00
Slrn wish
#35970
Author: Ian T Zimmerman
Date: Thu, 04 Sep 1997 00:00
20 lines
1320 bytes
It seems that although there's a way (namely set_prefix_argument) to
_set_ the prefix argument in a Slang macro (for use by C intrinsics
called by the macro), there's currently no way to _query_ the current
prefix argument, as entered interactively by the user.  This means
macros written to be used as interactive commands cannot be
parametrized by user input, which is a pain.  For example, I cannot
write a macro equivalent of the command `move down n headers, where n
is the prefix argument, or 1 if no prefix'.

Adding this bit seems to be trivial, just export Slrn_Prefix_Arg_Ptr
to Slang.

-- 
Ian T Zimmerman                        <itz@rahul.net>
The dilemma is that when you model something 
completely on efficiency, a lot of people get hurt.
Dr. Leonard Duhl of UC Berkeley, discussing `managed medical care'.

Re: Slrn wish
#35996
Author: Byrial Jensen
Date: Sat, 06 Sep 1997 00:00
76 lines
3037 bytes

Ian T Zimmerman <itz@rahul.net> wrote:
>  there's currently no way to _query_ the current
>prefix argument, as entered interactively by the user.

Here it is. The following patch defines 2 functions which can be called
from Slang macros:
 - "get_prefix_arg" returns the prefix argument, or -1 if none is set.
 - "reset_prefix_arg" removes the current prefix argument, so it won't
   be used by other functions called by the macro.

define test_function ()
{
   variable prefix_arg;
   variable msg;
   
   prefix_arg = get_prefix_arg;
   reset_prefix_arg;
   
   if (prefix_arg == -1)
     msg = "No prefix argument set";
   else
     msg = Sprintf ("The prefix argument is: %d", prefix_arg, 1);
   
   message (msg);
}
definekey ("test_function", "T", "group");
definekey ("test_function", "T", "article");

Best regards
- Byrial

--- interp.c.org	Sat Sep  6 10:15:57 1997
+++ interp.c	Sat Sep  6 10:48:26 1997
@@ -520,6 +520,22 @@
 
 /*}}}*/
 
+int get_prefix_arg (void) /*{{{*/
+{
+#define NO_PREFIX_ARGUMENT -1
+
+   return Slrn_Prefix_Arg_Ptr ? *Slrn_Prefix_Arg_Ptr : NO_PREFIX_ARGUMENT;
+}
+
+/*}}}*/
+
+void reset_prefix_arg (void) /*{{{*/
+{
+   Slrn_Prefix_Arg_Ptr = NULL;
+}
+
+/*}}}*/
+
 static int check_tty (void)
 {
    if (Slrn_TT_Initialized & SLRN_TTY_INIT)
@@ -1040,6 +1056,7 @@
    MAKE_INTRINSIC(".get_header_score", get_header_score, INT_TYPE, 0),
    MAKE_INTRINSIC(".get_header_tag_number", get_header_tag_number, INT_TYPE, 0),
    MAKE_INTRINSIC(".get_next_art_pgdn_action", slrn_get_next_pagedn_action, INT_TYPE, 0),
+   MAKE_INTRINSIC(".get_prefix_arg", get_prefix_arg, INT_TYPE, 0),
    MAKE_INTRINSIC(".get_response", get_response, INT_TYPE, 0),
    MAKE_INTRINSIC(".get_select_box_response", interp_select_box, INT_TYPE, 0),
    MAKE_INTRINSIC(".get_variable_value", get_variable_value, VOID_TYPE, 0),
@@ -1070,6 +1087,7 @@
    MAKE_INTRINSIC(".re_search_article", re_search_article, INT_TYPE, 1),
    MAKE_INTRINSIC(".read_mini", read_mini, VOID_TYPE, 0),
    MAKE_INTRINSIC(".read_mini_no_echo", read_mini_no_echo, VOID_TYPE, 0),
+   MAKE_INTRINSIC(".reset_prefix_arg", reset_prefix_arg, VOID_TYPE, 0),
    MAKE_INTRINSIC(".save_current_article", save_current_article, INT_TYPE, 1),
    MAKE_INTRINSIC(".search_article", search_article, INT_TYPE, 1),
    MAKE_INTRINSIC(".select_group", select_group, INT_TYPE, 0),

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads