Blame ed.h

Packit Bot a3ac83
/*  Global declarations for the ed editor.  */
Packit Bot a3ac83
/*  GNU ed - The GNU line editor.
Packit Bot a3ac83
    Copyright (C) 1993, 1994 Andrew Moore, Talke Studio
Packit Bot a3ac83
    Copyright (C) 2006-2017 Antonio Diaz Diaz.
Packit Bot a3ac83
Packit Bot a3ac83
    This program is free software: you can redistribute it and/or modify
Packit Bot a3ac83
    it under the terms of the GNU General Public License as published by
Packit Bot a3ac83
    the Free Software Foundation, either version 2 of the License, or
Packit Bot a3ac83
    (at your option) any later version.
Packit Bot a3ac83
Packit Bot a3ac83
    This program is distributed in the hope that it will be useful,
Packit Bot a3ac83
    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Bot a3ac83
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Bot a3ac83
    GNU General Public License for more details.
Packit Bot a3ac83
Packit Bot a3ac83
    You should have received a copy of the GNU General Public License
Packit Bot a3ac83
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit Bot a3ac83
*/
Packit Bot a3ac83
Packit Bot a3ac83
#ifndef __cplusplus
Packit Bot a3ac83
enum Bool { false = 0, true = 1 };
Packit Bot a3ac83
typedef enum Bool bool;
Packit Bot a3ac83
#endif
Packit Bot a3ac83
Packit Bot a3ac83
enum Pflags			/* print suffixes */
Packit Bot a3ac83
  {
Packit Bot a3ac83
  GLS = 0x01,			/* list after command */
Packit Bot a3ac83
  GNP = 0x02,			/* enumerate after command */
Packit Bot a3ac83
  GPR = 0x04			/* print after command */
Packit Bot a3ac83
  };
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
typedef struct line		/* Line node */
Packit Bot a3ac83
  {
Packit Bot a3ac83
  struct line * q_forw;
Packit Bot a3ac83
  struct line * q_back;
Packit Bot a3ac83
  long pos;			/* position of text in scratch buffer */
Packit Bot a3ac83
  int len;			/* length of line ('\n' is not stored) */
Packit Bot a3ac83
  }
Packit Bot a3ac83
line_t;
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
typedef struct
Packit Bot a3ac83
  {
Packit Bot a3ac83
  enum { UADD = 0, UDEL = 1, UMOV = 2, VMOV = 3 } type;
Packit Bot a3ac83
  line_t * head;			/* head of list */
Packit Bot a3ac83
  line_t * tail;			/* tail of list */
Packit Bot a3ac83
  }
Packit Bot a3ac83
undo_t;
Packit Bot a3ac83
Packit Bot a3ac83
#ifndef max
Packit Bot a3ac83
#define max( a,b ) ( (( a ) > ( b )) ? ( a ) : ( b ) )
Packit Bot a3ac83
#endif
Packit Bot a3ac83
#ifndef min
Packit Bot a3ac83
#define min( a,b ) ( (( a ) < ( b )) ? ( a ) : ( b ) )
Packit Bot a3ac83
#endif
Packit Bot a3ac83
Packit Bot a3ac83
Packit Bot a3ac83
/* defined in buffer.c */
Packit Bot a3ac83
bool append_lines( const char ** const ibufpp, const int addr,
Packit Bot a3ac83
                   bool insert, const bool isglobal );
Packit Bot a3ac83
bool close_sbuf( void );
Packit Bot a3ac83
bool copy_lines( const int first_addr, const int second_addr, const int addr );
Packit Bot a3ac83
int current_addr( void );
Packit Bot a3ac83
int dec_addr( int addr );
Packit Bot a3ac83
bool delete_lines( const int from, const int to, const bool isglobal );
Packit Bot a3ac83
int get_line_node_addr( const line_t * const lp );
Packit Bot a3ac83
char * get_sbuf_line( const line_t * const lp );
Packit Bot a3ac83
int inc_addr( int addr );
Packit Bot a3ac83
int inc_current_addr( void );
Packit Bot a3ac83
bool init_buffers( void );
Packit Bot a3ac83
bool isbinary( void );
Packit Bot a3ac83
bool join_lines( const int from, const int to, const bool isglobal );
Packit Bot a3ac83
int last_addr( void );
Packit Bot a3ac83
bool modified( void );
Packit Bot a3ac83
bool move_lines( const int first_addr, const int second_addr, const int addr,
Packit Bot a3ac83
                 const bool isglobal );
