about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-02-22 14:32:00 -0500
committerJune McEnroe <june@causal.agency>2019-02-22 14:32:00 -0500
commitc2317921f8429d0f2f0e7579beabf4dd9e987247 (patch)
treeb3af2c12ccace387151b3007a7b5be827905a4da
parentShow status window while connecting (diff)
downloadcatgirl-c2317921f8429d0f2f0e7579beabf4dd9e987247.tar.gz
catgirl-c2317921f8429d0f2f0e7579beabf4dd9e987247.zip
Rename global tags with angle brackets
-rw-r--r--catgirl.14
-rw-r--r--tag.c24
2 files changed, 17 insertions, 11 deletions
diff --git a/catgirl.1 b/catgirl.1
index 88f1945..5be44ec 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -88,7 +88,7 @@ the same as the nickname.
 .
 .It Fl v
 Show raw IRC protocol in the
-.Sy -raw-
+.Sy <raw>
 window.
 .
 .It Fl w Ar pass
@@ -181,7 +181,7 @@ matching the
 .
 .It Ic /raw
 Toggle the
-.Sy -raw-
+.Sy <raw>
 window.
 .
 .It Ic /url
diff --git a/tag.c b/tag.c
index e9b098b..13e06f3 100644
--- a/tag.c
+++ b/tag.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018  Curtis McEnroe <june@causal.agency>
+/* Copyright (C) 2018  C. McEnroe <june@causal.agency>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -21,20 +21,26 @@
 
 #include "chat.h"
 
-#define NONE   "-none-"
-#define STATUS "-status-"
-#define RAW    "-raw-"
+#define GLOBAL_TAGS \
+	X(TagNone,   0, "<none>") \
+	X(TagStatus, 1, "<status>") \
+	X(TagRaw,    2, "<raw>")
+enum { GlobalTagsLen = 3 };
 
-const struct Tag TagNone   = { 0, NONE };
-const struct Tag TagStatus = { 1, STATUS };
-const struct Tag TagRaw    = { 2, RAW };
+#define X(tag, id, name) const struct Tag tag = { id, name };
+GLOBAL_TAGS
+#undef X
 
 static struct {
 	char *name[TagsLen];
 	size_t len;
 } tags = {
-	.name = { NONE, STATUS, RAW },
-	.len = 3,
+	.name = {
+#define X(_, id, name) [id] = name,
+		GLOBAL_TAGS
+#undef X
+	},
+	.len = GlobalTagsLen,
 };
 
 struct Tag tagFind(const char *name) {
ight'> 2019-02-18Fix function-like #define regexJune McEnroe A define like #define FOO (1) is not function-like. 2019-02-18Match Tag in RustJune McEnroe 2019-02-18Match sh functions as TagJune McEnroe 2019-02-18Match Sh and Ss as Tag in mdocJune McEnroe 2019-02-18Match statics and typedefs as TagJune McEnroe 2019-02-18Clean up htmlHeaderJune McEnroe 2019-02-18Remove hi line numberingJune McEnroe Tags are much better for referring to specific parts of a file and line numbering is better done by a post-processing tool such as cat -n or producing a two-column HTML <table>. 2019-02-18Add Tag class to hiJune McEnroe 2019-02-17Generate HTML with hi -n -f html -o anchorJune McEnroe Running hi twice to insert stuff between the head and the content is a bit of a hack but oh well. 2019-02-17Add hi -f html -o anchor for line number linksJune McEnroe 2019-02-17Simplify temp trap in upJune McEnroe 2019-02-17Add line numbers to hiJune McEnroe Renames previous -n option to -m to stay consistent with cat -n. Prefixing lines with line numbers affects where the first tab indent ends up relative to the text above it. Not sure if it's worth fixing somehow. 2019-02-17Always split spans after newlinesJune McEnroe Simplifies ANSI and IRC output code, and prepares for line numbered output. 2019-02-15Color format specifiers light cyan in vimJune McEnroe 2019-02-15Highlight Interp as yellowJune McEnroe 2019-02-15Highlight strings in sh command substitutionsJune McEnroe 2019-02-15Add nmap gpJune McEnroe 2019-02-14Avoid newline when copying URL to pasteboardJune McEnroe 2019-02-13Add forgotten "sixth" book of H2G2June McEnroe