1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-21 08:36:23 -05:00

Revise header files formatting.

Finish tagging BBINDABLE functions.
Modify forward-character to handle combined Unicode.
Bump up version number and set default program name as 'ue'.
This commit is contained in:
Renaud 2021-08-13 11:06:58 +08:00
parent 50b727bf7f
commit b4d69118f5
36 changed files with 1493 additions and 1506 deletions

View File

@ -1,8 +1,8 @@
/* basic.h -- basic commands for cursor movement in active window */
#ifndef _BASIC_H_
# define _BASIC_H_
#define _BASIC_H_
# include "names.h"
#include "names.h" /* BINDABLE() */
/* $overlap is the size of the line overlap when kbd calls page forw/back
if 0, page will move by 2/3 of the window size (1/3 page overlap)

4
bind.h
View File

@ -1,9 +1,8 @@
/* bind.h -- bindable functions dealing with name and key bindings */
#ifndef _BIND_H_
#define _BIND_H_
#include "names.h"
#include "names.h" /* BINDABLE() */
/* Bindable uEMACS functions */
BINDABLE( apro) ;
@ -19,5 +18,4 @@ int startup( const char *fname) ;
const char *transbind( char *skey) ; /* by string representation of key */
#endif
/* end of bind.h */

View File

@ -2,13 +2,13 @@
#ifndef _BINDABLE_H_
#define _BINDABLE_H_
#include "names.h"
#include "names.h" /* BINDABLE() */
/* functions that can be bound to keys or procedure names */
BBINDABLE( ctlxe) ;
BBINDABLE( ctlxlp) ;
BBINDABLE( ctlxrp) ;
BINDABLE( ctrlg) ; /* ABORT */
BINDABLE( ctrlg) ; /* ABORT */
BINDABLE( quickexit) ;
BINDABLE( quit) ;

View File

@ -1,9 +1,9 @@
/* buffer.h -- buffer type and functions */
#ifndef _BUFFER_H_
# define _BUFFER_H_
#define _BUFFER_H_
#include "line.h"
#include "names.h"
#include "line.h" /* line_p */
#include "names.h" /* BINDABLE() */
/* Text is kept in buffers. A buffer header, described below, exists for
every buffer in the system. The buffers are kept in a big list, so that

View File

@ -1,9 +1,7 @@
/* defines.h -- */
#ifndef __DEFINES_H__
#define __DEFINES_H__
/* Must define one of
USG | BSD
*/
@ -16,5 +14,4 @@
#define NSTRING 128 /* # of bytes, string buffers */
#endif
/* end of defines.h */

View File

@ -1,19 +1,19 @@
/* display.h -- display functionality */
#ifndef _DISPLAY_H_
# define _DISPLAY_H_
#define _DISPLAY_H_
# include <stdarg.h>
#include <stdarg.h>
# include "estruct.h"
# include "names.h" /* BINDABLE() */
# include "utf8.h" /* unicode_t */
#include "estruct.h"
#include "names.h" /* BINDABLE() */
#include "utf8.h" /* unicode_t */
extern int mpresf ; /* Stuff in message line */
extern int scrollcount ; /* number of lines to scroll */
extern int discmd ; /* display command flag */
extern int disinp ; /* display input characters (echo) */
extern int gfcolor ; /* global forgrnd color (white) */
extern int gbcolor ; /* global backgrnd color (black) */
extern int mpresf ; /* Stuff in message line */
extern int scrollcount ; /* number of lines to scroll */
extern int discmd ; /* display command flag */
extern int disinp ; /* display input characters (echo) */
extern int gfcolor ; /* global forgrnd color (white) */
extern int gbcolor ; /* global backgrnd color (black) */
/* Bindable functions */
BINDABLE( upscreen) ;
@ -37,13 +37,14 @@ void echos( const char *s) ;
void rubout( void) ;
void getscreensize( int *widthp, int *heightp) ;
# if UNIX
# include <signal.h>
# ifdef SIGWINCH
extern int chg_width, chg_height ;
#if UNIX
# include <signal.h>
# ifdef SIGWINCH
extern int chg_width, chg_height ;
void sizesignal( int signr) ;
# endif
void sizesignal( int signr) ;
# endif
#endif
#endif
/* end of display.h */

155
estruct.h
View File

