aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dotXCompose25
-rw-r--r--treeprint.py77
2 files changed, 102 insertions, 0 deletions
diff --git a/dotXCompose b/dotXCompose
index 8a03796..92e7263 100644
--- a/dotXCompose
+++ b/dotXCompose
@@ -52,6 +52,7 @@ include "%L"
<Multi_key> <d> <d> <a> <g> : "‡" U2021 # DOUBLE DAGGER
# We already have THIN SPACE below, as <space> <apostrophe>! Keep both?
<Multi_key> <backslash> <comma> : " " U2009 # THIN SPACE
+<Multi_key> <s> <e> <c> : "§" U00A7 # SECTION SIGN
<Multi_key> <minus> <less> : "←" leftarrow # LEFTWARDS ARROW
<Multi_key> <minus> <asciicircum> : "↑" uparrow # UPWARDS ARROW
@@ -304,6 +305,8 @@ include "%L"
<Multi_key> <underscore> <k> : "ₖ" U2096 # LATIN SUBSCRIPT SMALL LETTER K
<Multi_key> <underscore> <m> : "ₘ" U2098 # LATIN SUBSCRIPT SMALL LETTER M
<Multi_key> <underscore> <n> : "ₙ" U2099 # LATIN SUBSCRIPT SMALL LETTER N
+<Multi_key> <underscore> <minus> : "₋" U208B # SUBSCRIPT MINUS
+<Multi_key> <underscore> <plus> : "₊" U208A # SUBSCRIPT PLUS
# Custom additions: Greek letters. Mapping corresponds to Emacs Greek
@@ -578,6 +581,18 @@ include "%L"
<Multi_key> <o> <minus> <plus> : "♀" U2640 # FEMALE SIGN
<Multi_key> <o> <minus> <greater> : "♂" U2642 # MALE SIGN
+
+<Multi_key> <Multi_key> <g> <a> <y> : "⚣" U26A3 # DOUBLED MALE SIGN
+<Multi_key> <Multi_key> <l> <e> <s> <b> <i> <a> <n> : "⚢" U26A2 # DOUBLED FEMALE SIGN
+<Multi_key> <Multi_key> <h> <e> <t> <e> <r> <o> : "⚤" U26A4 # INTERLOCKED FEMALE AND MALE SIGN
+
+# 'trans': short for transgender/transexual
+# 'genderq': short for genderqueer.
+# Wasn't sure which to call which symbol, and wanted to include both
+<Multi_key> <Multi_key> <t> <r> <a> <n> <s> : "⚥" U26A5 # MALE AND FEMALE SIGN
+<Multi_key> <Multi_key> <g> <e> <n> <d> <e> <r> <q> : "⚧" U26A7 # MALE WITH STROKE AND MALE AND FEMALE SIGN
+
+
<Multi_key> <O> <X>: "☠" U2620 # SKULL AND CROSSBONES
<Multi_key> <Multi_key> <s> <k> <u> <l> <l>: "☠" U2620 # SKULL AND CROSSBONES
<Multi_key> <Multi_key> <k> <b> <d> : "⌨" U2328 # KEYBOARD
@@ -624,6 +639,8 @@ include "%L"
<Multi_key> <asciicircum> <ampersand> <y> : "ʸ" U02B8 # SUPERSCRIPT Y
#Maybe add: ˀˁ˃˂
<Multi_key> <asciicircum> <minus> : "⁻" U207B # SUPERSCRIPT MINUS
+<Multi_key> <asciicircum> <plus> : "⁺" U207A # SUPERSCRIPT PLUS
+
<Multi_key> <asciitilde> <asciitilde> : "≈" U2248 # ALMOST EQUAL TO
<Multi_key> <s> <h> : "ʃ" U0283 # LATIN SMALL LETTER ESH
<Multi_key> <z> <h> : "ʒ" U0292 # LATIN SMALL LETTER EZH
@@ -682,6 +699,7 @@ include "%L"
<Multi_key> <numbersign> <C> : "𝄡" U0001d121 # MUSICAL SYMBOL C CLEF
<Multi_key> <numbersign> <o> <slash> : "♪" U266a # EIGHTH NOTE
<Multi_key> <numbersign> <o> <o> : "♫" U266b # BEAMED EIGHTH NOTES
+<Multi_key> <numbersign> <percent> : "♫" U266b # BEAMED EIGHTH NOTES
# Combining accents, for making things you don't have precomposed chars or keystrokes for:
@@ -801,6 +819,13 @@ include "%L"
<Multi_key> <Multi_key> <u> <r> <a> <n> <u> <s> : "♅" U2645 # URANUS (or ⛢ U26E2?)
<Multi_key> <Multi_key> <n> <e> <p> <t> <u> <n> <e> : "♆" U2646 # NEPTUNE
<Multi_key> <Multi_key> <p> <l> <u> <t> <o> : "♇" U2647 # PLUTO (ok, it isn't a planet anymore, but we still love it.)
+# Minor planets, whilst we're at it?
+<Multi_key> <Multi_key> <c> <e> <r> <e> <s> : "⚳" U26B3 # CERES
+<Multi_key> <Multi_key> <p> <a> <l> <l> <a> <s> : "⚴" U26B4 # PALLAS
+<Multi_key> <Multi_key> <j> <u> <n> <o> : "⚵" U26B5 # JUNO
+<Multi_key> <Multi_key> <v> <e> <s> <t> <a> : "⚶" U26B6 # VESTA
+<Multi_key> <Multi_key> <c> <h> <i> <r> <o> <n> : "⚷" U26B7 # CHIRON
+<Multi_key> <Multi_key> <l> <i> <l> <i> <t> <h> : "⚸" U26B8 # BLACK MOON LILITH
# Unicode 6.0 gave us all kinds of things, perhaps more than we can use...
diff --git a/treeprint.py b/treeprint.py
new file mode 100644
index 0000000..ce4f672
--- /dev/null
+++ b/treeprint.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+import sys
+import re
+
+"""
+This program slurps in a .XCompose file on standard input (or several
+concatenated together, since it won't follow includes) and outputs the
+compose sequences in an S-expression-like syntax, showing the prefix tree
+of sequences. This should bring together some of the groups that use a
+prefix-character, like * for the Greek alphabet and # for musical symbols.
+And scatter other related things far and wide. But it might be fun to look
+at.
+
+Prefix conflicts (in which you have a compose sequence that is the proper
+prefix of another) and exact conflicts (in which you have a compose
+sequence listed two with two different translations) cannot be handled
+gracefully in this notation, and they are not handled gracefully by this
+program. The tie is not broken in a consistent or predictable fashion,
+etc: this is a case of GIGO. Deal with it.
+"""
+
+def showdict(data, indent):
+ for (key, value) in data.iteritems():
+ print " "*indent + "("+key,
+ if type(value)==dict:
+ print ""
+ showdict(value, indent+4)
+ else:
+ print " "+value+")"
+
+
+listing={}
+
+try:
+ while True:
+ line=sys.stdin.next()
+ # print "((%s))"%line
+ startpos=0
+ name=[]
+ dupsfound=[]
+ while True:
+ m=re.match("\s*<(\w+)>",line[startpos:])
+ if not m:
+ break
+ word=m.group(1)
+ name.append(word)
+ startpos+=m.end()
+ if startpos<=0:
+ continue
+ m=re.match(r'[^"]*"(.+?)"',line)
+ if not m:
+ # shouldn't happen, but just in case
+ val='???'
+ print "couldn't make sense of line: "+line
+ else:
+ val=m.group(1)
+ cur=listing
+ for elt in name[:-1]:
+ if type(cur)==dict:
+ if not cur.has_key(elt):
+ cur[elt]={}
+ cur=cur[elt] # This will fail for prefix conflicts
+ else:
+ break # prefix conflict
+ # Presumably by now we're at the end, pointing to an empty dict.
+ if type(cur)==dict:
+ cur[name[-1]]=val
+ else:
+ # fail. Prefix conflict. Let's ignore it.
+ pass
+except StopIteration:
+ print "hit end"
+
+showdict(listing,0)
+
+