[LC++]scripting in C++

Jan Pfeifer pfjan at yahoo.com.br
Thu Sep 30 04:05:01 UTC 2004


 --- Torsten Rennett <Torsten at Rennett.de> escreveu: 
> On Mittwoch, 29. September 2004 15:36, Jan Pfeifer
> wrote:
> > lately i've been using more and more C++ even for
> > small  programs for which i would previously use
> perl
> > or python.
> >
> > so I'm trying to implement something to easy the
> > process of compiling and using these C++
> "scripts",
> > and was wondering if i could have some
> comments/ideas
> > from you on the subject -- whatever I do with it
> I'll
> > publish later here as GNU software.
> >
> > my idea so far is very simple:
> >
> > - start the C++ "scripts" with a
> >
> >    #!/path/scriptc++ [linker options]
> >
> > - let's say I have a "filter.cc" program.
> >
> > - the "scriptc++" program tests if there is a
> > ".filter.cc.compiled" file, and if not, or if
> > "filter.cc" is newer, it tries to recompile and
> link
> > "filter.cc" to ".filter.cc.compiled"
> >
> > - if compilation is successful, or if
> > ".filter.cc.compiled" is newer than "filter.cc",
> just
> > run it with the extra options passed to the
> execution
> > of "filter.cc"
> 
> Your "scriptc++" is simply a Makefile after all ...

yes, the idea is to have something that do all this
extra job of the Makefile and aliases automagically,
especially for small scripts -- I find myself so often
doing this kind of stuff.

> Create a 'run' target in your Makefile which depends
> on target 'all' (which 
> builds everything as usual) and start the program in
> the action section.  
> Now you can type 'make run' and the program will be
> build (if necassary) 
> and started.
> 
> For various such "C++ scripts" you can use a pattern
> like this:
> 	alias prog1="(cd ~/scripts/prog1/; make run)"
> 	alias prog2="(cd ~/scripts/prog2/; make run)"
> 	...
> Or:
> 	alias prog1="make -f ~/scripts/prog1/Makefile run"
> 	alias prog2="make -f ~/scripts/prog2/Makefile run"
> 
> Just an idea -- you have to work out the details ...
> 
> BTW: If you don't like compiling -- why don't you
> stay with Python?

mostly because of the libraries. I'm very often
switching between bash, php, sql, c++, perl, python,
java ... what bothers me the most is that i'm always
having to search for functions/parameters to do
something in such or such language, even for simple
things like trimming spaces from the end of a string.

so I'm trying to converge most of my work to one
language+library set.

> 
> 
> Torsten
> 
> -- 
> Ingenieurbuero RENNETT      -- innovative
> Software-Entwicklung --
> Torsten Rennett                   
> http://www.RENNETT.de
> Ludwig-Thoma-Weg 14         E-Mail:           
> Torsten at Rennett.de
> D-85551 Heimstetten         Telefon:            +49
> 89 904 805 38
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the tuxCPProgramming mailing list