Blame ed.h

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