[m-rev.] for review: source-linking for mdb

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Oct 29 19:45:54 AEDT 2001


On 29-Oct-2001, Mark Brown <dougl at cs.mu.OZ.AU> wrote:
> On 29-Oct-2001, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> > Mark Brown, Friday, 26 October 2001:
> > > 
> > > +	/*
> > > +	** We generate a unique name by appending a number to a fixed
> > > +	** string.  The number used is determined by trying all numbers
> > > +	** in sequence until one is found that is not being used.
> > > +	**
> > > +	** XXX this is quite a slow way of doing things, and there is
> > > +	** also a race condition, but it is difficult to see a better way.
> > > +	** We should let the server pick a unique name for itself, but
> > > +	** how would you communicate this name back to this process?
> > > +	*/
> > 
> > <hostname>-<mdb process id> should be unique.
> 
> I considered this, but I wasn't sure if there is a portable way of
> getting the hostname and pid.  Can anyone tell me if it is ok to use
> gethostname() and getpid()?

Well, this code is already rather X and Unix-specific.
Quite a bit of it won't work on non-Unix systems.

It's not OK to use gethostname() and getpid() without checking
that they exist, since that would cause the Mercury runtime to
not compile on systems that don't have them.  But it would be OK
to use them conditionally, based on the result of an autoconf test
(`AC_HAVE_FUNCS(gethostname getpid)'), and to just report an error
message at runtime if these functions don't exist.

> > One idea that occurs to me is that we could split the vim window
> > in two, with the upper window showing the caller and the lower
> > window showing the callee.
> > 
> > This can be arranged as follows.  Initialize the server and send
> > 
> > 	--remote +<start source line no.> <source file>
> > 	--remote-send 'z.'		# Centre on source line
> > 	--remote-send '^Ws'		# Split the window
> > 	--remote-send '^Wb'		# Ensure cursor is in lower window
> > 
> > thereafter send
> > 
> > 	--remote-send '^Wx'		# Swap upper and lower windows
> > 	--remote-send '^Wb'		# Ensure cursor is in lower window
> > 	--remote +<callee source line no.> <callee source file>
> > 	--remote-send 'z.'		# Centre on source line
> > 
> > Consecutive remote-sends can be condensed into one.
> 
> That sounds like a great idea.  Do you mind if I leave this new feature
> to a subsequent change, though?

I think that's a good idea.

Personally I think I will probably prefer not to use the split-screen
approach, so I'd like this feature to be disable-able.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  | "... it seems to me that 15 years of
The University of Melbourne         | email is plenty for one lifetime."
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- Prof. Donald E. Knuth
--------------------------------------------------------------------------
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