[comp.sys.amiga.tech] Bugs in Lattice C 5.05

phil@adam.adelaide.edu.au (Phil Kernick) (10/31/90)

I have found the following bug in Lattice/SAS C 5.05 and wonder if it
is fixed in 5.10 or if someone can give me a workaround (can anybody
in SAS technical support hear me out there ????).

test.c
--
main()
{
  puts(FUBAR);
}
--
compile with the following line
> lc -dFUBAR="hello" test.c

and it all falls down with lc1 crashing and giving the error
Parameters after file name ignored.

It all fails because of the quotes in the -d option, so my question is
how do you use the -d option if the symbol has imbedded quotes
(and don't say add the line
#define FUBAR "hello"
to the top of the source because that is *not* what I want in this
application).

Thanks in advance,
Phil.

-- 
Phil Kernick                            EMail:  phil@adam.adelaide.edu.au
Departmental Engineer                   Phone:  +618 228 5914
Dept. of Psychology                     Fax:    +618 224 0464
University of Adelaide                  Mail:   GPO Box 498 Adelaide SA 5001

walker@unx.sas.com (Doug Walker) (11/16/90)

In article <phil.657332282@adam.adelaide.edu.au> phil@adam.adelaide.edu.au (Phil Kernick) writes:
>I have found the following bug in Lattice/SAS C 5.05 and wonder if it
>is fixed in 5.10 or if someone can give me a workaround (can anybody
>in SAS technical support hear me out there ????).

SAS Tech support does not support usenet, so they are not listening.  I might
be able to be of some help, however.  Please call them at (919)677-8000
or FAX them at (919)677-8123 if you need to talk to them.

>It all fails because of the quotes in the -d option, so my question is
>how do you use the -d option if the symbol has imbedded quotes

Apparently, you can't.  lc must put double-quotes around all the arguments
it passes to lc1;  these double-quotes interfere with yours.  There is no
way of escaping the double-quotes.

You CAN do this if you invoke lc1 yourself, without using lc.  Pass the
argument just like you listed it:

   lc1 -dFUBAR="hello" test

You will, of course, have to run lc2 on it individually as well.

Another way to do it is to use the stringization feature of the preprocessor:

/* In your source code: */
#define STRING(x) #x

then on the command line...

lc -dFUBAR=STRING(hello) test


  *****
=*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
 *|. o.| ||                                          1200/2400/9600 Dual
  | o  |//     For all you do, this bug's for you!
  ====== 
usenet: ...mcnc!rti!sas!walker   plink: dwalker  bix: djwalker 

mclaren (Gavin McLaren) (11/17/90)

In article <1990Nov15.184915.18887@unx.sas.com> walker@unx.sas.com (Doug Walker) writes:
>In article <phil.657332282@adam.adelaide.edu.au> phil@adam.adelaide.edu.au (Phil Kernick) writes:
>>It all fails because of the quotes in the -d option, so my question is
>>how do you use the -d option if the symbol has imbedded quotes
>
>Apparently, you can't.  lc must put double-quotes around all the arguments
>it passes to lc1;  these double-quotes interfere with yours.  There is no
>way of escaping the double-quotes.

Seems to me the original problem was that the CLI stripped the quotes, and
make the quoted part of the -d option a seperate argument (as it should).

My trusty AmigaDOS manual states that the way to escape a quote character is:

lc -ddebug=*"Hello*" ...

You should use this to put characters like / or + or " into filenames that
are interpreted by the CLI, too.  Although why would anyone want too?

--Gavin McLaren
...!uunet!van-bc!mdivax1!mclaren

sie@fulcrum.bt.co.uk (Simon Raybould) (11/21/90)

In article <1990Nov15.184915.18887@unx.sas.com> walker@unx.sas.com (Doug Walker) writes:
>lc -dFUBAR=STRING(hello) test

I thought that '-d' set the debugging level ?

Does the same option do both the debugging and the symbol definition, according
to whether it is followed by a number or s string ?



+-=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
|   British Telecom Fulcrum  | name : Simon John Raybould   {^.^}   |
|   Fordrough Lane           | path : sie@fulcrum.bt.co.uk   \~/    |
|   Birmingham               +-----------+--------------------------|
|   B9 5LD                   |   //      | AMIGA B2000              |
|   ENGLAND                  | \X/AMIGA  | Lattice C V5.05          |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-+