#!/usr/bin/awk -f ## Copyright (C) 2020 Free Software Foundation, Inc. ## Author: Robert Pluim ## This file is part of GNU Emacs. ## GNU Emacs is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## GNU Emacs is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License ## along with GNU Emacs. If not, see . ### Commentary: ## This script takes as input Unicode's emoji-zwj-sequences.txt ## (https://www.unicode.org/Public/emoji/12.0/emoji-zwj-sequences.txt) ## and produces output for Emacs's lisp/international/emoji-zwj.el. ## For additional details, see . ## Things to do after installing a new version of emoji-zwj-sequences.txt: ## Check the output against the old output. ### Code: /^[0-9A-F]/ { sub(/ *;.*/, "", $0) num = split($0, elts) if (ch[elts[1]] == "") { vec[elts[1]] = "" ch[elts[1]] = elts[1] } else { vec[elts[1]] = vec[elts[1]] " " } vec[elts[1]] = vec[elts[1]] "\"" for (j = 1; j <= num; j++) { c = sprintf("\\N{U+%s}", elts[j]) vec[elts[1]] = vec[elts[1]] c } vec[elts[1]] = vec[elts[1]] "\"" } END { print ";;; emoji-zwj.el --- emoji zwj character composition table" print ";;; Automatically generated from admin/unidata/emoji-zwj-sequences.txt" print "(dolist (elt '(" for (elt in ch) { printf("(#x%s . (%s))\n", elt, vec[elt]) } print " ))" print " (set-char-table-range composition-function-table" print " (car elt)" print " (list (vector (regexp-opt (cdr elt))" print " 0" print " 'compose-gstring-for-graphic))))" print "\n" print "(provide 'emoji-zwj)" }