run c/cpp or other language snippet code
Perl 6
Switch branches/tags
Nothing to show
Latest commit eb943a5 Aug 21, 2017 @araraloren create tmpdir manual
Permalink
Failed to load latest commit information.
bin change Proc to Proc::Async Aug 7, 2017
lib/App create tmpdir manual Aug 21, 2017
t fix test mate Jul 31, 2017
.appveyor.yml manual install Pluggable Aug 17, 2017
.gitignore clean compile Jul 11, 2017
.travis.yml add config Aug 4, 2017
LICENSE change LICENSE, add readme Jul 31, 2017
META6.json create tmpdir manual Aug 21, 2017
README.adoc Update README.adoc Aug 16, 2017

README.adoc

perl-app-snippet

run c/cpp or other language snippet code

Build Status https://ci.appveyor.com/api/projects/status/jxi78155dvv8jrqx?svg=true

Feature

  • Run code from command line arguments

  • Run code input from user

  • compile files and link them to executable binary

  • Preprocess code only

  • Compile code only

  • Code format

TODO

  • Run code grab from web

Language Support

  • c

  • c++

Usage

  • c

    • code snippet

      $ snippet c -e 'int a = 500;'  -e 'a = rand();' -e 'printf("%d\n", a);' -i stdlib.h -p
      --------------------------------------------------
      #include <stdlib.h>
      #include <stdio.h>
      int main(void)
      {
      int a = 500; a = rand(); printf("%d\n", a);
      return 0;
      }
      --------------------------------------------------
      1804289383
    • read from user

      $ snippet c -r
      Please input your code, make sure your code correct.
      Enter @@CODEEND input.
      int main() {
          printf("Hello World!!\n");
      }
      @@CODEEND
      Hello World!!
    • file

      $ snippet c *.c
      Hello World!!
  • cxx

    • code snippet

      $ snippet cpp -e 'int a{500};' -e 'std::random_device rd{};' -e 'std::uniform_int_distribution<int> dist(0, 100000);' -e 'a = dist(rd);' -e 'std::cout <<a << std::endl;' -p -i random
      --------------------------------------------------
      #include <random>
      #include <iostream>
      int main(void)
      {
      int a{500};
      std::random_device rd{};
      std::uniform_int_distribution<int> dist(0, 100000);
      a = dist(rd);
      std::cout <<a << std::endl;
      return 0;
      }
      --------------------------------------------------
      81873
    • read from user

      $ snippet cpp -r -p
      Please input your code, make sure your code correct.
      Enter @@CODEEND input.
      int main() {
          std::cout <<"Hello World" << std::endl;
      }
      @@CODEEND
      --------------------------------------------------
      #include <iostream>
      int main() {
          std::cout <<"Hello World" << std::endl;
      }
      --------------------------------------------------
      Hello World
    • file

      $ snippet cpp *.cpp
      Hello World!!

Installation

zef install App::snippet

License

GPL

Author

araraloren (blackcatoverwall#gmail.com)