Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdeel Mujahid <3840695+am11@users.noreply.github.com>2020-12-23 03:52:26 +0300
committerGitHub <noreply@github.com>2020-12-23 03:52:26 +0300
commit8f463670ed885a3a70e1ac87809b8eda2926fc4d (patch)
tree44bd6d4f034dc0826f1d65aade2c34bf76f752d8 /src/coreclr/generateredefinesfile.sh
parent7a02953aefe74050837164d9c0ec141aed2cbf8d (diff)
Replace AWK with Bash scripts (#46313)
* Replace AWK with Bash scripts * Replace awk usage with Bash or POSIX tr * Simplify genmoduleindex.sh
Diffstat (limited to 'src/coreclr/generateredefinesfile.sh')
-rwxr-xr-xsrc/coreclr/generateredefinesfile.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/coreclr/generateredefinesfile.sh b/src/coreclr/generateredefinesfile.sh
new file mode 100755
index 00000000000..ff0954da8b3
--- /dev/null
+++ b/src/coreclr/generateredefinesfile.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+saved=("$@")
+while test $# -gt 0; do
+ case "$1" in
+ --help|-h)
+ printf "Usage:\ngenerateredefinesfile.sh <filename> <jump instruction for the platform> <prefix of what is being mapped from> <prefix of what is being mapped to>\n"
+ exit 1;;
+ esac
+ shift
+done
+set -- "${saved[@]}"
+
+jump="$2"
+prefix1="$3"
+prefix2="$4"
+
+while read -r line; do
+ # Skip empty lines and comment lines starting with semicolon
+ if [[ "$line" =~ ^\;.*$|^[[:space:]]*$ ]]; then
+ continue
+ fi
+
+ # Remove the CR character in case the sources are mapped from
+ # a Windows share and contain CRLF line endings
+ line="${line//$'\r'/}"
+
+ # Only process the entries that begin with "#"
+ if [[ "$line" =~ ^#.*$ ]]; then
+ line="${line//#/}"
+ printf "LEAF_ENTRY %s%s, _TEXT\n" "$prefix1" "$line"
+ printf " %s EXTERNAL_C_FUNC(%s%s)\n" "$jump" "$prefix2" "$line"
+ printf "LEAF_END %s%s, _TEXT\n\n" "$prefix1" "$line"
+ fi
+done < "$1"