diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2016-03-12 17:48:57 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2016-03-12 17:48:57 +0000 |
commit | 534db770dbe8c358ea267df20145e9793fb0275a (patch) | |
tree | 66989fb4e5511b4efe5652cf5312ac4f160bfd01 /protocols/Telegram/docs/tgl/gen_constants_h.awk | |
parent | 461f53bf697335fabdc82c6c9143e6020de4f022 (diff) |
tgl inside telegram
git-svn-id: http://svn.miranda-ng.org/main/trunk@16471 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Telegram/docs/tgl/gen_constants_h.awk')
-rw-r--r-- | protocols/Telegram/docs/tgl/gen_constants_h.awk | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/protocols/Telegram/docs/tgl/gen_constants_h.awk b/protocols/Telegram/docs/tgl/gen_constants_h.awk new file mode 100644 index 0000000000..74d20a70e2 --- /dev/null +++ b/protocols/Telegram/docs/tgl/gen_constants_h.awk @@ -0,0 +1,37 @@ +BEGIN { + print "/*"; + print " This file is part of telegram-client."; + print ""; + print " Telegram-client is free software: you can redistribute it and/or modify"; + print " it under the terms of the GNU General Public License as published by"; + print " the Free Software Foundation, either version 2 of the License, or"; + print " (at your option) any later version."; + print ""; + print " Telegram-client is distributed in the hope that it will be useful,"; + print " but WITHOUT ANY WARRANTY; without even the implied warranty of"; + print " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"; + print " GNU General Public License for more details."; + print ""; + print " You should have received a copy of the GNU General Public License"; + print " along with this telegram-client. If not, see <http://www.gnu.org/licenses/>."; + print ""; + print " Copyright Vitaly Valtman 2013"; + print "*/"; + print "#ifndef CONSTANTS_H"; + print "#define CONSTANTS_H"; +} +// { + if (split ($1, a, "#") == 2) { + gsub (/[ABCDEFGHIJKLMNOPQRSTUVWXYZ]/, "_&", a[1]); + gsub (/[.]/, "_", a[1]); + if (a[2] in h) { + print "ERROR: Duplicate magic " a[2] " for define " a[1] " and " h[a[2]] > "/dev/stderr" + exit 1; + } + h[a[2]] = a[1]; + print "#define", "CODE_" tolower(a[1]), "0x" a[2]; + } +} +END { + print "#endif"; +} |