mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-19 15:56:24 -05:00
Compare commits
No commits in common. "e6921a8ed1ff62869cf608b3f7ec40ce26239db0" and "18a0fbe57fb5cccb733f3596e9c94484432c98d2" have entirely different histories.
e6921a8ed1
...
18a0fbe57f
18
Makefile
18
Makefile
@ -13,6 +13,11 @@ else
|
|||||||
endif
|
endif
|
||||||
export E Q
|
export E Q
|
||||||
|
|
||||||
|
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
||||||
|
# for windows based target, insure we strip the variant part
|
||||||
|
# CYGWIN_NT-6.1, CYGWIN_NT-6.1-WOW, CYGWIN_NT-6.1-WOW64, MSYS_NT-10.0-19042
|
||||||
|
uname_S := $(shell sh -c 'echo $(uname_S) | sed s/_.*$$//')
|
||||||
|
|
||||||
PROGRAM=ue
|
PROGRAM=ue
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
@ -20,7 +25,18 @@ WARNINGS=-pedantic -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter
|
|||||||
CFLAGS=-O2 $(WARNINGS)
|
CFLAGS=-O2 $(WARNINGS)
|
||||||
LDFLAGS=-s
|
LDFLAGS=-s
|
||||||
LIBS=-lcurses
|
LIBS=-lcurses
|
||||||
DEFINES=-DPROGRAM=$(PROGRAM) -D_GNU_SOURCE # -DNDEBUG
|
DEFINES=-DAUTOCONF -DPROGRAM=$(PROGRAM) # -DNDEBUG
|
||||||
|
ifeq ($(uname_S),Linux)
|
||||||
|
DEFINES += -DPOSIX -DUSG
|
||||||
|
else ifeq ($(uname_S),CYGWIN)
|
||||||
|
DEFINES += -DCYGWIN -DSYSV
|
||||||
|
else ifeq ($(uname_S),MSYS)
|
||||||
|
DEFINES += -DCYGWIN -DSYSV
|
||||||
|
else ifeq ($(uname_S),NetBSD)
|
||||||
|
DEFINES += -DPOSIX -DBSD=1
|
||||||
|
else
|
||||||
|
$(error $(uname_S) needs configuration)
|
||||||
|
endif
|
||||||
|
|
||||||
BINDIR=/usr/bin
|
BINDIR=/usr/bin
|
||||||
LIBDIR=/usr/lib
|
LIBDIR=/usr/lib
|
||||||
|
6
buffer.c
6
buffer.c
@ -1,9 +1,8 @@
|
|||||||
/* buffer.c -- implements buffer.h */
|
/* buffer.c -- implements buffer.h */
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
|
||||||
/* Buffer management. Some of the functions are internal, and some are
|
/* Buffer management. Some of the functions are internal, and some are actually attached to
|
||||||
actually attached to user keys. Like everyone else, they set hints for
|
user keys. Like everyone else, they set hints for the display system.
|
||||||
the display system.
|
|
||||||
|
|
||||||
modified by Petri Kutvonen
|
modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
@ -12,6 +11,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "estruct.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "mlout.h"
|
#include "mlout.h"
|
||||||
|
65
defines.h
65
defines.h
@ -1,64 +1,17 @@
|
|||||||
/* defines.h -- customization based on gcc predefined macroes */
|
/* defines.h -- */
|
||||||
#ifndef __DEFINES_H__
|
#ifndef __DEFINES_H__
|
||||||
#define __DEFINES_H__
|
#define __DEFINES_H__
|
||||||
|
|
||||||
#if __unix__
|
/* Must define one of
|
||||||
# define UNIX 1
|
USG | BSD
|
||||||
# if __NetBSD__
|
*/
|
||||||
# define BSD 1
|
|
||||||
# define POSIX 1
|
|
||||||
# elsif __linux__
|
|
||||||
#define USG 1
|
#define USG 1
|
||||||
# define SVR4 1 /* locks */
|
|
||||||
# define POSIX 1
|
#define PKCODE 1
|
||||||
# else /* __CYGWIN__ */
|
#define SCROLLCODE 1 /* scrolling code P.K. */
|
||||||
# define USG 1
|
#define ENVFUNC 1
|
||||||
//# define POSIX 1
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# error Missing gcc predefined __unix__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NSTRING 128 /* # of bytes, string buffers */
|
#define NSTRING 128 /* # of bytes, string buffers */
|
||||||
|
|
||||||
#define TERMCAP 1 /* UNIX */
|
|
||||||
#define XONXOFF 1 /* UNIX */
|
|
||||||
|
|
||||||
#define VISMAC 0 /* update display during keyboard macros */
|
|
||||||
|
|
||||||
#define MSDOS 0
|
|
||||||
#define IBMPC MSDOS
|
|
||||||
#define COLOR MSDOS
|
|
||||||
#define MEMMAP IBMPC
|
|
||||||
|
|
||||||
|
|
||||||
#define FILOCK (SVR4 | BSD)
|
|
||||||
#define ENVFUNC 1 /* only two types so far (USG | BSD) */
|
|
||||||
|
|
||||||
#define PKCODE 1 /* include P.K. extensions, define always */
|
|
||||||
#define SCROLLCODE 1 /* scrolling code P.K. */
|
|
||||||
|
|
||||||
/* Dynamic RAM tracking and reporting redefinitions */
|
|
||||||
#define RAMSIZE 0 /* dynamic RAM memory usage tracking */
|
|
||||||
#if RAMSIZE
|
|
||||||
# define RAMSHOW 1 /* auto dynamic RAM reporting */
|
|
||||||
# include <stdlib.h>
|
|
||||||
void *allocate( size_t size) ;
|
|
||||||
void release( void *ptr) ;
|
|
||||||
|
|
||||||
# define malloc allocate
|
|
||||||
# define free release
|
|
||||||
#endif
|
#endif
|
||||||
|
/* end of defines.h */
|
||||||
/* De-allocate memory always on exit (if the operating system or main
|
|
||||||
program can not
|
|
||||||
*/
|
|
||||||
#define CLEAN 0 /* de-alloc memory on exit */
|
|
||||||
#if CLEAN
|
|
||||||
# define exit(a) cexit(a)
|
|
||||||
|
|
||||||
void cexit( int status) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
/* end of predefs.h */
|
|
||||||
|
16
display.c
16
display.c
@ -12,13 +12,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <locale.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "defines.h"
|
#include "estruct.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "line.h"
|
#include "line.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
@ -51,16 +50,16 @@ static video_p *pscreen ; /* Physical screen. */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int displaying = TRUE ;
|
static int displaying = TRUE ;
|
||||||
|
#if UNIX
|
||||||
|
# include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
# include <sys/ioctl.h>
|
# include <sys/ioctl.h>
|
||||||
/* for window size changes */
|
/* for window size changes */
|
||||||
int chg_width, chg_height ;
|
int chg_width, chg_height ;
|
||||||
|
|
||||||
static void sizesignal( int signr) ;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int currow ; /* Cursor row */
|
static int currow ; /* Cursor row */
|
||||||
static int curcol ; /* Cursor column */
|
static int curcol ; /* Cursor column */
|
||||||
static int vtrow = 0 ; /* Row location of SW cursor */
|
static int vtrow = 0 ; /* Row location of SW cursor */
|
||||||
@ -106,11 +105,6 @@ static int newscreensize( int h, int w) ;
|
|||||||
completely redrawn on the first call to "update".
|
completely redrawn on the first call to "update".
|
||||||
*/
|
*/
|
||||||
void vtinit( void) {
|
void vtinit( void) {
|
||||||
#ifdef SIGWINCH
|
|
||||||
signal( SIGWINCH, sizesignal) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
setlocale( LC_CTYPE, "") ; /* expects $LANG like en_GB.UTF-8 */
|
|
||||||
TTopen() ; /* open the screen */
|
TTopen() ; /* open the screen */
|
||||||
TTkopen() ; /* open the keyboard */
|
TTkopen() ; /* open the keyboard */
|
||||||
TTrev( FALSE) ;
|
TTrev( FALSE) ;
|
||||||
@ -1410,7 +1404,7 @@ void getscreensize( int *widthp, int *heightp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
static void sizesignal( int signr) {
|
void sizesignal( int signr) {
|
||||||
int w, h ;
|
int w, h ;
|
||||||
int old_errno = errno ;
|
int old_errno = errno ;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "defines.h" /* UNIX */
|
#include "estruct.h"
|
||||||
#include "names.h" /* BINDABLE() */
|
#include "names.h" /* BINDABLE() */
|
||||||
#include "utf8.h" /* unicode_t */
|
#include "utf8.h" /* unicode_t */
|
||||||
|
|
||||||
@ -40,6 +40,8 @@ void getscreensize( int *widthp, int *heightp) ;
|
|||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# ifdef SIGWINCH
|
# ifdef SIGWINCH
|
||||||
extern int chg_width, chg_height ;
|
extern int chg_width, chg_height ;
|
||||||
|
|
||||||
|
void sizesignal( int signr) ;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
135
estruct.h
Normal file
135
estruct.h
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
/* estruct.h -- */
|
||||||
|
#ifndef _ESTRUCT_H_
|
||||||
|
#define _ESTRUCT_H_
|
||||||
|
|
||||||
|
/* Structure and preprocessor defines
|
||||||
|
*
|
||||||
|
* written by Dave G. Conroy
|
||||||
|
* modified by Steve Wilhite, George Jones
|
||||||
|
* substantially modified by Daniel Lawrence
|
||||||
|
* modified by Petri Kutvonen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef MSDOS
|
||||||
|
# undef MSDOS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Machine/OS definitions. */
|
||||||
|
|
||||||
|
#if defined(AUTOCONF) || defined(BSD) || defined(SYSV)
|
||||||
|
|
||||||
|
/* Make an intelligent guess about the target system. */
|
||||||
|
|
||||||
|
# if defined(BSD) || defined(sun) || defined(ultrix) || defined(__osf__)
|
||||||
|
# ifndef BSD
|
||||||
|
# define BSD 1 /* Berkeley UNIX */
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define BSD 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if defined(SVR4) || defined(__linux__) /* ex. SunOS 5.3 */
|
||||||
|
# define SVR4 1
|
||||||
|
# define SYSV 1
|
||||||
|
# undef BSD
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if defined(SYSV) || defined(u3b2) || defined(_AIX) || (defined(i386) && defined(unix)) || defined( __unix__)
|
||||||
|
# define USG 1 /* System V UNIX */
|
||||||
|
# else
|
||||||
|
# define USG 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
# define BSD 0 /* UNIX BSD 4.2 and ULTRIX */
|
||||||
|
# define USG 1 /* UNIX system V */
|
||||||
|
#endif /*autoconf || BSD || SYSV */
|
||||||
|
|
||||||
|
#define MSDOS 0 /* MS-DOS */
|
||||||
|
|
||||||
|
/* Compiler definitions */
|
||||||
|
#ifndef AUTOCONF
|
||||||
|
# define UNIX 1 /* a random UNIX compiler */
|
||||||
|
#else
|
||||||
|
# define UNIX (BSD | USG)
|
||||||
|
#endif /*autoconf */
|
||||||
|
|
||||||
|
/* Debugging options */
|
||||||
|
|
||||||
|
#define RAMSIZE 0 /* dynamic RAM memory usage tracking */
|
||||||
|
#if RAMSIZE
|
||||||
|
# define RAMSHOW 1 /* auto dynamic RAM reporting */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef AUTOCONF
|
||||||
|
/* Terminal Output definitions */
|
||||||
|
# define TERMCAP 0 /* Use TERMCAP */
|
||||||
|
# define IBMPC 1 /* IBM-PC CGA/MONO/EGA driver */
|
||||||
|
#else
|
||||||
|
# define TERMCAP UNIX
|
||||||
|
# define IBMPC MSDOS
|
||||||
|
#endif /* Autoconf. */
|
||||||
|
|
||||||
|
/* Configuration options */
|
||||||
|
|
||||||
|
#define VISMAC 0 /* update display during keyboard macros */
|
||||||
|
|
||||||
|
#ifndef AUTOCONF
|
||||||
|
# define COLOR 1 /* color commands and windows */
|
||||||
|
# define FILOCK 0 /* file locking under unix BSD 4.2 */
|
||||||
|
#else
|
||||||
|
# define COLOR MSDOS
|
||||||
|
# ifdef SVR4
|
||||||
|
# define FILOCK 1
|
||||||
|
# else
|
||||||
|
# define FILOCK BSD
|
||||||
|
# endif
|
||||||
|
#endif /* Autoconf. */
|
||||||
|
|
||||||
|
#define CLEAN 0 /* de-alloc memory on exit */
|
||||||
|
|
||||||
|
#ifndef AUTOCONF
|
||||||
|
# define XONXOFF 0 /* don't disable XON-XOFF flow control P.K. */
|
||||||
|
#else
|
||||||
|
# define XONXOFF UNIX
|
||||||
|
#endif /* Autoconf. */
|
||||||
|
|
||||||
|
#define PKCODE 1 /* include my extensions P.K., define always */
|
||||||
|
#define SCROLLCODE 1 /* scrolling code P.K. */
|
||||||
|
|
||||||
|
/* Define some ability flags. */
|
||||||
|
|
||||||
|
#if IBMPC
|
||||||
|
# define MEMMAP 1
|
||||||
|
#else
|
||||||
|
# define MEMMAP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USG | BSD
|
||||||
|
# define ENVFUNC 1
|
||||||
|
#else
|
||||||
|
# define ENVFUNC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Dynamic RAM tracking and reporting redefinitions */
|
||||||
|
|
||||||
|
#if RAMSIZE
|
||||||
|
# include <stdlib.h>
|
||||||
|
void *allocate( size_t size) ;
|
||||||
|
void release( void *ptr) ;
|
||||||
|
# define malloc allocate
|
||||||
|
# define free release
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* De-allocate memory always on exit (if the operating system or
|
||||||
|
main program can not
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if CLEAN
|
||||||
|
# define exit(a) cexit(a)
|
||||||
|
|
||||||
|
void cexit( int status) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/* end of estruct.h */
|
2
eval.c
2
eval.c
@ -15,8 +15,8 @@
|
|||||||
#include "basic.h"
|
#include "basic.h"
|
||||||
#include "bind.h"
|
#include "bind.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "defines.h"
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
#include "estruct.h"
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
#include "execute.h"
|
#include "execute.h"
|
||||||
#include "flook.h"
|
#include "flook.h"
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "estruct.h"
|
||||||
|
#include "random.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "mlout.h"
|
#include "mlout.h"
|
||||||
#include "random.h"
|
|
||||||
#include "search.h"
|
#include "search.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
1
file.c
1
file.c
@ -17,6 +17,7 @@
|
|||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
#include "estruct.h"
|
||||||
#include "execute.h"
|
#include "execute.h"
|
||||||
#include "fileio.h"
|
#include "fileio.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
2
input.c
2
input.c
@ -13,8 +13,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "bind.h"
|
#include "bind.h"
|
||||||
|
#include "estruct.h"
|
||||||
#include "bindable.h"
|
#include "bindable.h"
|
||||||
#include "defines.h"
|
|
||||||
#include "display.h" /* rubout(), echos(), echoc(), update() */
|
#include "display.h" /* rubout(), echos(), echoc(), update() */
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
#include "isa.h"
|
#include "isa.h"
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
|
|
||||||
#include "basic.h"
|
#include "basic.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "defines.h"
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
#include "estruct.h"
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "line.h"
|
#include "line.h"
|
||||||
|
2
line.c
2
line.c
@ -20,7 +20,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "defines.h"
|
#include "estruct.h"
|
||||||
#include "mlout.h"
|
#include "mlout.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
2
lock.h
2
lock.h
@ -2,7 +2,7 @@
|
|||||||
#ifndef _LOCK_H_
|
#ifndef _LOCK_H_
|
||||||
#define _LOCK_H_
|
#define _LOCK_H_
|
||||||
|
|
||||||
#include "defines.h" /* BSD, SVR4 */
|
#include "estruct.h"
|
||||||
|
|
||||||
#if BSD | SVR4
|
#if BSD | SVR4
|
||||||
int lockchk( const char *fname) ;
|
int lockchk( const char *fname) ;
|
||||||
|
42
main.c
42
main.c
@ -62,11 +62,12 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "defines.h" /* OS specific customization */
|
#include "estruct.h" /* Global structures and defines. */
|
||||||
#if UNIX
|
#if UNIX
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
@ -90,7 +91,8 @@
|
|||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
#if UNIX
|
#if UNIX
|
||||||
static void emergencyexit( int signr) {
|
static void emergencyexit(int signr)
|
||||||
|
{
|
||||||
quickexit(FALSE, 0);
|
quickexit(FALSE, 0);
|
||||||
quit( TRUE, 0) ; /* If quickexit fails (to save changes), do a force quit */
|
quit( TRUE, 0) ; /* If quickexit fails (to save changes), do a force quit */
|
||||||
}
|
}
|
||||||
@ -122,12 +124,13 @@ static void usage( void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main( int argc, char *argv[]) {
|
int main(int argc, char **argv)
|
||||||
buffer_p bp; /* temp buffer pointer */
|
{
|
||||||
|
struct buffer *bp; /* temp buffer pointer */
|
||||||
int firstfile; /* first file flag */
|
int firstfile; /* first file flag */
|
||||||
int carg; /* current arg to scan */
|
int carg; /* current arg to scan */
|
||||||
int startflag; /* startup executed flag */
|
int startflag; /* startup executed flag */
|
||||||
buffer_p firstbp = NULL; /* ptr to first buffer in cmd line */
|
struct buffer *firstbp = NULL; /* ptr to first buffer in cmd line */
|
||||||
int viewflag; /* are we starting in view mode? */
|
int viewflag; /* are we starting in view mode? */
|
||||||
int gotoflag; /* do we need to goto a line at start? */
|
int gotoflag; /* do we need to goto a line at start? */
|
||||||
int gline = 0; /* if so, what line? */
|
int gline = 0; /* if so, what line? */
|
||||||
@ -135,10 +138,17 @@ int main( int argc, char *argv[]) {
|
|||||||
int errflag; /* C error processing? */
|
int errflag; /* C error processing? */
|
||||||
bname_t bname ; /* buffer name of file to read */
|
bname_t bname ; /* buffer name of file to read */
|
||||||
|
|
||||||
|
setlocale( LC_CTYPE, "") ; /* expects $LANG like en_GB.UTF-8 */
|
||||||
|
|
||||||
#if PKCODE & BSD
|
#if PKCODE & BSD
|
||||||
sleep(1); /* Time for window manager. */
|
sleep(1); /* Time for window manager. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if UNIX
|
||||||
|
#ifdef SIGWINCH
|
||||||
|
signal(SIGWINCH, sizesignal);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
if( argc == 2) {
|
if( argc == 2) {
|
||||||
if( strcmp( argv[ 1], "--help") == 0) {
|
if( strcmp( argv[ 1], "--help") == 0) {
|
||||||
usage() ;
|
usage() ;
|
||||||
@ -315,7 +325,7 @@ int main( int argc, char *argv[]) {
|
|||||||
*/
|
*/
|
||||||
static void edinit( char *bname) {
|
static void edinit( char *bname) {
|
||||||
buffer_p bp;
|
buffer_p bp;
|
||||||
window_p wp;
|
struct window *wp;
|
||||||
|
|
||||||
if( !init_bindings() /* initialize mapping of function to name and key */
|
if( !init_bindings() /* initialize mapping of function to name and key */
|
||||||
|| NULL == (bp = bfind( bname, TRUE, 0)) /* First buffer */
|
|| NULL == (bp = bfind( bname, TRUE, 0)) /* First buffer */
|
||||||
@ -432,27 +442,32 @@ static void dspram( void)
|
|||||||
|
|
||||||
#if CLEAN
|
#if CLEAN
|
||||||
|
|
||||||
/* cexit()
|
/*
|
||||||
|
* cexit()
|
||||||
*
|
*
|
||||||
* int status; return status of emacs
|
* int status; return status of emacs
|
||||||
*/
|
*/
|
||||||
void cexit( int status) {
|
void cexit( int status) {
|
||||||
|
struct buffer *bp; /* buffer list pointer */
|
||||||
|
struct window *wp; /* window list pointer */
|
||||||
|
struct window *tp; /* temporary window pointer */
|
||||||
|
|
||||||
/* first clean up the windows */
|
/* first clean up the windows */
|
||||||
window_p wp = wheadp ;
|
wp = wheadp;
|
||||||
while (wp) {
|
while (wp) {
|
||||||
window_p tp = wp->w_wndp ;
|
tp = wp->w_wndp;
|
||||||
free(wp);
|
free(wp);
|
||||||
wp = tp;
|
wp = tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
wheadp = NULL;
|
wheadp = NULL;
|
||||||
|
|
||||||
/* then the buffers */
|
/* then the buffers */
|
||||||
buffer_p bp ;
|
bp = bheadp;
|
||||||
while( (bp = bheadp) != NULL) {
|
while (bp) {
|
||||||
bp->b_nwnd = 0;
|
bp->b_nwnd = 0;
|
||||||
bp->b_flag = 0; /* don't say anything about a changed buffer! */
|
bp->b_flag = 0; /* don't say anything about a changed buffer! */
|
||||||
zotbuf(bp);
|
zotbuf(bp);
|
||||||
|
bp = bheadp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* and the kill buffer */
|
/* and the kill buffer */
|
||||||
@ -461,7 +476,8 @@ void cexit( int status) {
|
|||||||
/* and the video buffers */
|
/* and the video buffers */
|
||||||
vtfree();
|
vtfree();
|
||||||
|
|
||||||
(exit)( status) ;
|
#undef exit
|
||||||
|
exit(status);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
2
pklock.h
2
pklock.h
@ -2,7 +2,7 @@
|
|||||||
#ifndef _PKLOCK_H_
|
#ifndef _PKLOCK_H_
|
||||||
#define _PKLOCK_H_
|
#define _PKLOCK_H_
|
||||||
|
|
||||||
#include "defines.h" /* FILOCK, BSD, SVR4 */
|
#include "estruct.h"
|
||||||
|
|
||||||
#if (FILOCK && BSD) || SVR4
|
#if (FILOCK && BSD) || SVR4
|
||||||
char *dolock( const char *fname) ;
|
char *dolock( const char *fname) ;
|
||||||
|
43
posix.c
43
posix.c
@ -1,17 +1,18 @@
|
|||||||
/* posix.c -- posix implementation of termio.h */
|
/* posix.c -- posix implementation of termio.h */
|
||||||
#include "termio.h"
|
|
||||||
|
|
||||||
#include "defines.h" /* POSIX */
|
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
|
|
||||||
/* The functions in this file negotiate with the operating system for
|
#include "termio.h"
|
||||||
characters, and write characters in a barely buffered fashion on the
|
|
||||||
display. All operating systems.
|
|
||||||
|
|
||||||
modified by Petri Kutvonen
|
/* posix.c
|
||||||
|
*
|
||||||
based on termio.c, with all the old cruft removed, and
|
* The functions in this file negotiate with the operating system for
|
||||||
fixed for termios rather than the old termio.. Linus Torvalds
|
* characters, and write characters in a barely buffered fashion on the
|
||||||
|
* display. All operating systems.
|
||||||
|
*
|
||||||
|
* modified by Petri Kutvonen
|
||||||
|
*
|
||||||
|
* based on termio.c, with all the old cruft removed, and
|
||||||
|
* fixed for termios rather than the old termio.. Linus Torvalds
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -23,19 +24,21 @@
|
|||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "estruct.h"
|
||||||
#include "retcode.h"
|
#include "retcode.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
|
||||||
int ttrow = -1 ; /* Row location of HW cursor */
|
int ttrow = HUGE ; /* Row location of HW cursor */
|
||||||
int ttcol = -1 ; /* Column location of HW cursor */
|
int ttcol = HUGE ; /* Column location of HW cursor */
|
||||||
|
|
||||||
/* Define missing macroes for BSD and CYGWIN environment */
|
/* Since Mac OS X's termios.h doesn't have the following 2 macros, define them.
|
||||||
#if BSD
|
*/
|
||||||
|
#if BSD || defined(SYSV) && (defined(_DARWIN_C_SOURCE) || defined(_FREEBSD_C_SOURCE))
|
||||||
#define OLCUC 0000002
|
#define OLCUC 0000002
|
||||||
#define XCASE 0000004
|
#define XCASE 0000004
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __CYGWIN__ /* gcc predefined (see cpp -dM) */
|
#ifdef CYGWIN
|
||||||
#define XCASE 0
|
#define XCASE 0
|
||||||
#define ECHOPRT 0
|
#define ECHOPRT 0
|
||||||
#define PENDIN 0
|
#define PENDIN 0
|
||||||
@ -93,8 +96,10 @@ void ttopen(void)
|
|||||||
kbdflgs = fcntl(0, F_GETFL, 0);
|
kbdflgs = fcntl(0, F_GETFL, 0);
|
||||||
kbdpoll = FALSE;
|
kbdpoll = FALSE;
|
||||||
|
|
||||||
/* on all screens we are not sure of the initial position of the cursor */
|
/* on all screens we are not sure of the initial position
|
||||||
ttrow = ttcol = -1 ;
|
of the cursor */
|
||||||
|
ttrow = 999;
|
||||||
|
ttcol = 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -242,6 +247,8 @@ int typahead(void)
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#else
|
||||||
|
typedef void _pedantic_empty_translation_unit ;
|
||||||
|
#endif /* not POSIX */
|
||||||
|
|
||||||
/* end of posix.c */
|
/* end of posix.c */
|
||||||
|
2
random.c
2
random.c
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
#include "basic.h"
|
#include "basic.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "defines.h"
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
#include "estruct.h"
|
||||||
#include "execute.h"
|
#include "execute.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "line.h"
|
#include "line.h"
|
||||||
|
2
region.c
2
region.c
@ -12,7 +12,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "defines.h"
|
#include "estruct.h"
|
||||||
#include "line.h"
|
#include "line.h"
|
||||||
#include "mlout.h"
|
#include "mlout.h"
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
|
2
search.c
2
search.c
@ -65,8 +65,8 @@
|
|||||||
|
|
||||||
#include "basic.h"
|
#include "basic.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "defines.h"
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
#include "estruct.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "isa.h"
|
#include "isa.h"
|
||||||
#include "line.h"
|
#include "line.h"
|
||||||
|
6
spawn.c
6
spawn.c
@ -12,9 +12,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "buffer.h"
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
|
#include "buffer.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
#include "estruct.h"
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "flook.h"
|
#include "flook.h"
|
||||||
@ -25,6 +27,8 @@
|
|||||||
|
|
||||||
#if USG | BSD
|
#if USG | BSD
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#ifdef SIGWINCH
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
10
tcap.c
10
tcap.c
@ -20,8 +20,8 @@
|
|||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
#include <term.h>
|
#include <term.h>
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
#include "estruct.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
|
|
||||||
#if TERMCAP
|
#if TERMCAP
|
||||||
@ -83,7 +83,7 @@ static char *_UP, _PC, *CM, *CE, *CL, *SO, *SE;
|
|||||||
static char *CS, *DL, *AL, *SF, *SR;
|
static char *CS, *DL, *AL, *SF, *SR;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
terminal_t term = {
|
struct terminal term = {
|
||||||
480, /* actual 479 on 2560x1440 landscape terminal window */
|
480, /* actual 479 on 2560x1440 landscape terminal window */
|
||||||
2550, /* actual 2541 */
|
2550, /* actual 2541 */
|
||||||
0, /* These four values are set dynamically at open time. */
|
0, /* These four values are set dynamically at open time. */
|
||||||
@ -231,11 +231,13 @@ static void tcapclose(void)
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
static void tcapkopen( void) {
|
static void tcapkopen(void)
|
||||||
|
{
|
||||||
# if PKCODE
|
# if PKCODE
|
||||||
putpad(TI);
|
putpad(TI);
|
||||||
ttflush();
|
ttflush();
|
||||||
ttrow = ttcol = -1 ;
|
ttrow = 999;
|
||||||
|
ttcol = 999;
|
||||||
sgarbf = TRUE;
|
sgarbf = TRUE;
|
||||||
# endif
|
# endif
|
||||||
strcpy(sres, "NORMAL");
|
strcpy(sres, "NORMAL");
|
||||||
|
43
terminal.h
43
terminal.h
@ -6,15 +6,15 @@
|
|||||||
#include "retcode.h"
|
#include "retcode.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
|
||||||
/* The editor communicates with the display using a high level interface.
|
/* The editor communicates with the display using a high level interface. A
|
||||||
A "TERM" structure holds useful variables, and indirect pointers to
|
* "TERM" structure holds useful variables, and indirect pointers to routines
|
||||||
routines that do useful operations. The low level get and put routines
|
* that do useful operations. The low level get and put routines are here too.
|
||||||
are here too. This lets a terminal, in addition to having non standard
|
* This lets a terminal, in addition to having non standard commands, have
|
||||||
commands, have funny get and put character code too. The calls might
|
* funny get and put character code too. The calls might get changed to
|
||||||
get changed to "termp->t_field" style in the future, to make it possible
|
* "termp->t_field" style in the future, to make it possible to run more than
|
||||||
to run more than one terminal type.
|
* one terminal type.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
struct terminal {
|
||||||
const short t_maxrow ; /* max number of rows allowable */
|
const short t_maxrow ; /* max number of rows allowable */
|
||||||
const short t_maxcol ; /* max number of columns allowable */
|
const short t_maxcol ; /* max number of columns allowable */
|
||||||
short t_mrow ; /* max number of rows displayable */
|
short t_mrow ; /* max number of rows displayable */
|
||||||
@ -22,19 +22,19 @@ typedef struct {
|
|||||||
short t_mcol ; /* max number of rows displayable */
|
short t_mcol ; /* max number of rows displayable */
|
||||||
short t_ncol ; /* current number of columns displayed */
|
short t_ncol ; /* current number of columns displayed */
|
||||||
short t_margin; /* min margin for extended lines */
|
short t_margin; /* min margin for extended lines */
|
||||||
short t_scrsiz ; /* size of scroll region */
|
short t_scrsiz; /* size of scroll region " */
|
||||||
int t_pause; /* # times thru update to pause */
|
int t_pause; /* # times thru update to pause */
|
||||||
void (*t_open)( void) ; /* Open terminal at the start */
|
void (*t_open)(void); /* Open terminal at the start. */
|
||||||
void (*t_close)(void); /* Close terminal at end. */
|
void (*t_close)(void); /* Close terminal at end. */
|
||||||
void (*t_kopen)(void); /* Open keyboard */
|
void (*t_kopen)(void); /* Open keyboard */
|
||||||
void (*t_kclose)(void); /* close keyboard */
|
void (*t_kclose)(void); /* close keyboard */
|
||||||
int (*t_getchar)( void) ; /* Get character from keyboard */
|
int (*t_getchar)(void); /* Get character from keyboard. */
|
||||||
int (*t_putchar)( unicode_t) ; /* Put character to display */
|
int (*t_putchar)( unicode_t) ; /* Put character to display. */
|
||||||
void (*t_flush) (void) ; /* Flush output buffers */
|
void (*t_flush) (void); /* Flush output buffers. */
|
||||||
void (*t_move)( int, int) ; /* Move the cursor, origin 0 */
|
void (*t_move)(int, int);/* Move the cursor, origin 0. */
|
||||||
void (*t_eeol)( void) ; /* Erase to end of line */
|
void (*t_eeol)(void); /* Erase to end of line. */
|
||||||
void (*t_eeop)( void) ; /* Erase to end of page */
|
void (*t_eeop)(void); /* Erase to end of page. */
|
||||||
void (*t_beep)( void) ; /* Beep */
|
void (*t_beep)(void); /* Beep. */
|
||||||
void (*t_rev)(int); /* set reverse video state */
|
void (*t_rev)(int); /* set reverse video state */
|
||||||
int (*t_rez)(char *); /* change screen resolution */
|
int (*t_rez)(char *); /* change screen resolution */
|
||||||
#if COLOR
|
#if COLOR
|
||||||
@ -44,7 +44,7 @@ typedef struct {
|
|||||||
#if SCROLLCODE
|
#if SCROLLCODE
|
||||||
void (*t_scroll)(int, int,int); /* scroll a region of the screen */
|
void (*t_scroll)(int, int,int); /* scroll a region of the screen */
|
||||||
#endif
|
#endif
|
||||||
} terminal_t ;
|
};
|
||||||
|
|
||||||
/* TEMPORARY macros for terminal I/O (to be placed in a machine dependant
|
/* TEMPORARY macros for terminal I/O (to be placed in a machine dependant
|
||||||
place later)
|
place later)
|
||||||
@ -68,8 +68,11 @@ typedef struct {
|
|||||||
#define TTbacg (*term.t_setback)
|
#define TTbacg (*term.t_setback)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Terminal table defined only in tcap.c */
|
/* Terminal table defined only in term.c */
|
||||||
extern terminal_t term ;
|
extern struct terminal term ;
|
||||||
|
|
||||||
|
extern int ttrow ; /* Row location of HW cursor */
|
||||||
|
extern int ttcol ; /* Column location of HW cursor */
|
||||||
|
|
||||||
extern boolean eolexist ; /* does clear to EOL exist? */
|
extern boolean eolexist ; /* does clear to EOL exist? */
|
||||||
extern boolean revexist ; /* does reverse video exist? */
|
extern boolean revexist ; /* does reverse video exist? */
|
||||||
|
27
termio.c
27
termio.c
@ -1,19 +1,21 @@
|
|||||||
/* termio.c -- implements termio.h */
|
/* termio.c -- implements termio.h */
|
||||||
|
#if !defined( POSIX)
|
||||||
|
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
|
|
||||||
#include "defines.h" /* POSIX */
|
/* TERMIO.C
|
||||||
#ifndef POSIX
|
*
|
||||||
|
* The functions in this file negotiate with the operating system for
|
||||||
/* The functions in this file negotiate with the operating system for
|
* characters, and write characters in a barely buffered fashion on the display.
|
||||||
characters, and write characters in a barely buffered fashion on the
|
* All operating systems.
|
||||||
display. All operating systems.
|
*
|
||||||
|
* modified by Petri Kutvonen
|
||||||
modified by Petri Kutvonen
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "estruct.h"
|
||||||
#include "retcode.h"
|
#include "retcode.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
|
||||||
@ -21,8 +23,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
int ttrow = -1 ; /* Row location of HW cursor */
|
int ttrow = HUGE ; /* Row location of HW cursor */
|
||||||
int ttcol = -1 ; /* Column location of HW cursor */
|
int ttcol = HUGE ; /* Column location of HW cursor */
|
||||||
|
|
||||||
|
|
||||||
#if USG /* System V */
|
#if USG /* System V */
|
||||||
@ -139,7 +141,8 @@ void ttopen(void)
|
|||||||
|
|
||||||
/* on all screens we are not sure of the initial position
|
/* on all screens we are not sure of the initial position
|
||||||
of the cursor */
|
of the cursor */
|
||||||
ttrow = ttcol = -1 ;
|
ttrow = 999;
|
||||||
|
ttcol = 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -261,6 +264,8 @@ int typahead( void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
typedef void _pedantic_empty_translation_unit ;
|
||||||
#endif /* not POSIX */
|
#endif /* not POSIX */
|
||||||
|
|
||||||
/* end of termio.c */
|
/* end of termio.c */
|
||||||
|
2
termio.h
2
termio.h
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#define TYPEAH 1 /* type ahead causes update to be skipped */
|
#define TYPEAH 1 /* type ahead causes update to be skipped */
|
||||||
|
|
||||||
|
#define HUGE 1000 /* Huge number (for row/col) */
|
||||||
|
|
||||||
extern int ttrow ; /* Row location of HW cursor */
|
extern int ttrow ; /* Row location of HW cursor */
|
||||||
extern int ttcol ; /* Column location of HW cursor */
|
extern int ttcol ; /* Column location of HW cursor */
|
||||||
|
|
||||||
|
7
utf8.c
7
utf8.c
@ -1,13 +1,16 @@
|
|||||||
/* utf8.c -- implements utf8.h, conversion between unicode and UTF-8 */
|
/* utf8.c -- implements utf8.h, conversion between unicode and UTF-8 */
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
|
||||||
|
#define _XOPEN_SOURCE /* wcwidth in wchar.h */
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <wchar.h> /* either _XOPEN_SOURCE or _GNU_SOURCE */
|
#include <wchar.h>
|
||||||
|
|
||||||
|
|
||||||
/* Display width of UTF-8 character */
|
/* Display width of UTF-8 character */
|
||||||
int _utf8_width( unicode_t c) {
|
int _utf8_width( unicode_t c) {
|
||||||
#if __SIZEOF_WCHAR_T__ == 2 /* wcwidth only supports UTF-16 */
|
#if CYGWIN
|
||||||
|
assert( sizeof( wchar_t) == 2) ; /* wcwidth only supports UTF-16 */
|
||||||
return (c < 0x10000) ? wcwidth( (wchar_t) c) : -1 ;
|
return (c < 0x10000) ? wcwidth( (wchar_t) c) : -1 ;
|
||||||
#else
|
#else
|
||||||
return wcwidth( (wchar_t) c) ;
|
return wcwidth( (wchar_t) c) ;
|
||||||
|
2
window.c
2
window.c
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
#include "basic.h"
|
#include "basic.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "defines.h"
|
|
||||||
#include "display.h" /* upmode() */
|
#include "display.h" /* upmode() */
|
||||||
|
#include "estruct.h"
|
||||||
#include "execute.h"
|
#include "execute.h"
|
||||||
#include "line.h"
|
#include "line.h"
|
||||||
#include "mlout.h"
|
#include "mlout.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user