This document describes a sample program from the GetReuse SDK and provides information how to compile and link your programs with the GetReuse SDK.
Somewhere in an include-section of your program, include a declaration of the GetReuse SDK functions:
#include <getreuse.h>
Having buffers of bytes buf1 and buf2, calculate a similarity between content of the buffers as follows.
Use the function gr_measure to calculate similarity between buf1 and buf2 and between buf2 and buf1.
Compare results of calculations with zero in order to to check if the function gr_measure signals an error, and if so, use the function gr_error to get a text of the last error.
Use the function gr_adjust to calculate the final similarity between buf1 and buf2 by two one-way similarities.
These steps are demonstrated in details by a sample program.
The folder examples/c from the GetReuse SDK distribution contains the sample code distcalc.c.
The command-line program distcalc gets a list of files as arguments. For each pair of files f1 and f2, the program prints a line of information into the standard output. The information line consists of five information units divided by the TAB character:
Name of the file f1
Name of the file f2
Value of similarity between f1 and f2 using f1 as dictionary.
Value of similarity between f2 and f1 using f2 as dictionary.
Average value of similarity between f1 and f2
The GetReuse SDK contains a test data that is located in the folder tests/data. The program distcalc should correctly work with these files and produce result that is the same as the content of the file tests/etalon_output.
In order to compile a program with the GetReuse SDK elements, you should specify to a compiler:
Location of the header file
Location of the library file
These settings are compiler-dependent. Settings for the gcc compiler and the Microsoft Visual C compiler are described below.
Parameter -Idir is used to add directory dir to the list of directories to be searched for header files. Substitute dir by a path to the folder with the GetReuse SDK header file getreuse.h.
In order to link with the GetReuse SDK code library, just add a path to the library (including file name) into parameters of a compiler or a linker.
Alternate way to link with GetReuse SDK code library is to specify parameters -lgetreuse -Ldir where dir is a directory with the GetReuse SDK library file libgetreuse.a.
Directory examples/c contains the sample Makefile that demonstrates a compilation of the sample program.
$ make cc -I../../include -Wall -c -o distcalc.o distcalc.c cc -o distcalc distcalc.o ../../libs/linux586/libgetreuse.a
In order to specify folder to be searched for the GetReuse SDK header file getreuse.h, go to menu Project, submenu Settings. In the Project Settings window, select All Configurations as Settings for, switch to the tab C/C++, find Proprocessor in Category and add folder name into the Additional include deirectories field.
In order to link with the GetReuse SDK code library, add a path to the library (including file name) into the linker parameters. In the Project Settings window, switch to the tab Link, find General in Category and add the path into the field Object/library modules.
There are four libraries for different configurations of the Microsoft Visual C compiler:
getreuse.lib for the “Single-Threaded Release” configuration
getreused.lib for the “Single-Threaded Debug” configuration
getreusemt.lib for the “Multithreaded Release” configuration
getreusemtd.lib for the “Multithreaded Debug” configuration
The folder examples/c/msvc contains the sample workspace and project files for Microsoft Visual C.
© 2003, 2004 DataHansa software. All rights reserved.
All registered names are the property of their respective owners.