Thread overview
Re: Preprocessor again
Jan 04, 2003
Nic Tiger
Jan 06, 2003
Walter
Jan 06, 2003
Nic Tiger
January 04, 2003
Hi Walter,

Since D doesn't seem to have any preprocessing facility (like as C/C++) and the reasons are well known, I think it will be handy to reserve some king of directives which will change the line numeration in sources.

The purpose is simple. If I write my own preprocessor, I surely can setup compiling process for 2 stages: preprocessing and compiling. But after preprocessing I will have temporary source file with line numeration that doesn't correspond to original source file. In error messages I want compiler to report the original line #, not the line # of temporary file.

The solution is to add directive like '#line nnn' with C'ish meaning. Then during preprocessing I can place this directives in order to save the original line order.

What do you think?

Nic Tiger.


January 06, 2003
"Nic Tiger" <nictiger@progtech.ru> wrote in message news:av7821$qte$1@digitaldaemon.com...
> The solution is to add directive like '#line nnn' with C'ish meaning. Then during preprocessing I can place this directives in order to save the original line order.
>
> What do you think?

Aiieeeeeeee <g>

I understand the problem. Solutions I've seen in other places for the same problem is to drive the dmd compiler from a shell (you're already probably doing that). The shell remembers the mapping of processed line numbers to original source lines. The shell intercepts the DMD error messages and remaps the line numbers.


January 06, 2003
Ok, it's doable.

"Walter" <walter@digitalmars.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:avb8hu$2vil$1@digitaldaemon.com...
>
> "Nic Tiger" <nictiger@progtech.ru> wrote in message news:av7821$qte$1@digitaldaemon.com...
> > The solution is to add directive like '#line nnn' with C'ish meaning. Then during preprocessing I can place this directives in order to save
the
> > original line order.
> >
> > What do you think?
>
> Aiieeeeeeee <g>
>
> I understand the problem. Solutions I've seen in other places for the same problem is to drive the dmd compiler from a shell (you're already probably doing that). The shell remembers the mapping of processed line numbers to original source lines. The shell intercepts the DMD error messages and remaps the line numbers.
>
>