Packit Bot a3ac83
bool open_sbuf( void );
Packit Bot a3ac83
int path_max( const char * filename );
Packit Bot a3ac83
bool put_lines( const int addr );
Packit Bot a3ac83
const char * put_sbuf_line( const char * const buf, const int size );
Packit Bot a3ac83
line_t * search_line_node( const int addr );
Packit Bot a3ac83
void set_binary( void );
Packit Bot a3ac83
void set_current_addr( const int addr );
Packit Bot a3ac83
void set_modified( const bool m );
Packit Bot a3ac83
bool yank_lines( const int from, const int to );
Packit Bot a3ac83
void clear_undo_stack( void );
Packit Bot a3ac83
undo_t * push_undo_atom( const int type, const int from, const int to );
Packit Bot a3ac83
void reset_undo_state( void );
Packit Bot a3ac83
bool undo( const bool isglobal );
Packit Bot a3ac83
Packit Bot a3ac83
/* defined in global.c */
Packit Bot a3ac83
void clear_active_list( void );
Packit Bot a3ac83
const line_t * next_active_node( void );
Packit Bot a3ac83
bool set_active_node( const line_t * const lp );
Packit Bot a3ac83
void unset_active_nodes( const line_t * bp, const line_t * const ep );
Packit Bot a3ac83
Packit Bot a3ac83
/* defined in io.c */
Packit Bot a3ac83
bool get_extended_line( const char ** const ibufpp, int * const lenp,
Packit Bot a3ac83
                        const bool strip_escaped_newlines );
Packit Bot a3ac83
const char * get_stdin_line( int * const sizep );
Packit Bot a3ac83
int linenum( void );
Packit Bot a3ac83
bool print_lines( int from, const int to, const int pflags );
Packit Bot a3ac83
int read_file( const char * const filename, const int addr );
Packit Bot a3ac83
int write_file( const char * const filename, const char * const mode,
Packit Bot a3ac83
                const int from, const int to );
Packit Bot a3ac83
void reset_unterminated_line( void );
Packit Bot a3ac83
void unmark_unterminated_line( const line_t * const lp );
Packit Bot a3ac83
Packit Bot a3ac83
/* defined in main.c */
Packit Bot a3ac83
bool is_regular_file( const int fd );
Packit Bot a3ac83
bool may_access_filename( const char * const name );
Packit Bot a3ac83
bool restricted( void );
Packit Bot a3ac83
bool scripted( void );
Packit Bot a3ac83
void show_strerror( const char * const filename, const int errcode );
Packit Bot a3ac83
bool traditional( void );
Packit Bot a3ac83
Packit Bot a3ac83
/* defined in main_loop.c */
Packit Bot a3ac83
int main_loop( const bool loose );
Packit Bot a3ac83
void set_def_filename( const char * const s );
Packit Bot a3ac83
void set_error_msg( const char * msg );
Packit Bot a3ac83
void set_prompt( const char * const s );
Packit Bot a3ac83
void set_verbose( void );
Packit Bot a3ac83
void unmark_line_node( const line_t * const lp );
Packit Bot a3ac83
Packit Bot a3ac83
/* defined in regex.c */
Packit Bot a3ac83
bool build_active_list( const char ** const ibufpp, const int first_addr,
Packit Bot a3ac83
                        const int second_addr, const bool match );
Packit Bot a3ac83
bool extract_replacement( const char ** const ibufpp, const bool isglobal );
Packit Bot a3ac83
int next_matching_node_addr( const char ** const ibufpp, const bool forward );
Packit Bot a3ac83
bool search_and_replace( const int first_addr, const int second_addr,
Packit Bot a3ac83
                         const int snum, const bool isglobal );
Packit Bot a3ac83
bool set_subst_regex( const char ** const ibufpp );
Packit Bot a3ac83
bool subst_regex( void );
Packit Bot a3ac83
Packit Bot a3ac83
/* defined in signal.c */
Packit Bot a3ac83
void disable_interrupts( void );
Packit Bot a3ac83
void enable_interrupts( void );
Packit Bot a3ac83
bool parse_int( int * const i, const char * const str, const char ** const tail );
Packit Bot a3ac83
bool resize_buffer( char ** const buf, int * const size, const int min_size );
Packit Bot a3ac83
bool resize_line_buffer( const line_t *** const buf, int * const size,
Packit Bot a3ac83
                         const int min_size );
Packit Bot a3ac83
bool resize_undo_buffer( undo_t ** const buf, int * const size,
Packit Bot a3ac83
                         const int min_size );
Packit Bot a3ac83
void set_signals( void );
Packit Bot a3ac83
void set_window_lines( const int lines );
Packit Bot a3ac83
const char * strip_escapes( const char * p );
Packit Bot a3ac83
int window_columns( void );
Packit Bot a3ac83
int window_lines( void );