Remove all of the old Erlang stuff in preparation for renaming alterl.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666480 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5d2e1fa..8cbb80f 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -11,12 +11,11 @@
endif
if ENABLE_ERLANG
-SUBDIRS += erl
+SUBDIRS += alterl
endif
EXTRA_DIST = \
cocoa \
- erl \
hs \
ocaml \
perl \
diff --git a/lib/erl/COPYING b/lib/erl/COPYING
deleted file mode 100644
index 0101a7d..0000000
--- a/lib/erl/COPYING
+++ /dev/null
@@ -1,24 +0,0 @@
-Thrift Software License
-Copyright (c) 2006- Facebook, Inc.
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
diff --git a/lib/erl/LICENSE b/lib/erl/LICENSE
deleted file mode 100644
index 0101a7d..0000000
--- a/lib/erl/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-Thrift Software License
-Copyright (c) 2006- Facebook, Inc.
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
diff --git a/lib/erl/Makefile b/lib/erl/Makefile
deleted file mode 100644
index 09b1d1f..0000000
--- a/lib/erl/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-MODULES = \
- src
-
-all clean docs:
- for dir in $(MODULES); do \
- (cd $$dir; ${MAKE} $@); \
- done
-
-check: all
-
-distclean: clean
-
-# Hack to make "make dist" work.
-# This should not work, but it appears to.
-distdir:
diff --git a/lib/erl/README b/lib/erl/README
deleted file mode 100644
index caea067..0000000
--- a/lib/erl/README
+++ /dev/null
@@ -1,82 +0,0 @@
-Thrift Erlang Library
-
-README Author: Chris Piro (cpiro@facebook.com)
-Last Modified: 2007-Sep-17
-
-Thrift is distributed under the Thrift open source software license.
-Please see the included LICENSE file.
-
-Using Thrift with Erlang
-========================
-
-The Thrift Erlang binding is built using GNU make. Run `make' in
-lib/erl to generate the necessary .beam object files in lib/erl/ebin/.
-Although the directories are laid out much like an OTP application,
-these bindings (as you will soon discover) are not an OTP application
-proper. When starting the Erlang emulator (interpreter) you must use
-`-pa /path/to/thrift/lib/erl/ebin' to load the bindings.
-
-Running the Tutorial
-====================
-
-It is recommended to pattern your own servers after the tutorial
-included in tutorial/. Generate the gen-erl/ directory by running
-tutorial.thrift, then cd to tutorial/erl/ and run server.sh. This
-script includes the commmands necessary to compile the generated
-Erlang source, compile the tutorial server itself, and open the Erlang
-emulator. At the emulator prompt, type `server:start()' to begin
-listening for connections.
-
-Note that there is no tutorial client; you may use a supplied client
-in another language.
-
-Implementation Notes
-====================
-
-tExecptions and t*Factorys are straight "new" -- e.g. TF =
-tTransportFactory:new() everything else is start_new
-(i.e. gen_server:start_link) -- this spawns a process and returns a
-pid
-
-tErlProcessor is a shim around the generated code (which is not
-actually a gen_server). Of course tErlProcessor isn't a gen_server
-either ... thrift_oop_server is a shim to make our "Thrift objects"
-gen_servers. Maybe we should remove some layers?
-
-get/set never means process dictionary
-
-Use tErlServer and tErlAcceptor. tSimpleServer and tServerSocket as
-are present in the other bindings are incompatible by design ... the
-call trace is spastic across the process tree. tErlServer and
-tErlAcceptor follow the same model as iserve:
-
- * the top level code spawns a tErlServer, which listens on a socket
- * a tErlAcceptor is spawned and calls accept() on the listening
-socket
- * when accept() finishes, the tErlAcceptor
- * tells the tErlServer to spawn a new acceptor
- * handles the requests by spawning a processor, a transport, and a
-protocol
- * (the tricky part) when the socket closes, the protocol exits, so:
- * the transport exits because it's the one caller of the protocol
- * likewise, the processor exits because it's the caller of the
-transport
- * the tErlAcceptor traps the protocol's exit and exits with an
-acceptor_done
- * the tErlServer sees that the acceptor exited and does nothing
-since there is already another acceptor accept()ing on the listen
-socket
-
-For info about iserve: http://www.trapexit.org/A_fast_web_server_demonstrating_some_undocumented_Erlang_features
-
-Final Thoughts
-==============
-
-This binding is a work in progress. It's certainly less thoroughly
-tested than the other, older bindings. Despite using parts from
-otp_base it is not packaged well, nor is it an OTP application (not to
-mention its many smaller transgressions). This implementation
-intentionally patterns after the other bindings (which is why there's
-oop.erl and thrift_oop_server), but regretfully it departs from
-idiomatic Erlang. Please see the included TODO and contribute your
-improvements back to the project.
diff --git a/lib/erl/TODO b/lib/erl/TODO
deleted file mode 100644
index 03384fb..0000000
--- a/lib/erl/TODO
+++ /dev/null
@@ -1,35 +0,0 @@
-make thrift a proper OTP application
- * app-wide configuration (do DNS lookups?)
- * default protocols / transports (forget this factory business)
- * factor for elegance
-
-tutorial client
-
-make all methods effectful, remove the special casing (optionally, implement monads for Erlang)
-
-change objects from {record_tag, ...} to {oop_object, {record_tag, ...}, other_useful_stuff}
-so 1) we know exactly what's an object (can write is_object/1) e.g.
- is the tuple {tTransportException, ...} an object or a tuple that happens to start with that atom?
- we can't check this using is_record/2 without include every header file
- also, this makes it easy to pick objects out of deep tuples
- 2) we can build more functionality into oop later if need be
- carry around the class/superclasses so is_a(Object, ClassOrSuperclass) is easy
- 3) maybe hack up io:format and friends to run objects through oop:inspect automatically
-
-Currently we can't distingish a method exiting in the middle with an undef or function_clause from a method not being defined in a module. Big example: if the generated code can't be called at tErlProcessor.erl:63, it will exit with a missing_method not because tErlProcessor:process/3 is undefined, but because GP:process/3 is undefined, but the error makes it seem like the former happened. The oop code needs to be smarter -- I think it's possible to either a) hook into Erlang's missing function handler or b) do some introspection to determine directly whether a function is defined, rather than trying to infer from the exit.
-
-test suites
-
-move as much (program logic) as possible out of thrift_logger
-
-make thrift_logger 100% robust
-
-thrift_logger detects term width?
-
-undisgustify codegen
-
-move away from thrift_oop_server shim to straight-up gen_servers
-
-move away from Factories
-
-move away from ?L0, ?M0, and friends ... make calls in oop or individual modules (like gen_servers should be)
diff --git a/lib/erl/build/beamver b/lib/erl/build/beamver
deleted file mode 100644
index 2b5f77b..0000000
--- a/lib/erl/build/beamver
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/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
-
diff --git a/lib/erl/build/buildtargets.mk b/lib/erl/build/buildtargets.mk
deleted file mode 100644
index db52b78..0000000
--- a/lib/erl/build/buildtargets.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-EBIN ?= ../ebin
-ESRC ?= .
-EMULATOR = beam
-
-ERLC_WFLAGS = -W
-ERLC = erlc $(ERLC_WFLAGS) $(ERLC_FLAGS)
-ERL = erl -boot start_clean
-
-$(EBIN)/%.beam: $(ESRC)/%.erl
- @echo " ERLC $<"
- @$(ERLC) $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(EBIN) $<
-
-.erl.beam:
- $(ERLC) $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(dir $@) $<
-
diff --git a/lib/erl/build/colors.mk b/lib/erl/build/colors.mk
deleted file mode 100644
index 4d69c41..0000000
--- a/lib/erl/build/colors.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# Colors to assist visual inspection of make output.
-
-# Colors
-LGRAY=$$'\e[0;37m'
-DGRAY=$$'\e[1;30m'
-LGREEN=$$'\e[1;32m'
-LBLUE=$$'\e[1;34m'
-LCYAN=$$'\e[1;36m'
-LPURPLE=$$'\e[1;35m'
-LRED=$$'\e[1;31m'
-NO_COLOR=$$'\e[0m'
-DEFAULT=$$'\e[0m'
-BLACK=$$'\e[0;30m'
-BLUE=$$'\e[0;34m'
-GREEN=$$'\e[0;32m'
-CYAN=$$'\e[0;36m'
-RED=$$'\e[0;31m'
-PURPLE=$$'\e[0;35m'
-BROWN=$$'\e[0;33m'
-YELLOW=$$'\e[1;33m'
-WHITE=$$'\e[1;37m'
-
-BOLD=$$'\e[1;37m'
-OFF=$$'\e[0m'
diff --git a/lib/erl/build/docs.mk b/lib/erl/build/docs.mk
deleted file mode 100644
index b0b7377..0000000
--- a/lib/erl/build/docs.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-EDOC_PATH=../../../tools/utilities
-
-#single place to include docs from.
-docs:
- @mkdir -p ../doc
- @echo -n $${MY_BLUE:-$(BLUE)}; \
- $(EDOC_PATH)/edoc $(APP_NAME); \
- if [ $$? -eq 0 ]; then \
- echo $${MY_LRED:-$(LRED)}"$$d Doc Failed"; \
- fi; \
- echo -n $(OFF)$(NO_COLOR)
-
diff --git a/lib/erl/build/mime.types b/lib/erl/build/mime.types
deleted file mode 100644
index d6e3c0d..0000000
--- a/lib/erl/build/mime.types
+++ /dev/null
@@ -1,98 +0,0 @@
-
-application/activemessage
-application/andrew-inset
-application/applefile
-application/atomicmail
-application/dca-rft
-application/dec-dx
-application/mac-binhex40 hqx
-application/mac-compactpro cpt
-application/macwriteii
-application/msword doc
-application/news-message-id
-application/news-transmission
-application/octet-stream bin dms lha lzh exe class
-application/oda oda
-application/pdf pdf
-application/postscript ai eps ps
-application/powerpoint ppt
-application/remote-printing
-application/rtf rtf
-application/slate
-application/wita
-application/wordperfect5.1
-application/x-bcpio bcpio
-application/x-cdlink vcd
-application/x-compress Z
-application/x-cpio cpio
-application/x-csh csh
-application/x-director dcr dir dxr
-application/x-dvi dvi
-application/x-gtar gtar
-application/x-gzip gz
-application/x-hdf hdf
-application/x-httpd-cgi cgi
-application/x-koan skp skd skt skm
-application/x-latex latex
-application/x-mif mif
-application/x-netcdf nc cdf
-application/x-sh sh
-application/x-shar shar
-application/x-stuffit sit
-application/x-sv4cpio sv4cpio
-application/x-sv4crc sv4crc
-application/x-tar tar
-application/x-tcl tcl
-application/x-tex tex
-application/x-texinfo texinfo texi
-application/x-troff t tr roff
-application/x-troff-man man
-application/x-troff-me me
-application/x-troff-ms ms
-application/x-ustar ustar
-application/x-wais-source src
-application/zip zip
-audio/basic au snd
-audio/mpeg mpga mp2
-audio/x-aiff aif aiff aifc
-audio/x-pn-realaudio ram
-audio/x-pn-realaudio-plugin rpm
-audio/x-realaudio ra
-audio/x-wav wav
-chemical/x-pdb pdb xyz
-image/gif gif
-image/ief ief
-image/jpeg jpeg jpg jpe
-image/png png
-image/tiff tiff tif
-image/x-cmu-raster ras
-image/x-portable-anymap pnm
-image/x-portable-bitmap pbm
-image/x-portable-graymap pgm
-image/x-portable-pixmap ppm
-image/x-rgb rgb
-image/x-xbitmap xbm
-image/x-xpixmap xpm
-image/x-xwindowdump xwd
-message/external-body
-message/news
-message/partial
-message/rfc822
-multipart/alternative
-multipart/appledouble
-multipart/digest
-multipart/mixed
-multipart/parallel
-text/html html htm
-text/x-server-parsed-html shtml
-text/plain txt
-text/richtext rtx
-text/tab-separated-values tsv
-text/x-setext etx
-text/x-sgml sgml sgm
-video/mpeg mpeg mpg mpe
-video/quicktime qt mov
-video/x-msvideo avi
-video/x-sgi-movie movie
-x-conference/x-cooltalk ice
-x-world/x-vrml wrl vrml
diff --git a/lib/erl/build/otp.mk b/lib/erl/build/otp.mk
deleted file mode 100644
index 1d16e2c..0000000
--- a/lib/erl/build/otp.mk
+++ /dev/null
@@ -1,146 +0,0 @@
-# +----------------------------------------------------------------------+
-# $Id: otp.mk,v 1.4 2004/07/01 14:57:10 tfee Exp $
-# +----------------------------------------------------------------------+
-
-# otp.mk
-# - to be included in all OTP Makefiles
-# installed to /usr/local/include/erlang/otp.mk
-
-# gmake looks in /usr/local/include - that's hard-coded
-# users of this file will use
-# include erlang/top.mk
-
-# most interface files will be installed to $ERL_RUN_TOP/app-vsn/include/*.hrl
-
-# group owner for library/include directories
-ERLANGDEV_GROUP=erlangdev
-
-# ERL_TOP is root of Erlang source tree
-# ERL_RUN_TOP is root of Erlang target tree (some Ericsson Makefiles use $ROOT)
-# ERLANG_OTP is target root for Erlang code
-# - see sasl/systools reference manual page; grep "TEST"
-
-# OS_TYPE is FreeBSD, NetBSD, OpenBSD, Linux, SCO_SV, SunOS.
-OS_TYPE=${shell uname}
-
-# MHOST is the host where this Makefile runs.
-MHOST=${shell hostname -s}
-ERL_COMPILE_FLAGS+=-W0
-
-# The location of the erlang runtime system.
-ifndef ERL_RUN_TOP
-ERL_RUN_TOP=/usr/local/lib/erlang
-endif
-
-
-# Edit to reflect local environment.
-# ifeq (${OS_TYPE},Linux)
-# ERL_RUN_TOP=/usr/local/lib/erlang
-# Note* ERL_RUN_TOP can be determined by starting an
-# erlang shell and typing code:root_dir().
-# ERL_TOP=a symbolic link to the actual source top, which changes from version to version
-# Note* ERL_TOP is the directory where the erlang
-# source files reside. Make sure to run ./configure there.
-# TARGET=i686-pc-linux-gnu
-# Note* Target can be found in $ERL_TOP/erts
-# endif
-
-# See above for directions.
-ifeq (${OS_TYPE},Linux)
-ERL_TOP=/opt/OTP_SRC
-TARGET=i686-pc-linux-gnu
-endif
-
-ERLANG_OTP=/usr/local/erlang/otp
-VAR_OTP=/var/otp
-
-
-# Aliases for common binaries
-# Note - CFLAGS is modified in erlang.conf
-
-
-################################
-# SunOS
-################################
-ifeq (${OS_TYPE},SunOS)
-
- CC=gcc
- CXX=g++
- AR=/usr/ccs/bin/ar
- ARFLAGS=-rv
- CXXFLAGS+=${CFLAGS} -I/usr/include/g++
- LD=/usr/ccs/bin/ld
- RANLIB=/usr/ccs/bin/ranlib
-
-CFLAGS+=-Wall -pedantic -ansi -O
-CORE=*.core
-endif
-
-
-################################
-# FreeBSD
-################################
-ifeq (${OS_TYPE},FreeBSD)
-
- ifdef LINUXBIN
- COMPAT_LINUX=/compat/linux
- CC=${COMPAT_LINUX}/usr/bin/gcc
- CXX=${COMPAT_LINUX}/usr/bin/g++
- AR=${COMPAT_LINUX}/usr/bin/ar
- ARFLAGS=-rv
- CXXFLAGS+=-fhandle-exceptions ${CFLAGS} -I${COMPAT_LINUX}/usr/include/g++
- LD=${COMPAT_LINUX}/usr/bin/ld
- RANLIB=${COMPAT_LINUX}/usr/bin/ranlib
- BRANDELF=brandelf -t Linux
- else
- CC=gcc
- CXX=g++
- AR=/usr/bin/ar
- ARFLAGS=-rv
- CXXFLAGS+=-fhandle-exceptions ${CFLAGS} -I/usr/include/g++
- LD=/usr/bin/ld
- RANLIB=/usr/bin/ranlib
- BRANDELF=@true
-
- ifdef USES_PTHREADS
- CFLAGS+=-D_THREAD_SAFE
- LDFLAGS+=-lc_r
-
- # -pthread flag for 3.0+
- ifneq (${shell uname -r | cut -d. -f1},2)
- CFLAGS+=-pthread
- endif
- endif
- endif
-
-CFLAGS+=-Wall -pedantic -ansi -O -DFREEBSD
-CORE=*.core
-endif
-
-################################
-# OpenBSD
-################################
-ifeq (${OS_TYPE},OpenBSD)
-
- CC=gcc
- CXX=g++
- AR=/usr/bin/ar
- ARFLAGS=-rv
- CXXFLAGS+=${CFLAGS} -I/usr/include/g++
- LD=/usr/bin/ld
- RANLIB=/usr/bin/ranlib
-
- ifdef USES_PTHREADS
- CFLAGS+=-D_THREAD_SAFE
- LDFLAGS+=-lc_r
-
- # -pthread flag for 3.0+
- ifneq (${shell uname -r | cut -d. -f1},2)
- CFLAGS+=-pthread
- endif
- endif
-
-CFLAGS+=-Wall -pedantic -ansi -O -DOPENBSD
-CORE=*.core
-endif
-
diff --git a/lib/erl/build/otp_subdir.mk b/lib/erl/build/otp_subdir.mk
deleted file mode 100644
index 2a36c65..0000000
--- a/lib/erl/build/otp_subdir.mk
+++ /dev/null
@@ -1,85 +0,0 @@
-# Comment by tfee 2004-07-01
-# ==========================
-# This file is a mod of the stock OTP one.
-# The change allows make to stop when a compile error occurs.
-# This file needs to go into two places:
-# /usr/local/include/erlang
-# /opt/OTP_SRC/make
-#
-# where OTP_SRC is a symbolic link to a peer directory containing
-# the otp source, e.g. otp_src_R9C-2.
-#
-# After installing OTP, running sudo make install in otp/build
-# will push this file out to the two places listed above.
-#
-# The mod involves setting the shell variable $short_circuit, which we
-# introduce - ie it is not in the stock file. This variable is tested
-# to affect execution flow and is also returned to affect the flow in
-# the calling script (this one). The latter step is necessary because
-# of the recursion involved.
-# =====================================================================
-
-
-# ``The contents of this file are subject to the Erlang Public License,
-# Version 1.1, (the "License"); you may not use this file except in
-# compliance with the License. You should have received a copy of the
-# Erlang Public License along with this software. If not, it can be
-# retrieved via the world wide web at http://www.erlang.org/.
-#
-# Software distributed under the License is distributed on an "AS IS"
-# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-# the License for the specific language governing rights and limitations
-# under the License.
-#
-# The Initial Developer of the Original Code is Ericsson Utvecklings AB.
-# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
-# AB. All Rights Reserved.''
-#
-# $Id: otp_subdir.mk,v 1.5 2004/07/12 15:12:23 jeinhorn Exp $
-#
-#
-# Make include file for otp
-
-.PHONY: debug opt release docs release_docs tests release_tests \
- clean depend
-
-#
-# Targets that don't affect documentation directories
-#
-debug opt release docs release_docs tests release_tests clean depend: prepare
- @set -e ; \
- app_pwd=`pwd` ; \
- if test -f vsn.mk; then \
- echo "=== Entering application" `basename $$app_pwd` ; \
- fi ; \
- case "$(MAKE)" in *clearmake*) tflag="-T";; *) tflag="";; esac; \
- short_circuit=0 ; \
- for d in $(SUB_DIRECTORIES); do \
- if [[ $$short_circuit = 0 ]]; then \
- if test -f $$d/SKIP ; then \
- echo "=== Skipping subdir $$d, reason:" ; \
- cat $$d/SKIP ; \
- echo "===" ; \
- else \
- if test ! -d $$d ; then \
- echo "=== Skipping subdir $$d, it is missing" ; \
- else \
- xflag="" ; \
- if test -f $$d/ignore_config_record.inf; then \
- xflag=$$tflag ; \
- fi ; \
- (cd $$d && $(MAKE) $$xflag $@) ; \
- if [[ $$? != 0 ]]; then \
- short_circuit=1 ; \
- fi ; \
- fi ; \
- fi ; \
- fi ; \
- done ; \
- if test -f vsn.mk; then \
- echo "=== Leaving application" `basename $$app_pwd` ; \
- fi ; \
- exit $$short_circuit
-
-prepare:
- echo
diff --git a/lib/erl/build/raw_test.mk b/lib/erl/build/raw_test.mk
deleted file mode 100644
index bf8535d..0000000
--- a/lib/erl/build/raw_test.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-# for testing erlang files directly. The set up for a
-# this type of test would be
-# files to test reside in lib/<app_name>/src and the test files which are
-# just plain erlang code reside in lib/<app_name>/test
-#
-# This color codes emitted while the tests run assume that you are using
-# a white-on-black display schema. If not, e.g. if you use a white
-# background, you will not be able to read the "WHITE" text.
-# You can override this by supplying your own "white" color,
-# which may in fact be black! You do this by defining an environment
-# variable named "MY_WHITE" and setting it to $'\e[0;30m' (which is
-# simply bash's way of specifying "Escape [ 0 ; 3 0 m").
-# Similarly, you can set your versions of the standard colors
-# found in colors.mk.
-
-test:
- @TEST_MODULES=`ls *_test.erl`; \
- trap "echo $(OFF)$(NO_COLOR); exit 1;" 1 2 3 6; \
- for d in $$TEST_MODULES; do \
- echo $${MY_GREEN:-$(GREEN)}"Testing File $$d" $${MY_WHITE:-$(WHITE)}; \
- echo -n $${MY_BLUE:-$(BLUE)}; \
- erl -name $(APP_NAME) $(TEST_LIBS) \
- -s `basename $$d .erl` all -s init stop -noshell; \
- if [ $$? -ne 0 ]; then \
- echo $${MY_LRED:-$(LRED)}"$$d Test Failed"; \
- fi; \
- echo -n $(OFF)$(NO_COLOR); \
- done
-
diff --git a/lib/erl/include/oop.hrl b/lib/erl/include/oop.hrl
deleted file mode 100644
index 66d1a0c..0000000
--- a/lib/erl/include/oop.hrl
+++ /dev/null
@@ -1,25 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--define(CLASS(Obj), element(1, Obj)).
-
--define(DEFINE_ATTR(Attr), attr(This, get, Attr, _Value) -> This#?MODULE.Attr;
- attr(This, set, Attr, Value) -> This#?MODULE{Attr=Value}
-).
-
-%%% static: use only if you're sure This is class ?MODULE and not a super/subclass
--define(ATTR(Attr), This#?MODULE.Attr).
-
-%%% convenience for implementing inspect/1
-%%% e.g. -> "foo=5"
--define(FORMAT_ATTR(Attr),
- io_lib:write_atom(Attr) ++ "=" ++ io_lib:print(?ATTR(Attr))
-).
-
--define(ATTR_DUMMY,
- attr(dummy, dummy, dummy, dummy) ->
- exit(dummy_attr_used)
-).
diff --git a/lib/erl/include/protocol/tBinaryProtocol.hrl b/lib/erl/include/protocol/tBinaryProtocol.hrl
deleted file mode 100644
index dea2e29..0000000
--- a/lib/erl/include/protocol/tBinaryProtocol.hrl
+++ /dev/null
@@ -1,10 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--define(VERSION_MASK, 16#FFFF0000).
--define(VERSION_1, 16#80010000).
-
--record(tBinaryProtocol, {super}).
diff --git a/lib/erl/include/protocol/tBinaryProtocolFactory.hrl b/lib/erl/include/protocol/tBinaryProtocolFactory.hrl
deleted file mode 100644
index cf8c92b..0000000
--- a/lib/erl/include/protocol/tBinaryProtocolFactory.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tBinaryProtocolFactory, {super}).
diff --git a/lib/erl/include/protocol/tProtocol.hrl b/lib/erl/include/protocol/tProtocol.hrl
deleted file mode 100644
index d393f35..0000000
--- a/lib/erl/include/protocol/tProtocol.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tProtocol, {trans}).
diff --git a/lib/erl/include/protocol/tProtocolException.hrl b/lib/erl/include/protocol/tProtocolException.hrl
deleted file mode 100644
index 9d2f31a..0000000
--- a/lib/erl/include/protocol/tProtocolException.hrl
+++ /dev/null
@@ -1,15 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--define(tProtocolException_UNKNOWN, 0).
--define(tProtocolException_INVALID_DATA, 1).
--define(tProtocolException_NEGATIVE_SIZE, 2).
--define(tProtocolException_SIZE_LIMIT, 3).
--define(tProtocolException_BAD_VERSION, 4).
-
--record(tProtocolException, {super}).
-
-
diff --git a/lib/erl/include/protocol/tProtocolFactory.hrl b/lib/erl/include/protocol/tProtocolFactory.hrl
deleted file mode 100644
index 6335dd9..0000000
--- a/lib/erl/include/protocol/tProtocolFactory.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tProtocolFactory, {}).
diff --git a/lib/erl/include/server/tErlServer.hrl b/lib/erl/include/server/tErlServer.hrl
deleted file mode 100644
index b60df71..0000000
--- a/lib/erl/include/server/tErlServer.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tErlServer, {super, acceptor, listenSocket, port}).
diff --git a/lib/erl/include/server/tServer.hrl b/lib/erl/include/server/tServer.hrl
deleted file mode 100644
index 9488438..0000000
--- a/lib/erl/include/server/tServer.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tServer, {handler, processor, serverTransport, transportFactory, protocolFactory}).
diff --git a/lib/erl/include/server/tSimpleServer.hrl b/lib/erl/include/server/tSimpleServer.hrl
deleted file mode 100644
index e6d257d..0000000
--- a/lib/erl/include/server/tSimpleServer.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tSimpleServer, {super}).
diff --git a/lib/erl/include/tApplicationException.hrl b/lib/erl/include/tApplicationException.hrl
deleted file mode 100644
index 5e2b515..0000000
--- a/lib/erl/include/tApplicationException.hrl
+++ /dev/null
@@ -1,16 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
-% TApplicationException
--define(tApplicationException_UNKNOWN, 0).
--define(tApplicationException_UNKNOWN_METHOD, 1).
--define(tApplicationException_INVALID_MESSAGE_TYPE, 2).
--define(tApplicationException_WRONG_METHOD_NAME, 3).
--define(tApplicationException_BAD_SEQUENCE_ID, 4).
--define(tApplicationException_MISSING_RESULT, 5).
--define(tApplicationException_HANDLER_ERROR, 6).
-
--record(tApplicationException, {super}).
diff --git a/lib/erl/include/tErlProcessor.hrl b/lib/erl/include/tErlProcessor.hrl
deleted file mode 100644
index 65e5cd0..0000000
--- a/lib/erl/include/tErlProcessor.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tErlProcessor, {super, generatedProcessor, handler}).
diff --git a/lib/erl/include/tException.hrl b/lib/erl/include/tException.hrl
deleted file mode 100644
index 896e8cb..0000000
--- a/lib/erl/include/tException.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tException, {message, type, backtrace}).
diff --git a/lib/erl/include/tProcessor.hrl b/lib/erl/include/tProcessor.hrl
deleted file mode 100644
index 1883397..0000000
--- a/lib/erl/include/tProcessor.hrl
+++ /dev/null
@@ -1,8 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tProcessor, {}).
-
diff --git a/lib/erl/include/thrift.hrl b/lib/erl/include/thrift.hrl
deleted file mode 100644
index 4bc994e..0000000
--- a/lib/erl/include/thrift.hrl
+++ /dev/null
@@ -1,14 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--define(ERROR(F, D),
- error_logger:format(F, D)).
-
--define(INFO(F, D),
- error_logger:info_msg(F, D)).
-
--include("thrift_macros.hrl").
--include("thrift_constants.hrl").
diff --git a/lib/erl/include/thrift_constants.hrl b/lib/erl/include/thrift_constants.hrl
deleted file mode 100644
index 1948061..0000000
--- a/lib/erl/include/thrift_constants.hrl
+++ /dev/null
@@ -1,25 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
-%% TType
--define(tType_STOP, 0).
--define(tType_VOID, 1).
--define(tType_BOOL, 2).
--define(tType_BYTE, 3).
--define(tType_DOUBLE, 4).
--define(tType_I16, 6).
--define(tType_I32, 8).
--define(tType_I64, 10).
--define(tType_STRING, 11).
--define(tType_STRUCT, 12).
--define(tType_MAP, 13).
--define(tType_SET, 14).
--define(tType_LIST, 15).
-
-% TMessageType
--define(tMessageType_CALL, 1).
--define(tMessageType_REPLY, 2).
--define(tMessageType_EXCEPTION, 3).
diff --git a/lib/erl/include/thrift_macros.hrl b/lib/erl/include/thrift_macros.hrl
deleted file mode 100644
index a1a6bad..0000000
--- a/lib/erl/include/thrift_macros.hrl
+++ /dev/null
@@ -1,54 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
-%% so bad. sigh. at least we have the arity embedded in the code without having to parse it.
-%% fix me please.
-
-%% local (same process)
--define(L0(Method), oop:call(This, Method, [])).
--define(L1(Method, Arg1), oop:call(This, Method, [Arg1])).
--define(L2(Method, Arg1, Arg2), oop:call(This, Method, [Arg1, Arg2])).
--define(L3(Method, Arg1, Arg2, Arg3), oop:call(This, Method, [Arg1, Arg2, Arg3])).
--define(L4(Method, Arg1, Arg2, Arg3, Arg4), oop:call(This, Method, [Arg1, Arg2, Arg3, Arg4])).
--define(L5(Method, Arg1, Arg2, Arg3, Arg4, Arg5), oop:call(This, Method, [Arg1, Arg2, Arg3, Arg4, Arg5])).
--define(L6(Method, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), oop:call(This, Method, [Arg1, Arg2, Arg3, Arg4, Arg5, Arg6])).
-
-%% local (same process), but not This (e.g. t*Factory)
--define(F0(Obj, Method), oop:call(Obj, Method, [])).
--define(F1(Obj, Method, Arg1), oop:call(Obj, Method, [Arg1])).
--define(F2(Obj, Method, Arg1, Arg2), oop:call(Obj, Method, [Arg1, Arg2])).
--define(F3(Obj, Method, Arg1, Arg2, Arg3), oop:call(Obj, Method, [Arg1, Arg2, Arg3])).
--define(F4(Obj, Method, Arg1, Arg2, Arg3, Arg4), oop:call(Obj, Method, [Arg1, Arg2, Arg3, Arg4])).
--define(F5(Obj, Method, Arg1, Arg2, Arg3, Arg4, Arg5), oop:call(Obj, Method, [Arg1, Arg2, Arg3, Arg4, Arg5])).
--define(F6(Obj, Method, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), oop:call(Obj, Method, [Arg1, Arg2, Arg3, Arg4, Arg5, Arg6])).
-
-%% remote (different process)
--define(RT0(ServerRef, Method, Timeout), gen_server:call(ServerRef, {Method, []}, Timeout)).
--define(RT1(ServerRef, Method, Timeout, Arg1), gen_server:call(ServerRef, {Method, [Arg1]}, Timeout)).
--define(RT2(ServerRef, Method, Timeout, Arg1, Arg2), gen_server:call(ServerRef, {Method, [Arg1, Arg2]}, Timeout)).
--define(RT3(ServerRef, Method, Timeout, Arg1, Arg2, Arg3), gen_server:call(ServerRef, {Method, [Arg1, Arg2, Arg3]}, Timeout)).
--define(RT4(ServerRef, Method, Timeout, Arg1, Arg2, Arg3, Arg4), gen_server:call(ServerRef, {Method, [Arg1, Arg2, Arg3, Arg4]}, Timeout)).
--define(RT5(ServerRef, Method, Timeout, Arg1, Arg2, Arg3, Arg4, Arg5), gen_server:call(ServerRef, {Method, [Arg1, Arg2, Arg3, Arg4, Arg5]}, Timeout)).
--define(RT6(ServerRef, Method, Timeout, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), gen_server:call(ServerRef, {Method, [Arg1, Arg2, Arg3, Arg4, Arg5, Arg6]}, Timeout)).
-
-%% remote (different process), default timeout
--define(DEFAULT_TIMEOUT, 5000).
--define(R0(ServerRef, Method), ?RT0(ServerRef, Method, ?DEFAULT_TIMEOUT)).
--define(R1(ServerRef, Method, Arg1), ?RT1(ServerRef, Method, ?DEFAULT_TIMEOUT, Arg1)).
--define(R2(ServerRef, Method, Arg1, Arg2), ?RT2(ServerRef, Method, ?DEFAULT_TIMEOUT, Arg1, Arg2)).
--define(R3(ServerRef, Method, Arg1, Arg2, Arg3), ?RT3(ServerRef, Method, ?DEFAULT_TIMEOUT, Arg1, Arg2, Arg3)).
--define(R4(ServerRef, Method, Arg1, Arg2, Arg3, Arg4), ?RT4(ServerRef, Method, ?DEFAULT_TIMEOUT, Arg1, Arg2, Arg3, Arg4)).
--define(R5(ServerRef, Method, Arg1, Arg2, Arg3, Arg4, Arg5), ?RT5(ServerRef, Method, ?DEFAULT_TIMEOUT, Arg1, Arg2, Arg3, Arg4, Arg5)).
--define(R6(ServerRef, Method, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), ?RT6(ServerRef, Method, ?DEFAULT_TIMEOUT, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)).
-
-%% remote (different process), cast
--define(C0(ServerRef, Method), gen_server:cast(ServerRef, {Method, []})).
--define(C1(ServerRef, Method, Arg1), gen_server:cast(ServerRef, {Method, [Arg1]})).
--define(C2(ServerRef, Method, Arg1, Arg2), gen_server:cast(ServerRef, {Method, [Arg1, Arg2]})).
--define(C3(ServerRef, Method, Arg1, Arg2, Arg3), gen_server:cast(ServerRef, {Method, [Arg1, Arg2, Arg3]})).
--define(C4(ServerRef, Method, Arg1, Arg2, Arg3, Arg4), gen_server:cast(ServerRef, {Method, [Arg1, Arg2, Arg3, Arg4]})).
--define(C5(ServerRef, Method, Arg1, Arg2, Arg3, Arg4, Arg5), gen_server:cast(ServerRef, {Method, [Arg1, Arg2, Arg3, Arg4, Arg5]})).
--define(C6(ServerRef, Method, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), gen_server:cast(ServerRef, {Method, [Arg1, Arg2, Arg3, Arg4, Arg5, Arg6]})).
diff --git a/lib/erl/include/transport/tBufferedTransport.hrl b/lib/erl/include/transport/tBufferedTransport.hrl
deleted file mode 100644
index 0aa1a91..0000000
--- a/lib/erl/include/transport/tBufferedTransport.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tBufferedTransport, {super, transport, wbuf}).
diff --git a/lib/erl/include/transport/tBufferedTransportFactory.hrl b/lib/erl/include/transport/tBufferedTransportFactory.hrl
deleted file mode 100644
index 69081b4..0000000
--- a/lib/erl/include/transport/tBufferedTransportFactory.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tBufferedTransportFactory, {super}).
diff --git a/lib/erl/include/transport/tErlAcceptor.hrl b/lib/erl/include/transport/tErlAcceptor.hrl
deleted file mode 100644
index 43babb5..0000000
--- a/lib/erl/include/transport/tErlAcceptor.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tErlAcceptor, {super, serverPid, transportFactory, protocolFactory}).
diff --git a/lib/erl/include/transport/tServerSocket.hrl b/lib/erl/include/transport/tServerSocket.hrl
deleted file mode 100644
index 2f85b8a..0000000
--- a/lib/erl/include/transport/tServerSocket.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tServerSocket, {super, port, handle}).
diff --git a/lib/erl/include/transport/tServerTransport.hrl b/lib/erl/include/transport/tServerTransport.hrl
deleted file mode 100644
index ccb75e4..0000000
--- a/lib/erl/include/transport/tServerTransport.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tServerTransport, {}).
diff --git a/lib/erl/include/transport/tSocket.hrl b/lib/erl/include/transport/tSocket.hrl
deleted file mode 100644
index 95d8d87..0000000
--- a/lib/erl/include/transport/tSocket.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tSocket, {super, host, port, handle}).
diff --git a/lib/erl/include/transport/tTransport.hrl b/lib/erl/include/transport/tTransport.hrl
deleted file mode 100644
index 8d74289..0000000
--- a/lib/erl/include/transport/tTransport.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tTransport, {}).
diff --git a/lib/erl/include/transport/tTransportException.hrl b/lib/erl/include/transport/tTransportException.hrl
deleted file mode 100644
index 0fcc99f..0000000
--- a/lib/erl/include/transport/tTransportException.hrl
+++ /dev/null
@@ -1,13 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--define(tTransportException_UNKNOWN, 0).
--define(tTransportException_NOT_OPEN, 1).
--define(tTransportException_ALREADY_OPEN, 2).
--define(tTransportException_TIMED_OUT, 3).
--define(tTransportException_END_OF_FILE, 4).
-
--record(tTransportException, {super}).
diff --git a/lib/erl/include/transport/tTransportFactory.hrl b/lib/erl/include/transport/tTransportFactory.hrl
deleted file mode 100644
index 05aa820..0000000
--- a/lib/erl/include/transport/tTransportFactory.hrl
+++ /dev/null
@@ -1,7 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--record(tTransportFactory, {}).
diff --git a/lib/erl/src/Makefile b/lib/erl/src/Makefile
deleted file mode 100644
index 32db9c4..0000000
--- a/lib/erl/src/Makefile
+++ /dev/null
@@ -1,117 +0,0 @@
-# $Id: Makefile,v 1.3 2004/08/13 16:35:59 mlogan Exp $
-#
-include ../build/otp.mk
-include ../build/colors.mk
-include ../build/buildtargets.mk
-
-# ----------------------------------------------------
-# Application version
-# ----------------------------------------------------
-
-include ../vsn.mk
-APP_NAME=thrift
-PFX=thrift
-VSN=$(THRIFT_VSN)
-
-# ----------------------------------------------------
-# Install directory specification
-# WARNING: INSTALL_DIR the command to install a directory.
-# INSTALL_DST is the target directory
-# ----------------------------------------------------
-INSTALL_DST = $(ERLANG_OTP)/lib/$(APP_NAME)-$(VSN)
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-
-
-MODULES = $(shell find . -name \*.erl | sed s:^\\./:: | sed s/\\.erl//)
-MODULES_STRING_LIST = $(shell find . -name \*.erl | sed s:^\\./:\": | sed s/\\.erl/\",/)
-
-HRL_FILES=
-INTERNAL_HRL_FILES= $(APP_NAME).hrl
-ERL_FILES= $(MODULES:%=%.erl)
-DOC_FILES=$(ERL_FILES)
-
-APP_FILE= $(APP_NAME).app
-APPUP_FILE= $(APP_NAME).appup
-
-APP_SRC= $(APP_FILE).src
-APPUP_SRC= $(APPUP_FILE).src
-
-APP_TARGET= $(EBIN)/$(APP_FILE)
-APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
-
-BEAMS= $(MODULES:%=$(EBIN)/%.$(EMULATOR))
-TARGET_FILES= $(BEAMS) $(APP_TARGET) $(APPUP_TARGET)
-
-WEB_TARGET=/var/yaws/www/$(APP_NAME)
-
-# ----------------------------------------------------
-# FLAGS
-# ----------------------------------------------------
-
-ERL_FLAGS +=
-ERL_INCLUDE = -I../include -I../../fslib/include -I../../system_status/include
-ERL_COMPILE_FLAGS += $(ERL_INCLUDE)
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-
-all debug opt: $(EBIN) $(TARGET_FILES)
-
-#$(EBIN)/rm_logger.beam: $(APP_NAME).hrl
-include ../build/docs.mk
-
-# Note: In the open-source build clean must not destroy the preloaded
-# beam files.
-clean:
- rm -f $(TARGET_FILES)
- rm -f *~
- rm -f core
- rm -rf $(EBIN)
- rm -rf *html
-
-$(EBIN):
- mkdir $(EBIN)
-
-dialyzer: $(TARGET_FILES)
- dialyzer --src -r . $(ERL_INCLUDE)
-
-# ----------------------------------------------------
-# Special Build Targets
-# ----------------------------------------------------
-
-$(APP_TARGET): $(APP_SRC) ../vsn.mk $(BEAMS)
- sed -e 's;%VSN%;$(VSN);' \
- -e 's;%PFX%;$(PFX);' \
- -e 's;%APP_NAME%;$(APP_NAME);' \
- -e 's;%MODULES%;%MODULES%$(MODULES_STRING_LIST);' \
- $< > $<".tmp"
- sed -e 's/%MODULES%\(.*\),/\1/' \
- $<".tmp" > $@
- rm $<".tmp"
-
-
-$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
- sed -e 's;%VSN%;$(VSN);' $< > $@
-
-$(WEB_TARGET): ../markup/*
- rm -rf $(WEB_TARGET)
- mkdir $(WEB_TARGET)
- cp -r ../markup/ $(WEB_TARGET)
- cp -r ../skins/ $(WEB_TARGET)
-
-# ----------------------------------------------------
-# Install Target
-# ----------------------------------------------------
-
-install: all $(WEB_TARGET)
-# $(INSTALL_DIR) $(INSTALL_DST)/src
-# $(INSTALL_DATA) $(ERL_FILES) $(INSTALL_DST)/src
-# $(INSTALL_DATA) $(INTERNAL_HRL_FILES) $(INSTALL_DST)/src
-# $(INSTALL_DIR) $(INSTALL_DST)/include
-# $(INSTALL_DATA) $(HRL_FILES) $(INSTALL_DST)/include
-# $(INSTALL_DIR) $(INSTALL_DST)/ebin
-# $(INSTALL_DATA) $(TARGET_FILES) $(INSTALL_DST)/ebin
diff --git a/lib/erl/src/oop.erl b/lib/erl/src/oop.erl
deleted file mode 100644
index 418f0f2..0000000
--- a/lib/erl/src/oop.erl
+++ /dev/null
@@ -1,261 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
-%%%
-%%% dox:
-%%%
-%%% C++ <-> Erlang
-%%% classes modules
-%%% class b : public a a:super() -> b.
-%%%
-
--module(oop).
-
--export([start_new/2, get/2, set/3, call/2, call/3, inspect/1, class/1, is_object/1, is_a/2]).
--export([call1/3]). %% only for thrift_oop_server ... don't use it
--export([behaviour_info/1]).
-
--include("thrift.hrl").
--include("oop.hrl").
-
-%% state for the call loop
--record(cstate, {
- obj, %% the current object (on which we want to invoke MFA)
- module, %% the current module we're considering
- func, %% the method name (i.e. the function we're trying to invoke in Module)
- args, %% the arguments, the first of which is Obj
- tried, %% a (backwards) list of modules we've tried
- first_obj %% the original object
- }).
-
-%%%
-%%% behavior definition
-%%%
-
-behaviour_info(callbacks) ->
- [ {attr, 4},
- {super, 0}
- ];
-behaviour_info(_) ->
- undefined.
-
-%%%
-%%% public interface
-%%%
-
-%% TODO: voids take only ok as return?
-start_new(none=Resv, _) ->
- ?ERROR("can't instantiate ~p: class name is a reserved word", [Resv]),
- error;
-start_new(Class, Args) ->
- {ok, Pid} = gen_server:start_link(thrift_oop_server, {Class, Args}, []),
- Pid.
-
-%% get(Obj, Field) -> term()
-%% looks up Field in Obj or its ancestor objects
-get(Obj, Field) ->
- call(Obj, attr, [get, Field, get]).
-
-set(Obj, Field, Value) -> %% TODO: could be tail-recursive
- Module = ?CLASS(Obj),
- case apply_if_defined(Module, attr, [Obj, set, Field, Value]) of
- {ok, V} -> V;
- undef ->
- case get_superobject(Obj) of
- {ok, Superobj} ->
- Superobj1 = set(Superobj, Field, Value),
- Module:attr(Obj, set, super, Superobj1);
- undef ->
- error(missing_attr_set, Field, Obj)
- end
- end.
-
-%%
-%% ** dynamic method dispatch **
-%%
-%% calls Module:Func(*Args) if it exists
-%% if not, Module <- Module:super() and try again recursively
-%%
-%% Module:attr(*Args) is handled specially:
-%% Obj needs to be replaced with Obj's "superobject"
-%%
-call(Obj, Func) ->
- call(Obj, Func, []).
-
-call(Obj, Func, ArgsProper) ->
- %% this is WAY too expensive
- %% ?INFO("oop:call called: Obj=~p Func=~p ArgsProper=~p", [inspect(Obj), Func, ArgsProper]),
- case call1(Obj, Func, ArgsProper) of
- {ok, Value} -> Value;
- {error, Kind, S1} -> error(Kind, S1)
- end.
-
-call1(Obj, Func, ArgsProper) ->
- S = #cstate{
- obj = Obj,
- module = ?CLASS(Obj),
- func = Func,
- args = [Obj|ArgsProper], %% prepend This to args
- tried = [],
- first_obj = Obj
- },
- call1(S).
-
-call1(S = #cstate{obj=Obj, module=Module, func=Func, args=Args}) ->
- %% ?INFO("call1~n obj=~p~n MFA=~p, ~p, ~p", [inspect(Obj), Module, Func, Args]),
- %% io:format("call ~p~n", [Module]),
- case apply_if_defined(Module, Func, Args) of
- {ok, Value} -> {ok, Value};
- undef -> call1_try_super(S)
- end.
-
-call1_try_super(S = #cstate{func=attr, module=Module, tried=Tried}) ->
- case Module:super() of
- none -> {error, missing_attr, S};
- Superclass -> call1_try_super_attr(Superclass, S)
- end;
-call1_try_super(S = #cstate{func=Func, module=Module, tried=Tried}) ->
- case Module:super() of
- none -> {error, missing_method, S};
- Superclass ->
- S1 = S#cstate{
- module = Superclass,
- tried = [Module|Tried]
- },
- call1(S1)
- end.
-
-call1_try_super_attr(Superclass, S = #cstate{obj=Obj, module=Module, args=Args, tried=Tried}) ->
- %% look for attrs in the "super object"
- case get_superobject(Obj) of
- undef -> {error, missing_superobj, S};
- {ok, Superobj} when Module == ?CLASS(Obj) ->
- %% replace This with Superobj
- S1 = S#cstate{
- obj = Superobj,
- args = [Superobj|tl(Args)],
- module = Superclass,
- tried = [Module|Tried]
- },
- call1(S1)
- end.
-
-%% careful: not robust against records beginning with a class name
-%% (note: we can't just guard with is_record(?CLASS(Obj), Obj) since we
-%% can't/really really shouldn't require all record definitions in this file
-inspect(Obj) ->
- try
- case is_object(Obj) of
- true ->
- DeepList = inspect1(Obj, "#<"),
- lists:flatten(DeepList);
- false ->
- thrift_utils:sformat("~p", [Obj])
- end
- catch
- _:E ->
- thrift_utils:sformat("INSPECT_ERROR(~p) ~p", [E, Obj])
-
- %% TODO(cpiro): bring this back once we're done testing:
- %% _:E -> thrift_utils:sformat("~p", [Obj])
- end.
-
-inspect1(Obj, Str) ->
- Class = ?CLASS(Obj),
- Inspect = Class:inspect(Obj),
- Current = atom_to_list(Class) ++ ": " ++ Inspect,
-
- case get_superobject(Obj) of
- {ok, Superobj} ->
- inspect1(Superobj, Str ++ Current ++ " | ");
- undef ->
- Str ++ Current ++ ">"
- end.
-
-%% class(Obj) -> atom() = Class
-%% | none
-class(Obj) when is_tuple(Obj) ->
- %% if it's an object its first element will be a class name, and it'll have super/0
- case apply_if_defined(?CLASS(Obj), super, []) of
- {ok, _} -> ?CLASS(Obj);
- undef -> none
- end;
-class(_) -> none.
-
-%% is_a relationship
-is_a(Obj, Class) ->
- %% ?INFO("is_a ~p ~p", [Obj, Class]),
- case is_object(Obj) of
- true ->
- is_a1(Obj, Class);
- false ->
- false
- end.
-is_a1(Obj, Class) when Class == ?CLASS(Obj) ->
- true;
-is_a1(Obj, Class) ->
- case get_superobject(Obj) of
- undef ->
- false;
- {ok, SuperObj} ->
- is_a1(SuperObj, Class)
- end.
-
-%% is the tuple/record an object?
-%% is_object(Obj) = bool()
-is_object(Obj) when is_tuple(Obj) ->
- case class(Obj) of
- none -> false;
- _ -> true
- end;
-is_object(_) -> false.
-
-%%%
-%%% private helpers
-%%%
-
-%% apply_if_defined(MFA) -> {ok, apply(MFA)}
-%% | undef
-%% this could be worth some money
-apply_if_defined(M, F, A) ->
- apply_if_defined({M,F,A}).
-
-apply_if_defined({M,F,A} = MFA) ->
- try
- %% io:format("apply ~p ~p ~p~n", [M,F,A]),
- {ok, apply(M, F, A)}
- catch
- _:Kind when Kind == undef; Kind == function_clause ->
- case erlang:get_stacktrace() of
- %% the first stack call should match MFA when `apply' fails because the function is undefined
- %% they won't match if the function is currently running and an error happens in the middle
- [MFA|_] -> undef; % trapped successfully
- ST ->
- io:format("DONIT THE EXIT THING ~p~n", [Kind]),
- exit({Kind, ST}) % some unrelated error, re-exit
- end
- end.
-
-get_superobject(Obj) ->
- apply_if_defined(?CLASS(Obj), attr, [Obj, get, super, get]).
-
-%%%
-%%% errors
-%%%
-
-tried(S = #cstate{module=Module, tried=Tried}) ->
- lists:reverse([Module|Tried]).
-
-error(missing_superobj, S = #cstate{obj=Obj}) ->
- exit({missing_superobj, {inspect(Obj), tried(S)}});
-error(missing_method, S = #cstate{obj=Obj, func=Func, args=Args}) ->
- exit({missing_method, {Func, inspect(Obj), tl(Args), tried(S)}});
-error(missing_attr, S = #cstate{args=Args, first_obj=FirstObj}) ->
- exit({missing_attr, {hd(tl(Args)), inspect(FirstObj), tried(S)}}).
-
-error(missing_attr_set, Field, Obj) ->
- BT = "..", %% TODO: give a backtrace
- exit({missing_attr, {Field, inspect(Obj), BT}}).
diff --git a/lib/erl/src/protocol/tBinaryProtocol.erl b/lib/erl/src/protocol/tBinaryProtocol.erl
deleted file mode 100644
index 2155be6..0000000
--- a/lib/erl/src/protocol/tBinaryProtocol.erl
+++ /dev/null
@@ -1,218 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tBinaryProtocol).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("protocol/tProtocolException.hrl").
--include("protocol/tBinaryProtocol.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([
- new/1,
-
- writeMessageBegin/4,
- writeFieldBegin/4, writeFieldStop/1,
- writeMapBegin/4,
- writeListBegin/3,
- writeSetBegin/3,
-
- writeBool/2, writeByte/2, writeI16/2, writeI32/2,
- writeI64/2, writeDouble/2, writeString/2,
-
- readMessageBegin/1,
- readFieldBegin/1,
- readMapBegin/1,
- readListBegin/1,
- readSetBegin/1,
-
- readBool/1, readByte/1, readI16/1, readI32/1,
- readI64/1, readDouble/1, readString/1
-]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tProtocol.
-
-%%% inspect(This) -> string()
-
-inspect(_This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new(Trans) ->
- Super = (super()):new(Trans),
- #?MODULE{super=Super}.
-
-%%%
-%%% instance methods
-%%%
-
-writeMessageBegin(This, Name, Type, Seqid) ->
- ?L1(writeI32, ?VERSION_1 bor Type),
- ?L1(writeString, Name),
- ?L1(writeI32, Seqid),
- ok.
-
-writeFieldBegin(This, _Name, Type, Id) ->
- ?L1(writeByte, Type),
- ?L1(writeI16, Id),
- ok.
-
-writeFieldStop(This) ->
- ?L1(writeByte, ?tType_STOP),
- ok.
-
-writeMapBegin(This, Ktype, Vtype, Size) ->
- ?L1(writeByte, Ktype),
- ?L1(writeByte, Vtype),
- ?L1(writeI32, Size),
- ok.
-
-writeListBegin(This, Etype, Size) ->
- ?L1(writeByte, Etype),
- ?L1(writeI32, Size),
- ok.
-
-writeSetBegin(This, Etype, Size) ->
- ?L1(writeByte, Etype),
- ?L1(writeI32, Size),
- ok.
-
-%
-
-writeBool(This, true) ->
- ?L1(writeByte, 1);
-writeBool(This, false) ->
- ?L1(writeByte, 0).
-
-writeByte(This, Byte) when is_integer(Byte) ->
- Trans = oop:get(This, trans),
- ?R1(Trans, effectful_write, <<Byte:8/big>>).
-
-writeI16(This, I16) when is_integer(I16) ->
- Trans = oop:get(This, trans),
- ?R1(Trans, effectful_write, <<I16:16/big>>).
-
-writeI32(This, I32) when is_integer(I32) ->
- Trans = oop:get(This, trans),
- ?R1(Trans, effectful_write, <<I32:32/big>>).
-
-writeI64(This, I64) when is_integer(I64) ->
- Trans = oop:get(This, trans),
- ?R1(Trans, effectful_write, <<I64:64/big>>).
-
-writeDouble(This, Double) when is_float(Double) ->
- Trans = oop:get(This, trans),
- ?R1(Trans, effectful_write, <<Double:64/float-big>>).
-
-writeString(This, Str) when is_list(Str) -> % [char()] or iolist()
- Trans = oop:get(This, trans),
- Data = list_to_binary(Str),
- ?L1(writeI32, size(Data)),
- ?R1(Trans, effectful_write, Data);
-
-writeString(This, Binary) when is_binary(Binary) ->
- Trans = oop:get(This, trans),
- ?L1(writeI32, size(Binary)),
- ?R1(Trans, effectful_write, Binary).
-
-%%
-
-readMessageBegin(This) ->
- Version = ?L0(readI32),
- if
- (Version band ?VERSION_MASK) /= ?VERSION_1 ->
- tException:throw(tProtocolException, [?tProtocolException_BAD_VERSION, "Missing version identifier"]);
- true -> ok
- end,
- Type = Version band 16#000000ff,
- Name = ?L0(readString),
- Seqid = ?L0(readI32),
- { Name, Type, Seqid }.
-
-readFieldBegin(This) ->
- Type = ?L0(readByte),
- case Type of
- ?tType_STOP ->
- { nil, Type, 0 }; % WATCH
- _ ->
- Id = ?L0(readI16),
- { nil, Type, Id }
- end.
-
-readMapBegin(This) ->
- Ktype = ?L0(readByte),
- Vtype = ?L0(readByte),
- Size = ?L0(readI32),
- { Ktype, Vtype, Size }.
-
-readListBegin(This) ->
- Etype = ?L0(readByte),
- Size = ?L0(readI32),
- { Etype, Size }.
-
-readSetBegin(This) ->
- Etype = ?L0(readByte),
- Size = ?L0(readI32),
- { Etype, Size }.
-
-%%
-
-readBool(This) ->
- Byte = ?L0(readByte),
- (Byte /= 0).
-
-readByte(This) ->
- Trans = oop:get(This, trans),
- <<Val:8/integer-signed-big, _/binary>> = ?R1(Trans, readAll, 1),
- Val.
-
-readI16(This) ->
- Trans = oop:get(This, trans),
- <<Val:16/integer-signed-big, _/binary>> = ?R1(Trans, readAll, 2),
- Val.
-
-readI32(This) ->
- Trans = oop:get(This, trans),
- <<Val:32/integer-signed-big, _/binary>> = ?R1(Trans, readAll, 4),
- Val.
-
-readI64(This) ->
- Trans = oop:get(This, trans),
- <<Val:64/integer-signed-big, _/binary>> = ?R1(Trans, readAll, 8),
- Val.
-
-readDouble(This) ->
- Trans = oop:get(This, trans),
- <<Val:64/float-signed-big, _/binary>> = ?R1(Trans, readAll, 8),
- Val.
-
-readString(This) ->
- Trans = oop:get(This, trans),
- Sz = ?L0(readI32),
- binary_to_list(?R1(Trans, readAll, Sz)).
diff --git a/lib/erl/src/protocol/tBinaryProtocolFactory.erl b/lib/erl/src/protocol/tBinaryProtocolFactory.erl
deleted file mode 100644
index c525cdb..0000000
--- a/lib/erl/src/protocol/tBinaryProtocolFactory.erl
+++ /dev/null
@@ -1,57 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tBinaryProtocolFactory).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("protocol/tBinaryProtocol.hrl").
--include("protocol/tBinaryProtocolFactory.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/0, getProtocol/2]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tProtocolFactory.
-
-%%% inspect(This) -> string()
-
-inspect(_This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new() ->
- Super = (super()):new(),
- #?MODULE{super=Super}.
-
-%%%
-%%% instance methods
-%%%
-
-getProtocol(_This, Trans) ->
- oop:start_new(tBinaryProtocol, [Trans]).
-
diff --git a/lib/erl/src/protocol/tProtocol.erl b/lib/erl/src/protocol/tProtocol.erl
deleted file mode 100644
index 4ef67b8..0000000
--- a/lib/erl/src/protocol/tProtocol.erl
+++ /dev/null
@@ -1,175 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tProtocol).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("protocol/tProtocol.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([
- new/1,
- skip/2,
-
- writeMessageBegin/4, writeMessageEnd/1,
- writeStructBegin/2, writeStructEnd/1,
- writeFieldBegin/4, writeFieldEnd/1, writeFieldStop/1,
- writeMapBegin/4, writeMapEnd/1,
- writeListBegin/3, writeListEnd/1,
- writeSetBegin/3, writeSetEnd/1,
-
- writeBool/2, writeByte/2, writeI16/2, writeI32/2,
- writeI64/2, writeDouble/2, writeString/2,
-
- readMessageBegin/1, readMessageEnd/1,
- readStructBegin/1, readStructEnd/1,
- readFieldBegin/1, readFieldEnd/1,
- readMapBegin/1, readMapEnd/1,
- readListBegin/1, readListEnd/1,
- readSetBegin/1, readSetEnd/1,
-
- readBool/1, readByte/1, readI16/1, readI32/1,
- readI64/1, readDouble/1, readString/1
- ]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(trans).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- none.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- ?FORMAT_ATTR(trans).
-
-%%%
-%%% class methods
-%%%
-
-new(Trans) ->
- #?MODULE{trans=Trans}.
-
-%%%
-%%% instance methods
-%%%
-
-writeMessageBegin(_This, _Name, _Type, _Seqid) -> ok.
-writeMessageEnd(_This) -> ok.
-writeStructBegin(_This, _Name) -> ok.
-writeStructEnd(_This) -> ok.
-writeFieldBegin(_This, _Name, _Type, _Id) -> ok.
-writeFieldEnd(_This) -> ok.
-writeFieldStop(_This) -> ok.
-writeMapBegin(_This, _Ktype, _Vtype, _Size) -> ok.
-writeMapEnd(_This) -> ok.
-writeListBegin(_This, _Etype, _Size) -> ok.
-writeListEnd(_This) -> ok.
-writeSetBegin(_This, _Etype, _Size) -> ok.
-writeSetEnd(_This) -> ok.
-
-writeBool(_This, _Value) -> ok.
-writeByte(_This, _Value) -> ok.
-writeI16(_This, _Value) -> ok.
-writeI32(_This, _Value) -> ok.
-writeI64(_This, _Value) -> ok.
-writeDouble(_This, _Value) -> ok.
-writeString(_This, _Value) -> ok.
-
-readMessageBegin(_This) -> ok.
-readMessageEnd(_This) -> ok.
-readStructBegin(_This) -> ok.
-readStructEnd(_This) -> ok.
-readFieldBegin(_This) -> ok.
-readFieldEnd(_This) -> ok.
-readMapBegin(_This) -> ok.
-readMapEnd(_This) -> ok.
-readListBegin(_This) -> ok.
-readListEnd(_This) -> ok.
-readSetBegin(_This) -> ok.
-readSetEnd(_This) -> ok.
-
-readBool(_This) -> ok.
-readByte(_This) -> ok.
-readI16(_This) -> ok.
-readI32(_This) -> ok.
-readI64(_This) -> ok.
-readDouble(_This) -> ok.
-readString(_This) -> ok.
-
-skip(This, Type) ->
- case Type of
- ?tType_STOP -> nil; % WATCH
- ?tType_BOOL -> ?L0(readBool);
- ?tType_BYTE -> ?L0(readByte);
- ?tType_I16 -> ?L0(readI16);
- ?tType_I32 -> ?L0(readI32);
- ?tType_I64 -> ?L0(readI64);
- ?tType_DOUBLE -> ?L0(readDouble);
- ?tType_STRING -> ?L0(readString);
-
- ?tType_STRUCT ->
- ?L0(readStructBegin),
- skip_struct_loop(This),
-
- %% cpiro: this isn't here in the original tprotocol.rb, but i think it's a bug
- ?L0(readStructEnd);
-
- ?tType_MAP ->
- {Ktype, Vtype, Size} = ?L0(readMapBegin),
- skip_map_repeat(This, Ktype, Vtype, Size),
- ?L0(readMapEnd);
-
- ?tType_SET ->
- {Etype, Size} = ?L0(readSetBegin),
- skip_set_repeat(This, Etype, Size),
- ?L0(readSetEnd);
-
- ?tType_LIST ->
- {Etype, Size} = ?L0(readListBegin),
- skip_set_repeat(This, Etype, Size), % [sic] skipping same as for SET
- ?L0(readListEnd)
- end.
-
-skip_struct_loop(This) ->
- { _Name, Type, _Id } = ?L0(readFieldBegin),
- if
- Type == ?tType_STOP ->
- ok;
-
- true ->
- ?L1(skip, Type),
- ?L0(readFieldEnd),
-
- %% cpiro: this is here in original tprotocol.rb, but i think it's a bug
- %% ?L0(readStructEnd),
- skip_struct_loop(This)
- end.
-
-skip_map_repeat(This, Ktype, Vtype, Times) ->
- ?L1(skip, Ktype),
- ?L1(skip, Vtype),
- skip_map_repeat(This, Ktype, Vtype, Times-1).
-
-skip_set_repeat(This, Etype, Times) ->
- ?L1(skip, Etype),
- skip_set_repeat(This, Etype, Times-1).
diff --git a/lib/erl/src/protocol/tProtocolException.erl b/lib/erl/src/protocol/tProtocolException.erl
deleted file mode 100644
index 84833a8..0000000
--- a/lib/erl/src/protocol/tProtocolException.erl
+++ /dev/null
@@ -1,57 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tProtocolException).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("protocol/tProtocolException.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/0, new/1, new/2]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tException.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new(Type, Message) ->
- Super = (super()):new(Type, Message),
- #?MODULE{super=Super}.
-
-new() ->
- new(?tProtocolException_UNKNOWN, undefined).
-new(Type) ->
- new(Type, undefined).
-
-%%%
-%%% instance methods
-%%%
diff --git a/lib/erl/src/protocol/tProtocolFactory.erl b/lib/erl/src/protocol/tProtocolFactory.erl
deleted file mode 100644
index f756a29..0000000
--- a/lib/erl/src/protocol/tProtocolFactory.erl
+++ /dev/null
@@ -1,54 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tProtocolFactory).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("protocol/tProtocolFactory.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/0, getProtocol/2]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?ATTR_DUMMY.
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- none.
-
-%%% inspect(This) -> string()
-
-inspect(_This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new() ->
- #?MODULE{}.
-
-%%%
-%%% instance methods
-%%%
-
-getProtocol(This, Trans) ->
- nil.
diff --git a/lib/erl/src/server/tErlServer.erl b/lib/erl/src/server/tErlServer.erl
deleted file mode 100644
index 10ac2b2..0000000
--- a/lib/erl/src/server/tErlServer.erl
+++ /dev/null
@@ -1,102 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tErlServer).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("transport/tTransportException.hrl").
--include("server/tErlServer.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/6, new/5, new/4, effectful_serve/1, effectful_new_acceptor/1]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super);
-?DEFINE_ATTR(acceptor);
-?DEFINE_ATTR(listenSocket);
-?DEFINE_ATTR(port).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tServer.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- ?FORMAT_ATTR(acceptor) ++ ", " ++
- ?FORMAT_ATTR(listenSocket) ++ ", " ++
- ?FORMAT_ATTR(port).
-
-%%%
-%%% class methods
-%%%
-
-new(Port, Handler, Processor, ServerTransport, TransportFactory, ProtocolFactory) ->
- Super = (super()):new(Handler, Processor, ServerTransport, TransportFactory, ProtocolFactory),
- #?MODULE{super=Super, port=Port, listenSocket=nil, acceptor=nil}.
-
-new(Port, Handler, Processor, ServerTransport) ->
- new(Port, Handler, Processor, ServerTransport, nil, nil).
-
-new(Port, Handler, Processor, ServerTransport, TransportFactory) ->
- new(Port, Handler, Processor, ServerTransport, TransportFactory, nil).
-
-% listenSocket, acceptor, port
-
-effectful_serve(This) ->
- Port = oop:get(This, port),
-
- Options = [binary, {packet, 0}, {active, false}],
-
- %% listen
- case gen_tcp:listen(Port, Options) of
- {ok, ListenSocket} ->
- ?INFO("thrift server listening on port ~p", [Port]),
-
- This1 = oop:set(This, listenSocket, ListenSocket),
-
- %% spawn acceptor
- {_Acceptor, This2} = effectful_new_acceptor(This1),
-
- {ok, This2};
-
- {error, eaddrinuse} ->
- ?ERROR("thrift couldn't bind port ~p, address in use", [Port]),
- {{error, eaddrinuse}, This} %% state before the accept
- end.
-
-effectful_new_acceptor(This) ->
- ListenSocket = oop:get(This, listenSocket),
- Processor = oop:get(This, processor), %% cpiro: generated processor, not the "actual" processor
- Handler = oop:get(This, handler),
-
- TF = oop:get(This, transportFactory),
- PF = oop:get(This, protocolFactory),
-
- tErlAcceptor = oop:get(This, serverTransport), %% cpiro: only supported ServerTransport
-
- ServerPid = self(),
- Acceptor = oop:start_new(tErlAcceptor, [ServerPid, TF, PF]),
- ?C3(Acceptor, accept, ListenSocket, Processor, Handler),
-
- This1 = oop:set(This, acceptor, Acceptor),
-
- {Acceptor, This1}.
diff --git a/lib/erl/src/server/tServer.erl b/lib/erl/src/server/tServer.erl
deleted file mode 100644
index fc03331..0000000
--- a/lib/erl/src/server/tServer.erl
+++ /dev/null
@@ -1,81 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tServer).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("server/tServer.hrl").
--include("transport/tTransportFactory.hrl").
--include("protocol/tBinaryProtocolFactory.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/5, new/4, new/3, serve/1]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(handler);
-?DEFINE_ATTR(processor);
-?DEFINE_ATTR(serverTransport);
-?DEFINE_ATTR(transportFactory);
-?DEFINE_ATTR(protocolFactory).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- none.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- ?FORMAT_ATTR(handler) ++ ", " ++
- ?FORMAT_ATTR(processor) ++ ", " ++
- ?FORMAT_ATTR(serverTransport) ++ ", " ++
- ?FORMAT_ATTR(transportFactory) ++ ", " ++
- ?FORMAT_ATTR(protocolFactory).
-
-%%%
-%%% class methods
-%%%
-
-new(Handler, Processor, ServerTransport, TransportFactory, ProtocolFactory) ->
- #?MODULE{handler=Handler, processor=Processor, serverTransport=ServerTransport,
-
- %% much ado about nothing but
- %% subclasses pass nil too
- transportFactory =
- case TransportFactory of
- nil -> tTransportFactory:new();
- _ -> TransportFactory
- end,
-
- protocolFactory =
- case ProtocolFactory of
- nil -> tBinaryProtocolFactory:new();
- _ -> ProtocolFactory
- end
-}.
-
-new(Handler, Processor, ServerTransport) ->
- new(Handler, Processor, ServerTransport, nil, nil).
-
-new(Handler, Processor, ServerTransport, TransportFactory) ->
- new(Handler, Processor, ServerTransport, TransportFactory, nil).
-
-serve(_This) ->
- ok.
diff --git a/lib/erl/src/server/tSimpleServer.erl b/lib/erl/src/server/tSimpleServer.erl
deleted file mode 100644
index 833fe5d..0000000
--- a/lib/erl/src/server/tSimpleServer.erl
+++ /dev/null
@@ -1,111 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
-%%% NOTE: tSimpleServer's design isn't compatible with our concurrency model.
-%%% It won't work in principle, and certainly not in practice. YMMV.
-
--module(tSimpleServer).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("transport/tTransportException.hrl").
--include("server/tSimpleServer.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/5, new/4, new/3, serve/1]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tServer.
-
-%%% inspect(This) -> string()
-
-inspect(_This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new(Handler, Processor, ServerTransport, TransportFactory, ProtocolFactory) ->
- Super = (super()):new(Handler, Processor, ServerTransport, TransportFactory, ProtocolFactory),
- error_logger:warning_msg("tSimpleServer has an incompatable design and doesn't work. Promise."),
- #?MODULE{super=Super}.
-
-new(Handler, Processor, ServerTransport) ->
- new(Handler, Processor, ServerTransport, nil, nil).
-
-new(Handler, Processor, ServerTransport, TransportFactory) ->
- new(Handler, Processor, ServerTransport, TransportFactory, nil).
-
-%
-
-serve(This) ->
- exit(tSimpleServer_doesnt_work),
- ST = oop:get(This, serverTransport),
- ?R0(ST, effectful_listen),
-
- serve_loop(This).
-
-serve_loop(This) ->
- error_logger:info_msg("ready.", []),
-
- ST = oop:get(This, serverTransport),
- Client = ?RT0(ST, accept, infinity),
-
- TF = oop:get(This, transportFactory),
- Trans = ?F1(TF, getTransport, Client), %% cpiro: OPAQUE!! Trans = Client
-
- PF = oop:get(This, protocolFactory),
- Prot = ?F1(PF, getProtocol, Trans), %% cpiro: OPAQUE!! Prot = start_new(tBinaryProtocol, [Trans])
-
- error_logger:info_msg("client accept()ed", []),
-
- serve_loop_loop(This, Prot), % giggle loop?
-
- ?R0(Trans, effectful_close),
-
- serve_loop(This).
-
-serve_loop_loop(This, Prot) ->
- Next =
- try
- Handler = oop:get(This, handler),
- Processor = oop:get(This, processor),
- Val = apply(Processor, process, [Handler, Prot, Prot]), %% TODO(cpiro): make processor a gen_server instance
- error_logger:info_msg("request processed: rv=~p", [Val]),
- loop
- catch
- %% TODO(cpiro) case when is_record(...) to pick out our exception
- %% records vs. normal erlang throws
- E when is_record(E, tTransportException) ->
- error_logger:info_msg("tTransportException (normal-ish?)", []),
- close;
- F ->
- error_logger:info_msg("EXCEPTION: ~p", [F]),
- close
- end,
- case Next of
- loop -> serve_loop_loop(This, Prot);
- close -> ok
- end.
diff --git a/lib/erl/src/tApplicationException.erl b/lib/erl/src/tApplicationException.erl
deleted file mode 100644
index d99b003..0000000
--- a/lib/erl/src/tApplicationException.erl
+++ /dev/null
@@ -1,114 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tApplicationException).
-
--include("thrift.hrl").
--include("tApplicationException.hrl").
-
--include("oop.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/0, new/1, new/2, read/2, write/2]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tException.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new(Type, Message) ->
- Super = (super()):new(Type, Message),
- #?MODULE{super=Super}.
-
-new() -> new(?tApplicationException_UNKNOWN, undefined).
-new(Type) -> new(Type, undefined).
-
-%%%
-%%% instance methods
-%%%
-
-read(This, Iprot) ->
- ?R0(Iprot, readStructBegin),
- read_while_loop(This, Iprot),
- ?R0(Iprot, readStructEnd),
- ok.
-
-read_while_loop(This, Iprot) ->
- {_Fname, Ftype, Fid} = ?R0(Iprot, readFieldBegin),
-
- if
- Ftype == ?tType_STOP ->
- ok;
-
- (Fid == 1) and (Ftype == ?tType_STRING) ->
- Message1 = ?R0(Iprot, readString),
- This1 = oop:set(This, message, Message1),
- ?R0(Iprot, readFieldEnd),
- read_while_loop(This1, Iprot);
-
- Fid == 1 ->
- ?R0(Iprot, skip),
- ?R0(Iprot, readFieldEnd),
- read_while_loop(This, Iprot);
-
- (Fid == 2) and (Ftype == ?tType_I32) ->
- Type1 = ?R0(Iprot, readI32),
- This1 = oop:set(This, type, Type1),
- ?R0(Iprot, readFieldEnd),
- read_while_loop(This1, Iprot);
-
- true ->
- ?R0(Iprot, skip),
- ?R0(Iprot, readFieldEnd),
- read_while_loop(This, Iprot)
- end.
-
-write(This, Oprot) ->
- ?R1(Oprot, writeStructBegin, "tApplicationException"),
- Message = oop:get(This, message),
- Type = oop:get(This, type),
-
- if Message /= undefined ->
- ?R3(Oprot, writeFieldBegin, "message", ?tType_STRING, 1),
- ?R1(Oprot, writeString, Message),
- ?R0(Oprot, writeFieldEnd);
- true -> ok
- end,
-
- if Type /= undefined ->
- ?R3(Oprot, writeFieldBegin, "type", ?tType_I32, 2),
- ?R1(Oprot, writeI32, Type),
- ?R0(Oprot, writeFieldEnd);
- true -> ok
- end,
-
- ?R0(Oprot, writeFieldStop),
- ?R0(Oprot, writeStructEnd),
- ok.
diff --git a/lib/erl/src/tErlProcessor.erl b/lib/erl/src/tErlProcessor.erl
deleted file mode 100644
index 2e88b6d..0000000
--- a/lib/erl/src/tErlProcessor.erl
+++ /dev/null
@@ -1,63 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tErlProcessor).
-
--include("thrift.hrl").
--include("oop.hrl").
--include("tErlProcessor.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/2, process/3]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super);
-?DEFINE_ATTR(generatedProcessor);
-?DEFINE_ATTR(handler).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tProcessor.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- ?FORMAT_ATTR(generatedProcessor) ++ ", " ++
- ?FORMAT_ATTR(handler).
-
-%%%
-%%% class methods
-%%%
-
-new(GP, Handler) ->
- Super = (super()):new(),
- #?MODULE{super = Super, generatedProcessor = GP, handler = Handler}.
-
-%% processor is generated code
-%% handler is user code
-
-%%%
-%%% instance methods
-%%%
-
-process(This, Iprot, Oprot) ->
- GP = oop:get(This, generatedProcessor),
- Handler = oop:get(This, handler),
-
- GP:process(Handler, Iprot, Oprot).
diff --git a/lib/erl/src/tException.erl b/lib/erl/src/tException.erl
deleted file mode 100644
index 6dd3084..0000000
--- a/lib/erl/src/tException.erl
+++ /dev/null
@@ -1,93 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tException).
-
--include("oop.hrl").
--include("thrift.hrl").
--include("tException.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/2, add_backtrace_element/2, throw/2, inspect_with_backtrace/2, inspect_with_backtrace/3]).
-
--export([read/1]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(message);
-?DEFINE_ATTR(type);
-?DEFINE_ATTR(backtrace).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- none.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- BT = ?ATTR(backtrace),
- Depth =
- if
- is_list(BT) -> integer_to_list(length(BT));
- true -> "?"
- end,
- ?FORMAT_ATTR(message) ++ ", " ++
- ?FORMAT_ATTR(type) ++ ", "
- " backtrace:" ++ Depth.
-
-%%%
-%%% class methods
-%%%
-
-new(Type, Message) ->
- #?MODULE{type=Type, message=Message, backtrace=[]}.
-
-add_backtrace_element(E, Info) ->
- BT = oop:get(E, backtrace),
- E1 = oop:set(E, backtrace, [Info|BT]),
- E1.
-
-throw(Class, Args) ->
- E = apply(Class, new, Args),
- exit({thrift_exception, E}).
-
-
-inspect_with_backtrace(E, Where, Info) ->
- E1 = add_backtrace_element(E, Info),
- inspect_with_backtrace(E1, Where).
-
-inspect_with_backtrace(E, Where) ->
- thrift_utils:sformat("** ~s~n** ~s", [Where, oop:inspect(E)]) ++
- case oop:get(E, backtrace) of
- [] ->
- "";
- BT when is_list(BT) ->
- thrift_utils:sformat("~n** trace = ~p", [lists:reverse(BT)]);
- Else ->
- thrift_utils:sformat("<ERROR BT NOT A LIST = ~p>", [Else])
- end.
-
-read(E) ->
- case oop:class(E) of
- none ->
- none;
- Class ->
- Type = oop:get(E, type),
- BT = oop:get(E, backtrace),
- {Class, Type, BT}
- end.
diff --git a/lib/erl/src/tProcessor.erl b/lib/erl/src/tProcessor.erl
deleted file mode 100644
index b62e5ad..0000000
--- a/lib/erl/src/tProcessor.erl
+++ /dev/null
@@ -1,50 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tProcessor).
-
--include("oop.hrl").
--include("tProcessor.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/0]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?ATTR_DUMMY.
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- none.
-
-%%% inspect(This) -> string()
-
-inspect(_This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new() ->
- #?MODULE{}.
-
-%%%
-%%% instance methods
-%%%
-
diff --git a/lib/erl/src/thrift.app.src b/lib/erl/src/thrift.app.src
deleted file mode 100644
index 79055ca..0000000
--- a/lib/erl/src/thrift.app.src
+++ /dev/null
@@ -1,46 +0,0 @@
-%%% -*- mode:erlang -*-
-{application, %APP_NAME%,
- [
- % A quick description of the application.
- {description, "Thrift bindings"},
-
- % The version of the applicaton
- {vsn, "%VSN%"},
-
- % All modules used by the application.
- {modules, [
- %MODULES%
- ]},
-
- % All of the registered names the application uses. This can be ignored.
- {registered, []},
-
- % Applications that are to be started prior to this one. This can be ignored
- % leave it alone unless you understand it well and let the .rel files in
- % your release handle this.
- {applications,
- [
- kernel,
- stdlib
- ]},
-
- % OTP application loader will load, but not start, included apps. Again
- % this can be ignored as well. To load but not start an application it
- % is easier to include it in the .rel file followed by the atom 'none'
- {included_applications, []},
-
- % configuration parameters similar to those in the config file specified
- % on the command line. can be fetched with gas:get_env
- {env, [
- {term_width, 110},
- {force_one_line, false},
- {omit_fmt, ["thrift ~p:new(~s) = ~s"]},
- {gen_server_messages, true},
- {show_pid, true},
- {lookup, false} % DNS
- ]},
-
- % The Module and Args used to start this application.
- {mod, {thrift_app, []}}
- ]
-}.
diff --git a/lib/erl/src/thrift.appup.src b/lib/erl/src/thrift.appup.src
deleted file mode 100644
index 54a6383..0000000
--- a/lib/erl/src/thrift.appup.src
+++ /dev/null
@@ -1 +0,0 @@
-{"%VSN%",[],[]}.
diff --git a/lib/erl/src/thrift.erl b/lib/erl/src/thrift.erl
deleted file mode 100644
index ef2c1fa..0000000
--- a/lib/erl/src/thrift.erl
+++ /dev/null
@@ -1,65 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(thrift).
-
--export([start/0, stop/0, config/1, config/2, reconfig/1]).
-
--include("thrift.hrl").
-
-%%%
-%%% behavior definition
-%%%
-
-start() ->
- application:start(thrift).
-
-stop() ->
- application:stop(thrift).
-
-%%%
-%%% configuration
-%%%
-
-config(Item) ->
- config(?MODULE, Item).
-
-config(App, Item) ->
- case application:get_env(App, Item) of
- {ok, Value} ->
- Value;
- undefined ->
- ?ERROR("configuration for ~p is unavailable", [Item]),
- unconfigured_item,
- exit({missing_config, App, Item})
- end.
-
-reconfig(Config) ->
- BFName = filename:basename(Config, ".config"),
- FName = filename:join(filename:dirname(Config),
- BFName ++ ".config"),
-
- case file:consult(FName) of
- {error, R={_,_,_}} ->
- {error, file_error, file:format_error(R)};
- {error, Posix} ->
- {error, file_error, Posix};
- {ok, [List]} when is_list(List) ->
- reconfig1(List)
- end.
-
-reconfig1([]) ->
- ok;
-reconfig1([{App, List}|Tl]) ->
- reconfig2(List, App, 0),
- reconfig1(Tl).
-
-reconfig2([], App, Count) ->
- ?INFO("application ~p reconfigured: ~p keys updated", [App, Count]),
- ok;
-reconfig2([{Par, Val}|Tl], App, Count) ->
- application:set_env(App, Par, Val),
- reconfig2(Tl, App, Count+1).
diff --git a/lib/erl/src/thrift_app.erl b/lib/erl/src/thrift_app.erl
deleted file mode 100644
index 17a14cf..0000000
--- a/lib/erl/src/thrift_app.erl
+++ /dev/null
@@ -1,25 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(thrift_app).
-
--export([start/2, stop/1]).
--behaviour(application).
-
--include("thrift.hrl").
-
-%%%
-%%% behavior definition
-%%%
-
-start(_Type, _StartArgs) ->
- io:format("starting thrift~n"),
- thrift_logger:install(),
- {ok, Sup} = thrift_app_sup:start_link(),
- {ok, Sup}.
-
-stop(_State) ->
- ok.
diff --git a/lib/erl/src/thrift_app_sup.erl b/lib/erl/src/thrift_app_sup.erl
deleted file mode 100644
index 545ffa8..0000000
--- a/lib/erl/src/thrift_app_sup.erl
+++ /dev/null
@@ -1,19 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(thrift_app_sup).
-
--behaviour(supervisor).
-
--export([start_link/0, init/1]).
-
--define(SERVER, ?MODULE).
-
-start_link() ->
- supervisor:start_link({local, ?SERVER}, ?MODULE, []).
-
-init(_) ->
- {ok, {{one_for_one,10,1}, []}}.
diff --git a/lib/erl/src/thrift_logger.erl b/lib/erl/src/thrift_logger.erl
deleted file mode 100644
index e9963c0..0000000
--- a/lib/erl/src/thrift_logger.erl
+++ /dev/null
@@ -1,249 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(thrift_logger).
-
--behaviour(gen_event).
-
--include("thrift.hrl").
--include("oop.hrl").
-
-%% gen_event callbacks
--export([init/1, handle_event/2, handle_call/2,
- handle_info/2, terminate/2, code_change/3]).
-
--export([install/0, bin_trim/1]).
-
-%%
-
--record(state, {omit_formats=gb_sets:empty()}).
-
--define(GS_TERM_FORMAT, "** Generic server ~p terminating \n** Last message in was ~p~n** When Server state == ~p~n** Reason for termination == ~n** ~p~n").
-
-%%%
-%%% ensure the regular logger is out and ours is in
-%%%
-
-install() ->
- %% remove loggers
- io:format("starting logger~n"),
- lists:foreach(fun(Logger) ->
- case Logger of
- _ -> gen_event:delete_handler(error_logger, Logger, normal)
- end end,
- gen_event:which_handlers(error_logger)),
-
- %% TODO(cpiro): sasl someday?
- %% gen_event:add_handler(error_logger, sasl_report_file_h, {LogFile, all}),
-
- gen_event:add_handler(error_logger, ?MODULE, []),
-
- ok.
-
-%%%
-%%% init
-%%%
-
-init([]) ->
- OmitFormats = gb_sets:from_list(config(omit_fmt)),
- State = #state{omit_formats = OmitFormats},
- {ok, State}.
-
-%%%
-%%% handle_event
-%%%
-
-handle_event2(Symbol, Pid, Type, Message, State) -> % Message must be a string
- {ok, MessageSafe, NL} = regexp:gsub(Message, "[\n]+", " "), % collapse whitespace to one space
-
- Type1 =
- case Type of
- "" -> "";
- _ -> sformat("~p ", [Type])
- end,
-
- Banner =
- case config(show_pid) of
- true ->
- sformat("~s ~p ~s", [Symbol, Pid, Type1]);
- false ->
- sformat("~s~i ~s", [Symbol, Pid, Type1])
- end,
- BannerLen = length(Banner),
-
- %% there's no way to see if Message is a string? just try
- Output = sformat("~s", [Message]),
- OutputSafe = sformat("~s", [MessageSafe]),
-
- Length =
- case (length(OutputSafe) + BannerLen) < config(term_width) of
- true -> short;
- false -> long
- end,
-
- OneLine =
- case NL == 0 of
- true -> oneliner;
- false -> multiline
- end,
-
- case { config(force_one_line), Length, OneLine } of
- %% one line and short ... print as is
- {_, short, oneliner} ->
- format("~s~s~n", [Banner, OutputSafe]);
-
- %% too long ... squash to one
- {true, long, _} ->
- O = Banner ++ OutputSafe,
- Format = sformat("~~~ps >~n", [config(term_width)-2]), % e.g. "~80s >~n"
- format(Format, [O]);
-
- %% short but multiline... collapse to one
- {true, short, multiline} ->
- format("~s~s~n", [Banner, OutputSafe]);
-
- %% just print it
- _ ->
- format("~s~n~s~n~n", [Banner, Output])
- end.
-
-%%
-
-bin_trim([]) ->
- [];
-bin_trim([H|T]) ->
- [bin_trim(H) | bin_trim(T)];
-bin_trim({}) ->
- {};
-bin_trim(T) when is_tuple(T) ->
- list_to_tuple(bin_trim(tuple_to_list(T)));
-bin_trim(Bin) when is_binary(Bin), size(Bin) > 100 ->
- {Bin1,Rest} = split_binary(Bin, 100),
- Bin1;
-bin_trim(Term) ->
- Term.
-
-handle_event1({What, _Gleader, {Ref, Format, Data}}, State = #state{omit_formats=OmitFormats})
- when is_list(Format) ->
- Symbol =
- case What of
- error -> "!!";
- warning_msg -> "**";
- info_msg -> "..";
- _Else -> "??"
- end,
-
- case {Format, Data} of
- {?GS_TERM_FORMAT, [Ref, LastMessage, Obj, {Kind, E}]} when Kind == timeout; Kind == thrift_exception ->
- ok;
-
- {?GS_TERM_FORMAT, [Ref, LastMessage, Obj, Reason]} ->
- Format1 = "** gen_server terminating in message ~p~n** State = ~s~n** Reason = ~p~n",
- Message = sformat(Format1, [LastMessage, bin_trim(oop:inspect(Obj)), Reason]),
- handle_event2(Symbol, Ref, "", Message, State);
-
- {?GS_TERM_FORMAT, _Dta} ->
- TrimData = bin_trim(Data),
- Message = sformat("DATA DIDN'T MATCH: ~p~n", [TrimData]) ++ sformat(Format, TrimData),
- handle_event2(Symbol, Ref, "", Message, State);
- {_, _} ->
- case gb_sets:is_member(Format, OmitFormats) of
- true ->
- ok;
- false ->
- Message = sformat(Format, bin_trim(Data)),
- handle_event2(Symbol, Ref, "", Message, State)
- end
- end,
- {ok, State};
-
-handle_event1({What, _Gleader, {Pid, Type, Report}}, State) ->
- Symbol =
- case What of
- error_report -> "!!";
- warning_report -> "**";
- info_report -> "..";
- _Else -> "??"
- end,
-
- case Type of
- crash_report ->
- print_crash_report(Report);
- progress ->
- ok;
- _ ->
- Message = sformat("|| ~s", [oop:inspect(Report)]),
- handle_event2(Symbol, Pid, Type, Message, State)
- end,
- {ok, State};
-
-handle_event1(_Event, State) ->
- handle_event2("??", "<?.?.?>", "", _Event, State),
- {ok, State}.
-
-handle_event(Event, State) ->
- try
- handle_event1(Event, State)
- catch
- _:E ->
- format("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~n error logger error:~n ~p~n Event = ~p~n State = ~p~n ~p~n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~n",
- [E, Event, State, erlang:get_stacktrace()]),
- {ok, State}
- end.
-
-%%%
-%%% call, info, terminate, code_change
-%%%
-
-handle_call(_Request, State) ->
- Reply = ok,
- {ok, Reply, State}.
-
-handle_info(_Info, State) ->
- {ok, State}.
-
-terminate(normal, _State) ->
- ok;
-terminate(Reason, _State) ->
- format("*****************~n~n frick, error logger terminating: ~p~n~n*****************~n~n", [Reason]),
- ok.
-
-code_change(_OldVsn, State, _Extra) ->
- {ok, State}.
-
-%%====================================================================
-%%% Internal functions
-%%====================================================================
-
-%% how to output
-format(Format, Data) ->
- io:format(Format, Data).
-
-%% convenience
-sformat(Format, Data) ->
- thrift_utils:sformat(Format, Data).
-
-config(Item) ->
- thrift:config(Item).
-
-print_crash_report(Report) ->
- case Report of
- %% for R12B0
- [[_, _, {error_info, {exit, {thrift_exception, _}, _}} | _] | _] ->
- ok;
- [[_, _, {error_info, {exit, {timeout, _}, _}} | _] | _] ->
- ok;
-
- %% for R11B5
- [[_,_,{error_info, {thrift_exception, _}}|_] | _] ->
- ok;
- [[_,_,{error_info, {timeout, _}}|_] | _] ->
- ok;
-
- %% else
- _ ->
- io:format("~~~~ crash report: ~w~n", [Report])
- end.
diff --git a/lib/erl/src/thrift_oop_server.erl b/lib/erl/src/thrift_oop_server.erl
deleted file mode 100644
index ef512bc..0000000
--- a/lib/erl/src/thrift_oop_server.erl
+++ /dev/null
@@ -1,152 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(thrift_oop_server).
-
--behaviour(gen_server).
-
--include("oop.hrl").
-
--include("thrift.hrl").
-
--include("transport/tTransportException.hrl").
--include("protocol/tProtocolException.hrl").
-
--export([
- start_link/0,
- stop/0
- ]).
-
--export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
-
--define(SERVER, ?MODULE).
-
-%%%
-%%% api
-%%%
-
-start_link() ->
- gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
-
-stop() ->
- gen_server:cast(?SERVER, stop).
-
-%%%
-%%% init
-%%%
-
-init({Class, Args}) ->
- process_flag(trap_exit, true),
- try %% TODO use apply_if_defined
- State = apply(Class, new, Args),
- ?INFO("thrift ~p:new(~s) = ~s", [Class, thrift_utils:unbrack(Args), oop:inspect(State)]),
- {ok, State}
- catch
- E -> {stop, {new_failed, E}}
- end;
-
-init(_) ->
- {stop, invalid_params}.
-
-%%%
-%%% call and cast
-%%%
-
-handle_call(Request, From, State) -> handle_call_cast(call, Request, From, State).
-handle_cast(stop, State) -> {stop, normal, State};
-handle_cast({Method, Args}, State) -> handle_call_cast(cast, {Method, Args}, undefined, State).
-
-reply(call, Value, State) -> {reply, Value, State};
-reply(cast, _Value, State) -> {noreply, State}.
-
-handle_call_cast(Type, Request, From, State) ->
- %% ?INFO("~p: ~p", [?SERVER, oop:inspect(State)]),
- %% ?INFO("handle_call(Request=~p, From=~p, State)", [Request, From]),
-
- case Request of
- {get, [Field]} ->
- Value = oop:get(State, Field),
- reply(Type, Value, State);
-
- {set, [Field, Value]} ->
- State1 = oop:set(State, Field, Value),
- reply(Type, Value, State1);
-
- {class, []} ->
- reply(Type, ?CLASS(State), State);
-
- {Method, Args} ->
- handle_method(Type, State, Method, Args);
-
- _ ->
- ?ERROR("thrift no match for Request = ~p", [Request]),
- {stop, server_error, State}
- %% {reply, server_error, State}
- end.
-
-handle_method(Type, State, Method, Args) ->
- Is_effectful = lists:prefix("effectful_", atom_to_list(Method)),
-
- try {Is_effectful, oop:call(State, Method, Args)} of
- {true, {Retval, State1}} ->
- reply(Type, Retval, State1);
-
- {true, _MalformedReturn} ->
- %% TODO(cpiro): bad match -- remove when we're done converting
- ?ERROR("oop:call(effectful_*,..,..) malformed return value ~p",
- [_MalformedReturn]),
- {stop, server_error, State};
- %% {noreply, State};
-
- {false, Retval} ->
- reply(Type, Retval, State)
-
- catch
- exit:{thrift_exception, E} -> handle_exception(E, nothing);
- exit:{{thrift_exception, E}, Stack} -> handle_exception(E, Stack);
- exit:normal -> exit(normal);
- exit:(X = {timeout, _}) -> exit(X);
- exit:Other ->
- exit(Other)
- end.
-
-handle_exception(E, Stack) ->
- %% ?ERROR("texception ~p", [E]),
- case {oop:is_a(E, tException), Stack} of
- {true, nothing} -> % good
- exit({thrift_exception, E});
- {true, _} -> % good
- E1 = tException:add_backtrace_element(E, Stack),
- exit({thrift_exception, E1});
- {false, _} -> % shit
- ?ERROR("exception wasn't really a tException ~p", [E]),
- exit(bum)
- end.
-
-%%%
-%%% info, terminate, and code_change
-%%%
-
-handle_info({'EXIT', Pid, Except} = All, State) ->
- case Except of
- normal ->
- {noreply, State};
- {normal, _} ->
- {noreply, State};
- _unhandled ->
- error_logger:format("unhandled exit ~p", [All]),
- {stop, All, State}
- end;
-
-handle_info(Info, State) ->
- ?INFO("~p", [Info]),
- {noreply, State}.
-
-terminate(Reason, State) ->
- ok.
-
-code_change(OldVsn, State, Extra) ->
- {ok, State}.
diff --git a/lib/erl/src/thrift_sup.erl b/lib/erl/src/thrift_sup.erl
deleted file mode 100644
index 8be57df..0000000
--- a/lib/erl/src/thrift_sup.erl
+++ /dev/null
@@ -1,45 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(thrift_sup).
-
--behaviour(supervisor).
-
--include("thrift.hrl").
-
--export([start_link/3, init/1, thrift_start_link/7]).
-
--define(SERVER, ?MODULE).
-
-start_link(Port, Handler, Processor) ->
- Args = [Port, Handler, Processor],
- supervisor:start_link({local, ?SERVER}, ?MODULE, Args).
-
-init([Port, Handler, Processor]) ->
- TF = tBufferedTransportFactory,
- PF = tBinaryProtocolFactory,
- ST = tErlAcceptor,
- SF = tErlServer,
-
- ThriftModules = [TF, PF, ST, SF],
-
- Args = [SF, Port, Handler, Processor, ST, TF, PF],
-
- ThriftServer = {thrift_server, {?MODULE, thrift_start_link, Args},
- permanent, 2000, worker, ThriftModules},
-
- {ok, {{one_for_one, 10, 1}, [ThriftServer]}}.
-
-thrift_start_link(SF = tErlServer, Port, Hnd, Pr, ST, TF, PF) ->
- Args = [Port, Hnd, Pr, ST, TF:new(), PF:new()],
- Pid = oop:start_new(SF, Args),
- case ?R0(Pid, effectful_serve) of
- ok ->
- ok;
- {error, eaddrinuse} ->
- exit(eaddrinuse)
- end,
- {ok, Pid}.
diff --git a/lib/erl/src/thrift_utils.erl b/lib/erl/src/thrift_utils.erl
deleted file mode 100644
index 1cbacc0..0000000
--- a/lib/erl/src/thrift_utils.erl
+++ /dev/null
@@ -1,51 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(thrift_utils).
-
--include("transport/tTransportException.hrl").
-
--export([tabulate/2, dict_size/1, sformat/2, unbrack/1, first_item/1, unnest_record/2]).
-
-%% tabulate
-tabulate(N,F) ->
- tabulate(0, N, F).
-
-tabulate(N,M,_) when N==M ->
- [];
-tabulate(N,M,F) ->
- [F(N) | tabulate(N+1, M, F)].
-
-%% makin me sad
-dict_size(Dict) ->
- dict:fold(fun (_,_,I) -> I+1 end,0,Dict).
-
-%% I CAN HAS EAZIER KTHX
-sformat(Format, Data) when is_list(Data) ->
- lists:flatten(io_lib:format(Format, Data));
-sformat(Format, Item) ->
- error_logger:warning_msg("sformat called with non-list Data: (~p, ~p)", [Format, Item]),
- sformat(Format, [Item]).
-
-%% render a list and pick off the square brackets
-unbrack(List) ->
- List1 = sformat("~w", [List]),
- string:substr(List1, 2, length(List1)-2).
-
-first_item(DeepTuple) when is_tuple(DeepTuple) ->
- first_item(element(1, DeepTuple));
-first_item(NotTuple) ->
- NotTuple.
-
-unnest_record(Term, RecordTag) ->
- case is_record(Term, RecordTag) of
- true ->
- {ok, Term};
- false when is_tuple(Term) ->
- unnest_record(element(1, Term), RecordTag);
- _ ->
- error
- end.
diff --git a/lib/erl/src/transport/tBufferedTransport.erl b/lib/erl/src/transport/tBufferedTransport.erl
deleted file mode 100644
index 2b3e0aa..0000000
--- a/lib/erl/src/transport/tBufferedTransport.erl
+++ /dev/null
@@ -1,86 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tBufferedTransport).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("transport/tBufferedTransport.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/1, isOpen/1, effectful_open/1, effectful_close/1, read/2, effectful_write/2, effectful_flush/1]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super);
-?DEFINE_ATTR(transport);
-?DEFINE_ATTR(wbuf).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tTransport.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- ?FORMAT_ATTR(transport) ++ ", " ++
- ?FORMAT_ATTR(wbuf).
-
-%%%
-%%% class methods
-%%%
-
-new(Transport) ->
- Super = (super()):new(),
- #?MODULE{super=Super, transport=Transport, wbuf=""}.
-
-%%%
-%%% instance methods
-%%%
-
-isOpen(This) ->
- Transport = oop:get(This, transport),
- ?R0(Transport, isOpen).
-
-effectful_open(This) ->
- Transport = oop:get(This, transport),
- ?R0(Transport, effectful_open),
- {ok, This}.
-
-effectful_close(This) ->
- Transport = oop:get(This, transport),
- ?R0(Transport, effectful_close),
- {ok, This}.
-
-read(This, Sz) ->
- Transport = oop:get(This, transport),
- ?R1(Transport, read, Sz).
-
-effectful_write(This, Data) -> % be sure to rebind This to the retval
- Wbuf = oop:get(This, wbuf),
- This1 = oop:set(This, wbuf, [Wbuf, Data]), % build an iolist()
- {ok, This1}.
-
-effectful_flush(This) ->
- Wbuf = oop:get(This, wbuf),
- Transport = oop:get(This, transport),
- ?R1(Transport, effectful_write, Wbuf),
- ?R0(Transport, effectful_flush),
- This1 = oop:set(This, wbuf, []),
- {ok, This1}.
diff --git a/lib/erl/src/transport/tBufferedTransportFactory.erl b/lib/erl/src/transport/tBufferedTransportFactory.erl
deleted file mode 100644
index de2570e..0000000
--- a/lib/erl/src/transport/tBufferedTransportFactory.erl
+++ /dev/null
@@ -1,54 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tBufferedTransportFactory).
-
--include("oop.hrl").
--include("transport/tBufferedTransport.hrl").
--include("transport/tBufferedTransportFactory.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/0, getTransport/2]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?ATTR_DUMMY.
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tTransportFactory.
-
-%%% inspect(This) -> string()
-
-inspect(_This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new() ->
- Super = (super()):new(),
- #?MODULE{super=Super}.
-
-%%%
-%%% instance methods
-%%%
-
-getTransport(_This, Trans) ->
- oop:start_new(tBufferedTransport, [Trans]).
diff --git a/lib/erl/src/transport/tErlAcceptor.erl b/lib/erl/src/transport/tErlAcceptor.erl
deleted file mode 100644
index c2c8f9c..0000000
--- a/lib/erl/src/transport/tErlAcceptor.erl
+++ /dev/null
@@ -1,157 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tErlAcceptor).
-
--include("oop.hrl").
--include("thrift.hrl").
--include("tApplicationException.hrl").
--include("transport/tTransportException.hrl").
--include("protocol/tProtocolException.hrl").
--include("transport/tServerSocket.hrl").
--include("transport/tErlAcceptor.hrl").
-
--include_lib("kernel/include/inet.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/3, accept/4]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super);
-?DEFINE_ATTR(serverPid);
-?DEFINE_ATTR(transportFactory);
-?DEFINE_ATTR(protocolFactory).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tServerTransport.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- ?FORMAT_ATTR(serverPid) ++ ", " ++
- ?FORMAT_ATTR(transportFactory) ++ ", " ++
- ?FORMAT_ATTR(protocolFactory).
-
-%%%
-%%% class methods
-%%%
-
-new(ServerPid, TF, PF) ->
- Super = (super()):new(),
- #?MODULE{super = Super,
- serverPid = ServerPid,
- transportFactory = TF,
- protocolFactory = PF
- }.
-
-%%%
-%%% instance methods
-%%%
-
-accept(This, ListenSocket, GP, Handler) ->
- ServerPid = oop:get(This, serverPid),
-
- case catch gen_tcp:accept(ListenSocket) of
- {ok, Socket} ->
- ?C0(ServerPid, effectful_new_acceptor), % cast to create new acceptor
-
- AddrString = render_addr(Socket),
- ?INFO("thrift connection accepted from ~s", [AddrString]),
-
- Client = oop:start_new(tSocket, []),
- ?R1(Client, effectful_setHandle, Socket),
-
- %% cpiro: OPAQUE!! Trans = Client
- TF = oop:get(This, transportFactory),
- Trans = ?F1(TF, getTransport, Client),
-
- %% cpiro: OPAQUE!! Prot = start_new(tBinaryProtocol, [Trans])
- PF = oop:get(This, protocolFactory),
- Prot = ?F1(PF, getProtocol, Trans),
-
- %% start_new(, ...)
- Processor = oop:start_new(tErlProcessor, [GP, Handler]),
-
- try
- receive_loop(This, Processor, Prot, Prot)
- catch
- exit:{timeout, _} ->
- ?INFO("thrift connection timed out from ~s", [AddrString]);
-
- %% cpiro: i think the extra entry on the stack is always from receive_loop
- %% the below case shouldn't happen then? if we move this catch inside
- %% we'll probably need this case and not the next one
-
- %% exit:{thrift_exception, E} ->
- %% handle_exception(E, AddrString, no2);
-
- exit:{{thrift_exception, E}, Stack1} ->
- handle_exception(E, AddrString, Stack1);
-
- Class:Else ->
- ?ERROR("some other error ~p in tErlAcceptor: ~p", [Class, Else])
- end,
- exit(normal);
-
- Else ->
- R = thrift_utils:sformat("accept() failed: ~p", [Else]),
- tException:throw(tTransportException, [R])
- end.
-
-
-handle_exception(E, AddrString, Stack1) ->
- case tException:read(E) of
- none -> % not a tException
- ?ERROR("not really a tException: ~p", [exit, E]);
-
- {tProtocolException, ?tProtocolException_BAD_VERSION, _} ->
- ?INFO("thrift missing version from ~s", [AddrString]);
-
- {tTransportException, ?tTransportException_NOT_OPEN, _} ->
- ?INFO("thrift connection closed from ~s", [AddrString]);
-
- _ ->
- Where = "thrift tErlAcceptor caught a tException",
- ?ERROR("~s", [tException:inspect_with_backtrace(E, Where, Stack1)])
- end.
-
-%% always calls itself ... only way to escape is through an exit
-receive_loop(This, Processor, Iprot, Oprot) ->
- case ?R2(Processor, process, Iprot, Oprot) of
- {error, Reason} ->
- case tException:read(Reason) of
- none ->
- ?ERROR("thrift handler returned something weird: {error, ~p}", [Reason]);
- _ ->
- Where = "thrift processor/handler caught a tException",
- ?ERROR("~s", [tException:inspect_with_backtrace(Reason, Where)])
- end,
- receive_loop(This, Processor, Iprot, Oprot);
- Value ->
- ?INFO("thrift request: ~p", [Value]),
- receive_loop(This, Processor, Iprot, Oprot)
- end.
-
-%% helper functions
-
-%% @param Socket the socket in question
-render_addr(Socket) ->
- {ok, {{A,B,C,D}, Port}} = inet:peername(Socket),
- thrift_utils:sformat("~p.~p.~p.~p:~p", [A,B,C,D,Port]).
diff --git a/lib/erl/src/transport/tServerSocket.erl b/lib/erl/src/transport/tServerSocket.erl
deleted file mode 100644
index 76257c1..0000000
--- a/lib/erl/src/transport/tServerSocket.erl
+++ /dev/null
@@ -1,96 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tServerSocket).
-
--include("oop.hrl").
--include("thrift.hrl").
--include("transport/tServerSocket.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/1, effectful_listen/1, accept/1, effectful_close/1]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super);
-?DEFINE_ATTR(port);
-?DEFINE_ATTR(handle).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tServerTransport.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- ?FORMAT_ATTR(port) ++ ", " ++
- ?FORMAT_ATTR(handle).
-
-%%%
-%%% class methods
-%%%
-
-new(Port) ->
- Super = (super()):new(),
- #?MODULE{super = Super, port = Port, handle = nil}.
-
-%%%
-%%% instance methods
-%%%
-
-effectful_listen(This) ->
- Port = oop:get(This, port),
- Options = [binary, {packet, 0}, {active, false}], % was []
-
- case gen_tcp:listen(Port, Options) of
- {ok, ListenSocket} ->
- This1 = oop:set(This, handle, ListenSocket),
- {ok, This1}
-
- %% {error, _} ->
- %% TODO: no error handling in Ruby version?
- end.
-
-accept(This) ->
- case oop:get(This, handle) of
- nil ->
- nil; % cpiro: sic the Ruby code
-
- Handle ->
- case gen_tcp:accept(Handle) of
- {ok, Sock} ->
- Trans = oop:start_new(tSocket, []),
- ?R1(Trans, effectful_setHandle, Sock),
- Trans
- %% {error, _} ->
- %% TODO: no error handling in Ruby version?
- end
- end.
-
-effectful_close(This) ->
- case oop:get(This, handle) of
- nil ->
- {nil, This};
- Handle ->
- case gen_tcp:close(Handle) of
- ok ->
- {ok, This} % cpiro: sic the Ruby version: don't set handle to nil
- %% {error, _} ->
- %% TODO: no error handling in Ruby version?
- end
- end.
diff --git a/lib/erl/src/transport/tServerTransport.erl b/lib/erl/src/transport/tServerTransport.erl
deleted file mode 100644
index f007d54..0000000
--- a/lib/erl/src/transport/tServerTransport.erl
+++ /dev/null
@@ -1,52 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tServerTransport).
-
--include("oop.hrl").
--include("transport/tServerTransport.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/0]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?ATTR_DUMMY.
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- none.
-
-%%% inspect(This) -> string()
-
-inspect(_This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new() ->
- #?MODULE{}.
-
-%%%
-%%% instance methods
-%%%
-
-getTransport(_This, Trans) ->
- Trans.
diff --git a/lib/erl/src/transport/tSocket.erl b/lib/erl/src/transport/tSocket.erl
deleted file mode 100644
index 842fba3..0000000
--- a/lib/erl/src/transport/tSocket.erl
+++ /dev/null
@@ -1,134 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tSocket).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("transport/tTransportException.hrl").
--include("transport/tSocket.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/0, new/1, new/2,
- effectful_setHandle/2, effectful_open/1,
- isOpen/1, effectful_write/2, read/2, effectful_close/1]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super);
-?DEFINE_ATTR(host);
-?DEFINE_ATTR(port);
-?DEFINE_ATTR(handle).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tTransport.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- ?FORMAT_ATTR(host) ++ ", " ++
- ?FORMAT_ATTR(port) ++ ", " ++
- ?FORMAT_ATTR(handle).
-
-%%%
-%%% class methods
-%%%
-
-new(Host, Port) ->
- Super = (super()):new(),
- #?MODULE{super=Super, host=Host, port=Port, handle=nil}.
-
-new(Host) ->
- new(Host, 9090).
-
-new() ->
- new("localhost", 9090).
-
-%%%
-%%% instance methods
-%%%
-
-effectful_setHandle(This, Handle) ->
- {ok, oop:set(This, handle, Handle)}.
-
-effectful_open(This) ->
- Host = oop:get(This, host),
- Port = oop:get(This, port),
- Options = [binary, {packet, 0},
- {active, false},
- {reuseaddr, true},
- {nodelay, true},
- {send_timeout, case application:get_env(thrift, socket_send_timeout) of
- {ok, Millis} when is_integer(Millis), Millis > 0 -> Millis;
- _Else -> 5000
- end}
- ],
- case gen_tcp:connect(Host, Port, Options) of
- {error, _} ->
- tException:throw(tTransportException,
- [?tTransportException_NOT_OPEN, "Could not connect to " ++ Host ++ ":"
- ++ integer_to_list(Port)]);
- {ok, Socket} ->
- effectful_setHandle(This, Socket)
- end.
-
-isOpen(This) ->
- oop:get(This, handle) /= nil.
-
-effectful_write(This, Data) ->
- Handle = oop:get(This, handle),
-
- case gen_tcp:send(Handle, Data) of
- {error,timeout} ->
- effectful_close(This),
- tException:throw(tTransportException, [?tTransportException_NOT_OPEN, "in write"]);
- {error, _} ->
- effectful_close(This),
- tException:throw(tTransportException, [?tTransportException_NOT_OPEN, "in write"]);
- ok ->
- {ok, This}
- end.
-
-read(This, Sz) ->
- Handle = oop:get(This, handle),
- case gen_tcp:recv(Handle, Sz) of
- {ok, []} ->
- Host = oop:get(This, host),
- Port = oop:get(This, port),
- tException:throw(tTransportException,
- [?tTransportException_UNKNOWN,
- "TSocket: Could not read " ++ integer_to_list(Sz) ++
- "bytes from " ++ Host ++ ":" ++ integer_to_list(Port)]);
- {ok, Data} ->
- %% DEBUG
- ?INFO("tSocket: read ~p", [Data]),
- Data;
- {error, Error} ->
- tException:throw(tTransportException, [?tTransportException_NOT_OPEN, "in tSocket:read/2: gen_tcp:recv"])
- end.
-
-effectful_close(This) ->
- case oop:get(This, handle) of
- nil ->
- {ok, This};
- Handle ->
- gen_tcp:close(Handle),
- {ok, oop:set(This, handle, nil)}
- end.
diff --git a/lib/erl/src/transport/tTransport.erl b/lib/erl/src/transport/tTransport.erl
deleted file mode 100644
index 73bcf72..0000000
--- a/lib/erl/src/transport/tTransport.erl
+++ /dev/null
@@ -1,99 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tTransport).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("transport/tTransport.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/0, isOpen/1, effectful_open/1, effectful_close/1, read/2, readAll/2, effectful_write/2, effectful_flush/1]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?ATTR_DUMMY.
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- none.
-
-%%% inspect(This) -> string()
-
-inspect(_This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new() ->
- #?MODULE{}.
-
-%%%
-%%% instance methods
-%%%
-
-e() ->
- exit('tTransport is abstract').
-
-isOpen(_This) ->
- e(),
- nil.
-
-effectful_open(This) ->
- e(),
- {nil, This}.
-
-effectful_close(This) ->
- e(),
- {nil, This}.
-
-read(_This, _Sz) ->
- e(),
- nil.
-
-readAll(This, Sz) ->
- readAll_loop(This, Sz, "", 0).
-
-readAll_loop(This, Sz, Buff, Have) ->
- if
- Have < Sz ->
- Chunk = ?L1(read, Sz - Have),
-
- %% man gen_tcp:
- %% exactly Length bytes are returned, or an error;
- %% possibly discarding less than Length bytes of data when
- %% the socket gets closed from the other side.
-
- %% error_logger:info_msg("READ |~p|", [Chunk]),
-
- Have1 = Have + (Sz-Have), % length(Chunk)
- Buff1 = Buff ++ Chunk, % TODO: ++ efficiency?
- readAll_loop(This, Sz, Buff1, Have1);
- true ->
- Buff
- end.
-
-effectful_write(This, _Buf) ->
- e(),
- {nil, This}.
-
-effectful_flush(This) ->
- {nil, This}.
diff --git a/lib/erl/src/transport/tTransportException.erl b/lib/erl/src/transport/tTransportException.erl
deleted file mode 100644
index f81ae9b..0000000
--- a/lib/erl/src/transport/tTransportException.erl
+++ /dev/null
@@ -1,57 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tTransportException).
-
--include("oop.hrl").
-
--include("thrift.hrl").
--include("transport/tTransportException.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/0, new/1, new/2]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?DEFINE_ATTR(super).
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- tException.
-
-%%% inspect(This) -> string()
-
-inspect(This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new(Type, Message) ->
- Super = (super()):new(Type, Message),
- #?MODULE{super=Super}.
-
-new() ->
- new(?tTransportException_UNKNOWN, undefined).
-new(Type) ->
- new(Type, undefined).
-
-%%%
-%%% instance methods
-%%%
diff --git a/lib/erl/src/transport/tTransportFactory.erl b/lib/erl/src/transport/tTransportFactory.erl
deleted file mode 100644
index 77a9e01..0000000
--- a/lib/erl/src/transport/tTransportFactory.erl
+++ /dev/null
@@ -1,52 +0,0 @@
-%%% Copyright (c) 2007- Facebook
-%%% Distributed under the Thrift Software License
-%%%
-%%% See accompanying file LICENSE or visit the Thrift site at:
-%%% http://developers.facebook.com/thrift/
-
--module(tTransportFactory).
-
--include("oop.hrl").
--include("transport/tTransportFactory.hrl").
-
--behavior(oop).
-
--export([attr/4, super/0, inspect/1]).
-
--export([new/0, getTransport/2]).
-
-%%%
-%%% define attributes
-%%% 'super' is required unless ?MODULE is a base class
-%%%
-
-?ATTR_DUMMY.
-
-%%%
-%%% behavior callbacks
-%%%
-
-%%% super() -> SuperModule = atom()
-%%% | none
-
-super() ->
- none.
-
-%%% inspect(This) -> string()
-
-inspect(_This) ->
- "".
-
-%%%
-%%% class methods
-%%%
-
-new() ->
- #?MODULE{}.
-
-%%%
-%%% instance methods
-%%%
-
-getTransport(_This, Trans) ->
- Trans.
diff --git a/lib/erl/vsn.mk b/lib/erl/vsn.mk
deleted file mode 100644
index d9b4001..0000000
--- a/lib/erl/vsn.mk
+++ /dev/null
@@ -1 +0,0 @@
-THRIFT_VSN=0.1