@ -1,19 +1,17 @@
/* estruct.h -- */
#ifndef _ESTRUCT_H_
#define _ESTRUCT_H_
/* Structure and preprocessor defines
*
* written by Dave G. Conroy
* modified by Steve Wilhite, George Jones
* written by Dave G. Conroy
* modified by Steve Wilhite, George Jones
* substantially modified by Daniel Lawrence
* modified by Petri Kutvonen
* modified by Petri Kutvonen
*/
#ifdef MSDOS
#undef MSDOS
#ifdef MSDOS
# undef MSDOS
#endif
/* Machine/OS definitions. */
@ -22,121 +20,116 @@
/* 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(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(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
# 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 */
# define BSD 0 /* UNIX BSD 4.2 and ULTRIX */
# define USG 1 /* UNIX system V */
#endif /*autoconf || BSD || SYSV */
#define MSDOS 0 /* MS-DOS */
#define MSDOS 0 /* MS-DOS */
/* Compiler definitions */
#ifndef AUTOCONF
# define UNIX 1 /* a random UNIX compiler */
/* Compiler definitions */
#ifndef AUTOCONF
# define UNIX 1 /* a random UNIX compiler */
#else
# define UNIX (BSD | USG)
#endif /*autoconf */
# define UNIX (BSD | USG)
#endif /*autoconf */
/* Debugging options */
/* Debugging options */
#define RAMSIZE 0 /* dynamic RAM memory usage tracking */
#define RAMSIZE 0 /* dynamic RAM memory usage tracking */
#if RAMSIZE
#define RAMSHOW 1 /* auto dynamic RAM reporting */
# 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 */
#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
# define TERMCAP UNIX
# define IBMPC MSDOS
#endif /* Autoconf. */
/* Configuration options */
/* 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 */
#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
# define COLOR MSDOS
# ifdef SVR4
# define FILOCK 1
# else
# define FILOCK BSD
# endif
#endif /* Autoconf. */
#define CLEAN 0 /* de-alloc memory on exit */
#define CLEAN 0 /* de-alloc memory on exit */
#ifndef AUTOCONF
# define XONXOFF 0 /* don't disable XON-XOFF flow control P.K. */
#ifndef AUTOCONF
# define XONXOFF 0 /* don't disable XON-XOFF flow control P.K. */
#else
# define XONXOFF UNIX
# define XONXOFF UNIX
#endif /* Autoconf. */
#define PKCODE 1 /* include my extensions P.K., define always */
#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
#if IBMPC
# define MEMMAP 1
#else
#define MEMMAP 0
# define MEMMAP 0
#endif
#if USG | BSD
# define ENVFUNC 1
#if USG | BSD
# define ENVFUNC 1
#else
# define ENVFUNC 0
# define ENVFUNC 0
#endif
/* Dynamic RAM tracking and reporting redefinitions */
/* 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
#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
/* De-allocate memory always on exit (if the operating system or
main program can not
*/
#if CLEAN
#define exit(a) cexit(a)
#if CLEAN
# define exit(a) cexit(a)
void cexit( int status) ;
void cexit( int status) ;
#endif
#endif
/* end of estruct.h */

14
eval.h
View File

@ -1,14 +1,13 @@
/* eval.h -- variables and operands evaluation */
#ifndef _EVAL_H_
# define _EVAL_H_
#define _EVAL_H_
#include "names.h"
#define DEBUGM 1 /* $debug triggers macro debugging */
# if DEBUGM
int mdbugout( char *fmt, ...) ;
# endif
#if DEBUGM
int mdbugout( char *fmt, ...) ;
#endif
extern int macbug ; /* macro debuging flag */
extern int cmdstatus ; /* last command status */
@ -25,9 +24,8 @@ char *mklower( char *str) ;
/* Bindable functions */
TBINDABLE( clrmes) ;
BINDABLE( setvar) ;
BINDABLE( writemsg) ;
BINDABLE( setvar) ;
BINDABLE( writemsg) ;
#endif
/* end of eval.h */

3
exec.h
View File

@ -1,6 +1,6 @@
/* exec.h -- bindable functions to execute functions, macros and procedures */
#ifndef _EXEC_H_
# define _EXEC_H_
#define _EXEC_H_
#include "names.h"
@ -61,5 +61,4 @@ BINDABLE( cbuf39) ;
BINDABLE( cbuf40) ;
#endif
/* end of exec.h */

View File

@ -1,20 +1,19 @@
/* execute.h -- */
#ifndef _EXECUTE_H_
#define _EXECUTE_H_
#define CFENCE 1 /* fence matching in CMODE */
#include "names.h" /* key code */
extern int gasave ; /* global ASAVE size */
extern int gacount ; /* count until next ASAVE */
#include "names.h" /* BINDABLE() */
extern int gasave ; /* global ASAVE size */
extern int gacount ; /* count until next ASAVE */
int execute( unsigned keycode, int f, int n) ;
void kbd_loop( void) ;
#define CFENCE 1 /* fence matching in CMODE */
#if CFENCE
BINDABLE( getfence) ;
BINDABLE( getfence) ;
#endif
#endif
/* end of execute.h */

10
file.h
View File

@ -1,13 +1,12 @@
/* file.h -- file centric commands */
#ifndef _FILE_H_
#define _FILE_H_
#include "buffer.h"
#include "names.h"
#include "buffer.h" /* bname_t */
#include "names.h" /* BINDABLE() */
extern boolean restflag ; /* restricted use? */
boolean resterr( void) ; /* restricted error message */
extern boolean restflag ; /* restricted use? */
boolean resterr( void) ; /* restricted error message */
/* Bindable functions */
BINDABLE( filefind) ;
@ -25,5 +24,4 @@ void unqname( char *name) ;
int writeout( const char *fn) ;
#endif
/* end of file.h */

View File

