npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cpp-merge

v0.4.1

Published

Command line tool to produce single source file from multiple C/C++ files

Downloads

49

Readme

cpp-merge

Tool to produce a single source file from multiple C/C++ files. It was developed mainly to be used in programming contests that require submitting a solution as a single source file.

Install

Prerequisites

  • node
  • npm
  • yarn (optional)

Installation from npm

npm install -g cpp-merge

Installation from source

Clone git repository
git clone [email protected]:RandomVoid/cpp-merge.git
Build and link package

Using npm:

npm install
npm run build
npm link

Or using yarn:

yarn
yarn build
yarn link

Usage

This tool will produce a single source file from multiple C/C++ files. By default produced content is displayed on the standard output. To save it into a file use option -o or --output.

File passed as an argument will be processed similarly to what the preprocessor would do. It means all included local files (ex. #include "header.hpp") will be processed and added to output in place of the include directive. Program will search for include files first in the directory where the currently processed file is located and then in additional include directory, if it was specified in program arguments (option -i or --include).

Files containing #pragma once will be processed only once, so use this directive to avoid duplication of content of files in the output and to reduce its size.

After processing all included files, the program will try to find related source files for each of included local header files. If a file with the same base name and extension .c or .cpp exists, it will be appended to the output. Program will search first in the same directory where the main source file is located and then in an additional source directory, if it was specified in program arguments (option -s or --source). If the header was included using relative path ex. #include "one/two/three.hpp" the program will search for three.c or three.cpp in one/two/ or ${sourceDirectory}/one/two/. First found file will be appended to the output.

Program will detect duplication of system header includes, so output will contain only a unique set of them, ordered alphabetically. Any of the processed header and source files will not be changed.

Display the build-in help:

cpp-merge --help

Usage examples

Process main.cpp and display produced content on the standard output:

cpp-merge main.cpp

Process main.cpp and save output to file output.cpp:

cpp-merge --output output.cpp main.cpp

Specify additional include and source directory:

cpp-merge --include ../include --source ../src main.cpp