Scripal: Starting in C++

Installation

prerequisites

clean build (else skip to ready to use packages)

build Scripal under Linux
build Scripal under Windows

ready to use packages

install packages

C++ module

See how to use Scripal in C++ main.cpp.
Every single thread must call initLibrary(config, encoding) to specify the entire path to the config file used (leave empty for default) and the encodig of the OS environment. ENC_DEFAULT will denote the standard. For compile options see below.

run C++ test program scripal

C++ example main.cpp

#include <stdio.h> 
#include "scripal/scripalLib.hpp"

int main(int argc, char **argv) {
  using namespace Scripal;
  initLibrary(""); // put path to your own config file here, "" = use default

  std::cout << "version: " << Scripal::VERSION << "\n\n";

  // set time measurement on
  getConfig()->set("measureTime", true);

  // scripal object
  auto obj = new TFScripal("match find('235')");;
  if (obj->match("(234) 235-5678")) {
    std::cout << "results: " << obj->results.size() << " , '" << \
    obj->results.text[0] << "'" << "  position: " << obj->results.positions[0][0] << \
    ", " << obj->results.positions[0][1] << "\n\n";
  }
  exit(0);

};

Compile and link against Scripal library using gcc/g++ or Microsoft MSVC, other compilers have not been tested. Make sure that at least C++17 standard is supported.

Built example using g++:

g++ -c "main.cpp" -std=c++17 -Wall -o main.cpp.o -I.
g++ -o scripalTest main.cpp.o -lscripal 

calling scripalTest should result in something like:

version: 01.02.0

results: 1 , '235'  position: 6, 8

Also look at the Visual Studio Code (Linux) or Visual Studio (Windows) projects in .https://github.com/scripal-git/scripal/blob/main/wrapper/c++.

under Windows:
To tell Scripal about your Poco Build: open Developer Powershell in Visual Studio and execute

[Environment]::SetEnvironmentVariable("POCO_BASE", "XXX_PATH_XXX", "User")

where XXX_PATH_XXX ist the full path to your Poco folder

For more information see matching with Scripal and C++ library.