@ -1,12 +1,13 @@
/* fileio.h -- file primitives */
#ifndef _FILEIO_H_
#define _FILEIO_H_
typedef enum {
FIOSUC, /* File I/O, success. */
FIOFNF, /* File I/O, file not found. */
FIOEOF, /* File I/O, end of file. */
FIOERR, /* File I/O, error. */
FIOMEM /* File I/O, out of memory */
FIOSUC, /* File I/O, success. */
FIOFNF, /* File I/O, file not found. */
FIOEOF, /* File I/O, end of file. */
FIOERR, /* File I/O, error. */
FIOMEM /* File I/O, out of memory */
} fio_code ;
#define FTYPE_NONE 0
@ -21,10 +22,10 @@ typedef enum {
#define FCODE_EXTND 0x82
#define FCODE_MIXED 0x83
extern char *fline ; /* dynamic return line */
extern int ftype ;
extern int fcode ; /* encoding type */
extern int fpayload ; /* actual length of fline content */
extern char *fline ; /* dynamic return line */
extern int ftype ;
extern int fcode ; /* encoding type */
extern int fpayload ; /* actual length of fline content */
fio_code ffclose( void) ;
fio_code ffgetline( void) ;
@ -33,3 +34,4 @@ fio_code ffropen( const char *fn) ;
fio_code ffwopen( const char *fn) ;
#endif
/* end of fileio.h */

11
flook.h
View File

@ -1,8 +1,11 @@
#include "retcode.h"
/* flook.h -- */
#ifndef _FLOOK_H_
#define _FLOOK_H_
#include "retcode.h" /* boolean */
#define rcfname pathname[ 0]
#define hlpfname pathname[ 1]
#define rcfname pathname[ 0]
#define hlpfname pathname[ 1]
extern const char *pathname[] ;
@ -10,3 +13,5 @@ extern const char *pathname[] ;
boolean fexist( const char *fname) ;
char *flook( const char *fname, boolean hflag) ;
#endif
/* end of flook.h */

30
input.h
View File

@ -1,25 +1,26 @@
/* input.h -- */
#ifndef _INPUT_H_
#define _INPUT_H_
#include "names.h"
#include "names.h" /* nbind_p */
typedef enum {
STOP, PLAY, RECORD
STOP, PLAY, RECORD
} kbdstate ;
extern kbdstate kbdmode ; /* current keyboard macro mode */
extern int lastkey ; /* last keystoke */
extern int kbdrep ; /* number of repetitions */
extern int kbdm[] ; /* Holds kayboard macro data */
extern int *kbdptr ; /* current position in keyboard buf */
extern int *kbdend ; /* ptr to end of the keyboard */
extern kbdstate kbdmode ; /* current keyboard macro mode */
extern int lastkey ; /* last keystoke */
extern int kbdrep ; /* number of repetitions */
extern int kbdm[] ; /* Holds kayboard macro data */
extern int *kbdptr ; /* current position in keyboard buf */
extern int *kbdend ; /* ptr to end of the keyboard */
extern int metac ; /* current meta character */
extern int ctlxc ; /* current control X prefix char */
extern int reptc ; /* current universal repeat char */
extern int abortc ; /* current abort command char */
extern const int nlc ; /* end of input char */
extern int metac ; /* current meta character */
extern int ctlxc ; /* current control X prefix char */
extern int reptc ; /* current universal repeat char */
extern int abortc ; /* current abort command char */
extern const int nlc ; /* end of input char */
void ue_system( const char *cmd) ;
@ -28,7 +29,7 @@ int newmlarg( char **outbufref, const char *prompt, int size) ;
int newmlargt( char **outbufref, const char *prompt, int size) ;
int ectoc( int c) ;
/* Get a command name from the command line or interactively */
/* Get a command binding from the command line or interactively */
nbind_p getname( void) ;
int tgetc( void) ;
@ -37,3 +38,4 @@ int getcmd( void) ;
int getstring( const char *prompt, char *buf, int nbuf, int eolchar) ;
#endif
/* end of input.h */

43
isa.h
View File

@ -1,34 +1,32 @@
/* isa.h -- isletter, islower, isupper, flipcase */
#ifndef __ISA_H__
#define __ISA_H__
#define NATIONL 0 /* if 1, interpret [,],\,{,},| as characters P.K. */
#ifdef islower
#undef islower
#ifdef islower
# undef islower
#endif
#ifdef isupper
#undef isupper
#ifdef isupper
# undef isupper
#endif
#if NATIONL
#define LASTUL ']'
#define LASTLL '}'
#define NATIONL 0 /* if 1, interpret [,],\,{,},| as characters P.K. */
#if NATIONL
# define LASTUL ']'
# define LASTLL '}'
#else
#define LASTUL 'Z'
#define LASTLL 'z'
# define LASTUL 'Z'
# define LASTLL 'z'
#endif
#define isletter(c) __isxletter((0xFF & (c)))
#define islower(c) isxlower((0xFF & (c)))
#define isupper(c) isxupper((0xFF & (c)))
#define isletter(c) __isxletter((0xFF & (c)))
#define islower(c) isxlower((0xFF & (c)))
#define isupper(c) isxupper((0xFF & (c)))
#define __isxletter(c) (('a' <= c && LASTLL >= c) || ('A' <= c && LASTUL >= c) || (192<=c /* && c<=255 */))
#define isxlower(c) (('a' <= c && LASTLL >= c) || (224 <= c && 252 >= c))
#define isxupper(c) (('A' <= c && LASTUL >= c) || (192 <= c && 220 >= c))
#define __isxletter(c) (('a' <= c && LASTLL >= c) || \
('A' <= c && LASTUL >= c) || (192<=c /* && c<=255 */))
#define isxlower(c) (('a' <= c && LASTLL >= c) || (224 <= c && 252 >= c))
#define isxupper(c) (('A' <= c && LASTUL >= c) || (192 <= c && 220 >= c))
/* DIFCASE represents the integer difference between upper and lower
case letters. It is an xor-able value, which is fortunate, since the
@ -36,9 +34,8 @@
ascii in ebcdic.
*/
#define DIFCASE 0x20 /* ASCII 'a' - 'A' */
#define flipcase( c) ((c) ^ DIFCASE) /* Toggle the case of a letter. */
#endif /* __ISA_H__ */
#define DIFCASE 0x20 /* ASCII 'a' - 'A' */
#define flipcase( c) ((c) ^ DIFCASE) /* Toggle the case of a letter. */
#endif
/* end of isa.h */

