Csound Csound-dev Csound-tekno Search About

Re: macros

Date1998-04-21 12:22
Fromjpff@maths.bath.ac.uk
SubjectRe: macros
Message written at 20 Apr 1998 22:47:13 +0100
--- Copy of mail to nicb@axnet.it ---
In-reply-to: 
	(message from Nicola Bernardini on Sun, 19 Apr 1998 22:56:32 +0200
	(MET DST))
References:  

>>>>> "Nicola" == Nicola Bernardini  writes:


 Nicola> why could'nt we use the cpp pre-processor? It's already there,
 Nicola> it works well, and it could be spawned by csound itself before
 Nicola> parsing... (furthermore, it's available on all platforms, source code
 Nicola> is available so it could reasonably be modified to add csound-specific
 Nicola> features if necessary, etc. etc. etc.). I did'nt dare say this before,
 Nicola> but since we're evidently going in that direction...

I considered using CPP, and indeed I started doing it like that 18
months ago.  There is however a problem.  CPP does not exist on all
machines.  One of the features of Csound which I find attractive is
that it can be run by any musician with one any of a number of machine
types, and it is complete.  To follow that model we would need to
distribute a binary of CPP.  I failed to find a public domain one.  I
looked at mining the preprocessor from my company's C compiler, and
that is frightening.  CPP is actually excessively complex, and if we
used it people could assume that it really was CPP as defined in the
ANSI C document (although it is or was ambiguous).  

For this reason I rather reluctantly wrote teh system of macros I
did.  I cheated all over.  By using # to separate arguments for
example I do not need to tokenise, at teh loss of nested calls.

If any of you want to write a portable, non encumbered, CPP then I
would be pleased to use it.  I can of course use CPP any way as I have
some version of it on any machine I use seriously (ie not MAC...)

So if you want to do it, do it.

==John

Date1998-04-21 15:42
FromNicola Bernardini
SubjectRe: macros
On Tue, 21 Apr 1998 jpff@maths.bath.ac.uk wrote:

[snip]
> I considered using CPP, and indeed I started doing it like that 18
> months ago.  There is however a problem.  CPP does not exist on all
> machines.  One of the features of Csound which I find attractive is
> that it can be run by any musician with one any of a number of machine
> types, and it is complete.  To follow that model we would need to
> distribute a binary of CPP.  I failed to find a public domain one.  I
> looked at mining the preprocessor from my company's C compiler, and
> that is frightening.  CPP is actually excessively complex, and if we
> used it people could assume that it really was CPP as defined in the
> ANSI C document (although it is or was ambiguous).  
> 
> For this reason I rather reluctantly wrote teh system of macros I
> did.  I cheated all over.  By using # to separate arguments for
> example I do not need to tokenise, at teh loss of nested calls.
> 
> If any of you want to write a portable, non encumbered, CPP then I
> would be pleased to use it.  I can of course use CPP any way as I have
> some version of it on any machine I use seriously (ie not MAC...)

I think I remember there was once a very small and simple cpp on
comp.sources.unix or alt.sources or something like that. I found some
trace of it in article 1337 of alt.sources - but I only found the index
and still have'nt found the article itself. Besides, I think we should
be careful because even if I think that popen()/pclose() is POSIX, this
does not mean it is implemented all over. So, here's another idea:

if your macro system could act as a simple subset of cpp, then it would
be easy to produce alternative code for people with cpp and popen()/pclose()
just by ifdeffing one or the other (as for the graphics libraries). So
this would solve the problem altogether. True, the people with cpp would
have more possibilities, but then again, people with nice graphic interfaces
look at nicer graphics, don't they?

> 
> So if you want to do it, do it.

thanks for replying jpff, I know your machines are having problems so
thank you very much for taking the time... I'll see if I can come up
with a solution of some sort and then I'll propose it.

Nicola
------------------------------------------------------------------------
Nicola Bernardini
E-mail: nicb@axnet.it
 
Re graphics: A picture is worth 10K words -- but only those to describe
the picture.  Hardly any sets of 10K words can be adequately described
with pictures.