📄 generate.sh
字号:
#!/bin/sh -x# useful for emacs -*- sh -*-# ######################################################################### Common functions for all shell scripts in this directory# ######################################################################### $Id: generate.sh,v 1.3 1998/11/06 13:05:26 paubert Exp $# ######################################################################### ######################################################################### slprintbegin()# ######################################################################### $1 name of outputfile# $2 name of generator file# $3 list of files# ########################################################################function slprintbegin(){outputfile=$1radic=$2rm -f $outputfilecat > $outputfile << EOF// ------------------------------------------------------- -*- c++ -*- --//// WARNING: FILE AUTOMATICALLY GENERATED WITH ${radic}//// ----------------------------------------------------------------------EOFshift 2for i in $*; do echo "// from: " `basename $i` >> $outputfiledonecat >> $outputfile << EOF// ----------------------------------------------------------------------EOF}# ######################################################################### slprintend()# ######################################################################### $1 name of outputfile# ########################################################################function slprintend(){outputfile=$1cat >> $outputfile << EOF// ----------------------------------------------------------------------// end of fileEOF}# ######################################################################### slsimpleprint()# ######################################################################### $1 array list of name# $2 array list of operator# $3 string radical# $4 string outpufile# $5 string srcdir# ########################################################################function slsimpleprint(){ local i declare -a name=(`echo $1`) declare -a operator=(`echo $2`) radical=$3 outputfile=$4 srcdir=$5 let i=0 while test x${name[$i]} != x""; do sed -e "s/_name_/${name[$i]}/g" \ -e "s/_filename_/${radical}.hxx/g" \ -e "s/_operator_/${operator[$i]}/g" \ ${srcdir}/${radical}.hxx >> $outputfile let i=$((i+1)) done}# ######################################################################### slmultiprint()# ######################################################################### $1 string list of suffix# $2 array list of name# $3 array list of operator# $4 string radical# $5 string outpufile# $6 string srcdir# ########################################################################function slmultiprint(){ local i local j declare -a suffixlist=(`echo $1`) declare -a name=(`echo $2`) declare -a operator=(`echo $3`) radical=$4 outputfile=$5 srcdir=$6# loop over suffixes let j=0 while test x"${suffixlist[$j]}" != x""; do let i=0# for each name and operator substitute via sed and generate outputfile while test x"${name[$i]}" != x""; do sed -e "s/_name_/${name[$i]}/g" \ -e "s/_filename_/${radical}_${suffixlist[$j]}.hxx/g" \ -e "s/_operator_/${operator[$i]}/g" \ ${srcdir}/${radical}_${suffixlist[$j]}.hxx >> $outputfile let i=$((i+1)) done let j=$((j+1)) done}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -