Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rvirding committed Aug 10, 2011
2 parents 15b36cb + 09de124 commit 3928702
Show file tree
Hide file tree
Showing 43 changed files with 6,442 additions and 1,642 deletions.
30 changes: 24 additions & 6 deletions Makefile
Expand Up @@ -2,7 +2,7 @@
# This simple Makefile uses rebar to compile/clean if it
# exists, else does it explicitly.

EBINDIR = ebin
BINDIR = ebin
SRCDIR = src
INCDIR = include
DOCDIR = doc
Expand All @@ -11,7 +11,7 @@ EMACSDIR = emacs
VPATH = $(SRCDIR)

ERLCFLAGS = -W0 +debug_info
ERLC = erlc -I $(INCDIR) -o $(EBINDIR) $(ERLCFLAGS)
ERLC = erlc

## The .erl and .beam files
SRCS = $(notdir $(wildcard $(SRCDIR)/*.erl))
Expand All @@ -20,19 +20,37 @@ EBINS = $(SRCS:.erl=.beam)
## Where we install LFE, in the ERL_LIBS directory.
INSTALLDIR = $(ERL_LIBS)/lfe

.SUFFIXES: .erl .beam

$(BINDIR)/%.beam: %.erl
$(ERLC) -I $(INCDIR) -o $(BINDIR) $(ERLCFLAGS) $<

$(SRCDIR)/%.erl: %.xrl
$(ERLC) -o $(SRCDIR) $<

$(SRCDIR)/%.erl: %.yrl
$(ERLC) -o $(SRCDIR) $<

all: compile docs

.PHONY: compile erlc_compile install docs clean

## Compile using rebar if it exists else using make
compile:
if which -s rebar; \
then rebar compile; \
else $(ERLC) $(addprefix $(SRCDIR)/, $(SRCS)); \
else $(MAKE) $(MFLAGS) erlc_compile; \
fi

## Compile using erlc
erlc_compile: $(addprefix $(BINDIR)/, $(EBINS))

install:
if [ "$$ERL_LIBS" != "" ]; \
then mkdir -p $(INSTALLDIR)/$(EBINDIR) ; \
cp -pPR $(EBINDIR) $(INSTALLDIR); \
then mkdir -p $(INSTALLDIR)/$(BINDIR) ; \
cp -pPR $(BINDIR) $(INSTALLDIR); \
cp -pPR $(EMACSDIR) $(INSTALLDIR); \
cp -pPR $(INCDIR) $(INSTALLDIR); \
else exit 1; \
fi

Expand All @@ -41,6 +59,6 @@ docs:
clean:
if which -s rebar; \
then rebar clean; \
else rm -rf $(EBINDIR)/*.beam; \
else rm -rf $(BINDIR)/*.beam; \
fi
rm -rf erl_crash.dump
9 changes: 9 additions & 0 deletions README
Expand Up @@ -17,6 +17,15 @@ I will try to make a better fix soon. Sorry about that.
v0.7
----

First version of Query List Comprehensions.

Add access to current macro environment through the variable $ENV
within macros which allows explicit macro expansion.

First version of match-specification generator.

Add ets/mnesia match patterns to records.

Arithmetic functions + - * / and comparison functions > >= < =< == /=
=:= =/= now take multiple arguments. This is experimental and as yet
only implemented as macros.
Expand Down
35 changes: 35 additions & 0 deletions doc/lfe_bits.txt
@@ -0,0 +1,35 @@
MODULE

lfe_bits

MODULE SUMMARY

Lisp Flavoured Erlang (LFE) common binary functions

DESCRIPTION

This module contains a collection of library functions for for
handling binaries. They are generally not called by the user.

EXPORTS

parse_bitspecs(Specs) ->
{ok,Size,{Type,Unit,Sign,Endian}} |
{error,Error}.

Parse a bitspec and return the data. Unmentioned fields get
the value 'default'.

get_bitspecs(Specs) ->
{ok,Size,{Type,Unit,Sign,Endian}} |
{error,Error}.

Parse a bitspec, apply defaults and return the
data. Unmentioned fields get the value 'default'.

Error Information

The following error values are returned:

{undefined_bittype,Type}
bittype_unit
29 changes: 14 additions & 15 deletions doc/lfe_macro.txt
Expand Up @@ -27,40 +27,39 @@ DATA TYPES

EXPORTS

expand_form(Sexpr) -> Sexpr.
expand_form(Sexpr, Env) -> Sexpr.
expand_forms([FileSexpr], Env) -> ExpRet

where
Sexpr = sexpr()
FileSexpr = filesexpr()
Env = env()
ExpRet = {yes,[FileSexpr],Env,Warnings} | {error,Errors,Warnings}

Expand all macros in Sexpr either using the definitions in Env
or jst the default macros. Note that any eventual new macro
definitions will be lost.

expand_forms([FileSexpr]) -> [FileSexpr].
expand_forms([FileSexpr], Env) -> {[FileSexpr],Env}.
macro_forms([FileSexpr], Env) -> {[FileSexpr],Env}.

where
FileSexpr = filesexpr()
Env = env()

macro_forms([FileSexpr], Env) -> {[FileSexpr],Env}.
expand_expr_all(Sexpr, Env) -> Sexpr.

where
FileSexpr = filesexpr()
Sexpr = sexpr()
Env = env()

expand_macro(Sexpr, Env) -> {yes,Exp} | no.
expand_macro_1(Sexpr, Env) -> {yes,Exp} | no.
Expand all macros in Sexpr either using the definitions in Env
or just the default macros. Note that any eventual new macro
definitions will be lost.

expand_expr(Sexpr, Env) -> {yes,Exp} | no.
expand_expr_1(Sexpr, Env) -> {yes,Exp} | no.

where
Sexpr = Exp = sexpr()
Env = env()

Test if the top s-expression here is a macro call, if so
expand it and return {yes,Expansion}, if not then return no.
expand_macro/2 will expand the top s-expression as much as
possible while expand_macro_1/2 will only try it once. These
expand_expr/2 will expand the top s-expression as much as
possible while expand_expr_1/2 will only try it once. These
functions use the macro definitions in the environment and the
standard pre-defined macros.
17 changes: 0 additions & 17 deletions doc/lfe_shell.txt
Expand Up @@ -48,23 +48,6 @@ DESCRIPTION
All the commands in the standard Erlang shell can be
reached in this way.

(macroexpand-1 Expr)
If Expr is a macro call, does one round of expansion,
otherwise returns Expr.

(macroexpand Expr)
Returns the expansion returned by calling
macroexpand-1 repeatedly, starting with Expr, until
the result is no longer a macro call.

(macroexpand-all Expr)
Returns the expansion from the expression where all
macro calls have been expanded with macroexpand.

NOTE that when macroexpand-1 and macroexpand are called in
expressions entered in the shell then they will also expand
macros visible in the shell, e.g. from slurped filed.

Builtin shell variables:

+/++/+++
Expand Down

0 comments on commit 3928702

Please sign in to comment.