<commit_before>/* automaton
 * (c) 2013 <NAME>
 * The source code of this project is distributed under the terms of the
 * simplified BSD license. See the LICENSE file for details.
 */


#include "debug/stdfile.h"
#include "io/uart.h"


static int stdin_get(FILE *f) {
	(void)f;
	
	char c;
	if (uart_read_chr(UART_DEBUG, &c) != 0) {
		return (int)c;
	} else {
		return _FDEV_ERR;
	}
}

static int stdout_put(char c, FILE *f) {
	(void)f;
	
	if (uart_write_chr(UART_DEBUG, c) != 0) {
		return 0;
	} else {
		return _FDEV_ERR;
	}
}


void stdfile_open(void) {
	(void)fdevopen(NULL, stdin_get);
	(void)fdevopen(stdout_put, NULL);
}

void stdfile_close(void) {
	fclose(stdout);
	fclose(stdin);
}
<commit_msg>debug/stdfile: update for bool return type of uart functions<commit_after>/* automaton
 * (c) 2013 <NAME>
 * The source code of this project is distributed under the terms of the
 * simplified BSD license. See the LICENSE file for details.
 */


#include "debug/stdfile.h"
#include "io/uart.h"


static int stdin_get(FILE *f) {
	(void)f;
	
	char c;
	if (uart_read_chr(UART_DEBUG, &c)) {
		return (int)c;
	} else {
		return _FDEV_ERR;
	}
}

static int stdout_put(char c, FILE *f) {
	(void)f;
	
	if (uart_write_chr(UART_DEBUG, c)) {
		return 0;
	} else {
		return _FDEV_ERR;
	}
}


void stdfile_open(void) {
	(void)fdevopen(NULL, stdin_get);
	(void)fdevopen(stdout_put, NULL);
}

void stdfile_close(void) {
	fclose(stdout);
	fclose(stdin);
}

{'fraction_non_alphanumeric': 0.13582813582813583, 'fraction_numerical': 0.008316008316008316, 'mean_word_length': 4.048951048951049, 'pattern_counts': {'":': 0, '<': 5, '<?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': '725523', 'n_tokens_mistral': 622, 'n_tokens_neox': 581, 'n_words': 152}