From 7a4c3965608d3af3eecd0ade99ffac7c5347a63e Mon Sep 17 00:00:00 2001 From: Fernando Brito Date: Thu, 2 Dec 2010 15:42:44 -0300 Subject: [PATCH] Add text/x-prolog --- freedesktop.org.xml.in | 11 +++++++++-- tests/list | 5 ++++- tests/test-perl.pl | 24 ++++++++++++++++++++++++ tests/test-prolog.pl | 20 ++++++++++++++++++++ tests/test.pro | 20 ++++++++++++++++++++ tests/test.prolog | 20 ++++++++++++++++++++ 6 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 tests/test-perl.pl create mode 100644 tests/test-prolog.pl create mode 100644 tests/test.pro create mode 100644 tests/test.prolog diff --git a/freedesktop.org.xml.in b/freedesktop.org.xml.in index cd72ed4..0406a85 100644 --- a/freedesktop.org.xml.in +++ b/freedesktop.org.xml.in @@ -2564,17 +2564,24 @@ command to generate the output files. + + <_comment>Prolog source file + + + + + <_comment>Perl script - + - + diff --git a/tests/list b/tests/list index b7f9447..a34ea8f 100644 --- a/tests/list +++ b/tests/list @@ -233,7 +233,10 @@ test.mml application/mathml+xml ox # Copied from http://doc.trolltech.com/4.4/linguist-hellotr.html linguist.ts text/vnd.trolltech.linguist test.xsl application/xslt+xml -test.cbl text/x-cobol ox +test.pro text/x-prolog ox +test.prolog text/x-prolog ox +test-prolog.pl text/x-prolog ox +test-perl.pl application/x-perl xoo # Archives # Copied from http://bugs.freedesktop.org/show_bug.cgi?id=14909 diff --git a/tests/test-perl.pl b/tests/test-perl.pl new file mode 100644 index 0000000..a083713 --- /dev/null +++ b/tests/test-perl.pl @@ -0,0 +1,24 @@ +#!/usr/local/bin/perl +# +# rename series of frames +# +if ($#ARGV != 3) { + print "usage: rename old new start stop\n"; + exit; +} + +$old = $ARGV[0]; +$new = $ARGV[1]; +$start = $ARGV[2]; +$stop = $ARGV[3]; + +for ($i=$start; $i <= $stop; $i++) { + + $num = $i; + if($i<10) { $num = "00$i"; } + elsif($i<100) { $num = "0$i"; } + + $cmd = "mv $old.$num $new.$num"; + print $cmd."\n"; + if(system($cmd)) { print "rename failed\n"; } +} diff --git a/tests/test-prolog.pl b/tests/test-prolog.pl new file mode 100644 index 0000000..21c82df --- /dev/null +++ b/tests/test-prolog.pl @@ -0,0 +1,20 @@ +% test.pl -- quicksort implementation + +/* [+,-] */ +quicksort([], []). +quicksort([HEAD | TAIL], SORTED) :- partition(HEAD, TAIL, LEFT, RIGHT), + quicksort(LEFT, SORTEDL), + quicksort(RIGHT, SORTEDR), + append(SORTEDL, [HEAD | SORTEDR], SORTED). + +/* [+,+,-,-] */ +partition(PIVOT, [], [], []). +partition(PIVOT, [HEAD | TAIL], [HEAD | LEFT], RIGHT) :- HEAD @=< PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). +partition(PIVOT, [HEAD | TAIL], LEFT, [HEAD | RIGHT]) :- HEAD @> PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). + +/* [+,+,-] */ +append([], LIST, LIST). +append([HEAD | LIST1], LIST2, [HEAD | LIST3]) :- append(LIST1, LIST2, LIST3). + diff --git a/tests/test.pro b/tests/test.pro new file mode 100644 index 0000000..ebe365c --- /dev/null +++ b/tests/test.pro @@ -0,0 +1,20 @@ +% test.pro -- quicksort implementation + +/* [+,-] */ +quicksort([], []). +quicksort([HEAD | TAIL], SORTED) :- partition(HEAD, TAIL, LEFT, RIGHT), + quicksort(LEFT, SORTEDL), + quicksort(RIGHT, SORTEDR), + append(SORTEDL, [HEAD | SORTEDR], SORTED). + +/* [+,+,-,-] */ +partition(PIVOT, [], [], []). +partition(PIVOT, [HEAD | TAIL], [HEAD | LEFT], RIGHT) :- HEAD @=< PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). +partition(PIVOT, [HEAD | TAIL], LEFT, [HEAD | RIGHT]) :- HEAD @> PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). + +/* [+,+,-] */ +append([], LIST, LIST). +append([HEAD | LIST1], LIST2, [HEAD | LIST3]) :- append(LIST1, LIST2, LIST3). + diff --git a/tests/test.prolog b/tests/test.prolog new file mode 100644 index 0000000..6a141d4 --- /dev/null +++ b/tests/test.prolog @@ -0,0 +1,20 @@ +% test.prolog -- quicksort implementation + +/* [+,-] */ +quicksort([], []). +quicksort([HEAD | TAIL], SORTED) :- partition(HEAD, TAIL, LEFT, RIGHT), + quicksort(LEFT, SORTEDL), + quicksort(RIGHT, SORTEDR), + append(SORTEDL, [HEAD | SORTEDR], SORTED). + +/* [+,+,-,-] */ +partition(PIVOT, [], [], []). +partition(PIVOT, [HEAD | TAIL], [HEAD | LEFT], RIGHT) :- HEAD @=< PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). +partition(PIVOT, [HEAD | TAIL], LEFT, [HEAD | RIGHT]) :- HEAD @> PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). + +/* [+,+,-] */ +append([], LIST, LIST). +append([HEAD | LIST1], LIST2, [HEAD | LIST3]) :- append(LIST1, LIST2, LIST3). + -- 1.7.1