🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
2 messages
2 total messages Started by Vikas Agnihotri Thu, 31 Oct 1996 00:00
Adding a new SLANG intrinsic function
#27352
Author: Vikas Agnihotri
Date: Thu, 31 Oct 1996 00:00
62 lines
2224 bytes

After a suggestion from John, I have extended the slang intrinsics available
to SLRN as follows:

+ used the HEADER_NTAGGED definition already available to define it for use
in the interpreter by adding it to interp.c 

+ Mimicked the code for the tag_header() and prev_tagged_header(), next_tagged_header()
intrinsic functions by adding code to ntag_header(), prev_ntagged_header(),
next_ntagged_header, etc.
  Added the appropriate function prototypes, etc to make the code compile.

+ Used the % key to numerically tag the subjects with a reg-exp. I get the
message '110 headers tagged' from my slang.sl file. But I dont see
the header display updated to show the 'numerically' tagged headers like I see
when I manually 'tag' the headers with '#'.
 Also when I use the ']' and '[' keys , it says 'No more tagged headers'...

What am I doing wrong? I am attaching the relevant files and functions that I 
changed.


Thanks,
--Vikas
  vikas@insight.att.com

-----
In interp.c
static int Interp_Header_NTagged = HEADER_NTAGGED;
etc.
MAKE_VARIABLE(".HEADER_NTAGGED", &Interp_Header_NTagged, INT_TYPE, 1),
etc.
MAKE_INTRINSIC(".next_ntagged_header", slrn_next_ntagged_header, INT_TYPE, 0)
etc
----

-------
In art.c
int slrn_next_ntagged_header (void) /*{{{*/
{
   Slrn_Header_Type *h = Slrn_Current_Header;
 
   if (h == NULL) return 0;
 
   while (h->next != NULL)
     {
        h = h->next;
        if (h->flags & HEADER_NTAGGED)
          {
             slrn_goto_header (h, 0);
             return 1;
          }
     }
   return 0;
}
------

You get the idea, right...


Re: Adding a new SLANG intrinsic function
#27419
Author: John E. Davis
Date: Sun, 03 Nov 1996 00:00
65 lines
2666 bytes
On 31 Oct 1996 21:22:39 GMT, Vikas Agnihotri <vikas@insight.att.com>
wrote:
>+ used the HEADER_NTAGGED definition already available to define it for use
>in the interpreter by adding it to interp.c 
[...]
>What am I doing wrong? I am attaching the relevant files and functions that I 
>changed.

You simply cannot set the HEADER_NTAGGED bit in the flags bitmap and
expect a header to become numerically tagged.  The reason for this is
that associated with every numerically tagged header is another
structure that contains information about the tag, e.g., the tag
number.  Setting the bit does not create this structure.  If you want
a header to be numerically tagged, use

define numerically_tag_header ()
{
   if (0 == get_header_tag_number ())
     call ("tag_header");
}

define numerically_untag_header ()
{
   if (get_header_tag_number ())
     call ("tag_header");
}

These two functions assume a new intrinsic function called
'get_header_tag_number'.  Here is a patch for that (apply the patch by
hand):

--- src/release/slrn/src/interp.c	Tue Oct 22 14:08:35 1996
+++ src/slrn/src/interp.c	Sun Nov  3 14:00:53 1996
@@ -470,6 +536,15 @@
 
 /*}}}*/
 
+static int get_header_tag_number (void)
+{
+   if ((Slrn_Current_Header == NULL) 
+       || (0 == (Slrn_Current_Header->flags & HEADER_NTAGGED)))
+     return 0;
+   
+   return (int) Slrn_Current_Header->tag_number;
+}
+
 /*{{{ Header Searching */
 
 static int re_header_search (char *pat, unsigned int offset, int dir) /*{{{*/
@@ -615,6 +689,9 @@
 
 static SLang_Name_Type Slrn_Intrinsics [] = /*{{{*/
 {
+   MAKE_INTRINSIC(".get_header_tag_number", get_header_tag_number, INT_TYPE, 0),
    MAKE_VARIABLE(".GROUPS_DIRTY", &Slrn_Groups_Dirty, INT_TYPE, 1),
    
    MAKE_VARIABLE(".GROUP_NEW_GROUP_FLAG", &Interp_Group_New_Group_Flag, INT_TYPE, 1),

-- 
John E. Davis                   Center for Space Research/AXAF Science Center
617-258-8119                    MIT 37-662c, Cambridge, MA 02139
http://space.mit.edu/~davis

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