<commit_before>#include <cstdlib>
#include <iostream>
#include <vector>
#include <sstream>
#include <string>

#include <hdf5.h>
#include <hdf5_hl.h>

#include "tppmatrix.h"
#include "omxmatrix.h"

#include "stdutil.h"
#include "define.h"

int convertMat2h5(char *);
int convertH5toMat(char *);
string get_h5_name(char *filename);
string get_tpp_name(char *filename);

int copy_data(TPPMatrix*, OMXMatrix*, int, int, vector<string>&);
int copy_data(OMXMatrix*, TPPMatrix*, int, int);

hid_t _memspace = -1;
hid_t _dataspace = -1;

int main(int argc, char* argv[])
{
    // Get cmdline parameters
    // for each input .mat file
    cout << "\nCube MAT/OMX Converter (built " << __DATE__ << ")\n";
    int errors = 0;

    for (int i=1; i<argc; i++) {
        char *tpfilename = argv[i];
        printf("\n\nConverting %s to ",tpfilename);

        // Figure out which way we're converting:
        string str(tpfilename);
        int v;

        if (((size_t)str.find(".omx")==string::npos) &&
            ((size_t)str.find(".OMX")==string::npos)) {
            v = convertMat2h5(tpfilename);
        } else {
            v = convertH5toMat(tpfilename);
        }

        if (v!=0) {
            printf(">> Failed to convert %s.",tpfilename);
            errors += v;
        }
    }

    printf("\nDone; %d errors and %d of %d completed.\n",errors,argc-errors-1,argc-1);
}

int convertMat2h5(char *filename) {<commit_msg>Add usage msg<commit_after>#include <cstdlib>
#include <iostream>
#include <vector>
#include <sstream>
#include <string>

#include <hdf5.h>
#include <hdf5_hl.h>

#include "tppmatrix.h"
#include "omxmatrix.h"

#include "stdutil.h"
#include "define.h"

int convertMat2h5(char *);
int convertH5toMat(char *);
string get_h5_name(char *filename);
string get_tpp_name(char *filename);

int copy_data(TPPMatrix*, OMXMatrix*, int, int, vector<string>&);
int copy_data(OMXMatrix*, TPPMatrix*, int, int);

hid_t _memspace = -1;
hid_t _dataspace = -1;

int main(int argc, char* argv[])
{
    // Get cmdline parameters
    // for each input .mat file
    cout << "\nCube MAT/OMX Converter (built " << __DATE__ << ")\n";
    int errors = 0;

    if (argc==1) {
		cout << "\nUsage:  cube2omx.exe  [filename1] [filename2] ...\n";
		cout << "        - Files ending in .omx or .OMX will be converted from OMX to Cube\n";
		cout << "        - Files ending in anything else will be converted from Cube to OMX\n\n";
		exit(0);
    }

    for (int i=1; i<argc; i++) {
        char *tpfilename = argv[i];
        printf("\n\nConverting %s to ",tpfilename);

        // Figure out which way we're converting:
        string str(tpfilename);
        int v;

        if (((size_t)str.find(".omx")==string::npos) &&
            ((size_t)str.find(".OMX")==string::npos)) {
            v = convertMat2h5(tpfilename);
        } else {
            v = convertH5toMat(tpfilename);
        }

        if (v!=0) {
            printf(">> Failed to convert %s.",tpfilename);
            errors += v;
        }
    }

    printf("\nDone; %d errors and %d of %d completed.\n",errors,argc-errors-1,argc-1);
}

int convertMat2h5(char *filename) {
{'fraction_non_alphanumeric': 0.16171300735059124, 'fraction_numerical': 0.01310322786832854, 'mean_word_length': 2.8357843137254903, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 23, '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': '1397443', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1125, 'n_words': 282}