<commit_before>﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

using System;
using System.Runtime.InteropServices;

namespace winpty
{
    /// <summary>
    /// Native API wrapper for WinPty.
    /// </summary>
    public static class WinPty
    {
#pragma warning disable IDE1006 // Naming Styles
        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int winpty_error_code(IntPtr err);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public static extern string winpty_error_msg(IntPtr err);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern void winpty_error_free(IntPtr err);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr winpty_config_new(ulong agentFlags, out IntPtr err);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern void winpty_config_free(IntPtr cfg);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern void winpty_config_set_initial_size(IntPtr cfg, int cols, int rows);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr winpty_open(IntPtr cfg, out IntPtr err);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstLPWStrMarshaler))]
        public static extern string winpty_conin_name(IntPtr wp);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstLPWStrMarshaler))]
        public static extern string winpty_conout_name(IntPtr wp);<commit_msg>Use custom marshaler for winpty_error_msg too<commit_after>﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

using System;
using System.Runtime.InteropServices;

namespace winpty
{
    /// <summary>
    /// Native API wrapper for WinPty.
    /// </summary>
    public static class WinPty
    {
#pragma warning disable IDE1006 // Naming Styles
        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int winpty_error_code(IntPtr err);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstLPWStrMarshaler))]
        public static extern string winpty_error_msg(IntPtr err);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern void winpty_error_free(IntPtr err);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr winpty_config_new(ulong agentFlags, out IntPtr err);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern void winpty_config_free(IntPtr cfg);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern void winpty_config_set_initial_size(IntPtr cfg, int cols, int rows);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr winpty_open(IntPtr cfg, out IntPtr err);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstLPWStrMarshaler))]
        public static extern string winpty_conin_name(IntPtr wp);

        [DllImport("winpty.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstLPWStrMarshaler))]
        public static extern string winpty_conout_name(IntPtr wp);
{'fraction_non_alphanumeric': 0.08895265423242468, 'fraction_numerical': 0.003825920612147298, 'mean_word_length': 4.21571072319202, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3584868', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1247, 'n_words': 290}