<commit_before>// CoolPropMathcad.cpp : Defines the exported functions for the DLL Add-in.
//

#include <string>

#ifndef NOMINMAX; // Kill window's horrible min() and max() macros
#include "mcadincl.h"
#undef NOMINMAX; 

enum { MC_STRING = STRING };  // substitute enumeration variable MC_STRING for STRING, use MC_STRING below
#undef STRING                 // undefine STRING as it conflicts with STRING enum in cppformat/format.h

#include "CoolProp.h"
#include "HumidAirProp.h"



enum EC { INTERRUPTED, INSUFFICIENT_MEMORY, MUST_BE_REAL, NUMBER_OF_ERRORS = MUST_BE_REAL };   // Mathcad Error Codes

    // table of error messages
    // if user function never returns an
    // error -- you do not need to create this
    // table
    char * myErrorMessageTable[NUMBER_OF_ERRORS] =  
    {   
        "Interrupted"
        "Insufficient Memory"
        "Argument must be real"
    };
    
    // this code executes the user function CP_get_global_param_string, which is a wrapper for
    // the CoolProp.get_global_param_string() function, used to get a global string parameter from CoolProp
    LRESULT  CP_get_global_param_string(
                            LPMCSTRING ParamValue,   // output (value of parameter)
                            LPCMCSTRING ParamName )  // name of parameter (string) to retrieve
    {  
        // Invoke the std::string form of get_global_param_string() function, save result to a new string s
        std::string s = CoolProp::get_global_param_string(ParamName->str);
        char * c = new char [s.size()+1]; // creat a c-string (pointer) c with the same size as s
        // copy s into c, this process avoids the const-cast type which would result from instead
        // converting the string using s.c_str()
        std::copy(s.begin(), s.end(), c); 
        c[s.size()] = '\0';
        // assign the string to the function's output parameter
        ParamValue->str = c;
<commit_msg>Another try at MathCAD<commit_after>// CoolPropMathcad.cpp : Defines the exported functions for the DLL Add-in.
//

#include <string>

#ifndef NOMINMAX // Kill windows' horrible min() and max() macros
#define NOMINMAX
#endif
#include "mcadincl.h"
#undef NOMINMAX; 

enum { MC_STRING = STRING };  // substitute enumeration variable MC_STRING for STRING, use MC_STRING below
#undef STRING                 // undefine STRING as it conflicts with STRING enum in cppformat/format.h

#include "CoolProp.h"
#include "HumidAirProp.h"

enum EC { INTERRUPTED, INSUFFICIENT_MEMORY, MUST_BE_REAL, NUMBER_OF_ERRORS = MUST_BE_REAL };   // Mathcad Error Codes

    // table of error messages
    // if user function never returns an
    // error -- you do not need to create this
    // table
    char * myErrorMessageTable[NUMBER_OF_ERRORS] =  
    {   
        "Interrupted"
        "Insufficient Memory"
        "Argument must be real"
    };
    
    // this code executes the user function CP_get_global_param_string, which is a wrapper for
    // the CoolProp.get_global_param_string() function, used to get a global string parameter from CoolProp
    LRESULT  CP_get_global_param_string(
                            LPMCSTRING ParamValue,   // output (value of parameter)
                            LPCMCSTRING ParamName )  // name of parameter (string) to retrieve
    {  
        // Invoke the std::string form of get_global_param_string() function, save result to a new string s
        std::string s = CoolProp::get_global_param_string(ParamName->str);
        char * c = new char [s.size()+1]; // creat a c-string (pointer) c with the same size as s
        // copy s into c, this process avoids the const-cast type which would result from instead
        // converting the string using s.c_str()
        std::copy(s.begin(), s.end(), c); 
        c[s.size()] = '\0';
        // assign the string to the function's output parameter
        ParamValue->str = c;

{'fraction_non_alphanumeric': 0.08873456790123457, 'fraction_numerical': 0.00102880658436214, 'mean_word_length': 2.6109563602599812, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6026838', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1123, 'n_words': 404}