[m-rev.] Add a listing facility to mdb
Ian MacLarty
maclarty at cs.mu.OZ.AU
Sat Oct 22 13:48:06 AEST 2005
On Fri, 21 Oct 2005, Ralph Becket wrote:
> Ian MacLarty, Thursday, 13 October 2005:
> >
> > You need to add some tests.
> >
>
> I'll do that in a bit.
>
> > > trace/mercury_trace_internal.c:
> > > Implement the C part of the `list', `push_list_dir', and `pop_list_dir'
> > > commands
> >
> > It would be more consistent with the current mdb interface to add a new
> > configuration parameter that can be set with the `set' command. The format
> > options and the xml browser command and temporary filename are all set with the
> > `set' command, so why not the search path?
> > For example:
> >
> > set search_path '.;../browser;../compiler;../mdbcomp'
>
> I've added `set list_path dir1 dir2 ...'
>
Cool.
> >
> > I'm not convinced that caching all the newline positions is a good idea.
> > It may not require a lot of memory, but it does require some, and it also
> > increases the complexity of the code which will make it harder to maintain.
> > Is there really any noticable speedup to be had from caching the line numbers?
>
> There is a more serious problem here: debugging grades don't support
> tail recursion, so either method in Mercury (scanning once for newlines
> vs. every time a listing is requested) can exhaust the stack. This
> happens when trying to look at, say, io.m in the library.
>
All the code in the browser directory is not traced, even in debug grades,
so that shouldn't be a problem.
> The solution I've come up with is to write that part in C and not cache
> the line number offsets. (See the diff).
>
That's fine.
> +
> +
> +:- pragma foreign_type("C", c_file_ptr, "FILE *", [can_pass_as_mercury_type]).
There's no need to define a new type, you can use io.output_stream.
The diff looks good otherwise.
Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list