comp.lang.ada
 help / color / mirror / Atom feed
From: hebisch@math.uni.wroc.pl (Waldek Hebisch)
Subject: Re: sed and perl - yuck [Was Re: Preprocessor functionality equivalent ideas needed]
Date: 16 Dec 2003 00:40:42 GMT
Date: 2003-12-16T00:40:42+00:00	[thread overview]
Message-ID: <brlkaa$h1h$1@panorama.wcss.wroc.pl> (raw)
In-Reply-To: 1255206.8rsULcRV6F@linux1.krischik.com

Martin Krischik (krischik@users.sourceforge.net) wrote:
: Ludovic Brenta wrote:

: > Another approach could be to simulate a preprocessor with sed or perl
: > scripts.

: Did that, hated it and wrote AdaCL. If you rather use Ada then perl and find
: find sed cumbersome you should look at AdaCL.

: If you disagree: Write a sed line which inserst "OS." bevore every
: CD_Recorder -  but only if it is not allready there.

Well, if you have unused chars (say ';' and '#') the task is easy:

s/CD_Recorder/;CD_Recorder/g
s/OS\.;/OS.#/
s/;CD_Recorder/OS.CD_Recorder/g
s/[;#]//g

If all chars are used one have to quote first:

s/./:&/g
s/:C:D:_:R:e:c:o:r:d:e:r/;::C:D:_:R:e:c:o:r:d:e:r/g
s/:O:S:\.;:/:O:S:.;#/g
s/;::C:D:_:R:e:c:o:r:d:e:r/:O:S:.:C:D:_:R:e:c:o:r:d:e:r/g
s/;#:/:/g
s/.\(.\)/\1/g

I have not put them on sigle line for readability. The above is 
slightly off-topic, but I think it ilustrates nicely that a sequence
of simple steps can give result looking quite different then a single
step. In that spirit Ada discourages preprocessors (since complexity
grows quite a lot).

--
                              Waldek Hebisch
hebisch@math.uni.wroc.pl 



  reply	other threads:[~2003-12-16  0:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-10 20:04 Preprocessor functionality equivalent ideas needed Greg Milford
2003-12-10 21:41 ` Ludovic Brenta
2003-12-11 17:12   ` sed and perl - yuck [Was Re: Preprocessor functionality equivalent ideas needed] Martin Krischik
2003-12-16  0:40     ` Waldek Hebisch [this message]
2003-12-16 20:52       ` Martin Krischik
2003-12-10 22:29 ` Preprocessor functionality equivalent ideas needed Georg Bauhaus
2003-12-12  5:52   ` Simon Wright
2003-12-11  1:07 ` Jeffrey Carter
2003-12-11 13:34   ` Marin David Condic
2003-12-11 17:49     ` Jeffrey Carter
2003-12-11  5:39 ` Steve
2003-12-11 16:59 ` Martin Krischik
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox