#include "sn_network.h"
#include "sn_random.h"
-sn_network_t *sn_network_create (int inputs_num)
+sn_network_t *sn_network_create (int inputs_num) /* {{{ */
{
sn_network_t *n;
n->inputs_num = inputs_num;
return (n);
-} /* sn_network_t *sn_network_create */
+} /* }}} sn_network_t *sn_network_create */
-void sn_network_destroy (sn_network_t *n)
+void sn_network_destroy (sn_network_t *n) /* {{{ */
{
if (n == NULL)
return;
}
free (n);
-} /* void sn_network_destroy */
+} /* }}} void sn_network_destroy */
-int sn_network_stage_add (sn_network_t *n, sn_stage_t *s)
+int sn_network_stage_add (sn_network_t *n, sn_stage_t *s) /* {{{ */
{
sn_stage_t **temp;
n->stages_num++;
return (0);
-} /* int sn_network_stage_add */
+} /* }}} int sn_network_stage_add */
-int sn_network_stage_remove (sn_network_t *n, int s_num)
+int sn_network_stage_remove (sn_network_t *n, int s_num) /* {{{ */
{
int nmemb = n->stages_num - (s_num + 1);
sn_stage_t **temp;
}
return (0);
-} /* int sn_network_stage_remove */
+} /* }}} int sn_network_stage_remove */
-sn_network_t *sn_network_clone (const sn_network_t *n)
+sn_network_t *sn_network_clone (const sn_network_t *n) /* {{{ */
{
sn_network_t *n_copy;
int i;
}
return (n_copy);
-} /* sn_network_t *sn_network_clone */
+} /* }}} sn_network_t *sn_network_clone */
-int sn_network_show (sn_network_t *n)
+int sn_network_show (sn_network_t *n) /* {{{ */
{
int i;
sn_stage_show (n->stages[i]);
return (0);
-} /* int sn_network_show */
+} /* }}} int sn_network_show */
-int sn_network_invert (sn_network_t *n)
+int sn_network_invert (sn_network_t *n) /* {{{ */
{
int i;
sn_stage_invert (n->stages[i]);
return (0);
-} /* int sn_network_invert */
+} /* }}} int sn_network_invert */
-int sn_network_compress (sn_network_t *n)
+int sn_network_compress (sn_network_t *n) /* {{{ */
{
int i;
int j;
sn_network_stage_remove (n, n->stages_num - 1);
return (0);
-} /* int sn_network_compress */
+} /* }}} int sn_network_compress */
-int sn_network_normalize (sn_network_t *n)
+int sn_network_normalize (sn_network_t *n) /* {{{ */
{
int i;
} /* for (i = n->stages_num - 1 .. 0) */
return (0);
-} /* int sn_network_normalize */
+} /* }}} int sn_network_normalize */
-int sn_network_cut_at (sn_network_t *n, int input, enum sn_network_cut_dir_e dir)
+int sn_network_cut_at (sn_network_t *n, int input, /* {{{ */
+ enum sn_network_cut_dir_e dir)
{
int i;
int position = input;
n->inputs_num--;
return (0);
-} /* int sn_network_cut_at */
+} /* }}} int sn_network_cut_at */
-static int sn_network_add_bitonic_merger_recursive (sn_network_t *n,
+static int sn_network_add_bitonic_merger_recursive (sn_network_t *n, /* {{{ */
int low, int num)
{
sn_stage_t *s;
sn_network_add_bitonic_merger_recursive (n, low + m, m);
return (0);
-} /* int sn_network_add_bitonic_merger_recursive */
+} /* }}} int sn_network_add_bitonic_merger_recursive */
-static int sn_network_add_bitonic_merger (sn_network_t *n)
+static int sn_network_add_bitonic_merger (sn_network_t *n) /* {{{ */
{
sn_stage_t *s;
int m;
sn_network_add_bitonic_merger_recursive (n, m, m);
return (0);
-} /* int sn_network_add_bitonic_merger */
+} /* }}} int sn_network_add_bitonic_merger */
-static int sn_network_add_odd_even_merger_recursive (sn_network_t *n,
+static int sn_network_add_odd_even_merger_recursive (sn_network_t *n, /* {{{ */
int *indizes, int indizes_num)
{
if (indizes_num > 2)
}
return (0);
-} /* int sn_network_add_odd_even_merger_recursive */
+} /* }}} int sn_network_add_odd_even_merger_recursive */
-static int sn_network_add_odd_even_merger (sn_network_t *n)
+static int sn_network_add_odd_even_merger (sn_network_t *n) /* {{{ */
{
int *indizes;
int indizes_num;
free (indizes);
return (status);
-} /* int sn_network_add_bitonic_merger */
+} /* }}} int sn_network_add_bitonic_merger */
-sn_network_t *sn_network_combine (sn_network_t *n0, sn_network_t *n1)
+sn_network_t *sn_network_combine (sn_network_t *n0, /* {{{ */
+ sn_network_t *n1)
{
sn_network_t *n;
int stages_num;
sn_network_compress (n);
return (n);
-} /* sn_network_t *sn_network_combine */
+} /* }}} sn_network_t *sn_network_combine */
-int sn_network_sort (sn_network_t *n, int *values)
+int sn_network_sort (sn_network_t *n, int *values) /* {{{ */
{
int status;
int i;
}
return (status);
-} /* int sn_network_sort */
+} /* }}} int sn_network_sort */
-int sn_network_brute_force_check (sn_network_t *n)
+int sn_network_brute_force_check (sn_network_t *n) /* {{{ */
{
int test_pattern[n->inputs_num];
int values[n->inputs_num];
/* All tests successfull */
return (0);
-} /* int sn_network_brute_force_check */
+} /* }}} int sn_network_brute_force_check */
-sn_network_t *sn_network_read (FILE *fh)
+sn_network_t *sn_network_read (FILE *fh) /* {{{ */
{
sn_network_t *n;
char buffer[64];
}
return (n);
-} /* sn_network_t *sn_network_read */
+} /* }}} sn_network_t *sn_network_read */
-sn_network_t *sn_network_read_file (const char *file)
+sn_network_t *sn_network_read_file (const char *file) /* {{{ */
{
sn_network_t *n;
FILE *fh;
fclose (fh);
return (n);
-} /* sn_network_t *sn_network_read_file */
+} /* }}} sn_network_t *sn_network_read_file */
-int sn_network_write (sn_network_t *n, FILE *fh)
+int sn_network_write (sn_network_t *n, FILE *fh) /* {{{ */
{
int i;
sn_stage_write (n->stages[i], fh);
return (0);
-} /* int sn_network_write */
+} /* }}} int sn_network_write */
-int sn_network_write_file (sn_network_t *n, const char *file)
+int sn_network_write_file (sn_network_t *n, const char *file) /* {{{ */
{
int status;
FILE *fh;
fclose (fh);
return (status);
-} /* int sn_network_write_file */
+} /* }}} int sn_network_write_file */
-int sn_network_serialize (sn_network_t *n, char **ret_buffer,
+int sn_network_serialize (sn_network_t *n, char **ret_buffer, /* {{{ */
size_t *ret_buffer_size)
{
char *buffer;
*ret_buffer = buffer;
*ret_buffer_size = buffer_size;
return (0);
-} /* int sn_network_serialize */
+} /* }}} int sn_network_serialize */
-sn_network_t *sn_network_unserialize (char *buffer, size_t buffer_size)
+sn_network_t *sn_network_unserialize (char *buffer, /* {{{ */
+ size_t buffer_size)
{
sn_network_t *n;
int opt_inputs = 0;
}
return (n);
-} /* sn_network_t *sn_network_unserialize */
+} /* }}} sn_network_t *sn_network_unserialize */
-/* vim: set shiftwidth=2 softtabstop=2 : */
+/* vim: set sw=2 sts=2 et fdm=marker : */