Skip to content

Commit

Permalink
update readme file.
Browse files Browse the repository at this point in the history
  • Loading branch information
treefrogframework committed Feb 11, 2017
1 parent 0ddca36 commit 0d73a84
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,63 @@ Cpi is a tiny interpreter for C++11 code.

## Requirements
- Qt qmake build system
- g++ compiler
- Compiler - g++, clang++, Visual C++ compiler

## Install

$ qmake
$ make
$ sudo make install

## Run

## Run Mode
Save C++ source code as 'hello.cpp'.

int main()
{
std::cout << "Hello world\n";
return 0;
}


Run cpi in command line.

$ cpi hello.cpp
Hello world

Immediately compiled and executed!

Specify options for compiler or linker with "CompileOptions: " word.

#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;

int main(int argc, char *argv[])
{
if (argc != 2) return 0;

cout << sqrt(atoi(argv[1])) << endl;
return 0;
}
// CompileOptions: -lm

In this example, math library specified by "-lm" option.

$ cpi sqrt.cpp 2
1.41421

$ cpi sqrt.cpp 3
1.7320

## Interactive Mode

$ cpi
Cpi 2.0.0
Type ".help" for more information.
Loaded INI file: /home/foo/.config/cpi/cpi.conf

cpi> 3 << 23; (Bitwise operation)
25165824

Expand Down
5 changes: 5 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# include <csignal>
#endif

#define CPI_VERSION_STR "2.0.0"
#define CPI_VERSION_NUMBER 0x020000

#ifdef Q_CC_MSVC
# define DEFAULT_CONFIG \
"[General]\n" \
Expand Down Expand Up @@ -184,6 +187,8 @@ static void showCode()

static int interpreter()
{
print() << "Cpi " << CPI_VERSION_STR << endl;
print() << "Type \".help\" for more information." << endl;
print() << "Loaded INI file: " << conf->fileName() << endl;
print().flush();
Compiler compiler;
Expand Down

0 comments on commit 0d73a84

Please sign in to comment.