Search the web
Sign In
New User? Sign Up
ClearSilver
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Compile ClearSilver on System i   Message List  
Reply | Forward Message #1307 of 1347 |

Hi,

I'm trying to compile ClearSilver on a System i platform.

The compiler is C89 compatible (AFAIK). I am compiling the stuff manually, starting with the util directory. Things which compiled out of the box were

missing.c
neo_err.c
neo_misc.c
rcfs.c
snprintf.c
wildmat.c

Now am trying dict.c but got some errors:

/home/schmidt/clearsilver/util/dict.c, 563.77: CZM0041(20) The invocation
  of macro nerr_raise contains fewer arguments than are required by the 
  macro definition.                                                     

The compiler uses C99 style var args.


ILE C Language Reference:
Function-Like Macros
More complex than object-like macros, a function-like macro definition declares the names of formal parameters within parentheses, separated by commas. An empty formal parameter list is legal: such a macro can be used to simulate a function that takes no arguments.

Function-like macro definition: An identifier followed by a parameter list in parentheses and the replacement tokens. The parameters are imbedded in the replacement code. White space cannot separate the identifier (which is the name of the macro) and the left parenthesis of the parameter list. A comma must separate each parameter. For portability, you should not have more than 31 parameters for a macro. The parameter list may end with an ellipsis (...). In this case, the identifier __VA_ARGS__ may appear in the replacement list.

Function-like macro invocation: An identifier followed by a comma-separated list of arguments in parentheses. The number of arguments should match the number of parameters in the macro definition, unless the parameter list in the definition ends with an ellipsis. In this latter case, the number of arguments in the invocation should exceed the number of parameters in the definition. The excess are called trailing arguments. Once the preprocessor identifies a function-like macro invocation, argument substitution takes place. A parameter in the replacement code is replaced by the corresponding argument. If trailing arguments are permitted by the macro definition, they are merged with the intervening commas to replace the identifier __VA_ARGS__, as if they were a single argument. Any macro invocations contained in the argument itself are completely replaced before the argument replaces its corresponding parameter in the replacement code. This language feature is an orthogonal extension of C++.

If the identifier list does not end with an ellipsis, the number of arguments in a macro invocation must be the same as the number of parameters in the corresponding macro definition. During parameter substitution, any arguments remaining after all specified arguments have been substituted (including any separating commas) are combined into one argument called the variable argument. The variable argument will replace any occurrence of the identifier __VA_ARGS__ in the replacement list. The following example illustrates this:

#define debug(...) fprintf(stderr, __VA_ARGS__)

debug("flag"); /* Becomes fprintf(stderr, "flag"); */



I'm not a C programmer and don't understand the following code (which create the error message in the compilation):
dict.c: nerr_raise(NERR_ASSERT, "value or new are NULL");

neo_err.h:
#if defined(USE_C99_VARARG_MACROS)
#define nerr_raise(e , f , ...) \
   nerr_raisef(__PRETTY_FUNCTION__ , __FILE__ , __LINE__ , e , f , __VA_ARGS__)
#elif defined(USE_GNUC_VARARG_MACROS)
#define nerr_raise(e,f,a...) \
   nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,##a)
#endif

NEOERR *nerr_raisef (const char *func, const char *file, int lineno,
                     NERR_TYPE error, const char *fmt, ...)
                     ATTRIBUTE_PRINTF(5,6);


Question: Why is dict.c calling nerr_raise with only 2 parm. Shouldn't it be three parms (error type, format string and error message)? I definitely got something wrong but I don't know what?

The language reference says: ... the number of arguments in the invocation should exceed the number of parameters in the definition ...


Every help is welcome

Thanx in advance

Mihael Schmidt
Anwendungsentwicklung

Dirk Rossmann GmbH
Iserhägener Str.16
30938 Burgwedel
* +49 (05139) 898 - 4353

Handelsregister-Nr. HRB 120546, Amtsgericht Hannover
Ust-Id-Nr. DE 115055186
St.-Nr. 16 / 205 / 65401
Geschäftsführer: Dirk Roßmann, Alice Schardt-Roßmann, Roland Frobel, Klaus Praus



Thu Jun 11, 2009 9:09 am

Mihael.Schmidt@...
Send Email Send Email

Forward
Message #1307 of 1347 |
Expand Messages Author Sort by Date

Hi, I'm trying to compile ClearSilver on a System i platform. The compiler is C89 compatible (AFAIK). I am compiling the stuff manually, starting with the util...
Schmidt, Mihael
Mihael.Schmidt@...
Send Email
Jun 11, 2009
2:47 pm

I suspect the real problem is with the other macros __PRETTY_FUNCTION, __FILE__ and __LINE__. These are magic macros defined by some compilers, but they might ...
David Jeske
jeskeca
Offline Send Email
Jun 12, 2009
3:08 am

... it be ... definitely got ... nerr_raise() is setup to work like the printf() family of functions. For example, you might have: nerr_raise(NERR_ASSERT,...
Schmidt, Mihael
Mihael.Schmidt@...
Send Email
Jun 12, 2009
5:18 am

oh... it is util/ulocks.c (not util.ulock.c) I compiled clearsilver on a linux system and took the cs_config.h from it (and modified it a little bit). Now i...
Schmidt, Mihael
Mihael.Schmidt@...
Send Email
Jun 12, 2009
5:34 am

After some searching on the web I found that HAVE_LOCKF is queried in Clearsilver.h. There is seems that ulock, rcfs, dict and skiplist are optional (are not...
Schmidt, Mihael
Mihael.Schmidt@...
Send Email
Jun 12, 2009
5:45 am

Yes, they aren't necessary for the template system or cgi code, they're just extra. Brandon ... -- "This universe never did make sense; I suspect it was built...
Brandon Long
blong42
Offline Send Email
Jun 12, 2009
4:34 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help