<commit_before>#include <stdarg.h>

#include "newt.h"

newtGrid newtButtonBar(char * button1, newtComponent * b1comp, ...) {
    va_list args;
    char * name;
    newtGrid grid;
    newtComponent * compPtr;
    int num;

    va_start(args, b1comp);

    name = button1, num = 0;
    while (name) {
	name = va_arg(args, char *);
	compPtr = va_arg(args, newtComponent *);
	num++;
    }

    va_end(args);

    grid = newtCreateGrid(num, 1);

    va_start(args, b1comp);

    name = button1, compPtr = b1comp, num = 0;
    while (name) {
	*compPtr = newtButton(-1, -1, name);
	newtGridSetField(grid, num, 0, NEWT_GRID_COMPONENT, *compPtr, 
			 num ? 1 : 0, 0, 0, 0, 0, 0);

	name = va_arg(args, char *);
	compPtr = va_arg(args, newtComponent *);
	num++;
    }

    return grid;
}<commit_msg>added newtButtonBarv()<commit_after>#include <stdarg.h>

#include "newt.h"

/* if they try and pack more then 50 buttons, screw 'em */
newtGrid newtButtonBarv(char * button1, newtComponent * b1comp, va_list args) {
    newtGrid grid;
    struct buttonInfo {
	char * name;
	newtComponent * compPtr;
    } buttons[50];
    int num;
    int i;

    buttons[0].name = button1, buttons[0].compPtr = b1comp, num = 1;
    while (1) {
	buttons[num].name = va_arg(args, char *);
	if (!buttons[num].name) break;
	buttons[num].compPtr = va_arg(args, newtComponent *);
	num++;
    }

    grid = newtCreateGrid(num, 1);

    for (i = 0; i < num; i++) {
	*buttons[i].compPtr = newtButton(-1, -1, buttons[i].name);
	newtGridSetField(grid, i, 0, NEWT_GRID_COMPONENT, 
			 *buttons[i].compPtr,
			 num ? 1 : 0, 0, 0, 0, 0, 0);
    }

    return grid;
}

newtGrid newtButtonBar(char * button1, newtComponent * b1comp, ...) {
    va_list args;
    newtGrid grid;

    va_start(args, b1comp);

    grid = newtButtonBarv(button1, b1comp, args);

    va_end(args);
 
    return grid;
}
{'fraction_non_alphanumeric': 0.15064794816414687, 'fraction_numerical': 0.026457883369330453, 'mean_word_length': 3.1547085201793723, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, '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': '7002326', 'n_tokens_mistral': 780, 'n_tokens_neox': 719, 'n_words': 174}