[thrift] highly concurrent Erlang goodness
Summary:
* shim to use object-oriented code as gen_servers
* high(er) performance Erlang-style server and transport
* sane packaging based on otp-base, i.e. Makefiles and real structure
Test Plan: tutorial server offers the same (subset of) functionality as previous version
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665164 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/build/beamver b/lib/erl/build/beamver
new file mode 100644
index 0000000..fe448b9
--- /dev/null
+++ b/lib/erl/build/beamver
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# erlwareSys: otp/build/beamver,v 1.1 2002/02/14 11:45:20 hal Exp $
+
+# usage: beamver <beam_file>
+#
+# if there's a usable -vsn() attribute, print it and exit with status 0
+# otherwise, print nothing and exit with status 1
+
+# From the Erlang shell:
+#
+# 5> code:which(acca_inets).
+# "/home/martin/work/otp/releases/<app>/../../acca/ebin/<app>.beam"
+#
+# 8> beam_lib:version(code:which(<app>)).
+# {ok,{<app>,['$Id: beamver,v 1.1.1.1 2003/06/13 21:43:21 mlogan Exp $ ']}}
+
+# TMPFILE looks like this:
+#
+# io:format("hello ~p~n",
+# beam_lib:version("/home/hal/work/otp/acca/ebin/acca_inets.beam")]).
+
+TMPFILE=/tmp/beamver.$$
+
+# exit with failure if we can't read the file
+test -f "$1" || exit 1
+BEAMFILE=\"$1\"
+
+cat > $TMPFILE <<_EOF
+io:format("~p~n",
+ [beam_lib:version($BEAMFILE)]).
+_EOF
+
+# beam_result is {ok,{Module_name, Beam_version} or {error,beam_lib,{Reason}}
+beam_result=`erl -noshell \
+ -s file eval $TMPFILE \
+ -s erlang halt`
+
+rm -f $TMPFILE
+
+# sed regexes:
+# remove brackets and anything outside them
+# remove quotes and anything outside them
+# remove apostrophes and anything outside them
+# remove leading and trailing spaces
+
+case $beam_result in
+\{ok*)
+ echo $beam_result | sed -e 's/.*\[\(.*\)].*/\1/' \
+ -e 's/.*\"\(.*\)\".*/\1/' \
+ -e "s/.*\'\(.*\)\'.*/\1/" \
+ -e 's/ *$//' -e 's/^ *//'
+ exit 0
+ ;;
+*)
+ exit 1
+ ;;
+esac
+