<commit_before>/*
 * Copyright (c) 2018 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef SHELL_HISTORY_H__
#define SHELL_HISTORY_H__

#include <zephyr.h>
#include <sys/util.h>
#include <sys/dlist.h>
#include <sys/ring_buffer.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif


struct shell_history {
	struct ring_buf *ring_buf;
	sys_dlist_t list;
	sys_dnode_t *current;
};

/**
 * @brief Create shell history instance.
 *
 * @param _name History instance name.
 * @param _size Memory dedicated for shell history.
 */
#define SHELL_HISTORY_DEFINE(_name, _size) \
	static u8_t __noinit __aligned(sizeof(u32_t)) \
			_name##_ring_buf_data[_size]; \
	static struct ring_buf _name##_ring_buf = \
		{ \
			.size = _size, \
			.buf =  { .buf8 = _name##_ring_buf_data } \
		}; \
	static struct shell_history _name = { \
		.ring_buf = &_name##_ring_buf \
	}


/**
 * @brief Initialize shell history module.<commit_msg>shell_history: align buffer to pointer size<commit_after>/*
 * Copyright (c) 2018 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef SHELL_HISTORY_H__
#define SHELL_HISTORY_H__

#include <zephyr.h>
#include <sys/util.h>
#include <sys/dlist.h>
#include <sys/ring_buffer.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif


struct shell_history {
	struct ring_buf *ring_buf;
	sys_dlist_t list;
	sys_dnode_t *current;
};

/**
 * @brief Create shell history instance.
 *
 * @param _name History instance name.
 * @param _size Memory dedicated for shell history.
 */
#define SHELL_HISTORY_DEFINE(_name, _size) \
	static u8_t __noinit __aligned(sizeof(void *)) \
			_name##_ring_buf_data[_size]; \
	static struct ring_buf _name##_ring_buf = \
		{ \
			.size = _size, \
			.buf =  { .buf8 = _name##_ring_buf_data } \
		}; \
	static struct shell_history _name = { \
		.ring_buf = &_name##_ring_buf \
	}


/**
 * @brief Initialize shell history module.
{'fraction_non_alphanumeric': 0.12893243940175347, 'fraction_numerical': 0.009283135636926251, 'mean_word_length': 3.911392405063291, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '5369437', 'n_tokens_mistral': 785, 'n_tokens_neox': 741, 'n_words': 168}