View File

@ -2,7 +2,7 @@
#ifndef __ISEARCH_H__
#define __ISEARCH_H__
# include "names.h" /* BINDABLE */
#include "names.h" /* BINDABLE */
BINDABLE( risearch) ;
BINDABLE( fisearch) ;

1106
line.c

File diff suppressed because it is too large Load Diff

41
line.h
View File

@ -1,26 +1,24 @@
/* line.h -- line centric interface */
#ifndef _LINE_H_
#define _LINE_H_
#include "names.h"
#include "utf8.h"
/*
* All text is kept in circularly linked lists of "struct line" structures.
* These begin at the header line (which is the blank line beyond the end
* of the buffer). This line is pointed to by the "struct buffer". Each
* line contains a number of bytes in the line (the "used" size), the size
* of the text array, and the text. The end of line is not stored as a
* byte; it's implied. Future additions will include update hints, and a
* list of marks into the line.
/* All text is kept in circularly linked lists of "struct line" structures.
These begin at the header line (which is the blank line beyond the end
of the buffer). This line is pointed to by the "struct buffer". Each
line contains a number of bytes in the line (the "used" size), the size
of the text array, and the text. The end of line is not stored as a
byte; it's implied. Future additions will include update hints, and a
list of marks into the line.
*/
typedef struct line {
struct line *l_fp ; /* Forward link to the next line */
struct line *l_bp ; /* Backward link to the previous line */
int l_size ; /* Allocated size */
int l_used ; /* Used size */
char l_text[ 1] ; /* A bunch of characters */
struct line *l_fp ; /* Forward link to the next line */
struct line *l_bp ; /* Backward link to the previous line */
int l_size ; /* Allocated size */
int l_used ; /* Used size */
char l_text[ 1] ; /* A bunch of characters */
} *line_p ;
#define lforw(lp) ((lp)->l_fp)
@ -29,15 +27,15 @@ typedef struct line {
#define lputc(lp, n, c) ((lp)->l_text[(n)]=(c))
#define llength(lp) ((lp)->l_used)
extern int tabwidth ; /* Map to $tab, default to 8, can be set to [1, .. */
extern int tabwidth ; /* Map to $tab, default to 8, can be set to [1, .. */
char *getkill( void) ;
/* Bindable functions */
boolean backchar( int f, int n) ;
boolean forwchar( int f, int n) ;
BINDABLE( insspace) ;
BINDABLE( yank) ;
BBINDABLE( backchar) ;
BBINDABLE( forwchar) ;
BINDABLE( insspace) ;
BINDABLE( yank) ;
void lfree( line_p lp) ;
void lchange( int flag) ;
@ -54,8 +52,7 @@ void kdelete( void) ;
int kinsert( int c) ;
line_p lalloc( int minsize) ; /* Allocate a line of at least minsize chars. */
boolean rdonly( void) ; /* Read Only error message */
#endif /* _LINE_H_ */
boolean rdonly( void) ; /* Read Only error message */
#endif
/* end of line.h */

7
lock.h
View File

@ -1,18 +1,15 @@
/* lock.h -- */
#ifndef _LOCK_H_
#define _LOCK_H_
#include "estruct.h"
#if BSD | SVR4
#if BSD | SVR4
int lockchk( const char *fname) ;
int lockrel( void) ;
int lock( const char *fname) ;
int unlock( const char *fname) ;
#endif
#endif
#endif
/* end of lock.h */

View File

@ -1,5 +1,4 @@
/* mlout.h -- message line output interface */
#ifndef __MLOUT_H__
#define __MLOUT_H__
@ -8,8 +7,7 @@
extern void (*mloutfmt)( const char *, ...) ;
void mloutstr( const char *str) ;
boolean mloutfail( const char *msg) ; /* output with BELL and return FALSE */
#endif /* __MLOUT_H__ */
boolean mloutfail( const char *msg) ; /* output with BELL and return FALSE */
#endif
/* end of mlout.h */

16
names.h
View File

@ -1,20 +1,20 @@
/* names.h -- mapping of functions to names and keys */
#ifndef _NAMES_H_
# define _NAMES_H_
#define _NAMES_H_
#include "retcode.h"
#define CTL_ 0x01000000 /* Control flag, or'ed in */
#define META 0x02000000 /* Meta flag, or'ed in */
#define CTLX 0x04000000 /* ^X flag, or'ed in */
#define SPEC 0x08000000 /* special key (function keys) */
#define PRFXMASK 0x0F000000 /* prefix mask */
#define CTL_ 0x01000000 /* Control flag, or'ed in */
#define META 0x02000000 /* Meta flag, or'ed in */
#define CTLX 0x04000000 /* ^X flag, or'ed in */
#define SPEC 0x08000000 /* special key (function keys) */
#define PRFXMASK 0x0F000000 /* prefix mask */
/* Bindable uEMACS function pointer type and definition template */
#define BINDABLE( fname) int fname( boolean f, int n)
#define BBINDABLE( fname) boolean fname( boolean f, int n)
#define TBINDABLE BBINDABLE
#define TBINDABLE BBINDABLE
typedef BINDABLE( (*fnp_t)) ;
@ -46,7 +46,7 @@ extern kbind_p keytab ; /* key bind to functions table */
boolean init_bindings( void) ;
kbind_p setkeybinding( unsigned key, nbind_p nbp) ;
boolean delkeybinding( unsigned key) ;
kbind_p getkeybinding( unsigned key) ; /* look up by key code */
kbind_p getkeybinding( unsigned key) ; /* look up by key code */
/* find a name to function association in the name to function mapping table */
nbind_p fncmatch( char *name) ; /* look up by name */

View File

@ -1,17 +1,13 @@
/* pklock.h -- */
#ifndef _PKLOCK_H_
#define _PKLOCK_H_
#include "estruct.h"
#if (FILOCK && BSD) || SVR4
char *dolock( const char *fname) ;
char *undolock( const char *fname) ;
#endif
#endif
/* end of pklock.h */

1116
random.c

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,18 @@
/* random.h -- various commands */
#ifndef _RANDOM_H_
#define _RANDOM_H_
#include "names.h"
/* Command flags */
#define CFCPCN 0x0001 /* Flag that last command was C-P, C-N */
#define CFKILL 0x0002 /* Flag that last command was a kill */
#define CFCPCN 0x0001 /* Flag that last command was C-P, C-N */
#define CFKILL 0x0002 /* Flag that last command was a kill */
extern int thisflag ; /* Flags, this command */
extern int lastflag ; /* Flags, last command */
extern int thisflag ; /* Flags, this command */
extern int lastflag ; /* Flags, last command */
extern int fillcol ; /* Fill column */
extern boolean hardtab ; /* Use hard tab instead of soft tab */
extern int fillcol ; /* Fill column */
extern boolean hardtab ; /* Use hard tab instead of soft tab */
int getcline( void) ;
@ -21,28 +20,27 @@ int getccol( int bflg) ;
boolean setccol( int pos) ;
/* Bindable functions */
BINDABLE( setfillcol) ;
BINDABLE( showcpos) ;
boolean twiddle( int f, int n) ;
BINDABLE( quote) ;
BINDABLE( insert_tab) ;
BINDABLE( detab) ;
BINDABLE( entab) ;
BINDABLE( trim) ;
BINDABLE( openline) ;
BINDABLE( insert_newline) ;
BINDABLE( deblank) ;
BINDABLE( indent) ;
BINDABLE( forwdel) ;
BINDABLE( backdel) ;
BINDABLE( killtext) ;
BINDABLE( setemode) ;
BINDABLE( delmode) ;
BINDABLE( setgmode) ;
BINDABLE( delgmode) ;
BINDABLE( istring) ;
BINDABLE( ovstring) ;
BINDABLE( setfillcol) ;
BINDABLE( showcpos) ;
BBINDABLE( twiddle) ;
BINDABLE( quote) ;
BINDABLE( insert_tab) ;
BINDABLE( detab) ;
BINDABLE( entab) ;
BINDABLE( trim) ;
BINDABLE( openline) ;
BINDABLE( insert_newline) ;
BINDABLE( deblank) ;
BINDABLE( indent) ;
BINDABLE( forwdel) ;
BINDABLE( backdel) ;
BINDABLE( killtext) ;
BINDABLE( setemode) ;
BINDABLE( delmode) ;
BINDABLE( setgmode) ;
BINDABLE( delgmode) ;
BINDABLE( istring) ;
BINDABLE( ovstring) ;
#endif
/* end of random.h */

View File

@ -4,14 +4,13 @@
#include "line.h"
/*
* The starting position of a region, and the size of the region in
* characters, is kept in a region structure. Used by the region commands.
/* The starting position of a region, and the size of the region in
characters, is kept in a region structure. Used by the region commands.
*/
typedef struct {
line_p r_linep ; /* Origin struct line address. */
int r_offset ; /* Origin struct line offset. */
long r_size ; /* Length in characters. */
line_p r_linep ; /* Origin struct line address. */
int r_offset ; /* Origin struct line offset. */
long r_size ; /* Length in characters. */
} region_t ;
typedef region_t *region_p ;
@ -25,5 +24,4 @@ BINDABLE( upperregion) ;
int getregion( region_p rp) ;
#endif
/* end of region.h */

View File

@ -1,20 +1,23 @@
/* retcode.h -- */
#ifndef __RETCODE_H__
#define __RETCODE_H__
#ifdef FALSE
#error "FALSE shouldn't be defined"
#undef FALSE
#ifdef FALSE
# error "FALSE shouldn't be defined"
# undef FALSE
#endif
#ifdef TRUE
#error "TRUE shouldn't be defined"
#undef TRUE
#ifdef TRUE
# error "TRUE shouldn't be defined"
# undef TRUE
#endif
typedef enum {
FALSE, /* 0, false, no, bad, etc. */
TRUE /* 1, true, yes, good, etc. */
FALSE, /* 0, false, no, bad, etc. */
TRUE /* 1, true, yes, good, etc. */
} boolean ;
#define ABORT 2 /* 2, death, ^G, abort, etc. */
#define ABORT 2 /* 2, death, ^G, abort, etc. */
#endif
/* end of retcode.h */

View File

@ -1,40 +1,38 @@
/* search.h -- */
#ifndef _SEARCH_H_
#define _SEARCH_H_
#define MAGIC 1 /* include regular expression matching? */
#include "line.h" /* line_p */
#include "names.h" /* BINDABLE() */
#include "line.h"
typedef char spat_t[ 128] ; /* search pattern type */
#define NPAT sizeof( spat_t) /* # of bytes, pattern */
typedef char spat_t[ 128] ; /* search pattern type */
#define NPAT sizeof( spat_t) /* # of bytes, pattern */
extern unsigned int matchlen ;
extern char *patmatch ;
extern spat_t pat ; /* Search pattern */
extern spat_t tap ; /* Reversed pattern array. */
extern spat_t rpat ; /* replacement pattern */
extern spat_t pat ; /* Search pattern */
extern spat_t tap ; /* Reversed pattern array. */
extern spat_t rpat ; /* replacement pattern */
/*
* PTBEG, PTEND, FORWARD, and REVERSE are all toggle-able values for
* the scan routines.
*/
#define PTBEG 0 /* Leave the point at the beginning on search */
#define PTEND 1 /* Leave the point at the end on search */
#define FORWARD 0 /* forward direction */
#define REVERSE 1 /* backwards direction */
#define PTBEG 0 /* Leave the point at the beginning on search */
#define PTEND 1 /* Leave the point at the end on search */
#define FORWARD 0 /* forward direction */
#define REVERSE 1 /* backwards direction */
int scanner( const char *patrn, int direct, int beg_or_end) ;
/* Bindable functions */
BINDABLE( forwsearch) ;
BINDABLE( forwhunt) ;
BINDABLE( backsearch) ;
BINDABLE( backhunt) ;
BINDABLE( sreplace) ;
BINDABLE( backsearch) ;
BINDABLE( forwhunt) ;
BINDABLE( forwsearch) ;
BINDABLE( qreplace) ;
BINDABLE( sreplace) ;
int eq( unsigned char bc, unsigned char pc) ;
void savematch( void) ;
@ -45,11 +43,11 @@ int boundary( line_p curline, int curoff, int dir) ;
void setprompt( char *tpat, unsigned tpat_size, char *prompt, char *apat) ;
#define MAGIC 1 /* include regular expression matching? */
#if MAGIC
void mcclear( void) ;
void rmcclear( void) ;
#endif
#endif
/* end of search.h */

View File

@ -1,6 +1,8 @@
/* spawn.h -- various operating system access commands */
#ifndef _SPAWN_H_
#define _SPAWN_H_
#include "names.h"
#include "names.h" /* BINDABLE() */
/* Bindable functions */
BINDABLE( spawncli) ;
@ -12,4 +14,5 @@ BINDABLE( filter_buffer) ;
void rtfrmshell( void) ;
#endif
/* end of spawn.h */

View File

@ -1,14 +1,12 @@
/* terminal.h -- */
#ifndef __TERMINAL_H__
#define __TERMINAL_H__
#include "defines.h" /* COLOR, SCROLLCODE */
#include "defines.h" /* COLOR, SCROLLCODE */
#include "retcode.h"
#include "utf8.h"
/*
* The editor communicates with the display using a high level interface. A
/* The editor communicates with the display using a high level interface. A
* "TERM" structure holds useful variables, and indirect pointers to routines
* that do useful operations. The low level get and put routines are here too.
* This lets a terminal, in addition to having non standard commands, have
@ -17,69 +15,71 @@
* one terminal type.
*/
struct terminal {
const short t_maxrow ; /* max number of rows allowable */
const short t_maxcol ; /* max number of columns allowable */
short t_mrow ; /* max number of rows displayable */
short t_nrow ; /* current number of rows displayed */
short t_mcol ; /* max number of rows displayable */
short t_ncol ; /* current number of columns displayed */
short t_margin; /* min margin for extended lines */
short t_scrsiz; /* size of scroll region " */
int t_pause; /* # times thru update to pause */
void (*t_open)(void); /* Open terminal at the start. */
void (*t_close)(void); /* Close terminal at end. */
void (*t_kopen)(void); /* Open keyboard */
void (*t_kclose)(void); /* close keyboard */
int (*t_getchar)(void); /* Get character from keyboard. */
int (*t_putchar)( unicode_t) ; /* Put character to display. */
void (*t_flush) (void); /* Flush output buffers. */
void (*t_move)(int, int);/* Move the cursor, origin 0. */
void (*t_eeol)(void); /* Erase to end of line. */
void (*t_eeop)(void); /* Erase to end of page. */
void (*t_beep)(void); /* Beep. */
void (*t_rev)(int); /* set reverse video state */
int (*t_rez)(char *); /* change screen resolution */
#if COLOR
int (*t_setfor) (); /* set forground color */
int (*t_setback) (); /* set background color */
const short t_maxrow ; /* max number of rows allowable */
const short t_maxcol ; /* max number of columns allowable */
short t_mrow ; /* max number of rows displayable */
short t_nrow ; /* current number of rows displayed */
short t_mcol ; /* max number of rows displayable */
short t_ncol ; /* current number of columns displayed */
short t_margin; /* min margin for extended lines */
short t_scrsiz; /* size of scroll region " */
int t_pause; /* # times thru update to pause */
void (*t_open)(void); /* Open terminal at the start. */
void (*t_close)(void); /* Close terminal at end. */
void (*t_kopen)(void); /* Open keyboard */
void (*t_kclose)(void); /* close keyboard */
int (*t_getchar)(void); /* Get character from keyboard. */
int (*t_putchar)( unicode_t) ; /* Put character to display. */
void (*t_flush) (void); /* Flush output buffers. */
void (*t_move)(int, int);/* Move the cursor, origin 0. */
void (*t_eeol)(void); /* Erase to end of line. */
void (*t_eeop)(void); /* Erase to end of page. */
void (*t_beep)(void); /* Beep. */
void (*t_rev)(int); /* set reverse video state */
int (*t_rez)(char *); /* change screen resolution */
#if COLOR
int (*t_setfor) (); /* set forground color */
int (*t_setback) (); /* set background color */
#endif
#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
};
/* TEMPORARY macros for terminal I/O (to be placed in a machine
dependant place later) */
/* TEMPORARY macros for terminal I/O (to be placed in a machine dependant
place later)
*/
#define TTopen (*term.t_open)
#define TTclose (*term.t_close)
#define TTkopen (*term.t_kopen)
#define TTkclose (*term.t_kclose)
#define TTgetc (*term.t_getchar)
#define TTputc (*term.t_putchar)
#define TTflush (*term.t_flush)
#define TTmove (*term.t_move)
#define TTeeol (*term.t_eeol)
#define TTeeop (*term.t_eeop)
#define TTbeep (*term.t_beep)
#define TTrev (*term.t_rev)
#define TTrez (*term.t_rez)
#if COLOR
#define TTforg (*term.t_setfor)
#define TTbacg (*term.t_setback)
#define TTopen (*term.t_open)
#define TTclose (*term.t_close)
#define TTkopen (*term.t_kopen)
#define TTkclose (*term.t_kclose)
#define TTgetc (*term.t_getchar)
#define TTputc (*term.t_putchar)
#define TTflush (*term.t_flush)
#define TTmove (*term.t_move)
#define TTeeol (*term.t_eeol)
#define TTeeop (*term.t_eeop)
#define TTbeep (*term.t_beep)
#define TTrev (*term.t_rev)
#define TTrez (*term.t_rez)
#if COLOR
#define TTforg (*term.t_setfor)
#define TTbacg (*term.t_setback)
#endif
/* Terminal table defined only in term.c */
extern struct terminal term ;
extern int ttrow ; /* Row location of HW cursor */
extern int ttcol ; /* Column location of HW cursor */
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 revexist ; /* does reverse video exist? */
extern boolean sgarbf ; /* State of screen unknown */
extern boolean eolexist ; /* does clear to EOL exist? */
extern boolean revexist ; /* does reverse video exist? */
extern boolean sgarbf ; /* State of screen unknown */
extern char sres[] ; /* Current screen resolution. */
/* NORMAL, CGA, EGA, VGA */
extern char sres[] ; /* Current screen resolution. */
/* NORMAL, CGA, EGA, VGA */
#endif
/* end of terminal.h */

View File

@ -1,14 +1,15 @@
/* termio.h -- */
#ifndef _TERMIO_H_
#define _TERMIO_H_
#include "utf8.h"
#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) */
#define HUGE 1000 /* Huge number (for row/col) */
extern int ttrow ; /* Row location of HW cursor */
extern int ttcol ; /* Column location of HW cursor */
extern int ttrow ; /* Row location of HW cursor */
extern int ttcol ; /* Column location of HW cursor */
void ttopen( void) ;
void ttclose( void) ;
@ -18,3 +19,4 @@ int ttgetc( void) ;
int typahead( void) ;
#endif
/* end of termio.h */

6
utf8.h
View File

@ -1,5 +1,6 @@
#ifndef UTF8_H
#define UTF8_H
/* utf8.h -- */
#ifndef _UTF8_H_
#define _UTF8_H_
typedef unsigned int unicode_t ;
@ -10,3 +11,4 @@ unsigned utf8_revdelta( unsigned char *buf, unsigned pos) ;
unsigned unicode_to_utf8( unicode_t c, char *utf8) ;
#endif
/* end of utf8.h */

7
util.h
View File

@ -1,9 +1,10 @@
/* util.h -- utility functions */
#ifndef UTIL_H_
# define UTIL_H_
#ifndef _UTIL_H_
#define _UTIL_H_
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
void mystrscpy( char *dst, const char *src, int size) ;
#endif /* UTIL_H_ */
#endif
/* end of util.h */

View File

@ -1,16 +1,18 @@
#ifndef VERSION_H_
#define VERSION_H_
/* version.h -- name and version strings */
#ifndef _VERSION_H_
#define _VERSION_H_
#ifdef PROGRAM
# define _QUOTE( s) #s
# define QUOTE( s) _QUOTE( s)
# define PROGRAM_NAME QUOTE(PROGRAM)
#else
# define PROGRAM_NAME "em"
# define PROGRAM_NAME "ue"
#endif
#define PROGRAM_NAME_UTF8 "µEMACS"
#define VERSION "4.2.4"
#define VERSION "4.2.5"
#endif /* VERSION_H_ */
#endif
/* end of version.h */

View File

@ -2,9 +2,9 @@
#ifndef _WINDOW_H_
#define _WINDOW_H_
#include "defines.h" /* COLOR, SCROLLCODE */
#include "buffer.h" /* buffer_p, line_p */
#include "names.h" /* BINDABLE() */
#include "defines.h" /* COLOR, SCROLLCODE */
#include "buffer.h" /* buffer_p, line_p */
#include "names.h" /* BINDABLE() */
/* There is a window structure allocated for every active display window.
The windows are kept in a big list, in top to bottom screen order, with
@ -15,40 +15,40 @@
every input character.
*/
typedef struct window {
struct window *w_wndp; /* Next window */
buffer_p w_bufp ; /* Buffer displayed in window */
line_p w_linep ; /* Top line in the window */
line_p w_dotp ; /* Line containing "." */
line_p w_markp ; /* Line containing "mark" */
int w_doto ; /* Byte offset for "." */
int w_marko ; /* Byte offset for "mark" */
int w_toprow ; /* Origin 0 top row of window */
int w_ntrows ; /* # of rows of text in window */
char w_force ; /* If NZ, forcing row. */
char w_flag ; /* Flags. */
# if COLOR
char w_fcolor ; /* current forground color */
char w_bcolor ; /* current background color */
# endif
struct window *w_wndp; /* Next window */
buffer_p w_bufp ; /* Buffer displayed in window */
line_p w_linep ; /* Top line in the window */
line_p w_dotp ; /* Line containing "." */
line_p w_markp ; /* Line containing "mark" */
int w_doto ; /* Byte offset for "." */
int w_marko ; /* Byte offset for "mark" */
int w_toprow ; /* Origin 0 top row of window */
int w_ntrows ; /* # of rows of text in window */
char w_force ; /* If NZ, forcing row. */
char w_flag ; /* Flags. */
#if COLOR
char w_fcolor ; /* current forground color */
char w_bcolor ; /* current background color */
#endif
} *window_p ;
extern window_p curwp ; /* Current window */
extern window_p wheadp ; /* Head of list of windows */
extern window_p curwp ; /* Current window */
extern window_p wheadp ; /* Head of list of windows */
/* curwbyte return the byte after the dot in current window */
#define curwbyte() lgetc( curwp->w_dotp, curwp->w_doto)
#define WFFORCE 0x01 /* Window needs forced reframe */
#define WFMOVE 0x02 /* Movement from line to line */
#define WFEDIT 0x04 /* Editing within a line */
#define WFHARD 0x08 /* Better to a full display */
#define WFMODE 0x10 /* Update mode line. */
#define WFCOLR 0x20 /* Needs a color change */
#define WFFORCE 0x01 /* Window needs forced reframe */
#define WFMOVE 0x02 /* Movement from line to line */
#define WFEDIT 0x04 /* Editing within a line */
#define WFHARD 0x08 /* Better to a full display */
#define WFMODE 0x10 /* Update mode line. */
#define WFCOLR 0x20 /* Needs a color change */
# if SCROLLCODE
# define WFKILLS 0x40 /* something was deleted */
# define WFINS 0x80 /* something was inserted */
# endif
#if SCROLLCODE
# define WFKILLS 0x40 /* something was deleted */
# define WFINS 0x80 /* something was inserted */
#endif
/* Bindable functions */
BINDABLE( delwind) ;

1
word.h
View File

@ -21,5 +21,4 @@ BINDABLE( killpara) ;
BINDABLE( wordcount) ;
#endif
/* end of word.h */

View File

@ -1,10 +1,12 @@
/* wrapper.h -- */
#ifndef WRAPPER_H_
#define WRAPPER_H_
#include <stdlib.h>
#include <stdlib.h> /* size_t */
void xmkstemp( char *fname_template) ;
void *xmalloc( size_t size) ;
#endif /* WRAPPER_H_ */
#endif
/* end of wrapper.h */