Code Monkey home page Code Monkey logo

shpp's Introduction

shpp

Call c++ functions from a shell with any arguments of any types parsed automatically

Declare a variable or define a function and register it in shpp with a simple command. Your function will be available to be called by a shell that parses the arguments automatically to the types of the arguments of your function.

Usage

git clone --recursive https://github.com/GrossoMoreira/shpp
cd shpp
make
bin/example

Features

  • list available functions, including their return type and parameter types
  • call functions with any number of arguments of any primitive types or stl-like non-associative containers
  • read and write variables (const/read-only variables supported)
  • when a function is called, output its return value (of any supported type)
  • interactive and non interactive mode
  • auto-complete
  • command history
  • reverse search
  • sourcing commands from files

Interface

#include "shpp/shpp.h"

shpp::service svc;	// create a service

svc.provide("function_name", function_ptr);
svc.provide("variable_name", variable_ref);

shpp::shell sh(svc);	// create a shell for this service
sh.start();			// start shell

Interactive shell

Interactive shell demo

Supported types

  • primitive types
  • stl-like non-associative containers (std::vector, std::list...) that implement the push_back() method, parsed/serialized as JSON objects
  • containers of containers
Sample std::vector<std::list<int>> :

[[0,2,4],[1,3,5],[]]

..can be used as a function parameter or return type.

Dependencies

  • GNU readline

Todo

  • support arguments of user-defined types
  • support asynchronous execution of commands
  • call functions remotely

shpp's People

Contributors

grossomoreira avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.