Re: [Zope] Backslash as line continuation in C (Unix)

2000-09-13 Thread J M Cerqueira Esteves

On Tue, Sep 12, 2000 at 09:45:53PM -0700, Hung Jung Lu wrote:

 I am trying to build a third-party utility in Linux. I ran into troubles in 
 the compilation process because of the usage of backslash \ as line 
 continuation. (This is used in #def preprocessor macro statements.) When I 
 remove the backslashes and join the lines, it compiles fine. (I know 
 backslashes are fine in Windows Visual C++.)

Do the lines really END with a backslash?  There should be no problems
with standard C constructs, but for the backslash to work as expected it
really must be the last character in the line; there must be no white
space characters after it.  If your files are properly processed by some
Windows compiler and have problems under Linux, I can think of two
explanations:

Either the Windows compiler is being "tolerant" with improper white
space after the "\"...

Or your source files get white space after the "\" only when transported
to Linux; this may happen if under Linux the lines of your source files
still end with CR-LF (carriage return, line feed) as they do in Windows, 
instead of only LF (the expected end of line character in Unix).  

For all the other lines, perhaps the compiler doesn't care about the
extra CRs (they just count as white space), but they may become critical for
line continuation: where you are expecting a line to end with "\", your
Linux compiler may in fact see

   \ CR LF [the last (pre-LF) line character is CR, not "\" as expected]

instead of the proper sequence
   
   \ LF[the last (pre-LF) line character is "\", marking continuation]

If you have in Linux a small program called "fromdos", try to convert
your source files with it; the same conversion of line endings can
also be easily made with "tr", for instance.

-- 
 jmce: +351 919838775 ~ http://artenumerica.com/ ~ http://artenumerica.org/

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Backslash as line continuation in C (Unix)

2000-09-13 Thread Hung Jung Lu

Or your source files get white space after the "\" only when transported
to Linux; this may happen if under Linux the lines of your source files
still end with CR-LF (carriage return, line feed) as they do in Windows,
instead of only LF (the expected end of line character in Unix).

Yeap yeap, this is exactly the problem. :) I have written a small Python 
program and got rid of the CR characters. The problem must have happened 
when the original author FTP'ed the files in binary mode from Windows onto a 
Unix machine.

Thanks to everyone that have helped!

Hung Jung

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Backslash as line continuation in C (Unix)

2000-09-13 Thread Dieter Maurer

Hung Jung Lu writes:
  ... I ran into troubles in 
  the compilation process because of the usage of backslash \ as line 
  continuation. (This is used in #def preprocessor macro statements.) When I 
  remove the backslashes and join the lines, it compiles fine
  
  Does anyone know any other better solution than go into the code and 
  explicitly remove the backslashes? Is there any gcc option that recognizes 
  backslashes are line-joining characters? Or is there another character used 
  in gcc for joining lines? Any other suggestions?
Backslashes *ARE* line-joining characters for gcc -- without
any options!

I expect, that your backslashes are not immediately followed by
"\n" (not "\r\n"!). Then, they would not be "line joining"!
This very easily happens, if you transfer a Windows source
onto a Unix system.

I do not know, which editor you are using under Linux.
If you use "vim", then you would not see the "\r" preceeding
the "\n" but you would see a "textmode" in the status
line. Use ":set notextmode" and then write the file back.
This would remove the "\r".
You may use the "tr" utility, too, for the "\r" removal,
once you determined that this indeed is the problem.



Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] Backslash as line continuation in C (Unix)

2000-09-12 Thread Hung Jung Lu

Hi,

This is a Unix C question. But since I am doing something that ultimately 
results in a Zope product, I might as well ask the question here. :)

I am trying to build a third-party utility in Linux. I ran into troubles in 
the compilation process because of the usage of backslash \ as line 
continuation. (This is used in #def preprocessor macro statements.) When I 
remove the backslashes and join the lines, it compiles fine. (I know 
backslashes are fine in Windows Visual C++.)

Does anyone know any other better solution than go into the code and 
explicitly remove the backslashes? Is there any gcc option that recognizes 
backslashes are line-joining characters? Or is there another character used 
in gcc for joining lines? Any other suggestions?

regards,

Hung Jung

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )