| Author |
Message |
< Erlang ~ Esense in Xemacs |
| Ludvig |
Posted: Fri Jul 21, 2006 9:41 am |
|
|
|
User
Joined: 20 Jul 2006
Posts: 38
Location: London
|
Hi!
I'm trying to get Esense 1.11 to woork with my Xemacs installation under Suse 10.1 with R11B verison of Erlang.
But when I'm trying to run the esense.sh shell script to build my libraries I get this error:
Code:
ludvig@Blackbox:~/esense-1.11> ./esense.sh /usr/local/lib/erlang/lib/
/usr/local/lib/erlang/lib/edoc-0.6.9/src/edoc_doclet.erl, function run/2: at line 40: file not found: edoc_doclet.hrl
Generating index for module edoc_doclet
/usr/local/lib/erlang/lib/edoc-0.6.9/src/edoc_types.erl, function is_predefined/1: at line 33: file not found: edoc_types.hrl
Generating index for module edoc_types
{"init terminating in do_boot",{{case_clause,{'EXIT',{{badrecord,attribute},[{erl_syntax,attribute_name,1},
{esense,'-parse_erlang_record2/2-fun-0-',2},{lists,foldl,3},{esense,parse_erlang_record,2},
{esense,parse_erlang,2},{lists,foldl,3},{esense,parse_file,1},{lists,foreach,2}]}}},[{esense,parse_file,1},
{lists,foreach,2},{esense,parse_dir,1},{lists,foreach,2},{esense,parse_dir,1},{lists,foreach,2},
{esense,parse_dir,1},{esense,'-start/0-fun-0-',1}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
Any body now what the problem is?
I have added in my .erlang file:
Code:
code:add_path("/usr/local/lib/yaws/ebin").
But without any luck...Anyone got a clue??
Admin Edit:
Fixed the long quotes. |
Last edited by Ludvig on Wed Aug 02, 2006 9:44 am; edited 1 time in total |
|
| Back to top |
|
| tpatro |
Posted: Thu Jul 27, 2006 5:55 pm |
|
|
|
User
Joined: 27 Jul 2006
Posts: 20
|
Hi Ludvig,
I'm the author of ESense. ESense wasn't tested on OTP R11B at all. I've only used with OTP R10.
ESense was one of my first Erlang programs, therefore it still has some beginner errors in it.
I think the cause of this crash
Code: {"init terminating in
do_boot",{{case_clause,{'EXIT',{{badrecord,attribute},[{erl_syntax,attribute_name,1},{esens
is that I matched the records returned by erl_syntax with tuples instead of using records or accessor functions and the relevant record definitions must have changed between R10 and R11.
One should find the problematic parts of esense.erl and rewrite them correctly. I don't expect it to be complicated, but I don't have any time to work on ESense (that's why there wasn't a new release since January), so the one fixing the bug won't be me.
If you or someone else fixes the problem and sends me a nice, clean unified diff then I'll add the fix to the distribution.
From now on I will monitor this forum via RSS (can I monitor this specific topic only?), so you can post further questions here. |
|
|
| Back to top |
|
| Ludvig |
Posted: Fri Jul 28, 2006 8:19 am |
|
|
|
User
Joined: 20 Jul 2006
Posts: 38
Location: London
|
You can subscribe to this topic by email. You can't have the RSS feed to point to this exact topic. But you can have it on the FAQ forum here.
http://forum.trapexit.org/rss.php?f=18
I will see if I have the time to fix the problems. Otherwise maybe somebody else will have the time to do it?? |
|
|
| Back to top |
|
| tpatro |
Posted: Fri Jul 28, 2006 11:46 am |
|
|
|
User
Joined: 27 Jul 2006
Posts: 20
|
Okay, I devoted some time to the problem and came up with this solution:
Code:
--- esense.erl 9 Jun 2006 09:11:28 -0000 1.5
+++ esense.erl 28 Jul 2006 11:32:03 -0000
@@ -451,7 +451,15 @@
Record = lists:foldl(
fun (Arg, InnerRecord) ->
- parse_erlang_record2(Arg, InnerRecord)
+ case erl_syntax:type(Arg) of
+ atom ->
+ InnerRecord
+ #record{name = erl_syntax:atom_name(Arg)};
+ tuple ->
+ parse_erlang_record_fields(
+ erl_syntax:tuple_elements(Arg),
+ InnerRecord)
+ end
end,
#record{},
erl_syntax:attribute_arguments(Node)),
@@ -459,13 +467,11 @@
Record#record{line = erl_syntax:get_pos(Node),
doc = Doc}.
-parse_erlang_record2({tree, atom, {attr, _, _, _}, _} = RecordName, Record) ->
- Record#record{name = erl_syntax:atom_name(RecordName)};
-parse_erlang_record2({tree, tuple, _, Fields}, Record) ->
+parse_erlang_record_fields(Fields, Record) ->
lists:foldl(
fun (Field, InnerRecord) ->
Name = erl_syntax:atom_name(
- erl_syntax:attribute_name(Field)),
+ erl_syntax:record_field_name(Field)),
case erl_syntax:get_postcomments(Field) of
[] ->
Let me know if this fixes the problem. |
|
|
| Back to top |
|
| Ludvig |
Posted: Fri Jul 28, 2006 12:58 pm |
|
|
|
User
Joined: 20 Jul 2006
Posts: 38
Location: London
|
O thank you!
I have now patched the files.
It looked great but then it crached.
Here is the error output:
Generating index for module io_lib_fread
{"init terminating in do_boot",{{case_clause,{'EXIT',{{case_clause,macro},[{esense,'-parse_erlang_record/2-fun-0-',2},{lists,foldl,3},{esense,parse_erlang_record,2},
{esense,parse_erlang,2},{lists,foldl,3},{esense,parse_file,1},
{lists,foreach,2},{esense,parse_dir,1}]}}},[{esense,parse_file,1},{lists,foreach,2},{esense,parse_dir,1},{lists,foreach,2},{esense,parse_dir,1},
{lists,foreach,2},{esense,parse_dir,1},{esense,'-start/0-fun-0-',1}]}}
Crash dump was written to: erl_crash.dump
Some other things, don't know if they are errors or so:
/usr/local/lib/erlang/lib/edoc-0.6.9/src/edoc_doclet.erl, function run/2: at line 40: file not found: edoc_doclet.hrl
Generating index for module edoc_doclet
/usr/local/lib/erlang/lib/edoc-0.6.9/src/edoc_types.erl, function is_predefined/1: at line 33: file not found: edoc_types.hrl
One more error but this error it passed:
Generating index for module cerl_to_icode
/usr/local/lib/erlang/lib/hipe-3.5.5/cerl/cerl_binary_pattern_match.erl, function read_seg_size/1: at line 43: unknown error parsing type definition: {44,
edoc_parser,
["syntax error before: ","these"]}.
Generating index for module cerl_binary_pattern_match
I'm really glad that you looked in to it. Really missing this featuer in emacs.
Thanks |
Last edited by Ludvig on Wed Aug 02, 2006 9:44 am; edited 1 time in total |
|
| Back to top |
|
| tpatro |
Posted: Fri Jul 28, 2006 2:49 pm |
|
|
|
User
Joined: 27 Jul 2006
Posts: 20
|
I may take a look at the other errors next week, but don't hold your breath...
However, there is a much simpler solution. ESense works fine with OTP R10. Install R10 too on your system, compile ESense with it and hack the esense.sh or esense.bat file to make sure esense uses OTP R10 instead of R11.
You can use this configuration until ESense is ported properly to OTP R11. |
|
|
| Back to top |
|
| Ludvig |
Posted: Fri Jul 28, 2006 3:19 pm |
|
|
|
User
Joined: 20 Jul 2006
Posts: 38
Location: London
|
| I will try it out next week. Thanks for trying anyway |
|
|
| Back to top |
|
| Ludvig |
Posted: Wed Aug 02, 2006 9:00 am |
|
|
|
User
Joined: 20 Jul 2006
Posts: 38
Location: London
|
I have now checked litlle on the code to find out the problem.
As I can see it the problem is this:
This function:
Code:
parse_erlang_record(Node, PrevComments) ->
case erl_syntax:get_precomments(Node) of
[] ->
case PrevComments of
"" ->
Doc = undefined;
_ ->
Doc = PrevComments
end;
[Comment] ->
Doc = format_comments(Comment)
end,
Record = lists:foldl(
fun (Arg, InnerRecord) ->
case erl_syntax:type(Arg) of
atom ->
InnerRecord
#record{name = erl_syntax:atom_name(Arg)};
tuple ->
parse_erlang_record_fields(
erl_syntax:tuple_elements(Arg),
InnerRecord)
end
end,
#record{},
erl_syntax:attribute_arguments(Node)),
Record#record{line = erl_syntax:get_pos(Node),
doc = Doc}.
Dos not only get atoms and tuple in the case but macros.
And this come from things like this:
File: dets_v9.erl
Code:
-record(?HASH_PARMS, {
file_format_version,
bchunk_format_version,
file, type, keypos, hash_method,
n,m,next,
min,max,
no_objects,no_keys,
no_colls % [{LogSz,NoColls}], NoColls >= 0
}).
Where you have records with macro name.
Don't know if this will help you anything
----------------------------------
I have no fixed this problem... No I have another one... |
|
|
| Back to top |
|
| Ludvig |
Posted: Wed Aug 02, 2006 9:58 am |
|
|
|
User
Joined: 20 Jul 2006
Posts: 38
Location: London
|
Wohii...I got through the hole process.
Let's se if it works.
----------------
It workes...Yeyey
But I have no idea on how one creates a patch.
This what I have done anyway:
Function parse_erlang(Node, {Exports, PrevComments, Content})
1. I swaped places between "define" and "record"
2. I changed parse_erlang_record(Node, PrevComments, Content), to take in an extra Arg. Content.
Code:
"define" ->
Macro = parse_erlang_macro(Node),
Macros = Content#content.macros ++ [Macro],
{Exports, [], Content#content{macros = Macros}};
"record" ->
Record = parse_erlang_record(Node, PrevComments, Content),
Records = Content#content.records ++ [Record],
{Exports, [], Content#content{records = Records}};
Function: parse_erlang_record(Node, PrevComments, Content)
1. I first added Content to the function
2. I added an case macro which retrives the macro name from the Arg.
Then I find the value of this macro in the Content#content.macros that has
defined before (because I swaped them).
Code:
case erl_syntax:type(Arg) of
atom ->
InnerRecord
#record{name = erl_syntax:atom_name(Arg)};
tuple ->
parse_erlang_record_fields(
erl_syntax:tuple_elements(Arg),
InnerRecord);
macro ->
Macro = erl_syntax:variable_literal(erl_syntax:macro_name(Arg)),
Li = lists:filter(fun(Mac) ->
Mac#macro.name == Macro
end,Content#content.macros),
case Li of
[] ->
Name = undefined;
_ ->
Mc = hd(Li),
Name = Mc#macro.value
end,
InnerRecord
#record{name = Name}
end
Function: parse_erlang_with_edoc(Source, Comments, Filename)
1. I added a new case that takes other. Because I saw that the function allso could send back syntax_error. Haven't given it any time why. Mabye you know?
Code:
case catch edoc_extract:source(ParseTree, Filename,
edoc_lib:get_doc_env([{def, {'vsn', "current"}}]),
[{def, {'vsn', "current"}}]) of
{'EXIT', _Reason} ->
undefined;
{_Module, Xml} ->
case catch esense_edoc_layout:layout_module(Xml) of
{ok, EdocInfo} ->
EdocInfo;
_Other ->
undefined
end;
Problem ->
io:format("Problem: ~p~n",[Problem]),
undefined
end
--------------------
Now when I think about it I do not now if it nesscary to do the first two function changes more than to add the macro case where one just takes out the name of the macro and puts as a name. Do one whant to change the macro name to the macro value? Dose it really matter at all??? |
|
|
| Back to top |
|
| Ludvig |
Posted: Wed Aug 02, 2006 10:37 am |
|
|
|
User
Joined: 20 Jul 2006
Posts: 38
Location: London
|
Multiposting... sorry
Is there anyway to get completion on the module you are currently working on? |
|
|
| Back to top |
|
| tpatro |
Posted: Wed Aug 02, 2006 10:49 am |
|
|
|
User
Joined: 27 Jul 2006
Posts: 20
|
Good work! I'll take a look at your changes when I have the time (not soon ).
In order for completion to work on the current module the "erlang" module mustbe indexed. If it is then everything should work fine. |
|
|
| Back to top |
|
| Ludvig |
Posted: Wed Aug 02, 2006 11:02 am |
|
|
|
User
Joined: 20 Jul 2006
Posts: 38
Location: London
|
I have gotten the internal completion to work. But not on all files.
Get this problem on a module:
Assertion failed: (= (char-after) ?
When I look at the esense window it complains about the edoc. Is it that sensitive? |
|
|
| Back to top |
|
| tpatro |
Posted: Wed Aug 02, 2006 11:10 am |
|
|
|
User
Joined: 27 Jul 2006
Posts: 20
|
It seems doc in R11 prints out messages to the standard output:
Code: Generating index for module cerl_to_icode
/usr/local/lib/erlang/lib/hipe-3.5.5/cerl/cerl_binary_pattern_match.erl, function read_seg_size/1: at line 43: unknown error parsing type definition: {44,
edoc_parser,
["syntax error before: ","these"]}.
When you use esense it loads module info on-the-fly in the background (*esense* buffer). Unfortunately these unexpected messages from edoc end up in the output which confuses esense when it tries parsing the module.
Yes, it's that sensitive, since it does not expect garbage in the *esense* buffer.
I don't know if this new edoc behavior is configurable, if the messages can be supressed somehow. |
|
|
| Back to top |
|
| Ludvig |
Posted: Wed Aug 02, 2006 1:41 pm |
|
|
|
User
Joined: 20 Jul 2006
Posts: 38
Location: London
|
Hmm, I will see if I can find out anything about that problem.
Have another one now. When I run the esense.sh on the mneisa libray everything seems to work fine. But when I try to run F1 on
mnesia:
I get "Wrong type argument: char-or-string-p, nil".
Is this an error that you generate? Or what can the problem be? I've looked in the *esense* tab and there is no error message in it that I could see. Do you know what I should look for? |
|
|
| Back to top |
|
| tpatro |
Posted: Wed Aug 02, 2006 2:17 pm |
|
|
|
User
Joined: 27 Jul 2006
Posts: 20
|
What do you mean by pressing F1 "on mnesia"?
Is it only the "mnesia" atom itself? Or is it some function call mnesia:some_func? If you're more specific it's more likely I can find the problem.
Also, reproduce the problem with debugging turned on:
M-x toggle-debug-on-error
(I hope it's the same in XEmacs. I'm a Gnu Emacs user.)
And paste the debug output here. |
|
|
| Back to top |
|
|
|
All times are GMT
Page 1 of 3
Goto page 1, 2, 3 Next
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|