Skip to content

Commit

Permalink
Tighten up packbeam_api
Browse files Browse the repository at this point in the history
This change set tightens up the packbeam API to expose just enough information about AVM files as is needed without exposing internal implementation details.

Signed-off-by: Fred Dushin <fred@dushin.net>
  • Loading branch information
fadushin committed Oct 20, 2023
1 parent 1874698 commit 692a74c
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 83 deletions.
19 changes: 9 additions & 10 deletions src/packbeam.erl
Original file line number Diff line number Diff line change
Expand Up @@ -272,35 +272,34 @@ print_modules(Modules, Format) ->
print_module(ParsedFile, undefined) ->
print_module(ParsedFile, "default");
print_module(ParsedFile, "default") ->
ModuleName = proplists:get_value(module_name, ParsedFile),
Flags = proplists:get_value(flags, ParsedFile),
Data = proplists:get_value(data, ParsedFile),
Name = packbeam_api:get_element_name(ParsedFile),
Data = packbeam_api:get_element_data(ParsedFile),
io:format(
"~s~s [~p]~n", [
ModuleName,
case packbeam_api:is_entrypoint(Flags) of
Name,
case packbeam_api:is_entrypoint(ParsedFile) of
true -> " *";
_ -> ""
end,
byte_size(Data)
]
);
print_module(ParsedFile, "csv") ->
ModuleName = proplists:get_value(module_name, ParsedFile),
Data = proplists:get_value(data, ParsedFile),
Name = packbeam_api:get_element_name(ParsedFile),
Data = packbeam_api:get_element_data(ParsedFile),
io:format(
"~s,~p,~p,~p~n", [
ModuleName,
Name,
packbeam_api:is_beam(ParsedFile),
packbeam_api:is_entrypoint(ParsedFile),
byte_size(Data)
]
);
print_module(ParsedFile, "bare") ->
ModuleName = proplists:get_value(module_name, ParsedFile),
Name = packbeam_api:get_element_name(ParsedFile),
io:format(
"~s~n", [
ModuleName
Name
]
);
print_module(_ParsedFile, Format) ->
Expand Down
Loading

0 comments on commit 692a74c

Please sign in to comment.