[plt-scheme] port -> file/line/column ?

From: Kirill Lisovsky (lisovsky at acm.org)
Date: Mon Oct 7 17:18:01 EDT 2002

Hi Jim!

Thank you, it helps.
On Mon, 7 Oct 2002 Benderjg2 at aol.com wrote:
> > Is it possible to extract from a port some information about 
> > current position and (in case of file-stream port) about corresponding
> > file name?
> > 
> > In other words, I'm looking for some friends to 'file-position' which can 
> > return 
> > line, column and filename.
> After calling (port-count-lines! <port>)--following the opening of the port--
> then port-next-location will return a list of line number, column number, 
> and file pos.
1. Is it possible to turn lines-counting on for _every_ input port in a
program (short of redefinition of 'open-input-file' and friends) ?
I believe that the overhead will be low, in other Schemes input ports are 
always opened in this mode...

2. Any ideas about file name?

Best regards, 

Posted on the users mailing list.