📄 genarchdescrip.awk
字号:
## Copyright (C) 1998, 1999, 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 { ndescrip = 0; nlayout = 0;}/^arch/ { arch = $2;};/^(gen|fix|fpu|stat)/ { if ($6 == "*") next; if ($6 == "root") annex = 0; else annex = $6; if ($4 == "uint8_t") sz = 1; else if ($4 == "uint16_t") sz = 2; else if ($4 == "uint32_t") sz = 4; else if ($4 == "uint64_t") sz = 8; else if ($4 == "uint80_t") sz = 10; else if ($4 == "uint128_t") sz = 16; descrip[ndescrip] = sprintf("{ ARCH(%s), %s(%s), %d, %s }", arch, $3, $2, sz, $9); ndescrip++; # the zero is vestigial, and is supposed to be for the value offset. layout[nlayout] = sprintf("{ ARCH(%s), REG(%s), %d, %d, %d, 0, %d }", arch, $2, annex, $7, $8, sz); nlayout++;}END { printf("/* This file is automatically generated and is hereby\n"); printf(" placed in the public domain */\n\n"); printf("static RegDescrip Registers[] = {\n"); for (i = 0; i < ndescrip; i++) { printf(" %s%s\n", descrip[i], (i < (ndescrip - 1)) ? "," : ""); } printf("};\n"); printf("static RegLayout Layout[] = {\n"); for (i = 0; i < nlayout; i++) { printf(" %s%s\n", layout[i], (i < (nlayout - 1)) ? "," : ""); } printf("};\n");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -