├── README.md
└── build
├── QuickStart
└── QuickStart.cpp
├── README.md
├── create_dist.sh
├── launchers
├── Open command line.bat
└── Pocket C++.bat
└── npp
├── plugins
└── config
│ ├── NppExec.ini
│ └── npes_saved.txt
├── session.xml
└── shortcuts.xml
/README.md:
--------------------------------------------------------------------------------
1 | # Pocket C++
2 |
3 | Portable and easy to use editor to write and test C++11/14/17/20 snippets.
4 |
5 | ## Features
6 |
7 | * Press `F9` key to compile C++ files
8 | * Press `Ctrl+F9` to execute the compiled program
9 | * Press `F4`/`Ctrl+F4` to go to next/previous compiler error
10 | * Includes [MinGW Distro](http://nuwen.net/mingw.html) by [Stephan T. Lavavej](http://nuwen.net/stl.html), gcc 9.2.0 ([supported features](https://gcc.gnu.org/projects/cxx-status.html))
11 | * Includes [Notepad++ v7.8.9](http://notepad-plus-plus.org/) with [NppExec](https://github.com/d0vgan/nppexec) plugin
12 | * Includes [cmake v3.18.2](http://cmake.org/)
13 |
14 | ## Download
15 |
16 | [Pocket C++ 0.8 Windows 64-bit](https://github.com/dacap/pocketcpp/releases/download/v0.8/pocketcpp-0.8.exe)
17 |
18 | See [FAQ](https://github.com/dacap/pocketcpp/wiki/FAQ) for
19 | installation instructions and more.
20 |
21 | ## Notes
22 |
23 | * The `.cpp` file must be self-contained (it must contain a `main()` function),
24 | * The file is compiled using `-std=c++2a` flag with gcc 9.2.0
25 | * Static linking (`-static`) is used to generate the output (`.exe`
26 | file), in this way it doesn't depend on external `.dll` (e.g. C++
27 | runtime).
28 | * In next versions you'll be able to link multiple `.cpp` files and to
29 | use third party libraries like Boost and SDL (which are already
30 | included in the Pocket C++ distribution).
31 |
32 | Pocket C++ looks like (is) Notepad++
33 |
34 |
35 |
36 | You can press **F9 to compile** your .cpp files. If there are compilation errors you can double-click them to go to the specific line.
37 |
38 |
39 |
40 | You can press **Ctrl+F9 to execute** the compiled program
41 |
42 |
43 |
--------------------------------------------------------------------------------
/build/QuickStart/QuickStart.cpp:
--------------------------------------------------------------------------------
1 | // ===========================
2 | // Welcome to Pocket C++
3 | // ===========================
4 | //
5 | // You can compile C++ files using F9 key (try it!).
6 | // Then you can execute the generated program pressing Ctrl+F9.
7 | //
8 | // Good luck!
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | using namespace std;
15 |
16 | // Strongly-typed enums
17 | // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf
18 | enum class Color : int { Red, Yellow, Blue };
19 |
20 | int main()
21 | {
22 | Color red = Color::Red, blue = Color::Blue;
23 | cout << "red = " << static_cast(red) << "\n";
24 | cout << "blue = " << static_cast(blue) << "\n";
25 |
26 | // Initializer lists
27 | // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm
28 | vector a = { 1, 2, 3 };
29 |
30 | // Lambdas and begin/end() functions.
31 | // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf
32 | for_each(begin(a), end(a), [](int& v) {
33 | v *= 2;
34 | });
35 |
36 | // Range-based for
37 | // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2930.html
38 | for (int v : a)
39 | cout << v << "\n";
40 |
41 | // Auto, constexpr, and decltype
42 | // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf
43 | // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf
44 | auto x = 3.2;
45 | constexpr auto y = 5.4;
46 | decltype(x + y) z = x + y;
47 | cout << "(x, y, z) = (" << x << ", " << y << ", " << z << ")\n";
48 |
49 | // if constexpr
50 | // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0292r2.html
51 | if constexpr(y == 5.4) {
52 | cout << "y is 5.4\n";
53 | }
54 |
55 | // Range-based for statements with initializer
56 | // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0614r1.html
57 | for (auto v = { 3, 2, 1 }; auto i : v)
58 | cout << "i=" << i << ", ";
59 | cout << "\n";
60 |
61 | return 0;
62 | }
63 |
--------------------------------------------------------------------------------
/build/README.md:
--------------------------------------------------------------------------------
1 | This directory contains scripts and files required to create a new
2 | Pocket C++ distribution.
3 |
4 | You will need a Mozilla Build environment to run `create_dist.sh`
5 | script: https://wiki.mozilla.org/MozillaBuild
6 |
7 | .- [David Capello](mailto:davidcapello@gmail.com)
8 |
--------------------------------------------------------------------------------
/build/create_dist.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | srcdir=$(pwd)
4 | version=0.8
5 | outputdir="/c/pocketcpp-build"
6 |
7 | # ----------------------------------------
8 | # Output directory
9 | # ----------------------------------------
10 |
11 | echo -n "Output directory ($outputdir)? "
12 | read ans
13 | if [[ "$ans" != "" ]] ; then
14 | outputdir=$ans
15 | fi
16 |
17 | if [[ -d "$outputdir" ]] ; then
18 | echo Directory $outputdir already exist
19 | echo -n "Do you want to continue anyway (yes/NO)? "
20 | read ans
21 | if [[ "$ans" != "yes" ]] ; then
22 | exit 1 ;
23 | fi
24 | fi
25 |
26 | if [[ ! -d "$outputdir" ]] ; then mkdir "$outputdir" ; fi
27 | if [[ ! -d "$outputdir/cache" ]] ; then mkdir "$outputdir/cache" ; fi
28 | if [[ ! -d "$outputdir/pocketcpp" ]] ; then mkdir "$outputdir/pocketcpp" ; fi
29 | start "$outputdir"
30 |
31 | # ----------------------------------------
32 | # Download files
33 | # ----------------------------------------
34 |
35 | cd "$outputdir/cache"
36 | if [[ ! -f npp.7z ]] ; then
37 | wget https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.8.9/npp.7.8.9.bin.minimalist.x64.7z -O npp.7z
38 | fi
39 | if [[ ! -f mingw.exe ]] ; then
40 | wget https://nuwen.net/files/mingw/history/mingw-17.1.exe -O mingw.exe
41 | fi
42 | if [[ ! -f NppExec.zip ]] ; then
43 | wget https://github.com/d0vgan/nppexec/releases/download/v06-RC3/NppExec_06RC3_dll_x64_PA.zip -O NppExec.zip
44 | fi
45 | if [[ ! -f cmake.zip ]] ; then
46 | wget https://github.com/Kitware/CMake/releases/download/v3.18.2/cmake-3.18.2-win64-x64.zip -O cmake.zip
47 | fi
48 |
49 | # ----------------------------------------
50 | # Uncompress
51 | # ----------------------------------------
52 |
53 | cd "$outputdir/pocketcpp"
54 | if [[ ! -d npp ]] ; then
55 | 7z x "$outputdir/cache/npp.7z" -onpp
56 | fi
57 | if [[ ! -d MinGW ]] ; then
58 | 7z x "$outputdir/cache/mingw.exe"
59 | fi
60 | if [[ ! -d cmake ]] ; then
61 | unzip "$outputdir/cache/cmake.zip"
62 | mv cmake-3.18.2-win64-x64 cmake
63 | fi
64 |
65 | # ----------------------------------------
66 | # Copy Pocket++ files
67 | # ----------------------------------------
68 |
69 | cd "$outputdir/pocketcpp"
70 | cp $srcdir/launchers/*.bat .
71 | cp -r $srcdir/npp .
72 | cp -r $srcdir/QuickStart QuickStart
73 |
74 | # ----------------------------------------
75 | # Install Notepad++ plugins
76 | # ----------------------------------------
77 |
78 | if [[ ! -f npp/plugins/NppExec/NppExec.dll ]] ; then
79 | unzip "$outputdir/cache/NppExec.zip" NppExec/NppExec.dll
80 | mkdir -q npp/plugins
81 | mv NppExec npp/plugins
82 | fi
83 |
84 | # ----------------------------------------
85 | # Create package
86 | # ----------------------------------------
87 |
88 | cd "$outputdir"
89 | 7z a -sfx7z.sfx pocketcpp-$version.exe pocketcpp
90 |
--------------------------------------------------------------------------------
/build/launchers/Open command line.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | set PATH=%~dp0cmake\bin;%PATH%
3 | cmd /k ""%~dp0MinGW\set_distro_paths.bat" && title PocketC++"
4 |
--------------------------------------------------------------------------------
/build/launchers/Pocket C++.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | set PATH=%~dp0cmake\bin;%PATH%
3 | set PATH=%~dp0npp;%PATH%
4 | "%~dp0MinGW\set_distro_paths.bat" && start notepad++.exe
5 |
--------------------------------------------------------------------------------
/build/npp/plugins/config/NppExec.ini:
--------------------------------------------------------------------------------
1 | [Console]
2 | Visible=0
3 | ShowHelp=0
4 | Encoding=17
5 | SaveOnExecute=0
6 | CmdHistory=1
7 | SaveCmdHistory=1
8 | NoInternalMsgs=0
9 | TextColorNormal=0(6)
10 | TextColorError=A01010
11 | TextColorMessage=208020
12 | BackgroundColor=00
13 | [Restore]
14 | LastSelectedScript=0
15 | [UserMenu]
16 | 0="Compile C++ File :: Compile C++ File"
17 | 1="Execute Compiled File :: Execute Compiled File"
18 | [ConsoleOutputFilter]
19 | RecognitionMask0="%ABSFILE%:%LINE%:*"
20 | RecognitionEffect0="+E FF 00 00 -I -B -U"
21 | [FiltersHighlight]
22 | 0="%ABSFILE%:%LINE%:"
23 |
--------------------------------------------------------------------------------
/build/npp/plugins/config/npes_saved.txt:
--------------------------------------------------------------------------------
1 | ::Compile C++ File
2 | NPP_SAVE
3 | g++ -s -O3 -o "$(CURRENT_DIRECTORY)\$(NAME_PART)" "$(FULL_CURRENT_PATH)" -static -std=c++2a
4 | ::Execute Compiled File
5 | "$(CURRENT_DIRECTORY)\$(NAME_PART).exe"
6 |
--------------------------------------------------------------------------------
/build/npp/session.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/build/npp/shortcuts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | firefox "$(FULL_CURRENT_PATH)"
13 | iexplore "$(FULL_CURRENT_PATH)"
14 | chrome "$(FULL_CURRENT_PATH)"
15 | safari "$(FULL_CURRENT_PATH)"
16 | http://www.php.net/$(CURRENT_WORD)
17 | https://www.google.com/search?q=$(CURRENT_WORD)
18 | https://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)
19 | $(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD)
20 | $(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD) -nosession -multiInst
21 | outlook /a "$(FULL_CURRENT_PATH)"
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------