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

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

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   Topic List   < Prev Topic  |  Next Topic >
Summarize Messages Sort by Date  
#1307 From: "Schmidt, Mihael" <Mihael.Schmidt@...>
Date: Thu Jun 11, 2009 9:09 am
Subject: Compile ClearSilver on System i
Mihael.Schmidt@...
Send Email Send Email
 

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


#1309 From: "David Jeske" <jeske@...>
Date: Fri Jun 12, 2009 2:56 am
Subject: Re: Compile ClearSilver on System i
jeskeca
Offline Offline
Send Email Send Email
 
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
not be defined by your compiler. You can try to make the compile work simply by
replaceing these arguments with actual values. Try replacing this:

nerr_raisef(__PRETTY_FUNCTION__ , __FILE__ , __LINE__ , e , f , __VA_ARGS__)

With this:

nerr_raisef("test", "test" , "test" , e , f , __VA_ARGS__)

-- Schmidt, Mihael wrote:
> 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?

nerr_raise() is setup to work like the printf() family of functions. For
example, you might have:

nerr_raise(NERR_ASSERT, "problematic value %d", local_variable_int);

Because the statement you referenced has no % formatting, it has no arguments.
nerr_raise(NERR_ASSERT, "value or new are NULL");



#1311 From: "Schmidt, Mihael" <Mihael.Schmidt@...>
Date: Fri Jun 12, 2009 5:17 am
Subject: AW: Compile ClearSilver on System i
Mihael.Schmidt@...
Send Email Send Email
 

-- Schmidt, Mihael wrote:
> 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?

nerr_raise() is setup to work like the printf() family of functions. For
example, you might have:

nerr_raise(NERR_ASSERT, "problematic value %d", local_variable_int);

Because the statement you referenced has no % formatting, it has no
arguments.
nerr_raise(NERR_ASSERT, "value or new are NULL");

Mihael: ... and that was my problem. The ILE C compiler expects to have
at least one variable argument if __VA_ARGS__ is used. I added an empty
string and it works now, like:

nerr_raise(NERR_ASSERT, "value or new are NULL", "");

But now I got another problem: The lockf() function is not available on
System i for ILE C. Is there a way to replace this function? A
workaround?

lockf() is used in util/ulock.c, function fLock and fFind.

Any ideas would be great.

Thanx in advance.

Mihael



#1312 From: "Schmidt, Mihael" <Mihael.Schmidt@...>
Date: Fri Jun 12, 2009 5:33 am
Subject: AW: Compile ClearSilver on System i
Mihael.Schmidt@...
Send Email Send Email
 
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 see that there is a setting for the
availability of lockf() :

/* Does your system have lockf ? */
/* #define HAVE_LOCKF 1 */

On the linux system there is of course lockf() but not on System i. So I put it
in comments. But it does not seem to do anything. Haven't found anything in
ulocks.c or ulocks.h.

Can I somehow use fcntl() instead of lockf() as a workaround?

Any idea?

Mihael

-----Ursprüngliche Nachricht-----
Von: ClearSilver@yahoogroups.com [mailto:ClearSilver@yahoogroups.com] Im Auftrag
von Schmidt, Mihael
Gesendet: Freitag, 12. Juni 2009 07:17
An: ClearSilver@yahoogroups.com
Betreff: AW: Compile ClearSilver on System i




-- Schmidt, Mihael wrote:
> 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?

nerr_raise() is setup to work like the printf() family of functions. For
example, you might have:

nerr_raise(NERR_ASSERT, "problematic value %d", local_variable_int);

Because the statement you referenced has no % formatting, it has no
arguments.
nerr_raise(NERR_ASSERT, "value or new are NULL");

Mihael: ... and that was my problem. The ILE C compiler expects to have
at least one variable argument if __VA_ARGS__ is used. I added an empty
string and it works now, like:

nerr_raise(NERR_ASSERT, "value or new are NULL", "");

But now I got another problem: The lockf() function is not available on
System i for ILE C. Is there a way to replace this function? A
workaround?

lockf() is used in util/ulock.c, function fLock and fFind.

Any ideas would be great.

Thanx in advance.

Mihael






#1313 From: "Schmidt, Mihael" <Mihael.Schmidt@...>
Date: Fri Jun 12, 2009 5:45 am
Subject: AW: Compile ClearSilver on System i
Mihael.Schmidt@...
Send Email Send Email
 
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 included if not supported on the system). Is that so? Can I go on with
the rest of the sources?

Thanx for any help in advance

Mihael

