📄 genkeytypes.awk
字号:
## Copyright (C) 2000, Jonathan S. Shapiro.## This file is part of the EROS Operating System.## 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 2,# 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, write to the Free Software# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.## program to generate ArchDescrip stuff for EROSIMG library.# Note that this version handles only one architecture, which# is something we really should fix someday.BEGIN { nPrimary = 0; nMisc = 0; nDomain = 0; nAkt = 0;}/^primary/ { primary[nPrimary] = $2; publish_akt[$2] = 1; nPrimary++;};/^noakt/ { publish_akt[$2] = 0;};/^domain/ { domain[nDomain] = $2; nDomain++;};END { printf("#ifndef __STDKEYTYPE_H__\n"); printf("#define __STDKEYTYPE_H__\n"); printf("/* This file is automatically generated and is hereby\n"); printf(" placed in the public domain */\n\n"); for (i = 0; i < nPrimary; i++) { printf("#define KT_%-20s %d /* %s key (primary) */\n", primary[i], i, primary[i]); if (publish_akt[primary[i]]) printf("#define AKT_%-20s %d /* %s key (primary) */\n", primary[i], i, primary[i]); } printf("#define KT_NUM_KEYTYPE %d\n", i); for (i = 0; i < nAkt; i++) { printf("#define AKT_%-20s %d /* %s key (akt) */\n", akt[i], i+128, akt[i]); } printf("\n/* Standard domains: */\n\n"); for (i = 0; i < nDomain; i++) { printf("#define SKT_%-20s %d /* %s key (domain) */\n", domain[i], i+65536, domain[i]); printf("#define AKT_%-20s %d /* %s key (domain) */\n", domain[i], i+65536, domain[i]); } printf("\n"); printf("#endif /* __STDKEYTYPE_H__ */\n\n"); printf("/* Lines below are intentionally multiply includable. They are\n"); printf(" provided for use by applications that may need to perform\n"); printf(" per-keytype declarations. */\n\n"); printf("#ifndef __EROS_PRIMARY_KEYDEF\n"); printf("#define __EROS_PRIMARY_KEYDEF(name)\n"); printf("#endif /* __EROS_PRIMARY_KEYDEF */\n\n"); printf("#ifndef __EROS_MISC_KEYDEF\n"); printf("#define __EROS_MISC_KEYDEF(name)\n"); printf("#endif /* __EROS_MISC_KEYDEF */\n\n"); printf("#ifndef __EROS_DOMAIN_KEYDEF\n"); printf("#define __EROS_DOMAIN_KEYDEF(name)\n"); printf("#endif /* __EROS_DOMAIN_KEYDEF */\n\n"); for (i = 0; i < nPrimary; i++) { printf("__EROS_PRIMARY_KEYDEF(%s)\n", primary[i]); } printf("\n"); for (i = 0; i < nMisc; i++) { printf("__EROS_MISC_KEYDEF(%s)\n", misc[i]); } printf("\n"); for (i = 0; i < nDomain; i++) { printf("__EROS_DOMAIN_KEYDEF(%s)\n", domain[i]); } printf("#undef __EROS_PRIMARY_KEYDEF\n"); printf("#undef __EROS_MISC_KEYDEF\n"); printf("#undef __EROS_DOMAIN_KEYDEF\n");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -