ltypes

来自「u-boot 源代码」· 代码 · 共 56 行

TXT
56
字号
#!/bin/bashif [ $# -ne 1 ]then    echo "usage: Ltypes filename" >&2    exit 2fiFILE="$1"#TMPFILE='mktemp "${FILE}.XXXXXX"' || exit 1TMPFILE=${FILE}.`date "+%s"`touch $TMPFILE || exit 1# Change all the Xilinx types to Linux types and put the result into a temp filesed	\	-e 's/\bXTRUE\b/TRUE/g' \	-e 's/\bXFALSE\b/FALSE/g' \	-e 's/\bXNULL\b/NULL/g' \	-e 's/"xenv.h"/<asm\/delay.h>/g' \	-e 's/\bXENV_USLEEP\b/udelay/g' \	-e 's/\bXuint8\b/u8/g' \	-e 's/\bXuint16\b/u16/g' \	-e 's/\bXuint32\b/u32/g' \	-e 's/\bXint8\b/s8/g' \	-e 's/\bXint16\b/s16/g' \	-e 's/\bXint32\b/s32/g' \	-e 's/\bXboolean\b/u32/g' \	"${FILE}" > "${TMPFILE}"# Overlay the original file with the temp filemv "${TMPFILE}" "${FILE}"# Are we doing xbasic_types.h?if [ "${FILE##*/}" = xbasic_types.h ]then    # Remember as you're reading this that we've already gone through the prior    # sed script.  We need to do some other things to xbasic_types.h:    #   1) Add ifndefs around TRUE and FALSE defines    #   2) Remove definition of NULL as NULL    #   3) Replace most of the primitive types section with a #include    sed \	-e '/u32 true/,/#define false/Ic\#ifndef TRUE\#define TRUE 1\#endif\#ifndef FALSE\#define FALSE 0\#endif' \	-e '/#define[[:space:]][[:space:]]*NULL[[:space:]][[:space:]]*NULL/d' \	-e '/typedef[[:space:]][[:space:]]*unsigned[[:space:]][[:space:]]*char[[:space:]][[:space:]]*u8/,/typedef[[:space:]][[:space:]]*unsigned[[:space:]][[:space:]]*long[[:space:]][[:space:]]*u32.*boolean/c\#include <linux/types.h>' \	"${FILE}" > "${TMPFILE}"    mv "${TMPFILE}" "${FILE}"fi

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?