source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Let descriptions (bit-mask 0x100) also be mined for text.
Date: Tue, 21 Jun 2011 10:16:06 -0400 (EDT)	[thread overview]
Message-ID: <201106211416.p5LEG6qh009548@krisdoz.my.domain> (raw)

Log Message:
-----------
Let descriptions (bit-mask 0x100) also be mined for text.  This doubles
the database size (one record for each file), but it's critical
information.

Modified Files:
--------------
    mdocml:
        Makefile
        makewhatis.1
        makewhatis.c

Revision Data
-------------
Index: makewhatis.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/makewhatis.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -Lmakewhatis.c -Lmakewhatis.c -u -p -r1.5 -r1.6
--- makewhatis.c
+++ makewhatis.c
@@ -52,7 +52,7 @@
 #define TYPE_STANDARD	0x20
 #define TYPE_AUTHOR	0x40
 #define TYPE_CONFIG	0x80
-#define	TYPE__MAX	TYPE_CONFIG
+#define TYPE_DESC	0x100
 
 /* Buffer for storing growable data. */
 
@@ -695,16 +695,25 @@ static void
 pmdoc_Nd(MDOC_ARGS)
 {
 	int		 first;
+	size_t		 sz;
 	
 	for (first = 1, n = n->child; n; n = n->next) {
 		if (MDOC_TEXT != n->type)
 			continue;
-		if (first) 
-			buf_appendb(dbuf, n->string, strlen(n->string) + 1);
-		else
+
+		if (first) {
+			sz = strlen(n->string) + 1;
+			buf_appendb(dbuf, n->string, sz);
+			buf_appendb(buf, n->string, sz);
+		} else {
 			buf_append(dbuf, n->string);
+			buf_append(buf, n->string);
+		}
+
 		first = 0;
 	}
+
+	hash_put(hash, buf, TYPE_DESC);
 }
 
 /* ARGSUSED */
@@ -897,7 +906,9 @@ pman_node(MAN_ARGS)
 			while (' ' == *start)
 				start++;
 
-			buf_appendb(dbuf, start, strlen(start) + 1);
+			sz = strlen(start) + 1;
+			buf_appendb(dbuf, start, sz);
+			buf_appendb(buf, start, sz);
 		}
 	}
 
Index: makewhatis.1
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/makewhatis.1,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lmakewhatis.1 -Lmakewhatis.1 -u -p -r1.4 -r1.5
--- makewhatis.1
+++ makewhatis.1
@@ -107,6 +107,8 @@ A standard as given in the STANDARDS sec
 An author as given in the AUTHORS section.
 .It Li 0x80
 A configuration as given in the SYNOPSIS section.
+.It Li 0x100
+Free-form descriptive text as given in the NAME section.
 .El
 .Pp
 The last four bytes are a host-ordered record number within the
Index: Makefile
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/Makefile,v
retrieving revision 1.350
retrieving revision 1.351
diff -LMakefile -LMakefile -u -p -r1.350 -r1.351
--- Makefile
+++ Makefile
@@ -353,7 +353,7 @@ llib-lmandoc.ln: $(MANDOC_LNS)
 
 # You'll need -ldb for Linux.
 makewhatis: $(MAKEWHATIS_OBJS) libmandoc.a
-	$(CC) -o $@ $(MAKEWHATIS_OBJS) libmandoc.a -ldb
+	$(CC) -o $@ $(MAKEWHATIS_OBJS) libmandoc.a
 
 llib-lmakewhatis.ln: $(MAKEWHATIS_LNS)
 	$(LINT) $(LINTFLAGS) -Cmakewhatis $(MAKEWHATIS_LNS)
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2011-06-21 14:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201106211416.p5LEG6qh009548@krisdoz.my.domain \
    --to=kristaps@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).