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++, Objective‑C, C#, or Python program. There are also compile options for 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.

The following Examples show how to call the Artistic Style shared library using the various programming languages. They are command line programs and do NOT contain a Graphical User Interface for the Artistic Style options. Their purpose is to demonstrate the various calling procedures.

Source code for all examples and the test files can be downloaded below or obtained from the Subversion repository. These projects also require the source from Artistic Style in addition to the development examples. There is information on checking files out of the repository on the Artistic Style Subversion page.

You can also browse the subversion repository. The current development release is in the "trunk" directory. This gives you a view of the project's code without actually checking-out the files.

Examples

Source code from the following examples can be copied and pasted into an editor or development environment for compiling and running. Or the source code can be downloaded from the "Source Code Downloads" section below. The code highlighting for the example html pages was done with Highlight.

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 Artistic Style libraries.

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

Objective‑C on Windows and Linux contains information on compiling and running Objective-C programs using GNUstep. It has instructions for compiling the Example program on Windows or Linux.

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 (JNI). 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.

Calling Artistic Style from a Python Script contains information on calling Artistic Style as a shared library from a Python script. It includes a sample Python script that can be used to test the shared library.

Source Code Downloads

The downloads contain the above example source files and the test data. The test data is the same for all downloads.

C++ Example

The example for C++ contains the methods to call Artistic Style from a static or shared library using a C++ program. Compile Artistic Style as a static or shared library using the macro ASTYLE_LIB. Copy the shared library to the same folder as the C++ Example executable. Compile Example.cpp as an executable and link it to the library. It will format files in the test‑data directory included in the download.

Objective‑C Example

The example for Objective‑C contains the methods to call Artistic Style from a static or shared library using an Objective‑C program. Compile Artistic Style as a static or shared llibrary using the macro ASTYLE_LIB. Copy the shared library to the same folder as the Objective‑C Example executable. It will format files in the test‑data directory included in the download.

Java Example

The example for Java includes an AStyleInterface class that calls 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 files in the test‑data directory included in the download.

C# Example

The example for C# includes an AStyleInterface class that calls 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 files in the test‑data directory included in the download.

Python Examples

This download contains three Python scripts. The script ExampleExe.py calls an Artistic Style executable to format C++ source code. The scripts ExampleByte.py and ExampleUnicode.py call the Artistic Style shared library. The executable and shared library must be compiled using the macro ASTYLE_LIB. Copy the executable and shared library to the same folder as the Python scripts. They will format files in the test‑data directory included in the download.