<commit_before>#include <fudge.h>
#include "token.h"
#include "parse.h"

static unsigned int walk_path(unsigned int index, unsigned int indexw, unsigned int count, char *buffer)
{

    if (memory_match(buffer, "/", 1))
        return call_walk(index, CALL_DR, count - 1, buffer + 1);

    return call_walk(index, indexw, count, buffer);

}

static void execute_command(struct command *command, char *buffer)
{

    unsigned int i;

    if (!walk_path(CALL_L1, CALL_L0, command->binary.count, buffer + command->binary.index))
        return;

    call_open(CALL_L1);

    for (i = 0; i < command->ins; i++)
    {

        unsigned int index = CALL_I1 + i * 2;

        if (command->in[i].index.count)
            index = CALL_I1 + ascii_read_value(buffer + command->in[i].index.index, command->in[i].index.count, 10) * 2;

        if (command->in[i].path.count)
        {

            walk_path(index, CALL_DW, command->in[i].path.count, buffer + command->in[i].path.index);
            call_open(index);

        }

    }

    for (i = 0; i < command->outs; i++)
    {

        unsigned int index = CALL_O1 + i * 2;

        if (command->out[i].index.count)
            index = CALL_O1 + ascii_read_value(buffer + command->out[i].index.index, command->out[i].index.count, 10) * 2;

        if (command->out[i].path.count)
        {

            walk_path(index, CALL_DW, command->out[i].path.count, buffer + command->out[i].path.index);
            call_open(index);

        }

    }

    call_spawn(CALL_L1);

    for (i = 0; i < command->ins; i++)
    {

        unsigned int index = CALL_I1 + i * 2;

        if (command->in[i].index.count)
            index = CALL_I1 + ascii_read_value(buffer + command->in[i].index.index, command->in[i].index.count, 10) * 2;

        if (command->in[i].path.count)
            call_close(index);

    }

    for (i = 0; i < command->outs; i++)
    {

        unsigned int index = CALL_O1 + i * 2;

        if (command->out[i].index.count)
            index = CALL_O1 + ascii_read_value(buffer + command->out[i].index.index, command->out[i].index.count, 10) * 2;

        if (command->out[i].path.count)
            call_close(index);

    }

    call_close(CALL_L1);

}

static void execute(struct token_state *state, struct expression *expression)
{

    unsigned int pindex;

    for (pindex = 0; pindex < expression->pipes; pindex++)
    {

        struct pipe *pipe = &expression->pipe[pindex];
        unsigned int cindex;

        for (cindex = 0; cindex < pipe->commands; cindex++)
            call_walk(CALL_L2 + cindex, CALL_DR, 17, "system/pipe/clone");

        for (cindex = 0; cindex < pipe->commands; cindex++)
            call_open(CALL_L2 + cindex);

        for (cindex = 0; cindex < pipe->commands; cindex++)
        {

            if (cindex != pipe->commands - 1)
                call_walk(CALL_O1, CALL_L2 + cindex, 4, "../0");
            else
                call_walk(CALL_O1, CALL_O0, 0, 0);

            call_open(CALL_O1);
            execute_command(&pipe->command[cindex], state->buffer);
            call_walk(CALL_I1, CALL_L2 + cindex, 4, "../1");
            call_open(CALL_I1);

        }

        for (cindex = 0; cindex < pipe->commands; cindex++)<commit_msg>more cleanups<commit_after>#include <fudge.h>
#include "token.h"
#include "parse.h"

static unsigned int walk_path(unsigned int index, unsigned int indexw, unsigned int count, char *buffer)
{

    if (memory_match(buffer, "/", 1))
        return call_walk(index, CALL_DR, count - 1, buffer + 1);

    return call_walk(index, indexw, count, buffer);

}

static void execute_command(struct command *command, char *buffer)
{

    unsigned int i;

    if (!walk_path(CALL_L1, CALL_L0, command->binary.count, buffer + command->binary.index))
        return;

    call_open(CALL_L1);

    for (i = 0; i < command->ins; i++)
    {

        unsigned int index = CALL_I1 + i * 2;

        if (command->in[i].index.count)
            index = CALL_I1 + ascii_read_value(buffer + command->in[i].index.index, command->in[i].index.count, 10) * 2;

        if (command->in[i].path.count)
        {

            walk_path(index, CALL_DW, command->in[i].path.count, buffer + command->in[i].path.index);
            call_open(index);

        }

    }

    for (i = 0; i < command->outs; i++)
    {

        unsigned int index = CALL_O1 + i * 2;

        if (command->out[i].index.count)
            index = CALL_O1 + ascii_read_value(buffer + command->out[i].index.index, command->out[i].index.count, 10) * 2;

        if (command->out[i].path.count)
        {

            walk_path(index, CALL_DW, command->out[i].path.count, buffer + command->out[i].path.index);
            call_open(index);

        }

    }

    call_spawn(CALL_L1);

    for (i = 0; i < command->ins; i++)
    {

        unsigned int index = CALL_I1 + i * 2;

        if (command->in[i].index.count)
            index = CALL_I1 + ascii_read_value(buffer + command->in[i].index.index, command->in[i].index.count, 10) * 2;

        if (command->in[i].path.count)
            call_close(index);

    }

    for (i = 0; i < command->outs; i++)
    {

        unsigned int index = CALL_O1 + i * 2;

        if (command->out[i].index.count)
            index = CALL_O1 + ascii_read_value(buffer + command->out[i].index.index, command->out[i].index.count, 10) * 2;

        if (command->out[i].path.count)
            call_close(index);

    }

    call_close(CALL_L1);

}

static void execute(struct token_state *state, struct expression *expression)
{

    unsigned int pindex;

    for (pindex = 0; pindex < expression->pipes; pindex++)
    {

        struct pipe *pipe = &expression->pipe[pindex];
        unsigned int cindex;

        for (cindex = 0; cindex < pipe->commands; cindex++)
            call_walk(CALL_L2 + cindex, CALL_DR, 17, "system/pipe/clone");

        for (cindex = 0; cindex < pipe->commands; cindex++)
            call_open(CALL_L2 + cindex);

        for (cindex = 0; cindex < pipe->commands; cindex++)
        {

            call_close(CALL_O1);

            if (cindex != pipe->commands - 1)
                call_walk(CALL_O1, CALL_L2 + cindex, 4, "../0");
            else
                call_walk(CALL_O1, CALL_O0, 0, 0);

            call_open(CALL_O1);
            execute_command(&pipe->command[cindex], state->buffer);
            call_close(CALL_I1);
            call_walk(CALL_I1, CALL_L2 + cindex, 4, "../1");
            call_open(CALL_I1);

        }

        for (cindex = 0; cindex < pipe->commands; cindex++)
{'fraction_non_alphanumeric': 0.1486920605782469, 'fraction_numerical': 0.0186629952577635, 'mean_word_length': 2.228641975308642, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 75, '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': '774450', 'n_tokens_mistral': 2374, 'n_tokens_neox': 2172, 'n_words': 480}