diff options
Diffstat (limited to 'tools/build_numerics.sh')
-rwxr-xr-x | tools/build_numerics.sh | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/tools/build_numerics.sh b/tools/build_numerics.sh new file mode 100755 index 0000000..cb225a7 --- /dev/null +++ b/tools/build_numerics.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +########################################################################### +# # +# envbot - an IRC bot in bash # +# Copyright (C) 2007-2008 Arvid Norlander # +# # +# This program 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. # +# # +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. # +# # +########################################################################### +#--------------------------------------------------------------------- +## Generate list of numerics from the numerics.txt<br /> +## Output to STDOUT.<br /> +## Run this using make numerics in the main directory. +#--------------------------------------------------------------------- + +# Clean up env, just in case. +unset LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY +unset LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS +unset LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION +export LC_ALL=C +export LANG=C + +cat << EOF +#!/bin/bash +# -*- coding: utf-8 -*- +########################################################################### +# # +# envbot - an IRC bot in bash # +# Copyright (C) 2007-2008 Arvid Norlander # +# # +# This program 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. # +# # +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. # +# # +########################################################################### + +########################################################################### +# # +# WARNING THIS FILE IS AUTOGENERATED. ANY CHANGES WILL BE OVERWRITTEN! # +# See the source in tools/numerics.txt for comments about some numerics # +# This file was generated with tools/build_numerics.sh # +# # +########################################################################### +#--------------------------------------------------------------------- +## Auto-generated list of numerics from tools/numerics.txt<br /> +## This file contains a list of numerics that we currently use. +## It is therefore incomplete.<br /> +## Because the list of variables in this file is so long, please see +## it's source for more details. +#--------------------------------------------------------------------- + +########################## +# Name -> number mapping # +########################## + +EOF +# The numerics above are special case, otherwise bash strips leading 0. + +# Yes a bash file with .txt.. +source tools/numerics.txt || { echo 'Failed to source.' >&2; exit 1; } + +for index in ${!numeric[*]}; do + printf "numeric_%s='%03i'\n" "${numeric[$index]}" "$index" +done + +# Same special case as above. +cat << EOF + +########################## +# Number -> name mapping # +########################## + +EOF +for index in ${!numeric[*]}; do + echo "numerics[$index]='${numeric[$index]}'" +done + +cat << EOF + +# End of generated file. +EOF |