aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/escript.erl
AgeCommit message (Collapse)Author
2010-03-16Remove the undocumented function escript:foldl/3Håkan Mattsson
It is possible to obtain the same effect with the functions escript:extract/2 and zip:fold/3. See escript_SUITE:escript_foldl/3 for a complete emulation of the old escript:foldl/3 function.
2010-03-16Add functions to create and extract escriptsHåkan Mattsson
Both reltool and rebar needs to parse escripts. They are currently using an undocumented function called escript:foldl/3. It folds a function over all files in the body of an escript. If the body contains source code the function compiles it and the gives debug compiled beam code to the fold fun. If the body is an archive the fun is applied for all files in the archive. Instead of making the undocumented function public, the new functions escript:create/2 and escript:extract/2 has been introduced. Together with the new zip:foldl/3 function they have the same functionality as escript:foldl/3 in a more flexible and generic way. escript:foldl/3 should be removed as soon as reltool and rebar has been adopted to use the new functions. The simplest way for reltool and rebar to do this is to just copy the code from escript_SUITE:escript_foldl/3, which happens to provide a future compatible implementation of an emulated escript:foldl/3 function. I was quite hesitant when I introduced the compile_source option. It feels that it does not belong there but the alternative felt worse. The rationale for the compile_source option is that it is a bit cumbersome to compile the source code, as the source in most cases is partial. In order to do compile the source you need to know about some internals in escript. Without compile_source I think that these internals should be documented. Further you need to duplicate parts of the code. Without the compile_source option you need to first parse the source to forms, using an undocumented function in epp with an extended format of predefined macros which also is undocumented. Then you need to investigate the forms to see if you need to add an export form for main. When that is done you can run the rest of the compiler passes as usual. It is not so much code (60 lines or so) to write, but I do not want to urge people to write it. I actually wrote the code (see escript_SUITE:escript_foldl/3) before I decided to introduce the compile_source option.
2010-02-22Fix escript:foldl/3 for beam and archive filesTuncer Ayaz
escript:foldl/3 was not completely adapted to the changes introduced in 6af2ac91005276add18b1c9bbf4c8fe4f8c6e040. A partial fix has already been applied by Hakan Mattson in 4ec4a06edb5baaa0af2840943230c4a0be3a93cf. Signed-off-by: Tuncer Ayaz <[email protected]>
2010-02-15Fixed a case_clause error in the internal function escript:foldl/3.Håkan Mattsson
2010-02-10OTP-8434 Improved handling of typed records in escriptsHåkan Mattsson
2010-01-27OTP-8387 Explicit top directories in archive files are now optional.Håkan Mattsson
For example, if an archive (app-vsn.ez) just contains an app-vsn/ebin/mod.beam file, the file info for the app-vsn and app-vsn/ebin directories are faked using the file info from the archive file as origin. The virtual direcories can also be listed. For short, the top directories are virtual if they does not exist.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP