<commit_before>#include "../src/mapper_internal.h"
#include <mapper/mapper.h>
#include <stdio.h>
#include <math.h>
#include <lo/lo.h>

#include <unistd.h>
#include <signal.h>

#ifdef WIN32
#define usleep(x) Sleep(x/1000)
#endif

int automate = 1;

mapper_device source = 0;
mapper_device destination = 0;
mapper_signal sendsig;
mapper_signal recvsig;

int sent = 0;
int received = 0;
int done = 0;

void insig_handler(mapper_signal sig, mapper_db_signal props,
                   int instance_id, void *value, int count,
                   mapper_timetag_t *timetag)
{
    if (value) {
        if (props->type == 'f')
            printf("--> %s got %f\n", props->is_output ?
                   "source" : "destination", (*(float*)value));
        else if (props->type == 'i')
            printf("--> %s got %i\n", props->is_output ?
                   "source" : "destination", (*(int*)value));
    }
    else {
        printf("--> %s got NIL\n", props->is_output ?
               "source" : "destination");
    }
    received++;
}

/*! Creation of a local source. */
int setup_source()
{
    source = mdev_new("testreverse-send", 0, 0);
    if (!source)
        goto error;
    printf("source created.\n");

    float mn=0, mx=10;

    sendsig = mdev_add_output(source, "/outsig", 1, 'i', 0, &mn, &mx);
    msig_set_callback(sendsig, insig_handler, 0);

    printf("Output signals registered.\n");
    printf("Number of outputs: %d\n", mdev_num_outputs(source));

    return 0;

  error:
    return 1;
}

void cleanup_source()
{<commit_msg>Fixed min/max datatypes in testreverse program.<commit_after>#include "../src/mapper_internal.h"
#include <mapper/mapper.h>
#include <stdio.h>
#include <math.h>
#include <lo/lo.h>

#include <unistd.h>
#include <signal.h>

#ifdef WIN32
#define usleep(x) Sleep(x/1000)
#endif

int automate = 1;

mapper_device source = 0;
mapper_device destination = 0;
mapper_signal sendsig;
mapper_signal recvsig;

int sent = 0;
int received = 0;
int done = 0;

void insig_handler(mapper_signal sig, mapper_db_signal props,
                   int instance_id, void *value, int count,
                   mapper_timetag_t *timetag)
{
    if (value) {
        if (props->type == 'f')
            printf("--> %s got %f\n", props->is_output ?
                   "source" : "destination", (*(float*)value));
        else if (props->type == 'i')
            printf("--> %s got %i\n", props->is_output ?
                   "source" : "destination", (*(int*)value));
    }
    else {
        printf("--> %s got NIL\n", props->is_output ?
               "source" : "destination");
    }
    received++;
}

/*! Creation of a local source. */
int setup_source()
{
    source = mdev_new("testreverse-send", 0, 0);
    if (!source)
        goto error;
    printf("source created.\n");

    int mn=0, mx=10;

    sendsig = mdev_add_output(source, "/outsig", 1, 'i', 0, &mn, &mx);
    msig_set_callback(sendsig, insig_handler, 0);

    printf("Output signals registered.\n");
    printf("Number of outputs: %d\n", mdev_num_outputs(source));

    return 0;

  error:
    return 1;
}

void cleanup_source()
{
{'fraction_non_alphanumeric': 0.1599229287090559, 'fraction_numerical': 0.014129736673089274, 'mean_word_length': 2.664705882352941, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3665558', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1083, 'n_words': 275}