You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Magnús Þór Torfason <ma...@handtolvur.is> on 2002/08/28 19:00:00 UTC

Velocity in C/CPP?

<disclaimer>
I am not sure if this has been asked before, and aware
that the question may be rather optimistic
</disclaimer>

That said, I am wondering if a templating engine similar to Velocity is
available for C/CPP.  What I am looking for does not have to have Velocity's
rich feature set.  I am looking for a program using the pure velocity
mindset.  I really need is something which duplicates the functionality of

Velocity evaluate(context, writer, logTag, instream)

I am using Velocity in the most peculiar places (when using Java), and am
beginning to feel like it should be a standard part of the class library,
but when using other languages I feel a bit empty-handed without it.

PHP and such languages are usable in a web setting, but when it comes to
transforming a string in a simple way, using a dynamic context, I have not
found anything.

Best regards,

Magnus


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Velocity in C/CPP?

Posted by Bill Burton <bi...@progress.com>.
Hello,

There's Cheetah, a Velocity like template system for Python.  See
http://marc.theaimsgroup.com/?l=velocity-user&m=99507614016276&w=2 and
http://cheetahtemplate.org.  I'm not that familiar with Python but hear it
works well for embedded applications.

-Bill

Magnús Þór Torfason wrote:
> 
> <disclaimer>
> I am not sure if this has been asked before, and aware
> that the question may be rather optimistic
> </disclaimer>
> 
> That said, I am wondering if a templating engine similar to Velocity is
> available for C/CPP.  What I am looking for does not have to have Velocity's
> rich feature set.  I am looking for a program using the pure velocity
> mindset.  I really need is something which duplicates the functionality of
> 
> Velocity evaluate(context, writer, logTag, instream)
> 
> I am using Velocity in the most peculiar places (when using Java), and am
> beginning to feel like it should be a standard part of the class library,
> but when using other languages I feel a bit empty-handed without it.
> 
> PHP and such languages are usable in a web setting, but when it comes to
> transforming a string in a simple way, using a dynamic context, I have not
> found anything.
> 
> Best regards,
> 
> Magnus

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Velocity in C/CPP?

Posted by Nick Temple <nt...@alivecity.com>.
In C/CPP, or another language, how would you implement Reflection, which is
the "core" of how Velocity works?  I know that C doesn't have the
appropriate runtime type information -- would C++?

In any case, I would suspect that any language port would require a (nearly)
complete rewrite, regardless if you had some sort of "core" functionality.

If I really needed Velocity in any other language, my solution would
probably be to link a JRE into my application - this is relatively
straightforward (not necessarily "easy") to do from C/C++ and Perl, I'd
assume the same is true of most scripting languages as well (PHP, Python,
etc..) I've heard mention a C# implementation that may do the job as well
(cross-language development) - I'm not sure where that stands.

You still have to define your Java/<language of choice> object linkage is
such a way that it "makes sense" to Velocity.

My gut reaction is that Velocity leverages the Java internals _extremely_
well, and as such probably isn't much of a target for cross-language
compatibility (other than compiling your C app to Java :->).  Point being
that writing a templating engine in Perl that leverages it's specific
strengths (weak typechecking, anonymous tied hashes, "package objects")
would be more efficient / faster / easier to use than the impedence mismatch
you would get with the way Velocity does things internally.  Yes, the API
could be very similar, the internals, however would be very different

Nick

-----Original Message-----
From: Gonzalo Diethelm [mailto:gonzalo.diethelm@aditiva.com]
Sent: Wednesday, August 28, 2002 12:16 PM
To: Velocity Users List
Subject: RE: Velocity in C/CPP?


> <disclaimer>
> I am not sure if this has been asked before, and aware
> that the question may be rather optimistic
> </disclaimer>
>
> That said, I am wondering if a templating engine similar to Velocity is
> available for C/CPP.  What I am looking for does not have to have
> Velocity's
> rich feature set.  I am looking for a program using the pure velocity
> mindset.  I really need is something which duplicates the functionality of
>
> Velocity evaluate(context, writer, logTag, instream)

I asked something related to this some time ago: is there Velocity
for Perl? For PHP? Then, I arrived to the conclusion that the basic
Velocity functionality should be implemented in C (which does NOT
answer the question of how to represent the context, but bear with
me), and have the target language (Java, Perl, PHP, etc.) simply
call upon the common library. Alas, I have no idea how to do this,
nor do I have the time to embark on such a project.

> Best regards,
>
> Magnus

Regards,


--
Gonzalo A. Diethelm
gonzalo.diethelm@aditiva.com


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Velocity in C/CPP?

Posted by Gonzalo Diethelm <go...@aditiva.com>.
> <disclaimer>
> I am not sure if this has been asked before, and aware
> that the question may be rather optimistic
> </disclaimer>
>
> That said, I am wondering if a templating engine similar to Velocity is
> available for C/CPP.  What I am looking for does not have to have
> Velocity's
> rich feature set.  I am looking for a program using the pure velocity
> mindset.  I really need is something which duplicates the functionality of
>
> Velocity evaluate(context, writer, logTag, instream)

I asked something related to this some time ago: is there Velocity
for Perl? For PHP? Then, I arrived to the conclusion that the basic
Velocity functionality should be implemented in C (which does NOT
answer the question of how to represent the context, but bear with
me), and have the target language (Java, Perl, PHP, etc.) simply
call upon the common library. Alas, I have no idea how to do this,
nor do I have the time to embark on such a project.

> Best regards,
>
> Magnus

Regards,


--
Gonzalo A. Diethelm
gonzalo.diethelm@aditiva.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>