-----Ursprüngliche Nachricht-----
Von: ClearSilver@yahoogroups.com [mailto:ClearSilver@yahoogroups.com] Im Auftrag
von Schmidt, Mihael
Gesendet: Freitag, 12. Juni 2009 07:34
An: ClearSilver@yahoogroups.com
Betreff: AW: Compile ClearSilver on System i



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 see that there is a setting for the
availability of lockf() :

/* Does your system have lockf ? */
/* #define HAVE_LOCKF 1 */

On the linux system there is of course lockf() but not on System i. So I put it
in comments. But it does not seem to do anything. Haven't found anything in
ulocks.c or ulocks.h.

Can I somehow use fcntl() instead of lockf() as a workaround?

Any idea?

Mihael

-----Ursprüngliche Nachricht-----
Von: ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com>
[mailto:ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com> ] Im
Auftrag von Schmidt, Mihael
Gesendet: Freitag, 12. Juni 2009 07:17
An: ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com>
Betreff: AW: Compile ClearSilver on System i

-- Schmidt, Mihael wrote:
> 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?

nerr_raise() is setup to work like the printf() family of functions. For
example, you might have:

nerr_raise(NERR_ASSERT, "problematic value %d", local_variable_int);

Because the statement you referenced has no % formatting, it has no
arguments.
nerr_raise(NERR_ASSERT, "value or new are NULL");

Mihael: ... and that was my problem. The ILE C compiler expects to have
at least one variable argument if __VA_ARGS__ is used. I added an empty
string and it works now, like:

nerr_raise(NERR_ASSERT, "value or new are NULL", "");

But now I got another problem: The lockf() function is not available on
System i for ILE C. Is there a way to replace this function? A
workaround?

lockf() is used in util/ulock.c, function fLock and fFind.

Any ideas would be great.

Thanx in advance.

Mihael







#1315 From: Brandon Long <blong@...>
Date: Fri Jun 12, 2009 4:33 pm
Subject: Re: Compile ClearSilver on System i
blong42
Offline Offline
Send Email Send Email
 
Yes, they aren't necessary for the template system or cgi code, they're
just extra.

Brandon

On 06/12/09 Schmidt, Mihael uttered the following other thing:
> 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 included if not supported on the system). Is that so? Can I go on with
the rest of the sources?
>
> Thanx for any help in advance
>
> Mihael
>
> -----Ursprüngliche Nachricht-----
> Von: ClearSilver@yahoogroups.com [mailto:ClearSilver@yahoogroups.com] Im
Auftrag von Schmidt, Mihael
> Gesendet: Freitag, 12. Juni 2009 07:34
> An: ClearSilver@yahoogroups.com
> Betreff: AW: Compile ClearSilver on System i
>
>
>
> 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 see that there is a setting for the
availability of lockf() :
>
> /* Does your system have lockf ? */
> /* #define HAVE_LOCKF 1 */
>
> On the linux system there is of course lockf() but not on System i. So I put
it in comments. But it does not seem to do anything. Haven't found anything in
ulocks.c or ulocks.h.
>
> Can I somehow use fcntl() instead of lockf() as a workaround?
>
> Any idea?
>
> Mihael
>
> -----Ursprüngliche Nachricht-----
> Von: ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com>
[mailto:ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com> ] Im
Auftrag von Schmidt, Mihael
> Gesendet: Freitag, 12. Juni 2009 07:17
> An: ClearSilver@yahoogroups.com <mailto:ClearSilver%40yahoogroups.com>
> Betreff: AW: Compile ClearSilver on System i
>
> -- Schmidt, Mihael wrote:
> > 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?
>
> nerr_raise() is setup to work like the printf() family of functions. For
> example, you might have:
>
> nerr_raise(NERR_ASSERT, "problematic value %d", local_variable_int);
>
> Because the statement you referenced has no % formatting, it has no
> arguments.
> nerr_raise(NERR_ASSERT, "value or new are NULL");
>
> Mihael: ... and that was my problem. The ILE C compiler expects to have
> at least one variable argument if __VA_ARGS__ is used. I added an empty
> string and it works now, like:
>
> nerr_raise(NERR_ASSERT, "value or new are NULL", "");
>
> But now I got another problem: The lockf() function is not available on
> System i for ILE C. Is there a way to replace this function? A
> workaround?
>
> lockf() is used in util/ulock.c, function fLock and fFind.
>
> Any ideas would be great.
>
> Thanx in advance.
>
> Mihael
>
>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
--
"This universe never did make sense; I suspect it was built on a
government contract." -- Robert A. Heinlein
http://www.fiction.net/blong/



 
Advanced
Add to My Yahoo!      XML What's This?

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