diff options
author | Erlang/OTP <[email protected]> | 2010-03-17 09:05:43 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-03-17 09:05:43 +0000 |
commit | 4b8723ee1e17264d15cc89e26e2293605280f319 (patch) | |
tree | 8aa0abe065490667057eaafe10aac2919cc95458 /lib/reltool/src/reltool.hrl | |
parent | e2c29e24e0635ed729896f16c1d32fc2437371cf (diff) | |
parent | d09c73a475ecc29b2715b92fe39bd234b3283e84 (diff) | |
download | otp-4b8723ee1e17264d15cc89e26e2293605280f319.tar.gz otp-4b8723ee1e17264d15cc89e26e2293605280f319.tar.bz2 otp-4b8723ee1e17264d15cc89e26e2293605280f319.zip |
Merge branch 'hawk/escript-add-create-and-extract' into dev
* hawk/escript-add-create-and-extract:
Add type info for record fields
Remove the undocumented function escript:foldl/3
Make reltool independent of the function escript:foldl/3
Add functions to create and extract escripts
Add function zip:foldl/3 to iterate over zip archives
OTP-8521 hawk/escript-add-create-and-extract
Added function zip:foldl/3 to iterate over zip archives.
Added functions to create and extract escripts. See escript:create/2 and
escript:extract/2.
The undocumented function escript:foldl/3 has been removed. The same
functionality can be achieved with the more flexible functions
escript:extract/2 and zip:foldl/3.
Record fields has been annotated with type info. Source files as been
adapted to fit within 80 chars and trailing whitespace hasd been removed.
Diffstat (limited to 'lib/reltool/src/reltool.hrl')
-rw-r--r-- | lib/reltool/src/reltool.hrl | 335 |
1 files changed, 220 insertions, 115 deletions
diff --git a/lib/reltool/src/reltool.hrl b/lib/reltool/src/reltool.hrl index e7d84f97db..8a6a2142fd 100644 --- a/lib/reltool/src/reltool.hrl +++ b/lib/reltool/src/reltool.hrl @@ -16,119 +16,144 @@ %% %% %CopyrightEnd% --define(APPLICATION, reltool). +-define(APPLICATION, reltool). -define(MISSING_APP, '*MISSING*'). -define(MISSING_APP_TEXT, "*MISSING*"). --record(common, - { - sys_debug, % term() - wx_debug, % term() - trap_exit, % bool() - app_tab, % ets_tab() - mod_tab, % ets_tab() - mod_used_by_tab % ets_tab() - }). - --record(sys, - { - %% Sources - root_dir, % directory() - lib_dirs, % [directory()] - escripts, % [file()] - mod_cond, % all | app | ebin | derived | none - incl_cond, % include | exclude | derived - apps, % [#app{}] - - %% Target cond - boot_rel, % string() - rels, % [#rel{}] - emu_name, % string() - profile, % standalone | development | embedded - incl_sys_filters, % [regexp()] - excl_sys_filters, % [regexp()] - incl_app_filters, % [regexp()] - excl_app_filters, % [regexp()] - incl_archive_filters, % [regexp()] - excl_archive_filters, % [regexp()] - archive_opts, % [zip:create()] - relocatable, % bool() - app_type, % permanent | transient | temporary | load | none - app_file, % keep | strip | all - debug_info % keep | strip - }). - --record(rel, - { - name, % string() - vsn, % string() - rel_apps % [#rel_app{}] - }). +-type file() :: string(). +-type dir() :: string(). +%% app - Include all modules in app file +%% ebin - Include all modules on ebin directory +%% derived - Include only those modules that others are dependent on +-type mod_cond() :: all | app | ebin | derived | none. +-type incl_cond() :: include | exclude | derived. +-type debug_info() :: keep | strip. +-type app_file() :: keep | strip | all. +-type re_regexp() :: string(). % re:regexp() +-type regexps() :: [re_regexp()] | + {add, [re_regexp()]} | + {del, [re_regexp()]} . +-type incl_sys_filters() :: regexps(). +-type excl_sys_filters() :: regexps(). +-type incl_app_filters() :: regexps(). +-type excl_app_filters() :: regexps(). +-type incl_archive_filters() :: regexps(). +-type excl_archive_filters() :: regexps(). +-type archive_opt() :: term(). % zip:create() +-type root_dir() :: dir(). +-type lib_dir() :: dir(). +-type profile() :: development | embedded | standalone. +-type relocatable() :: boolean(). +-type escript_file() :: file(). +-type mod_name() :: atom(). +-type app_name() :: atom(). +-type app_vsn() :: string(). % e.g. "4.7" +-type app_label() :: string().% e.g. "mnesia" or "mnesia-4.7" +-type app_type() :: permanent | transient | temporary | load | none. +-type incl_app() :: app_name(). +-type emu_name() :: string(). +-type rel_name() :: string(). +-type rel_vsn() :: string(). +-type boot_rel() :: rel_name(). +-type rel_app() :: app_name() + | {app_name(), app_type()} + | {app_name(), [incl_app()]} + | {app_name(), app_type(), [incl_app()]}. +-type mod() :: {incl_cond, incl_cond()} + | {debug_info, debug_info()}. +-type app() :: {vsn, app_vsn()} + | {mod, mod_name(), mod()} + | {mod_cond, mod_cond()} + | {incl_cond, incl_cond()} + | {app_file, app_file()} + | {debug_info, debug_info()} + | {incl_app_filters, incl_app_filters()} + | {excl_app_filters, excl_app_filters()} + | {incl_archive_filters, incl_archive_filters()} + | {excl_archive_filters, excl_archive_filters()}. +-type escript() :: {incl_cond, incl_cond()}. +-type sys() :: {mod_cond, mod_cond()} + | {incl_cond, incl_cond()} + | {debug_info, debug_info()} + | {app_file, app_file()} + | {profile, profile()} + | {incl_sys_filters, incl_sys_filters()} + | {excl_sys_filters, excl_sys_filters()} + | {incl_app_filters, incl_app_filters()} + | {excl_app_filters, excl_app_filters()} + | {incl_archive_filters, incl_archive_filters()} + | {excl_archive_filters, excl_archive_filters()} + | {archive_opts, [archive_opt()]} + | {root_dir, root_dir()} + | {lib_dirs, [lib_dir()]} + | {boot_rel, boot_rel()} + | {rel, rel_name(), rel_vsn(), [rel_app()]} + | {relocatable, relocatable()} + | {erts, app()} + | {escript, escript_file(), [escript()]} + | {app, app_name(), [app()]}. +-type config() :: {sys, [sys()]}. +-type option() :: {wx_debug, term()} | + {trap_exit, boolean()} | + config() | + {config, config() | file()}. +-type options() :: [option()]. +-type server_pid() :: pid(). +-type window_pid() :: pid(). +-type server() :: server_pid() | options(). +-type rel_file() :: term(). +-type script_file() :: term(). +-type reason() :: string(). +-type escript_arg() :: string(). +-type base_dir() :: dir(). +-type base_file() :: file(). +-type top_dir() :: file(). +-type top_file() :: file(). +-type target_spec() :: [target_spec()] + | {create_dir, base_dir(), [target_spec()]} + | {create_dir, base_dir(), top_dir(), [target_spec()]} + | {archive, + base_file(), + [archive_opt()], + [target_spec()]} + | {copy_file, base_file()} + | {copy_file, base_file(), top_file()} + | {write_file, base_file(), iolist()} + | {strip_beam_file, base_file()}. +-type target_dir() :: dir(). +-type incl_defaults() :: boolean(). +-type incl_derived() :: boolean(). +-type ets_tab() :: term(). +-type status() :: missing | ok. --record(rel_app, +-record(common, { - name, % atom() - app_type, % permanent | transient | temporary | load | none - incl_apps % [atom()] + sys_debug :: term(), + wx_debug :: term(), + trap_exit :: boolean(), + app_tab :: ets_tab(), + mod_tab :: ets_tab(), + mod_used_by_tab :: ets_tab() }). --record(app, - {%% Static info - name, % atom() - is_escript, % bool() - use_selected_vsn,% bool() | undefined - active_dir, % dir_name() - sorted_dirs, % [dir_name()] - vsn, % string() e.g. "4.7" - label, % string() e.g. "mnesia" or "mnesia-4.7" - info, % #app_info{} | undefined - mods, % [#mod{}] - - %% Static source cond - mod_cond, % all | app | ebin | derived | none | undefined - incl_cond, % include | exclude | derived | undefined - - %% Static target cond - debug_info, % keep | strip | undefined - app_file, % keep | strip | all | undefined - app_type, % permanent | transient | temporary | load | none - incl_app_filters, % [regexp()] - excl_app_filters, % [regexp()] - incl_archive_filters, % [regexp()] - excl_archive_filters, % [regexp()] - archive_opts, % [zip_create_opt()] - - %% Dynamic - status, % missing | ok - uses_mods, % [atom()] - used_by_mods, % [atom()] - uses_apps, % [atom()] - used_by_apps, % [atom()] - is_pre_included, % bool() - is_included % bool() - }). -record(mod, {%% Static - name, % atom() - app_name, % atom() - incl_cond, % include | exclude | derived | undefined - debug_info, % keep | strip | undefined - is_app_mod, % bool(), - is_ebin_mod, % bool(), - uses_mods, % [module()] - exists, % bool() + name :: mod_name(), + app_name :: app_name(), + incl_cond :: incl_cond() | undefined, + debug_info :: debug_info() | undefined, + is_app_mod :: boolean(), + is_ebin_mod :: boolean(), + uses_mods :: [mod_name()], + exists :: boolean(), %% Dynamic - status, % missing | ok - used_by_mods, % [atom()] - is_pre_included, % bool() | undefined - is_included % bool() | undefined + status :: status(), + used_by_mods :: [mod_name()], + is_pre_included :: boolean() | undefined, + is_included :: boolean() | undefined }). -%% app - Include all modules in app file -%% ebin - Include all modules on ebin directory -%% derived - Include only those modules that others are dependent on - -record(app_info, { description = "", @@ -145,8 +170,86 @@ start_phases = undefined }). +-record(app, + {%% Static info + name :: app_name(), + is_escript :: boolean(), + use_selected_vsn :: boolean() | undefined, + active_dir :: dir(), + sorted_dirs :: [dir()], + vsn :: app_vsn(), + label :: app_label(), + info :: #app_info{} | undefined, + mods :: [#mod{}], + + %% Static source cond + mod_cond :: mod_cond() | undefined, + incl_cond :: incl_cond() | undefined, + + %% Static target cond + debug_info :: debug_info() | undefined, + app_file :: app_file() | undefined, + app_type :: app_type(), + incl_app_filters :: incl_app_filters(), + excl_app_filters :: excl_app_filters(), + incl_archive_filters :: incl_archive_filters(), + excl_archive_filters :: excl_archive_filters(), + archive_opts :: [archive_opt()], + + %% Dynamic + status :: status(), + uses_mods :: [mod_name()], + used_by_mods :: [mod_name()], + uses_apps :: [app_name()], + used_by_apps :: [app_name()], + is_pre_included :: boolean(), + is_included :: boolean() + }). + +-record(rel_app, + { + name :: app_name(), + app_type :: app_type(), + incl_apps :: [incl_app()] + }). + +-record(rel, + { + name :: rel_name(), + vsn :: rel_vsn(), + rel_apps :: [#rel_app{}] + }). + +-record(sys, + { + %% Sources + root_dir :: dir(), + lib_dirs :: [dir()], + escripts :: [file()], + mod_cond :: mod_cond(), + incl_cond :: incl_cond(), + apps :: [#app{}], + + %% Target cond + boot_rel :: boot_rel(), + rels :: [#rel{}], + emu_name :: emu_name(), + profile :: profile(), + incl_sys_filters :: incl_sys_filters(), + excl_sys_filters :: excl_sys_filters(), + incl_app_filters :: incl_app_filters(), + excl_app_filters :: excl_app_filters(), + incl_archive_filters :: incl_archive_filters(), + excl_archive_filters :: excl_archive_filters(), + archive_opts :: [archive_opt()], + relocatable :: boolean(), + app_type :: app_type(), + app_file :: app_file(), + debug_info :: debug_info() + }). + -record(regexp, {source, compiled}). - + -define(ERR_IMAGE, 0). -define(WARN_IMAGE, 1). -define(QUEST_IMAGE, 2). @@ -170,7 +273,7 @@ -define(DEFAULT_DEBUG_INFO, keep). -define(DEFAULT_INCL_ARCHIVE_FILTERS, [".*"]). --define(DEFAULT_EXCL_ARCHIVE_FILTERS, ["^include$", "^priv$"]). +-define(DEFAULT_EXCL_ARCHIVE_FILTERS, ["^include\$", "^priv\$"]). -define(DEFAULT_ARCHIVE_OPTS, []). -define(DEFAULT_INCL_SYS_FILTERS, [".*"]). @@ -178,25 +281,27 @@ -define(DEFAULT_INCL_APP_FILTERS, [".*"]). -define(DEFAULT_EXCL_APP_FILTERS, []). --define(EMBEDDED_INCL_SYS_FILTERS, ["^bin", +-define(EMBEDDED_INCL_SYS_FILTERS, ["^bin", "^erts", "^lib", "^releases"]). --define(EMBEDDED_EXCL_SYS_FILTERS, ["^bin/(erlc|dialyzer|typer)(|\\.exe)$", - "^erts.*/bin/(erlc|dialyzer|typer)(|\\.exe)$", - "^erts.*/bin/.*(debug|pdb)"]). +-define(EMBEDDED_EXCL_SYS_FILTERS, + ["^bin/(erlc|dialyzer|typer)(|\\.exe)\$", + "^erts.*/bin/(erlc|dialyzer|typer)(|\\.exe)\$", + "^erts.*/bin/.*(debug|pdb)"]). -define(EMBEDDED_INCL_APP_FILTERS, ["^ebin", - "^priv", + "^priv", "^include"]). -define(EMBEDDED_EXCL_APP_FILTERS, []). --define(STANDALONE_INCL_SYS_FILTERS, ["^bin/(erl|epmd)(|\\.exe|\\.ini)$", - "^bin/start(|_clean).boot$", +-define(STANDALONE_INCL_SYS_FILTERS, ["^bin/(erl|epmd)(|\\.exe|\\.ini)\$", + "^bin/start(|_clean).boot\$", "^erts.*/bin", - "^lib$"]). --define(STANDALONE_EXCL_SYS_FILTERS, ["^erts.*/bin/(erlc|dialyzer|typer)(|\\.exe)$", - "^erts.*/bin/(start|escript|to_erl|run_erl)(|\\.exe)$", - "^erts.*/bin/.*(debug|pdb)"]). --define(STANDALONE_INCL_APP_FILTERS, ["^ebin", + "^lib\$"]). +-define(STANDALONE_EXCL_SYS_FILTERS, + ["^erts.*/bin/(erlc|dialyzer|typer)(|\\.exe)\$", + "^erts.*/bin/(start|escript|to_erl|run_erl)(|\\.exe)\$", + "^erts.*/bin/.*(debug|pdb)"]). +-define(STANDALONE_INCL_APP_FILTERS, ["^ebin", "^priv"]). --define(STANDALONE_EXCL_APP_FILTERS, ["^ebin/.*\\.appup$"]). +-define(STANDALONE_EXCL_APP_FILTERS, ["^ebin/.*\\.appup\$"]). |