From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: basic support for tag priorities; written at YYC
Date: Sat, 25 Jul 2015 09:02:37 -0500 (EST) [thread overview]
Message-ID: <4449873231889931210.enqueue@fantadrom.bsd.lv> (raw)
Log Message:
-----------
basic support for tag priorities; written at YYC
Modified Files:
--------------
mdocml:
mdoc_term.c
tag.c
tag.h
Revision Data
-------------
Index: tag.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/tag.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -Ltag.h -Ltag.h -u -p -r1.2 -r1.3
--- tag.h
+++ tag.h
@@ -18,8 +18,8 @@
__BEGIN_DECLS
char *tag_init(void);
-size_t tag_get(const char *, size_t);
-void tag_put(const char *, size_t, size_t);
+size_t tag_get(const char *, size_t, int);
+void tag_put(const char *, size_t, int, size_t);
void tag_write(void);
void tag_unlink(void);
Index: tag.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/tag.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -Ltag.c -Ltag.c -u -p -r1.3 -r1.4
--- tag.c
+++ tag.c
@@ -34,6 +34,7 @@
struct tag_entry {
size_t line;
+ int prio;
char s[];
};
@@ -81,7 +82,7 @@ tag_init(void)
* or 0 if the term is unknown.
*/
size_t
-tag_get(const char *s, size_t len)
+tag_get(const char *s, size_t len, int prio)
{
struct tag_entry *entry;
const char *end;
@@ -94,14 +95,14 @@ tag_get(const char *s, size_t len)
end = s + len;
slot = ohash_qlookupi(&tag_data, s, &end);
entry = ohash_find(&tag_data, slot);
- return(entry == NULL ? 0 : entry->line);
+ return((entry == NULL || prio < entry->prio) ? 0 : entry->line);
}
/*
* Set the line number where a term is defined.
*/
void
-tag_put(const char *s, size_t len, size_t line)
+tag_put(const char *s, size_t len, int prio, size_t line)
{
struct tag_entry *entry;
const char *end;
@@ -121,6 +122,7 @@ tag_put(const char *s, size_t len, size_
ohash_insert(&tag_data, slot, entry);
}
entry->line = line;
+ entry->prio = prio;
}
/*
Index: mdoc_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v
retrieving revision 1.320
retrieving revision 1.321
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.320 -r1.321
--- mdoc_term.c
+++ mdoc_term.c
@@ -2268,7 +2268,7 @@ termp_tag_pre(DECL_ARGS)
(n->parent->tok == MDOC_Xo &&
n->parent->parent->prev == NULL &&
n->parent->parent->parent->tok == MDOC_It)) &&
- ! tag_get(n->child->string, 0))
- tag_put(n->child->string, 0, p->line);
+ ! tag_get(n->child->string, 0, 1))
+ tag_put(n->child->string, 0, 1, p->line);
return(1);
}
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2015-07-25 14:02 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=4449873231889931210.enqueue@fantadrom.bsd.lv \
--to=schwarze@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).