Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #1636
| From | Nomen Nescio <nobody@dizum.com> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: Suggestions for a preprocessor |
| References | <jpvnnr$e2e$1@speranza.aioe.org> |
| Message-ID | <2fe8cfc5d188d76ad2c844d6eb2a536e@dizum.com> (permalink) |
| Date | 2012-05-28 16:46 +0200 |
| Organization | mail2news@dizum.com |
Rui Maciel <rui.maciel@gmail.com> wrote: > Fritz Wuehler wrote: > > > Rui Maciel <rui.maciel@gmail.com> wrote: > > > >> If you were given the task of generating a set of text files whose > >> different versions differed only in a set of numerical values, which tool > >> would you choose? > > > > diff? > > The objective is to generate a set of files with present different values > specified by a parameter. For example, let's assume we have this template: > > <example> > Line (0,0) (XX,YY) > </example> Oh, sorry. In that case m4 might actually work but it's ugly no matter what you do with it. awk is nice because it's more readable and is standard on most UNIX variants. After that I suppose any scripting language you like would do the job well. SNOBOL4 would be a great choice but it can be difficult to learn at first. After that you'll use it for everything. In SNOBOL4 everything is a string until you need it to be something else, like a number. Tcl would be another good choice. It's more work for almost anything than SNOBOL4 but it has the advantage of namespaces and it is easier to write and manage large scripting systems in Tcl. SNOBOL4 becomes difficult to use as a factor of program size. > And, based on this template, a user intended to define N different data > files, each one with different values for (XX, YY), with the values for XX > and YY being defined in terms of an arbitrary algebraic expression. > > > >> The first tool that jumped to my mind was the M4 preprocessor, but it > >> appears it doesn't handle algebraic operations that well. > > > > m4 doesn't seem to do anything well except edit sendmail.cnf files > > After a bit of digging, I also ended up with the idea that m4 is limited to > the point it is essentially useless. Someone correct me if I'm wrong, but > it appears m4 only supports algebraic operations on integers. If it doesn't > support floating point operations, or even decimal fractions, then it is > essentially irrelevant for any task which involves non-integer numberical > values. It's a macro language, it's designed for text replacement but not calculations. I think you can probably force it to do anything but it's not much higher level than brainf**k with a Lisp-like syntax.
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar
Suggestions for a preprocessor Rui Maciel <rui.maciel@gmail.com> - 2012-05-27 17:29 +0100
Re: Suggestions for a preprocessor Fritz Wuehler <fritz@spamexpire-201205.rodent.frell.theremailer.net> - 2012-05-28 02:16 +0200
Re: Suggestions for a preprocessor Rui Maciel <rui.maciel@gmail.com> - 2012-05-28 12:32 +0100
Re: Suggestions for a preprocessor "BartC" <bc@freeuk.com> - 2012-05-28 13:51 +0100
Re: Suggestions for a preprocessor Rui Maciel <rui.maciel@gmail.com> - 2012-05-28 16:19 +0100
Re: Suggestions for a preprocessor Rui Maciel <rui.maciel@gmail.com> - 2012-05-28 16:43 +0100
Re: Suggestions for a preprocessor "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-05-28 14:45 +0100
Re: Suggestions for a preprocessor Rui Maciel <rui.maciel@gmail.com> - 2012-05-28 16:21 +0100
Re: Suggestions for a preprocessor Patricia Shanahan <pats@acm.org> - 2012-05-28 16:33 -0700
Re: Suggestions for a preprocessor Nomen Nescio <nobody@dizum.com> - 2012-05-28 16:46 +0200
Re: Suggestions for a preprocessor Ian Collins <ian-news@hotmail.com> - 2012-05-29 07:50 +1200
csiph-web