Artistic Style Developer Information

 

Artistic Style has compile options for creating a shared library (DLL) or static library for use with a Graphical User Interface (GUI). The shared library can be called from a C++ or C# program. It also contains a Java Native Interface (JNI) that allows it to be called from a Java program. Information on compiling the various configurations of Artistic Style is in the Install Information.

Examples

Source code from the following examples can be copied and pasted into an editor or development environment for compiling and running. The Test Data can be obtained from the corresponding download in the following Downloads section.

Calling Artistic Style from a C++ Program contains information on calling Artistic Style as a shared or static library from a C++ program. It includes a C++ sample program that can be used to test the library.

Calling Artistic Style as a Java Native Interface contains information on calling Artistic Style as a shared library from a Java program using the Java Native Interface. It includes a Java sample program that can be used to test the shared library. The Java Development Kit (JDK) must be installed to compile Artistic Style.

Calling Artistic Style from a C# Program contains information on calling Artistic Style as a shared library from a C# program. It includes a C# sample program that can be used to test the shared library.

Downloads

The downloads are source code files that contain a more extensive example of the sample programs. The AStyleInterface class can be used by another program to call Artistic Style. It contains functions to load the shared library, build an option list, call the GetVersion and Format functions, and handle errors. An example program demonstrates using the class. Test data is included with the download.

C++ Interface

Example2 for C++ includes an AStyleInterface class that builds the option string and contains the error handling and memory allocation functions. Compile Artistic Style as a shared or static library using the macro ASTYLE_LIB. Compile Example2.cpp and AStyleInterface.cpp as an executable and link it to the library. It will format cpp and h files in the test-c directory. Artistic Style and the interface programs could also be compiled as a single executable.

Java Interface

Example2 for Java includes an AStyleInterface class that builds the option string and contains the methods to call the shared library using the Java Native Interface (JNI). Artistic Style must be compiled as a shared library using the macro ASTYLE_JNI. Copy the shared library to the same folder as the Java class files (it is loaded from the classpath directory). It will format java files in the test-j directory.

C# Interface

Example2 for C# includes an AStyleInterface class that builds the option string and contains the methods to call the shared library using a C# program. Compile Artistic Style as a shared library using the macro ASTYLE_LIB. Copy the shared library to the same folder as the C# class files (C# does a Windows type search for the shared library, looking first in the startup program's directory). It will format C# files in the test-s directory.