<commit_before>#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>

#include <atl.h>
#include <evpath.h>
#include <mpi.h>

#include "sst.h"

#include "cp_internal.h"

void CP_validateParams(SstStream Stream, SstParams Params, int Writer)
{
    if (Params->RendezvousReaderCount >= 0)
    {
        Stream->RendezvousReaderCount = Params->RendezvousReaderCount;
    }
    else
    {
        fprintf(stderr, "Invalid RendezvousReaderCount parameter value (%d) "
                        "for SST Stream %s\n",
                Params->RendezvousReaderCount, Stream->Filename);
    }
    if (Params->QueueLimit >= 0)
    {
        Stream->QueueLimit = Params->QueueLimit;
    }
    else
    {
        fprintf(stderr,
                "Invalid QueueLimit parameter value (%d) for SST Stream %s\n",
                Params->QueueLimit, Stream->Filename);
    }
    Stream->DiscardOnQueueFull = Params->DiscardOnQueueFull;
    Stream->RegistrationMethod = Params->RegistrationMethod;
    char *SelectedTransport = NULL;
    if (Params->DataTransport != NULL)
    {
    	int i;
        SelectedTransport = malloc(strlen(Params->DataTransport) + 1);
        for(i = 0; Params->DataTransport[i] != 0; i++)
        {
        	SelectedTransport[i] = tolower(Params->DataTransport[i]);
        }
        SelectedTransport[i] = 0;

        /* canonicalize SelectedTransport */
        if ((strcmp(SelectedTransport, "wan") == 0) ||
            (strcmp(SelectedTransport, "evpath") == 0))
        {
            Stream->DataTransport = strdup("evpath");
        }
        else if ((strcmp(SelectedTransport, "rdma") == 0) ||
                 (strcmp(SelectedTransport, "ib") == 0) ||
                 (strcmp(SelectedTransport, "fabric") == 0))
        {
            Stream->DataTransport = strdup("rdma");
        }
        free(SelectedTransport);
    }
    if (Params->DataTransport == NULL)
    {
        /* determine reasonable default, now "evpath" */
        Stream->DataTransport = strdup("evpath");
    }
}

static FMField CP_SstParamsList_RAW[] = {
#define declare_field(Param, Type, Typedecl, Default)                          \
    {#Param, #Typedecl, sizeof(Typedecl), FMOffset(struct _SstParams *, Param)},
    SST_FOREACH_PARAMETER_TYPE_4ARGS(declare_field)
#undef declare_field
        {NULL, NULL, 0, 0}};
static FMField *CP_SstParamsList = NULL;

static FMField CP_ReaderInitList[] = {
    {"ContactInfo", "string", sizeof(char *),<commit_msg>Added error message for unrecognized value of DataTransport parameter<commit_after>#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>

#include <atl.h>
#include <evpath.h>
#include <mpi.h>

#include "sst.h"

#include "cp_internal.h"

void CP_validateParams(SstStream Stream, SstParams Params, int Writer)
{
    if (Params->RendezvousReaderCount >= 0)
    {
        Stream->RendezvousReaderCount = Params->RendezvousReaderCount;
    }
    else
    {
        fprintf(stderr, "Invalid RendezvousReaderCount parameter value (%d) "
                        "for SST Stream %s\n",
                Params->RendezvousReaderCount, Stream->Filename);
    }
    if (Params->QueueLimit >= 0)
    {
        Stream->QueueLimit = Params->QueueLimit;
    }
    else
    {
        fprintf(stderr,
                "Invalid QueueLimit parameter value (%d) for SST Stream %s\n",
                Params->QueueLimit, Stream->Filename);
    }
    Stream->DiscardOnQueueFull = Params->DiscardOnQueueFull;
    Stream->RegistrationMethod = Params->RegistrationMethod;
    char *SelectedTransport = NULL;
    if (Params->DataTransport != NULL)
    {
    	int i;
        SelectedTransport = malloc(strlen(Params->DataTransport) + 1);
        for(i = 0; Params->DataTransport[i] != 0; i++)
        {
        	SelectedTransport[i] = tolower(Params->DataTransport[i]);
        }
        SelectedTransport[i] = 0;

        /* canonicalize SelectedTransport */
        if ((strcmp(SelectedTransport, "wan") == 0) ||
            (strcmp(SelectedTransport, "evpath") == 0))
        {
            Stream->DataTransport = strdup("evpath");
        }
        else if ((strcmp(SelectedTransport, "rdma") == 0) ||
                 (strcmp(SelectedTransport, "ib") == 0) ||
                 (strcmp(SelectedTransport, "fabric") == 0))
        {
            Stream->DataTransport = strdup("rdma");
        }
        else
        {
        	fprintf(stderr, "Error: Unknown value '%s' for DataTransport parameter.\n", SelectedTransport);
        	Stream->DataTransport = NULL;
        }
        free(SelectedTransport);
    }
    if (Params->DataTransport == NULL)
    {
        /* determine reasonable default, now "evpath" */
        Stream->DataTransport = strdup("evpath");
    }
}

static FMField CP_SstParamsList_RAW[] = {
#define declare_field(Param, Type, Typedecl, Default)                          \
    {#Param, #Typedecl, sizeof(Typedecl), FMOffset(struct _SstParams *, Param)},
    SST_FOREACH_PARAMETER_TYPE_4ARGS(declare_field)
#undef declare_field
        {NULL, NULL, 0, 0}};
static FMField *CP_SstParamsList = NULL;

static FMField CP_ReaderInitList[] = {
    {"ContactInfo", "string", sizeof(char *),
{'fraction_non_alphanumeric': 0.1338282885969922, 'fraction_numerical': 0.00533028745478774, 'mean_word_length': 2.586348122866894, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 70, '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': '7576291', 'n_tokens_mistral': 1650, 'n_tokens_neox': 1589, 'n_words': 330}