<commit_before>﻿using System;
using System.IO;
using Wasm.Binary;

namespace Wasm.Cat
{
    // wasm-cat takes WebAssembly files as input and concatenates their sections.

    public static class Program
    {
        public static int Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.Error.WriteLine("usage: wasm-cat file.wasm...");
                return 1;
            }

            var file = new WasmFile();
            foreach (var path in args)
            {
                using (var fileStream = File.OpenRead(path))
                {
                    using (var reader = new BinaryReader(fileStream))
                    {
                        // Create a WebAssembly reader, read the file and append its
                        // sections to the resulting file.
                        var wasmReader = new BinaryWasmReader(reader);
                        file.Sections.AddRange(wasmReader.ReadFile().Sections);<commit_msg>Preserve version numbers in wasm-cat<commit_after>﻿using System;
using System.IO;
using Wasm.Binary;

namespace Wasm.Cat
{
    // wasm-cat takes WebAssembly files as input and concatenates their sections.

    public static class Program
    {
        public static int Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.Error.WriteLine("usage: wasm-cat file.wasm...");
                return 1;
            }

            var file = new WasmFile();
            foreach (var path in args)
            {
                using (var fileStream = File.OpenRead(path))
                {
                    using (var reader = new BinaryReader(fileStream))
                    {
                        // Create a WebAssembly reader, read the file and append its
                        // sections to the resulting file.
                        var wasmReader = new BinaryWasmReader(reader);
                        var inputFile = wasmReader.ReadFile();
                        file.Sections.AddRange(inputFile.Sections);

                        // Also, set the WebAssembly version number to the max of the
                        // input files.
                        if (inputFile.Header.Version > file.Header.Version)
                        {
                            file.Header = inputFile.Header;
                        }
{'fraction_non_alphanumeric': 0.07650273224043716, 'fraction_numerical': 0.0016813787305590584, 'mean_word_length': 1.2666666666666666, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '3582716', 'n_tokens_mistral': 582, 'n_tokens_neox': 540, 'n_words': 170}