In my opinion it's not interesting part of the contest to write algorithms you have already written dozens of times. I kind of see why people who prepare to IOI/ICPC would do that, but not other participants. So I created yet another tool that allows to use your own library locally and submit to CodeForces. Idea is that you write in one file, then submit another file and you don't need to do any other action to actually generate file to submit (once everything is configured)

## Demo

The tool consists of two independent parts

inline_includes: this is a simple python script that inlines all the includes you used from whitelist of directories (so that standard headers such as are not inlined). It's far from supporting whole c++ (e.g it doesn't support #include MACRO) but it was enough for my library. This part can be replaced for your own language. The paths to directories to inline is passed

command_fs: this tool is written in c++ using libfuse. It accepts to directories (mount point and source directory) and a command (With arguments). So for each file file in source directory it virtually creates file file is the mounted directory with the content of output of command command args file. So, if you pass inline_includes as a command it "replaces" all the files with its contents with inlined includes

## OS Support:

MacOS: I tested on 10.14 and 10.15
Linux: It should work but I haven't tested
Windows: I don't know much about windows but in principle it should work via fuse api of WinFSP

## Installation:

### inline_includes:

From brew:
brew install AlexeyDmitriev/sp/inline_includes

Manual:
It's just a python file, you can grab it from github in the most convenient for you way.

### command_fs:

From brew:

brew cask install osxfuse # Required because formula can't depend on cask in brew
brew install AlexeyDmitriev/sp/command_fs


Manual:
1. Install libfuse in someway
2. It's a cmake project, you can get it from github and build as usual:

mkdir build
cd build
cmake ..
make


Then binary called command_fs is what you need

I'll appreciate help to package this for your own platforms.

## Usage

So, first you create a virtual filesystem (assuming both command_fs and inline_includes are in \$PATH, otherwise you can replace them with a path to them)

command_fs /path/to/mount_point /path/to/sources/you/write inline_includes /include/path1 /include/path2

Then, all the files from /path/to/sources/you/write are inlined in /path/to/mount_point and you are ready to enjoy problem solving

Once you are done you can unmount the directory using umount /path/to/mount_point (but you don't have to)

Also you should be able to configure automount so that you don't need to run anything after reboot but I've never tried that.

• +113

 » 13 months ago, # |   +41 Thank you, great! But I don't think that poor keyboard deserves that hard p̶u̶n̶c̶h̶e̶s̶ clicks.
 » 13 months ago, # |   +10 Isn't setting up a proxy server which intercepts the code and then edits it an easier way than maintaining a virtual filesystem? It'd also change the code when one copy-pastes it instead of choosing file
•  » » 13 months ago, # ^ |   0 I'm not sure what kind of proxy do you mean. It might be easier. Copy-pasting is not supported the way I did indeed.Can't say it was hard with virtual filesystem, it's like 200 lines total, mostly boilerplate
 » 13 months ago, # |   +9 I don't think copy pasting is very difficult, especially since dependencies in templates tend to be very low.
•  » » 13 months ago, # ^ |   0 I don't like copy pasting too much. But whatever works for you
•  » » » 13 months ago, # ^ |   -61 The include directive is literally copypasting the contents of a file. This blog is about automated copypasting.
•  » » » » 13 months ago, # ^ |   +86 let's skip this useless linguistic discussion
•  » » » » » 13 months ago, # ^ |   -38 Linguistic? What?
 » 13 months ago, # |   0 Is there any install instructions for linux?
•  » » 13 months ago, # ^ |   0 Currently you can only build it from sources, see the post for details.
 » 5 months ago, # |   0 You can just pass the solution to the preprocessor (cpp) like this:cpp -i solution.cppThe output can then be sent to codeforces.
•  » » 5 months ago, # ^ | ← Rev. 2 →   0 Standard library will be also inlinee which is bad for 2 reasons: 1) source limit 2) if you have different standard library not everything is going to workAnd of course the inlining is more obvious part of the two, anyway
•  » » » 5 months ago, # ^ |   -10 BTW the source code is not readable at all, so I can't verify that there's no bugs and that with my environment this program won't basically destroy all my files because of bad pipe.Please fix the code (split into functions, add comments, use C++ libraries like pthread).
 » 5 months ago, # |   0 Can do an another screencast showing what command to use after one another, as it is looking a bit complicated...Btw, nice work on the library, and the inlining part...