Lines Matching refs:history
48 void z_shell_history_mode_exit(struct shell_history *history) in z_shell_history_mode_exit() argument
50 history->current = NULL; in z_shell_history_mode_exit()
53 bool z_shell_history_get(struct shell_history *history, bool up, in z_shell_history_get() argument
59 if (sys_dlist_is_empty(&history->list)) { in z_shell_history_get()
65 if (history->current == NULL) { in z_shell_history_get()
72 l_item = sys_dlist_peek_prev_no_check(&history->list, in z_shell_history_get()
73 history->current); in z_shell_history_get()
75 l_item = (history->current == NULL) ? in z_shell_history_get()
76 sys_dlist_peek_head_not_empty(&history->list) : in z_shell_history_get()
77 sys_dlist_peek_next_no_check(&history->list, history->current); in z_shell_history_get()
81 history->current = l_item; in z_shell_history_get()
95 static void add_to_head(struct shell_history *history, in add_to_head() argument
102 sys_dlist_prepend(&history->list, &item->dnode); in add_to_head()
106 static bool remove_from_tail(struct shell_history *history) in remove_from_tail() argument
112 if (sys_dlist_is_empty(&history->list)) { in remove_from_tail()
116 l_item = sys_dlist_peek_tail(&history->list); in remove_from_tail()
123 ring_buf_get(history->ring_buf, NULL, total_len); in remove_from_tail()
128 void z_shell_history_purge(struct shell_history *history) in z_shell_history_purge() argument
130 while (remove_from_tail(history)) { in z_shell_history_purge()
134 void z_shell_history_put(struct shell_history *history, uint8_t *line, in z_shell_history_put() argument
147 if (total_len > ring_buf_capacity_get(history->ring_buf)) { in z_shell_history_put()
151 z_shell_history_mode_exit(history); in z_shell_history_put()
157 l_item = sys_dlist_peek_head(&history->list); in z_shell_history_put()
168 if (ring_buf_is_empty(history->ring_buf)) { in z_shell_history_put()
176 ring_buf_reset(history->ring_buf); in z_shell_history_put()
179 claim_len = ring_buf_put_claim(history->ring_buf, in z_shell_history_put()
186 ring_buf_put_claim(history->ring_buf, in z_shell_history_put()
200 add_to_head(history, h_item, line, len, padding); in z_shell_history_put()
201 ring_buf_put_finish(history->ring_buf, claim_len); in z_shell_history_put()
205 ring_buf_put_finish(history->ring_buf, 0); in z_shell_history_put()
206 remove_from_tail(history); in z_shell_history_put()
210 void z_shell_history_init(struct shell_history *history) in z_shell_history_init() argument
212 sys_dlist_init(&history->list); in z_shell_history_init()
213 history->current = NULL; in z_shell_history_init()