diff --git a/README.md b/README.md index 952e9a2..1855e8c 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,3 @@ # The parse_trans application # - - -## Modules ## - - - - - - - - -
ct_expand
exprecs
parse_trans
parse_trans_codegen
parse_trans_mod
parse_trans_pp
- diff --git a/doc/README.md b/doc/README.md index 14bd178..1855e8c 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,16 +1,3 @@ # The parse_trans application # - - -## Modules ## - - - - - - - - -
ct_expand
exprecs
parse_trans
parse_trans_codegen
parse_trans_mod
parse_trans_pp
- diff --git a/doc/ct_expand.md b/doc/ct_expand.md index 34d55f6..508a73e 100644 --- a/doc/ct_expand.md +++ b/doc/ct_expand.md @@ -6,44 +6,32 @@ * [Function Index](#index) * [Function Details](#functions) - Compile-time expansion utility. + __Authors:__ : Ulf Wiger ([`ulf@feuerlabs.com`](mailto:ulf@feuerlabs.com)). + ## Description ## - - This module serves as an example of parse_trans-based transforms, but might also be a useful utility in its own right. The transform searches for calls to the pseudo-function `ct_expand:term(Expr)`, and then replaces the call site with the result of evaluating `Expr` at compile-time. - - For example, the line - - `ct_expand:term(lists:sort([3,5,2,1,4]))` - - would be expanded at compile-time to `[1,2,3,4,5]`. - - ct_expand has now been extended to also evaluate calls to local functions. See examples/ct_expand_test.erl for some examples. - - A debugging facility exists: passing the option {ct_expand_trace, Flags} as an option, or adding a compiler attribute -ct_expand_trace(Flags) will enable a form of call trace. - `Flags` can be `[]` (no trace) or `[F]`, where `F` is `c` (call trace), `r` (return trace), or `x` (exception trace)'. @@ -57,7 +45,6 @@ or adding a compiler attribute -ct_expand_trace(Flags) will enable a form of cal ### form() ### -

 form() = any()
 
@@ -65,11 +52,9 @@ form() = any() - ### forms() ### -

 forms() = [form()]
 
@@ -77,16 +62,13 @@ forms() = [form()] - ### options() ### -

 options() = [{atom(), any()}]
 
- ## Function Index ## @@ -105,22 +87,18 @@ options() = [{atom(), any()}] `extract_fun(Name, Arity, Forms) -> any()` - ### lfun_rewrite/2 ### `lfun_rewrite(Exprs, Forms) -> any()` - ### parse_transform/2 ### -

 parse_transform(Forms::forms(), Options::options()) -> forms()
 

- diff --git a/doc/edoc-info b/doc/edoc-info index 7665186..995e8f4 100644 --- a/doc/edoc-info +++ b/doc/edoc-info @@ -1,5 +1,4 @@ %% encoding: UTF-8 {application,parse_trans}. -{packages,[]}. {modules,[ct_expand,exprecs,parse_trans,parse_trans_codegen,parse_trans_mod, parse_trans_pp]}. diff --git a/doc/exprecs.md b/doc/exprecs.md index 80e5c79..bd5ef54 100644 --- a/doc/exprecs.md +++ b/doc/exprecs.md @@ -6,9 +6,10 @@ * [Function Index](#index) * [Function Details](#functions) - Parse transform for generating record access functions. + __Authors:__ : Ulf Wiger ([`ulf@wiger.net`](mailto:ulf@wiger.net)). + ## Description ## @@ -16,54 +17,28 @@ __Authors:__ : Ulf Wiger ([`ulf@wiger.net`](mailto:ulf@wiger.net)). This parse transform can be used to reduce compile-time dependencies in large systems. - In the old days, before records, Erlang programmers often wrote access functions for tuple data. This was tedious and error-prone. The record syntax made this easier, but since records were implemented fully in the pre-processor, a nasty compile-time dependency was introduced. - This module automates the generation of access functions for records. While this method cannot fully replace the utility of pattern matching, it does allow a fair bit of functionality on records without the need for compile-time dependencies. - Whenever record definitions need to be exported from a module, inserting a compiler attribute, `export_records([RecName|...])` causes this transform to lay out access functions for the exported records: - As an example, consider the following module: -``` +```erlang -module(test_exprecs). -export([f/0]). - -compile({parse_transform, exprecs}). - -record(r, {a = 0 :: integer(), - b = 0 :: integer(), - c = 0 :: integer()}). - -record(s,{a}). - -export_records([r,s]). - f() -> - {new,'#new-r'([])}. -``` - - - -Compiling this (assuming exprecs is in the path) will produce the -following code. - - - -``` - - -module(test_exprecs). - -compile({pt_pp_src,true}). - -export([f/0]). -record(r,{a = 0 :: integer(),b = 0 :: integer(),c = 0 :: integer()}). -record(s,{a}). -export_records([r,s]). @@ -96,6 +71,7 @@ following code. '#fromlist-s'/2, '#info-s'/1, '#lens-s'/1]). + -export_type(['#prop-r'/0,'#attr-r'/0,'#prop-s'/0,'#attr-s'/0]). -type '#prop-r'() :: {a, integer()} | {b, integer()} | {c, integer()}. -type '#attr-r'() :: a | b | c. -type '#prop-s'() :: {a, any()}. @@ -109,14 +85,14 @@ following code. '#new-r'(); '#new-'(s) -> '#new-s'(). - -spec '#info-'(r) -> [a | b | c]; - (s) -> [a]. + -spec '#info-'(r) -> ['#attr-r'()]; + (s) -> ['#attr-s'()]. '#info-'(RecName) -> '#info-'(RecName, fields). -spec '#info-'(r, size) -> 4; - (r, fields) -> [a | b | c]; + (r, fields) -> ['#attr-r'()]; (s, size) -> 2; - (s, fields) -> [a]. + (s, fields) -> ['#attr-s'()]. '#info-'(r, Info) -> '#info-r'(Info); '#info-'(s, Info) -> @@ -150,7 +126,8 @@ following code. (b, #r{}) -> integer(); (c, #r{}) -> integer(); (a, #s{}) -> any(); - (['#attr-r'()], #r{}) -> [integer()]; + (['#attr-r'()], #r{}) -> + [integer() | integer() | integer()]; (['#attr-s'()], #s{}) -> [any()]. '#get-'(Attrs, Rec) when is_record(Rec, r) -> '#get-r'(Attrs, Rec); @@ -168,10 +145,10 @@ following code. '#fromlist-r'(Vals, Rec); '#fromlist-'(Vals, Rec) when is_record(Rec, s) -> '#fromlist-s'(Vals, Rec). - -spec '#lens-'('#prop-r'(), r) -> - {fun((#r{}) -> any()), fun((any(), #r{}) -> #r{})}; - ('#prop-s'(), s) -> - {fun((#s{}) -> any()), fun((any(), #s{}) -> #s{})}. + -spec '#lens-'('#attr-r'(), r) -> + {fun((#r{}) -> any()), fun((any(), #r{}) -> #r{})}; + ('#attr-s'(), s) -> + {fun((#s{}) -> any()), fun((any(), #s{}) -> #s{})}. '#lens-'(Attr, r) -> '#lens-r'(Attr); '#lens-'(Attr, s) -> @@ -185,7 +162,7 @@ following code. -spec '#get-r'(a, #r{}) -> integer(); (b, #r{}) -> integer(); (c, #r{}) -> integer(); - (['#attr-r'()], #r{}) -> [integer()]. + (['#attr-r'()], #r{}) -> [any()]. '#get-r'(Attrs, R) when is_list(Attrs) -> [ '#get-r'(A, R) || @@ -240,13 +217,13 @@ following code. '#pos-r'(A) when is_atom(A) -> 0. -spec '#info-r'(fields) -> [a | b | c]; - (size) -> 3. + (size) -> 4. '#info-r'(fields) -> record_info(fields, r); '#info-r'(size) -> record_info(size, r). - -spec '#lens-r'('#prop-r'()) -> - {fun((#r{}) -> any()), fun((any(), #r{}) -> #r{})}. + -spec '#lens-r'('#attr-r'()) -> + {fun((#r{}) -> any()), fun((any(), #r{}) -> #r{})}. '#lens-r'(a) -> {fun(R) -> '#get-r'(a, R) @@ -320,13 +297,13 @@ following code. '#pos-s'(A) when is_atom(A) -> 0. -spec '#info-s'(fields) -> [a]; - (size) -> 1. + (size) -> 2. '#info-s'(fields) -> record_info(fields, s); '#info-s'(size) -> record_info(size, s). - -spec '#lens-s'('#prop-s'()) -> - {fun((#s{}) -> any()), fun((any(), #s{}) -> #s{})}. + -spec '#lens-s'('#attr-s'()) -> + {fun((#s{}) -> any()), fun((any(), #s{}) -> #s{})}. '#lens-s'(a) -> {fun(R) -> '#get-s'(a, R) @@ -335,18 +312,14 @@ following code. '#set-s'([{a,X}], R) end}; '#lens-s'(Attr) -> - error(bad_record_op, ['#lens-s', Attr]). + error(bad_record_op, ['#lens-s',Attr]). f() -> {new,'#new-r'([])}. ``` - - It is possible to modify the naming rules of exprecs, through the use of the following attributes (example reflecting the current rules): - - ``` -exprecs_prefix(["#", operation, "-"]). @@ -354,7 +327,6 @@ of the following attributes (example reflecting the current rules): -exprecs_vfname([fname, "__", version]). ``` - The lists must contain strings or any of the following control atoms: * in `exprecs_prefix`: `operation` @@ -364,13 +336,10 @@ The lists must contain strings or any of the following control atoms: * in `exprecs_vfname`: `operation`, `record`, `prefix`, `fname`, `version` - - Exprecs will substitute the control atoms with the string values of the corresponding items. The result will then be flattened and converted to an atom (a valid function or type name). - `operation` is one of: @@ -485,7 +454,6 @@ atom (a valid function or type name). ### form() ### -

 form() = any()
 
@@ -493,11 +461,9 @@ form() = any() - ### forms() ### -

 forms() = [form()]
 
@@ -505,16 +471,13 @@ forms() = [form()] - ### options() ### -

 options() = [{atom(), any()}]
 
- ## Function Index ## @@ -531,10 +494,8 @@ options() = [{atom(), any()}] ### parse_transform/2 ### -

 parse_transform(Forms::forms(), Options::options()) -> forms()
 

- diff --git a/doc/parse_trans.md b/doc/parse_trans.md index 296b9bb..b5a8525 100644 --- a/doc/parse_trans.md +++ b/doc/parse_trans.md @@ -6,15 +6,14 @@ * [Function Index](#index) * [Function Details](#functions) - Generic parse transform library for Erlang. + __Authors:__ : Ulf Wiger ([`ulf.wiger@feuerlabs.com`](mailto:ulf.wiger@feuerlabs.com)). + ## Description ## - - ... @@ -28,7 +27,6 @@ __Authors:__ : Ulf Wiger ([`ulf.wiger@feuerlabs.com`](mailto:ulf.wiger@feuerlabs ### form() ### -

 form() = any()
 
@@ -36,11 +34,9 @@ form() = any() - ### forms() ### -

 forms() = [form()]
 
@@ -48,11 +44,9 @@ forms() = [form()] - ### insp_f() ### -

 insp_f() = fun((type(), form(), #context{}, A) -> {boolean(), A})
 
@@ -60,11 +54,9 @@ insp_f() = fun((type(), form() - ### options() ### -

 options() = [{atom(), any()}]
 
@@ -72,11 +64,9 @@ options() = [{atom(), any()}] - ### type() ### -

 type() = atom()
 
@@ -84,11 +74,9 @@ type() = atom() - ### xform_f_df() ### -

 xform_f_df() = fun((type(), form(), #context{}, Acc) -> {form(), Acc} | {forms(), form(), forms(), Acc})
 
@@ -96,16 +84,13 @@ xform_f_df() = fun((type(), form() - ### xform_f_rec() ### -

 xform_f_rec() = fun((type(), form(), #context{}, Acc) -> {form(), boolean(), Acc} | {forms(), form(), forms(), boolean(), Acc})
 
- ## Function Index ## @@ -136,83 +121,69 @@ Makes one pass. ### context/2 ### -

 context(X1::Attr, Context) -> any()
 
- Accessor function for the Context record. + ### depth_first/4 ### -

 depth_first(Fun::xform_f_df(), Acc, Forms::forms(), Options::options()) -> {forms(), Acc} | {error, list()}
 

- ### do_depth_first/4 ### -

 do_depth_first(F::xform_f_df(), Acc::term(), Forms::forms(), Context::#context{}) -> {forms(), term()}
 

- ### do_insert_forms/4 ### -

 do_insert_forms(X1::above | below, Insert::forms(), Forms::forms(), Context::#context{}) -> forms()
 

- ### do_inspect/4 ### -

 do_inspect(F::insp_f(), Acc::term(), Forms::forms(), Context::#context{}) -> term()
 

- ### do_transform/4 ### -

 do_transform(F::xform_f_rec(), Acc::term(), Forms::forms(), Context::#context{}) -> {forms(), term()}
 

- ### error/3 ### -

 error(R::Reason, F::Form, I::Info) -> throw()
 
- - Used to report errors detected during the parse transform. @@ -221,121 +192,106 @@ Used to report errors detected during the parse transform. `export_function(F, Arity, Forms) -> any()` - ### format_error/1 ### -

 format_error(Error::{atom(), term()}) -> iolist()
 

- ### format_exception/2 ### -

 format_exception(Class, Reason) -> String
 

Equivalent to [`format_exception(Class, Reason, 4)`](#format_exception-3). + ### format_exception/3 ### -

 format_exception(Class, Reason, Lines) -> String
 
- Produces a few lines of user-friendly formatting of exception info - - This function is very similar to the exception pretty-printing in the shell, but returns a string that can be used as error info e.g. by error forms handled by [`return/2`](#return-2). By default, the first 4 lines of the pretty-printed exception info are returned, but this can be controlled with the `Lines` parameter. - Note that a stacktrace is generated inside this function. + ### function_exists/3 ### -

 function_exists(Fname::atom(), Arity::integer(), Forms) -> boolean()
 

- Checks whether the given function is defined in Forms. + ### get_attribute/2 ### -

 get_attribute(A, Forms) -> any()
 
- Returns the value of the first occurence of attribute A. + ### get_attribute/3 ### `get_attribute(A, Forms, Undef) -> any()` - ### get_file/1 ### -

 get_file(Forms) -> string()
 

- Returns the name of the file being compiled. + ### get_module/1 ### -

 get_module(Forms) -> atom()
 

- Returns the name of the module being compiled. + ### get_orig_syntax_tree/1 ### -

 get_orig_syntax_tree(File) -> Forms
 

- - Fetches a Syntax Tree representing the code before pre-processing, that is, including record and macro definitions. Note that macro definitions must be syntactically complete forms (this function @@ -345,86 +301,73 @@ uses epp_dodger). ### get_pos/1 ### -

 get_pos(I::list()) -> integer()
 

- Tries to retrieve the line number from an erl_syntax form. Returns a (very high) dummy number if not successful. + ### initial_context/2 ### -

 initial_context(Forms, Options) -> #context{}
 

- Initializes a context record. When traversing through the form list, the context is updated to reflect the current function and arity. Static elements in the context are the file name, the module name and the options passed to the transform function. + ### inspect/4 ### -

 inspect(F::Fun, Acc::Forms, Forms::Acc, Options) -> NewAcc
 
- Equvalent to do_inspect(Fun,Acc,Forms,initial_context(Forms,Options)). + ### optionally_pretty_print/3 ### -

 optionally_pretty_print(Result::forms(), Options::options(), Context::#context{}) -> ok
 

- ### plain_transform/2 ### -

 plain_transform(Fun, Forms) -> forms()
 
- - Performs a transform of `Forms` using the fun `Fun(Form)`. `Form` is always an Erlang abstract form, i.e. it is not converted to syntax_tools representation. The intention of this transform is for the fun to have a catch-all clause returning `continue`. This will ensure that it stays robust against additions to the language. - - `Fun(Form)` must return either of the following: - - * `NewForm` - any valid form * `continue` - dig into the sub-expressions of the form * `{done, NewForm}` - Replace `Form` with `NewForm`; return all following forms unchanged * `{error, Reason}` - Abort transformation with an error message. - Example - This transform fun would convert all instances of `P ! Msg` to `gproc:send(P, Msg)`: @@ -445,33 +388,30 @@ Example - This transform fun would convert all instances of `P ! Msg` to ### pp_beam/1 ### -

 pp_beam(Beam::file:filename()) -> string() | {error, Reason}
 

- Reads debug_info from the beam file Beam and returns a string containing the pretty-printed corresponding erlang source code. + ### pp_beam/2 ### -

 pp_beam(Beam::filename(), Out::filename()) -> ok | {error, Reason}
 

- Reads debug_info from the beam file Beam and pretty-prints it as Erlang source code, storing it in the file Out. + ### pp_src/2 ### -

 pp_src(Res::Forms, Out::filename()) -> ok
 
@@ -485,19 +425,16 @@ Pretty-prints the erlang source code corresponding to Forms into Out `replace_function(F, Arity, NewForm, Forms) -> any()` - ### replace_function/5 ### `replace_function(F, Arity, NewForm, Forms, Opts) -> any()` - ### return/2 ### -

 return(Forms, Context) -> Forms | {error, Es, Ws} | {warnings, Forms, Ws}
 
@@ -511,7 +448,6 @@ a bit of care. The easiest way is to simply produce an `{error, Err}` or removes them from the form list (otherwise, the linter will crash), and produces a return value that the compiler can work with. - The format of the `error` and `warning` "forms" must be `{Tag, {Pos, Module, Info}}`, where: @@ -533,7 +469,6 @@ using the function [`format_exception/2`](#format_exception-2). ### revert/1 ### -

 revert(Tree) -> Forms
 
@@ -545,7 +480,6 @@ Note that the Erlang forms are a subset of the Syntax Tools syntax tree, so this function is safe to call even on a list of regular Erlang forms. - Note2: R16B03 introduced a bug, where forms produced by `erl_syntax:revert/1` (specifically, implicit funs) could crash the linter. This function works around that limitation, after first verifying that it's @@ -557,7 +491,6 @@ variable will be removed when R16B03 is no longer 'supported'. ### revert_form/1 ### -

 revert_form(F::Tree) -> Form
 
@@ -569,12 +502,10 @@ Reverts a single form back from Syntax Tools format to Erlang forms. completely revert attribute forms. This function deals properly with those cases. - Note that the Erlang forms are a subset of the Syntax Tools syntax tree, so this function is safe to call even on a regular Erlang form. - Note2: R16B03 introduced a bug, where forms produced by `erl_syntax:revert/1` (specifically, implicit funs) could crash the linter. This function works around that limitation, after first verifying that it's @@ -586,23 +517,20 @@ variable will be removed when R16B03 is no longer 'supported'. ### top/3 ### -

 top(F::function(), Forms::forms(), Options::list()) -> forms() | {error, term()}
 

- ### transform/4 ### -

 transform(Fun, Acc, Forms, Options) -> {TransformedForms, NewAcc}
 
- Makes one pass + diff --git a/doc/parse_trans_codegen.md b/doc/parse_trans_codegen.md index e2bdc39..7e7f7bf 100644 --- a/doc/parse_trans_codegen.md +++ b/doc/parse_trans_codegen.md @@ -5,15 +5,14 @@ * [Function Index](#index) * [Function Details](#functions) - Parse transform for code generation pseduo functions. + __Authors:__ : Ulf Wiger ([`ulf@feuerlabs.com`](mailto:ulf@feuerlabs.com)). + ## Description ## - - ... @@ -37,57 +36,40 @@ representing the abstract form of that code. `format_error(E) -> any()` - ### parse_transform/2 ### -

 parse_transform(Forms, Options) -> NewForms
 

- - Searches for calls to pseudo functions in the module `codegen`, and converts the corresponding erlang code to a data structure representing the abstract form of that code. - - The purpose of these functions is to let the programmer write the actual code that is to be generated, rather than manually writing abstract forms, which is more error prone and cannot be checked by the compiler until the generated module is compiled. - - Supported functions: - - ## gen_function/2 ## - - Usage: `codegen:gen_function(Name, Fun)` - - Substitutes the abstract code for a function with name `Name` and the same behaviour as `Fun`. - `Fun` can either be a anonymous `fun`, which is then converted to a named function, or it can be an `implicit fun`, e.g. `fun is_member/2`. In the latter case, the referenced function is fetched and converted to an abstract form representation. It is also renamed so that the generated function has the name `Name`. - - Another alternative is to wrap a fun inside a list comprehension, e.g. ``` @@ -101,8 +83,6 @@ Another alternative is to wrap a fun inside a list comprehension, e.g. ``` - - Calling the above with `f(foo, [{1,a},{2,b},{3,c}])` will result in generated code corresponding to: @@ -114,27 +94,17 @@ generated code corresponding to: ``` - - ## gen_functions/1 ## - - Takes a list of `{Name, Fun}` tuples and produces a list of abstract data objects, just as if one had written `[codegen:gen_function(N1,F1),codegen:gen_function(N2,F2),...]`. - - ## exprs/1 ## - - Usage: `codegen:exprs(Fun)` - - `Fun` is either an anonymous function, or an implicit fun with only one function clause. This "function" takes the body of the fun and produces a data type representing the abstract form of the list of expressions in @@ -142,43 +112,26 @@ the body. The arguments of the function clause are ignored, but can be used to ensure that all necessary variables are known to the compiler. - - ## gen_module/3 ## - - Generates abstract forms for a complete module definition. - - Usage: `codegen:gen_module(ModuleName, Exports, Functions)` - - `ModuleName` is either an atom or a `{'$var', V}` reference. - - `Exports` is a list of `{Function, Arity}` tuples. - - `Functions` is a list of `{Name, Fun}` tuples analogous to that for `gen_functions/1`. - - ## Variable substitution ## - - It is possible to do some limited expansion (importing a value bound at compile-time), using the construct `{'$var', V}`, where `V` is a bound variable in the scope of the call to `gen_function/2`. - Example: ``` @@ -187,7 +140,6 @@ Example: codegen:gen_function(Name, fun(L) -> lists:member({'$var',X}, L) end). ``` - After transformation, calling `gen(contains_17, 17)` will yield the abstract form corresponding to: @@ -198,17 +150,12 @@ abstract form corresponding to: ``` - - ## Form substitution ## - - It is possible to inject abstract forms, using the construct `{'$form', F}`, where `F` is bound to a parsed form in the scope of the call to `gen_function/2`. - Example: ``` @@ -217,7 +164,6 @@ Example: codegen:gen_function(Name, fun(X) -> X =:= {'$form',F} end). ``` - After transformation, calling `gen(is_foo, {atom,0,foo})` will yield the abstract form corresponding to: diff --git a/doc/parse_trans_mod.md b/doc/parse_trans_mod.md index 84e925f..0d3f979 100644 --- a/doc/parse_trans_mod.md +++ b/doc/parse_trans_mod.md @@ -5,8 +5,6 @@ * [Function Index](#index) * [Function Details](#functions) - - ## Data Types ## @@ -17,7 +15,6 @@ ### compile_options() ### -

 compile_options() = [term()]
 
@@ -25,16 +22,13 @@ compile_options() = [term()] - ### erlang_form() ### -

 erlang_form() = term()
 
- ## Function Index ## @@ -51,72 +45,59 @@ erlang_form() = term() ### abstract_code/1 ### -

 abstract_code(BeamFile::binary()) -> erlang_form()
 

- ### beam_file/1 ### -

 beam_file(Module::module()) -> binary()
 

- ### compile_and_load_forms/1 ### -

 compile_and_load_forms(AbsCode::erlang_form()) -> ok
 

- ### compile_and_load_forms/2 ### -

 compile_and_load_forms(AbsCode::erlang_form(), Opts::compile_options()) -> ok
 

- ### compile_options/1 ### -

 compile_options(BeamFile::binary() | module()) -> compile_options()
 

- ### rename_module/2 ### -

 rename_module(T::erlang_form(), NewName::module()) -> erlang_form()
 

- ### transform_module/3 ### `transform_module(Mod, PT, Options) -> any()` - diff --git a/doc/parse_trans_pp.md b/doc/parse_trans_pp.md index 8b4c183..bafbf99 100644 --- a/doc/parse_trans_pp.md +++ b/doc/parse_trans_pp.md @@ -5,21 +5,19 @@ * [Function Index](#index) * [Function Details](#functions) - Generic parse transform library for Erlang. + __Authors:__ : Ulf Wiger ([`ulf@feuerlabs.com`](mailto:ulf@feuerlabs.com)). + ## Description ## - - This module contains some useful utility functions for inspecting the results of parse transforms or code generation. The function `main/1` is called from escript, and can be used to pretty-print debug info in a .beam file from a Linux shell. - Using e.g. the following bash alias: ``` @@ -27,10 +25,8 @@ Using e.g. the following bash alias: alias pp='escript $PARSE_TRANS_ROOT/ebin/parse_trans_pp.beam' ``` - a file could be pretty-printed using the following command: - `$ pp ex_codegen.beam | less` ## Function Index ## @@ -51,44 +47,39 @@ Erlang source code, storing it in the file Out. main(X1::[string()]) -> any()
-
### pp_beam/1 ### -

 pp_beam(Beam::filename()) -> string() | {error, Reason}
 

- Reads debug_info from the beam file Beam and returns a string containing the pretty-printed corresponding erlang source code. + ### pp_beam/2 ### -

 pp_beam(Beam::filename(), Out::filename()) -> ok | {error, Reason}
 

- Reads debug_info from the beam file Beam and pretty-prints it as Erlang source code, storing it in the file Out. + ### pp_src/2 ### -

 pp_src(Forms0::Forms, Out::filename()) -> ok
 
diff --git a/doc/stylesheet.css b/doc/stylesheet.css index e426a90..ab170c0 100644 --- a/doc/stylesheet.css +++ b/doc/stylesheet.css @@ -27,10 +27,10 @@ div.spec { margin-left: 2em; background-color: #eeeeee; } -a.module,a.package { +a.module { text-decoration:none } -a.module:hover,a.package:hover { +a.module:hover { background-color: #eeeeee; } ul.definitions {