diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
| commit | 268a53de823a6750d6256ee1fb1e7707b4b45740 (patch) | |
| tree | 42c1799a9a82b2f7d9790ee9fe181d72a7274751 /sim/ucsim/put(c) | |
| download | sdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz | |
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'sim/ucsim/put(c)')
| -rwxr-xr-x | sim/ucsim/put(c) | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/sim/ucsim/put(c) b/sim/ucsim/put(c) new file mode 100755 index 0000000..d215649 --- /dev/null +++ b/sim/ucsim/put(c) @@ -0,0 +1,83 @@ +#!/bin/sh + +# Functions + +debug() +{ + if [ "$DEBUG" = "yes" ]; then + echo $* + fi +} + + +# Parsing options + +DEBUG=no +STARTYEAR=`date +%Y` +YEAR=`date +%y` +FILES="" + +while [ "$1" != "" ]; do +case $1 in + "-s") + shift + STARTYEAR=$1 + ;; + "-V") + DEBUG=yes + ;; + *) + if [ "$FILES" = "" ]; then + FILES=$1 + else + FILES="${FILES} ${1}" + fi + ;; +esac +shift +done + +debug "STARTYEAR= ${STARTYEAR}" +debug "FILES= ${FILES}" +debug "YEAR= ${YEAR}" + + +# Doing the job + +putit() +{ + debug "F= ${1}" + sed -n '/^\/\*@1@\*\//,$p' $1 >${1}.tmp + if [ -f '(c).1' ]; then + (sed 's|@@F@@|'${1}'|g + s|@@S@@|'${STARTYEAR}'|g + s|@@Y@@|'${YEAR}'|g' '(c).1' + cat ${1}.tmp) >$1 + else + (cat <<EOF +/* + * Simulator of MCS51 ${1} + * + * Copyright (c) Drotos Daniel, Talker Bt. ${STARTYEAR},${YEAR} + * + */ +EOF + cat ${1}.tmp) >$1 + fi + rm -f ${1}.tmp +} + +for FILE in ${FILES}; do + debug "Checking ${FILE}..." + if grep '^/\*@1@\*/' $FILE >/dev/null; then + # can do + debug "/*@1@*/ marker found in ${FILE}" + putit $FILE + else + # can not + debug "/*@1@*/ marker not found in ${FILE}" + fi +done + + +# End of putcopyright |
