www.digitalmars.com         C & C++   DMDScript  

D - Re: Preprocessor again

reply "Nic Tiger" <nictiger progtech.ru> writes:
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


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.
Jan 04 2003
parent reply "Walter" <walter digitalmars.com> writes:
"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.
Jan 05 2003
parent "Nic Tiger" <nictiger progtech.ru> writes:
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.
Jan 06 2003