--- /dev/null
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include "ppport.h"
+
+#include "../pairwise.h"
+
+#include <strings.h>
+
+MODULE = Pairwise PACKAGE = Pairwise
+
+void
+pairwise (file)
+ FILE *file
+ PREINIT:
+ struct fasta **seqs;
+ char **output;
+ int i = 0;
+ PPCODE:
+ /* read the sequences */
+ seqs = read_fasta(file);
+ check_length(seqs);
+
+ /* do the pairwise comparison */
+ output = do_pairwise(seqs);
+
+ /* free the sequences */
+ while (seqs[i] != NULL)
+ free_fasta(seqs[i++]);
+ free(seqs);
+
+ /* find out much output there is */
+ while (output[i] != NULL)
+ i++;
+ EXTEND(SP, i);
+
+ /* convert it to perl and free the output */
+ for (i = 0; output[i] != NULL; i++) {
+ PUSHs(sv_2mortal( newSVpv(output[i], strlen(output[i])) ));
+ free(output[i]);
+ }
+ free(output);