diff --git a/README.md b/README.md index eed822f..0113c36 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Cpi is a tiny interpreter for C++11 code. ## Requirements - Qt qmake build system - - g++ compiler + - Compiler - g++, clang++, Visual C++ compiler ## Install @@ -12,10 +12,55 @@ Cpi is a tiny interpreter for C++11 code. $ 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 + #include + #include + 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 diff --git a/main.cpp b/main.cpp index a42de0d..10b06db 100644 --- a/main.cpp +++ b/main.cpp @@ -10,6 +10,9 @@ # include #endif +#define CPI_VERSION_STR "2.0.0" +#define CPI_VERSION_NUMBER 0x020000 + #ifdef Q_CC_MSVC # define DEFAULT_CONFIG \ "[General]\n" \ @@ -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;