2013-09-30 19:34:04 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* apps/system/readline/readline.h
|
|
|
|
*
|
2021-06-10 13:17:16 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2013-09-30 19:34:04 +02:00
|
|
|
*
|
2021-06-10 13:17:16 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2013-09-30 19:34:04 +02:00
|
|
|
*
|
2021-06-10 13:17:16 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2013-09-30 19:34:04 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __APPS_SYSTEM_READLINE_READLINE_H
|
2020-01-31 16:18:05 +01:00
|
|
|
#define __APPS_SYSTEM_READLINE_READLINE_H
|
2013-09-30 19:34:04 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Helper macros */
|
|
|
|
|
|
|
|
#define RL_GETC(v) ((v)->rl_getc(v))
|
2020-11-15 13:29:57 +01:00
|
|
|
|
|
|
|
#ifdef CONFIG_READLINE_ECHO
|
|
|
|
# define RL_PUTC(v,ch) ((v)->rl_putc(v,ch))
|
|
|
|
# define RL_WRITE(v,b,s) ((v)->rl_write(v,b,s))
|
|
|
|
#endif
|
2013-09-30 19:34:04 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Type Declarations
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
struct rl_common_s
|
|
|
|
{
|
2020-11-15 13:29:57 +01:00
|
|
|
int (*rl_getc)(FAR struct rl_common_s *vtbl);
|
2013-09-30 19:34:04 +02:00
|
|
|
#ifdef CONFIG_READLINE_ECHO
|
2020-11-15 13:29:57 +01:00
|
|
|
void (*rl_putc)(FAR struct rl_common_s *vtbl, int ch);
|
|
|
|
void (*rl_write)(FAR struct rl_common_s *vtbl, FAR const char *buffer,
|
|
|
|
size_t buflen);
|
2013-09-30 19:34:04 +02:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: readline_common
|
|
|
|
*
|
2016-12-14 01:04:43 +01:00
|
|
|
* Common logic shared by various readline frone-ends (currently only
|
|
|
|
* readline()).
|
2013-09-30 19:34:04 +02:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* buf - The user allocated buffer to be filled.
|
|
|
|
* buflen - the size of the buffer.
|
|
|
|
* instream - The stream to read characters from
|
|
|
|
* outstream - The stream to each characters to.
|
|
|
|
*
|
|
|
|
* Returned values:
|
|
|
|
* On success, the (positive) number of bytes transferred is returned.
|
|
|
|
* EOF is returned to indicate either an end of file condition or a
|
|
|
|
* failure.
|
|
|
|
*
|
2015-10-03 01:35:18 +02:00
|
|
|
****************************************************************************/
|
2013-09-30 19:34:04 +02:00
|
|
|
|
2020-11-15 13:29:57 +01:00
|
|
|
ssize_t readline_common(FAR struct rl_common_s *vtbl,
|
|
|
|
FAR char *buf, int buflen);
|
2013-09-30 19:34:04 +02:00
|
|
|
|
|
|
|
#endif /* __APPS_SYSTEM_READLINE_READLINE_H */
|