forked from andre-simon/highlight
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtestmod.pl
36 lines (26 loc) · 1.03 KB
/
testmod.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Perl SWIG module test script
#
# Import highlight.pm, which is the interface for the highlight.so module.
# See highlight.pm for all available attributes and class members.
use highlight;
#get a generator instance (for HTML output)
my $gen = highlight::CodeGenerator::getInstance($highlight::CodeGenerator::HTML);
my $dir = new highlight::DataDir();
#$dir->searchDataDir("");
$dir->initSearchDirectories("");
my $themepath=$dir->getThemePath("seashell.theme");
my $langpath=$dir->getLangPath("c.lang");
#initialize the generator with a colour theme and the language definition
$gen->initTheme($themepath);
$gen->loadLanguage($langpath);
#set some parameters
$gen->setIncludeStyle(1);
$gen->setEncoding("ISO-8859-1");
#get output string
my $output=$gen->generateString("int main(int argc, char **argv) {\n".
" HighlightApp app;\n".
" return app.run(argc, argv);\n".
"}\n");
print $output;
# clear the instance
highlight::CodeGenerator::deleteInstance($gen);