Article View: news.software.readers
Article #27419Re: Adding a new SLANG intrinsic function
From: John E. Davis
Date: Sun, 03 Nov 1996 00:00
Date: Sun, 03 Nov 1996 00:00
65 lines
2666 bytes
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
Technical Details
Message-ID:
<slrn57pr5k.d2m.davis@aluche.mit.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailReferences:
<slrn57i5vp.j1h.vikas@joshua.insight.att.com>Show Full Headers
Complete Article Headers
Message-ID: <slrn57pr5k.d2m.davis@aluche.mit.edu> Subject: Re: Adding a new SLANG intrinsic function Date: Sun, 03 Nov 1996 00:00:00 +0000 From: davis@space.mit.edu (John E. Davis) References: <slrn57i5vp.j1h.vikas@joshua.insight.att.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 194132191 Organization: Center for Space Research Reply-to: davis@space.mit.edu Newsgroups: news.software.readers