<commit_before>/* win32 version of yaws starup script */
/* Author: <EMAIL> (Jan 2009) */


#include <windows.h>
#include <stdio.h>

#define BSIZ 16000

static unsigned char path[BSIZ];
static unsigned char *fpath;

static void readreg() {
    HKEY hKey;
    unsigned int bsz = BSIZ;
    // Check where yaws is installed, we need to -pa that path
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
                     "SOFTWARE\\Hyber\\Yaws",
                     0, KEY_READ, &hKey) != ERROR_SUCCESS)
        {
            printf ("Cannot find yaws installation in the registry\n");
            exit(1);
        }
    memset(path, 0, BSIZ);
    int ret = RegQueryValueEx(hKey, "DIR", NULL, NULL, path, &bsz);
    fpath = (unsigned char*)malloc(strlen(path));
    int i;
    for(i = 0; i<strlen(path); i++ ) {
        if (path[i] == '\\') {
            fpath[i] = '/';
        }
        else 
            fpath[i] = path[i];
    }
    fpath[i] = 0;
    
}


int charg(char **argv, char *s1, char *s2, int p) {
    if (strcmp(s1, argv[p]) == 0) return 1;
    if ((s2 != NULL) && strcmp(s2, argv[p]) == 0) return 1;
    return 0;
}


int runwait(char *execString) {
    
    STARTUPINFO          si = { sizeof(si) };
    PROCESS_INFORMATION  pi;

    //printf("execString: %s \n", execString);

    if(CreateProcess(0, execString, NULL, NULL, FALSE, 0, 0, 0, &si, &pi))
        {
            unsigned long ret = 0;
            
            // wait for process to finish
            WaitForSingleObject(pi.hProcess, INFINITE);
            if (GetExitCodeProcess(pi.hProcess, &ret) == 0)
                ret = 1;
            CloseHandle(pi.hProcess);
            CloseHandle(pi.hThread);
            return ret;
        }
    printf("Failed to create the process entirely\n");
    return 1;
}



int nosh(char *s) {
    char buf[BUFSIZ];
    sprintf (buf, "erl -noshell -pa \"%s/ebin\" %s ", fpath, s);
    return runwait(buf);
}

int help() {
    printf("usage:  "<commit_msg>Better error msg if erl is not found for win32 users<commit_after>/* win32 version of yaws starup script */
/* Author: <EMAIL> (Jan 2009) */


#include <windows.h>
#include <stdio.h>

#define BSIZ 16000

static unsigned char path[BSIZ];
static unsigned char *fpath;

static void readreg() {
    HKEY hKey;
    unsigned int bsz = BSIZ;
    // Check where yaws is installed, we need to -pa that path
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
                     "SOFTWARE\\Hyber\\Yaws",
                     0, KEY_READ, &hKey) != ERROR_SUCCESS)
        {
            printf ("Cannot find yaws installation in the registry\n");
            exit(1);
        }
    memset(path, 0, BSIZ);
    int ret = RegQueryValueEx(hKey, "DIR", NULL, NULL, path, &bsz);
    fpath = (unsigned char*)malloc(strlen(path));
    int i;
    for(i = 0; i<strlen(path); i++ ) {
        if (path[i] == '\\') {
            fpath[i] = '/';
        }
        else 
            fpath[i] = path[i];
    }
    fpath[i] = 0;
    
}


int charg(char **argv, char *s1, char *s2, int p) {
    if (strcmp(s1, argv[p]) == 0) return 1;
    if ((s2 != NULL) && strcmp(s2, argv[p]) == 0) return 1;
    return 0;
}


int runwait(char *execString) {
    
    STARTUPINFO          si = { sizeof(si) };
    PROCESS_INFORMATION  pi;

    //printf("execString: %s \n", execString);

    if(CreateProcess(0, execString, NULL, NULL, FALSE, 0, 0, 0, &si, &pi))
        {
            unsigned long ret = 0;
            
            // wait for process to finish
            WaitForSingleObject(pi.hProcess, INFINITE);
            if (GetExitCodeProcess(pi.hProcess, &ret) == 0)
                ret = 1;
            CloseHandle(pi.hProcess);
            CloseHandle(pi.hThread);
            return ret;
        }
    printf("Failed to create the process entirely\n");
    printf("Tried to invoke: <%s> \n", execString);
    printf("Make sure you have <erl> in your environment PATH \n"); 
    return 1;
}



int nosh(char *s) {
    char buf[BUFSIZ];
    sprintf (buf, "erl -noshell -pa \"%s/ebin\" %s ", fpath, s);
    return runwait(buf);
}

int help() {
    printf("usage:  "
{'fraction_non_alphanumeric': 0.14456947162426614, 'fraction_numerical': 0.017123287671232876, 'mean_word_length': 2.037890044576523, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '1010909', 'n_tokens_mistral': 1474, 'n_tokens_neox': 1399, 'n_words': 398}