[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.4.1 Basic Library Utilization
Here is a basic example showing how it is possible to use the CLooG library,
assuming that a standard installation has been done.
The following C program reads a CLooG input file on the standard input,
then prints the solution on the standard output.
Options are preselected to the default values of the CLooG software.
This example is provided in the example
directory of the
CLooG distribution.
/* example.c */ # include <stdio.h> # include <cloog/cloog.h> int main() { CloogState *state; CloogInput *input; CloogOptions *options ; struct clast_stmt *root; /* Setting options and reading program informations. */ state = cloog_state_malloc(); options = cloog_options_malloc(state); input = cloog_input_read(stdin, options); /* Generating and printing the code. */ root = cloog_clast_create_from_input(input, options); clast_pprint(stdout, root, 0, options); cloog_clast_free(root); cloog_options_free(options) ; cloog_state_free(state); return 0; }
The compilation (with default isl/GMP version installed) command could be:
gcc -DCLOOG_INT_GMP example.c -lcloog-isl -o example
A calling command with the input file test.cloog could be:
more test.cloog | ./example
This document was generated on August 20, 2013 using texi2html 5.0.