TuX as LLG logo
Software
DMX4Linux
Driver Suite for Linux
csv2iif.pl suite
convert PayPal transactions to IIF, OFX, QIF
Hardware
DMX30 Interface
128Ch SPP
DMX43 Interface
2out 2in EPP
LED Hardware
for Linux and Windows
EPROM Sampler
for 8 bits of sound
Misc
CatWeasel
Linux drivers for MK3/4 PCI
pg_trompe
PostgreSQL replication
trycatch
C exception/signal handling lib
Patches
to various software
Tools
and small scripts
Docs
misc documents
Links
to lighting stuff

c++int - a C++ interpretor wrapper

c++int is a program to execute C++ files without the compile/link steps. It's intended to be used similar to script languages (perl, python) on Unix systems with the shebang syntax. The following example should make everything clear.

If you have installed the c++int program into the /usr/bin/ directory you can create a file test.cpp with the following content:

#!/usr/bin/c++int -Wall
#include <iostream>
int main(int argc, char **argv)
{
  std::cout << "my c++ interpreter is working!\n";
  for(int i=1; i<argc; ++i)
    std::cout << "command line argument #" << i << ": " << argv[i] << std::endl;
  return 0;
}
You can now either execute the program by calling it with the c++int program on the command line like:
$ c++int test.cpp
my c++ interpreter is working!
Or you can make the test.cpp file executable and call it directly:
$ chmod +x test.cpp
$ ./test.cpp
my c++ interpreter is working!

Usage

You can prefix a C++ source code file with the Unix shebang to execute the source code file with the c++int program. Add
#!/usr/bin/c++int
as the first line. If you need additional compiler flags you can add them to the shebang line.

If you need to supply arguments to your C++ program you have to prefix them with --, to distinguish them from compiler options:

$ ./test.cc -- test
my c++ interpreter is working!
command line argument #1: test
You have to be careful if your arguments contain whitespace, because the whitespace will be interpreted twice by the unix shell (once in the original call, the second time when the compiled program is executed). The following example does not work as expected when the argument is only quoted once:
$ ./test.cc -- "first argument"
my c++ interpreter is working!
command line argument #1: first
command line argument #2: argument
To work around this issue you can quote the argument twice:
$ ./test.cc -- "'first argument'"
my c++ interpreter is working!
command line argument #1: first argument

You can control the execution of c++int with two special environment variables:

CXX_INT_DEBUG
When this variable is set to any value, c++int will print debug messages about its execution.
CXX_INT_CACHE
This variable should specify a directory name. If the directory is writable by the user the compiled program will be saved in the directory. This allows a faster execution of C++ programs.

Download

c++int-1.0.tar.gz released 2012-07-04.

Contact

Write an email to Dirk Jagdmann for questions and suggestions.


Search:
http://llg.cubic.org © 2001-2017 by Dirk Jagdmann