diff options
author | Nicolas Pouillard <np@nicolaspouillard.fr> | 2007-02-07 22:57:25 +0000 |
---|---|---|
committer | Nicolas Pouillard <np@nicolaspouillard.fr> | 2007-02-07 22:57:25 +0000 |
commit | 3cd78f0517cf627cc576a5f57790f71b8b7b3726 (patch) | |
tree | 8f37cedebf954dc93f65f8214dd84ba0719055e4 | |
parent | 9514ed06f4a16878cfb5171afa9e49be12e9c9a7 (diff) |
Use sed instead of awk for tolower
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7838 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rwxr-xr-x | build/mkmyocamlbuild_config.sh | 28 | ||||
-rw-r--r-- | build/tolower.sed | 11 |
2 files changed, 14 insertions, 25 deletions
diff --git a/build/mkmyocamlbuild_config.sh b/build/mkmyocamlbuild_config.sh index 9bd64b975..397a2997b 100755 --- a/build/mkmyocamlbuild_config.sh +++ b/build/mkmyocamlbuild_config.sh @@ -7,33 +7,11 @@ sed \ -e 's/\\"/"/g' \ -e 's/^\(#.*\)$/(* \1 *)/' \ -e 's/^\(.*\$([0-9]).*\)$/(* \1 *)/' \ - -e 's/^\([^(=]*\)=\([^"]*\)$/let <lower>\1<\/lower> = "\2";;/' \ - -e 's/\$(\([^)]*\))/"\^<lower>\1<\/lower>\^"/g' \ + -e 's/^\([^(=]*\)=\([^"]*\)$/let <:lower<\1>> = "\2";;/' \ + -e 's/\$(\([^)]*\))/"\^<:lower<\1>>\^"/g' \ -e 's/""\^//g' \ -e 's/\^""//g' \ -e 's/^let <lower>\(MAKE\|DO\).*$//g' \ -e 's/"true"/true/g' \ -e 's/"false"/false/g' \ - config/Makefile > myocamlbuild_config.tmp.ml - -# -# Some gory awk script to workaround the \L sed feature -# that is only part of gnused. -# -awk '{ - x = $0 ; - while (x ~ /<lower>/) { - i = index(x, "<lower>"); - j = index(x, "</lower>"); - xi = substr(x, 0, i - 1); - i2 = i + length("<lower>"); - xj = substr(x, i2, j - i2); - k = j + length("</lower>"); - xk = substr(x, k, length(x) - k + 1); - x = sprintf("%s%s%s", xi, tolower(xj), xk) - }; - printf("%s\n", x) }' \ - < myocamlbuild_config.tmp.ml > myocamlbuild_config.ml - -rm -f myocamlbuild_config.tmp.ml - + config/Makefile | sed -f build/tolower.sed | sed -f build/tolower.sed > myocamlbuild_config.ml diff --git a/build/tolower.sed b/build/tolower.sed new file mode 100644 index 000000000..ccd55fca4 --- /dev/null +++ b/build/tolower.sed @@ -0,0 +1,11 @@ +# tolower.sed expands one ...<:lower<FOO>>... to ...foo... per line +h +s/.*<:lower<\(.*\)>>.*/\1/ +t cont +b end +:cont +y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ +s/$/|/ +G +s/\(.*\)|\n\(.*\)<:lower<\(.*\)>>/\2\1/ +:end |