12to11/mime1.awk
2022-09-12 13:24:50 +00:00

34 lines
1.1 KiB
Awk

# Wayland compositor running on top of an X serer.
# Copyright (C) 2022 to various contributors.
# This file is part of 12to11.
# 12to11 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.
# 12to11 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 12to11. If not, see <https://www.gnu.org/licenses/>.
BEGIN {
print "#define DirectTransferInitializer(table, start) \\"
i = 0
}
/ ([a-z]+\/[-+.[:alnum:]]+) / { # Leave 2 spaces before and 1 space after
match ($0, / ([a-z]+\/[-+.[:alnum:]]+) /, array)
name = array[1]
gsub (/[[:punct:]]/, "_", name) # Convert to a valid atom name
printf " table[%d + start].atom = %s;\\\n", i++, name
}
END {
printf "\n"
}