Просмотр исходного кода

thank you all. problem is fixed by removing code :-) fix #47

Namdak Tonpa 9 лет назад
Родитель
Сommit
1a61e13b96
4 измененных файлов с 8 добавлено и 21 удалено
  1. 1 1
      include/mad.hrl
  2. BIN
      mad
  3. 2 2
      src/package/mad_escript.erl
  4. 5 18
      src/provision/mad_repl.erl

+ 1 - 1
include/mad.hrl

@@ -1 +1 @@
--define(VERSION,"a0f684").
+-define(VERSION,"f2dfbc").


+ 2 - 2
src/package/mad_escript.erl

@@ -5,9 +5,9 @@
 main(N) ->
     App = filename:basename(case N of [] -> mad_utils:cwd(); E -> E end),
     mad_resolve:main([]),
-    EmuArgs = "-noshell -noinput +pc unicode",
+    EmuArgs = "+pc unicode",
     Files = static() ++ beams(fun filename:basename/1, fun read_file/1) ++ overlay(),
-   [ io:format("Escript: ~ts~n",[File]) || { File, _ } <- Files ],
+%   [ io:format("Escript: ~ts~n",[File]) || { File, _ } <- Files ],
     escript:create(App,[shebang,{comment,""},{emu_args,EmuArgs},{archive,Files,[memory]}]),
     file:change_mode(App, 8#764),
     {ok,App}.

+ 5 - 18
src/provision/mad_repl.erl

@@ -83,11 +83,10 @@ sh(Params) ->
     load(),
     Config = load_config(),
     Driver = mad_utils:get_value(shell_driver,_Config,user_drv),
-    pre(Driver),
+    repl_intro(),
     case os:type() of
-         {win32,nt} -> shell:start();
+         {win32,nt} -> os:cmd("chcp 65001"), shell:start();
                   _ -> Driver:start() end,
-    post(Driver),
     load_apps(Params,Config,[]),
     case Params of
         ["applist"] -> skip;
@@ -135,19 +134,7 @@ parse(String) ->
     {value,Value,_Bs} = erl_eval:exprs(AbsForm, erl_eval:new_bindings()),
     Value.
 
-% we need to call printing before starting driver for user_drv
-% but for start_kjell we should call after, that's why we have pre and post here.
-
-pre(start_kjell) -> [];
-pre(user_drv) -> unregister(user), appconfig(user_drv);
-pre(Driver) -> appconfig(Driver).
-post(start_kjell) -> appconfig(start_kjell);
-post(_) -> [].
-print(Label,Value,start_kjell) -> io:requests([{put_chars,Label ++ normalize(length(Label)+1,Value) ++ "\n\r"}]);
-print(Label,Value,_) -> mad:info("~s~p~n",[Label,Value]).
-normalize(Padding,V) -> [ case X of 10 -> [13,10]; E -> E end || X <- lists:flatten(pp(Padding,V) )].
-pp(Padding,V) -> k_io_lib_pretty:print(V, Padding, 80, 30, 60, fun(_,_)-> no end).
-appconfig(Driver) ->
-    print("Configuration: ", load_config(), Driver),
-    print("Applications: ",  applist(),     Driver).
+repl_intro() ->
+    io:format("Configuration: ~p~n", [load_config()]),
+    io:format("Applications:  ~p~n", [applist()]).