Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 02-23-2005
JohnB JohnB is offline
Registered User
 
 
Join Date: Feb 2005
Posts: 17
Include syntax of generated files.

I am using #include "..." syntax in an ice input file and the generated code is changing it to #include <...>. This makes it hard to create -I paths to access the files. There is a subtle difference between the following:

#include <xyz.h>
#include "xyz.h"

and this difference is sometimes important. In my case I'm moving generated header files to a public include dir. Putting -I. on the include path will not work because -I. means the current directory of compilation process whereas "xyz.h" means current dir of the file in which the #include "xyz.h" is located. Note that '-I.' is not always even the current dir of the .cpp file being compiled.

Can the generated code preserve the quotes or angle brackets as they are in the input file? I suppose it may be hard to do because the preprocessor has already removed this information. Just thougt I'd ask before I make a workaround.
__________________
-john
Reply With Quote
  #2 (permalink)  
Old 02-23-2005
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Hi John,

Section 4.4.3 of the Ice manual states the following:
Quote:
#include directives can appear only at the beginning of a Slice source file, that is, they must precede all other Slice definitions. In addition, only #include directives using the <>-syntax to specify a file name are permitted; use of the ""-syntax is not supported.
So technically your Slice code is invalid, and only works because Ice currently uses a C preprocessor. It is possible in the future that Ice would eliminate the external preprocessor and only support what is described in the manual.

The Ice source code also moves generated header files. With careful use of the -I and --include-dir options, it should be possible to achieve the desired result. Let us know if you're still having trouble.

Take care,
- Mark
Reply With Quote
  #3 (permalink)  
Old 02-23-2005
JohnB JohnB is offline
Registered User
 
 
Join Date: Feb 2005
Posts: 17
Can the <> include path information?

// -*- mode: idl -*-
#ifndef NavUpdate_ice
#define NavUpdate_ice

#ifndef NavData_ice
# include <cnav/NavData.ice> // << See here
#endif

module cnav
{
interface NavUpdate
{
nonmutating void update(NavData data);
};
};
#endif /* NavUpdate_ice */


----------------------------------------------
The manual is ambiguous:

• #include directives can appear only at the beginning of a Slice source file, that is, they must precede all other Slice definitions. In addition, only
#include directives using the <>-syntax to specify a file name are permitted; use of the ""-syntax is not supported. For example:
#include <File1.ice> // OK
#include "File2.ice" // Not supported!

Doesn't say no '/'. I tried it and it doesn't work.
__________________
-john

Last edited by JohnB : 02-23-2005 at 05:23 PM.
Reply With Quote
  #4 (permalink)  
Old 02-23-2005
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Quote:
Can the <> include path information?
Yes, that is legal. Furthermore, you can ensure that the generated code uses the same path information by using the -I and --include-dir options. Take a look at how the Ice Slice files work, in conjunction with Makefiles such as src/Ice/Makefile.

- Mark
Reply With Quote
  #5 (permalink)  
Old 02-23-2005
JohnB JohnB is offline
Registered User
 
 
Join Date: Feb 2005
Posts: 17
Quote:
Originally Posted by mes
...using the -I and --include-dir options.
Ok now it works. Looks like the --include-dir puts its argument string into generated file between the <> before the file name. <arg/file.h>

Eample: $ slice2cpp --include-dir CNAV ...
Produces: include <CNAV/NavData.h>

That works for me.

The documenation (both --help and pdf manual) doesn't quite make this clear. Here's what command line help says.

--include-dir DIR Use DIR as the header include directory in source files.
__________________
-john

Last edited by JohnB : 02-24-2005 at 09:40 AM.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom headers in generated files Sameerrele Help Center 2 10-17-2006 07:02 PM
Compatibility of files .h and .cpp generated from a .ice mykael Help Center 1 07-12-2006 09:34 AM
Any editor with SLICE syntax highlight ? hack Help Center 2 09-27-2004 10:17 AM
sequences syntax panic Help Center 1 12-04-2003 09:55 AM
generated #include clemens Help Center 1 06-04-2003 08:21 AM


All times are GMT -4. The time now is 07:08 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.