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

generateredefinesfile.sh « coreclr « src - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ff0954da8b3bc893ba15ef858794fdbad000f3d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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"